From: Jiecheng Wu <jasonwood2031@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH] fm10k_main.c: fix missing return value check of alloc_skb()
Date: Sat, 18 Aug 2018 10:00:58 +0800 [thread overview]
Message-ID: <20180818020058.14652-1-jasonwood2031@gmail.com> (raw)
Function fm10k_init_module() defined in drivers/net/ethernet/intel/fm10k/fm10k_main.c calls alloc_workqueue() to allocate memory for struct workqueue_struct which is dereferenced immediately. As alloc_workqueue() may return NULL on failure, this code piece may cause NULL pointer dereference bug.
---
drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index 3f53654..78a43d6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -41,6 +41,8 @@ static int __init fm10k_init_module(void)
/* create driver workqueue */
fm10k_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0,
fm10k_driver_name);
+ if (!fm10k_workqueue)
+ return -ENOMEM;
fm10k_dbg_init();
--
2.6.4
next reply other threads:[~2018-08-18 5:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-18 2:00 Jiecheng Wu [this message]
2018-08-18 2:14 ` [PATCH] fm10k_main.c: fix missing return value check of alloc_skb() Andrew Lunn
-- strict thread matches above, loose matches on Subject: below --
2018-08-18 2:27 Jiecheng Wu
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=20180818020058.14652-1-jasonwood2031@gmail.com \
--to=jasonwood2031@gmail.com \
--cc=netdev@vger.kernel.org \
/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).