summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8712
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2012-08-28 11:59:04 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-04 14:14:08 -0700
commit5ca136a0cb96aabcb3c2158fb958677d55915f93 (patch)
tree89363099377e6217ec2836e38f497fff43986d40 /drivers/staging/rtl8712
parent6a5c23194e09103ed24301e098c03a7da382a656 (diff)
downloadlinux-5ca136a0cb96aabcb3c2158fb958677d55915f93.tar.bz2
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>
Diffstat (limited to 'drivers/staging/rtl8712')
-rw-r--r--drivers/staging/rtl8712/rtl8712_recv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 8e82ce2fee38..4cd297aed788 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -374,6 +374,8 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
a_len -= ETH_HLEN;
/* Allocate new skb for releasing to upper layer */
sub_skb = dev_alloc_skb(nSubframe_Length + 12);
+ if (!sub_skb)
+ break;
skb_reserve(sub_skb, 12);
data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length);
memcpy(data_ptr, pdata, nSubframe_Length);
@@ -1094,6 +1096,8 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz;
} else {
precvframe->u.hdr.pkt = skb_clone(pskb, GFP_ATOMIC);
+ if (!precvframe->u.hdr.pkt)
+ return _FAIL;
precvframe->u.hdr.rx_head = pbuf;
precvframe->u.hdr.rx_data = pbuf;
precvframe->u.hdr.rx_tail = pbuf;