Skip to content

Commit dd19e82

Browse files
jahay1anguy11
authored andcommitted
idpf: fix kernel panic on unknown packet types
In the very rare case where a packet type is unknown to the driver, idpf_rx_process_skb_fields would return early without calling eth_type_trans to set the skb protocol / the network layer handler. This is especially problematic if tcpdump is running when such a packet is received, i.e. it would cause a kernel panic. Instead, call eth_type_trans for every single packet, even when the packet type is unknown. Fixes: 3a8845a ("idpf: add RX splitq napi poll support") Reported-by: Balazs Nemeth <[email protected]> Signed-off-by: Joshua Hay <[email protected]> Reviewed-by: Jesse Brandeburg <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Tested-by: Salvatore Daniele <[email protected]> Signed-off-by: Pavan Kumar Linga <[email protected]> Tested-by: Krishneil Singh <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 8edfc7a commit dd19e82

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/intel/idpf/idpf_txrx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,6 +2941,8 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq,
29412941
rx_ptype = le16_get_bits(rx_desc->ptype_err_fflags0,
29422942
VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M);
29432943

2944+
skb->protocol = eth_type_trans(skb, rxq->vport->netdev);
2945+
29442946
decoded = rxq->vport->rx_ptype_lkup[rx_ptype];
29452947
/* If we don't know the ptype we can't do anything else with it. Just
29462948
* pass it up the stack as-is.
@@ -2951,8 +2953,6 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq,
29512953
/* process RSS/hash */
29522954
idpf_rx_hash(rxq, skb, rx_desc, &decoded);
29532955

2954-
skb->protocol = eth_type_trans(skb, rxq->vport->netdev);
2955-
29562956
if (le16_get_bits(rx_desc->hdrlen_flags,
29572957
VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_M))
29582958
return idpf_rx_rsc(rxq, skb, rx_desc, &decoded);

0 commit comments

Comments
 (0)