]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
exfat: fix refcount leak in exfat_find
authorShuhao Fu <sfual@cse.ust.hk>
Tue, 21 Oct 2025 08:42:28 +0000 (16:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:31 +0000 (14:03 +0100)
commitd009ff8959d28d2a33aeb96a5f7e7161c421d78f
tree65ac353103e8d10b2ec73e364b305d7d15812734
parentbd4da8f59dbbccee0841479e23481bc3f3f2e696
exfat: fix refcount leak in exfat_find

[ Upstream commit 9aee8de970f18c2aaaa348e3de86c38e2d956c1d ]

Fix refcount leaks in `exfat_find` related to `exfat_get_dentry_set`.

Function `exfat_get_dentry_set` would increase the reference counter of
`es->bh` on success. Therefore, `exfat_put_dentry_set` must be called
after `exfat_get_dentry_set` to ensure refcount consistency. This patch
relocate two checks to avoid possible leaks.

Fixes: 82ebecdc74ff ("exfat: fix improper check of dentry.stream.valid_size")
Fixes: 13940cef9549 ("exfat: add a check for invalid data size")
Signed-off-by: Shuhao Fu <sfual@cse.ust.hk>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/exfat/namei.c