Skip to content

Commit a857f5c

Browse files
ISCAS-VulabNipaLocal
authored and
NipaLocal
committed
net: dsa: felix: Add NULL check for outer_tagging_rule()
In felix_update_tag_8021q_rx_rules(), the return value of ocelot_vcap_block_find_filter_by_id() is not checked, which could lead to a NULL pointer dereference if the filter is not found. Add the necessary check and use `continue` to skip the current CPU port if the filter is not found, ensuring that all CPU ports are processed. Fixes: f1288fd ("net: dsa: felix: fix VLAN tag loss on CPU reception with ocelot-8021q") Cc: [email protected] # 6.11+ Signed-off-by: Wentao Liang <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 790496b commit a857f5c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ static int felix_update_tag_8021q_rx_rules(struct dsa_switch *ds, int port,
348348

349349
outer_tagging_rule = ocelot_vcap_block_find_filter_by_id(block_vcap_es0,
350350
cookie, false);
351+
if (!outer_tagging_rule)
352+
continue;
351353

352354
felix_update_tag_8021q_rx_rule(outer_tagging_rule, vlan_filtering);
353355

0 commit comments

Comments
 (0)