[lvc-project] [PATCH] dl2k: Fix potential NULL pointer dereference in receive_packet()

Jacob Keller jacob.e.keller at intel.com
Thu Feb 15 00:56:17 MSK 2024



On 2/13/2024 12:09 PM, Rand Deeb wrote:
The subject doesn't indicate which tree for netdev it would target, but
this seems like an obvious bug fix for net.

> @@ -972,6 +972,14 @@ receive_packet (struct net_device *dev)
>  							   np->rx_buf_sz,
>  							   DMA_FROM_DEVICE);
>  			}
> +			if (skb == NULL) {
> +				np->rx_ring[entry].fraginfo = 0;
> +				printk (KERN_INFO
> +				       "%s: receive_packet: "
> +				       "Unable to re-allocate Rx skbuff.#%d\n",
> +				       dev->name, entry);

You could use netdev_warn here instead of printk, which would include
the device information. I checked a couple other drivers and none of
them appear to log any message when this fails. A handful increment a
driver count of how many allocation failures occurred. I'm not sure how
helpful this print would be in practice.

With or without changes to the printed warning message:

Reviewed-by: Jacob Keller <jacob.e.keller at intel.com>



More information about the lvc-project mailing list