linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: Lino Sanfilippo <LinoSanfilippo@gmx.de>, <netdev@vger.kernel.org>,
	<ahmedtamrawi@gmail.com>, <davem@davemloft.net>,
	<linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wil6210: Fix potential memory leaks on error paths
Date: Sun, 30 Nov 2014 10:28:39 +0200	[thread overview]
Message-ID: <3345120.HXl93bohCX@lx-wigig-72> (raw)
In-Reply-To: <1417139239-32602-1-git-send-email-LinoSanfilippo@gmx.de>

On Friday, November 28, 2014 02:47:19 AM Lino Sanfilippo wrote:
> Fix missing memory deallocation on error paths in wil_write_file_wmi()
> and wil_write_file_txmgmt().
> 
> Reported-by: Ahmed Tamrawi <ahmedtamrawi@gmail.com>
> Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
> ---
>  drivers/net/wireless/ath/wil6210/debugfs.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
> index 54a6ddc..4e6e145 100644
> --- a/drivers/net/wireless/ath/wil6210/debugfs.c
> +++ b/drivers/net/wireless/ath/wil6210/debugfs.c
> @@ -573,8 +573,10 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
>  	if (!frame)
>  		return -ENOMEM;
>  
> -	if (copy_from_user(frame, buf, len))
> +	if (copy_from_user(frame, buf, len)) {
> +		kfree(frame);
>  		return -EIO;
> +	}
>  
>  	params.buf = frame;
>  	params.len = len;
> @@ -614,8 +616,10 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
>  		return -ENOMEM;
>  
>  	rc = simple_write_to_buffer(wmi, len, ppos, buf, len);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		kfree(wmi);
>  		return rc;
> +	}
>  
>  	cmd = &wmi[1];
>  	cmdid = le16_to_cpu(wmi->id);
> 

Lino and Ahmed: thanks for that. Here is my
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>

John: please merge

           reply	other threads:[~2014-11-30  8:29 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1417139239-32602-1-git-send-email-LinoSanfilippo@gmx.de>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3345120.HXl93bohCX@lx-wigig-72 \
    --to=qca_vkondrat@qca.qualcomm.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=ahmedtamrawi@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).