summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-13 12:18:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-10 12:33:46 +0300
commit2c3dd20f852ab092e7be9e063f6d5298a6567e4a (patch)
tree83f32c70f573dfe194fd11b63da75dafe77676c8 /drivers/net
parentb8cd0b7b09ed932c7c16825ac9a853b2507e316c (diff)
downloadlinux-2c3dd20f852ab092e7be9e063f6d5298a6567e4a.tar.xz
cxgb4: fix a memory leak bug
[ Upstream commit c554336efa9bbc28d6ec14efbee3c7d63c61a34f ] In blocked_fl_write(), 't' is not deallocated if bitmap_parse_user() fails, leading to a memory leak bug. To fix this issue, free t before returning the error. Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 0f72f9c4ec74..b429b726b987 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -3276,8 +3276,10 @@ static ssize_t blocked_fl_write(struct file *filp, const char __user *ubuf,
return -ENOMEM;
err = bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz);
- if (err)
+ if (err) {
+ kvfree(t);
return err;
+ }
bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz);
kvfree(t);