From: wzt.wzt@gmail.com Date: Wed, 5 May 2010 06:56:52 +0000 (+0800) Subject: Staging: rtl8192u: Check kmalloc return value before use the buffer in ieee80211_soft... X-Git-Tag: MMI-PSA29.97-13-9~23841^2^2~186 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dde27e03cc964526531fdf2bd58c1e4ee4525074;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 --- 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); } }