From: Eric Dumazet <eric.dumazet@gmail•com>
To: David Miller <davem@davemloft•net>
Cc: netdev@vger•kernel.org, fruggeri@aristanetworks•com, willemb@google•com
Subject: Re: [PATCH net] net/packet: fix a race in packet_bind() and packet_notifier()
Date: Tue, 28 Nov 2017 07:14:55 -0800 [thread overview]
Message-ID: <1511882095.16595.14.camel@gmail.com> (raw)
In-Reply-To: <20171128.094855.1432729042351719024.davem@davemloft.net>
On Tue, 2017-11-28 at 09:48 -0500, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail•com>
> Date: Mon, 27 Nov 2017 20:00:52 -0800
>
> > @@ -368,9 +368,11 @@ static void __unregister_prot_hook(struct sock
> *sk, bool sync)
> > __sock_put(sk);
> >
> > if (sync) {
> > + po->frozen = 1;
> > spin_unlock(&po->bind_lock);
> > synchronize_net();
> > spin_lock(&po->bind_lock);
> > + po->frozen = 0;
> > }
> > }
> >
>
> Ugh.
>
> Maybe you can just set po->num to zero in the bind code path which
> causes
> this problem. That will prevent this situation entirely.
Yes, I can submit a V2 with this idea implemented, thanks.
next prev parent reply other threads:[~2017-11-28 15:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 4:00 [PATCH net] net/packet: fix a race in packet_bind() and packet_notifier() Eric Dumazet
2017-11-28 10:23 ` Francesco Ruggeri
2017-11-28 15:13 ` Eric Dumazet
2017-11-28 14:48 ` David Miller
2017-11-28 15:14 ` Eric Dumazet [this message]
2017-11-28 16:03 ` [PATCH v2 " Eric Dumazet
2017-11-28 16:14 ` David Miller
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=1511882095.16595.14.camel@gmail.com \
--to=eric.dumazet@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=fruggeri@aristanetworks$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=willemb@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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