lkml.org 
[lkml]   [2019]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] udf: prevent memory leak in udf_new_inode
Date
In udf_new_inode if either udf_new_block or insert_inode_locked fials
the allocated memory for iinfo->i_ext.i_data should be released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
fs/udf/ialloc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index 0adb40718a5d..b8ab3acab6b6 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -86,6 +86,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
dinfo->i_location.partitionReferenceNum,
start, &err);
if (err) {
+ kfree(iinfo->i_ext.i_data);
iput(inode);
return ERR_PTR(err);
}
@@ -130,6 +131,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
iinfo->i_crtime = inode->i_mtime;
if (unlikely(insert_inode_locked(inode) < 0)) {
+ kfree(iinfo->i_ext.i_data);
make_bad_inode(inode);
iput(inode);
return ERR_PTR(-EIO);
--
2.17.1
\
 
 \ /
  Last update: 2019-09-25 23:40    [W:0.077 / U:2.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site