diff mbox series

[v2,net] ieee802154: fix one possible memleak in adf7242_probe

Message ID 20200720143001.40194-1-liujian56@huawei.com
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series [v2,net] ieee802154: fix one possible memleak in adf7242_probe | expand

Commit Message

Liu Jian July 20, 2020, 2:30 p.m. UTC
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>
---
v1->v2:
Change targeting from "net-next" to "net"

 drivers/net/ieee802154/adf7242.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Stefan Schmidt July 20, 2020, 2:15 p.m. UTC | #1
Hello.

On 20.07.20 16:30, 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>
> ---
> v1->v2:
> Change targeting from "net-next" to "net"


Before sending a second version make sure you check replies to your 
patch postings. I already applied the v1 patch to my wpan tree which 
goes into net.

As v2 it is identical v1 therei s nothing to do here for me.

regards
Stefan Schmidt
Liu Jian July 21, 2020, 1:33 a.m. UTC | #2
> -----Original Message-----
> From: Stefan Schmidt [mailto:stefan@datenfreihafen.org]
> Sent: Monday, July 20, 2020 10:16 PM
> To: liujian (CE) <liujian56@huawei.com>; michael.hennerich@analog.com;
> alex.aring@gmail.com; davem@davemloft.net; kuba@kernel.org;
> kjlu@umn.edu; netdev@vger.kernel.org
> Subject: Re: [PATCH v2 net] ieee802154: fix one possible memleak in
> adf7242_probe
> 
> Hello.
> 
> On 20.07.20 16:30, 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>
> > ---
> > v1->v2:
> > Change targeting from "net-next" to "net"
> 
> 
> Before sending a second version make sure you check replies to your patch
> postings. I already applied the v1 patch to my wpan tree which goes into net.
I am sorry for this, I will check the mail first hereafter.
> As v2 it is identical v1 therei s nothing to do here for me.
> 
> regards
> Stefan Schmidt
diff mbox series

Patch

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);