]> git.baikalelectronics.ru Git - kernel.git/commitdiff
exfat: fix possible memory leak in exfat_find()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 6 May 2020 14:25:54 +0000 (14:25 +0000)
committerNamjae Jeon <namjae.jeon@samsung.com>
Mon, 18 May 2020 02:51:44 +0000 (11:51 +0900)
'es' is malloced from exfat_get_dentry_set() in exfat_find() and should
be freed before leaving from the error handling cases, otherwise it will
cause memory leak.

Fixes: 3ba778edcf48 ("exfat: add inode operations")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
fs/exfat/namei.c

index b72d782568b811ece222db0dd3575fd8bf2c958a..a2659a8a68a14273eeff16dd467d771ebe038b43 100644 (file)
@@ -692,6 +692,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
                        exfat_fs_error(sb,
                                "non-zero size file starts with zero cluster (size : %llu, p_dir : %u, entry : 0x%08x)",
                                i_size_read(dir), ei->dir.dir, ei->entry);
+                       kfree(es);
                        return -EIO;
                }