From ac7c66698a2c51e4c6a34b84621c79e7cb89e07d Mon Sep 17 00:00:00 2001 From: "ODonnell, Michael" Date: Wed, 11 Jan 2006 11:26:22 -0800 Subject: [PATCH] corruption during e100 MDI register access We have identified two related bugs in the e100 driver. Both bugs are related to manipulation of the MDI control register. The first problem is that the Ready bit is being ignored when writing to the Control register; we noticed this because the Linux bonding driver would occasionally come to the spurious conclusion that the link was down when querying Link State. It turned out that by failing to wait for a previous command to complete it was selecting what was essentially a random register in the MDI register set. When we added code that waits for the Ready bit (as shown in the patch file below) all such problems ceased. The second problem is that, although access to the MDI registers involves multiple steps which must not be intermixed, nothing was defending against two or more threads attempting simultaneous access. The most obvious situation where such interference could occur involves the watchdog versus ioctl paths, but there are probably others, so we recommend the locking shown in our patch file. Signed-off-by: Michael O'Donnell Cc: "David S. Miller" Cc: Jeff Garzik Cc: John Ronciak Cc: Ganesh Venkatesan Cc: Jesse Brandeburg Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/e100.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 22cd04556707..23de22631c64 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -132,6 +132,10 @@ * TODO: * o several entry points race with dev->close * o check for tx-no-resources/stop Q races with tx clean/wake Q + * + * FIXES: + * 2005/12/02 - Michael O'Donnell + * - Stratus87247: protect MDI control register manipulations */ #include @@ -578,6 +582,7 @@ struct nic { u16 leds; u16 eeprom_wc; u16 eeprom[256]; + spinlock_t mdio_lock; }; static inline void e100_write_flush(struct nic *nic) @@ -876,15 +881,35 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data) { u32 data_out = 0; unsigned int i; + unsigned long flags; + + /* + * Stratus87247: we shouldn't be writing the MDI control + * register until the Ready bit shows True. Also, since + * manipulation of the MDI control registers is a multi-step + * procedure it should be done under lock. + */ + spin_lock_irqsave(&nic->mdio_lock, flags); + for (i = 100; i; --i) { + if (readl(&nic->csr->mdi_ctrl) & mdi_ready) + break; + udelay(20); + } + if (unlikely(!i)) { + printk("e100.mdio_ctrl(%s) won't go Ready\n", + nic->netdev->name ); + spin_unlock_irqrestore(&nic->mdio_lock, flags); + return 0; /* No way to indicate timeout error */ + } writel((reg << 16) | (addr << 21) | dir | data, &nic->csr->mdi_ctrl); - for(i = 0; i < 100; i++) { + for (i = 0; i < 100; i++) { udelay(20); - if((data_out = readl(&nic->csr->mdi_ctrl)) & mdi_ready) + if ((data_out = readl(&nic->csr->mdi_ctrl)) & mdi_ready) break; } - + spin_unlock_irqrestore(&nic->mdio_lock, flags); DPRINTK(HW, DEBUG, "%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n", dir == mdi_read ? "READ" : "WRITE", addr, reg, data, data_out); @@ -2562,6 +2587,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, /* locks must be initialized before calling hw_reset */ spin_lock_init(&nic->cb_lock); spin_lock_init(&nic->cmd_lock); + spin_lock_init(&nic->mdio_lock); /* Reset the device before pci_set_master() in case device is in some * funky state and has an interrupt pending - hint: we don't have the -- cgit v1.2.3 From 9ad8b9d1520db4d317d791eeb8d6e47c366be82c Mon Sep 17 00:00:00 2001 From: dann frazier Date: Wed, 11 Jan 2006 11:26:24 -0800 Subject: [PATCH] CONFIG_AIRO needs CONFIG_CRYPTO airo.c currently has MICSUPPORT enabled, which requires CONFIG_CRYPTO. A user reported a build failure which is due to the lack of a Kconfig dependency. See http://bugs.debian.org/344205. This patch makes Kconfig enforce this dependency. Signed-off-by: dann frazier Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/wireless/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 24f7967aab67..c1a6e69f7905 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig @@ -243,7 +243,7 @@ config IPW2200_DEBUG config AIRO tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" - depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN) + depends on NET_RADIO && ISA_DMA_API && CRYPTO && (PCI || BROKEN) ---help--- This is the standard Linux driver to support Cisco/Aironet ISA and PCI 802.11 wireless cards. -- cgit v1.2.3 From 9c07b884b92c80e9d660b7b9282631fb626451e2 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 11 Jan 2006 11:26:25 -0800 Subject: [PATCH] gfar: fix compile error Missing include of to get definition of IPPROTO_UDP. Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/gianfar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 146f9513aea5..637b73ad5e90 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -84,6 +84,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3 From 1d5326774c9245fef77334a9e0f11cd4f8aa7b4e Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 11 Jan 2006 11:27:32 -0800 Subject: [PATCH] gianfar mii: Use proper resource for MII memory region We can now have the gianfar mii platform device have a proper resource for the IO memory region for its registers. Previously we passed this information that the platform_data structure because we couldn't handle overlapping memory regions for platform devices. Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/gianfar_mii.c | 5 ++++- include/linux/fsl_devices.h | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 04a462c2a5b7..74e52fcbf806 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c @@ -128,6 +128,7 @@ int gfar_mdio_probe(struct device *dev) struct gianfar_mdio_data *pdata; struct gfar_mii *regs; struct mii_bus *new_bus; + struct resource *r; int err = 0; if (NULL == dev) @@ -151,8 +152,10 @@ int gfar_mdio_probe(struct device *dev) return -ENODEV; } + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + /* Set the PHY base address */ - regs = (struct gfar_mii *) ioremap(pdata->paddr, + regs = (struct gfar_mii *) ioremap(r->start, sizeof (struct gfar_mii)); if (NULL == regs) { diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 934aa9bda481..a7a2b855ba72 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h @@ -55,9 +55,6 @@ struct gianfar_platform_data { }; struct gianfar_mdio_data { - /* device specific information */ - u32 paddr; - /* board specific information */ int irq[32]; }; -- cgit v1.2.3 From a4d00f179fcec7065fe5742e9cebd6500886070f Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 11 Jan 2006 11:27:33 -0800 Subject: [PATCH] phy: Added a macro to represent the string format used to match a phy device Add the PHY_ID_FMT macro to ensure that the format of the id string used by a driver to match to its specific phy is consistent between the mdio_bus and the driver. Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/phy/phy.c | 2 +- include/linux/phy.h | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 02940c0fef68..459443b572ce 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -81,7 +81,7 @@ int mdiobus_register(struct mii_bus *bus) phydev->dev.parent = bus->dev; phydev->dev.bus = &mdio_bus_type; - sprintf(phydev->dev.bus_id, "phy%d:%d", bus->id, i); + snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, i); phydev->bus = bus; diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b8686e47f899..1474b7c5ac0b 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -42,7 +42,7 @@ */ void phy_print_status(struct phy_device *phydev) { - pr_info("%s: Link is %s", phydev->dev.bus_id, + pr_info("PHY: %s - Link is %s", phydev->dev.bus_id, phydev->link ? "Up" : "Down"); if (phydev->link) printk(" - %d/%s", phydev->speed, diff --git a/include/linux/phy.h b/include/linux/phy.h index 92a9696fdebe..331521a10a2d 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -53,6 +53,9 @@ #define PHY_MAX_ADDR 32 +/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ +#define PHY_ID_FMT "%x:%02x" + /* The Bus class for PHYs. Devices which provide access to * PHYs should register using this structure */ struct mii_bus { -- cgit v1.2.3 From 4d3248a29cb78b31bb0520eb99b4be620e810a40 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 11 Jan 2006 11:27:33 -0800 Subject: [PATCH] gianfar: Use new PHY_ID_FMT macro Make the driver produce the string used by phy_connect and have board specific code pass the integer mii bus id and phy device id for the specific controller instance. Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/gianfar.c | 5 ++++- include/linux/fsl_devices.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 637b73ad5e90..0c18dbd67d3b 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -399,12 +399,15 @@ static int init_phy(struct net_device *dev) priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ? SUPPORTED_1000baseT_Full : 0; struct phy_device *phydev; + char phy_id[BUS_ID_SIZE]; priv->oldlink = 0; priv->oldspeed = 0; priv->oldduplex = -1; - phydev = phy_connect(dev, priv->einfo->bus_id, &adjust_link, 0); + snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id); + + phydev = phy_connect(dev, phy_id, &adjust_link, 0); if (IS_ERR(phydev)) { printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index a7a2b855ba72..a9f1cfd096ff 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h @@ -50,7 +50,8 @@ struct gianfar_platform_data { /* board specific information */ u32 board_flags; - const char *bus_id; + u32 bus_id; + u32 phy_id; u8 mac_addr[6]; }; -- cgit v1.2.3 From c213460fd4781c04832c81416532d64ae2bfa88b Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn / snakebyte Date: Tue, 10 Jan 2006 13:16:03 +0100 Subject: [PATCH] replace MODULE_PARM in tulip/uli526x.c Replace the MODULE_PARM usage in uli526x.c with module_param. Signed-off-by: Eric Sesterhenn Signed-off-by: Jeff Garzik --- drivers/net/tulip/uli526x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 1a4316336256..983981666800 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c @@ -1689,9 +1689,9 @@ MODULE_AUTHOR("Peer Chen, peer.chen@uli.com.tw"); MODULE_DESCRIPTION("ULi M5261/M5263 fast ethernet driver"); MODULE_LICENSE("GPL"); -MODULE_PARM(debug, "i"); -MODULE_PARM(mode, "i"); -MODULE_PARM(cr6set, "i"); +module_param(debug, int, 0644); +module_param(mode, int, 0); +module_param(cr6set, int, 0); MODULE_PARM_DESC(debug, "ULi M5261/M5263 enable debugging (0-1)"); MODULE_PARM_DESC(mode, "ULi M5261/M5263: Bit 0: 10/100Mbps, bit 2: duplex, bit 8: HomePNA"); -- cgit v1.2.3 From 9a6301c114aaab1df6de6fad9899bb89852a7592 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 10 Jan 2006 00:56:11 -0500 Subject: [PATCH] wireless/atmel: add IWENCODEEXT, IWAUTH, and association event support This patch allows the Atmel driver to work correctly with wpa_supplicant and other programs that require some conformance with WEXT-18. It should not affect current behavior of the driver. The patch does four things: 1) Implements SIOCSIWENCODEEXT, SIOCGIWENCODEEXT, SIOCSIWAUTH, and SIOCGIWAUTH calls for unencrypted and WEP operation 2) Accepts zero-filled addresses for SIOCSIWAP, which are legal and should turn off any previous forced WAP address 3) Sends association and de-association events to userspace at most of the appropriate times 4) Fixes erroneous order of CIPHER_SUITE_WEP_* arguments in one location which are actually unused anyway Signed-off-by: Dan Williams Signed-off-by: Jeff Garzik --- drivers/net/wireless/atmel.c | 227 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 223 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index e4729ddf29fd..f0ccfef66445 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -1407,6 +1407,17 @@ static int atmel_close(struct net_device *dev) { struct atmel_private *priv = netdev_priv(dev); + /* Send event to userspace that we are disassociating */ + if (priv->station_state == STATION_STATE_READY) { + union iwreq_data wrqu; + + wrqu.data.length = 0; + wrqu.data.flags = 0; + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); + } + atmel_enter_state(priv, STATION_STATE_DOWN); if (priv->bus_type == BUS_TYPE_PCCARD) @@ -1780,10 +1791,10 @@ static int atmel_set_encode(struct net_device *dev, priv->wep_is_on = 1; priv->exclude_unencrypted = 1; if (priv->wep_key_len[index] > 5) { - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; + priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; priv->encryption_level = 2; } else { - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; + priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; priv->encryption_level = 1; } } @@ -1853,6 +1864,181 @@ static int atmel_get_encode(struct net_device *dev, return 0; } +static int atmel_set_encodeext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct atmel_private *priv = netdev_priv(dev); + struct iw_point *encoding = &wrqu->encoding; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + int idx, key_len; + + /* Determine and validate the key index */ + idx = encoding->flags & IW_ENCODE_INDEX; + if (idx) { + if (idx < 1 || idx > WEP_KEYS) + return -EINVAL; + idx--; + } else + idx = priv->default_key; + + if ((encoding->flags & IW_ENCODE_DISABLED) || + ext->alg == IW_ENCODE_ALG_NONE) { + priv->wep_is_on = 0; + priv->encryption_level = 0; + priv->pairwise_cipher_suite = CIPHER_SUITE_NONE; + } + + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) + priv->default_key = idx; + + /* Set the requested key */ + switch (ext->alg) { + case IW_ENCODE_ALG_NONE: + break; + case IW_ENCODE_ALG_WEP: + if (ext->key_len > 5) { + priv->wep_key_len[idx] = 13; + priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; + priv->encryption_level = 2; + } else if (ext->key_len > 0) { + priv->wep_key_len[idx] = 5; + priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; + priv->encryption_level = 1; + } else { + return -EINVAL; + } + priv->wep_is_on = 1; + memset(priv->wep_keys[idx], 0, 13); + key_len = min ((int)ext->key_len, priv->wep_key_len[idx]); + memcpy(priv->wep_keys[idx], ext->key, key_len); + break; + default: + return -EINVAL; + } + + return -EINPROGRESS; +} + +static int atmel_get_encodeext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct atmel_private *priv = netdev_priv(dev); + struct iw_point *encoding = &wrqu->encoding; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + int idx, max_key_len; + + max_key_len = encoding->length - sizeof(*ext); + if (max_key_len < 0) + return -EINVAL; + + idx = encoding->flags & IW_ENCODE_INDEX; + if (idx) { + if (idx < 1 || idx > WEP_KEYS) + return -EINVAL; + idx--; + } else + idx = priv->default_key; + + encoding->flags = idx + 1; + memset(ext, 0, sizeof(*ext)); + + if (!priv->wep_is_on) { + ext->alg = IW_ENCODE_ALG_NONE; + ext->key_len = 0; + encoding->flags |= IW_ENCODE_DISABLED; + } else { + if (priv->encryption_level > 0) + ext->alg = IW_ENCODE_ALG_WEP; + else + return -EINVAL; + + ext->key_len = priv->wep_key_len[idx]; + memcpy(ext->key, priv->wep_keys[idx], ext->key_len); + encoding->flags |= IW_ENCODE_ENABLED; + } + + return 0; +} + +static int atmel_set_auth(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct atmel_private *priv = netdev_priv(dev); + struct iw_param *param = &wrqu->param; + + switch (param->flags & IW_AUTH_INDEX) { + case IW_AUTH_WPA_VERSION: + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + case IW_AUTH_PRIVACY_INVOKED: + /* + * atmel does not use these parameters + */ + break; + + case IW_AUTH_DROP_UNENCRYPTED: + priv->exclude_unencrypted = param->value ? 1 : 0; + break; + + case IW_AUTH_80211_AUTH_ALG: { + if (param->value & IW_AUTH_ALG_SHARED_KEY) { + priv->exclude_unencrypted = 1; + } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { + priv->exclude_unencrypted = 0; + } else + return -EINVAL; + break; + } + + case IW_AUTH_WPA_ENABLED: + /* Silently accept disable of WPA */ + if (param->value > 0) + return -EOPNOTSUPP; + break; + + default: + return -EOPNOTSUPP; + } + return -EINPROGRESS; +} + +static int atmel_get_auth(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct atmel_private *priv = netdev_priv(dev); + struct iw_param *param = &wrqu->param; + + switch (param->flags & IW_AUTH_INDEX) { + case IW_AUTH_DROP_UNENCRYPTED: + param->value = priv->exclude_unencrypted; + break; + + case IW_AUTH_80211_AUTH_ALG: + if (priv->exclude_unencrypted == 1) + param->value = IW_AUTH_ALG_SHARED_KEY; + else + param->value = IW_AUTH_ALG_OPEN_SYSTEM; + break; + + case IW_AUTH_WPA_ENABLED: + param->value = 0; + break; + + default: + return -EOPNOTSUPP; + } + return 0; +} + + static int atmel_get_name(struct net_device *dev, struct iw_request_info *info, char *cwrq, @@ -2289,13 +2475,15 @@ static int atmel_set_wap(struct net_device *dev, { struct atmel_private *priv = netdev_priv(dev); int i; - static const u8 bcast[] = { 255, 255, 255, 255, 255, 255 }; + static const u8 any[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + static const u8 off[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; unsigned long flags; if (awrq->sa_family != ARPHRD_ETHER) return -EINVAL; - if (memcmp(bcast, awrq->sa_data, 6) == 0) { + if (!memcmp(any, awrq->sa_data, 6) || + !memcmp(off, awrq->sa_data, 6)) { del_timer_sync(&priv->management_timer); spin_lock_irqsave(&priv->irqlock, flags); atmel_scan(priv, 1); @@ -2378,6 +2566,15 @@ static const iw_handler atmel_handler[] = (iw_handler) atmel_get_encode, /* SIOCGIWENCODE */ (iw_handler) atmel_set_power, /* SIOCSIWPOWER */ (iw_handler) atmel_get_power, /* SIOCGIWPOWER */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* SIOCSIWGENIE */ + (iw_handler) NULL, /* SIOCGIWGENIE */ + (iw_handler) atmel_set_auth, /* SIOCSIWAUTH */ + (iw_handler) atmel_get_auth, /* SIOCGIWAUTH */ + (iw_handler) atmel_set_encodeext, /* SIOCSIWENCODEEXT */ + (iw_handler) atmel_get_encodeext, /* SIOCGIWENCODEEXT */ + (iw_handler) NULL, /* SIOCSIWPMKSA */ }; static const iw_handler atmel_private_handler[] = @@ -2924,6 +3121,8 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) u16 ass_id = le16_to_cpu(ass_resp->ass_id); u16 rates_len = ass_resp->length > 4 ? 4 : ass_resp->length; + union iwreq_data wrqu; + if (frame_len < 8 + rates_len) return; @@ -2954,6 +3153,14 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) priv->station_is_associated = 1; priv->station_was_associated = 1; atmel_enter_state(priv, STATION_STATE_READY); + + /* Send association event to userspace */ + wrqu.data.length = 0; + wrqu.data.flags = 0; + memcpy(wrqu.ap_addr.sa_data, priv->CurrentBSSID, ETH_ALEN); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); + return; } @@ -3632,6 +3839,7 @@ static int reset_atmel_card(struct net_device *dev) struct atmel_private *priv = netdev_priv(dev); u8 configuration; + int old_state = priv->station_state; /* data to add to the firmware names, in priority order this implemenents firmware versioning */ @@ -3792,6 +4000,17 @@ static int reset_atmel_card(struct net_device *dev) else build_wep_mib(priv); + if (old_state == STATION_STATE_READY) + { + union iwreq_data wrqu; + + wrqu.data.length = 0; + wrqu.data.flags = 0; + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); + } + return 1; } -- cgit v1.2.3 From 5af47b2ff124fdad9ba84baeb9f7eeebeb227b43 Mon Sep 17 00:00:00 2001 From: Jay Vosburgh Date: Mon, 9 Jan 2006 12:14:00 -0800 Subject: [PATCH] bonding: UPDATED hash-table corruption in bond_alb.c I believe I see the race Michael refers to (tlb_choose_channel may set head, which tlb_init_slave clears), although I was not able to reproduce it. I have updated his patch for the current netdev-2.6.git tree and added a version update. His original comment follows: Our systems have been crashing during testing of PCI HotPlug support in the various networking components. We've faulted in the bonding driver due to a bug in bond_alb.c:tlb_clear_slave() In that routine, the last modification to the TLB hash table is made without protection of the lock, allowing a race that can lead tlb_choose_channel() to select an invalid table element. -J Signed-off-by: Jeff Garzik --- drivers/net/bonding/bond_alb.c | 4 ++-- drivers/net/bonding/bonding.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 854ddfb90da1..f2a63186ae05 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -169,9 +169,9 @@ static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_ index = next_index; } - _unlock_tx_hashtbl(bond); - tlb_init_slave(slave); + + _unlock_tx_hashtbl(bond); } /* Must be called before starting the monitor timer */ diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index f20bb85c1ea5..3dd78d048c3e 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -22,8 +22,8 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "3.0.0" -#define DRV_RELDATE "November 8, 2005" +#define DRV_VERSION "3.0.1" +#define DRV_RELDATE "January 9, 2006" #define DRV_NAME "bonding" #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" -- cgit v1.2.3 From c9fa7d5d6cec7a45f9dc6c2f23500af50d5617c9 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 27 Dec 2005 02:14:13 +0100 Subject: [PATCH] fix wrong comments in ieee80211.h The comments in ieee80211.h claim that one doesn't need to set the len parameter of the stats struct. But if one doesn't, the management frames are read far over the memory they actually occupy causing badness. Signed-Off-By: Johannes Berg Signed-off-by: Jeff Garzik --- include/net/ieee80211.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index cde2f4f4f501..df05f468fa5c 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h @@ -363,8 +363,9 @@ enum ieee80211_reasoncode { #define IEEE80211_OFDM_SHIFT_MASK_A 4 /* NOTE: This data is for statistical purposes; not all hardware provides this - * information for frames received. Not setting these will not cause - * any adverse affects. */ + * information for frames received. + * For ieee80211_rx_mgt, you need to set at least the 'len' parameter. + */ struct ieee80211_rx_stats { u32 mac_time; s8 rssi; @@ -1088,6 +1089,7 @@ extern int ieee80211_tx_frame(struct ieee80211_device *ieee, /* ieee80211_rx.c */ extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); +/* make sure to set stats->len */ extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, struct ieee80211_hdr_4addr *header, struct ieee80211_rx_stats *stats); -- cgit v1.2.3 From 9f3f46b5fe83a56d380d4006dd2cd906bc186f91 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Fri, 9 Dec 2005 10:36:09 -0500 Subject: [PATCH] via-velocity: use NETIF_F_IP_CSUM (hardware only support IPv4) At least some versions of the via-velocity hardware only support checksumming IPv4 frames in hardware. However, the driver is currently setting the NETIF_F_HW_CSUM flag, which indicates support for more than just IPv4. This results in errors when trying to use IPv6 over via-velocity hardware. Signed-off-by: John W. Linville Signed-off-by: Jeff Garzik --- drivers/net/via-velocity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 82c6b757d306..c2d5907dc8e0 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -791,7 +791,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi #endif if (vptr->flags & VELOCITY_FLAGS_TX_CSUM) { - dev->features |= NETIF_F_HW_CSUM; + dev->features |= NETIF_F_IP_CSUM; } ret = register_netdev(dev); -- cgit v1.2.3