From: Ursula Braun <ubraun@linux.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
raspl@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com
Subject: [PATCH net 2/5] net/smc: fix a NULL pointer dereference
Date: Thu, 11 Apr 2019 11:17:31 +0200 [thread overview]
Message-ID: <20190411091734.4263-3-ubraun@linux.ibm.com> (raw)
In-Reply-To: <20190411091734.4263-1-ubraun@linux.ibm.com>
From: Kangjie Lu <kjlu@umn.edu>
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>
---
net/smc/smc_ism.c | 5 +++++
1 file changed, 5 insertions(+)
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);
--
2.16.4
next prev parent reply other threads:[~2019-04-11 9:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-11 9:17 [PATCH net 0/5] net/smc: fixes 2019-04-11 Ursula Braun
2019-04-11 9:17 ` [PATCH net 1/5] net/smc: wait for pending work before clcsock release_sock Ursula Braun
2019-04-11 9:17 ` Ursula Braun [this message]
2019-04-11 9:17 ` [PATCH net 3/5] net/smc: propagate file from SMC to TCP socket Ursula Braun
2019-04-11 9:17 ` [PATCH net 4/5] net/smc: fix return code from FLUSH command Ursula Braun
2019-04-11 9:17 ` [PATCH net 5/5] net/smc: move unhash before release of clcsock Ursula Braun
2019-04-11 18:04 ` [PATCH net 0/5] net/smc: fixes 2019-04-11 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190411091734.4263-3-ubraun@linux.ibm.com \
--to=ubraun@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=kgraul@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=raspl@linux.ibm.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).