From 7091eb42d6e9207a3917df768fbb4f80e53450c3 Mon Sep 17 00:00:00 2001 From: hwg Date: Thu, 26 Jun 2014 10:13:06 +0800 Subject: [PATCH] asix usb ethernet: avoid kernel panic when alloc skb fail in lowmemory case --- drivers/net/usb/asix_common.c | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 drivers/net/usb/asix_common.c 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) -- 2.34.1