]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
idpf: fix kernel panic on unknown packet types
authorJoshua Hay <joshua.a.hay@intel.com>
Thu, 21 Mar 2024 00:09:25 +0000 (17:09 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:38:05 +0000 (16:38 +0200)
commit dd19e827d63ac60debf117676d1126bff884bdb8 upstream.

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: 3a8845af66ed ("idpf: add RX splitq napi poll support")
Reported-by: Balazs Nemeth <bnemeth@redhat.com>
Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Salvatore Daniele <sdaniele@redhat.com>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/intel/idpf/idpf_txrx.c

index 2f8ad79ae3f046a6841c8602f0d4e62137d98810..017a081d858020434b53148cf4c30d831bb690b2 100644 (file)
@@ -2940,6 +2940,8 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq,
        rx_ptype = le16_get_bits(rx_desc->ptype_err_fflags0,
                                 VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M);
 
+       skb->protocol = eth_type_trans(skb, rxq->vport->netdev);
+
        decoded = rxq->vport->rx_ptype_lkup[rx_ptype];
        /* If we don't know the ptype we can't do anything else with it. Just
         * pass it up the stack as-is.
@@ -2950,8 +2952,6 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq,
        /* process RSS/hash */
        idpf_rx_hash(rxq, skb, rx_desc, &decoded);
 
-       skb->protocol = eth_type_trans(skb, rxq->vport->netdev);
-
        if (le16_get_bits(rx_desc->hdrlen_flags,
                          VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_M))
                return idpf_rx_rsc(rxq, skb, rx_desc, &decoded);