diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-04-11 11:17:31 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-11 20:04:08 +0200 |
commit | e183d4e414b64711baf7a04e214b61969ca08dfa (patch) | |
tree | 05cb57ab0507aac5640939c941a924eee866ab31 /net | |
parent | net/smc: wait for pending work before clcsock release_sock (diff) | |
download | linux-e183d4e414b64711baf7a04e214b61969ca08dfa.tar.xz linux-e183d4e414b64711baf7a04e214b61969ca08dfa.zip |
net/smc: fix a NULL pointer dereference
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/smc_ism.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index 2fff79db1a59..e89e918b88e0 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -289,6 +289,11 @@ struct smcd_dev *smcd_alloc_dev(struct device *parent, const char *name, 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); |