From: wzt.wzt on
Check kmalloc return value before use the buffer.

Signed-off-by: Zhitong Wang <zhitong.wangzt(a)alibaba-inc.com>

---
.../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 27d9257..8718ac9 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1579,6 +1579,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);
}
}
--
1.6.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/