All of lore.kernel.org
 help / color / mirror / Atom feed
From: stranche@codeaurora.org
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, steffen.klassert@secunet.com
Subject: Re: [PATCH net] af_key: free SKBs under RCU protection
Date: Mon, 24 Sep 2018 12:46:07 -0600	[thread overview]
Message-ID: <c30e965c4290b3a4a7ec8f91fa587598@codeaurora.org> (raw)
In-Reply-To: <9a3d8036-9f8c-6e8b-f16c-7c278c448db3@gmail.com>

On 2018-09-23 11:15, Eric Dumazet wrote:
> On 09/20/2018 12:25 PM, stranche@codeaurora.org wrote:
> 
>> Perhaps a cleaner solution here is to always clone the SKB in
>> pfkey_broadcast_one(). That will ensure that the two kfree_skb() calls
>> in pfkey_broadcast() will never be passed an SKB with sock_rfree() as
>> its destructor, and we can avoid this race condition.
> 
> Yes, this whole idea of avoiding the cloning is brain dead.
> 
> Better play safe and having a straightforward implementation.
> 
> I suggest something like this (I could not reproduce the bug with the
> syzkaller repro)
> 
> Note that I removed the sock_hold(sk)/sock_put(sk) pair as this is 
> useless.
> The only time GFP_KERNEL might be used is when the sk is already owned
> by the caller.
> 
> 
>  net/key/af_key.c |   40 +++++++++++++++-------------------------
>  1 file changed, 15 insertions(+), 25 deletions(-)

Hi Eric,

That patch works like a charm. Could you upload that as a formal patch?
Thanks for all your help with this.

      reply	other threads:[~2018-09-25  0:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20  0:18 [PATCH net] af_key: free SKBs under RCU protection Sean Tranchetti
2018-09-20 13:29 ` Eric Dumazet
2018-09-20 19:25   ` stranche
2018-09-20 22:10     ` Eric Dumazet
2018-09-20 22:29       ` Eric Dumazet
2018-09-21 17:09         ` stranche
2018-09-21 17:40           ` Eric Dumazet
2018-09-21 18:44             ` stranche
2018-09-23 17:15     ` Eric Dumazet
2018-09-24 18:46       ` stranche [this message]

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=c30e965c4290b3a4a7ec8f91fa587598@codeaurora.org \
    --to=stranche@codeaurora.org \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.