ocfs2: free memory allocated by security_inode_init_security
PATCH 1/1 ocfs2: free memory allocated by security_inode_init_security
The LSM security_inode_init_security() hook allocates memory for xattr name and value, expecting the caller to release the memory afterwards.
--- fs/ocfs2/xattr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/ocfs2/xattr.c +2 -0
@@ -7215,6 +7215,8 @@ int ocfs2_init_security_and_acl(struct inode *dir,ocfs2_inode_unlock (dir,0 );brelse (dir_bh); +kfree (si.name); +kfree (si.value); leave:return ret; }
Signature · 1 line
1.7.4.4
PATCH 1/1 ocfs2: free memory allocated by security_inode_init_security
Quoted 6 lines · Tiger Yang
The LSM
security_inode_init_security()hook allocates memory for xattr name and value, expecting the caller to release the memory afterwards.reported-by Mimi Zohar <[email protected]>Signed-off-by Tiger Yang <[email protected]>
Hi Tiger,
Thanks for taking a look. For the normal case, the memory is now freed, but not on failure.
thanks,
Mimi
Quoted 17 lines
--- fs/ocfs2/xattr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/ocfs2/xattr.c +2
-0@@ -7215,6 +7215,8 @@ int ocfs2_init_security_and_acl(struct inode *dir,ocfs2_inode_unlock (dir,0 );brelse (dir_bh); +kfree (si.name); +kfree (si.value); leave:return ret; }
PATCH 1/1 ocfs2: free memory allocated by security_inode_init_security
Quoted 3 lines · Mimi Zohar
Thanks for taking a look. For the normal case, the memory is now freed, but not on failure.
Hi, Mini,
Thanks point it out, I will resend the patch.
Regards,
Tiger
PATCH 1/1 ocfs2: free memory allocated by security_inode_init_security
In reply to Mimi ZoharQuoted 7 lines · Mimi Zohar
Quoted 6 lines · Tiger Yang
The LSM
security_inode_init_security()hook allocates memory for xattr name and value, expecting the caller to release the memory afterwards.reported-by Mimi Zohar<[email protected]>Signed-off-by Tiger Yang<[email protected]>
Quoted 8 lines
Hi Tiger,
Thanks for taking a look. For the normal case, the memory is now freed, but not on failure.
thanks,
Mimi
Move the frees below leave. And just to be safe, specifically init .name and .value to null while declaring.
Quoted 23 lines
Quoted 9 lines
--- fs/ocfs2/xattr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/ocfs2/xattr.c +0
-0fs/ocfs2/xattr.c int ocfs2_init_security_and_acl(struct inode *dir, · line 7222
Quoted 8 lines
fs/ocfs2/xattr.c +2
-0@@ -7215,6 +7215,8 @@ int ocfs2_init_security_and_acl(struct inode *dir,ocfs2_inode_unlock (dir,0 );brelse (dir_bh); +kfree (si.name); +kfree (si.value); leave:return ret; }_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel