mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
trusted-keys: another free memory bugfix
TSS_rawhmac() forgot to call va_end()/kfree() when data == NULL and forgot to call va_end() when crypto_shash_update() < 0. Fix these bugs by escaping from the loop using "break" (rather than "return"/"goto") in order to make sure that va_end()/kfree() are always called. Signed-off-by: Tetsuo Handa <[email protected]> Reviewed-by: Jesper Juhl <[email protected]> Acked-by: Mimi Zohar <[email protected]> Acked-by: David Howells <[email protected]> Signed-off-by: James Morris <[email protected]>
This commit is contained in:
parent
40c1001792
commit
35576eab39
1 changed files with 5 additions and 3 deletions
|
|
@ -101,11 +101,13 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key,
|
|||
if (dlen == 0)
|
||||
break;
|
||||
data = va_arg(argp, unsigned char *);
|
||||
if (data == NULL)
|
||||
return -EINVAL;
|
||||
if (data == NULL) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
ret = crypto_shash_update(&sdesc->shash, data, dlen);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
break;
|
||||
}
|
||||
va_end(argp);
|
||||
if (!ret)
|
||||
|
|
|
|||
Loading…
Reference in a new issue