From dde27e03cc964526531fdf2bd58c1e4ee4525074 Mon Sep 17 00:00:00 2001 From: "wzt.wzt@gmail.com" Date: Wed, 5 May 2010 14:56:52 +0800 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 148424a9ac1c..e5e583ed1196 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/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); } } -- 2.20.1