• Marc Dionne's avatar
    afs: Fix possible oops in afs_lookup trace event · 3f668583
    Marc Dionne authored
    [ Upstream commit c4c613ff ]
    
    The afs_lookup trace event can cause the following:
    
    [  216.576777] BUG: kernel NULL pointer dereference, address: 000000000000023b
    [  216.576803] #PF: supervisor read access in kernel mode
    [  216.576813] #PF: error_code(0x0000) - not-present page
    ...
    [  216.576913] RIP: 0010:trace_event_raw_event_afs_lookup+0x9e/0x1c0 [kafs]
    
    If the inode from afs_do_lookup() is an error other than ENOENT, or if it
    is ENOENT and afs_try_auto_mntpt() returns an error, the trace event will
    try to dereference the error pointer as a valid pointer.
    
    Use IS_ERR_OR_NULL to only pass a valid pointer for the trace, or NULL.
    
    Ideally the trace would include the error value, but for now just avoid
    the oops.
    
    Fixes: 80548b03 ("afs: Add more tracepoints")
    Signed-off-by: default avatarMarc Dionne <marc.dionne@auristor.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    3f668583
Name
Last commit
Last update
Documentation Loading commit data...
LICENSES Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.clang-format Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...