From ae9a3405fd28ce05dc3d0b51d541fd5ec742b3b4 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Wed, 11 Apr 2012 22:41:36 +0200 Subject: ath6kl: fix memory leak in ath6kl_fwlog_block_read() If, in drivers/net/wireless/ath/ath6kl/debug.c::ath6kl_fwlog_block_read(), the call to wait_for_completion_interruptible() returns -ERESTARTSYS then we'll return without freeing the (as yet unused) memory we allocated for 'buf' - thus leaking it. Signed-off-by: Jesper Juhl Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath6kl/debug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/net/wireless/ath/ath6kl/debug.c') diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index 2bcd45095eb9..496382f472de 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c @@ -407,8 +407,10 @@ static ssize_t ath6kl_fwlog_block_read(struct file *file, ret = wait_for_completion_interruptible( &ar->debug.fwlog_completion); - if (ret == -ERESTARTSYS) + if (ret == -ERESTARTSYS) { + vfree(buf); return ret; + } spin_lock(&ar->debug.fwlog_queue.lock); } -- cgit v1.2.3 From eb38987e899369d936c55f93f631062c417435d2 Mon Sep 17 00:00:00 2001 From: Raja Mani Date: Mon, 16 Apr 2012 16:09:56 +0530 Subject: ath6kl: Retain bg scan period value modified by the user Added a new member bg_scan_period in struct ath6kl_vif to retain background scan period value configured via debugfs entry 'bgscan_interval'. This backup is needed in schedule scan path while configuring scan parameters. Signed-off-by: Raja Mani Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath6kl/debug.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/net/wireless/ath/ath6kl/debug.c') diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index 496382f472de..acb6430d8e7e 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c @@ -1578,10 +1578,15 @@ static ssize_t ath6kl_bgscan_int_write(struct file *file, size_t count, loff_t *ppos) { struct ath6kl *ar = file->private_data; + struct ath6kl_vif *vif; u16 bgscan_int; char buf[32]; ssize_t len; + vif = ath6kl_vif_first(ar); + if (!vif) + return -EIO; + len = min(count, sizeof(buf) - 1); if (copy_from_user(buf, user_buf, len)) return -EFAULT; @@ -1593,6 +1598,8 @@ static ssize_t ath6kl_bgscan_int_write(struct file *file, if (bgscan_int == 0) bgscan_int = 0xffff; + vif->bg_scan_period = bgscan_int; + ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0, bgscan_int, 0, 0, 0, 3, 0, 0, 0); -- cgit v1.2.3 From 92ada0468c50eba6546618a643ecd0af7af7435a Mon Sep 17 00:00:00 2001 From: Thomas Pedersen Date: Fri, 20 Apr 2012 11:33:07 -0700 Subject: ath6kl: unblock fwlog_block_read() on exit Complete the waiting fwlog_block_read on debugfs cleanup, otherwise userspace and module unload might softlock. Signed-off-by: Thomas Pedersen Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath6kl/debug.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/wireless/ath/ath6kl/debug.c') diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index acb6430d8e7e..ced6c6fe5470 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c @@ -1824,6 +1824,7 @@ int ath6kl_debug_init_fs(struct ath6kl *ar) void ath6kl_debug_cleanup(struct ath6kl *ar) { skb_queue_purge(&ar->debug.fwlog_queue); + complete(&ar->debug.fwlog_completion); kfree(ar->debug.roam_tbl); } -- cgit v1.2.3