Re: Trial Patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 14-09-09 11:07 PM, Valdis.Kletnieks@xxxxxx wrote:
> On Tue, 09 Sep 2014 22:56:10 -0400, nick said:
> 
>>> OK. It's official.  I see *zero* possibility that you'll ever manage to
>>> write an acceptable patch.  This is *still* wrong.
>>>
>> Care to explain.
> 
> No.  Please go figure it out for yourself.
> 
I think I fixed it through. If not I known why.
Nick 
>From ad55b627241203a380dd9c708a4feae98446f85f Mon Sep 17 00:00:00 2001
From: Nicholas Krause <xerofoify@xxxxxxxxx>
Date: Tue, 9 Sep 2014 21:12:56 -0400
Subject: [PATCH] staging: Fix NULL check for allocating the skb in
 r8192E_firmware.c

This patch checks in the loop of the function, fw_download_code if
a allocated skb is NULL. If the skb is NULL then we first free the
allocated skbs in the queue of this function with skb_queue_purge
in order to free the allocated skbs. After the freeing of the queue
we break out of the do/while of this function as we need to run
write_nic_byte in order to activate parts of the network card's
driver. 

Signed-off-by: Nicholas Krause <xerofoify@xxxxxxxxx>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index 1a95d1f..a251414 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -61,6 +61,10 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
 		}
 
 		skb  = dev_alloc_skb(frag_length + 4);
+		if (skb == NULL) {
+			skb_queue_purge(&priv->rtllib->skbwaitQ[TXCMD_QUEUE];
+			rt_status = false;
+			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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux