Netdev List
 help / color / mirror / Atom feed
From: Josh Elsasser <jelsasser@appneta.com>
To: davem@davemloft.net
Cc: "Josh Elsasser" <jelsasser@appneta.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"Sasha Levin" <alexander.levin@verizon.com>,
	"Willem de Bruijn" <willemb@google.com>,
	"Cong Wang" <xiyou.wangcong@gmail.com>,
	"Alexander Potapenko" <glider@google.com>,
	"Myungho Jung" <mhjungk@gmail.com>,
	"Michal Kubeček" <mkubecek@suse.cz>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/1] net: avoid a kernel panic during sk_busy_loop
Date: Sun, 11 Mar 2018 12:22:54 -0700	[thread overview]
Message-ID: <20180311192322.101598-1-jelsasser@appneta.com> (raw)

Hi Dave,

I stumbled across a reproducible kernel panic while playing around with
busy_poll on a Linux 4.9.86 kernel. There's an unfortunate interaction
between init_dummy_netdev, which doesn't bother to fill in netdev_ops, and
sk_busy_loop, which assumes netdev_ops is a valid pointer.

To reproduce on the device under test (DUT), I did:

  $ ip addr show dev wlan0
  8: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq [...]
      inet 172.16.122.6/23 brd 172.16.123.255 scope global wlan0
  $ sysctl -w net.core.busy_read=50
  $ nc -l 172.16.122.6 5001

Then transmitted some data to this socket from a second host:

  $ echo "foo" | nc 172.16.122.6 5001

The DUT immediately hits a kernel panic.

I've attached a patch that applies cleanly to the 4.9.87 stable release.
This fix isn't necessary for net/net-next (ndo_busy_poll was removed in
linux-4.11), but a further backport of this commit is likely required for
any stable releases older than linux-4.5.

I hope this is the right way to raise something like this. I couldn't find
a clear answer from the -stable and netdev howtos for bugs against features
that no longer exist in mainline.

Thanks,
Josh

             reply	other threads:[~2018-03-11 19:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-11 19:22 Josh Elsasser [this message]
2018-03-11 19:22 ` [PATCH 1/1] net: check dev->reg_state before deref of napi netdev_ops Josh Elsasser
2018-03-12 23:17   ` Cong Wang
2018-03-13  5:17     ` Josh Elsasser
  -- strict thread matches above, loose matches on Subject: below --
2018-03-13  5:31 [PATCH 0/1] net: avoid a kernel panic during sk_busy_loop Josh Elsasser

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=20180311192322.101598-1-jelsasser@appneta.com \
    --to=jelsasser@appneta.com \
    --cc=alexander.levin@verizon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhjungk@gmail.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    --cc=xiyou.wangcong@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