Skip to content
Snippets Groups Projects
Commit 8dfaad7e authored by Peter Huang's avatar Peter Huang Committed by Chung-Chiang Cheng
Browse files

Fix leak for symbolic link in exfat_lookup


While exfat_lookup() for symbolic file, we Should not alloc memory
to EXFAT_I(inode)->target since the corredspoding exfat inode info
is still is in memory and EXFAT_I(inode)->target has not released
yet. If we do so, memory leak would happen. Therefore we only alloc
it if not null.

Reviewed-by: default avatarEthan Wu <ethanwu@synology.com>
Signed-off-by: default avatarChung-Chiang Cheng <cccheng@synology.com>
parent 9a2f465c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -829,7 +829,7 @@ static struct dentry *exfat_lookup(struct inode *dir, struct dentry *dentry,
}
 
i_mode = inode->i_mode;
if (S_ISLNK(i_mode)) {
if (S_ISLNK(i_mode) && !EXFAT_I(inode)->target) {
EXFAT_I(inode)->target = kmalloc(i_size_read(inode)+1, GFP_KERNEL);
if (!EXFAT_I(inode)->target) {
err = -ENOMEM;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment