stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Josh Elsasser <jelsasser@appneta.com>
Subject: [PATCH 4.4 46/73] net: check before dereferencing netdev_ops during busy poll
Date: Mon,  8 Jul 2019 17:12:56 +0200	[thread overview]
Message-ID: <20190708150523.819580216@linuxfoundation.org> (raw)
In-Reply-To: <20190708150513.136580595@linuxfoundation.org>

From: Josh Elsasser <jelsasser@appneta.com>

init_dummy_netdev() leaves its netdev_ops pointer zeroed. This leads
to a NULL pointer dereference when sk_busy_loop fires against an iwlwifi
wireless adapter and checks napi->dev->netdev_ops->ndo_busy_poll.

Avoid this by ensuring napi->dev->netdev_ops is valid before following
the pointer, avoiding the following panic when busy polling on a dummy
netdev:

  BUG: unable to handle kernel NULL pointer dereference at 00000000000000c8
  IP: [<ffffffff817b4b72>] sk_busy_loop+0x92/0x2f0
  Call Trace:
   [<ffffffff815a3134>] ? uart_write_room+0x74/0xf0
   [<ffffffff817964a9>] sock_poll+0x99/0xa0
   [<ffffffff81223142>] do_sys_poll+0x2e2/0x520
   [<ffffffff8118d3fc>] ? get_page_from_freelist+0x3bc/0xa30
   [<ffffffff810ada22>] ? update_curr+0x62/0x140
   [<ffffffff811ea671>] ? __slab_free+0xa1/0x2a0
   [<ffffffff811ea671>] ? __slab_free+0xa1/0x2a0
   [<ffffffff8179dbb1>] ? skb_free_head+0x21/0x30
   [<ffffffff81221bd0>] ? poll_initwait+0x50/0x50
   [<ffffffff811eaa36>] ? kmem_cache_free+0x1c6/0x1e0
   [<ffffffff815a4884>] ? uart_write+0x124/0x1d0
   [<ffffffff810bd1cd>] ? remove_wait_queue+0x4d/0x60
   [<ffffffff810bd224>] ? __wake_up+0x44/0x50
   [<ffffffff81582731>] ? tty_write_unlock+0x31/0x40
   [<ffffffff8158c5c6>] ? tty_ldisc_deref+0x16/0x20
   [<ffffffff81584820>] ? tty_write+0x1e0/0x2f0
   [<ffffffff81587e50>] ? process_echoes+0x80/0x80
   [<ffffffff8120c17b>] ? __vfs_write+0x2b/0x130
   [<ffffffff8120d09a>] ? vfs_write+0x15a/0x1a0
   [<ffffffff81223455>] SyS_poll+0x75/0x100
   [<ffffffff819a6524>] entry_SYSCALL_64_fastpath+0x24/0xcf

Commit 79e7fff47b7b ("net: remove support for per driver ndo_busy_poll()")
indirectly fixed this upstream in linux-4.11 by removing the offending
pointer usage. No other users of napi->dev touch its netdev_ops.

Fixes: 8b80cda536ea ("net: rename include/net/ll_poll.h to include/net/busy_poll.h") # 4.4.y
Signed-off-by: Josh Elsasser <jelsasser@appneta.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

This is a straightforward backport of the 4.9.y fix[1] for this crash, which doesn't
apply to the older LTS releases. Only build-tested on 4.4.y, as I don't have access
to wireless hardware and firmware that runs on older LTS kernels.

