[PATCH RFC net] ps3/gelic: Fix possible NULL pointer dereference
Geert Uytterhoeven
geert at linux-m68k.org
Thu Feb 22 19:45:31 AEDT 2024
Hi Simon,
On Wed, Feb 21, 2024 at 5:57 PM Simon Horman <horms at kernel.org> wrote:
> Fix possible NULL pointer dereference in gelic_card_release_tx_chain()
>
> The cited commit introduced a netdev variable to
> gelic_card_release_tx_chain() which is set unconditionally on each
> iteration of a for loop.
>
> It is set to the value of tx_chain->tail->skb->dev. However, in some
> cases it is assumed that tx_chain->tail->skb may be NULL. And if that
> occurs, setting netdev will cause a NULl pointer dereference.
Thanks for your patch!
> Given the age of this code I do wonder if this can occur in practice.
> But to be on the safe side this patch assumes that it can and aims to
> avoid the dereference in the case where tx_chain->tail->skb may be NULL.
The compiler may also lazy-load netdev until it's actually used,
avoiding the crash?
> Fixes: 589866f9f1cb ("PS3: gelic: Add support for dual network interface")
> Signed-off-by: Simon Horman <horms at kernel.org>
Reviewed-by: Geert Uytterhoeven <geert at linux-m68k.org>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
More information about the Linuxppc-dev
mailing list