diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-08 10:01:26 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-08 14:53:28 -0500 |
commit | 642fe4d00db56d65060ce2fd4c105884414acb16 (patch) | |
tree | 49d4b27e67b129dec2b1c102af9e6365466880c3 /net/sunrpc/rpc_pipe.c | |
parent | 0e4a43ed08e2f44aa7b96aa95d0a540d675483e1 (diff) |
SUNRPC: Fix validity issues with rpc_pipefs sb->s_fs_info
rpc_kill_sb() must defer calling put_net() until after the notifier
has been called, since most (all?) of the notifier callbacks assume
that sb->s_fs_info points to a valid net namespace. It also must not
call put_net() if the call to rpc_fill_super was unsuccessful.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=48421
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: stable@vger.kernel.org [>= v3.4]
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 80f5dd23417d..e659def77742 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -1152,14 +1152,19 @@ static void rpc_kill_sb(struct super_block *sb) | |||
1152 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | 1152 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
1153 | 1153 | ||
1154 | mutex_lock(&sn->pipefs_sb_lock); | 1154 | mutex_lock(&sn->pipefs_sb_lock); |
1155 | if (sn->pipefs_sb != sb) { | ||
1156 | mutex_unlock(&sn->pipefs_sb_lock); | ||
1157 | goto out; | ||
1158 | } | ||
1155 | sn->pipefs_sb = NULL; | 1159 | sn->pipefs_sb = NULL; |
1156 | mutex_unlock(&sn->pipefs_sb_lock); | 1160 | mutex_unlock(&sn->pipefs_sb_lock); |
1157 | put_net(net); | ||
1158 | dprintk("RPC: sending pipefs UMOUNT notification for net %p%s\n", | 1161 | dprintk("RPC: sending pipefs UMOUNT notification for net %p%s\n", |
1159 | net, NET_NAME(net)); | 1162 | net, NET_NAME(net)); |
1160 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | 1163 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
1161 | RPC_PIPEFS_UMOUNT, | 1164 | RPC_PIPEFS_UMOUNT, |
1162 | sb); | 1165 | sb); |
1166 | put_net(net); | ||
1167 | out: | ||
1163 | kill_litter_super(sb); | 1168 | kill_litter_super(sb); |
1164 | } | 1169 | } |
1165 | 1170 | ||