Re: [PATCH net-next] ieee802154: fix one possible memleak in adf7242_probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
  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



[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux