linux/drivers/net/ethernet
Sabrina Dubroca 08e8331654 e1000: add dummy allocator to fix race condition between mtu change and netpoll
There is a race condition between e1000_change_mtu's cleanups and
netpoll, when we change the MTU across jumbo size:

Changing MTU frees all the rx buffers:
    e1000_change_mtu -> e1000_down -> e1000_clean_all_rx_rings ->
        e1000_clean_rx_ring

Then, close to the end of e1000_change_mtu:
    pr_info -> ... -> netpoll_poll_dev -> e1000_clean ->
        e1000_clean_rx_irq -> e1000_alloc_rx_buffers -> e1000_alloc_frag

And when we come back to do the rest of the MTU change:
    e1000_up -> e1000_configure -> e1000_configure_rx ->
        e1000_alloc_jumbo_rx_buffers

alloc_jumbo finds the buffers already != NULL, since data (shared with
page in e1000_rx_buffer->rxbuf) has been re-alloc'd, but it's garbage,
or at least not what is expected when in jumbo state.

This results in an unusable adapter (packets don't get through), and a
NULL pointer dereference on the next call to e1000_clean_rx_ring
(other mtu change, link down, shutdown):

BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<ffffffff81194d6e>] put_compound_page+0x7e/0x330

    [...]

Call Trace:
 [<ffffffff81195445>] put_page+0x55/0x60
 [<ffffffff815d9f44>] e1000_clean_rx_ring+0x134/0x200
 [<ffffffff815da055>] e1000_clean_all_rx_rings+0x45/0x60
 [<ffffffff815df5e0>] e1000_down+0x1c0/0x1d0
 [<ffffffff811e2260>] ? deactivate_slab+0x7f0/0x840
 [<ffffffff815e21bc>] e1000_change_mtu+0xdc/0x170
 [<ffffffff81647050>] dev_set_mtu+0xa0/0x140
 [<ffffffff81664218>] do_setlink+0x218/0xac0
 [<ffffffff814459e9>] ? nla_parse+0xb9/0x120
 [<ffffffff816652d0>] rtnl_newlink+0x6d0/0x890
 [<ffffffff8104f000>] ? kvm_clock_read+0x20/0x40
 [<ffffffff810a2068>] ? sched_clock_cpu+0xa8/0x100
 [<ffffffff81663802>] rtnetlink_rcv_msg+0x92/0x260

By setting the allocator to a dummy version, netpoll can't mess up our
rx buffers.  The allocator is set back to a sane value in
e1000_configure_rx.

Fixes: edbbb3ca10 ("e1000: implement jumbo receive with partial descriptors")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-03-06 02:47:10 -08:00
..
3com drivers/net: Use setup_timer and mod_timer 2015-02-11 19:40:12 -08:00
8390 net: 8390: axnet_cs: Use setup_timer and mod_timer 2015-03-01 13:40:23 -05:00
adaptec
adi
aeroflex
agere et131x: use msecs_to_jiffies for conversions 2015-02-11 19:37:43 -08:00
allwinner
alteon
altera Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
amd Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
apm drivers: net: xgene: Make xgene_enet_of_match depend on CONFIG_OF 2015-02-11 19:39:08 -08:00
apple
arc
atheros
broadcom tg3: use napi_complete_done() 2015-03-06 00:20:09 -05:00
brocade bna: Update the Driver and Firmware Version 2015-02-21 22:05:23 -05:00
cadence net: cadence: Remove Kconfig dependency on ARCH 2015-03-04 15:48:26 -05:00
calxeda
chelsio cxgb4: Try and provide an RDMA CIQ per cpu 2015-03-05 15:11:52 -05:00
cirrus Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-02-05 14:33:28 -08:00
cisco Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
davicom
dec net/tulip: don't warn about unknown ARM architecture 2015-02-02 18:53:34 -08:00
dlink
emulex be2net: implement .sriov_configure() PCI callback 2015-03-04 15:58:37 -05:00
faraday
freescale gianfar: Reduce logging noise seen due to phy polling if link is down 2015-03-03 14:37:30 -05:00
fujitsu
hisilicon net: hip04: add missing MODULE_LICENSE 2015-02-02 18:51:03 -08:00
hp
i825xx
ibm ibmveth: Add function to enable live MAC address changes 2015-03-03 14:36:17 -05:00
icplus
intel e1000: add dummy allocator to fix race condition between mtu change and netpoll 2015-03-06 02:47:10 -08:00
marvell Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-01-27 16:59:56 -08:00
mellanox Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
micrel ethernet: Use eth_<foo>_addr instead of memset 2015-03-03 17:01:36 -05:00
microchip
moxa
myricom myri10ge: Delete an unnecessary check before the function call "kfree" 2015-02-05 00:25:10 -08:00
natsemi
neterion vxge: fix sparse warning 2015-02-05 16:07:06 -08:00
nuvoton
nvidia
nxp
octeon
oki-semi
packetengines
pasemi net: pasemi: Use setup_timer and mod_timer 2015-03-01 13:40:23 -05:00
qlogic Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
qualcomm
rdc
realtek r8169: Fix trivial typo in rtl_check_firmware 2015-02-24 16:26:07 -05:00
renesas sh_eth: Mitigate lost statistics updates 2015-03-04 15:40:54 -05:00
rocker rocker: implement IPv4 fib offloading 2015-03-06 00:24:58 -05:00
samsung Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-02-09 14:35:57 -08:00
seeq
sfc
sgi
silan
sis
smsc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
stmicro net: stmmac: Use setup_timer and mod_timer 2015-03-01 13:40:23 -05:00
sun Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
tehuti
ti Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
tile tile: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:37 -08:00
toshiba ethernet: Use eth_<foo>_addr instead of memset 2015-03-03 17:01:36 -05:00
tundra
via net: via-rhine: add BQL support 2015-02-24 16:30:02 -05:00
wiznet
xilinx
xircom
xscale Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c
jme.c
jme.h
Kconfig
korina.c
lantiq_etop.c
Makefile
netx-eth.c