]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
afs: Fix potential null pointer dereference in afs_put_server
authorZhen Ni <zhen.ni@easystack.cn>
Tue, 23 Sep 2025 07:51:04 +0000 (15:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Oct 2025 11:40:41 +0000 (13:40 +0200)
commit7b8381f3c405b864a814d747e526e078c3ef4bc2
tree6dc33ad442d485383aa8a6a273745946f56f99a0
parent07b1f63b5f86765793fab44d3d4c2be681cddafb
afs: Fix potential null pointer dereference in afs_put_server

commit 9158c6bb245113d4966df9b2ba602197a379412e upstream.

afs_put_server() accessed server->debug_id before the NULL check, which
could lead to a null pointer dereference. Move the debug_id assignment,
ensuring we never dereference a NULL server pointer.

Fixes: 2757a4dc1849 ("afs: Fix access after dec in put functions")
Cc: stable@vger.kernel.org
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Acked-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/afs/server.c