Staging: Check kmalloc return value before use the buffer in ieee80211_softmac.c
PATCH 1/1 Staging: 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 <[email protected]>
--- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +2 -0
@@ -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); } }
Signature · 1 line
1.6.5.3
Quoted 13 lines · On Wed, May 05, 2010 at 02:56:52PM +0800, [email protected] wrote:
Check kmalloc return value before use the buffer.
Signed-off-by Zhitong Wang <[email protected]>--- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0
-0
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) · line 1583
Quoted 5 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +2
-0@@ -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