Skip to content

Commit

Permalink
net/smc: fix a NULL pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kengiter authored and davem330 committed Apr 11, 2019
1 parent fd57770 commit e183d4e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/smc/smc_ism.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e183d4e

Please sign in to comment.