Explorar o código

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 <jj@chaosbits.net>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Jesper Juhl %!s(int64=13) %!d(string=hai) anos
pai
achega
ae9a3405fd
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      drivers/net/wireless/ath/ath6kl/debug.c

+ 3 - 1
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);
 	}