netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: maloneykernel@gmail.com
Cc: netdev@vger.kernel.org, willemdebruijn.kernel@gmail.com,
	eric.dumazet@gmail.com, maloney@google.com
Subject: Re: [PATCH net] packet: fix crash in fanout_demux_rollover()
Date: Tue, 28 Nov 2017 11:14:29 -0500 (EST)	[thread overview]
Message-ID: <20171128.111429.1528029123202775549.davem@davemloft.net> (raw)
In-Reply-To: <20171128154429.84833-1-maloneykernel@gmail.com>

From: Mike Maloney <maloneykernel@gmail.com>
Date: Tue, 28 Nov 2017 10:44:29 -0500

> From: Mike Maloney <maloney@google.com>
> 
> syzkaller found a race condition fanout_demux_rollover() while removing
> a packet socket from a fanout group.
> 
> po->rollover is read and operated on during packet_rcv_fanout(), via
> fanout_demux_rollover(), but the pointer is currently cleared before the
> synchronization in packet_release().   It is safer to delay the cleanup
> until after synchronize_net() has been called, ensuring all calls to
> packet_rcv_fanout() for this socket have finished.
> 
> To further simplify synchronization around the rollover structure, set
> po->rollover in fanout_add() only if there are no errors.  This removes
> the need for rcu in the struct and in the call to
> packet_getsockopt(..., PACKET_ROLLOVER_STATS, ...).
> 
> Crashing stack trace:
...
> Fixes: 0648ab70afe6 ("packet: rollover prepare: per-socket state")
> Fixes: 509c7a1ecc860 ("packet: avoid panic in packet_getsockopt()")
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Signed-off-by: Mike Maloney <maloney@google.com>

Applied and queued up for -stable.

      parent reply	other threads:[~2017-11-28 16:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 15:44 [PATCH net] packet: fix crash in fanout_demux_rollover() Mike Maloney
2017-11-28 16:06 ` Eric Dumazet
2017-11-28 16:14 ` David Miller [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=20171128.111429.1528029123202775549.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=maloney@google.com \
    --cc=maloneykernel@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).