• David Howells's avatar
    afs: Fix leak in afs_lookup_cell_rcu() · c231241d
    David Howells authored
    [ Upstream commit a5fb8e6c ]
    
    Fix a leak on the cell refcount in afs_lookup_cell_rcu() due to
    non-clearance of the default error in the case a NULL cell name is passed
    and the workstation default cell is used.
    
    Also put a bit at the end to make sure we don't leak a cell ref if we're
    going to be returning an error.
    
    This leak results in an assertion like the following when the kafs module is
    unloaded:
    
    	AFS: Assertion failed
    	2 == 1 is false
    	0x2 == 0x1 is false
    	------------[ cut here ]------------
    	kernel BUG at fs/afs/cell.c:770!
    	...
    	RIP: 0010:afs_manage_cells+0x220/0x42f [kafs]
    	...
    	 process_one_work+0x4c2/0x82c
    	 ? pool_mayday_timeout+0x1e1/0x1e1
    	 ? do_raw_spin_lock+0x134/0x175
    	 worker_thread+0x336/0x4a6
    	 ? rescuer_thread+0x4af/0x4af
    	 kthread+0x1de/0x1ee
    	 ? kthread_park+0xd4/0xd4
    	 ret_from_fork+0x24/0x30
    
    Fixes: 989782dc ("afs: Overhaul cell database management")
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    c231241d
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...