From 4c14fe91d0209897fda4dea0102c8cd2e1ddd860 Mon Sep 17 00:00:00 2001 From: Divy Le Ray Date: Sat, 1 Dec 2007 15:57:17 -0800 Subject: cxgb - revert file mode changes. revert inavertant file mode changes Signed-off-by: Divy Le Ray Signed-off-by: Jeff Garzik diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c old mode 100755 new mode 100644 diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c old mode 100755 new mode 100644 diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c old mode 100755 new mode 100644 diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h old mode 100755 new mode 100644 -- cgit v0.10.2 From 0581d3f53053de597ef4956568c15785e59828ef Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 3 Dec 2007 04:34:32 +0000 Subject: Don't claim to do IPv6 checksum offload Signed-off-by: David Woodhouse Signed-off-by: Jeff Garzik diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 09b4fde..a8db5d7 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c @@ -1362,7 +1362,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); - dev->features = NETIF_F_HW_CSUM | NETIF_F_LLTX | NETIF_F_SG; + dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG; /* These should come out of the device tree eventually */ mac->dma_txch = index; -- cgit v0.10.2 From 4c537e6371a9510c82eb96fb7e1e66017e0e2053 Mon Sep 17 00:00:00 2001 From: Jon Smirl Date: Mon, 3 Dec 2007 22:38:10 +0000 Subject: Fix memory corruption in fec_mpc52xx The mpc5200 fec driver is corrupting memory. This patch fixes two bugs where the wrong skb was being referenced. Signed-off-by: Jon Smirl Acked-by: Domen Puncer Signed-off-by: Grant Likely Signed-off-by: David Woodhouse Signed-off-by: Jeff Garzik diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index bf5a7ca..79f7ead 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -422,7 +422,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status, (struct bcom_bd **)&bd); - dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE); + dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len, DMA_FROM_DEVICE); /* Test for errors in received frame */ if (status & BCOM_FEC_RX_BD_ERRORS) { @@ -467,7 +467,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) bcom_prepare_next_buffer(priv->rx_dmatsk); bd->status = FEC_RX_BUFFER_SIZE; - bd->skb_pa = dma_map_single(&dev->dev, rskb->data, + bd->skb_pa = dma_map_single(&dev->dev, skb->data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(priv->rx_dmatsk, skb); -- cgit v0.10.2 From 8cfcbe998aa0459e20bbad61376f81c1715b25d6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 3 Dec 2007 17:02:17 -0800 Subject: sky2: recovery deadlock fix Prevent deadlock in sky2 recovery logic. sky2_down calls napi_synchronize which gets stuck if napi was already disabled. Fix by rearranging slightly and not calling napi_disable until after both ports are stopped. The napi_disable probably is being overly paranoid, but it is safe now. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 3d1dfc9..6197afb 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -2906,16 +2906,14 @@ static void sky2_restart(struct work_struct *work) int i, err; rtnl_lock(); - sky2_write32(hw, B0_IMSK, 0); - sky2_read32(hw, B0_IMSK); - napi_disable(&hw->napi); - for (i = 0; i < hw->ports; i++) { dev = hw->dev[i]; if (netif_running(dev)) sky2_down(dev); } + napi_disable(&hw->napi); + sky2_write32(hw, B0_IMSK, 0); sky2_reset(hw); sky2_write32(hw, B0_IMSK, Y2_IS_BASE); napi_enable(&hw->napi); -- cgit v0.10.2 From d30f53aeb31d453a5230f526bea592af07944564 Mon Sep 17 00:00:00 2001 From: Wang Chen Date: Tue, 4 Dec 2007 10:01:37 +0800 Subject: SMC911X: Fix using of dereferenced skb after netif_rx Signed-off-by: Wang Chen Signed-off-by: Jeff Garzik diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 1a3d80b..76cc1d3 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -1299,9 +1299,9 @@ smc911x_rx_dma_irq(int dma, void *data) PRINT_PKT(skb->data, skb->len); dev->last_rx = jiffies; skb->protocol = eth_type_trans(skb, dev); - netif_rx(skb); dev->stats.rx_packets++; dev->stats.rx_bytes += skb->len; + netif_rx(skb); spin_lock_irqsave(&lp->lock, flags); pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; -- cgit v0.10.2 From 4352d82647f679fb8dd9440b34400fa49beedb2c Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Mon, 3 Dec 2007 21:34:14 -0600 Subject: pasemi_mac: Fix reuse of free'd skb Turns out we're freeing the skb when we detect CRC error, but we're not clearing out info->skb. We could either clear it and have the stack reallocate it, or just leave it and the rx ring refill code will reuse the one that was allocated. Reusing a freed skb obviously caused some nasty crashes of various kind, as reported by Brent Baude and David Woodhouse. Signed-off-by: Olof Johansson Signed-off-by: Jeff Garzik diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index a8db5d7..816a59e 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c @@ -586,7 +586,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) /* CRC error flagged */ mac->netdev->stats.rx_errors++; mac->netdev->stats.rx_crc_errors++; - dev_kfree_skb_irq(skb); + /* No need to free skb, it'll be reused */ goto next; } -- cgit v0.10.2 From f9663aea2a938f9dc60dbfef34b9e7847a69c947 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Sat, 1 Dec 2007 22:10:03 -0700 Subject: gianfar: fix compile warning Eliminate an uninitialized variable warning. The code is correct, but a pointer to the automatic variable 'addr' is passed to dma_alloc_coherent. Since addr has never been initialized, and the compiler doesn't know what dma_alloc_coherent will do with it, it complains. Signed-off-by: Grant Likely Signed-off-by: Jeff Garzik diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 38268d7..0431e9e 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -696,7 +696,7 @@ int startup_gfar(struct net_device *dev) { struct txbd8 *txbdp; struct rxbd8 *rxbdp; - dma_addr_t addr; + dma_addr_t addr = 0; unsigned long vaddr; int i; struct gfar_private *priv = netdev_priv(dev); -- cgit v0.10.2 From 6f4a7f4183bdbd02741dcd8edbd10b8628acc5d5 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Tue, 4 Dec 2007 16:17:33 +0300 Subject: PHY: Add the phy_device_release device method. Lately I've got this nice badness on mdio bus removal: Device 'e0103120:06' does not have a release() function, it is broken and must be fixed. ------------[ cut here ]------------ Badness at drivers/base/core.c:107 NIP: c015c1a8 LR: c015c1a8 CTR: c0157488 REGS: c34bdcf0 TRAP: 0700 Not tainted (2.6.23-rc5-g9ebadfbb-dirty) MSR: 00029032 CR: 24088422 XER: 00000000 ... [c34bdda0] [c015c1a8] device_release+0x78/0x80 (unreliable) [c34bddb0] [c01354cc] kobject_cleanup+0x80/0xbc [c34bddd0] [c01365f0] kref_put+0x54/0x6c [c34bdde0] [c013543c] kobject_put+0x24/0x34 [c34bddf0] [c015c384] put_device+0x1c/0x2c [c34bde00] [c0180e84] mdiobus_unregister+0x2c/0x58 ... Though actually there is nothing broken, it just device subsystem core expects another "pattern" of resource managment. This patch implement phy device's release function, thus we're getting rid of this badness. Also small hidden bug fixed, hope none other introduced. ;-) Signed-off-by: Anton Vorontsov Acked-by: Andy Fleming Signed-off-by: Jeff Garzik diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index fc2f0e6..c30196d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus) err = device_register(&phydev->dev); - if (err) + if (err) { printk(KERN_ERR "phy %d failed to register\n", i); + phy_device_free(phydev); + phydev = NULL; + } } bus->phy_map[i] = phydev; @@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus) int i; for (i = 0; i < PHY_MAX_ADDR; i++) { - if (bus->phy_map[i]) { + if (bus->phy_map[i]) device_unregister(&bus->phy_map[i]->dev); - kfree(bus->phy_map[i]); - } } } EXPORT_SYMBOL(mdiobus_unregister); diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f6e4848..5b9e175 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -44,6 +44,16 @@ static struct phy_driver genphy_driver; extern int mdio_bus_init(void); extern void mdio_bus_exit(void); +void phy_device_free(struct phy_device *phydev) +{ + kfree(phydev); +} + +static void phy_device_release(struct device *dev) +{ + phy_device_free(to_phy_device(dev)); +} + struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) { struct phy_device *dev; @@ -54,6 +64,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) if (NULL == dev) return (struct phy_device*) PTR_ERR((void*)-ENOMEM); + dev->dev.release = phy_device_release; + dev->speed = 0; dev->duplex = -1; dev->pause = dev->asym_pause = 0; diff --git a/include/linux/phy.h b/include/linux/phy.h index e10763d..554836e 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -403,6 +403,7 @@ int phy_mii_ioctl(struct phy_device *phydev, int phy_start_interrupts(struct phy_device *phydev); void phy_print_status(struct phy_device *phydev); struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); +void phy_device_free(struct phy_device *phydev); extern struct bus_type mdio_bus_type; #endif /* __PHY_H */ -- cgit v0.10.2