Skip to contentSkip to conversation

ieee802154: fix one possible memleak in ca8210_dev_com_init

PATCH In review Liu Jian 2 participants 3 messages Jul 20, 2020 – Jul 21, 2020

Subsystems (4)
lore
Share & tools
lore

Liu Jian

author
#0 lore raw

PATCH 1/1 ieee802154: fix one possible memleak in ca8210_dev_com_init

We should call destroy_workqueue to destroy mlme_workqueue in error branch.

Fixes ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
---
 drivers/net/ieee802154/ca8210.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ieee802154/ca8210.c +1 -0
index e04c3b60cae7..4eb64709d44c 100644
@@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv *priv)
 	);
 	if (!priv->irq_workqueue) {
 		dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n");
+		destroy_workqueue(priv->mlme_workqueue);
 		return -ENOMEM;
 	}
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Hello.

Quoted 13 lines · Liu Jian

We should call destroy_workqueue to destroy mlme_workqueue in error branch.

Fixes ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
---
  drivers/net/ieee802154/ca8210.c | 1 +
  1 file changed, 1 insertion(+)
drivers/net/ieee802154/ca8210.c +0 -0
index e04c3b60cae7..4eb64709d44c 100644

drivers/net/ieee802154/ca8210.c static int ca8210_dev_com_init(struct ca8210_priv *priv) · line 2930

Quoted 6 lines
drivers/net/ieee802154/ca8210.c +1 -0
@@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv *priv)
  	);
  	if (!priv->irq_workqueue) {
  		dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n");
+		destroy_workqueue(priv->mlme_workqueue);
  		return -ENOMEM;
  	}

For ieee802154 patches please keep the linux-wpan list in CC. This allows me to track patches with patchwork. Applied this one manually.

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

regards
Stefan Schmidt

#2 lore raw
Quoted 34 lines

-----Original Message-----
From: Stefan Schmidt [mailto:[email protected]]
Sent: Tuesday, July 21, 2020 4:35 PM
To: liujian (CE) <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net] ieee802154: fix one possible memleak in ca8210_dev_com_init

Hello.

Quoted 1 line · Liu Jian

We should call destroy_workqueue to destroy mlme_workqueue in error

branch.

drivers/net/ieee802154/ca8210.c static int ca8210_dev_com_init(struct ca8210_priv

Quoted 14 lines
Fixes ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device

driver")

---
  drivers/net/ieee802154/ca8210.c | 1 +
  1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/net/ieee802154/ca8210.c index e04c3b60cae7..4eb64709d44c 100644

drivers/net/ieee802154/ca8210.c +0 -0
@@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv

*priv)

drivers/net/ieee802154/ca8210.c static int ca8210_dev_com_init(struct ca8210_priv *priv)

Quoted 3 lines
drivers/net/ieee802154/ca8210.c +0 -0
  	);
  	if (!priv->irq_workqueue) {
  		dev_crit(&priv->spi->dev, "alloc of irq_workqueue
Quoted 7 lines

failed!\n");

drivers/net/ieee802154/ca8210.c static int ca8210_dev_com_init(struct ca8210_priv *priv) · line 2930

Quoted 3 lines
drivers/net/ieee802154/ca8210.c +1 -0
+		destroy_workqueue(priv->mlme_workqueue);
  		return -ENOMEM;
  	}

For ieee802154 patches please keep the linux-wpan list in CC. This allows me to track patches with patchwork. Applied this one manually.

Got it, thank you~

Quoted 5 lines

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

regards
Stefan Schmidt