[lvc-project] [PATCH 5.10] ubifs: fix possible dereference after free

Andrey Tsygunka aitsygunka at yandex.ru
Thu Oct 17 09:09:08 MSK 2024


From: Konstantin Meskhidze <konstantin.meskhidze at huawei.com>

commit d81efd66106c03771ffc8637855a6ec24caa6350 upstream.

'old_idx' could be dereferenced after free via 'rb_link_node' function
call.

Fixes: b5fda08ef213 ("ubifs: Fix memleak when insert_old_idx() failed")
Co-developed-by: Ivanov Mikhail <ivanov.mikhail1 at huawei-partners.com>
Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze at huawei.com>
Reviewed-by: Zhihao Cheng <chengzhihao1 at huawei.com>
Signed-off-by: Richard Weinberger <richard at nod.at>
Signed-off-by: Andrey Tsygunka <aitsygunka at yandex.ru>
---
 fs/ubifs/tnc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 2313c7174e3c..3ea96019cc7d 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -65,6 +65,7 @@ static void do_insert_old_idx(struct ubifs_info *c,
 		else {
 			ubifs_err(c, "old idx added twice!");
 			kfree(old_idx);
+			return;
 		}
 	}
 	rb_link_node(&old_idx->rb, parent, p);
-- 
2.25.1




More information about the lvc-project mailing list