Skip to content

Commit

Permalink
NFSD: Prevent a possible oops in the nfs_dirent() tracepoint
Browse files Browse the repository at this point in the history
[ Upstream commit 7b08cf6 ]

The double copy of the string is a mistake, plus __assign_str()
uses strlen(), which is wrong to do on a string that isn't
guaranteed to be NUL-terminated.

Fixes: 6019ce0 ("NFSD: Add a tracepoint to record directory entry encoding")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
chucklever authored and gregkh committed Jul 20, 2021
1 parent e8a8bb8 commit 7605bff
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/nfsd/trace.h
Expand Up @@ -408,7 +408,6 @@ TRACE_EVENT(nfsd_dirent,
__entry->ino = ino;
__entry->len = namlen;
memcpy(__get_str(name), name, namlen);
__assign_str(name, name);
),
TP_printk("fh_hash=0x%08x ino=%llu name=%.*s",
__entry->fh_hash, __entry->ino,
Expand Down

0 comments on commit 7605bff

Please sign in to comment.