From: Luca Coelho <luca@coelho.fi>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, kvalo@codeaurora.org,
ebiggers3@gmail.com, Haim Dreyfuss <haim.dreyfuss@intel.com>,
Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH] cfg80211: fix NULL pointer derference when querying regdb
Date: Mon, 21 May 2018 23:34:57 +0300 [thread overview]
Message-ID: <20180521203457.17242-1-luca@coelho.fi> (raw)
In-Reply-To: <20180519183345.GA701@sol.localdomain>
From: Haim Dreyfuss <haim.dreyfuss@intel.com>
Some drivers may call this function when regdb is not initialized yet,
so we need to make sure regdb is valid before trying to access it.
Make sure regdb is initialized before trying to access it in
reg_query_regdb_wmm() and query_regdb().
Reported-by: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
net/wireless/reg.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 9806380ec671..91ebe2425b0d 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -916,6 +916,9 @@ int reg_query_regdb_wmm(char *alpha2, int freq, u32 *dbptr,
const struct fwdb_header *hdr = regdb;
const struct fwdb_country *country;
+ if (!regdb)
+ return -ENODATA;
+
if (IS_ERR(regdb))
return PTR_ERR(regdb);
--
2.17.0
prev parent reply other threads:[~2018-05-21 20:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-19 18:33 [4.17 iwlwifi regression] NULL pointer dereference in reg_query_regdb_wmm() Eric Biggers
2018-05-21 7:42 ` Luca Coelho
2018-05-21 16:25 ` Kalle Valo
2018-05-21 16:30 ` Luca Coelho
2018-05-21 17:57 ` Kalle Valo
2018-05-21 10:10 ` Dreyfuss, Haim
2018-05-21 16:28 ` Kalle Valo
2018-05-21 16:56 ` Dreyfuss, Haim
2018-05-22 14:06 ` Kalle Valo
2018-05-22 4:47 ` Eric Biggers
2018-05-22 4:59 ` Eric Biggers
2018-05-22 7:58 ` Dreyfuss, Haim
2018-05-21 10:11 ` Dreyfuss, Haim
2018-05-21 20:34 ` Luca Coelho [this message]
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=20180521203457.17242-1-luca@coelho.fi \
--to=luca@coelho.fi \
--cc=ebiggers3@gmail.com \
--cc=haim.dreyfuss@intel.com \
--cc=johannes@sipsolutions.net \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luciano.coelho@intel.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