diff options
author | Wenwen Wang <wenwen@cs.uga.edu> | 2019-08-15 22:50:02 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2019-09-03 16:39:33 +0300 |
commit | 145a32fe57e3ce195f52611ebadd0df911a56615 (patch) | |
tree | af77e02f09aab82564f130ee324d957400b3f9ce /drivers/net/wireless/cisco | |
parent | 7a2eb7367fdea72e448d1a847aa857f6caf8ea2f (diff) | |
download | blackbird-op-linux-145a32fe57e3ce195f52611ebadd0df911a56615.tar.gz blackbird-op-linux-145a32fe57e3ce195f52611ebadd0df911a56615.zip |
airo: fix memory leaks
In proc_BSSList_open(), 'file->private_data' is allocated through kzalloc()
and 'data->rbuffer' is allocated through kmalloc(). In the following
execution, if an error occurs, they are not deallocated, leading to memory
leaks. To fix this issue, free the allocated memory regions before
returning the error.
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/cisco')
-rw-r--r-- | drivers/net/wireless/cisco/airo.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 9342ffbe1e81..f43c06569ea1 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -5441,11 +5441,18 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { Cmd cmd; Resp rsp; - if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; + if (ai->flags & FLAG_RADIO_MASK) { + kfree(data->rbuffer); + kfree(file->private_data); + return -ENETDOWN; + } memset(&cmd, 0, sizeof(cmd)); cmd.cmd=CMD_LISTBSS; - if (down_interruptible(&ai->sem)) + if (down_interruptible(&ai->sem)) { + kfree(data->rbuffer); + kfree(file->private_data); return -ERESTARTSYS; + } issuecommand(ai, &cmd, &rsp); up(&ai->sem); data->readlen = 0; |