diff mbox series

[net] ieee802154: fix one possible memleak in ca8210_dev_com_init

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

Commit Message

Liu Jian July 20, 2020, 2:33 p.m. UTC
We should call destroy_workqueue to destroy mlme_workqueue in error branch.

Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
Signed-off-by: Liu Jian <liujian56@huawei.com>
---
 drivers/net/ieee802154/ca8210.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stefan Schmidt July 21, 2020, 8:35 a.m. UTC | #1
Hello.

On 20.07.20 16:33, Liu Jian wrote:
> We should call destroy_workqueue to destroy mlme_workqueue in error branch.
> 
> Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
> Signed-off-by: Liu Jian <liujian56@huawei.com>
> ---
>   drivers/net/ieee802154/ca8210.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> index e04c3b60cae7..4eb64709d44c 100644
> --- a/drivers/net/ieee802154/ca8210.c
> +++ b/drivers/net/ieee802154/ca8210.c
> @@ -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
Liu Jian July 21, 2020, 11:09 a.m. UTC | #2
> -----Original Message-----
> From: Stefan Schmidt [mailto:stefan@datenfreihafen.org]
> Sent: Tuesday, July 21, 2020 4:35 PM
> To: liujian (CE) <liujian56@huawei.com>; h.morris@cascoda.com;
> alex.aring@gmail.com; davem@davemloft.net; kuba@kernel.org;
> marcel@holtmann.or; netdev@vger.kernel.org
> Subject: Re: [PATCH net] ieee802154: fix one possible memleak in
> ca8210_dev_com_init
> 
> Hello.
> 
> On 20.07.20 16:33, Liu Jian wrote:
> > We should call destroy_workqueue to destroy mlme_workqueue in error
> branch.
> >
> > Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device
> > driver")
> > Signed-off-by: Liu Jian <liujian56@huawei.com>
> > ---
> >   drivers/net/ieee802154/ca8210.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/ieee802154/ca8210.c
> > b/drivers/net/ieee802154/ca8210.c index e04c3b60cae7..4eb64709d44c
> > 100644
> > --- a/drivers/net/ieee802154/ca8210.c
> > +++ b/drivers/net/ieee802154/ca8210.c
> > @@ -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.
Got it, thank you~
> This patch has been applied to the wpan tree and will be part of the next pull
> request to net. Thanks!
> 
> regards
> Stefan Schmidt
diff mbox series

Patch

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index e04c3b60cae7..4eb64709d44c 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -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;
 	}