summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorzhangxiaoxu <zhangxiaoxu5@huawei.com>2020-11-09 15:44:16 +0100
committerJakub Kicinski <kuba@kernel.org>2020-11-11 02:49:06 +0100
commit2bae900b9419db3f3e43bbda3194657235fee096 (patch)
treea5811e5c09c9e407aace0c22fd0312902290026e /drivers
parentnet: Update window_clamp if SOCK_RCVBUF is set (diff)
downloadlinux-2bae900b9419db3f3e43bbda3194657235fee096.tar.xz
linux-2bae900b9419db3f3e43bbda3194657235fee096.zip
net: dsa: mv88e6xxx: Fix memleak in mv88e6xxx_region_atu_snapshot
When mv88e6xxx_fid_map return error, we lost free the table. Fix it. Fixes: bfb255428966 ("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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/dsa/mv88e6xxx/devlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/devlink.c b/drivers/net/dsa/mv88e6xxx/devlink.c
index 10cd1bfd81a0..ade04c036fd9 100644
--- a/drivers/net/dsa/mv88e6xxx/devlink.c
+++ b/drivers/net/dsa/mv88e6xxx/devlink.c
@@ -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);