[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1415203879-17261-1-git-send-email-danieru.dressler@gmail.com>
Date: Thu, 6 Nov 2014 01:11:17 +0900
From: Daniel Dressler <danieru.dressler@...il.com>
To: danieru.dressler@...il.com
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Matthew Casey <mdcasey@...bloom.com>,
Ben Hutchings <ben@...adent.org.uk>,
devel@...verdev.osuosl.org (open list:STAGING SUBSYSTEM),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] Staging: rtl8192e: Fix segfault upon alloc failure
Kernel space allocations can fail. This patch
fixes a crash condition upon allocation failure.
Should this condition occur init_firmware() will
goto its error handler and declare download failure.
Of interesting note is that prior to this patch
fw_download_code() could never fail yet our caller
checked the return value.
Reported-by: RUC_Soft_Sec <rucsoftsec@...il.com>
Signed-off-by: Daniel Dressler <danieru.dressler@...il.com>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index 2e28744..e4257fe 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -61,6 +61,9 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
}
skb = dev_alloc_skb(frag_length + 4);
+ if (!skb)
+ return false;
+
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;
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists