mac80211: Do not use stack memory with scatterlist for GMAC
commit02eeea5b49649467a7dafdbca9377218547697c1
authorJouni Malinen <j@w1.fi>
Mon, 27 May 2019 22:46:43 +0000 (28 01:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jun 2019 03:36:55 +0000 (25 11:36 +0800)
tree844fb49fe64710d3993ce161eb733d7ac8fa5a58
parente669f9c50a05c184e8746c751817514d9ddd0e4e
mac80211: Do not use stack memory with scatterlist for GMAC

commit a71fd9dac23613d96ba3c05619a8ef4fd6cdf9b9 upstream.

ieee80211_aes_gmac() uses the mic argument directly in sg_set_buf() and
that does not allow use of stack memory (e.g., BUG_ON() is hit in
sg_set_buf() with CONFIG_DEBUG_SG). BIP GMAC TX side is fine for this
since it can use the skb data buffer, but the RX side was using a stack
variable for deriving the local MIC value to compare against the
received one.

Fix this by allocating heap memory for the mic buffer.

This was found with hwsim test case ap_cipher_bip_gmac_128 hitting that
BUG_ON() and kernel panic.

Cc: stable@vger.kernel.org
Signed-off-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mac80211/wpa.c