All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sean.wang@mediatek.com
Cc: linux-mediatek@lists.infradead.org, lorenzo.bianconi@redhat.com,
	ryder.lee@mediatek.com, linux-wireless@vger.kernel.org,
	nbd@nbd.name
Subject: Re: [PATCH 3/3] mt76: mt7615: fix potential memory leak in mcu message handler
Date: Tue, 30 Jun 2020 09:17:01 +0200	[thread overview]
Message-ID: <20200630071701.GC2169@localhost.localdomain> (raw)
In-Reply-To: <b1dc67b62bcc53ad02e86099ac0aab312109094b.1593491298.git.sean.wang@mediatek.com>


[-- Attachment #1.1: Type: text/plain, Size: 1257 bytes --]

> From: Sean Wang <sean.wang@mediatek.com>
> 
> Fix potential memory leak in mcu message handler on error condition.
> 

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> Fixes: 0e6a29e477f3 ("mt76: mt7615: add support to read temperature from mcu")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index 1b46cccd93c5..58e3838a3dba 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -183,8 +183,10 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd,
>  	struct mt7615_mcu_rxd *rxd = (struct mt7615_mcu_rxd *)skb->data;
>  	int ret = 0;
>  
> -	if (seq != rxd->seq)
> -		return -EAGAIN;
> +	if (seq != rxd->seq) {
> +		ret = -EAGAIN;
> +		goto out;
> +	}
>  
>  	switch (cmd) {
>  	case MCU_CMD_PATCH_SEM_CONTROL:
> @@ -215,6 +217,7 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd,
>  	default:
>  		break;
>  	}
> +out:
>  	dev_kfree_skb(skb);
>  
>  	return ret;
> -- 
> 2.25.1

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sean.wang@mediatek.com
Cc: nbd@nbd.name, lorenzo.bianconi@redhat.com,
	ryder.lee@mediatek.com, linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 3/3] mt76: mt7615: fix potential memory leak in mcu message handler
Date: Tue, 30 Jun 2020 09:17:01 +0200	[thread overview]
Message-ID: <20200630071701.GC2169@localhost.localdomain> (raw)
In-Reply-To: <b1dc67b62bcc53ad02e86099ac0aab312109094b.1593491298.git.sean.wang@mediatek.com>

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

> From: Sean Wang <sean.wang@mediatek.com>
> 
> Fix potential memory leak in mcu message handler on error condition.
> 

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> Fixes: 0e6a29e477f3 ("mt76: mt7615: add support to read temperature from mcu")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index 1b46cccd93c5..58e3838a3dba 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -183,8 +183,10 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd,
>  	struct mt7615_mcu_rxd *rxd = (struct mt7615_mcu_rxd *)skb->data;
>  	int ret = 0;
>  
> -	if (seq != rxd->seq)
> -		return -EAGAIN;
> +	if (seq != rxd->seq) {
> +		ret = -EAGAIN;
> +		goto out;
> +	}
>  
>  	switch (cmd) {
>  	case MCU_CMD_PATCH_SEM_CONTROL:
> @@ -215,6 +217,7 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd,
>  	default:
>  		break;
>  	}
> +out:
>  	dev_kfree_skb(skb);
>  
>  	return ret;
> -- 
> 2.25.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2020-06-30  7:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  4:37 [PATCH 1/3] mt76: mt7663u: fix memory leak in set key sean.wang
2020-06-30  4:37 ` sean.wang
2020-06-30  4:37 ` [PATCH 2/3] mt76: mt7663u: fix potential memory leak in mcu message handler sean.wang
2020-06-30  4:37   ` sean.wang
2020-06-30  7:13   ` Lorenzo Bianconi
2020-06-30  7:13     ` Lorenzo Bianconi
2020-06-30  4:37 ` [PATCH 3/3] mt76: mt7615: " sean.wang
2020-06-30  4:37   ` sean.wang
2020-06-30  7:17   ` Lorenzo Bianconi [this message]
2020-06-30  7:17     ` Lorenzo Bianconi
2020-06-30  7:07 ` [PATCH 1/3] mt76: mt7663u: fix memory leak in set key Lorenzo Bianconi
2020-06-30  7:07   ` Lorenzo Bianconi
2020-06-30  7:24 ` Lorenzo Bianconi
2020-06-30  7:24   ` Lorenzo Bianconi
2020-06-30 21:41   ` sean.wang
2020-06-30 21:41     ` sean.wang

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=20200630071701.GC2169@localhost.localdomain \
    --to=lorenzo@kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.