Skip to content

Commit

Permalink
cfg80211: regulatory: reject invalid hints
Browse files Browse the repository at this point in the history
commit 47caf68 upstream.

Reject invalid hints early in order to not cause a kernel
WARN later if they're restored to or similar.

Reported-by: [email protected]
Link: https://syzkaller.appspot.com/bug?extid=d451401ffd00a60677ee
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jmberg-intel authored and gregkh committed Sep 9, 2020
1 parent c4b2191 commit 02015d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 02015d2

Please sign in to comment.