Skip to content

Commit f5bce28

Browse files
akodanevkuba-moo
authored andcommitted
net: sxgbe: fix potential NULL dereference in sxgbe_rx()
Currently, when skb is null, the driver prints an error and then dereferences skb on the next line. To fix this, let's add a 'break' after the error message to switch to sxgbe_rx_refill(), which is similar to the approach taken by the other drivers in this particular case, e.g. calxeda with xgmac_rx(). Found during a code review. Fixes: 1edb9ca ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver") Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20251121123834.97748-1-aleksei.kodanev@bell-sw.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0ae9cfc commit f5bce28

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,8 +1521,10 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit)
15211521

15221522
skb = priv->rxq[qnum]->rx_skbuff[entry];
15231523

1524-
if (unlikely(!skb))
1524+
if (unlikely(!skb)) {
15251525
netdev_err(priv->dev, "rx descriptor is not consistent\n");
1526+
break;
1527+
}
15261528

15271529
prefetch(skb->data - NET_IP_ALIGN);
15281530
priv->rxq[qnum]->rx_skbuff[entry] = NULL;

0 commit comments

Comments
 (0)