mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-20 14:16:02 +00:00
mac80211: fils_aead: fix encrypt error handling
gcc -Wmaybe-uninitialized reports a bug in aes_siv_encryp:
net/mac80211/fils_aead.c: In function ‘aes_siv_encrypt.constprop’:
net/mac80211/fils_aead.c:84:26: error: ‘tfm2’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
At the time that the memory allocation fails, 'tfm2' has not been
allocated, so we should not attempt to free it later, and we can
simply return an error.
Fixes: 39404feee6
("mac80211: FILS AEAD protection for station mode association frames")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
088e8df82f
commit
514877182b
1 changed files with 2 additions and 4 deletions
|
@ -110,10 +110,8 @@ static int aes_siv_encrypt(const u8 *key, size_t key_len,
|
|||
* overwriting this during AES-CTR.
|
||||
*/
|
||||
tmp = kmemdup(plain, plain_len, GFP_KERNEL);
|
||||
if (!tmp) {
|
||||
res = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
|
||||
/* IV for CTR before encrypted data */
|
||||
memcpy(out, v, AES_BLOCK_SIZE);
|
||||
|
|
Loading…
Reference in a new issue