[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH][SELINUX] 2/7 Add netif controls


James Morris <jmorris _at_ 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().
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」
Follow-Ups: References: