linux-stable/fs/afs
David Howells 65c24caf1b afs: Fix dynamic root getattr
[ Upstream commit cb78d1b5ef ]

The recent patch to make afs_getattr consult the server didn't account
for the pseudo-inodes employed by the dynamic root-type afs superblock
not having a volume or a server to access, and thus an oops occurs if
such a directory is stat'd.

Fix this by checking to see if the vnode->volume pointer actually points
anywhere before following it in afs_getattr().

This can be tested by stat'ing a directory in /afs.  It may be
sufficient just to do "ls /afs" and the oops looks something like:

        BUG: kernel NULL pointer dereference, address: 0000000000000020
        ...
        RIP: 0010:afs_getattr+0x8b/0x14b
        ...
        Call Trace:
         <TASK>
         vfs_statx+0x79/0xf5
         vfs_fstatat+0x49/0x62

Fixes: 2aeb8c86d4 ("afs: Fix afs_getattr() to refetch file status if callback break occurred")
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
Tested-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/165408450783.1031787.7941404776393751186.stgit@warthog.procyon.org.uk/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-07-02 16:27:33 +02:00
..
addr_list.c Merge branch 'afs-proc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-06-16 16:32:04 +09:00
afs.h afs: Rearrange status mapping 2018-04-09 21:53:59 +01:00
afs_cm.h
afs_fs.h afs: Prospectively look up extra files when doing a single lookup 2018-04-09 21:12:31 +01:00
afs_vl.h
cache.c fscache: Pass object size in rather than calling back for it 2018-04-06 14:05:14 +01:00
callback.c afs: Fix lock-wait/callback-break double locking 2020-01-27 14:50:49 +01:00
cell.c afs: Fix characters allowed into cell names 2020-01-29 16:43:18 +01:00
cmservice.c afs: Fix the CB.ProbeUuid service handler to reply correctly 2019-09-06 10:21:54 +02:00
dir.c afs: Fix infinite loop found by xfstest generic/676 2022-06-14 16:59:34 +02:00
dir_edit.c afs: Remove set but not used variables 'before', 'after' 2020-01-27 14:51:22 +01:00
dynroot.c afs: Fix NULL deref in afs_dynroot_depopulate() 2020-08-26 10:31:05 +02:00
file.c afs: Fix key leak in afs_release() and afs_evict_inode() 2020-01-27 14:50:48 +01:00
flock.c afs: Fix lock-wait/callback-break double locking 2020-01-27 14:50:49 +01:00
fsclient.c Merge branch 'afs-proc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-06-16 16:32:04 +09:00
inode.c afs: Fix dynamic root getattr 2022-07-02 16:27:33 +02:00
internal.h afs: Fix uninitialised spinlock afs_volume::cb_break_lock 2019-07-21 09:03:06 +02:00
Kconfig
main.c afs: Fix an IS_ERR() vs NULL check 2021-06-30 08:48:14 -04:00
Makefile afs: Handle CONFIG_PROC_FS=n 2018-06-15 00:52:55 -04:00
misc.c
mntpt.c afs: Support the AFS dynamic root 2018-02-06 14:43:37 +00:00
netdevices.c afs: Implement network namespacing 2018-05-23 12:01:15 +01:00
proc.c afs: Fix memory leak in afs_put_sysnames() 2020-06-25 15:33:04 +02:00
rotate.c rxrpc: Fix handling of call quietly cancelled out on server 2018-06-04 16:06:26 -04:00
rxrpc.c afs: Fix some tracing details 2020-04-02 15:28:19 +02:00
security.c afs: Fix double inc of vnode->cb_break 2020-01-27 14:50:49 +01:00
server.c afs: Fix afs_find_server lookups for ipv4 peers 2020-01-09 10:18:55 +01:00
server_list.c afs: Fix refcounting in callback registration 2018-05-14 13:17:35 +01:00
super.c afs: Fix large file support 2020-01-27 14:51:20 +01:00
vlclient.c afs: Fix loop index mixup in afs_deliver_vl_get_entry_by_name_u() 2019-09-06 10:21:54 +02:00
volume.c afs: Fix uninitialised spinlock afs_volume::cb_break_lock 2019-07-21 09:03:06 +02:00
write.c afs: afs_write_end() should change i_size under the right lock 2020-06-25 15:33:06 +02:00
xattr.c afs: Fix the afs.cell and afs.volume xattr handlers 2020-01-27 14:50:45 +01:00
xdr_fs.h afs: Adjust the directory XDR structures 2018-04-09 21:54:48 +01:00