diff mbox series

NFSD: Fix trace_nfsd_fh_verify_err() crasher

Message ID 166828356768.42842.2412588018662481301.stgit@klimt.1015granger.net (mailing list archive)
State New, archived
Headers show
Series NFSD: Fix trace_nfsd_fh_verify_err() crasher | expand

Commit Message

Chuck Lever Nov. 12, 2022, 8:06 p.m. UTC
Now that the nfsd_fh_verify_err() tracepoint is always called on
error, it needs to handle cases where the filehandle is not yet
fully formed.

Fixes: 93c128e709ae ("nfsd: ensure we always call fh_verify_error tracepoint")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jeff Layton Nov. 14, 2022, 11:35 a.m. UTC | #1
On Sat, 2022-11-12 at 15:06 -0500, Chuck Lever wrote:
> Now that the nfsd_fh_verify_err() tracepoint is always called on
> error, it needs to handle cases where the filehandle is not yet
> fully formed.
> 
> Fixes: 93c128e709ae ("nfsd: ensure we always call fh_verify_error tracepoint")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/trace.h |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
> index ef01ecd3eec6..331a33a8f1f8 100644
> --- a/fs/nfsd/trace.h
> +++ b/fs/nfsd/trace.h
> @@ -254,7 +254,10 @@ TRACE_EVENT_CONDITION(nfsd_fh_verify_err,
>  				  rqstp->rq_xprt->xpt_remotelen);
>  		__entry->xid = be32_to_cpu(rqstp->rq_xid);
>  		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
> -		__entry->inode = d_inode(fhp->fh_dentry);
> +		if (fhp->fh_dentry)
> +			__entry->inode = d_inode(fhp->fh_dentry);
> +		else
> +			__entry->inode = NULL;
>  		__entry->type = type;
>  		__entry->access = access;
>  		__entry->error = be32_to_cpu(error);
> 

Doh!

Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff mbox series

Patch

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index ef01ecd3eec6..331a33a8f1f8 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -254,7 +254,10 @@  TRACE_EVENT_CONDITION(nfsd_fh_verify_err,
 				  rqstp->rq_xprt->xpt_remotelen);
 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
-		__entry->inode = d_inode(fhp->fh_dentry);
+		if (fhp->fh_dentry)
+			__entry->inode = d_inode(fhp->fh_dentry);
+		else
+			__entry->inode = NULL;
 		__entry->type = type;
 		__entry->access = access;
 		__entry->error = be32_to_cpu(error);