All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH 1/1] ocfs2: free memory allocated by security_inode_init_security
@ 2011-05-30  6:39 Tiger Yang
  2011-05-30  9:54 ` Mimi Zohar
  0 siblings, 1 reply; 4+ messages in thread
From: Tiger Yang @ 2011-05-30  6:39 UTC (permalink / raw)
  To: ocfs2-devel

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 <zohar@linux.vnet.ibm.com>
Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
---
 fs/ocfs2/xattr.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 81ecf9c..e9b031e 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -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;
 }
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] ocfs2: free memory allocated by security_inode_init_security
  2011-05-30  6:39 [Ocfs2-devel] [PATCH 1/1] ocfs2: free memory allocated by security_inode_init_security Tiger Yang
@ 2011-05-30  9:54 ` Mimi Zohar
  2011-05-31 16:44   ` Tiger Yang
  2011-05-31 17:13   ` Sunil Mushran
  0 siblings, 2 replies; 4+ messages in thread
From: Mimi Zohar @ 2011-05-30  9:54 UTC (permalink / raw)
  To: ocfs2-devel

On Mon, 2011-05-30 at 14:39 +0800, Tiger Yang wrote:
> 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 <zohar@linux.vnet.ibm.com>
> Signed-off-by: Tiger Yang <tiger.yang@oracle.com>

Hi Tiger,

Thanks for taking a look.  For the normal case, the memory is now freed,
but not on failure.

thanks,

Mimi

> ---
>  fs/ocfs2/xattr.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index 81ecf9c..e9b031e 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -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;
>  }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] ocfs2: free memory allocated by security_inode_init_security
  2011-05-30  9:54 ` Mimi Zohar
@ 2011-05-31 16:44   ` Tiger Yang
  2011-05-31 17:13   ` Sunil Mushran
  1 sibling, 0 replies; 4+ messages in thread
From: Tiger Yang @ 2011-05-31 16:44 UTC (permalink / raw)
  To: ocfs2-devel

Mimi Zohar wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] ocfs2: free memory allocated by security_inode_init_security
  2011-05-30  9:54 ` Mimi Zohar
  2011-05-31 16:44   ` Tiger Yang
@ 2011-05-31 17:13   ` Sunil Mushran
  1 sibling, 0 replies; 4+ messages in thread
From: Sunil Mushran @ 2011-05-31 17:13 UTC (permalink / raw)
  To: ocfs2-devel

On 05/30/2011 02:54 AM, Mimi Zohar wrote:
> On Mon, 2011-05-30 at 14:39 +0800, Tiger Yang wrote:
>> 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<zohar@linux.vnet.ibm.com>
>> Signed-off-by: Tiger Yang<tiger.yang@oracle.com>
> 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.

>> ---
>>   fs/ocfs2/xattr.c |    2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
>> index 81ecf9c..e9b031e 100644
>> --- a/fs/ocfs2/xattr.c
>> +++ b/fs/ocfs2/xattr.c
>> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-31 17:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-30  6:39 [Ocfs2-devel] [PATCH 1/1] ocfs2: free memory allocated by security_inode_init_security Tiger Yang
2011-05-30  9:54 ` Mimi Zohar
2011-05-31 16:44   ` Tiger Yang
2011-05-31 17:13   ` Sunil Mushran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.