mirror of
https://github.com/torvalds/linux.git
synced 2026-12-06 05:14:35 +00:00
net: dsa: felix: Fix memory leak in felix_setup_mmio_filtering
Avoid a memory leak if there is not a CPU port defined.
Fixes: 8d5f7954b7 ("net: dsa: felix: break at first CPU port during init and teardown")
Addresses-Coverity-ID: 1492897 ("Resource leak")
Addresses-Coverity-ID: 1492899 ("Resource leak")
Signed-off-by: José Expósito <[email protected]>
Reviewed-by: Vladimir Oltean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
committed by
Jakub Kicinski
parent
37ad4e2a77
commit
e8b1d76980
@@ -290,8 +290,11 @@ static int felix_setup_mmio_filtering(struct felix *felix)
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu < 0)
|
||||
if (cpu < 0) {
|
||||
kfree(tagging_rule);
|
||||
kfree(redirect_rule);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
tagging_rule->key_type = OCELOT_VCAP_KEY_ETYPE;
|
||||
*(__be16 *)tagging_rule->key.etype.etype.value = htons(ETH_P_1588);
|
||||
|
||||
Reference in New Issue
Block a user