On Wed, Aug 13, 2014 at 12:55 PM, Nick Krause <xerofoify@xxxxxxxxx> wrote: > On Wed, Aug 13, 2014 at 12:02 PM, <Valdis.Kletnieks@xxxxxx> wrote: >> On Wed, 13 Aug 2014 18:50:43 +0400, Max Filippov said: >> >>> No need to trigger it, faking it would be enough, e.g.: >> >>> + if (++i < 3) >>> + skb = dev_alloc_skb(frag_length + 4); >>> + else >>> + skb = NULL; >> >> Don't bet on this triggering on a real system without some additional >> scaffolding - take a look at what the function is doing, and ask yourself >> how many times it will be called on the average system :) > Seems to be called a lot. In addition I can only build test this as I > don't have the hardware. > Cheers Nick I did test my patch by doing a kernel build and I get this error, drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c:66:4: error: implicit declaration of function ‘skb_quene_purge’ [-Werror=implicit-function-declaration] skb_quene_purge(&priv->rtllib->skb_waitQ[tcb_desc->queue_index]); I am wondering how do I fix this, I will attach my patch so I can fix this out and send a proper patch :). By the way thanks for the help guys :). Nick
From 4aab020dbd8b849e22cda7b0672a03c9133dbcd0 Mon Sep 17 00:00:00 2001 From: Nicholas Krause <xerofoify@xxxxxxxxx> Date: Wed, 13 Aug 2014 13:24:55 -0400 Subject: [PATCH] staging: Check for Null return of fw_download_code This patch fixes the bug , https://bugzilla.kernel.org/show_bug.cgi?id=60461 on the kernel bugzilla. Further more I am checking if we are allocating a NULL skb and if so make rt_status to false and free the quene we are using for allocated skbs in the while/do loop with skb_quene_purge. Signed-off-by: Nicholas Krause <xerofoify@xxxxxxxxx> --- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 1a95d1f..0f18c6d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -61,6 +61,11 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, } skb = dev_alloc_skb(frag_length + 4); + if (skb == NULL ) { + rt_status = false; + skb_quene_purge(&priv->rtllib->skb_waitQ[tcb_desc->queue_index]); + break; + } memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; -- 1.9.1
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies