Browse Source

Staging: rtl8192u: Check kmalloc return value before use the buffer in ieee80211_softmac.c

Check kmalloc return value before use the buffer.

Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
wzt.wzt@gmail.com 15 years ago
parent
commit
dde27e03cc
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c

+ 2 - 0
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c

@@ -1580,6 +1580,8 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
 		if(*(t++) == MFIE_TYPE_CHALLENGE){
 			*chlen = *(t++);
 			*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
+			if (!*challenge)
+				return -ENOMEM;
 			memcpy(*challenge, t, *chlen);
 		}
 	}