Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] net: ieee802154: fix a potential NULL pointer dereference
@ 2019-03-11  7:25 Kangjie Lu
  2019-03-11  7:30 ` Hennerich, Michael
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kangjie Lu @ 2019-03-11  7:25 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Michael Hennerich, Alexander Aring, Stefan Schmidt,
	David S. Miller, linux-wpan, netdev, linux-kernel

In case alloc_ordered_workqueue fails, the fix releases
sources and returns -ENOMEM to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/ieee802154/adf7242.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index cd1d8faccca5..cd6b95e673a5 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -1268,6 +1268,10 @@ static int adf7242_probe(struct spi_device *spi)
 	INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work);
 	lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev),
 					     WQ_MEM_RECLAIM);
+	if (unlikely(!lp->wqueue)) {
+		ret = -ENOMEM;
+		goto err_hw_init;
+	}
 
 	ret = adf7242_hw_init(lp);
 	if (ret)
-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] net: ieee802154: fix a potential NULL pointer dereference
  2019-03-11  7:25 [PATCH] net: ieee802154: fix a potential NULL pointer dereference Kangjie Lu
@ 2019-03-11  7:30 ` Hennerich, Michael
  2019-03-13  9:08   ` Stefan Schmidt
  2019-03-13  9:09 ` Stefan Schmidt
  2019-03-13  9:09 ` Stefan Schmidt
  2 siblings, 1 reply; 5+ messages in thread
From: Hennerich, Michael @ 2019-03-11  7:30 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Alexander Aring, Stefan Schmidt, David S. Miller,
	linux-wpan, netdev, linux-kernel



> -----Original Message-----
> From: Kangjie Lu [mailto:kjlu@umn.edu]
> Sent: Montag, 11. März 2019 08:25
> To: kjlu@umn.edu
> Cc: pakki001@umn.edu; Hennerich, Michael <Michael.Hennerich@analog.com>; Alexander Aring <alex.aring@gmail.com>; Stefan
> Schmidt <stefan@datenfreihafen.org>; David S. Miller <davem@davemloft.net>; linux-wpan@vger.kernel.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] net: ieee802154: fix a potential NULL pointer dereference
> 
> In case alloc_ordered_workqueue fails, the fix releases
> sources and returns -ENOMEM to avoid NULL pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  drivers/net/ieee802154/adf7242.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> index cd1d8faccca5..cd6b95e673a5 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1268,6 +1268,10 @@ static int adf7242_probe(struct spi_device *spi)
>         INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work);
>         lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev),
>                                              WQ_MEM_RECLAIM);
> +       if (unlikely(!lp->wqueue)) {
> +               ret = -ENOMEM;
> +               goto err_hw_init;
> +       }
> 
>         ret = adf7242_hw_init(lp);
>         if (ret)
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ieee802154: fix a potential NULL pointer dereference
  2019-03-11  7:30 ` Hennerich, Michael
@ 2019-03-13  9:08   ` Stefan Schmidt
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Schmidt @ 2019-03-13  9:08 UTC (permalink / raw)
  To: Hennerich, Michael, Kangjie Lu
  Cc: pakki001, Alexander Aring, David S. Miller, linux-wpan, netdev,
	linux-kernel

Hello.

On 11.03.19 08:30, Hennerich, Michael wrote:
> 
> 
>> -----Original Message-----
>> From: Kangjie Lu [mailto:kjlu@umn.edu]
>> Sent: Montag, 11. März 2019 08:25
>> To: kjlu@umn.edu
>> Cc: pakki001@umn.edu; Hennerich, Michael <Michael.Hennerich@analog.com>; Alexander Aring <alex.aring@gmail.com>; Stefan
>> Schmidt <stefan@datenfreihafen.org>; David S. Miller <davem@davemloft.net>; linux-wpan@vger.kernel.org;
>> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: [PATCH] net: ieee802154: fix a potential NULL pointer dereference
>>
>> In case alloc_ordered_workqueue fails, the fix releases
>> sources and returns -ENOMEM to avoid NULL pointer dereference.
>>
>> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> 
> Acked-by: Michael Hennerich <michael.hennerich@analog.com>

Strange enough patchwork did not pick up this acked by from you. I added
in manually to the patch. Just so you know.

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ieee802154: fix a potential NULL pointer dereference
  2019-03-11  7:25 [PATCH] net: ieee802154: fix a potential NULL pointer dereference Kangjie Lu
  2019-03-11  7:30 ` Hennerich, Michael
@ 2019-03-13  9:09 ` Stefan Schmidt
  2019-03-13  9:09 ` Stefan Schmidt
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Schmidt @ 2019-03-13  9:09 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Michael Hennerich, Alexander Aring, David S. Miller,
	linux-wpan, netdev, linux-kernel

Hello.

On 11.03.19 08:25, Kangjie Lu wrote:
> In case alloc_ordered_workqueue fails, the fix releases
> sources and returns -ENOMEM to avoid NULL pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>  drivers/net/ieee802154/adf7242.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> index cd1d8faccca5..cd6b95e673a5 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1268,6 +1268,10 @@ static int adf7242_probe(struct spi_device *spi)
>  	INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work);
>  	lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev),
>  					     WQ_MEM_RECLAIM);
> +	if (unlikely(!lp->wqueue)) {
> +		ret = -ENOMEM;
> +		goto err_hw_init;
> +	}
>  
>  	ret = adf7242_hw_init(lp);
>  	if (ret)
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ieee802154: fix a potential NULL pointer dereference
  2019-03-11  7:25 [PATCH] net: ieee802154: fix a potential NULL pointer dereference Kangjie Lu
  2019-03-11  7:30 ` Hennerich, Michael
  2019-03-13  9:09 ` Stefan Schmidt
@ 2019-03-13  9:09 ` Stefan Schmidt
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Schmidt @ 2019-03-13  9:09 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Michael Hennerich, Alexander Aring, David S. Miller,
	linux-wpan, netdev, linux-kernel

Hello.

[please ignore the first mail, hit send to early]

On 11.03.19 08:25, Kangjie Lu wrote:
> In case alloc_ordered_workqueue fails, the fix releases
> sources and returns -ENOMEM to avoid NULL pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>  drivers/net/ieee802154/adf7242.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> index cd1d8faccca5..cd6b95e673a5 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1268,6 +1268,10 @@ static int adf7242_probe(struct spi_device *spi)
>  	INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work);
>  	lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev),
>  					     WQ_MEM_RECLAIM);
> +	if (unlikely(!lp->wqueue)) {
> +		ret = -ENOMEM;
> +		goto err_hw_init;
> +	}
>  
>  	ret = adf7242_hw_init(lp);
>  	if (ret)
> 


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

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11  7:25 [PATCH] net: ieee802154: fix a potential NULL pointer dereference Kangjie Lu
2019-03-11  7:30 ` Hennerich, Michael
2019-03-13  9:08   ` Stefan Schmidt
2019-03-13  9:09 ` Stefan Schmidt
2019-03-13  9:09 ` Stefan Schmidt

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git