Skip to content

Commit 313e0a3

Browse files
haiyangzNipaLocal
authored and
NipaLocal
committed
net: mana: Fix Rx DMA datasize and skb_over_panic
mana_get_rxbuf_cfg() aligns the RX buffer's DMA datasize to be multiple of 64. So a packet slightly bigger than mtu+14, say 1536, can be received and cause skb_over_panic. Sample dmesg: [ 5325.237162] skbuff: skb_over_panic: text:ffffffffc043277a len:1536 put:1536 head:ff1100018b517000 data:ff1100018b517100 tail:0x700 end:0x6ea dev:<NULL> [ 5325.243689] ------------[ cut here ]------------ [ 5325.245748] kernel BUG at net/core/skbuff.c:192! [ 5325.247838] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [ 5325.258374] RIP: 0010:skb_panic+0x4f/0x60 [ 5325.302941] Call Trace: [ 5325.304389] <IRQ> [ 5325.315794] ? skb_panic+0x4f/0x60 [ 5325.317457] ? asm_exc_invalid_op+0x1f/0x30 [ 5325.319490] ? skb_panic+0x4f/0x60 [ 5325.321161] skb_put+0x4e/0x50 [ 5325.322670] mana_poll+0x6fa/0xb50 [mana] [ 5325.324578] __napi_poll+0x33/0x1e0 [ 5325.326328] net_rx_action+0x12e/0x280 As discussed internally, this alignment is not necessary. To fix this bug, remove it from the code. So oversized packets will be marked as CQE_RX_TRUNCATED by NIC, and dropped. Cc: [email protected] Fixes: ca9c54d ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)") Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: Dexuan Cui <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 8767468 commit 313e0a3

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static void mana_get_rxbuf_cfg(int mtu, u32 *datasize, u32 *alloc_size,
601601

602602
*alloc_size = mtu + MANA_RXBUF_PAD + *headroom;
603603

604-
*datasize = ALIGN(mtu + ETH_HLEN, MANA_RX_DATA_ALIGN);
604+
*datasize = mtu + ETH_HLEN;
605605
}
606606

607607
static int mana_pre_alloc_rxbufs(struct mana_port_context *mpc, int new_mtu)

include/net/mana/mana.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ enum TRI_STATE {
3939
#define COMP_ENTRY_SIZE 64
4040

4141
#define RX_BUFFERS_PER_QUEUE 512
42-
#define MANA_RX_DATA_ALIGN 64
4342

4443
#define MAX_SEND_BUFFERS_PER_QUEUE 256
4544

0 commit comments

Comments
 (0)