]> git.baikalelectronics.ru Git - kernel.git/commit
net: wireless: nl80211: fix out-of-bounds access in nl80211_del_key()
authorAnant Thazhemadam <anant.thazhemadam@gmail.com>
Wed, 7 Oct 2020 03:54:01 +0000 (09:24 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 8 Oct 2020 10:37:25 +0000 (12:37 +0200)
commit970f69baf6e2dff047c39db7d83af04c8e04c525
tree878859c1619029ae7c6ccb291cb941257f243a81
parentc8855ce6d1831f9ce66c223cc7cb2be84c789fa9
net: wireless: nl80211: fix out-of-bounds access in nl80211_del_key()

In nl80211_parse_key(), key.idx is first initialized as -1.
If this value of key.idx remains unmodified and gets returned, and
nl80211_key_allowed() also returns 0, then rdev_del_key() gets called
with key.idx = -1.
This causes an out-of-bounds array access.

Handle this issue by checking if the value of key.idx after
nl80211_parse_key() is called and return -EINVAL if key.idx < 0.

Cc: stable@vger.kernel.org
Reported-by: syzbot+b1bb342d1d097516cbda@syzkaller.appspotmail.com
Tested-by: syzbot+b1bb342d1d097516cbda@syzkaller.appspotmail.com
Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Link: https://lore.kernel.org/r/20201007035401.9522-1-anant.thazhemadam@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c