]> git.baikalelectronics.ru Git - kernel.git/commit
cfg80211: wext: really don't store non-WEP keys
authorJohannes Berg <johannes.berg@intel.com>
Wed, 28 Sep 2016 21:44:57 +0000 (23:44 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 28 Sep 2016 21:55:23 +0000 (23:55 +0200)
commitadc0bfdd4d272a5802fdbe282af5df0ca659601b
treebaabc7b1c604ee8a97b5dd5833d0569e7fc44b43
parent40028a36f0fc345b3472860b01a375c7a971172b
cfg80211: wext: really don't store non-WEP keys

Jouni reported that during (repeated) wext_pmf test runs (from the
wpa_supplicant hwsim test suite) the kernel crashes. The reason is
that after the key is set, the wext code still unnecessarily stores
it into the key cache. Despite smatch pointing out an overflow, I
failed to identify the possibility for this in the code and missed
it during development of the earlier patch series.

In order to fix this, simply check that we never store anything but
WEP keys into the cache, adding a comment as to why that's enough.

Also, since the cache is still allocated early even if it won't be
used in many cases, add a comment explaining why - otherwise we'd
have to roll back key settings to the driver in case of allocation
failures, which is far more difficult.

Fixes: d5d5d2578a2d ("cfg80211: reduce connect key caching struct size")
Reported-by: Jouni Malinen <j@w1.fi>
Bisected-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/wext-compat.c