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

rtl8192se: Fix BUG caused by failure to check skb allocation

When downloading firmware into the device, the driver fails to check the
return when allocating an skb. When the allocation fails, a BUG can be
generated, as seen in https://bugzilla.redhat.com/show_bug.cgi?id=771656.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Larry Finger and committed by
John W. Linville
d90db4b1 874c60ba

+4
+4
drivers/net/wireless/rtlwifi/rtl8192se/fw.c
··· 196 196 /* Allocate skb buffer to contain firmware */ 197 197 /* info and tx descriptor info. */ 198 198 skb = dev_alloc_skb(frag_length); 199 + if (!skb) 200 + return false; 199 201 skb_reserve(skb, extra_descoffset); 200 202 seg_ptr = (u8 *)skb_put(skb, (u32)(frag_length - 201 203 extra_descoffset)); ··· 575 573 576 574 len = _rtl92s_get_h2c_cmdlen(MAX_TRANSMIT_BUFFER_SIZE, 1, &cmd_len); 577 575 skb = dev_alloc_skb(len); 576 + if (!skb) 577 + return false; 578 578 cb_desc = (struct rtl_tcb_desc *)(skb->cb); 579 579 cb_desc->queue_index = TXCMD_QUEUE; 580 580 cb_desc->cmd_or_init = DESC_PACKET_TYPE_NORMAL;