From: "Ahmed S. Darwish" <darwish.07@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: casey@schaufler-ca.com, paul.moore@hp.com,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Subject: Re: [PATCH BUGFIX -v2 -rc4] Smack: Respect 'unlabeled' netlabel mode
Date: Sat, 31 May 2008 04:12:42 +0300 [thread overview]
Message-ID: <20080531011242.GA7061@ubuntu> (raw)
In-Reply-To: <20080530162500.1411f14d.akpm@linux-foundation.org>
On Fri, May 30, 2008 at 04:25:00PM -0700, Andrew Morton wrote:
> On Sat, 31 May 2008 02:57:51 +0300
> "Ahmed S. Darwish" <darwish.07@gmail.com> wrote:
>
> > + mutex_lock(&smack_ambient_lock);
> > + nlsp->domain = kstrdup(smack_net_ambient, GFP_ATOMIC);
> > + mutex_unlock(&smack_ambient_lock);
>
> no no no no no. And no.
>
> GFP_ATOMIC is *unreliable*. Using it in a "security" feature is a bug
> - if it fails, the feature isn't secure any more.
>
> Failing to check the kmalloc() return value might be a bug.
>
> If we _need_ GFP_ATOMIC here then taking a mutex in a cannot-sleep
> context is a bug.
>
> The patch adds a kmalloc but doesn't add a kfree. Is it leaky?
>
> Finally, why is there a need to take a lock around a single store
> instruction?
Possibly the worst three lines written ever. GFP_ATOMIC line
was cut-and-paste forgetting to change it to GFP_KERNEL and the lock
is already useless.
--
"Better to light a candle, than curse the darkness"
Ahmed S. Darwish
Homepage: http://darwish.07.googlepages.com
Blog: http://darwish-07.blogspot.com
next prev parent reply other threads:[~2008-05-31 1:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 23:36 [PATCH BUGFIX -rc4] Smack: Respect 'unlabeled' netlabel mode Ahmed S. Darwish
2008-05-30 23:10 ` Casey Schaufler
2008-05-31 0:58 ` Ahmed S. Darwish
2008-05-31 0:37 ` Casey Schaufler
2008-05-31 13:08 ` Paul Moore
2008-05-30 23:57 ` [PATCH BUGFIX -v2 " Ahmed S. Darwish
2008-05-30 23:10 ` Tetsuo Handa
2008-05-30 23:25 ` Andrew Morton
2008-05-31 1:12 ` Ahmed S. Darwish [this message]
2008-05-30 23:45 ` Casey Schaufler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080531011242.GA7061@ubuntu \
--to=darwish.07@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul.moore@hp.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).