Staging: rtl8192u: Check kmalloc return value before use the buffer in ieee80211_soft...
authorwzt.wzt@gmail.com <wzt.wzt@gmail.com>
Wed, 5 May 2010 06:56:52 +0000 (14:56 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 11 May 2010 18:36:11 +0000 (11:36 -0700)
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>
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c

index 148424a9ac1c406c56e3b037da08704114ed4494..e5e583ed1196f9dc4f00c062dbd81187f2566955 100644 (file)
@@ -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);
                }
        }