diff options
author | Wenwen Wang <wenwen@cs.uga.edu> | 2019-08-13 11:18:52 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-08-15 05:03:42 +0200 |
commit | c554336efa9bbc28d6ec14efbee3c7d63c61a34f (patch) | |
tree | 42f805635256b26be06b10e3e7bd9e5469869ebd /drivers | |
parent | sctp: fix memleak in sctp_send_reset_streams (diff) | |
download | linux-c554336efa9bbc28d6ec14efbee3c7d63c61a34f.tar.xz linux-c554336efa9bbc28d6ec14efbee3c7d63c61a34f.zip |
cxgb4: fix a memory leak bug
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 4 |
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 02959035ed3f..d692251ee252 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c @@ -3236,8 +3236,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); |