]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: sparx5: do not refer to skb after passing it on
authorSteen Hegelund <steen.hegelund@microchip.com>
Wed, 2 Feb 2022 08:30:39 +0000 (09:30 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 2 Feb 2022 17:07:22 +0000 (09:07 -0800)
Do not try to use any SKB fields after the packet has been passed up in the
receive stack.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Link: https://lore.kernel.org/r/20220202083039.3774851-1-steen.hegelund@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c

index dc7e5ea6ec158f9c67b8974767f8be3d735a796e..148d431fcde429f665332a7738fa943921959712 100644 (file)
@@ -145,9 +145,9 @@ static void sparx5_xtr_grp(struct sparx5 *sparx5, u8 grp, bool byte_swap)
        skb_put(skb, byte_cnt - ETH_FCS_LEN);
        eth_skb_pad(skb);
        skb->protocol = eth_type_trans(skb, netdev);
-       netif_rx(skb);
        netdev->stats.rx_bytes += skb->len;
        netdev->stats.rx_packets++;
+       netif_rx(skb);
 }
 
 static int sparx5_inject(struct sparx5 *sparx5,