[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b0b157a-0e8c-d8f5-901e-836d545a8e4c@schaufler-ca.com>
Date: Fri, 1 Jun 2018 09:41:39 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: chandan.vn@...sung.com,
"linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>
Cc: Tejun Heo <tj@...nel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"bfields@...ldses.org" <bfields@...ldses.org>,
"jlayton@...nel.org" <jlayton@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
CPGS <cpgs@...sung.com>,
Sireesha Talluri <sireesha.t@...sung.com>,
Chris Wright <chrisw@...s-sol.org>,
Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and
kernfs_security_xattr_set
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_notifysecctx() is sending the "ctx" to smack_inode_setsecurity()
>>> and since "ctx" would be NULL because we used "false", smack_inode_setsecurity()
>>> becomes dummy.
>
>> Thank you for pointing this out. You're right, there's more
>> at issue here than changing the alloc flag will fix. I think
>> that calling smack_inode_getsecurity() from smack_inode_getsecctx()
>> is making the code more complicated than it needs to be. I will
>> have a patch shortly.
> If you think the patch would take time or is complicated, I suggest that the kfree() fix should go
> to fix the leaks for now.
Heavens no! The patch is very simple. I'm building a kernel with
it now, and should have it tested and posted within a few hours.
The implementation of smack_inode_getsecctx() that's there is
understandable, but wrong. There's a much better way to do the
job.
Powered by blists - more mailing lists