]> git.hungrycats.org Git - linux/commit
cifs: prevent use-after-free by freeing the cfile later
authorShyam Prasad N <sprasad@microsoft.com>
Thu, 22 Jun 2023 18:16:03 +0000 (18:16 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:51 +0000 (19:39 +0200)
commitb6353518ef8180816e863aa23b06456f395404d6
tree87a172271090ff7b0ef250d2b4a6f2a4727087c5
parent1df929db46b8f15dce5adafc2e62f88395fd8755
cifs: prevent use-after-free by freeing the cfile later

[ Upstream commit 33f736187d08f6bc822117629f263b97d3df4165 ]

In smb2_compound_op we have a possible use-after-free
which can cause hard to debug problems later on.

This was revealed during stress testing with KASAN enabled
kernel. Fixing it by moving the cfile free call to
a few lines below, after the usage.

Fixes: 76894f3e2f71 ("cifs: improve symlink handling for smb2+")
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/smb2inode.c