netdev
[Top] [All Lists]

Re: [PATCH] tiny af_packet.c cleanup

To: Mitchell Blank Jr <mitch@xxxxxxxxxx>
Subject: Re: [PATCH] tiny af_packet.c cleanup
From: Francois Romieu <romieu@xxxxxxxxxxxxx>
Date: Sat, 13 Sep 2003 11:03:53 +0200
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20030913080252.GE94744@xxxxxxxxxxxxxx>; from mitch@xxxxxxxxxx on Sat, Sep 13, 2003 at 01:02:52AM -0700
References: <20030913055033.GB94744@xxxxxxxxxxxxxx> <20030913093559.A23840@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20030913080252.GE94744@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
Mitchell Blank Jr <mitch@xxxxxxxxxx> :
[...]
> I thought that without the comment someone might think that the second
> "if()" wasn't needed (since we had just checked the same value against
> NULL a few lines up)

Ok, I completely missed the intent.

Actually packet_rcv() is run in a BH context and doesn't race with
SO_{ATTACH/DETACH}_FILTER from sock_setsockopt() which does the
appropriate BH locking (spin_lock_bh(&sk->sk_lock.slock) in
net/core/sock.c::sock_setsockopt and in net/core/filter.c::sk_attach_filter).
packet_rcv() doesn't race with BH either due to the bh_lock_sock (a spin_lock
in disguise) you quoted.

That being said, I don't see how such an explanation could fit in a short,
inlined comment. :o)

--
Ueimor

<Prev in Thread] Current Thread [Next in Thread>