Skip to content

Commit 2bae900

Browse files
z00467499kuba-moo
authored andcommitted
net: dsa: mv88e6xxx: Fix memleak in mv88e6xxx_region_atu_snapshot
When mv88e6xxx_fid_map return error, we lost free the table. Fix it. Fixes: bfb2554 ("net: dsa: mv88e6xxx: Add devlink regions") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: zhangxiaoxu <zhangxiaoxu5@huawei.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20201109144416.1540867-1-zhangxiaoxu5@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 909172a commit 2bae900

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/net/dsa/mv88e6xxx/devlink.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,10 @@ static int mv88e6xxx_region_atu_snapshot(struct devlink *dl,
393393
mv88e6xxx_reg_lock(chip);
394394

395395
err = mv88e6xxx_fid_map(chip, fid_bitmap);
396-
if (err)
396+
if (err) {
397+
kfree(table);
397398
goto out;
399+
}
398400

399401
while (1) {
400402
fid = find_next_bit(fid_bitmap, MV88E6XXX_N_FID, fid + 1);

0 commit comments

Comments
 (0)