mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-12-19 09:08:10 +01:00
net: sxgbe: fix potential NULL dereference in sxgbe_rx()
[ Upstream commitf5bce28f6b] 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:1edb9ca69e("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
aa20dcff03
commit
7fd789d6ea
|
|
@ -1521,8 +1521,10 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit)
|
||||||
|
|
||||||
skb = priv->rxq[qnum]->rx_skbuff[entry];
|
skb = priv->rxq[qnum]->rx_skbuff[entry];
|
||||||
|
|
||||||
if (unlikely(!skb))
|
if (unlikely(!skb)) {
|
||||||
netdev_err(priv->dev, "rx descriptor is not consistent\n");
|
netdev_err(priv->dev, "rx descriptor is not consistent\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
prefetch(skb->data - NET_IP_ALIGN);
|
prefetch(skb->data - NET_IP_ALIGN);
|
||||||
priv->rxq[qnum]->rx_skbuff[entry] = NULL;
|
priv->rxq[qnum]->rx_skbuff[entry] = NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user