aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2017-04-23 19:53:58 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-24 10:58:44 +0100
commit67cbdf6d0c0217c647128e837474d7464527e506 (patch)
tree5bd7d9d2facf1d67f4aaef5c603964ce2814fe8c
parent3bc8caed0878d9e3206a40ecf06d025b3086e20f (diff)
downloadlinux-linaro-stable-67cbdf6d0c0217c647128e837474d7464527e506.tar.gz
staging: wilc1000: fix unchecked return value
[ Upstream commit 9e96652756ad647b7bcc03cb99ffc9756d7b5f93 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/wilc1000/linux_mon.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 450af1b77f99..b2092c5ec7f3 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -251,6 +251,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);