]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFSD: Prevent a possible oops in the nfs_dirent() tracepoint
authorChuck Lever <chuck.lever@oracle.com>
Fri, 25 Jun 2021 15:12:49 +0000 (11:12 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 7 Jul 2021 00:14:44 +0000 (20:14 -0400)
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: 01888e035498 ("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>
fs/nfsd/trace.h

index 10cc3aaf1089e3398b920bc5826865a7259ce558..adaec43548d11f32310bd319d6a195c6f8bbcf33 100644 (file)
@@ -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,