Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wenwen Wang and committed by
David S. Miller
c554336e 6d5afe20

+3 -1
+3 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
··· 3236 3236 return -ENOMEM; 3237 3237 3238 3238 err = bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz); 3239 - if (err) 3239 + if (err) { 3240 + kvfree(t); 3240 3241 return err; 3242 + } 3241 3243 3242 3244 bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz); 3243 3245 kvfree(t);