From: Johannes Berg Date: Wed, 19 Aug 2020 08:46:48 +0000 (+0200) Subject: cfg80211: regulatory: reject invalid hints X-Git-Tag: v5.4.64~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=58c3e86d42d207e60015773d7cc699f5130c5dfa;p=users%2Fdwmw2%2Flinux.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 1a8218f1bbe07..20a8e6af88c45 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2941,6 +2941,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;