diff options
29 files changed, 102 insertions, 90 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index a17eb130f574..6dbfed0b4149 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -7285,15 +7285,15 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry, | |||
7285 | } | 7285 | } |
7286 | break; | 7286 | break; |
7287 | case ATH9K_CIPHER_WEP: | 7287 | case ATH9K_CIPHER_WEP: |
7288 | if (k->kv_len < 40 / NBBY) { | 7288 | if (k->kv_len < LEN_WEP40) { |
7289 | DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, | 7289 | DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, |
7290 | "%s: WEP key length %u too small\n", | 7290 | "%s: WEP key length %u too small\n", |
7291 | __func__, k->kv_len); | 7291 | __func__, k->kv_len); |
7292 | return false; | 7292 | return false; |
7293 | } | 7293 | } |
7294 | if (k->kv_len <= 40 / NBBY) | 7294 | if (k->kv_len <= LEN_WEP40) |
7295 | keyType = AR_KEYTABLE_TYPE_40; | 7295 | keyType = AR_KEYTABLE_TYPE_40; |
7296 | else if (k->kv_len <= 104 / NBBY) | 7296 | else if (k->kv_len <= LEN_WEP104) |
7297 | keyType = AR_KEYTABLE_TYPE_104; | 7297 | keyType = AR_KEYTABLE_TYPE_104; |
7298 | else | 7298 | else |
7299 | keyType = AR_KEYTABLE_TYPE_128; | 7299 | keyType = AR_KEYTABLE_TYPE_128; |
@@ -7313,7 +7313,7 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry, | |||
7313 | key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask; | 7313 | key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask; |
7314 | key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff; | 7314 | key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff; |
7315 | key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask; | 7315 | key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask; |
7316 | if (k->kv_len <= 104 / NBBY) | 7316 | if (k->kv_len <= LEN_WEP104) |
7317 | key4 &= 0xff; | 7317 | key4 &= 0xff; |
7318 | 7318 | ||
7319 | if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) { | 7319 | if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) { |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 2888778040e4..95b337149484 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -206,7 +206,8 @@ static int ath_key_config(struct ath_softc *sc, | |||
206 | if (!ret) | 206 | if (!ret) |
207 | return -EIO; | 207 | return -EIO; |
208 | 208 | ||
209 | sc->sc_keytype = hk.kv_type; | 209 | if (mac) |
210 | sc->sc_keytype = hk.kv_type; | ||
210 | return 0; | 211 | return 0; |
211 | } | 212 | } |
212 | 213 | ||
@@ -756,7 +757,8 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
756 | key->hw_key_idx = key->keyidx; | 757 | key->hw_key_idx = key->keyidx; |
757 | /* push IV and Michael MIC generation to stack */ | 758 | /* push IV and Michael MIC generation to stack */ |
758 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 759 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
759 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | 760 | if (key->alg == ALG_TKIP) |
761 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | ||
760 | } | 762 | } |
761 | break; | 763 | break; |
762 | case DISABLE_KEY: | 764 | case DISABLE_KEY: |
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 2fe806175c01..20ddb7acdb94 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -360,8 +360,9 @@ static void ath_rx_flush_tid(struct ath_softc *sc, | |||
360 | struct ath_arx_tid *rxtid, int drop) | 360 | struct ath_arx_tid *rxtid, int drop) |
361 | { | 361 | { |
362 | struct ath_rxbuf *rxbuf; | 362 | struct ath_rxbuf *rxbuf; |
363 | unsigned long flag; | ||
363 | 364 | ||
364 | spin_lock_bh(&rxtid->tidlock); | 365 | spin_lock_irqsave(&rxtid->tidlock, flag); |
365 | while (rxtid->baw_head != rxtid->baw_tail) { | 366 | while (rxtid->baw_head != rxtid->baw_tail) { |
366 | rxbuf = rxtid->rxbuf + rxtid->baw_head; | 367 | rxbuf = rxtid->rxbuf + rxtid->baw_head; |
367 | if (!rxbuf->rx_wbuf) { | 368 | if (!rxbuf->rx_wbuf) { |
@@ -382,7 +383,7 @@ static void ath_rx_flush_tid(struct ath_softc *sc, | |||
382 | INCR(rxtid->baw_head, ATH_TID_MAX_BUFS); | 383 | INCR(rxtid->baw_head, ATH_TID_MAX_BUFS); |
383 | INCR(rxtid->seq_next, IEEE80211_SEQ_MAX); | 384 | INCR(rxtid->seq_next, IEEE80211_SEQ_MAX); |
384 | } | 385 | } |
385 | spin_unlock_bh(&rxtid->tidlock); | 386 | spin_unlock_irqrestore(&rxtid->tidlock, flag); |
386 | } | 387 | } |
387 | 388 | ||
388 | static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, | 389 | static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index e2581229d8b2..23fed3298962 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -474,8 +474,8 @@ static void iwl4965_apm_stop(struct iwl_priv *priv) | |||
474 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); | 474 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); |
475 | 475 | ||
476 | udelay(10); | 476 | udelay(10); |
477 | 477 | /* clear "init complete" move adapter D0A* --> D0U state */ | |
478 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 478 | iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
479 | spin_unlock_irqrestore(&priv->lock, flags); | 479 | spin_unlock_irqrestore(&priv->lock, flags); |
480 | } | 480 | } |
481 | 481 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index cbc01a00eaf4..b08036a9d894 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -145,7 +145,8 @@ static void iwl5000_apm_stop(struct iwl_priv *priv) | |||
145 | 145 | ||
146 | udelay(10); | 146 | udelay(10); |
147 | 147 | ||
148 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 148 | /* clear "init complete" move adapter D0A* --> D0U state */ |
149 | iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | ||
149 | 150 | ||
150 | spin_unlock_irqrestore(&priv->lock, flags); | 151 | spin_unlock_irqrestore(&priv->lock, flags); |
151 | } | 152 | } |
@@ -577,14 +578,11 @@ static int iwl5000_load_section(struct iwl_priv *priv, | |||
577 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), | 578 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), |
578 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); | 579 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); |
579 | 580 | ||
580 | /* FIME: write the MSB of the phy_addr in CTRL1 | ||
581 | * iwl_write_direct32(priv, | ||
582 | IWL_FH_TFDIB_CTRL1_REG(IWL_FH_SRVC_CHNL), | ||
583 | ((phy_addr & MSB_MSK) | ||
584 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_count); | ||
585 | */ | ||
586 | iwl_write_direct32(priv, | 581 | iwl_write_direct32(priv, |
587 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), byte_cnt); | 582 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), |
583 | (iwl_get_dma_hi_address(phy_addr) | ||
584 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); | ||
585 | |||
588 | iwl_write_direct32(priv, | 586 | iwl_write_direct32(priv, |
589 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), | 587 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), |
590 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | | 588 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 061ffba9c884..c0b73c4d6f44 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2602,6 +2602,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
2602 | { | 2602 | { |
2603 | struct iwl_priv *priv = hw->priv; | 2603 | struct iwl_priv *priv = hw->priv; |
2604 | int ret; | 2604 | int ret; |
2605 | u16 pci_cmd; | ||
2605 | 2606 | ||
2606 | IWL_DEBUG_MAC80211("enter\n"); | 2607 | IWL_DEBUG_MAC80211("enter\n"); |
2607 | 2608 | ||
@@ -2612,6 +2613,13 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
2612 | pci_restore_state(priv->pci_dev); | 2613 | pci_restore_state(priv->pci_dev); |
2613 | pci_enable_msi(priv->pci_dev); | 2614 | pci_enable_msi(priv->pci_dev); |
2614 | 2615 | ||
2616 | /* enable interrupts if needed: hw bug w/a */ | ||
2617 | pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); | ||
2618 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { | ||
2619 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; | ||
2620 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); | ||
2621 | } | ||
2622 | |||
2615 | ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, | 2623 | ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, |
2616 | DRV_NAME, priv); | 2624 | DRV_NAME, priv); |
2617 | if (ret) { | 2625 | if (ret) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index 944642450d3d..cd11c0ca2991 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
@@ -287,6 +287,7 @@ | |||
287 | 287 | ||
288 | #define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) | 288 | #define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) |
289 | 289 | ||
290 | #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 | ||
290 | 291 | ||
291 | /** | 292 | /** |
292 | * Transmit DMA Channel Control/Status Registers (TCSR) | 293 | * Transmit DMA Channel Control/Status Registers (TCSR) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index d82823b5c8ab..ff879d46624a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -426,7 +426,7 @@ static int iwl_tx_queue_init(struct iwl_priv *priv, | |||
426 | continue; | 426 | continue; |
427 | } | 427 | } |
428 | 428 | ||
429 | txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA); | 429 | txq->cmd[i] = kmalloc(len, GFP_KERNEL); |
430 | if (!txq->cmd[i]) | 430 | if (!txq->cmd[i]) |
431 | return -ENOMEM; | 431 | return -ENOMEM; |
432 | } | 432 | } |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 04d7a251e3f0..8941919001bb 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -595,7 +595,7 @@ static int if_cs_prog_helper(struct if_cs_card *card) | |||
595 | if (ret < 0) { | 595 | if (ret < 0) { |
596 | lbs_pr_err("can't download helper at 0x%x, ret %d\n", | 596 | lbs_pr_err("can't download helper at 0x%x, ret %d\n", |
597 | sent, ret); | 597 | sent, ret); |
598 | goto done; | 598 | goto err_release; |
599 | } | 599 | } |
600 | 600 | ||
601 | if (count == 0) | 601 | if (count == 0) |
@@ -604,9 +604,8 @@ static int if_cs_prog_helper(struct if_cs_card *card) | |||
604 | sent += count; | 604 | sent += count; |
605 | } | 605 | } |
606 | 606 | ||
607 | err_release: | ||
607 | release_firmware(fw); | 608 | release_firmware(fw); |
608 | ret = 0; | ||
609 | |||
610 | done: | 609 | done: |
611 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); | 610 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); |
612 | return ret; | 611 | return ret; |
@@ -676,14 +675,8 @@ static int if_cs_prog_real(struct if_cs_card *card) | |||
676 | } | 675 | } |
677 | 676 | ||
678 | ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); | 677 | ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); |
679 | if (ret < 0) { | 678 | if (ret < 0) |
680 | lbs_pr_err("firmware download failed\n"); | 679 | lbs_pr_err("firmware download failed\n"); |
681 | goto err_release; | ||
682 | } | ||
683 | |||
684 | ret = 0; | ||
685 | goto done; | ||
686 | |||
687 | 680 | ||
688 | err_release: | 681 | err_release: |
689 | release_firmware(fw); | 682 | release_firmware(fw); |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 1ebcafe7ca5f..36c004e15602 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -1970,6 +1970,9 @@ __orinoco_set_multicast_list(struct net_device *dev) | |||
1970 | priv->promiscuous = promisc; | 1970 | priv->promiscuous = promisc; |
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | /* If we're not in promiscuous mode, then we need to set the | ||
1974 | * group address if either we want to multicast, or if we were | ||
1975 | * multicasting and want to stop */ | ||
1973 | if (! promisc && (mc_count || priv->mc_count) ) { | 1976 | if (! promisc && (mc_count || priv->mc_count) ) { |
1974 | struct dev_mc_list *p = dev->mc_list; | 1977 | struct dev_mc_list *p = dev->mc_list; |
1975 | struct hermes_multicast mclist; | 1978 | struct hermes_multicast mclist; |
@@ -1989,9 +1992,10 @@ __orinoco_set_multicast_list(struct net_device *dev) | |||
1989 | printk(KERN_WARNING "%s: Multicast list is " | 1992 | printk(KERN_WARNING "%s: Multicast list is " |
1990 | "longer than mc_count\n", dev->name); | 1993 | "longer than mc_count\n", dev->name); |
1991 | 1994 | ||
1992 | err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFGROUPADDRESSES, | 1995 | err = hermes_write_ltv(hw, USER_BAP, |
1993 | HERMES_BYTES_TO_RECLEN(priv->mc_count * ETH_ALEN), | 1996 | HERMES_RID_CNFGROUPADDRESSES, |
1994 | &mclist); | 1997 | HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN), |
1998 | &mclist); | ||
1995 | if (err) | 1999 | if (err) |
1996 | printk(KERN_ERR "%s: Error %d setting multicast list.\n", | 2000 | printk(KERN_ERR "%s: Error %d setting multicast list.\n", |
1997 | dev->name, err); | 2001 | dev->name, err); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h index 7e88ce5651b9..2ea7866abd5d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00reg.h +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h | |||
@@ -136,7 +136,7 @@ struct rt2x00_field32 { | |||
136 | */ | 136 | */ |
137 | #define is_power_of_two(x) ( !((x) & ((x)-1)) ) | 137 | #define is_power_of_two(x) ( !((x) & ((x)-1)) ) |
138 | #define low_bit_mask(x) ( ((x)-1) & ~(x) ) | 138 | #define low_bit_mask(x) ( ((x)-1) & ~(x) ) |
139 | #define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x)) | 139 | #define is_valid_mask(x) is_power_of_two(1LU + (x) + low_bit_mask(x)) |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * Macro's to find first set bit in a variable. | 142 | * Macro's to find first set bit in a variable. |
@@ -173,8 +173,7 @@ struct rt2x00_field32 { | |||
173 | * does not exceed the given typelimit. | 173 | * does not exceed the given typelimit. |
174 | */ | 174 | */ |
175 | #define FIELD_CHECK(__mask, __type) \ | 175 | #define FIELD_CHECK(__mask, __type) \ |
176 | BUILD_BUG_ON(!__builtin_constant_p(__mask) || \ | 176 | BUILD_BUG_ON(!(__mask) || \ |
177 | !(__mask) || \ | ||
178 | !is_valid_mask(__mask) || \ | 177 | !is_valid_mask(__mask) || \ |
179 | (__mask) != (__type)(__mask)) \ | 178 | (__mask) != (__type)(__mask)) \ |
180 | 179 | ||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 7d970678f940..59391250d51c 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -297,7 +297,6 @@ unifdef-y += parport.h | |||
297 | unifdef-y += patchkey.h | 297 | unifdef-y += patchkey.h |
298 | unifdef-y += pci.h | 298 | unifdef-y += pci.h |
299 | unifdef-y += personality.h | 299 | unifdef-y += personality.h |
300 | unifdef-y += pim.h | ||
301 | unifdef-y += pktcdvd.h | 300 | unifdef-y += pktcdvd.h |
302 | unifdef-y += pmu.h | 301 | unifdef-y += pmu.h |
303 | unifdef-y += poll.h | 302 | unifdef-y += poll.h |
diff --git a/include/linux/mroute.h b/include/linux/mroute.h index 07112ee9293a..8a455694d682 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
7 | #include <linux/in.h> | 7 | #include <linux/in.h> |
8 | #endif | 8 | #endif |
9 | #include <linux/pim.h> | ||
10 | 9 | ||
11 | /* | 10 | /* |
12 | * Based on the MROUTING 3.5 defines primarily to keep | 11 | * Based on the MROUTING 3.5 defines primarily to keep |
@@ -130,6 +129,7 @@ struct igmpmsg | |||
130 | */ | 129 | */ |
131 | 130 | ||
132 | #ifdef __KERNEL__ | 131 | #ifdef __KERNEL__ |
132 | #include <linux/pim.h> | ||
133 | #include <net/sock.h> | 133 | #include <net/sock.h> |
134 | 134 | ||
135 | #ifdef CONFIG_IP_MROUTE | 135 | #ifdef CONFIG_IP_MROUTE |
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h index 5cf50473a10f..6f4c180179e2 100644 --- a/include/linux/mroute6.h +++ b/include/linux/mroute6.h | |||
@@ -115,6 +115,7 @@ struct sioc_mif_req6 | |||
115 | 115 | ||
116 | #ifdef __KERNEL__ | 116 | #ifdef __KERNEL__ |
117 | 117 | ||
118 | #include <linux/pim.h> | ||
118 | #include <linux/skbuff.h> /* for struct sk_buff_head */ | 119 | #include <linux/skbuff.h> /* for struct sk_buff_head */ |
119 | 120 | ||
120 | #ifdef CONFIG_IPV6_MROUTE | 121 | #ifdef CONFIG_IPV6_MROUTE |
diff --git a/include/linux/pim.h b/include/linux/pim.h index 236ffd317394..1ba0661561a4 100644 --- a/include/linux/pim.h +++ b/include/linux/pim.h | |||
@@ -3,22 +3,6 @@ | |||
3 | 3 | ||
4 | #include <asm/byteorder.h> | 4 | #include <asm/byteorder.h> |
5 | 5 | ||
6 | #ifndef __KERNEL__ | ||
7 | struct pim { | ||
8 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
9 | __u8 pim_type:4, /* PIM message type */ | ||
10 | pim_ver:4; /* PIM version */ | ||
11 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
12 | __u8 pim_ver:4; /* PIM version */ | ||
13 | pim_type:4; /* PIM message type */ | ||
14 | #endif | ||
15 | __u8 pim_rsv; /* Reserved */ | ||
16 | __be16 pim_cksum; /* Checksum */ | ||
17 | }; | ||
18 | |||
19 | #define PIM_MINLEN 8 | ||
20 | #endif | ||
21 | |||
22 | /* Message types - V1 */ | 6 | /* Message types - V1 */ |
23 | #define PIM_V1_VERSION __constant_htonl(0x10000000) | 7 | #define PIM_V1_VERSION __constant_htonl(0x10000000) |
24 | #define PIM_V1_REGISTER 1 | 8 | #define PIM_V1_REGISTER 1 |
@@ -27,7 +11,6 @@ struct pim { | |||
27 | #define PIM_VERSION 2 | 11 | #define PIM_VERSION 2 |
28 | #define PIM_REGISTER 1 | 12 | #define PIM_REGISTER 1 |
29 | 13 | ||
30 | #if defined(__KERNEL__) | ||
31 | #define PIM_NULL_REGISTER __constant_htonl(0x40000000) | 14 | #define PIM_NULL_REGISTER __constant_htonl(0x40000000) |
32 | 15 | ||
33 | /* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ | 16 | /* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ |
@@ -42,4 +25,3 @@ struct pimreghdr | |||
42 | struct sk_buff; | 25 | struct sk_buff; |
43 | extern int pim_rcv_v1(struct sk_buff *); | 26 | extern int pim_rcv_v1(struct sk_buff *); |
44 | #endif | 27 | #endif |
45 | #endif | ||
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 91d3d96805d0..b12dae2b0b2d 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1029,6 +1029,11 @@ skip: | |||
1029 | } | 1029 | } |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | static inline bool inetdev_valid_mtu(unsigned mtu) | ||
1033 | { | ||
1034 | return mtu >= 68; | ||
1035 | } | ||
1036 | |||
1032 | /* Called only under RTNL semaphore */ | 1037 | /* Called only under RTNL semaphore */ |
1033 | 1038 | ||
1034 | static int inetdev_event(struct notifier_block *this, unsigned long event, | 1039 | static int inetdev_event(struct notifier_block *this, unsigned long event, |
@@ -1048,6 +1053,10 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1048 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); | 1053 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); |
1049 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); | 1054 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); |
1050 | } | 1055 | } |
1056 | } else if (event == NETDEV_CHANGEMTU) { | ||
1057 | /* Re-enabling IP */ | ||
1058 | if (inetdev_valid_mtu(dev->mtu)) | ||
1059 | in_dev = inetdev_init(dev); | ||
1051 | } | 1060 | } |
1052 | goto out; | 1061 | goto out; |
1053 | } | 1062 | } |
@@ -1058,7 +1067,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1058 | dev->ip_ptr = NULL; | 1067 | dev->ip_ptr = NULL; |
1059 | break; | 1068 | break; |
1060 | case NETDEV_UP: | 1069 | case NETDEV_UP: |
1061 | if (dev->mtu < 68) | 1070 | if (!inetdev_valid_mtu(dev->mtu)) |
1062 | break; | 1071 | break; |
1063 | if (dev->flags & IFF_LOOPBACK) { | 1072 | if (dev->flags & IFF_LOOPBACK) { |
1064 | struct in_ifaddr *ifa; | 1073 | struct in_ifaddr *ifa; |
@@ -1080,9 +1089,9 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1080 | ip_mc_down(in_dev); | 1089 | ip_mc_down(in_dev); |
1081 | break; | 1090 | break; |
1082 | case NETDEV_CHANGEMTU: | 1091 | case NETDEV_CHANGEMTU: |
1083 | if (dev->mtu >= 68) | 1092 | if (inetdev_valid_mtu(dev->mtu)) |
1084 | break; | 1093 | break; |
1085 | /* MTU falled under 68, disable IP */ | 1094 | /* disable IP when MTU is not enough */ |
1086 | case NETDEV_UNREGISTER: | 1095 | case NETDEV_UNREGISTER: |
1087 | inetdev_destroy(in_dev); | 1096 | inetdev_destroy(in_dev); |
1088 | break; | 1097 | break; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 01d47674f7e5..e53e493606c5 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -377,14 +377,14 @@ static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) | |||
377 | skb_checksum_complete(skb)) { | 377 | skb_checksum_complete(skb)) { |
378 | atomic_inc(&sk->sk_drops); | 378 | atomic_inc(&sk->sk_drops); |
379 | kfree_skb(skb); | 379 | kfree_skb(skb); |
380 | return 0; | 380 | return NET_RX_DROP; |
381 | } | 381 | } |
382 | 382 | ||
383 | /* Charge it to the socket. */ | 383 | /* Charge it to the socket. */ |
384 | if (sock_queue_rcv_skb(sk,skb)<0) { | 384 | if (sock_queue_rcv_skb(sk,skb)<0) { |
385 | atomic_inc(&sk->sk_drops); | 385 | atomic_inc(&sk->sk_drops); |
386 | kfree_skb(skb); | 386 | kfree_skb(skb); |
387 | return 0; | 387 | return NET_RX_DROP; |
388 | } | 388 | } |
389 | 389 | ||
390 | return 0; | 390 | return 0; |
@@ -429,7 +429,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
429 | if (skb_checksum_complete(skb)) { | 429 | if (skb_checksum_complete(skb)) { |
430 | atomic_inc(&sk->sk_drops); | 430 | atomic_inc(&sk->sk_drops); |
431 | kfree_skb(skb); | 431 | kfree_skb(skb); |
432 | return 0; | 432 | return NET_RX_DROP; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 7439b63df5d0..cf82acec913a 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -265,7 +265,7 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | |||
265 | key = sdata->default_key; | 265 | key = sdata->default_key; |
266 | if (key) { | 266 | if (key) { |
267 | sprintf(buf, "../keys/%d", key->debugfs.cnt); | 267 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
268 | sdata->debugfs.default_key = | 268 | sdata->common_debugfs.default_key = |
269 | debugfs_create_symlink("default_key", | 269 | debugfs_create_symlink("default_key", |
270 | sdata->debugfsdir, buf); | 270 | sdata->debugfsdir, buf); |
271 | } else | 271 | } else |
@@ -277,8 +277,8 @@ void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata) | |||
277 | if (!sdata) | 277 | if (!sdata) |
278 | return; | 278 | return; |
279 | 279 | ||
280 | debugfs_remove(sdata->debugfs.default_key); | 280 | debugfs_remove(sdata->common_debugfs.default_key); |
281 | sdata->debugfs.default_key = NULL; | 281 | sdata->common_debugfs.default_key = NULL; |
282 | } | 282 | } |
283 | 283 | ||
284 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, | 284 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 586a9b49b0fc..4498d8713652 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -496,8 +496,10 @@ struct ieee80211_sub_if_data { | |||
496 | struct { | 496 | struct { |
497 | struct dentry *mode; | 497 | struct dentry *mode; |
498 | } monitor; | 498 | } monitor; |
499 | struct dentry *default_key; | ||
500 | } debugfs; | 499 | } debugfs; |
500 | struct { | ||
501 | struct dentry *default_key; | ||
502 | } common_debugfs; | ||
501 | 503 | ||
502 | #ifdef CONFIG_MAC80211_MESH | 504 | #ifdef CONFIG_MAC80211_MESH |
503 | struct dentry *mesh_stats_dir; | 505 | struct dentry *mesh_stats_dir; |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 5cafdd4c8018..8eb79e92e94c 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -205,7 +205,7 @@ replay: | |||
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | root_lock = qdisc_root_lock(q); | 208 | root_lock = qdisc_root_sleeping_lock(q); |
209 | 209 | ||
210 | if (tp == NULL) { | 210 | if (tp == NULL) { |
211 | /* Proto-tcf does not exist, create new one */ | 211 | /* Proto-tcf does not exist, create new one */ |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 481260a4f10f..e3d8455eebc2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -75,7 +75,7 @@ static __inline__ int route4_fastmap_hash(u32 id, int iif) | |||
75 | static inline | 75 | static inline |
76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) | 76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) |
77 | { | 77 | { |
78 | spinlock_t *root_lock = qdisc_root_lock(q); | 78 | spinlock_t *root_lock = qdisc_root_sleeping_lock(q); |
79 | 79 | ||
80 | spin_lock_bh(root_lock); | 80 | spin_lock_bh(root_lock); |
81 | memset(head->fastmap, 0, sizeof(head->fastmap)); | 81 | memset(head->fastmap, 0, sizeof(head->fastmap)); |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 506b709510b6..1122c952aa99 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1169,8 +1169,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
1169 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) | 1169 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) |
1170 | goto nla_put_failure; | 1170 | goto nla_put_failure; |
1171 | 1171 | ||
1172 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1172 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
1173 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1173 | qdisc_root_sleeping_lock(q), &d) < 0) |
1174 | goto nla_put_failure; | 1174 | goto nla_put_failure; |
1175 | 1175 | ||
1176 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) | 1176 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) |
@@ -1461,8 +1461,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1461 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) | 1461 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) |
1462 | goto nla_put_failure; | 1462 | goto nla_put_failure; |
1463 | 1463 | ||
1464 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1464 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
1465 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1465 | qdisc_root_sleeping_lock(q), &d) < 0) |
1466 | goto nla_put_failure; | 1466 | goto nla_put_failure; |
1467 | 1467 | ||
1468 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) | 1468 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 9b720adedead..8b06fa900482 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1754,7 +1754,7 @@ static void cbq_put(struct Qdisc *sch, unsigned long arg) | |||
1754 | 1754 | ||
1755 | if (--cl->refcnt == 0) { | 1755 | if (--cl->refcnt == 0) { |
1756 | #ifdef CONFIG_NET_CLS_ACT | 1756 | #ifdef CONFIG_NET_CLS_ACT |
1757 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1757 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1758 | struct cbq_sched_data *q = qdisc_priv(sch); | 1758 | struct cbq_sched_data *q = qdisc_priv(sch); |
1759 | 1759 | ||
1760 | spin_lock_bh(root_lock); | 1760 | spin_lock_bh(root_lock); |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 97d4761cc31e..d14f02056ae6 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1043,7 +1043,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt) | |||
1043 | 1043 | ||
1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | 1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) |
1045 | { | 1045 | { |
1046 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1046 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1047 | struct htb_sched *q = qdisc_priv(sch); | 1047 | struct htb_sched *q = qdisc_priv(sch); |
1048 | struct nlattr *nest; | 1048 | struct nlattr *nest; |
1049 | struct tc_htb_glob gopt; | 1049 | struct tc_htb_glob gopt; |
@@ -1075,7 +1075,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1075 | struct sk_buff *skb, struct tcmsg *tcm) | 1075 | struct sk_buff *skb, struct tcmsg *tcm) |
1076 | { | 1076 | { |
1077 | struct htb_class *cl = (struct htb_class *)arg; | 1077 | struct htb_class *cl = (struct htb_class *)arg; |
1078 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1078 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1079 | struct nlattr *nest; | 1079 | struct nlattr *nest; |
1080 | struct tc_htb_opt opt; | 1080 | struct tc_htb_opt opt; |
1081 | 1081 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index fb0294d0b55e..3781e55046d0 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -341,7 +341,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
341 | for (i = 0; i < n; i++) | 341 | for (i = 0; i < n; i++) |
342 | d->table[i] = data[i]; | 342 | d->table[i] = data[i]; |
343 | 343 | ||
344 | root_lock = qdisc_root_lock(sch); | 344 | root_lock = qdisc_root_sleeping_lock(sch); |
345 | 345 | ||
346 | spin_lock_bh(root_lock); | 346 | spin_lock_bh(root_lock); |
347 | d = xchg(&q->delay_dist, d); | 347 | d = xchg(&q->delay_dist, d); |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 2c35c678563b..d35ef059abb1 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -161,7 +161,7 @@ teql_destroy(struct Qdisc* sch) | |||
161 | txq = netdev_get_tx_queue(master->dev, 0); | 161 | txq = netdev_get_tx_queue(master->dev, 0); |
162 | master->slaves = NULL; | 162 | master->slaves = NULL; |
163 | 163 | ||
164 | root_lock = qdisc_root_lock(txq->qdisc); | 164 | root_lock = qdisc_root_sleeping_lock(txq->qdisc); |
165 | spin_lock_bh(root_lock); | 165 | spin_lock_bh(root_lock); |
166 | qdisc_reset(txq->qdisc); | 166 | qdisc_reset(txq->qdisc); |
167 | spin_unlock_bh(root_lock); | 167 | spin_unlock_bh(root_lock); |
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index ab015c62d561..833b024f8f66 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
@@ -39,4 +39,5 @@ config WIRELESS_EXT_SYSFS | |||
39 | files in /sys/class/net/*/wireless/. The same information | 39 | files in /sys/class/net/*/wireless/. The same information |
40 | is available via the ioctls as well. | 40 | is available via the ioctls as well. |
41 | 41 | ||
42 | Say Y if you have programs using it (we don't know of any). | 42 | Say Y if you have programs using it, like old versions of |
43 | hal. | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 841b32a2e680..46914b79d850 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1731,8 +1731,7 @@ restart: | |||
1731 | * We can't enlist stable bundles either. | 1731 | * We can't enlist stable bundles either. |
1732 | */ | 1732 | */ |
1733 | write_unlock_bh(&policy->lock); | 1733 | write_unlock_bh(&policy->lock); |
1734 | if (dst) | 1734 | dst_free(dst); |
1735 | dst_free(dst); | ||
1736 | 1735 | ||
1737 | if (pol_dead) | 1736 | if (pol_dead) |
1738 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTPOLDEAD); | 1737 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTPOLDEAD); |
@@ -1748,8 +1747,7 @@ restart: | |||
1748 | err = xfrm_dst_update_origin(dst, fl); | 1747 | err = xfrm_dst_update_origin(dst, fl); |
1749 | if (unlikely(err)) { | 1748 | if (unlikely(err)) { |
1750 | write_unlock_bh(&policy->lock); | 1749 | write_unlock_bh(&policy->lock); |
1751 | if (dst) | 1750 | dst_free(dst); |
1752 | dst_free(dst); | ||
1753 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTBUNDLECHECKERROR); | 1751 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTBUNDLECHECKERROR); |
1754 | goto error; | 1752 | goto error; |
1755 | } | 1753 | } |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 4c6914ef7d92..7bd62f61593f 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -780,11 +780,13 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
780 | { | 780 | { |
781 | unsigned int h; | 781 | unsigned int h; |
782 | struct hlist_node *entry; | 782 | struct hlist_node *entry; |
783 | struct xfrm_state *x, *x0; | 783 | struct xfrm_state *x, *x0, *to_put; |
784 | int acquire_in_progress = 0; | 784 | int acquire_in_progress = 0; |
785 | int error = 0; | 785 | int error = 0; |
786 | struct xfrm_state *best = NULL; | 786 | struct xfrm_state *best = NULL; |
787 | 787 | ||
788 | to_put = NULL; | ||
789 | |||
788 | spin_lock_bh(&xfrm_state_lock); | 790 | spin_lock_bh(&xfrm_state_lock); |
789 | h = xfrm_dst_hash(daddr, saddr, tmpl->reqid, family); | 791 | h = xfrm_dst_hash(daddr, saddr, tmpl->reqid, family); |
790 | hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) { | 792 | hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) { |
@@ -833,7 +835,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
833 | if (tmpl->id.spi && | 835 | if (tmpl->id.spi && |
834 | (x0 = __xfrm_state_lookup(daddr, tmpl->id.spi, | 836 | (x0 = __xfrm_state_lookup(daddr, tmpl->id.spi, |
835 | tmpl->id.proto, family)) != NULL) { | 837 | tmpl->id.proto, family)) != NULL) { |
836 | xfrm_state_put(x0); | 838 | to_put = x0; |
837 | error = -EEXIST; | 839 | error = -EEXIST; |
838 | goto out; | 840 | goto out; |
839 | } | 841 | } |
@@ -849,7 +851,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
849 | error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid); | 851 | error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid); |
850 | if (error) { | 852 | if (error) { |
851 | x->km.state = XFRM_STATE_DEAD; | 853 | x->km.state = XFRM_STATE_DEAD; |
852 | xfrm_state_put(x); | 854 | to_put = x; |
853 | x = NULL; | 855 | x = NULL; |
854 | goto out; | 856 | goto out; |
855 | } | 857 | } |
@@ -870,7 +872,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
870 | xfrm_hash_grow_check(x->bydst.next != NULL); | 872 | xfrm_hash_grow_check(x->bydst.next != NULL); |
871 | } else { | 873 | } else { |
872 | x->km.state = XFRM_STATE_DEAD; | 874 | x->km.state = XFRM_STATE_DEAD; |
873 | xfrm_state_put(x); | 875 | to_put = x; |
874 | x = NULL; | 876 | x = NULL; |
875 | error = -ESRCH; | 877 | error = -ESRCH; |
876 | } | 878 | } |
@@ -881,6 +883,8 @@ out: | |||
881 | else | 883 | else |
882 | *err = acquire_in_progress ? -EAGAIN : error; | 884 | *err = acquire_in_progress ? -EAGAIN : error; |
883 | spin_unlock_bh(&xfrm_state_lock); | 885 | spin_unlock_bh(&xfrm_state_lock); |
886 | if (to_put) | ||
887 | xfrm_state_put(to_put); | ||
884 | return x; | 888 | return x; |
885 | } | 889 | } |
886 | 890 | ||
@@ -1067,18 +1071,20 @@ static struct xfrm_state *__xfrm_find_acq_byseq(u32 seq); | |||
1067 | 1071 | ||
1068 | int xfrm_state_add(struct xfrm_state *x) | 1072 | int xfrm_state_add(struct xfrm_state *x) |
1069 | { | 1073 | { |
1070 | struct xfrm_state *x1; | 1074 | struct xfrm_state *x1, *to_put; |
1071 | int family; | 1075 | int family; |
1072 | int err; | 1076 | int err; |
1073 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); | 1077 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); |
1074 | 1078 | ||
1075 | family = x->props.family; | 1079 | family = x->props.family; |
1076 | 1080 | ||
1081 | to_put = NULL; | ||
1082 | |||
1077 | spin_lock_bh(&xfrm_state_lock); | 1083 | spin_lock_bh(&xfrm_state_lock); |
1078 | 1084 | ||
1079 | x1 = __xfrm_state_locate(x, use_spi, family); | 1085 | x1 = __xfrm_state_locate(x, use_spi, family); |
1080 | if (x1) { | 1086 | if (x1) { |
1081 | xfrm_state_put(x1); | 1087 | to_put = x1; |
1082 | x1 = NULL; | 1088 | x1 = NULL; |
1083 | err = -EEXIST; | 1089 | err = -EEXIST; |
1084 | goto out; | 1090 | goto out; |
@@ -1088,7 +1094,7 @@ int xfrm_state_add(struct xfrm_state *x) | |||
1088 | x1 = __xfrm_find_acq_byseq(x->km.seq); | 1094 | x1 = __xfrm_find_acq_byseq(x->km.seq); |
1089 | if (x1 && ((x1->id.proto != x->id.proto) || | 1095 | if (x1 && ((x1->id.proto != x->id.proto) || |
1090 | xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) { | 1096 | xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) { |
1091 | xfrm_state_put(x1); | 1097 | to_put = x1; |
1092 | x1 = NULL; | 1098 | x1 = NULL; |
1093 | } | 1099 | } |
1094 | } | 1100 | } |
@@ -1110,6 +1116,9 @@ out: | |||
1110 | xfrm_state_put(x1); | 1116 | xfrm_state_put(x1); |
1111 | } | 1117 | } |
1112 | 1118 | ||
1119 | if (to_put) | ||
1120 | xfrm_state_put(to_put); | ||
1121 | |||
1113 | return err; | 1122 | return err; |
1114 | } | 1123 | } |
1115 | EXPORT_SYMBOL(xfrm_state_add); | 1124 | EXPORT_SYMBOL(xfrm_state_add); |
@@ -1269,10 +1278,12 @@ EXPORT_SYMBOL(xfrm_state_migrate); | |||
1269 | 1278 | ||
1270 | int xfrm_state_update(struct xfrm_state *x) | 1279 | int xfrm_state_update(struct xfrm_state *x) |
1271 | { | 1280 | { |
1272 | struct xfrm_state *x1; | 1281 | struct xfrm_state *x1, *to_put; |
1273 | int err; | 1282 | int err; |
1274 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); | 1283 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); |
1275 | 1284 | ||
1285 | to_put = NULL; | ||
1286 | |||
1276 | spin_lock_bh(&xfrm_state_lock); | 1287 | spin_lock_bh(&xfrm_state_lock); |
1277 | x1 = __xfrm_state_locate(x, use_spi, x->props.family); | 1288 | x1 = __xfrm_state_locate(x, use_spi, x->props.family); |
1278 | 1289 | ||
@@ -1281,7 +1292,7 @@ int xfrm_state_update(struct xfrm_state *x) | |||
1281 | goto out; | 1292 | goto out; |
1282 | 1293 | ||
1283 | if (xfrm_state_kern(x1)) { | 1294 | if (xfrm_state_kern(x1)) { |
1284 | xfrm_state_put(x1); | 1295 | to_put = x1; |
1285 | err = -EEXIST; | 1296 | err = -EEXIST; |
1286 | goto out; | 1297 | goto out; |
1287 | } | 1298 | } |
@@ -1295,6 +1306,9 @@ int xfrm_state_update(struct xfrm_state *x) | |||
1295 | out: | 1306 | out: |
1296 | spin_unlock_bh(&xfrm_state_lock); | 1307 | spin_unlock_bh(&xfrm_state_lock); |
1297 | 1308 | ||
1309 | if (to_put) | ||
1310 | xfrm_state_put(to_put); | ||
1311 | |||
1298 | if (err) | 1312 | if (err) |
1299 | return err; | 1313 | return err; |
1300 | 1314 | ||