[1]: https://lore.kernel.org/stable/20190701234143.72631-1-jelsasser@appneta.com/T/#u

 include/net/busy_poll.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -93,7 +93,7 @@ static inline bool sk_busy_loop(struct s
 		goto out;
 
 	ops = napi->dev->netdev_ops;
-	if (!ops->ndo_busy_poll)
+	if (!ops || !ops->ndo_busy_poll)
 		goto out;
 
 	do {



  parent reply	other threads:[~2019-07-08 15:16 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 15:12 [PATCH 4.4 00/73] 4.4.185-stable review Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 01/73] fs/binfmt_flat.c: make load_flat_shared_library() work Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 02/73] mm/page_idle.c: fix oops because end_pfn is larger than max_pfn Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 03/73] scsi: vmw_pscsi: Fix use-after-free in pvscsi_queue_lck() Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 04/73] tracing: Silence GCC 9 array bounds warning Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 05/73] gcc-9: silence address-of-packed-member warning Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 06/73] usb: chipidea: udc: workaround for endpoint conflict issue Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 07/73] Input: uinput - add compat ioctl number translation for UI_*_FF_UPLOAD Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 08/73] apparmor: enforce nullbyte at end of tag string Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 09/73] parport: Fix mem leak in parport_register_dev_model Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 10/73] parisc: Fix compiler warnings in float emulation code Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 11/73] IB/hfi1: Insure freeze_work work_struct is canceled on shutdown Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 12/73] MIPS: uprobes: remove set but not used variable epc Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 13/73] net: hns: Fix loopback test failed at copper ports Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 14/73] sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 15/73] scripts/checkstack.pl: Fix arm64 wrong or unknown architecture Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 16/73] scsi: ufs: Check that space was properly alloced in copy_query_response Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 17/73] s390/qeth: fix VLAN attribute in bridge_hostnotify udev event Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 18/73] hwmon: (pmbus/core) Treat parameters as paged if on multiple pages Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 19/73] Btrfs: fix race between readahead and device replace/removal Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 20/73] btrfs: start readahead also in seed devices Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 21/73] can: flexcan: fix timeout when set small bitrate Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 22/73] can: purge socket error queue on sock destruct Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 23/73] ARM: imx: cpuidle-imx6sx: Restrict the SW2ISO increase to i.MX6SX Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 24/73] Bluetooth: Align minimum encryption key size for LE and BR/EDR connections Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 25/73] Bluetooth: Fix regression with minimum encryption key size alignment Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 26/73] SMB3: retry on STATUS_INSUFFICIENT_RESOURCES instead of failing write Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 27/73] cfg80211: fix memory leak of wiphy device name Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 28/73] mac80211: drop robust management frames from unknown TA Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 29/73] perf ui helpline: Use strlcpy() as a shorter form of strncpy() + explicit set nul Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 30/73] perf help: Remove needless use of strncpy() Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 31/73] 9p/rdma: do not disconnect on down_interruptible EAGAIN Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 32/73] 9p: acl: fix uninitialized iattr access Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 33/73] 9p/rdma: remove useless check in cm_event_handler Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 34/73] 9p: p9dirent_read: check network-provided name length Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 35/73] net/9p: include trans_common.h to fix missing prototype warning Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 36/73] KVM: X86: Fix scan ioapic use-before-initialization Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 37/73] ovl: modify ovl_permission() to do checks on two inodes Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 38/73] x86/speculation: Allow guests to use SSBD even if host does not Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 39/73] cpu/speculation: Warn on unsupported mitigations= parameter Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 40/73] sctp: change to hold sk after auth shkey is created successfully Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 41/73] tipc: change to use register_pernet_device Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 42/73] tipc: check msg->req data len in tipc_nl_compat_bearer_disable Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 43/73] team: Always enable vlan tx offload Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 44/73] ipv4: Use return value of inet_iif() for __raw_v4_lookup in the while loop Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 45/73] bonding: Always enable vlan tx offload Greg Kroah-Hartman
2019-07-08 15:12 ` Greg Kroah-Hartman [this message]
2019-07-08 15:12 ` [PATCH 4.4 47/73] Bluetooth: Fix faulty expression for minimum encryption key size check Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 48/73] um: Compile with modern headers Greg Kroah-Hartman
2019-07-08 15:12 ` [PATCH 4.4 49/73] ASoC : cs4265 : readable register too low Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 50/73] spi: bitbang: Fix NULL pointer dereference in spi_unregister_master Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 51/73] ASoC: max98090: remove 24-bit format support if RJ is 0 Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 52/73] usb: gadget: fusb300_udc: Fix memory leak of fusb300->ep[i] Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 53/73] usb: gadget: udc: lpc32xx: allocate descriptor with GFP_ATOMIC Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 54/73] scsi: hpsa: correct ioaccel2 chaining Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 55/73] ARC: Assume multiplier is always present Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 56/73] ARC: fix build warning in elf.h Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 57/73] MIPS: math-emu: do not use bools for arithmetic Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 58/73] mfd: omap-usb-tll: Fix register offsets Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 59/73] swiotlb: Make linux/swiotlb.h standalone includible Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 60/73] bug.h: work around GCC PR82365 in BUG() Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 61/73] MIPS: Workaround GCC __builtin_unreachable reordering bug Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 62/73] ptrace: Fix ->ptracer_cred handling for PTRACE_TRACEME Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 63/73] crypto: user - prevent operating on larval algorithms Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 64/73] ALSA: seq: fix incorrect order of dest_client/dest_ports arguments Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 65/73] ALSA: firewire-lib/fireworks: fix miss detection of received MIDI messages Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 66/73] ALSA: usb-audio: fix sign unintended sign extension on left shifts Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 67/73] lib/mpi: Fix karactx leak in mpi_powm Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 68/73] btrfs: Ensure replaced device doesnt have pending chunk allocation Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 69/73] tty: rocket: fix incorrect forward declaration of rp_init() Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 70/73] ARC: handle gcc generated __builtin_trap for older compiler Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 71/73] arm64, vdso: Define vdso_{start,end} as array Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 72/73] KVM: x86: degrade WARN to pr_warn_ratelimited Greg Kroah-Hartman
2019-07-08 15:13 ` [PATCH 4.4 73/73] dmaengine: imx-sdma: remove BD_INTR for channel0 Greg Kroah-Hartman
2019-07-08 19:12 ` [PATCH 4.4 00/73] 4.4.185-stable review kernelci.org bot
2019-07-09  2:37 ` shuah
2019-07-09  6:05 ` Naresh Kamboju
2019-07-09 18:40 ` Guenter Roeck
2019-07-10  6:10 ` Jon Hunter

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=20190708150523.819580216@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=jelsasser@appneta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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).