From: hwg Date: Thu, 26 Jun 2014 02:13:06 +0000 (+0800) Subject: asix usb ethernet: X-Git-Tag: firefly_0821_release~5046 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7091eb42d6e9207a3917df768fbb4f80e53450c3;p=firefly-linux-kernel-4.4.55.git asix usb ethernet: avoid kernel panic when alloc skb fail in lowmemory case --- diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c old mode 100644 new mode 100755 index 577c72d5f369..97a93e842ed9 --- a/drivers/net/usb/asix_common.c +++ b/drivers/net/usb/asix_common.c @@ -111,6 +111,12 @@ int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb, rx->size = skb->len - offset; } + if (!rx->ax_skb) { + rx->size = 0; + netdev_err(dev->net, "asix_rx_fixup_internal Bad ax_skb buf.\n"); + return 0; + } + data = skb_put(rx->ax_skb, rx->size); memcpy(data, skb->data + offset, rx->size); if (!remaining)