From: Andrew Morton <akpm@osdl.org>
To: James Morris <jmorris@redhat.com>
Cc: linux-kernel@vger.kernel.org, sds@epoch.ncsc.mil, selinux@tycho.nsa.gov
Subject: Re: [PATCH][SELINUX] 2/7 Add netif controls
Date: Fri, 9 Jan 2004 13:06:13 -0800 [thread overview]
Message-ID: <20040109130613.711b34a6.akpm@osdl.org> (raw)
In-Reply-To: <Xine.LNX.4.44.0401091012460.21309-100000@thoron.boston.redhat.com>
James Morris <jmorris@redhat.com> wrote:
>
> +static void sel_netif_destroy(struct sel_netif *netif)
> +{
> + DEBUGP("%s: %s\n", __FUNCTION__, netif->nsec.dev->name);
> +
> + spin_lock_bh(&sel_netif_lock);
> + list_del_rcu(&netif->list);
> + sel_netif_total--;
> + spin_unlock_bh(&sel_netif_lock);
> +
> + call_rcu(&netif->rcu_head, sel_netif_free, netif);
> +}
> +
> +void sel_netif_put(struct sel_netif *netif)
> +{
> + if (atomic_dec_and_test(&netif->users))
> + sel_netif_destroy(netif);
> +}
This seems racy. If the netif is still eligible for lookup on entry to
sel_netif_put(), another CPU can come in and find the netif while it is
hashed but while it has a zero refcount. Only to have the netif destroyed
under its feet?
If so, you need to invent atomic_dec_and_lock_bh().
next prev parent reply other threads:[~2004-01-09 21:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Xine.LNX.4.44.0401091009440.21309@thoron.boston.redhat.com>
2004-01-09 15:38 ` James Morris
2004-01-09 20:57 ` Andrew Morton
2004-01-09 21:25 ` Stephen Smalley
2004-01-09 21:06 ` Andrew Morton [this message]
2004-01-09 21:46 ` James Morris
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=20040109130613.711b34a6.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=selinux@tycho.nsa.gov \
/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
all inboxes | Powered by JetHome®