linux/drivers/net/ethernet/airoha
Lorenzo Bianconi 09bccf56db net: airoha: Validate egress gdm port in airoha_ppe_foe_entry_prepare()
Dev pointer in airoha_ppe_foe_entry_prepare routine is not strictly
a device allocated by airoha_eth driver since it is an egress device
and the flowtable can contain even wlan, pppoe or vlan devices. E.g:

flowtable ft {
        hook ingress priority filter
        devices = { eth1, lan1, lan2, lan3, lan4, wlan0 }
        flags offload                               ^
                                                    |
                     "not allocated by airoha_eth" --
}

In this case airoha_get_dsa_port() will just return the original device
pointer and we can't assume netdev priv pointer points to an
airoha_gdm_port struct.
Fix the issue validating egress gdm port in airoha_ppe_foe_entry_prepare
routine before accessing net_device priv pointer.

Fixes: 00a7678310 ("net: airoha: Introduce flowtable offload support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250401-airoha-validate-egress-gdm-port-v4-1-c7315d33ce10@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-04-03 15:18:16 -07:00
..
Kconfig net: airoha: Introduce Airoha NPU support 2025-03-04 13:22:09 +01:00
Makefile net: airoha: Introduce PPE debugfs support 2025-03-04 13:22:10 +01:00
airoha_eth.c net: airoha: Validate egress gdm port in airoha_ppe_foe_entry_prepare() 2025-04-03 15:18:16 -07:00
airoha_eth.h net: airoha: Validate egress gdm port in airoha_ppe_foe_entry_prepare() 2025-04-03 15:18:16 -07:00
airoha_npu.c net: airoha: Introduce Airoha NPU support 2025-03-04 13:22:09 +01:00
airoha_npu.h net: airoha: Introduce Airoha NPU support 2025-03-04 13:22:09 +01:00
airoha_ppe.c net: airoha: Validate egress gdm port in airoha_ppe_foe_entry_prepare() 2025-04-03 15:18:16 -07:00
airoha_ppe_debugfs.c net: airoha: Introduce PPE debugfs support 2025-03-04 13:22:10 +01:00
airoha_regs.h net: airoha: Enable Rx Scatter-Gather 2025-03-06 16:41:13 -08:00