summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2020-08-19 10:46:48 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-09 19:03:13 +0200
commit02015d244d9c043414509afa370f8f7d471e14b5 (patch)
tree991a1259f84e246490fe06a00bad958c688d787a
parentc4b219136040bc57e9704afee8f5c5a9430795a5 (diff)
downloadlinux-stable-02015d244d9c043414509afa370f8f7d471e14b5.tar.gz
linux-stable-02015d244d9c043414509afa370f8f7d471e14b5.tar.bz2
linux-stable-02015d244d9c043414509afa370f8f7d471e14b5.zip
cfg80211: regulatory: reject invalid hints
commit 47caf685a6854593348f216e0b489b71c10cbe03 upstream. Reject invalid hints early in order to not cause a kernel WARN later if they're restored to or similar. Reported-by: syzbot+d451401ffd00a60677ee@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=d451401ffd00a60677ee Link: https://lore.kernel.org/r/20200819084648.13956-1-johannes@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 b95d1c2bdef7..9eb9d34cef7b 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2408,6 +2408,9 @@ int regulatory_hint_user(const char *alpha2,
if (WARN_ON(!alpha2))
return -EINVAL;
+ if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2))
+ return -EINVAL;
+
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;