Re: [PATCH] net: ethernet: fix NULL dereference in nixge_recv()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/11/24 09:34, Ma Ke wrote:
In function nixge_recv() dereference of NULL pointer priv->rx_bd_v is
possible for the case of its allocation failure in netdev_priv(ndev).

please be more precise about the case, rx_bd_v is not set during
netdev(w/priv) allocation

the embedded priv part is allocated together with the netdev, in the
.probe()


Move while() loop with priv->rx_bd_v dereference under the check for
its validity.

this style has some benefits, but in the kernel we prefer the early
return:
	if (!priv->rx_bd_v)
		return 0;

instead of touching a whole function


Cc: stable@xxxxxxxxxxxxxxx
Fixes: 492caffa8a1a ("net: ethernet: nixge: Add support for National Instruments XGE netdev")
Signed-off-by: Ma Ke <make_ruc2021@xxxxxxx>
---
  drivers/net/ethernet/ni/nixge.c | 86 ++++++++++++++++-----------------
  1 file changed, 43 insertions(+), 43 deletions(-)




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux