staging: rtl8192e: Fix potential null dereference

check memory is allocated in '*challenge' before using it.

Signed-off-by: Hema Prathaban <hemaklnce@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Hema Prathaban 2013-05-14 20:59:19 +05:30 committed by Greg Kroah-Hartman
parent 95d8ee5403
commit ae053253a7

View file

@ -1802,7 +1802,9 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
if (*(t++) == MFIE_TYPE_CHALLENGE) {
*chlen = *(t++);
*challenge = kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen); /*TODO - check here*/
if (!*challenge)
return -ENOMEM;
memcpy(*challenge, t, *chlen);
}
}
return cpu_to_le16(a->status);