Blob Blame History Raw
From: Kangjie Lu <kjlu@umn.edu>
Date: Thu, 11 Apr 2019 11:17:31 +0200
Subject: net/smc: fix a NULL pointer dereference
Git-commit: e183d4e414b64711baf7a04e214b61969ca08dfa
Patch-mainline: v5.1-rc6
References: bsc#1134607 bsc#1134618 LTC#177518 LTC#177520

In case alloc_ordered_workqueue fails, the fix returns NULL
to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 net/smc/smc_ism.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -290,6 +290,11 @@ struct smcd_dev *smcd_alloc_dev(struct d
 	INIT_LIST_HEAD(&smcd->vlan);
 	smcd->event_wq = alloc_ordered_workqueue("ism_evt_wq-%s)",
 						 WQ_MEM_RECLAIM, name);
+	if (!smcd->event_wq) {
+		kfree(smcd->conn);
+		kfree(smcd);
+		return NULL;
+	}
 	return smcd;
 }
 EXPORT_SYMBOL_GPL(smcd_alloc_dev);