Skip to content

Commit

Permalink
ieee802154: fix one possible memleak in adf7242_probe
Browse files Browse the repository at this point in the history
When probe fail, we should destroy the workqueue.

Fixes: 2795e8c ("net: ieee802154: fix a potential NULL pointer dereference")
Signed-off-by: Liu Jian <liujian56@huawei.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/20200717090121.2143-1-liujian56@huawei.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
  • Loading branch information
Liu Jian authored and Stefan Schmidt committed Jul 17, 2020
1 parent 473309f commit 66673f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ieee802154/adf7242.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 66673f9

Please sign in to comment.