Commit 47caf685 authored by Johannes Berg's avatar Johannes Berg

cfg80211: regulatory: reject invalid hints

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.netSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 35799944
...@@ -2946,6 +2946,9 @@ int regulatory_hint_user(const char *alpha2, ...@@ -2946,6 +2946,9 @@ int regulatory_hint_user(const char *alpha2,
if (WARN_ON(!alpha2)) if (WARN_ON(!alpha2))
return -EINVAL; return -EINVAL;
if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2))
return -EINVAL;
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
if (!request) if (!request)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment