lkml.org 
[lkml]   [2010]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Staging: Check kmalloc return value before use the buffer in ieee80211_softmac.c
On Wed, May 05, 2010 at 02:56:52PM +0800, wzt.wzt@gmail.com wrote:
> Check kmalloc return value before use the buffer.
>
> Signed-off-by: Zhitong Wang <zhitong.wangzt@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;

Great catch!

thanks for the patch, now queued up.

greg k-h


\
 
 \ /
  Last update: 2010-05-05 18:29    [W:0.033 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site