[PATCH net] net: ethernet: mtk_ppe: avoid NULL deref when gmac0 is disabled

Simon Horman horms at kernel.org
Thu Mar 26 10:15:27 PDT 2026


On Tue, Mar 24, 2026 at 09:36:01AM +0100, Sven Eckelmann (Plasma Cloud) wrote:
> If the gmac0 is disabled, the precheck for a valid ingress device will
> cause a NULL pointer deref and crash the system. This happens because
> eth->netdev[0] will be NULL but the code will directly try to access
> netdev_ops.
> 
> Instead of just checking for the first net_device, it must be checked if
> any of the mtk_eth net_devices is matching the netdev_ops of the ingress
> device.
> 
> Cc: stable at vger.kernel.org
> Fixes: 73cfd947dbdb ("net: ethernet: mtk_eth_soc: ppe: prevent ppe update for non-mtk devices")
> Signed-off-by: Sven Eckelmann (Plasma Cloud) <se at simonwunderlich.de>

Reviewed-by: Simon Horman <horms at kernel.org>




More information about the Linux-mediatek mailing list