Message ID | 173466889807.11072.9460940011488391036@noble.neil.brown.name (mailing list archive) |
---|---|
State | Under Review |
Headers | show |
Series | nfsd: restore callback functionality for NFSv4.0 | expand |
On Fri, 2024-12-20 at 15:28 +1100, NeilBrown wrote: > 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: 1e02c641c3a4 ("NFSD: Prevent NULL dereference in nfsd4_process_cb_update()") > Signed-off-by: NeilBrown <neilb@suse.de> > --- > fs/nfsd/nfs4callback.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c > index 4ea99c47cd9d..e4a1d2d9b24a 100644 > --- a/fs/nfsd/nfs4callback.c > +++ b/fs/nfsd/nfs4callback.c > @@ -1135,7 +1135,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c > args.authflavor = clp->cl_cred.cr_flavor; > clp->cl_cb_ident = conn->cb_ident; > } else { > - if (!conn->cb_xprt) > + if (!conn->cb_xprt || !ses) > return -EINVAL; > clp->cl_cb_session = ses; > args.bc_xprt = conn->cb_xprt; > @@ -1557,8 +1557,6 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) > ses = c->cn_session; > } > spin_unlock(&clp->cl_lock); > - if (!c) > - return; > > err = setup_callback_client(clp, &conn, ses); > if (err) { > > base-commit: 8d5b7358ea7c07b69c44f0af21ebc79a49cf12a3 Reviewed-by: Jeff Layton <jlayton@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com> On Fri, 20 Dec 2024 15:28:18 +1100, NeilBrown wrote: > 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() > > [...] Applied to nfsd-fixed for v6.13, thanks! [1/1] nfsd: restore callback functionality for NFSv4.0 commit: 7917f01a286ce01e9c085e24468421f596ee1a0c -- Chuck Lever
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 4ea99c47cd9d..e4a1d2d9b24a 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -1135,7 +1135,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c args.authflavor = clp->cl_cred.cr_flavor; clp->cl_cb_ident = conn->cb_ident; } else { - if (!conn->cb_xprt) + if (!conn->cb_xprt || !ses) return -EINVAL; clp->cl_cb_session = ses; args.bc_xprt = conn->cb_xprt; @@ -1557,8 +1557,6 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) ses = c->cn_session; } spin_unlock(&clp->cl_lock); - if (!c) - return; err = setup_callback_client(clp, &conn, ses); if (err) {
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: 1e02c641c3a4 ("NFSD: Prevent NULL dereference in nfsd4_process_cb_update()") Signed-off-by: NeilBrown <neilb@suse.de> --- fs/nfsd/nfs4callback.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) base-commit: 8d5b7358ea7c07b69c44f0af21ebc79a49cf12a3