On 14-09-08 02:08 PM, Valdis.Kletnieks@xxxxxx wrote: > On Mon, 08 Sep 2014 06:36:34 -0400, nick said: > >> Found a bug and attempted to fix it >> sub_skb = dev_alloc_skb(nSubframe_Length + 12); >> + if (!sub_skb) >> + return -ENOMEM; > > Nick - we've told you before to research this stuff more fully before > posting patches. As others have pointed out, there's exactly one caller, who > wants a different return on error. > > For bonus points - explain why you're returning a -ENOMEM from > a function that's declared as 'static u8 parse_subframe(...'. > > This is *NOT* how you convince us that you should be allowed anywhere near > kernel code. > Fixed the patch, and Valdis thanks for the note about reading the code properly first. Nick
>From d5f7b8929bebcf0b12d8e402932b790f61786168 Mon Sep 17 00:00:00 2001 From: Nicholas Krause <xerofoify@xxxxxxxxx> Date: Mon, 8 Sep 2014 05:57:09 -0400 Subject: [PATCH] staging: Fix ieee_80211_rx.c to check for Null allocated skb In ieee_80211_rx.c we may have a Null allocated sub in parse_subframe and need to check if the allocated skb is NUll. If it is return -ENOMEM. Signed-off-by: Nicholas Krause <xerofoify@xxxxxxxxx> --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 73410cc..dc8520d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -847,6 +847,8 @@ static u8 parse_subframe(struct sk_buff *skb, #else /* Allocate new skb for releasing to upper layer */ sub_skb = dev_alloc_skb(nSubframe_Length + 12); + if (!sub_skb) + return NULL; skb_reserve(sub_skb, 12); data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); memcpy(data_ptr,skb->data,nSubframe_Length); -- 1.9.1
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies