cfg80211: limit wiphy names to 128 bytes
commit7d73a8c07d8486c3d1fd7d22bacc7dd7c19007cb
authorJohannes Berg <johannes.berg@intel.com>
Tue, 3 Apr 2018 12:33:49 +0000 (3 14:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:12:59 +0000 (25 16:12 +0200)
tree57bbf9b303bc213626607a793b579954ab6dd1c0
parent6c65719153f983dc3ac6afd321fd463cba22ee13
cfg80211: limit wiphy names to 128 bytes

commit a7cfebcb7594a24609268f91299ab85ba064bf82 upstream.

There's currently no limit on wiphy names, other than netlink
message size and memory limitations, but that causes issues when,
for example, the wiphy name is used in a uevent, e.g. in rfkill
where we use the same name for the rfkill instance, and then the
buffer there is "only" 2k for the environment variables.

This was reported by syzkaller, which used a 4k name.

Limit the name to something reasonable, I randomly picked 128.

Reported-by: syzbot+230d9e642a85d3fec29c@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/uapi/linux/nl80211.h
net/wireless/core.c