mac80211: move struct aead_req off the stack
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 17 Oct 2016 14:05:33 +0000 (15:05 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 17 Oct 2016 14:14:04 +0000 (16:14 +0200)
commitf4a067f9ffca603b45f7e82ddd2ba50e5904cea3
tree7b50496f4eaa8952548eeece1ee28c9045f746d9
parent1d4de2e222b41006007d7dbfce2abfe448217e49
mac80211: move struct aead_req off the stack

Some crypto implementations (such as the generic CCM wrapper in crypto/)
use scatterlists to map fields of private data in their struct aead_req.
This means these data structures cannot live in the vmalloc area, which
means that they cannot live on the stack (with CONFIG_VMAP_STACK.)

This currently occurs only with the generic software implementation, but
the private data and usage is implementation specific, so move the whole
data structures off the stack into heap by allocating every time we need
to use them.

In addition, take care not to put any of our own stack allocations into
scatterlists. This involves reserving some extra room when allocating the
aead_request structures, and referring to those allocations in the scatter-
lists (while copying the data from the stack before the crypto operation)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/aes_ccm.c
net/mac80211/aes_ccm.h
net/mac80211/aes_gcm.c
net/mac80211/aes_gcm.h
net/mac80211/aes_gmac.c
net/mac80211/aes_gmac.h
net/mac80211/wpa.c