]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
net: ethernet: mtk_ppe: avoid NULL deref when gmac0 is disabled
authorSven Eckelmann (Plasma Cloud) <se@simonwunderlich.de>
Tue, 24 Mar 2026 08:36:01 +0000 (09:36 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Mar 2026 02:01:25 +0000 (19:01 -0700)
commit976ff48c2ac6e6b25b01428c9d7997bcd0fb2949
tree2cb2383083da99c3f04b66a1c558b9937fee8b5b
parentf73896b4197ed53cf0894657c899265ef7c86b7a
net: ethernet: mtk_ppe: avoid NULL deref when gmac0 is disabled

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@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@simonwunderlich.de>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260324-wed-crash-gmac0-disabled-v1-1-3bc388aee565@simonwunderlich.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mediatek/mtk_ppe_offload.c