[PATCH 4.4 125/268] e1000e: allocate ring descriptors with dma_zalloc_coherent
From: Greg Kroah-Hartman
Date: Mon May 28 2018 - 11:29:54 EST
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Yves Kerbrat <pkerbrat@xxxxxxxxx>
[ Upstream commit aea3fca005fb45f80869f2e8d56fd4e64c1d1fdb ]
Descriptor rings were not initialized at zero when allocated
When area contained garbage data, it caused skb_over_panic in
e1000_clean_rx_irq (if data had E1000_RXD_STAT_DD bit set)
This patch makes use of dma_zalloc_coherent to make sure the
ring is memset at 0 to prevent the area from containing garbage.
Following is the signature of the panic:
IODDR0@xxx: skbuff: skb_over_panic: text:80407b20 len:64010 put:64010 head:ab46d800 data:ab46d842 tail:0xab47d24c end:0xab46df40 dev:eth0
IODDR0@xxx: BUG: failure at net/core/skbuff.c:105/skb_panic()!
IODDR0@xxx: Kernel panic - not syncing: BUG!
IODDR0@xxx:
IODDR0@xxx: Process swapper/0 (pid: 0, threadinfo=81728000, task=8173cc00 ,cpu: 0)
IODDR0@xxx: SP = <815a1c0c>
IODDR0@xxx: Stack: 00000001
IODDR0@xxx: b2d89800 815e33ac
IODDR0@xxx: ea73c040 00000001
IODDR0@xxx: 60040003 0000fa0a
IODDR0@xxx: 00000002
IODDR0@xxx:
IODDR0@xxx: 804540c0 815a1c70
IODDR0@xxx: b2744000 602ac070
IODDR0@xxx: 815a1c44 b2d89800
IODDR0@xxx: 8173cc00 815a1c08
IODDR0@xxx:
IODDR0@xxx: 00000006
IODDR0@xxx: 815a1b50 00000000
IODDR0@xxx: 80079434 00000001
IODDR0@xxx: ab46df40 b2744000
IODDR0@xxx: b2d89800
IODDR0@xxx:
IODDR0@xxx: 0000fa0a 8045745c
IODDR0@xxx: 815a1c88 0000fa0a
IODDR0@xxx: 80407b20 b2789f80
IODDR0@xxx: 00000005 80407b20
IODDR0@xxx:
IODDR0@xxx:
IODDR0@xxx: Call Trace:
IODDR0@xxx: [<804540bc>] skb_panic+0xa4/0xa8
IODDR0@xxx: [<80079430>] console_unlock+0x2f8/0x6d0
IODDR0@xxx: [<80457458>] skb_put+0xa0/0xc0
IODDR0@xxx: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
IODDR0@xxx: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
IODDR0@xxx: [<804079c8>] e1000_clean_rx_irq+0x188/0x3e8
IODDR0@xxx: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
IODDR0@xxx: [<80468b48>] __dev_kfree_skb_any+0x88/0xa8
IODDR0@xxx: [<804101ac>] e1000e_poll+0x94/0x288
IODDR0@xxx: [<8046e9d4>] net_rx_action+0x19c/0x4e8
IODDR0@xxx: ...
IODDR0@xxx: Maximum depth to print reached. Use kstack=<maximum_depth_to_print> To specify a custom value (where 0 means to display the full backtrace)
IODDR0@xxx: ---[ end Kernel panic - not syncing: BUG!
Signed-off-by: Pierre-Yves Kerbrat <pkerbrat@xxxxxxxxx>
Signed-off-by: Marius Gligor <mgligor@xxxxxxxxx>
Tested-by: Aaron Brown <aaron.f.brown@xxxxxxxxx>
Reviewed-by: Alexander Duyck <alexander.h.duyck@xxxxxxxxx>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@xxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -2330,8 +2330,8 @@ static int e1000_alloc_ring_dma(struct e
{
struct pci_dev *pdev = adapter->pdev;
- ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma,
- GFP_KERNEL);
+ ring->desc = dma_zalloc_coherent(&pdev->dev, ring->size, &ring->dma,
+ GFP_KERNEL);
if (!ring->desc)
return -ENOMEM;