[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091226140544.5600b3d1@nehalam>
Date: Sat, 26 Dec 2009 14:05:44 -0800
From: Stephen Hemminger <shemminger@...ux-foundation.org>
To: David Miller <davem@...emloft.net>
Cc: Michael Breuer <mbreuer@...jas.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Berck E. Nash" <flyboy@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
netdev@...r.kernel.org
Subject: [PATCH] sky2: make sure ethernet header is in transmit skb
When DHCP sends a packet using AF_PACKET, it is possible for driver
to receive a transmit packet with the Ethernet header off in the
skb fragments. The hardware doesn't handle 0 size DMA's well,
so it gets confused.
Other drivers may have same problem, I really think this ought
to be done at higher level.
Signed-off-by: Stephen Hemminger <shemminger@...tta.com>
---
Patch against net-2.6, but same patch applies to -stable as well
(with fuzz).
--- a/drivers/net/sky2.c 2009-12-26 13:39:34.289252942 -0800
+++ b/drivers/net/sky2.c 2009-12-26 13:59:44.548877690 -0800
@@ -1654,6 +1654,14 @@ static netdev_tx_t sky2_xmit_frame(struc
if (unlikely(tx_avail(sky2) < tx_le_req(skb)))
return NETDEV_TX_BUSY;
+ /* Make sure there is at least some data for first DMA */
+ if (!pskb_may_pull(skb, ETH_HLEN)) {
+ if (net_ratelimit())
+ pr_info(PFX "%s: packet missing ether header (%d)?",
+ dev->name, skb->len);
+ goto drop;
+ }
+
len = skb_headlen(skb);
mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
@@ -1799,6 +1807,7 @@ mapping_unwind:
mapping_error:
if (net_ratelimit())
dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name);
+drop:
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists