Skip to content

Commit 642fe4d

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
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]
1 parent 0e4a43e commit 642fe4d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎net/sunrpc/rpc_pipe.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,14 +1152,19 @@ static void rpc_kill_sb(struct super_block *sb)
11521152
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
11531153

11541154
mutex_lock(&sn->pipefs_sb_lock);
1155+
if (sn->pipefs_sb != sb) {
1156+
mutex_unlock(&sn->pipefs_sb_lock);
1157+
goto out;
1158+
}
11551159
sn->pipefs_sb = NULL;
11561160
mutex_unlock(&sn->pipefs_sb_lock);
1157-
put_net(net);
11581161
dprintk("RPC: sending pipefs UMOUNT notification for net %p%s\n",
11591162
net, NET_NAME(net));
11601163
blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
11611164
RPC_PIPEFS_UMOUNT,
11621165
sb);
1166+
put_net(net);
1167+
out:
11631168
kill_litter_super(sb);
11641169
}
11651170

0 commit comments

Comments
 (0)