Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-06-01 Thread Casey Schaufler
On 6/1/2018 9:29 AM, CHANDAN VN wrote: >>>  I agree that the fix can be done simply by using "false" for  >>>  smack_inode_getsecurity(), but what happens with kernfs_node_setsecdata() >>>  and smack_inode_notifysecctx(). kernfs_node_setsecdata() is probably  >>> ignorable >>>  but smack_inode_noti

RE: Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-06-01 Thread CHANDAN VN
>> I agree that the fix can be done simply by using "false" for  >> smack_inode_getsecurity(), but what happens with kernfs_node_setsecdata() >> and smack_inode_notifysecctx(). kernfs_node_setsecdata() is probably  >>ignorable >> but smack_inode_notifysecctx() is sending the "ctx" to  >>smack_ino

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-06-01 Thread Casey Schaufler
On 6/1/2018 1:56 AM, CHANDAN VN wrote: > Hi >   > >> On 5/31/2018 9:11 AM, Tejun Heo wrote: >>  On Thu, May 31, 2018 at 09:04:25AM -0700, Casey Schaufler wrote:  On 5/31/2018 8:39 AM, Tejun Heo wrote: >  (cc'ing more security folks and copying whole body) > >  So, I'm sure the patc

RE: Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-06-01 Thread CHANDAN VN
Hi   >On 5/31/2018 9:11 AM, Tejun Heo wrote: > On Thu, May 31, 2018 at 09:04:25AM -0700, Casey Schaufler wrote: >>> On 5/31/2018 8:39 AM, Tejun Heo wrote:  (cc'ing more security folks and copying whole body)  So, I'm sure the patch fixes the memory leak but API wise it looks  supe

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread Casey Schaufler
On 5/31/2018 1:57 PM, Eric W. Biederman wrote: > Casey Schaufler writes: > >> On 5/31/2018 2:28 AM, CHANDAN VN wrote: >>> From: "sireesha.t" >>> >>> Leak is caused because smack_inode_getsecurity() is allocating memory >>> using kstrdup(). Though the security_release_secctx() is called, it >>> wo

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread Eric W. Biederman
Casey Schaufler writes: > On 5/31/2018 2:28 AM, CHANDAN VN wrote: >> From: "sireesha.t" >> >> Leak is caused because smack_inode_getsecurity() is allocating memory >> using kstrdup(). Though the security_release_secctx() is called, it >> would not free the allocated memory. Calling security_rele

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread Casey Schaufler
On 5/31/2018 9:11 AM, Tejun Heo wrote: > On Thu, May 31, 2018 at 09:04:25AM -0700, Casey Schaufler wrote: >> On 5/31/2018 8:39 AM, Tejun Heo wrote: >>> (cc'ing more security folks and copying whole body) >>> >>> So, I'm sure the patch fixes the memory leak but API wise it looks >>> super confusing.

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread Tejun Heo
On Thu, May 31, 2018 at 09:04:25AM -0700, Casey Schaufler wrote: > On 5/31/2018 8:39 AM, Tejun Heo wrote: > > (cc'ing more security folks and copying whole body) > > > > So, I'm sure the patch fixes the memory leak but API wise it looks > > super confusing. Can security folks chime in here? Is th

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread Casey Schaufler
On 5/31/2018 8:39 AM, Tejun Heo wrote: > (cc'ing more security folks and copying whole body) > > So, I'm sure the patch fixes the memory leak but API wise it looks > super confusing. Can security folks chime in here? Is this the right > fix? security_inode_getsecctx() provides a security context

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread Tejun Heo
(cc'ing more security folks and copying whole body) So, I'm sure the patch fixes the memory leak but API wise it looks super confusing. Can security folks chime in here? Is this the right fix? Thanks. On Thu, May 31, 2018 at 02:58:31PM +0530, CHANDAN VN wrote: > From: "sireesha.t" > > Leak i

Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread Casey Schaufler
On 5/31/2018 2:28 AM, CHANDAN VN wrote: > From: "sireesha.t" > > Leak is caused because smack_inode_getsecurity() is allocating memory > using kstrdup(). Though the security_release_secctx() is called, it > would not free the allocated memory. Calling security_release_secctx is > not relevant for

[PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

2018-05-31 Thread CHANDAN VN
From: "sireesha.t" Leak is caused because smack_inode_getsecurity() is allocating memory using kstrdup(). Though the security_release_secctx() is called, it would not free the allocated memory. Calling security_release_secctx is not relevant for this scenario as inode_getsecurity() does not provi