linux_dsm_epyc7002/drivers/net/ethernet
Thadeu Lima de Souza Cascardo ef38079401 qlge: fix dma map leak when the last chunk is not allocated
qlge allocates chunks from a page that it maps and unmaps that page when
the last chunk is released. When the driver is unloaded or the card is
removed, all chunks are released and the page is unmapped for the last
chunk.

However, when the last chunk of a page is not allocated and the device
is removed, that page is not unmapped. In fact, its last reference is
not put and there's also a page leak. This bug prevents a device from
being properly hotplugged.

When the DMA API debug option is enabled, the following messages show
the pending DMA allocation after we remove the driver.

This patch fixes the bug by unmapping and putting the page from the ring
if its last chunk has not been allocated.

pci 0005:98:00.0: DMA-API: device driver has pending DMA allocations while released from device [count=1]
One of leaked entries details: [device address=0x0000000060a80000] [size=65536 bytes] [mapped with DMA_FROM_DEVICE] [mapped as page]
------------[ cut here ]------------
WARNING: at lib/dma-debug.c:746
Modules linked in: qlge(-) rpadlpar_io rpaphp pci_hotplug fuse [last unloaded: qlge]
NIP: c0000000003fc3ec LR: c0000000003fc3e8 CTR: c00000000054de60
REGS: c0000003ee9c74e0 TRAP: 0700   Tainted: G           O  (3.7.2)
MSR: 8000000000029032 <SF,EE,ME,IR,DR,RI>  CR: 28002424  XER: 00000001
SOFTE: 1
CFAR: c0000000007a39c8
TASK = c0000003ee8d5c90[8406] 'rmmod' THREAD: c0000003ee9c4000 CPU: 31
GPR00: c0000000003fc3e8 c0000003ee9c7760 c000000000c789f8 00000000000000ee
GPR04: 0000000000000000 00000000000000ef 0000000000004000 0000000000010000
GPR08: 00000000000000be c000000000b22088 c000000000c4c218 00000000007c0000
GPR12: 0000000028002422 c00000000ff26c80 0000000000000000 000001001b0f1b40
GPR16: 00000000100cb9d8 0000000010093088 c000000000cdf910 0000000000000001
GPR20: 0000000000000000 c000000000dbfc00 0000000000000000 c000000000dbfb80
GPR24: c0000003fafc9d80 0000000000000001 000000000001ff80 c0000003f38f7888
GPR28: c000000000ddfc00 0000000000000400 c000000000bd7790 c000000000ddfb80
NIP [c0000000003fc3ec] .dma_debug_device_change+0x22c/0x2b0
LR [c0000000003fc3e8] .dma_debug_device_change+0x228/0x2b0
Call Trace:
[c0000003ee9c7760] [c0000000003fc3e8] .dma_debug_device_change+0x228/0x2b0 (unreliable)
[c0000003ee9c7840] [c00000000079a098] .notifier_call_chain+0x78/0xf0
[c0000003ee9c78e0] [c0000000000acc20] .__blocking_notifier_call_chain+0x70/0xb0
[c0000003ee9c7990] [c0000000004a9580] .__device_release_driver+0x100/0x140
[c0000003ee9c7a20] [c0000000004a9708] .driver_detach+0x148/0x150
[c0000003ee9c7ac0] [c0000000004a8144] .bus_remove_driver+0xc4/0x150
[c0000003ee9c7b60] [c0000000004aa58c] .driver_unregister+0x8c/0xe0
[c0000003ee9c7bf0] [c0000000004090b4] .pci_unregister_driver+0x34/0xf0
[c0000003ee9c7ca0] [d000000002231194] .qlge_exit+0x1c/0x34 [qlge]
[c0000003ee9c7d20] [c0000000000e36d8] .SyS_delete_module+0x1e8/0x290
[c0000003ee9c7e30] [c0000000000098d4] syscall_exit+0x0/0x94
Instruction dump:
7f26cb78 e818003a e87e81a0 e8f80028 e9180030 796b1f24 78001f24 7d6a5a14
7d2a002a e94b0020 483a7595 60000000 <0fe00000> 2fb80000 40de0048 80120050
---[ end trace 4294f9abdb01031d ]---
Mapped at:
 [<d000000002222f54>] .ql_update_lbq+0x384/0x580 [qlge]
 [<d000000002227bd0>] .ql_clean_inbound_rx_ring+0x300/0xc60 [qlge]
 [<d0000000022288cc>] .ql_napi_poll_msix+0x39c/0x5a0 [qlge]
 [<c0000000006b3c50>] .net_rx_action+0x170/0x300
 [<c000000000081840>] .__do_softirq+0x170/0x300

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Acked-by: Jitendra Kalsaria <Jitendra.kalsaria@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-05-13 12:54:38 -07: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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-05-01 14:08:52 -07:00
apple drivers:net: Remove dma_alloc_coherent OOM messages 2013-03-15 08:56:58 -04:00
atheros Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-05-01 14:08:52 -07:00
broadcom drivers/net: rename random32() to prandom_u32() 2013-05-07 18:38:27 -07:00
brocade net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
cadence net/ethernet: MACB should depend on HAS_DMA 2013-05-11 16:28:24 -07:00
calxeda net/ethernet: NET_CALXEDA_XGMAC should depend on HAS_DMA 2013-05-11 16:28:23 -07:00
chelsio cxgb4: fix error recovery when t4_fw_hello returns a positive value 2013-05-03 16:10:34 -04:00
cirrus cirrus: cs89x0: remove two obsolete Kconfig macros 2013-03-29 15:40:24 -04:00
cisco net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
davicom Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-04-01 13:36:50 -04:00
dec Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-03-20 12:46:26 -04:00
dlink drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
emulex be2net: disable TX in be_close() 2013-05-08 11:59:48 -07:00
faraday net: ftgmac100: Use module_platform_driver() 2013-03-18 13:02:37 -04:00
freescale net: fec: enable hardware checksum only on imx6q-fec 2013-05-11 16:12:44 -07: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 emac: Fix EMAC soft reset on 460EX/GT 2013-05-11 17:40:14 -07:00
icplus
intel e1000e: fix scheduling while atomic bug 2013-05-07 07:51:37 -07:00
marvell sky2: Fix crash on receiving VLAN frames 2013-05-03 16:10:34 -04:00
mellanox net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode 2013-05-11 16:12:44 -07: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 net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04: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
oki-semi pch_gbe: minor: report the actual error on MTU change 2013-04-16 16:43:35 -04:00
packetengines Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
pasemi drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
qlogic qlge: fix dma map leak when the last chunk is not allocated 2013-05-13 12:54:38 -07:00
rdc drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
realtek Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-04-30 03:55:20 -04:00
renesas sh_eth: use random MAC address if no valid one supplied 2013-04-30 15:37:08 -04:00
seeq drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb 2013-03-09 16:09:19 -05:00
sfc sfc: fix return value check in efx_ptp_probe_channel() 2013-05-08 13:13:30 -07:00
sgi drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0) 2013-03-17 12:50:24 -04:00
silan Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
sis sis900: check for DMA map errors 2013-04-15 14:11:37 -04:00
smsc ARM: arm-soc non-critical fixes for 3.10 2013-05-02 08:56:55 -07:00
stmicro net/ethernet: STMMAC_ETH should depend on HAS_DMA 2013-05-11 16:28:23 -07:00
sun net: add ETH_P_802_3_MIN 2013-03-28 01:20:42 -04:00
tehuti net: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
ti drivers: net: cpsw: irq not disabled in cpsw isr in particular sequence 2013-05-02 16:52:04 -04: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: vlan: add protocol argument to packet tagging functions 2013-04-19 14:46:06 -04:00
wiznet net: ethernet: wiznet: add CONFIG_PM_SLEEP to suspend/resume functions 2013-03-26 12:47:17 -04:00
xilinx net: vlan: rename NETIF_F_HW_VLAN_* feature flags to NETIF_F_HW_VLAN_CTAG_* 2013-04-19 14:45:26 -04: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
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