Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae053253 authored by Hema Prathaban's avatar Hema Prathaban Committed by Greg Kroah-Hartman
Browse files

staging: rtl8192e: Fix potential null dereference



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

Signed-off-by: default avatarHema Prathaban <hemaklnce@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95d8ee54
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1802,7 +1802,9 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
		if (*(t++) == MFIE_TYPE_CHALLENGE) {
		if (*(t++) == MFIE_TYPE_CHALLENGE) {
			*chlen = *(t++);
			*chlen = *(t++);
			*challenge = kmalloc(*chlen, GFP_ATOMIC);
			*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);
	return cpu_to_le16(a->status);