linux-uconsole/drivers/net/ethernet
Sabrina Dubroca 9923e74aef e1000: add dummy allocator to fix race condition between mtu change and netpoll
commit 08e8331654 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06 21:56:28 +02:00
..
3com 3c59x: fix PCI resource management 2013-05-11 17:40:14 -07:00
8390 Char / Misc driver update for 3.10-rc1 2013-04-29 11:18:34 -07:00
adaptec net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
adi bfin_mac: fix error return code in bfin_mac_probe() 2013-05-08 13:13:30 -07:00
aeroflex drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
alteon net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
amd net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} 2015-04-13 14:02:13 +02:00
apple net: Revert unused variable changes. 2013-05-23 12:15:32 -07:00
atheros alx: fix alx_poll() 2015-01-27 07:52:31 -08:00
broadcom tg3: Call dev_kfree_skby_any instead of dev_kfree_skb. 2015-04-29 10:33:56 +02:00
brocade lseek(fd, n, SEEK_END) does *not* go to eof - n 2013-06-16 08:10:53 -10:00
cadence net/cadence/macb: fix bug/typo in extracting gem_irq_read_clear bit 2013-07-28 16:29:55 -07:00
calxeda net/ethernet: NET_CALXEDA_XGMAC should depend on HAS_DMA 2013-05-11 16:28:23 -07:00
chelsio cxgb3: Fix length calculation in write_ofld_wr() on 32-bit architectures 2013-11-20 12:27:46 -08:00
cirrus cirrus: cs89x0: remove two obsolete Kconfig macros 2013-03-29 15:40:24 -04:00
cisco enic: fix rx skb checksum 2015-01-27 07:52:31 -08:00
davicom Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-04-01 13:36:50 -04:00
dec tulip: Properly check dma mapping result 2013-06-13 17:09:40 -07:00
dlink drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
emulex benet: Call dev_kfree_skby_any instead of kfree_skb. 2015-04-29 10:33:57 +02:00
faraday net: ftgmac100: Use module_platform_driver() 2013-03-18 13:02:37 -04:00
freescale net: fec: fix potential use after free 2014-01-15 15:28:48 -08:00
fujitsu Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-05-01 14:08:52 -07:00
hp
i825xx drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
ibm ibmveth: Fix endian issues with rx_no_buffer statistic 2014-10-05 14:54:07 -07:00
icplus ipg: fix an unsigned widening cast of '~' truncation issue 2013-05-15 14:42:14 -07:00
intel e1000: add dummy allocator to fix race condition between mtu change and netpoll 2015-05-06 21:56:28 +02:00
marvell net: mvneta: fix Tx interrupt delay 2014-12-16 09:09:43 -08:00
mellanox net/mlx4_core: Limit count field to 24 bits in qp_alloc_res 2014-12-16 09:09:42 -08:00
micrel ks8851: Remove unneeded PM_OPS definitions 2013-04-16 16:30:51 -04:00
microchip net: ethernet: enc28j60: use spi_get_drvdata() and spi_set_drvdata() 2013-04-07 16:48:19 -04:00
myricom myri10ge: check for DMA mapping errors 2014-10-15 08:31:56 +02:00
natsemi net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
neterion net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
nuvoton drivers:net: Remove dma_alloc_coherent OOM messages 2013-03-15 08:56:58 -04:00
nvidia net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
nxp net/nxp/lpc_eth: Drop ifdef CONFIG_OF_NET 2013-04-02 16:43:56 -04:00
octeon netdev: octeon_mgmt: Fix structure layout for little-endian. 2013-06-19 22:12:48 -07:00
oki-semi pch_gbe: minor: report the actual error on MTU change 2013-04-16 16:43:35 -04:00
packetengines
pasemi drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
qlogic netxen: fix netxen_nic_poll() logic 2015-02-26 17:48:48 -08:00
rdc drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
realtek r8169: Call dev_kfree_skby_any instead of dev_kfree_skb. 2015-04-29 10:33:56 +02:00
renesas sh_eth: fix misreporting of transmit abort 2013-06-24 00:10:21 -07:00
seeq drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
sfc sfc: check for NULL efx->ptp_data in efx_ptp_event 2014-03-23 21:38:10 -07:00
sgi drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
silan
sis sis900: check for DMA map errors 2013-04-15 14:11:37 -04:00
smsc net: smc91: fix crash regression on the versatile 2013-12-11 22:36:27 -08:00
stmicro stmmac: fix EEE setup 2013-06-19 18:40:21 -07:00
sun vio: fix reuse of vio_dring slot 2014-11-21 09:22:52 -08:00
tehuti net: do not pretend FRAGLIST support 2014-01-15 15:28:45 -08:00
ti drivers: net: cpsw: discard dual emac default vlan configuration 2015-02-05 22:35:37 -08:00
tile tile: support new Tilera hypervisor 2013-05-02 16:20:31 -04:00
toshiba net/spider_net: fix error return code in spider_net_open() 2013-05-08 13:13:29 -07:00
tundra drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
via net,via-rhine: Fix tx_timeout handling 2014-02-06 11:08:16 -08:00
wiznet net: ethernet: wiznet: add CONFIG_PM_SLEEP to suspend/resume functions 2013-03-26 12:47:17 -04:00
xilinx net: do not pretend FRAGLIST support 2014-01-15 15:28:45 -08:00
xircom Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-05-01 14:08:52 -07:00
xscale
dnet.c
dnet.h
ethoc.c
fealnx.c
jme.c net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
jme.h
Kconfig
korina.c net: Revert unused variable changes. 2013-05-23 12:15:32 -07:00
lantiq_etop.c lantiq_etop: use free_netdev(netdev) instead of kfree() 2013-03-21 11:50:10 -04:00
Makefile
netx-eth.c drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
s6gmac.c s6gmac: fix error return code in s6gmac_probe() 2013-03-22 10:23:42 -04:00