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>
This commit is contained in:
parent
318a5b2a50
commit
dde27e03cc
1 changed files with 2 additions and 0 deletions
|
@ -1580,6 +1580,8 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
|
||||||
if(*(t++) == MFIE_TYPE_CHALLENGE){
|
if(*(t++) == MFIE_TYPE_CHALLENGE){
|
||||||
*chlen = *(t++);
|
*chlen = *(t++);
|
||||||
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
|
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
|
||||||
|
if (!*challenge)
|
||||||
|
return -ENOMEM;
|
||||||
memcpy(*challenge, t, *chlen);
|
memcpy(*challenge, t, *chlen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue