Skip to content

Commit 7917f01

Browse files
neilbrownchucklever
authored andcommitted
nfsd: restore callback functionality for NFSv4.0
A recent patch inadvertently broke callbacks for NFSv4.0. In the 4.0 case we do not expect a session to be found but still need to call setup_callback_client() which will not try to dereference it. This patch moves the check for failure to find a session into the 4.1+ branch of setup_callback_client() Fixes: 1e02c64 ("NFSD: Prevent NULL dereference in nfsd4_process_cb_update()") Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 9048cf0 commit 7917f01

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/nfsd/nfs4callback.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
11001100
args.authflavor = clp->cl_cred.cr_flavor;
11011101
clp->cl_cb_ident = conn->cb_ident;
11021102
} else {
1103-
if (!conn->cb_xprt)
1103+
if (!conn->cb_xprt || !ses)
11041104
return -EINVAL;
11051105
clp->cl_cb_session = ses;
11061106
args.bc_xprt = conn->cb_xprt;
@@ -1522,8 +1522,6 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
15221522
ses = c->cn_session;
15231523
}
15241524
spin_unlock(&clp->cl_lock);
1525-
if (!c)
1526-
return;
15271525

15281526
err = setup_callback_client(clp, &conn, ses);
15291527
if (err) {

0 commit comments

Comments
 (0)