summaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorHaim Dreyfuss <haim.dreyfuss@intel.com>2018-05-21 23:34:57 +0300
committerJohannes Berg <johannes.berg@intel.com>2018-05-22 10:17:52 +0200
commit5247a77ced2d3396a32679c7480e8bcd5b26e471 (patch)
tree7b1dc7be25d50bc45771666044fad90ed6ff0150 /net/wireless
parent1d6741d86429a294f51f2773c751c8f7662e7ca2 (diff)
cfg80211: fix NULL pointer derference when querying regdb
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> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/reg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ac3e12c32aa3..5fcec5c94eb7 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);