Commit 2bae900b authored by zhangxiaoxu's avatar zhangxiaoxu Committed by Jakub Kicinski

net: dsa: mv88e6xxx: Fix memleak in mv88e6xxx_region_atu_snapshot

When mv88e6xxx_fid_map return error, we lost free the table.

Fix it.

Fixes: bfb25542 ("net: dsa: mv88e6xxx: Add devlink regions")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarzhangxiaoxu <zhangxiaoxu5@huawei.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20201109144416.1540867-1-zhangxiaoxu5@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 909172a1
......@@ -393,8 +393,10 @@ static int mv88e6xxx_region_atu_snapshot(struct devlink *dl,
mv88e6xxx_reg_lock(chip);
err = mv88e6xxx_fid_map(chip, fid_bitmap);
if (err)
if (err) {
kfree(table);
goto out;
}
while (1) {
fid = find_next_bit(fid_bitmap, MV88E6XXX_N_FID, fid + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment