Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: r8712u: Fix allocations not checked for failure

The driver has a dev_alloc_skb() and an skb_clone() call that are not
checked for failure.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Larry Finger and committed by
Greg Kroah-Hartman
5ca136a0 6a5c2319

+4
+4
drivers/staging/rtl8712/rtl8712_recv.c
··· 374 374 a_len -= ETH_HLEN; 375 375 /* Allocate new skb for releasing to upper layer */ 376 376 sub_skb = dev_alloc_skb(nSubframe_Length + 12); 377 + if (!sub_skb) 378 + break; 377 379 skb_reserve(sub_skb, 12); 378 380 data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); 379 381 memcpy(data_ptr, pdata, nSubframe_Length); ··· 1096 1094 precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz; 1097 1095 } else { 1098 1096 precvframe->u.hdr.pkt = skb_clone(pskb, GFP_ATOMIC); 1097 + if (!precvframe->u.hdr.pkt) 1098 + return _FAIL; 1099 1099 precvframe->u.hdr.rx_head = pbuf; 1100 1100 precvframe->u.hdr.rx_data = pbuf; 1101 1101 precvframe->u.hdr.rx_tail = pbuf;