linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / 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 related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-13  9:09 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).