Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e966527 authored by Pan Bian's avatar Pan Bian Committed by Greg Kroah-Hartman
Browse files

staging: wilc1000: fix unchecked return value



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: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3c2bf0bd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);