Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
* RE: [PATCH net-next] ieee802154: fix one possible memleak in adf7242_probe
  2020-07-17  9:01 [PATCH net-next] ieee802154: fix one possible memleak in adf7242_probe Liu Jian
@ 2020-07-17  8:32 ` Hennerich, Michael
  2020-07-17  9:52 ` Stefan Schmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Hennerich, Michael @ 2020-07-17  8:32 UTC (permalink / raw)
  To: Liu Jian, alex.aring, stefan, davem, kuba, kjlu, linux-wpan, netdev


> -----Original Message-----
> From: Liu Jian <liujian56@huawei.com>
> Sent: Freitag, 17. Juli 2020 11:01
> To: Hennerich, Michael <Michael.Hennerich@analog.com>;
> alex.aring@gmail.com; stefan@datenfreihafen.org; davem@davemloft.net;
> kuba@kernel.org; kjlu@umn.edu; linux-wpan@vger.kernel.org;
> netdev@vger.kernel.org
> Subject: [PATCH net-next] ieee802154: fix one possible memleak in
> adf7242_probe
> 
> When probe fail, we should destroy the workqueue.
> 
> Fixes: 2795e8c25161 ("net: ieee802154: fix a potential NULL pointer
> dereference")
> Signed-off-by: Liu Jian <liujian56@huawei.com>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  drivers/net/ieee802154/adf7242.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ieee802154/adf7242.c
> b/drivers/net/ieee802154/adf7242.c
> index 5a37514e4234..8dbccec6ac86 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1262,7 +1262,7 @@ static int adf7242_probe(struct spi_device *spi)
>  					     WQ_MEM_RECLAIM);
>  	if (unlikely(!lp->wqueue)) {
>  		ret = -ENOMEM;
> -		goto err_hw_init;
> +		goto err_alloc_wq;
>  	}
> 
>  	ret = adf7242_hw_init(lp);
> @@ -1294,6 +1294,8 @@ static int adf7242_probe(struct spi_device *spi)
>  	return ret;
> 
>  err_hw_init:
> +	destroy_workqueue(lp->wqueue);
> +err_alloc_wq:
>  	mutex_destroy(&lp->bmux);
>  	ieee802154_free_hw(lp->hw);
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net-next] ieee802154: fix one possible memleak in adf7242_probe
@ 2020-07-17  9:01 Liu Jian
  2020-07-17  8:32 ` Hennerich, Michael
  2020-07-17  9:52 ` Stefan Schmidt
  0 siblings, 2 replies; 3+ messages in thread
From: Liu Jian @ 2020-07-17  9:01 UTC (permalink / raw)
  To: michael.hennerich, alex.aring, stefan, davem, kuba, kjlu,
	linux-wpan, netdev

When probe fail, we should destroy the workqueue.

Fixes: 2795e8c25161 ("net: ieee802154: fix a potential NULL pointer dereference")
Signed-off-by: Liu Jian <liujian56@huawei.com>
---
 drivers/net/ieee802154/adf7242.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 5a37514e4234..8dbccec6ac86 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -1262,7 +1262,7 @@ static int adf7242_probe(struct spi_device *spi)
 					     WQ_MEM_RECLAIM);
 	if (unlikely(!lp->wqueue)) {
 		ret = -ENOMEM;
-		goto err_hw_init;
+		goto err_alloc_wq;
 	}
 
 	ret = adf7242_hw_init(lp);
@@ -1294,6 +1294,8 @@ static int adf7242_probe(struct spi_device *spi)
 	return ret;
 
 err_hw_init:
+	destroy_workqueue(lp->wqueue);
+err_alloc_wq:
 	mutex_destroy(&lp->bmux);
 	ieee802154_free_hw(lp->hw);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ieee802154: fix one possible memleak in adf7242_probe
  2020-07-17  9:01 [PATCH net-next] ieee802154: fix one possible memleak in adf7242_probe Liu Jian
  2020-07-17  8:32 ` Hennerich, Michael
@ 2020-07-17  9:52 ` Stefan Schmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Schmidt @ 2020-07-17  9:52 UTC (permalink / raw)
  To: Liu Jian, michael.hennerich, alex.aring, davem, kuba, kjlu,
	linux-wpan, netdev

Hello.

On 17.07.20 11:01, Liu Jian wrote:
> When probe fail, we should destroy the workqueue.
> 
> Fixes: 2795e8c25161 ("net: ieee802154: fix a potential NULL pointer dereference")
> Signed-off-by: Liu Jian <liujian56@huawei.com>
> ---
>   drivers/net/ieee802154/adf7242.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> index 5a37514e4234..8dbccec6ac86 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1262,7 +1262,7 @@ static int adf7242_probe(struct spi_device *spi)
>   					     WQ_MEM_RECLAIM);
>   	if (unlikely(!lp->wqueue)) {
>   		ret = -ENOMEM;
> -		goto err_hw_init;
> +		goto err_alloc_wq;
>   	}
>   
>   	ret = adf7242_hw_init(lp);
> @@ -1294,6 +1294,8 @@ static int adf7242_probe(struct spi_device *spi)
>   	return ret;
>   
>   err_hw_init:
> +	destroy_workqueue(lp->wqueue);
> +err_alloc_wq:
>   	mutex_destroy(&lp->bmux);
>   	ieee802154_free_hw(lp->hw);
>   
> 


This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17  9:01 [PATCH net-next] ieee802154: fix one possible memleak in adf7242_probe Liu Jian
2020-07-17  8:32 ` Hennerich, Michael
2020-07-17  9:52 ` Stefan Schmidt

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git