Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1629009 > unrolled thread

[PATCH 1/1] staging: wilc1000: fix unchecked return value

Started byPan Bian <bianpan201602@163.com>
First post2017-04-23 14:00 +0200
Last post2017-04-23 14:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] staging: wilc1000: fix unchecked return value Pan Bian <bianpan201602@163.com> - 2017-04-23 14:00 +0200

#1629009 — [PATCH 1/1] staging: wilc1000: fix unchecked return value

FromPan Bian <bianpan201602@163.com>
Date2017-04-23 14:00 +0200
Subject[PATCH 1/1] staging: wilc1000: fix unchecked return value
Message-ID<tzolk-7Zf-13@gated-at.bofh.it>
From: Pan Bian <bianpan2016@163.com>

Function dev_alloc_skb() will return a NULL pointer if there is no
enough memory. However, in function WILC_WFI_mon_xmit(), its return
value is used without validation. This may result in a bad memory access
bug. This patch fixes the bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/staging/wilc1000/linux_mon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index f328d75..c9782d4 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -197,6 +197,8 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
 
 	if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6)))) {
 		skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr));
+		if (!skb2)
+			return -ENOMEM;
 
 		memcpy(skb_put(skb2, skb->len), skb->data, skb->len);
 
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web