From: Greg Kroah-Hartman Date: Mon, 29 Jun 2009 23:48:35 +0000 (-0700) Subject: .30 patches X-Git-Tag: v2.6.27.26~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e904250e88f0bf674823952e13619378976b923f;p=thirdparty%2Fkernel%2Fstable-queue.git .30 patches --- diff --git a/queue-2.6.30/asoc-remove-odd-bit-clock-ratios-for-wm8903.patch b/queue-2.6.30/asoc-remove-odd-bit-clock-ratios-for-wm8903.patch new file mode 100644 index 00000000000..74d933def6b --- /dev/null +++ b/queue-2.6.30/asoc-remove-odd-bit-clock-ratios-for-wm8903.patch @@ -0,0 +1,44 @@ +From ba2533a47865ec0dbc72834287a8a048e9337a95 Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Fri, 12 Jun 2009 16:55:56 +0100 +Subject: ASoC: Remove odd bit clock ratios for WM8903 + +From: Mark Brown + +commit ba2533a47865ec0dbc72834287a8a048e9337a95 upstream. + +These are not supported since performance can not be guaranteed +when they are in use. + +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/wm8903.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/sound/soc/codecs/wm8903.c ++++ b/sound/soc/codecs/wm8903.c +@@ -1215,22 +1215,18 @@ static struct { + int div; + } bclk_divs[] = { + { 10, 0 }, +- { 15, 1 }, + { 20, 2 }, + { 30, 3 }, + { 40, 4 }, + { 50, 5 }, +- { 55, 6 }, + { 60, 7 }, + { 80, 8 }, + { 100, 9 }, +- { 110, 10 }, + { 120, 11 }, + { 160, 12 }, + { 200, 13 }, + { 220, 14 }, + { 240, 15 }, +- { 250, 16 }, + { 300, 17 }, + { 320, 18 }, + { 440, 19 }, diff --git a/queue-2.6.30/ath9k-fix-bug-in-calibration-initialization.patch b/queue-2.6.30/ath9k-fix-bug-in-calibration-initialization.patch new file mode 100644 index 00000000000..1434793792d --- /dev/null +++ b/queue-2.6.30/ath9k-fix-bug-in-calibration-initialization.patch @@ -0,0 +1,129 @@ +From 04d19ddd254b404703151ab25aa5041e50ff40f7 Mon Sep 17 00:00:00 2001 +From: Sujith +Date: Mon, 13 Apr 2009 21:56:59 +0530 +Subject: ath9k: Fix bug in calibration initialization + +From: Sujith + +commit 04d19ddd254b404703151ab25aa5041e50ff40f7 upstream. + +This patch fixes a bug in ath9k_hw_init_cal() where the wrong +calibration was being done for non-AR9285 chipsets. +Also add a few helpful comments. + +Signed-off-by: Sujith +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/calib.c | 61 +++++++++++++------------------------ + 1 file changed, 22 insertions(+), 39 deletions(-) + +--- a/drivers/net/wireless/ath9k/calib.c ++++ b/drivers/net/wireless/ath9k/calib.c +@@ -919,83 +919,66 @@ static bool ar9285_clc(struct ath_hw *ah + return true; + } + +-bool ath9k_hw_init_cal(struct ath_hw *ah, +- struct ath9k_channel *chan) ++bool ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan) + { + if (AR_SREV_9285(ah) && AR_SREV_9285_12_OR_LATER(ah)) { + if (!ar9285_clc(ah, chan)) + return false; +- } else if (AR_SREV_9280_10_OR_LATER(ah)) { +- REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); +- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); +- REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); ++ } else { ++ if (AR_SREV_9280_10_OR_LATER(ah)) { ++ REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); ++ } + +- /* Kick off the cal */ ++ /* Calibrate the AGC */ + REG_WRITE(ah, AR_PHY_AGC_CONTROL, +- REG_READ(ah, AR_PHY_AGC_CONTROL) | +- AR_PHY_AGC_CONTROL_CAL); ++ REG_READ(ah, AR_PHY_AGC_CONTROL) | ++ AR_PHY_AGC_CONTROL_CAL); + +- if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, +- AR_PHY_AGC_CONTROL_CAL, 0, +- AH_WAIT_TIMEOUT)) { ++ /* Poll for offset calibration complete */ ++ if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL, ++ 0, AH_WAIT_TIMEOUT)) { + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, + "offset calibration failed to complete in 1ms; " + "noisy environment?\n"); + return false; + } + +- REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); +- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); +- REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); +- } +- +- /* Calibrate the AGC */ +- REG_WRITE(ah, AR_PHY_AGC_CONTROL, +- REG_READ(ah, AR_PHY_AGC_CONTROL) | +- AR_PHY_AGC_CONTROL_CAL); +- +- if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL, +- 0, AH_WAIT_TIMEOUT)) { +- DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, +- "offset calibration failed to complete in 1ms; " +- "noisy environment?\n"); +- return false; +- } +- +- if (AR_SREV_9280_10_OR_LATER(ah)) { +- REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); +- REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); ++ if (AR_SREV_9280_10_OR_LATER(ah)) { ++ REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); ++ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); ++ } + } + + /* Do PA Calibration */ + if (AR_SREV_9285(ah) && AR_SREV_9285_11_OR_LATER(ah)) + ath9k_hw_9285_pa_cal(ah); + +- /* Do NF Calibration */ ++ /* Do NF Calibration after DC offset and other calibrations */ + REG_WRITE(ah, AR_PHY_AGC_CONTROL, +- REG_READ(ah, AR_PHY_AGC_CONTROL) | +- AR_PHY_AGC_CONTROL_NF); ++ REG_READ(ah, AR_PHY_AGC_CONTROL) | AR_PHY_AGC_CONTROL_NF); + + ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; + ++ /* Enable IQ, ADC Gain and ADC DC offset CALs */ + if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) { + if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) { + INIT_CAL(&ah->adcgain_caldata); + INSERT_CAL(ah, &ah->adcgain_caldata); + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, +- "enabling ADC Gain Calibration.\n"); ++ "enabling ADC Gain Calibration.\n"); + } + if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) { + INIT_CAL(&ah->adcdc_caldata); + INSERT_CAL(ah, &ah->adcdc_caldata); + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, +- "enabling ADC DC Calibration.\n"); ++ "enabling ADC DC Calibration.\n"); + } + if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) { + INIT_CAL(&ah->iq_caldata); + INSERT_CAL(ah, &ah->iq_caldata); + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE, +- "enabling IQ Calibration.\n"); ++ "enabling IQ Calibration.\n"); + } + + ah->cal_list_curr = ah->cal_list; diff --git a/queue-2.6.30/ath9k-fix-bug-in-checking-ht-flag.patch b/queue-2.6.30/ath9k-fix-bug-in-checking-ht-flag.patch new file mode 100644 index 00000000000..6422b0c5118 --- /dev/null +++ b/queue-2.6.30/ath9k-fix-bug-in-checking-ht-flag.patch @@ -0,0 +1,31 @@ +From db2f63f60a087ed29ae04310c1076c61f77a5d20 Mon Sep 17 00:00:00 2001 +From: Sujith +Date: Mon, 13 Apr 2009 21:56:41 +0530 +Subject: ath9k: Fix bug in checking HT flag + +From: Sujith + +commit db2f63f60a087ed29ae04310c1076c61f77a5d20 upstream. + +The operating HT mode is stored in chanmode and +not channelFlags. + +Signed-off-by: Sujith +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/calib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath9k/calib.c ++++ b/drivers/net/wireless/ath9k/calib.c +@@ -883,7 +883,7 @@ bool ath9k_hw_calibrate(struct ath_hw *a + static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan) + { + REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); +- if (chan->channelFlags & CHANNEL_HT20) { ++ if (IS_CHAN_HT20(chan)) { + REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_PARALLEL_CAL_ENABLE); + REG_SET_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN); + REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, diff --git a/queue-2.6.30/ath9k-fix-bug-in-determining-calibration-support.patch b/queue-2.6.30/ath9k-fix-bug-in-determining-calibration-support.patch new file mode 100644 index 00000000000..cbafa437cc4 --- /dev/null +++ b/queue-2.6.30/ath9k-fix-bug-in-determining-calibration-support.patch @@ -0,0 +1,33 @@ +From a451aa66dcb14efcb7addf1d8edcac8df76a97b6 Mon Sep 17 00:00:00 2001 +From: Sujith +Date: Mon, 13 Apr 2009 21:56:43 +0530 +Subject: ath9k: Fix bug in determining calibration support + +From: Sujith + +commit a451aa66dcb14efcb7addf1d8edcac8df76a97b6 upstream. + +ADC gain calibration has to be done for all non 2GHZ-HT20 channels. +Regression from "ath9k: use ieee80211_conf on ath9k_hw_iscal_supported()" + +Signed-off-by: Sujith +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/calib.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath9k/calib.c ++++ b/drivers/net/wireless/ath9k/calib.c +@@ -284,8 +284,8 @@ static bool ath9k_hw_iscal_supported(str + return true; + case ADC_GAIN_CAL: + case ADC_DC_CAL: +- if (conf->channel->band == IEEE80211_BAND_5GHZ && +- conf_is_ht20(conf)) ++ if (!(conf->channel->band == IEEE80211_BAND_2GHZ && ++ conf_is_ht20(conf))) + return true; + break; + } diff --git a/queue-2.6.30/ath9k-fix-bug-in-scan-termination.patch b/queue-2.6.30/ath9k-fix-bug-in-scan-termination.patch new file mode 100644 index 00000000000..d8bd563822d --- /dev/null +++ b/queue-2.6.30/ath9k-fix-bug-in-scan-termination.patch @@ -0,0 +1,31 @@ +From 9c07a7777f44c7e39accec5ad8c4293d6a9b2a47 Mon Sep 17 00:00:00 2001 +From: Sujith +Date: Mon, 13 Apr 2009 21:56:36 +0530 +Subject: ath9k: Fix bug in scan termination + +From: Sujith + +commit 9c07a7777f44c7e39accec5ad8c4293d6a9b2a47 upstream. + +A full HW reset needs to be done on termination of a scan run. +Not setting SC_OP_FULL_RESET resulted in doing a +fast channel change. + +Signed-off-by: Sujith +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/main.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/ath9k/main.c ++++ b/drivers/net/wireless/ath9k/main.c +@@ -2772,6 +2772,7 @@ static void ath9k_sw_scan_complete(struc + mutex_lock(&sc->mutex); + aphy->state = ATH_WIPHY_ACTIVE; + sc->sc_flags &= ~SC_OP_SCANNING; ++ sc->sc_flags |= SC_OP_FULL_RESET; + mutex_unlock(&sc->mutex); + } + diff --git a/queue-2.6.30/ath9k-fix-bug-when-using-a-card-with-a-busted-eeprom.patch b/queue-2.6.30/ath9k-fix-bug-when-using-a-card-with-a-busted-eeprom.patch new file mode 100644 index 00000000000..ddda35799e6 --- /dev/null +++ b/queue-2.6.30/ath9k-fix-bug-when-using-a-card-with-a-busted-eeprom.patch @@ -0,0 +1,60 @@ +From 85efc86eb7c6cbb1c8ce8d99b10b948be033fbb9 Mon Sep 17 00:00:00 2001 +From: Luis R. Rodriguez +Date: Mon, 13 Apr 2009 21:41:46 -0400 +Subject: ath9k: Fix bug when using a card with a busted EEPROM + +From: Luis R. Rodriguez + +backport of commit 85efc86eb7c6cbb1c8ce8d99b10b948be033fbb9 upstream. + +We fail if your EEPROM is busted but we were never propagated the +error back so such users could end up with a cryptic oops message +like: + +IP: [] ath9k_reg_apply_world_flags+0x29/0x130 [ath9k] +*pde = 00000000 +Oops: 0000 [#1] SMP +Modules linked in: ath9k(+) mac80211 cfg80211 +Pid: 4284, comm: insmod Not tainted (2.6.29-wl #3) 7660A14 +EIP: 0060:[] EFLAGS: 00010286 CPU: 1 +EIP is at ath9k_reg_apply_world_flags+0x29/0x130 [ath9k] + +Fix this by propagating the error and also lets not leave the +user in the dark and communicate what's going on. When this +happens you will now see this: + +ath9k 0000:16:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16 +ath9k: Invalid EEPROM contents + +Signed-off-by: Luis R. Rodriguez +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/main.c | 3 ++- + drivers/net/wireless/ath9k/regd.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath9k/main.c ++++ b/drivers/net/wireless/ath9k/main.c +@@ -1416,7 +1416,8 @@ static int ath_init(u16 devid, struct at + for (i = 0; i < sc->keymax; i++) + ath9k_hw_keyreset(ah, (u16) i); + +- if (ath9k_regd_init(sc->sc_ah)) ++ error = ath9k_regd_init(sc->sc_ah); ++ if (error) + goto bad; + + /* default to MONITOR mode */ +--- a/drivers/net/wireless/ath9k/regd.c ++++ b/drivers/net/wireless/ath9k/regd.c +@@ -439,7 +439,7 @@ int ath9k_regd_init(struct ath_hw *ah) + u16 regdmn; + + if (!ath9k_regd_is_eeprom_valid(ah)) { +- DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, ++ DPRINTF(ah->ah_sc, ATH_DBG_FATAL, + "Invalid EEPROM contents\n"); + return -EINVAL; + } diff --git a/queue-2.6.30/ath9k-fix-memleak-on-tx-dma-failure.patch b/queue-2.6.30/ath9k-fix-memleak-on-tx-dma-failure.patch new file mode 100644 index 00000000000..3397911f198 --- /dev/null +++ b/queue-2.6.30/ath9k-fix-memleak-on-tx-dma-failure.patch @@ -0,0 +1,34 @@ +From 675902ef822c114c0dac17ed10eed43eb8f5c9ec Mon Sep 17 00:00:00 2001 +From: Sujith +Date: Mon, 13 Apr 2009 21:56:34 +0530 +Subject: ath9k: Fix memleak on TX DMA failure + +From: Sujith + +commit 675902ef822c114c0dac17ed10eed43eb8f5c9ec upstream. + +The driver-specific region has to be freed in case +of a DMA mapping failure. + +Signed-off-by: Sujith +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/xmit.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath9k/xmit.c ++++ b/drivers/net/wireless/ath9k/xmit.c +@@ -1573,8 +1573,9 @@ static int ath_tx_setup_buffer(struct ie + skb->len, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(sc->dev, bf->bf_dmacontext))) { + bf->bf_mpdu = NULL; +- DPRINTF(sc, ATH_DBG_CONFIG, +- "dma_mapping_error() on TX\n"); ++ kfree(tx_info_priv); ++ tx_info->rate_driver_data[0] = NULL; ++ DPRINTF(sc, ATH_DBG_FATAL, "dma_mapping_error() on TX\n"); + return -ENOMEM; + } + diff --git a/queue-2.6.30/ath9k-fix-pci-fatal-interrupts-by-restoring-retry_timeout-disabling.patch b/queue-2.6.30/ath9k-fix-pci-fatal-interrupts-by-restoring-retry_timeout-disabling.patch new file mode 100644 index 00000000000..33f5c10a05d --- /dev/null +++ b/queue-2.6.30/ath9k-fix-pci-fatal-interrupts-by-restoring-retry_timeout-disabling.patch @@ -0,0 +1,82 @@ +From f0214843ba23d9bf6dc6b8ad2c6ee27b60f0322e Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 16 Jun 2009 11:59:23 +0300 +Subject: ath9k: Fix PCI FATAL interrupts by restoring RETRY_TIMEOUT disabling + +From: Jouni Malinen + +commit f0214843ba23d9bf6dc6b8ad2c6ee27b60f0322e upstream. + +An earlier commit, 'ath9k: remove dummy PCI "retry timeout" fix', removed +code that was documented to disable RETRY_TIMEOUT register (PCI reg +0x41) since it was claimed to be a no-op. However, it turns out that +there are some combinations of hosts and ath9k-supported cards for +which this is not a no-op (reg 0x41 has value 0x80, not 0) and this +code (or something similar) is needed. In such cases, the driver may +be next to unusable due to very frequent PCI FATAL interrupts from the +card. + +Reverting the earlier commit, i.e., restoring the RETRY_TIMEOUT +disabling, seems to resolve the issue. Since the removal of this code +was not based on any known issue and was purely a cleanup change, the +safest option here is to just revert that commit. Should there be +desire to clean this up in the future, the change will need to be +tested with a more complete coverage of cards and host systems. + +http://bugzilla.kernel.org/show_bug.cgi?id=13483 + +Signed-off-by: Jouni Malinen +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/pci.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/drivers/net/wireless/ath9k/pci.c ++++ b/drivers/net/wireless/ath9k/pci.c +@@ -87,6 +87,7 @@ static int ath_pci_probe(struct pci_dev + struct ath_softc *sc; + struct ieee80211_hw *hw; + u8 csz; ++ u32 val; + int ret = 0; + struct ath_hw *ah; + +@@ -133,6 +134,14 @@ static int ath_pci_probe(struct pci_dev + + pci_set_master(pdev); + ++ /* ++ * Disable the RETRY_TIMEOUT register (0x41) to keep ++ * PCI Tx retries from interfering with C3 CPU state. ++ */ ++ pci_read_config_dword(pdev, 0x40, &val); ++ if ((val & 0x0000ff00) != 0) ++ pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); ++ + ret = pci_request_region(pdev, 0, "ath9k"); + if (ret) { + dev_err(&pdev->dev, "PCI memory region reserve error\n"); +@@ -244,12 +253,21 @@ static int ath_pci_resume(struct pci_dev + struct ieee80211_hw *hw = pci_get_drvdata(pdev); + struct ath_wiphy *aphy = hw->priv; + struct ath_softc *sc = aphy->sc; ++ u32 val; + int err; + + err = pci_enable_device(pdev); + if (err) + return err; + pci_restore_state(pdev); ++ /* ++ * Suspend/Resume resets the PCI configuration space, so we have to ++ * re-disable the RETRY_TIMEOUT register (0x41) to keep ++ * PCI Tx retries from interfering with C3 CPU state ++ */ ++ pci_read_config_dword(pdev, 0x40, &val); ++ if ((val & 0x0000ff00) != 0) ++ pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); + + /* Enable LED */ + ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN, diff --git a/queue-2.6.30/ath9k-initialize-ani-timers.patch b/queue-2.6.30/ath9k-initialize-ani-timers.patch new file mode 100644 index 00000000000..c5d6be12764 --- /dev/null +++ b/queue-2.6.30/ath9k-initialize-ani-timers.patch @@ -0,0 +1,67 @@ +From 415f738ecf41b427921b503ecfd427e26f89dc23 Mon Sep 17 00:00:00 2001 +From: Sujith +Date: Mon, 13 Apr 2009 21:56:46 +0530 +Subject: ath9k: Initialize ANI timers + +From: Sujith + +commit 415f738ecf41b427921b503ecfd427e26f89dc23 upstream. + +The various ANI timers have to be initialized properly when +starting the calibration timer. + +Signed-off-by: Sujith +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath9k/main.c | 24 +++++++++++++++--------- + 1 file changed, 15 insertions(+), 9 deletions(-) + +--- a/drivers/net/wireless/ath9k/main.c ++++ b/drivers/net/wireless/ath9k/main.c +@@ -408,6 +408,18 @@ set_timer: + mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); + } + ++static void ath_start_ani(struct ath_softc *sc) ++{ ++ unsigned long timestamp = jiffies_to_msecs(jiffies); ++ ++ sc->ani.longcal_timer = timestamp; ++ sc->ani.shortcal_timer = timestamp; ++ sc->ani.checkani_timer = timestamp; ++ ++ mod_timer(&sc->ani.timer, ++ jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); ++} ++ + /* + * Update tx/rx chainmask. For legacy association, + * hard code chainmask to 1x1, for 11n association, use +@@ -920,9 +932,7 @@ static void ath9k_bss_assoc_info(struct + sc->nodestats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER; + sc->nodestats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER; + +- /* Start ANI */ +- mod_timer(&sc->ani.timer, +- jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); ++ ath_start_ani(sc); + } else { + DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n"); + sc->curaid = 0; +@@ -2271,12 +2281,8 @@ static int ath9k_add_interface(struct ie + + ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); + +- if (conf->type == NL80211_IFTYPE_AP) { +- /* TODO: is this a suitable place to start ANI for AP mode? */ +- /* Start ANI */ +- mod_timer(&sc->ani.timer, +- jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); +- } ++ if (conf->type == NL80211_IFTYPE_AP) ++ ath_start_ani(sc); + + out: + mutex_unlock(&sc->mutex); diff --git a/queue-2.6.30/cfg80211-cleanup-return-calls-on-nl80211_set_reg.patch b/queue-2.6.30/cfg80211-cleanup-return-calls-on-nl80211_set_reg.patch new file mode 100644 index 00000000000..c5106b4eac7 --- /dev/null +++ b/queue-2.6.30/cfg80211-cleanup-return-calls-on-nl80211_set_reg.patch @@ -0,0 +1,72 @@ +From d0e18f833d23afefb6751a21d14a2cd71d2d4d66 Mon Sep 17 00:00:00 2001 +From: Luis R. Rodriguez +Date: Wed, 13 May 2009 17:04:40 -0400 +Subject: cfg80211: cleanup return calls on nl80211_set_reg() + +From: Luis R. Rodriguez + +commit d0e18f833d23afefb6751a21d14a2cd71d2d4d66 upstream. + +This has no functional change, but it will make the race +fix easier to spot in my next patch. + +Signed-off-by: Luis R. Rodriguez +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + net/wireless/nl80211.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -2388,15 +2388,19 @@ static int nl80211_set_reg(struct sk_buf + goto bad_reg; + } + +- if (!reg_is_valid_request(alpha2)) +- return -EINVAL; ++ if (!reg_is_valid_request(alpha2)) { ++ r = -EINVAL; ++ goto bad_reg; ++ } + + size_of_regd = sizeof(struct ieee80211_regdomain) + + (num_rules * sizeof(struct ieee80211_reg_rule)); + + rd = kzalloc(size_of_regd, GFP_KERNEL); +- if (!rd) +- return -ENOMEM; ++ if (!rd) { ++ r = -ENOMEM; ++ goto bad_reg; ++ } + + rd->n_reg_rules = num_rules; + rd->alpha2[0] = alpha2[0]; +@@ -2413,8 +2417,10 @@ static int nl80211_set_reg(struct sk_buf + + rule_idx++; + +- if (rule_idx > NL80211_MAX_SUPP_REG_RULES) ++ if (rule_idx > NL80211_MAX_SUPP_REG_RULES) { ++ r = -EINVAL; + goto bad_reg; ++ } + } + + BUG_ON(rule_idx != num_rules); +@@ -2422,11 +2428,12 @@ static int nl80211_set_reg(struct sk_buf + mutex_lock(&cfg80211_mutex); + r = set_regdom(rd); + mutex_unlock(&cfg80211_mutex); ++ + return r; + + bad_reg: + kfree(rd); +- return -EINVAL; ++ return r; + } + + static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) diff --git a/queue-2.6.30/cfg80211-fix-for-duplicate-userspace-replies.patch b/queue-2.6.30/cfg80211-fix-for-duplicate-userspace-replies.patch new file mode 100644 index 00000000000..68f4aa3c913 --- /dev/null +++ b/queue-2.6.30/cfg80211-fix-for-duplicate-userspace-replies.patch @@ -0,0 +1,50 @@ +From 729e9c7663190d71fe5e29831634df80f38199c1 Mon Sep 17 00:00:00 2001 +From: Luis R. Rodriguez +Date: Sun, 31 May 2009 18:24:34 -0400 +Subject: cfg80211: fix for duplicate userspace replies + +From: Luis R. Rodriguez + +commit 729e9c7663190d71fe5e29831634df80f38199c1 upstream. + +This fixes an incorrect assumption (BUG_ON) made in +cfg80211 when handling country IE regulatory requests. +The assumption was that we won't try to call_crda() +twice for the same event and therefore we will not +recieve two replies through nl80211 for the regulatory +request. As it turns out it is true we don't call_crda() +twice for the same event, however, kobject_uevent_env() +*might* send the udev event twice and/or userspace can +simply process the udev event twice. We remove the BUG_ON() +and simply ignore the duplicate request. + +For details refer to this thread: + +http://marc.info/?l=linux-wireless&m=124149987921337&w=2 + +Reported-by: Maxim Levitsky +Signed-off-by: Luis R. Rodriguez +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + net/wireless/reg.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -2042,7 +2042,13 @@ static int __set_regdom(const struct iee + * the country IE rd with what CRDA believes that country should have + */ + +- BUG_ON(!country_ie_regdomain); ++ /* ++ * Userspace could have sent two replies with only ++ * one kernel request. By the second reply we would have ++ * already processed and consumed the country_ie_regdomain. ++ */ ++ if (!country_ie_regdomain) ++ return -EALREADY; + BUG_ON(rd == country_ie_regdomain); + + /* diff --git a/queue-2.6.30/cfg80211-fix-in-nl80211_set_reg.patch b/queue-2.6.30/cfg80211-fix-in-nl80211_set_reg.patch new file mode 100644 index 00000000000..b4f7eb007a2 --- /dev/null +++ b/queue-2.6.30/cfg80211-fix-in-nl80211_set_reg.patch @@ -0,0 +1,63 @@ +From 61405e97788b1bc4e7c5be5b4ec04a73fc11bac2 Mon Sep 17 00:00:00 2001 +From: Luis R. Rodriguez +Date: Wed, 13 May 2009 17:04:41 -0400 +Subject: cfg80211: fix in nl80211_set_reg() + +From: Luis R. Rodriguez + +commit 61405e97788b1bc4e7c5be5b4ec04a73fc11bac2 upstream. + +There is a race on access to last_request and its alpha2 +through reg_is_valid_request() and us possibly processing +first another regulatory request on another CPU. We avoid +this improbably race by locking with the cfg80211_mutex as +we should have done in the first place. While at it add +the assert on locking on reg_is_valid_request(). + +Signed-off-by: Luis R. Rodriguez +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + net/wireless/nl80211.c | 5 ++++- + net/wireless/reg.c | 2 ++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -2388,6 +2388,8 @@ static int nl80211_set_reg(struct sk_buf + return -EINVAL; + } + ++ mutex_lock(&cfg80211_mutex); ++ + if (!reg_is_valid_request(alpha2)) { + r = -EINVAL; + goto bad_reg; +@@ -2425,13 +2427,14 @@ static int nl80211_set_reg(struct sk_buf + + BUG_ON(rule_idx != num_rules); + +- mutex_lock(&cfg80211_mutex); + r = set_regdom(rd); ++ + mutex_unlock(&cfg80211_mutex); + + return r; + + bad_reg: ++ mutex_unlock(&cfg80211_mutex); + kfree(rd); + return r; + } +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -389,6 +389,8 @@ static int call_crda(const char *alpha2) + /* Used by nl80211 before kmalloc'ing our regulatory domain */ + bool reg_is_valid_request(const char *alpha2) + { ++ assert_cfg80211_lock(); ++ + if (!last_request) + return false; + diff --git a/queue-2.6.30/cfg80211-return-immediately-if-num-reg-rules-nl80211_max_supp_reg_rules.patch b/queue-2.6.30/cfg80211-return-immediately-if-num-reg-rules-nl80211_max_supp_reg_rules.patch new file mode 100644 index 00000000000..b9621066ab8 --- /dev/null +++ b/queue-2.6.30/cfg80211-return-immediately-if-num-reg-rules-nl80211_max_supp_reg_rules.patch @@ -0,0 +1,32 @@ +From 4776c6e7f66f853011bc1fd6fe37fa63f0b6982c Mon Sep 17 00:00:00 2001 +From: Luis R. Rodriguez +Date: Wed, 13 May 2009 17:04:39 -0400 +Subject: cfg80211: return immediately if num reg rules > NL80211_MAX_SUPP_REG_RULES + +From: Luis R. Rodriguez + +commit 4776c6e7f66f853011bc1fd6fe37fa63f0b6982c upstream. + +This has no functional change except we save a kfree(rd) and +allows us to clean this code up a bit after this. We do +avoid an unnecessary kfree(NULL) but calling that was OK too. + +Signed-off-by: Luis R. Rodriguez +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + net/wireless/nl80211.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -2385,7 +2385,7 @@ static int nl80211_set_reg(struct sk_buf + rem_reg_rules) { + num_rules++; + if (num_rules > NL80211_MAX_SUPP_REG_RULES) +- goto bad_reg; ++ return -EINVAL; + } + + if (!reg_is_valid_request(alpha2)) { diff --git a/queue-2.6.30/crypto-aes-ni-fix-cbc-mode-iv-saving.patch b/queue-2.6.30/crypto-aes-ni-fix-cbc-mode-iv-saving.patch new file mode 100644 index 00000000000..bfeb831b9cf --- /dev/null +++ b/queue-2.6.30/crypto-aes-ni-fix-cbc-mode-iv-saving.patch @@ -0,0 +1,40 @@ +From e6efaa025384f86a18814a6b9f4e5d54484ab9ff Mon Sep 17 00:00:00 2001 +From: Huang Ying +Date: Thu, 18 Jun 2009 19:33:57 +0800 +Subject: crypto: aes-ni - Fix cbc mode IV saving + +From: Huang Ying + +commit e6efaa025384f86a18814a6b9f4e5d54484ab9ff upstream. + +Original implementation of aesni_cbc_dec do not save IV if input +length % 4 == 0. This will make decryption of next block failed. + +Signed-off-by: Huang Ying +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/crypto/aesni-intel_asm.S | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/arch/x86/crypto/aesni-intel_asm.S ++++ b/arch/x86/crypto/aesni-intel_asm.S +@@ -845,7 +845,7 @@ ENTRY(aesni_cbc_enc) + */ + ENTRY(aesni_cbc_dec) + cmp $16, LEN +- jb .Lcbc_dec_ret ++ jb .Lcbc_dec_just_ret + mov 480(KEYP), KLEN + add $240, KEYP + movups (IVP), IV +@@ -891,6 +891,7 @@ ENTRY(aesni_cbc_dec) + add $16, OUTP + cmp $16, LEN + jge .Lcbc_dec_loop1 +- movups IV, (IVP) + .Lcbc_dec_ret: ++ movups IV, (IVP) ++.Lcbc_dec_just_ret: + ret diff --git a/queue-2.6.30/lockdep-select-frame-pointers-on-x86.patch b/queue-2.6.30/lockdep-select-frame-pointers-on-x86.patch new file mode 100644 index 00000000000..afd997d5cda --- /dev/null +++ b/queue-2.6.30/lockdep-select-frame-pointers-on-x86.patch @@ -0,0 +1,34 @@ +From 00540e5d54be972a94a3b2ce6da8621bebe731a2 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Fri, 12 Jun 2009 10:04:01 +0200 +Subject: lockdep: Select frame pointers on x86 + +From: Peter Zijlstra + +commit 00540e5d54be972a94a3b2ce6da8621bebe731a2 upstream. + +x86 stack traces are a piece of crap without frame pointers, and its not +like the 'performance gain' of not having stack pointers matters when you +selected lockdep. + +Reported-by: Andrew Morton +LKML-Reference: +Signed-off-by: Peter Zijlstra +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + lib/Kconfig.debug | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/lib/Kconfig.debug ++++ b/lib/Kconfig.debug +@@ -440,7 +440,7 @@ config LOCKDEP + bool + depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT + select STACKTRACE +- select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND && !S390 ++ select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 + select KALLSYMS + select KALLSYMS_ALL + diff --git a/queue-2.6.30/mac80211-fix-minstrel-single-rate-memory-corruption.patch b/queue-2.6.30/mac80211-fix-minstrel-single-rate-memory-corruption.patch new file mode 100644 index 00000000000..692d9b62086 --- /dev/null +++ b/queue-2.6.30/mac80211-fix-minstrel-single-rate-memory-corruption.patch @@ -0,0 +1,53 @@ +From 5ee58d7e6ad019675b4090582aec4fa1180d8703 Mon Sep 17 00:00:00 2001 +From: Bob Copeland +Date: Fri, 5 Jun 2009 08:21:50 -0400 +Subject: mac80211: fix minstrel single-rate memory corruption + +From: Bob Copeland + +commit 5ee58d7e6ad019675b4090582aec4fa1180d8703 upstream. + +The minstrel rate controller periodically looks up rate indexes in +a sampling table. When accessing a specific row and column, minstrel +correctly does a bounds check which, on the surface, appears to handle +the case where mi->n_rates < 2. However, mi->sample_idx is actually +defined as an unsigned, so the right hand side is taken to be a huge +positive number when negative, and the check will always fail. + +Consequently, the RC will overrun the array and cause random memory +corruption when communicating with a peer that has only a single rate. +The max value of mi->sample_idx is around 25 so casting to int should +have no ill effects. + +Without the change, uptime is a few minutes under load with an AP +that has a single hard-coded rate, and both the AP and STA could +potentially crash. With the change, both lasted 12 hours with a +steady load. + +Thanks to Ognjen Maric for providing the single-rate clue so I could +reproduce this. + +This fixes http://bugzilla.kernel.org/show_bug.cgi?id=12490 on the +regression list (also http://bugzilla.kernel.org/show_bug.cgi?id=13000). + +Reported-by: Sergey S. Kostyliov +Reported-by: Ognjen Maric +Signed-off-by: Bob Copeland +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + net/mac80211/rc80211_minstrel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -216,7 +216,7 @@ minstrel_get_next_sample(struct minstrel + unsigned int sample_ndx; + sample_ndx = SAMPLE_TBL(mi, mi->sample_idx, mi->sample_column); + mi->sample_idx++; +- if (mi->sample_idx > (mi->n_rates - 2)) { ++ if ((int) mi->sample_idx > (mi->n_rates - 2)) { + mi->sample_idx = 0; + mi->sample_column++; + if (mi->sample_column >= SAMPLE_COLUMNS) diff --git a/queue-2.6.30/ramfs-ignore-unknown-mount-options.patch b/queue-2.6.30/ramfs-ignore-unknown-mount-options.patch new file mode 100644 index 00000000000..bb8c3a91b6e --- /dev/null +++ b/queue-2.6.30/ramfs-ignore-unknown-mount-options.patch @@ -0,0 +1,54 @@ +From 0a8eba9b7f7aa3ad0305627c99ad4d6deedd871d Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Sun, 14 Jun 2009 22:56:48 +0100 +Subject: ramfs: ignore unknown mount options + +From: Mike Frysinger + +commit 0a8eba9b7f7aa3ad0305627c99ad4d6deedd871d upstream. + +On systems where CONFIG_SHMEM is disabled, mounting tmpfs filesystems can +fail when tmpfs options are used. This is because tmpfs creates a small +wrapper around ramfs which rejects unknown options, and ramfs itself only +supports a tiny subset of what tmpfs supports. This makes it pretty hard +to use the same userspace systems across different configuration systems. +As such, ramfs should ignore the tmpfs options when tmpfs is merely a +wrapper around ramfs. + +This used to work before commit c3b1b1cbf0 as previously, ramfs would +ignore all options. But now, we get: +ramfs: bad mount option: size=10M +mount: mounting mdev on /dev failed: Invalid argument + +Another option might be to restore the previous behavior, where ramfs +simply ignored all unknown mount options ... which is what Hugh prefers. + +Signed-off-by: Mike Frysinger +Signed-off-by: Hugh Dickins +Acked-by: Matt Mackall +Acked-by: Wu Fengguang +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ramfs/inode.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/fs/ramfs/inode.c ++++ b/fs/ramfs/inode.c +@@ -202,9 +202,12 @@ static int ramfs_parse_options(char *dat + return -EINVAL; + opts->mode = option & S_IALLUGO; + break; +- default: +- printk(KERN_ERR "ramfs: bad mount option: %s\n", p); +- return -EINVAL; ++ /* ++ * We might like to report bad mount options here; ++ * but traditionally ramfs has ignored all mount options, ++ * and as it is used as a !CONFIG_SHMEM simple substitute ++ * for tmpfs, better continue to ignore other mount options. ++ */ + } + } + diff --git a/queue-2.6.30/send_sigio_to_task-sanitize-the-usage-of-fown-signum.patch b/queue-2.6.30/send_sigio_to_task-sanitize-the-usage-of-fown-signum.patch new file mode 100644 index 00000000000..08caee16a0c --- /dev/null +++ b/queue-2.6.30/send_sigio_to_task-sanitize-the-usage-of-fown-signum.patch @@ -0,0 +1,68 @@ +From 8eeee4e2f04fc551f50c9d9847da2d73d7d33728 Mon Sep 17 00:00:00 2001 +From: Oleg Nesterov +Date: Wed, 17 Jun 2009 00:27:10 +0200 +Subject: send_sigio_to_task: sanitize the usage of fown->signum + +From: Oleg Nesterov + +commit 8eeee4e2f04fc551f50c9d9847da2d73d7d33728 upstream. + +send_sigio_to_task() reads fown->signum several times, we can race with +F_SETSIG which changes ->signum lockless. In theory, this can fool +security checks or we can call group_send_sig_info() with the wrong +->si_signo which does not match "int sig". + +Change the code to cache ->signum. + +Signed-off-by: Oleg Nesterov +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/fcntl.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/fs/fcntl.c ++++ b/fs/fcntl.c +@@ -428,14 +428,20 @@ static inline int sigio_perm(struct task + } + + static void send_sigio_to_task(struct task_struct *p, +- struct fown_struct *fown, ++ struct fown_struct *fown, + int fd, + int reason) + { +- if (!sigio_perm(p, fown, fown->signum)) ++ /* ++ * F_SETSIG can change ->signum lockless in parallel, make ++ * sure we read it once and use the same value throughout. ++ */ ++ int signum = ACCESS_ONCE(fown->signum); ++ ++ if (!sigio_perm(p, fown, signum)) + return; + +- switch (fown->signum) { ++ switch (signum) { + siginfo_t si; + default: + /* Queue a rt signal with the appropriate fd as its +@@ -444,7 +450,7 @@ static void send_sigio_to_task(struct ta + delivered even if we can't queue. Failure to + queue in this case _should_ be reported; we fall + back to SIGIO in that case. --sct */ +- si.si_signo = fown->signum; ++ si.si_signo = signum; + si.si_errno = 0; + si.si_code = reason; + /* Make sure we are called with one of the POLL_* +@@ -456,7 +462,7 @@ static void send_sigio_to_task(struct ta + else + si.si_band = band_table[reason - POLL_IN]; + si.si_fd = fd; +- if (!group_send_sig_info(fown->signum, &si, p)) ++ if (!group_send_sig_info(signum, &si, p)) + break; + /* fall-through: fall back on the old plain SIGIO signal */ + case 0: diff --git a/queue-2.6.30/series b/queue-2.6.30/series index b665942b846..32ca8c43841 100644 --- a/queue-2.6.30/series +++ b/queue-2.6.30/series @@ -54,3 +54,22 @@ x86-hpet-mark-per-cpu-interrupts-irqf_timer-to-prevent-resume-failure.patch arm-5545-2-add-flush_kernel_dcache_page-for-arm.patch ib-mlx4-add-strong-ordering-to-local-inval-and-fast-reg-work-requests.patch epoll-fix-nested-calls-support.patch +lockdep-select-frame-pointers-on-x86.patch +asoc-remove-odd-bit-clock-ratios-for-wm8903.patch +ramfs-ignore-unknown-mount-options.patch +mac80211-fix-minstrel-single-rate-memory-corruption.patch +cfg80211-fix-for-duplicate-userspace-replies.patch +cfg80211-cleanup-return-calls-on-nl80211_set_reg.patch +cfg80211-return-immediately-if-num-reg-rules-nl80211_max_supp_reg_rules.patch +cfg80211-fix-in-nl80211_set_reg.patch +ath9k-fix-bug-when-using-a-card-with-a-busted-eeprom.patch +ath9k-fix-bug-in-calibration-initialization.patch +ath9k-fix-bug-in-determining-calibration-support.patch +ath9k-fix-bug-in-checking-ht-flag.patch +ath9k-fix-bug-in-scan-termination.patch +ath9k-fix-memleak-on-tx-dma-failure.patch +ath9k-initialize-ani-timers.patch +ath9k-fix-pci-fatal-interrupts-by-restoring-retry_timeout-disabling.patch +shift-current_cred-from-__f_setown-to-f_modown.patch +send_sigio_to_task-sanitize-the-usage-of-fown-signum.patch +crypto-aes-ni-fix-cbc-mode-iv-saving.patch diff --git a/queue-2.6.30/shift-current_cred-from-__f_setown-to-f_modown.patch b/queue-2.6.30/shift-current_cred-from-__f_setown-to-f_modown.patch new file mode 100644 index 00000000000..a86ba87fe7d --- /dev/null +++ b/queue-2.6.30/shift-current_cred-from-__f_setown-to-f_modown.patch @@ -0,0 +1,76 @@ +From 2f38d70fb4e97e7d00e12eaac45790cf6ebd7b22 Mon Sep 17 00:00:00 2001 +From: Oleg Nesterov +Date: Tue, 16 Jun 2009 22:07:46 +0200 +Subject: shift current_cred() from __f_setown() to f_modown() + +From: Oleg Nesterov + +commit 2f38d70fb4e97e7d00e12eaac45790cf6ebd7b22 upstream. + +Shift current_cred() from __f_setown() to f_modown(). This reduces +the number of arguments and saves 48 bytes from fs/fcntl.o. + +[ Note: this doesn't clear euid/uid when pid is set to NULL. But if + f_owner.pid == NULL we never use f_owner.uid/euid. Otherwise we'd + have a bug anyway: we must not send signals if pid was reset to NULL. ] + +Signed-off-by: Oleg Nesterov +Acked-by: David Howells +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/fcntl.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +--- a/fs/fcntl.c ++++ b/fs/fcntl.c +@@ -198,15 +198,19 @@ static int setfl(int fd, struct file * f + } + + static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, +- uid_t uid, uid_t euid, int force) ++ int force) + { + write_lock_irq(&filp->f_owner.lock); + if (force || !filp->f_owner.pid) { + put_pid(filp->f_owner.pid); + filp->f_owner.pid = get_pid(pid); + filp->f_owner.pid_type = type; +- filp->f_owner.uid = uid; +- filp->f_owner.euid = euid; ++ ++ if (pid) { ++ const struct cred *cred = current_cred(); ++ filp->f_owner.uid = cred->uid; ++ filp->f_owner.euid = cred->euid; ++ } + } + write_unlock_irq(&filp->f_owner.lock); + } +@@ -214,14 +218,13 @@ static void f_modown(struct file *filp, + int __f_setown(struct file *filp, struct pid *pid, enum pid_type type, + int force) + { +- const struct cred *cred = current_cred(); + int err; +- ++ + err = security_file_set_fowner(filp); + if (err) + return err; + +- f_modown(filp, pid, type, cred->uid, cred->euid, force); ++ f_modown(filp, pid, type, force); + return 0; + } + EXPORT_SYMBOL(__f_setown); +@@ -247,7 +250,7 @@ EXPORT_SYMBOL(f_setown); + + void f_delown(struct file *filp) + { +- f_modown(filp, NULL, PIDTYPE_PID, 0, 0, 1); ++ f_modown(filp, NULL, PIDTYPE_PID, 1); + } + + pid_t f_getown(struct file *filp)