3.0.1-stable review
Subsystems (64)
PATCH 88/102 SERIAL: SC26xx: Fix link error.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ralf Baechle <[email protected]>
commit f2eb3cdf14457fccb14ae8c4d7d7cee088cd3957 upstream.
Kconfig allows enabling console support for the SC26xx driver even when it's configured as a module resulting in a:
ERROR: "uart_console_device" [drivers/tty/serial/sc26xx.ko] undefined!
modpost error since the driver was merged in eea63e0e8a60d00485b47fb6e75d9aa2566b989b [SC26XX: New serial driver for SC2681 uarts] in 2.6.25. Fixed by only allowing console support to be enabled if the driver is builtin.
--- drivers/tty/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/Kconfig +1 -1
@@ -1419,7 +1419,7 @@ config SERIAL_SC26XX config SERIAL_SC26XX_CONSOLE bool "Console on SC2681/SC2692 serial port" - depends on SERIAL_SC26XX + depends on SERIAL_SC26XX=y select SERIAL_CORE_CONSOLE help Support for Console on SC2681/SC2692 serial ports.
cover 3.0.1-stable review
This is the start of the stable review cycle for the 3.0.1 release. There are 102 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Friday, August 5, 2011, 20:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.1-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 4 +- arch/alpha/kernel/time.c | 2 +- arch/arm/mach-pxa/cm-x300.c | 8 +- arch/powerpc/kernel/crash.c | 6 +- arch/powerpc/kernel/time.c | 2 +- arch/powerpc/platforms/pseries/hvconsole.c | 2 +- arch/x86/include/asm/msr-index.h | 3 + arch/x86/kernel/cpu/intel.c | 18 +++ arch/x86/kernel/relocate_kernel_32.S | 2 + arch/x86/kernel/relocate_kernel_64.S | 2 + arch/x86/oprofile/backtrace.c | 56 ++++++++-- arch/xtensa/kernel/ptrace.c | 3 + block/blk-core.c | 3 + block/blk-exec.c | 7 ++ drivers/block/cciss.h | 2 +- drivers/firewire/core-cdev.c | 20 ++-- drivers/firmware/sigma.c | 3 + drivers/gpu/drm/radeon/atombios_dp.c | 22 +++- drivers/gpu/drm/radeon/radeon_combios.c | 3 +- drivers/gpu/drm/radeon/radeon_pm.c | 3 + drivers/infiniband/ulp/srp/ib_srp.c | 2 + drivers/md/dm-io.c | 29 +++++- drivers/md/dm-mpath.c | 5 + drivers/md/dm-snap-persistent.c | 2 +- drivers/md/dm.c | 10 ++- drivers/misc/Kconfig | 3 +- drivers/mmc/host/sdhci-esdhc-imx.c | 2 +- drivers/net/jme.c | 20 +++- drivers/net/wireless/ath/ath9k/ar9003_mac.c | 3 +- drivers/net/wireless/ath/ath9k/mac.c | 3 +- drivers/net/wireless/rt2x00/rt2800pci.c | 1 + drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 2 +- drivers/pci/pci.c | 7 +- drivers/pci/quirks.c | 23 ++++ drivers/rtc/interface.c | 55 +++++++--- drivers/rtc/rtc-tegra.c | 2 +- drivers/scsi/hpsa.h | 2 +- drivers/scsi/libsas/sas_expander.c | 3 + drivers/scsi/pmcraid.c | 3 + drivers/scsi/scsi_devinfo.c | 2 + drivers/scsi/scsi_lib.c | 2 + drivers/scsi/ses.c | 6 +- drivers/scsi/sr.c | 46 +++++++- drivers/scsi/sr.h | 7 ++ drivers/staging/ath6kl/os/linux/ar6000_drv.c | 49 ++++++--- drivers/staging/ath6kl/os/linux/cfg80211.c | 31 +++--- .../staging/ath6kl/os/linux/include/ar6000_drv.h | 9 ++ drivers/staging/brcm80211/brcmsmac/wl_mac80211.c | 5 - drivers/staging/comedi/comedi_fops.c | 4 +- drivers/staging/hv/channel.c | 2 +- drivers/staging/hv/channel_mgmt.c | 2 +- drivers/staging/hv/connection.c | 2 +- drivers/staging/hv/netvsc.c | 4 +- drivers/staging/hv/rndis_filter.c | 6 +- drivers/staging/hv/storvsc.c | 8 +- drivers/staging/hv/storvsc_drv.c | 2 +- drivers/staging/rtl8192e/r8192E_core.c | 6 + drivers/staging/usbip/vhci_hcd.c | 4 +- drivers/tty/hvc/hvc_console.c | 8 +- drivers/tty/n_gsm.c | 4 - drivers/tty/serial/8250.c | 2 +- drivers/tty/serial/Kconfig | 2 +- drivers/usb/host/ehci-hcd.c | 8 +- drivers/usb/host/ehci-hub.c | 3 +- drivers/usb/host/ehci-q.c | 85 +++++++-------- drivers/usb/host/ehci.h | 4 +- drivers/usb/host/pci-quirks.c | 28 +++++ drivers/usb/musb/musb_core.c | 1 + drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 4 + drivers/watchdog/shwdt.c | 2 +- fs/cifs/dir.c | 2 +- fs/ecryptfs/inode.c | 1 + fs/ecryptfs/keystore.c | 47 +++++---- fs/ext3/xattr.c | 12 ++- fs/ext4/ext4.h | 1 + fs/ext4/extents.c | 11 +- fs/ext4/mballoc.c | 2 +- fs/gfs2/ops_fstype.c | 4 +- fs/nfs/delegation.c | 16 ++-- fs/nfs/dir.c | 56 ++++++---- fs/nfs/nfs4filelayout.c | 2 +- fs/nfs/nfs4proc.c | 8 ++- fs/nfs/nfs4xdr.c | 2 +- fs/nfs/pnfs.c | 63 ++++++----- fs/nfs/pnfs.h | 6 +- fs/nfsd/nfs4state.c | 66 +++++------- fs/proc/base.c | 16 +++- include/linux/firewire-cdev.h | 3 + include/linux/mm.h | 2 + include/linux/netdevice.h | 5 +- include/linux/nfs_fs.h | 3 +- include/linux/nfs_xdr.h | 2 +- ipc/sem.c | 13 ++- kernel/events/core.c | 7 +- kernel/futex.c | 4 +- kernel/trace/trace.h | 1 + kernel/trace/trace_events.c | 113 ++++++++++++++++--- kernel/trace/trace_events_filter.c | 6 + lib/xz/xz_private.h | 2 +- mm/backing-dev.c | 1 + mm/memcontrol.c | 2 +- mm/memory.c | 58 ++++++++++- mm/oom_kill.c | 4 +- net/bridge/br_private.h | 1 + net/bridge/br_stp.c | 4 +- net/core/ethtool.c | 4 +- net/mac80211/mlme.c | 3 + net/sunrpc/svc_xprt.c | 11 +- net/wireless/reg.c | 5 +- security/apparmor/domain.c | 2 +- security/apparmor/lsm.c | 2 +- sound/core/pcm_compat.c | 2 +- sound/pci/hda/patch_realtek.c | 7 +- sound/pci/oxygen/xonar_pcm179x.c | 5 +- sound/soc/davinci/davinci-vcif.c | 9 +- sound/soc/soc-core.c | 1 + tools/perf/Makefile | 5 +- tools/perf/util/header.c | 5 +- tools/perf/util/session.c | 30 +++-- tools/perf/util/session.h | 1 + 121 files changed, 932 insertions(+), 403 deletions(-)
PATCH 11/102 Staging: hv: netvsc: Increase the timeout value in the netvsc driver
3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit 5c5781b3f88567211ecaaada13431af15c8c6003 upstream.
On some loaded windows hosts, we have discovered that the host may not respond to guest requests within the specified time (one second) as evidenced by the guest timing out. Fix this problem by increasing the timeout to 5 seconds.
It may be useful to apply this patch to the 3.0 kernel as well.
--- drivers/staging/hv/netvsc.c | 4 ++-- drivers/staging/hv/rndis_filter.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hv/netvsc.c +2 -2
@@ -270,7 +270,7 @@ static int netvsc_init_recv_buf(struct h goto cleanup; } - t =wait_for_completion_timeout (&net_device->channel_init_wait,HZ ); + t =wait_for_completion_timeout (&net_device->channel_init_wait,5 *HZ );BUG_ON (t ==0 );
@@ -513,7 +513,7 @@ static int netvsc_connect_vsp(struct hv_if (ret !=0 ) goto cleanup; - t =wait_for_completion_timeout (&net_device->channel_init_wait,HZ ); + t =wait_for_completion_timeout (&net_device->channel_init_wait,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ;
drivers/staging/hv/rndis_filter.c +3 -3
@@ -467,7 +467,7 @@ static int rndis_filter_query_device(strif (ret !=0 ) goto Cleanup; - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto Cleanup;
@@ -543,7 +543,7 @@ static int rndis_filter_set_packet_filteif (ret !=0 ) goto Cleanup; - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret =-1 ;
@@ -600,7 +600,7 @@ static int rndis_filter_init_device(stru } - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ;
PATCH 12/102 USB: OHCI: fix another regression for NVIDIA controllers
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit 6ea12a04d295235ed67010a09fdea58c949e3eb0 upstream.
The NVIDIA series of OHCI controllers continues to be troublesome. A few people using the MCP67 chipset have reported that even with the most recent kernels, the OHCI controller fails to handle new connections and spams the system log with "unable to enumerate USB port" messages. This is different from the other problems previously reported for NVIDIA OHCI controllers, although it is probably related.
It turns out that the MCP67 controller does not like to be kept in the RESET state very long. After only a few seconds, it decides not to work any more. This patch (as1479) changes the PCI initialization quirk code so that NVIDIA controllers are switched into the SUSPEND state after 50 ms of RESET. With no interrupts enabled and all the downstream devices reset, and thus unable to send wakeup requests, this should be perfectly safe (even for non-NVIDIA hardware).
The removal code in ohci-hcd hasn't been changed; it will still leave the controller in the RESET state. As a result, if someone unloads ohci-hcd and then reloads it, the controller won't work again until the system is rebooted. If anybody complains about this, the removal code can be updated similarly.
This fixes Bugzilla #22052.
--- drivers/usb/host/pci-quirks.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/usb/host/pci-quirks.c +28 -0
@@ -35,6 +35,8 @@#define OHCI_INTRSTATUS 0x0c#define OHCI_INTRENABLE 0x10#define OHCI_INTRDISABLE 0x14 +#define OHCI_FMINTERVAL 0x34 +#define OHCI_HCR (1 << 0)/* host controller reset */ #define OHCI_OCR (1 << 3)/* ownership change request */ #define OHCI_CTRL_RWC (1 << 9)/* remote wakeup connected */ #define OHCI_CTRL_IR (1 << 8)/* interrupt routing */
@@ -497,6 +499,32 @@ static void __devinit quirk_usb_handoff_/* reset controller, preserving RWC (and possibly IR) */ writel (control &OHCI_CTRL_MASK , base +OHCI_CONTROL ); +readl (base +OHCI_CONTROL ); + +/* Some NVIDIA controllers stop working if kept in RESET for too long */ +if (pdev->vendor ==PCI_VENDOR_ID_NVIDIA ) { +u32 fminterval; +int cnt; + +/* drive reset for at least 50 ms (7.1.7.5) */ +msleep (50 ); + +/* software reset of the controller, preserving HcFmInterval */ + fminterval =readl (base +OHCI_FMINTERVAL ); +writel (OHCI_HCR , base +OHCI_CMDSTATUS ); + +/* reset requires max 10 us delay */ +for (cnt =30 ; cnt >0 ; --cnt) {/* ... allow extra time */ +if ((readl (base +OHCI_CMDSTATUS ) &OHCI_HCR ) ==0 ) +break ; +udelay (1 ); + } +writel (fminterval, base +OHCI_FMINTERVAL ); + +/* Now we're in the SUSPEND state with all devices reset +* and wakeups and interrupts disabled +*/ + }/* * disable interrupts
PATCH 13/102 USB: EHCI: go back to using the system clock for QH unlinks
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit 004c19682884d4f40000ce1ded53f4a1d0b18206 upstream.
This patch (as1477) fixes a problem affecting a few types of EHCI controller. Contrary to what one might expect, these controllers automatically stop their internal frame counter when no ports are enabled. Since ehci-hcd currently relies on the frame counter for determining when it should unlink QHs from the async schedule, those controllers run into trouble: The frame counter stops and the QHs never get unlinked.
Some systems have also experienced other problems traced back to commit b963801164618e25fbdc0cd452ce49c3628b46c8 (USB: ehci-hcd unlink speedups), which made the original switch from using the system clock to using the frame counter. It never became clear what the reason was for these problems, but evidently it is related to use of the frame counter.
To fix all these problems, this patch more or less reverts that commit and goes back to using the system clock. But this can't be done cleanly because other changes have since been made to the scan_async() subroutine. One of these changes involved the tricky logic that tries to avoid rescanning QHs that have already been seen when the scanning loop is restarted, which happens whenever an URB is given back. Switching back to clock-based unlinks would make this logic even more complicated.
Therefore the new code doesn't rescan the entire async list whenever a giveback occurs. Instead it rescans only the current QH and continues on from there. This requires the use of a separate pointer to keep track of the next QH to scan, since the current QH may be unlinked while the scanning is in progress. That new pointer must be global, so that it can be adjusted forward whenever the _next_ QH gets unlinked. (uhci-hcd uses this same trick.)
Simplification of the scanning loop removes a level of indentation, which accounts for the size of the patch. The amount of code changed is relatively small, and it isn't exactly a reversion of the b963801164 commit.
This fixes Bugzilla #32432.
--- drivers/usb/host/ehci-hcd.c | 8 +--- drivers/usb/host/ehci-q.c | 86 +++++++++++++++++++++----------------------- drivers/usb/host/ehci.h | 3 + 3 files changed, 47 insertions(+), 50 deletions(-)
drivers/usb/host/ehci-hcd.c +3 -5
@@ -94,7 +94,8 @@ static const char hcd_name [] = "ehci_hc#define EHCI_IAA_MSECS 10/* arbitrary */ #define EHCI_IO_JIFFIES (HZ/10)/* io watchdog > irq_thresh */ #define EHCI_ASYNC_JIFFIES (HZ/20)/* async idle timeout */ -#define EHCI_SHRINK_FRAMES 5/* async qh unlink delay */ +#define EHCI_SHRINK_JIFFIES (DIV_ROUND_UP(HZ, 200) + 1) +/* 200-ms async qh unlink delay */ /* Initial IRQ latency: faster than hw default */ static int log2_irq_thresh =0 ;// 0 to 6
@@ -152,10 +153,7 @@ timer_action(struct ehci_hcd *ehci, enumbreak ;/* case TIMER_ASYNC_SHRINK: */ default : -/* add a jiffie since we synch against the -* 8 KHz uframe counter. -*/ - t =DIV_ROUND_UP (EHCI_SHRINK_FRAMES *HZ ,1000 ) +1 ; + t =EHCI_SHRINK_JIFFIES ;break ; }mod_timer (&ehci->watchdog, t + jiffies);
drivers/usb/host/ehci-q.c +42 -44
101 lines not on this page · raw message
drivers/usb/host/ehci.h +2 -1
@@ -75,6 +75,7 @@ struct ehci_hcd { /* one per controllestruct ehci_qh *async;struct ehci_qh *dummy;/* For AMD quirk use */ struct ehci_qh *reclaim; +struct ehci_qh *qh_scan_next; unsigned scanning : 1;/* periodic schedule support */
@@ -117,7 +118,6 @@ struct ehci_hcd { /* one per controllestruct timer_list iaa_watchdog;struct timer_list watchdog;unsigned long actions; -unsigned stamp;unsigned periodic_stamp;unsigned random_frame;unsigned long next_statechange;
@@ -343,6 +343,7 @@ struct ehci_qh {struct ehci_qh *reclaim;/* next to reclaim */ struct ehci_hcd *ehci; +unsigned long unlink_time;/* * Do NOT use atomic operations for QH refcounting. On some CPUs
PATCH 14/102 usb: musb: restore INDEX register in resume path
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ajay Kumar Gupta <[email protected]>
commit 3c5fec75e121b21a2eb35e5a6b44291509abba6f upstream.
Restoring the missing INDEX register value in musb_restore_context(). Without this suspend resume functionality is broken with offmode enabled.
--- drivers/usb/musb/musb_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/musb/musb_core.c +1 -0
@@ -2329,6 +2329,7 @@ static void musb_restore_context(struct musb->context.index_regs[i].rxhubport); } } +musb_writeb (musb_base,MUSB_INDEX , musb->context.index); }static int musb_suspend (struct device *dev)
PATCH 19/102 ARM: pxa/cm-x300: fix V3020 RTC functionality
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Igor Grinberg <[email protected]>
commit 6c7b3ea52e345ab614edb91d3f0e9f3bb3713871 upstream.
While in sleep mode the CS# and other V3020 RTC GPIOs must be driven high, otherwise V3020 RTC fails to keep the right time in sleep mode.
--- arch/arm/mach-pxa/cm-x300.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/cm-x300.c +4 -4
@@ -161,10 +161,10 @@ static mfp_cfg_t cm_x3xx_mfp_cfg[] __iniGPIO99_GPIO ,/* Ethernet IRQ */ /* RTC GPIOs */ -GPIO95_GPIO ,/* RTC CS */ -GPIO96_GPIO ,/* RTC WR */ -GPIO97_GPIO ,/* RTC RD */ -GPIO98_GPIO ,/* RTC IO */ +GPIO95_GPIO |MFP_LPM_DRIVE_HIGH ,/* RTC CS */ +GPIO96_GPIO |MFP_LPM_DRIVE_HIGH ,/* RTC WR */ +GPIO97_GPIO |MFP_LPM_DRIVE_HIGH ,/* RTC RD */ +GPIO98_GPIO ,/* RTC IO */ /* Standard I2C */ GPIO21_I2C_SCL,
PATCH 2/102 mmc: Added quirks for Ricoh 1180:e823 lower base clock frequency
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Manoj Iyer <[email protected]>
commit 15bed0f2fa8e1d7db201692532c210a7823d2d21 upstream.
Ricoh 1180:e823 does not recognize certain types of SD/MMC cards, as reported at http://launchpad.net/bugs/773524. Lowering the SD base clock frequency from 200Mhz to 50Mhz fixes this issue. This solution was suggest by Koji Matsumuro, Ricoh Company, Ltd.
This change has no negative performance effect on standard SD cards, though it's quite possible that there will be one on UHS-1 cards.
--- drivers/pci/quirks.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/pci/quirks.c +23 -0
@@ -2758,6 +2758,29 @@ static void ricoh_mmc_fixup_r5c832(strucdev_notice (&dev->dev,"proprietary Ricoh MMC controller disabled (via firewire function)\n" );dev_notice (&dev->dev,"MMC cards are now supported by standard SDHCI controller\n" ); + +/* +* RICOH 0xe823 SD/MMC card reader fails to recognize +* certain types of SD/MMC cards. Lowering the SD base +* clock frequency from 200Mhz to 50Mhz fixes this issue. +* +* 0x150 - SD2.0 mode enable for changing base clock +* frequency to 50Mhz +* 0xe1 - Base clock frequency +* 0x32 - 50Mhz new clock frequency +* 0xf9 - Key register for 0x150 +* 0xfc - key register for 0xe1 +*/ +if (dev->device ==PCI_DEVICE_ID_RICOH_R5CE823 ) { +pci_write_config_byte (dev,0xf9 ,0xfc ); +pci_write_config_byte (dev,0x150 ,0x10 ); +pci_write_config_byte (dev,0xf9 ,0x00 ); +pci_write_config_byte (dev,0xfc ,0x01 ); +pci_write_config_byte (dev,0xe1 ,0x32 ); +pci_write_config_byte (dev,0xfc ,0x00 ); + +dev_notice (&dev->dev,"MMC controller base frequency changed to 50Mhz.\n" ); + } }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5C832 , ricoh_mmc_fixup_r5c832);DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5C832 , ricoh_mmc_fixup_r5c832);
PATCH 20/102 ASoC: davinci: add missing break statement
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sudhakar Rajashekhara <[email protected]>
commit 82d1d521036eb3f5aae48b847f939d99a44c18bb upstream.
In davinci_vcif_trigger() function, a break() statement was missing causing the davinci_vcif_stop() function to be called as a fallback after calling davinci_vcif_start().
--- sound/soc/davinci/davinci-vcif.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/davinci/davinci-vcif.c +1 -0
@@ -159,6 +159,7 @@ static int davinci_vcif_trigger(struct scase SNDRV_PCM_TRIGGER_RESUME :case SNDRV_PCM_TRIGGER_PAUSE_RELEASE :davinci_vcif_start (substream); +break ;case SNDRV_PCM_TRIGGER_STOP :case SNDRV_PCM_TRIGGER_SUSPEND :case SNDRV_PCM_TRIGGER_PAUSE_PUSH :
PATCH 21/102 ASoC: davinci: fix codec start and stop functions
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sudhakar Rajashekhara <[email protected]>
commit 3012f43eaf7592d8121426918e43e3b5db013aff upstream.
According to DM365 voice codec data sheet at [1], before starting recording or playback, ADC/DAC modules should follow a reset and enable cycle. Writing a 1 to the ADC/DAC bit in the register resets the module and clearing the bit to 0 will enable the module. But the driver seems to be doing the reverse of it.
[1] http://focus.ti.com/lit/ug/sprufi9b/sprufi9b.pdf
--- sound/soc/davinci/davinci-vcif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/davinci/davinci-vcif.c +4 -4
@@ -62,9 +62,9 @@ static void davinci_vcif_start(struct sn w =readl (davinci_vc->base +DAVINCI_VC_CTRL );if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) -MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTDAC ,1 ); +MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTDAC ,0 );else -MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTADC ,1 ); +MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTADC ,0 );writel (w, davinci_vc->base +DAVINCI_VC_CTRL ); }
@@ -80,9 +80,9 @@ static void davinci_vcif_stop(struct snd/* Reset transmitter/receiver and sample rate/frame sync generators */ w =readl (davinci_vc->base +DAVINCI_VC_CTRL );if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) -MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTDAC ,0 ); +MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTDAC ,1 );else -MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTADC ,0 ); +MOD_REG_BIT (w,DAVINCI_VC_CTRL_RSTADC ,1 );writel (w, davinci_vc->base +DAVINCI_VC_CTRL ); }
PATCH 3/102 mmc: sdhci-esdhc-imx: SDHCI_CARD_PRESENT does not get cleared
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Shawn Guo <[email protected]>
commit 803862a6f7de4939e0a557214e5e4b37e36f87ff upstream.
The function esdhc_readl_le intends to clear bit SDHCI_CARD_PRESENT, when the card detect gpio tells there is no card. But it does not clear the bit actually. The patch gives a fix on that.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-esdhc-imx.c +1 -1
@@ -74,7 +74,7 @@ static u32 esdhc_readl_le(struct sdhci_hif (boarddata &&gpio_is_valid (boarddata->cd_gpio) &&gpio_get_value (boarddata->cd_gpio))/* no card, if a valid gpio says so... */ - val &=SDHCI_CARD_PRESENT ; + val &= ~SDHCI_CARD_PRESENT ;else /* ... in all other cases assume card is present */ val |=SDHCI_CARD_PRESENT ;
PATCH 5/102 gro: Only reset frag0 when skb can be pulled
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Herbert Xu <[email protected]>
commit 17dd759c67f21e34f2156abcf415e1f60605a188 upstream.
Currently skb_gro_header_slow unconditionally resets frag0 and frag0_len. However, when we can't pull on the skb this leaves the GRO fields in an inconsistent state.
This patch fixes this by only resetting those fields after the pskb_may_pull test.
--- include/linux/netdevice.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/netdevice.h +4 -1
@@ -1688,9 +1688,12 @@ static inline int skb_gro_header_hard(ststatic inline void *skb_gro_header_slow (struct sk_buff *skb,unsigned int hlen,unsigned int offset) { +if (!pskb_may_pull (skb, hlen)) +return NULL ; +NAPI_GRO_CB (skb)->frag0 =NULL ;NAPI_GRO_CB (skb)->frag0_len =0 ; -return pskb_may_pull (skb, hlen) ? skb->data + offset :NULL ; +return skb->data + offset; }static inline void *skb_gro_mac_header (struct sk_buff *skb)
PATCH 8/102 staging: comedi: fix infoleak to userspace
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vasiliy Kulikov <[email protected]>
commit 819cbb120eaec7e014e5abd029260db1ca8c5735 upstream.
driver_name and board_name are pointers to strings, not buffers of size COMEDI_NAMELEN. Copying COMEDI_NAMELEN bytes of a string containing less than COMEDI_NAMELEN-1 bytes would leak some unrelated bytes.
--- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/comedi/comedi_fops.c +2 -2
@@ -383,8 +383,8 @@ static int do_devinfo_ioctl(struct comed/* fill devinfo structure */ devinfo.version_code =COMEDI_VERSION_CODE ; devinfo.n_subdevs = dev->n_subdevices; -memcpy (devinfo.driver_name, dev->driver->driver_name,COMEDI_NAMELEN ); -memcpy (devinfo.board_name, dev->board_name,COMEDI_NAMELEN ); +strlcpy (devinfo.driver_name, dev->driver->driver_name,COMEDI_NAMELEN ); +strlcpy (devinfo.board_name, dev->board_name,COMEDI_NAMELEN );if (read_subdev) devinfo.read_subdevice = read_subdev - dev->subdevices;
PATCH 10/102 Staging: hv: vmbus: Increase the timeout value in the vmbus driver
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit 2dfde9644fe8c4a77f9c73f95b25d6300ca23b5d upstream.
On some loaded windows hosts, we have discovered that the host may not respond to guest requests within the specified time (one second) as evidenced by the guest timing out. Fix this problem by increasing the timeout to 5 seconds.
It may be useful to apply this patch to the 3.0 kernel as well.
--- drivers/staging/hv/channel.c | 2 +- drivers/staging/hv/channel_mgmt.c | 2 +- drivers/staging/hv/connection.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/hv/channel.c +1 -1
@@ -212,7 +212,7 @@ int vmbus_open(struct vmbus_channel *newif (ret !=0 ) goto Cleanup; - t =wait_for_completion_timeout (&openInfo->waitevent,HZ ); + t =wait_for_completion_timeout (&openInfo->waitevent,5 *HZ );if (t ==0 ) { err = -ETIMEDOUT ; goto errorout;
drivers/staging/hv/channel_mgmt.c +1 -1
@@ -773,7 +773,7 @@ int vmbus_request_offers(void) goto cleanup; } - t =wait_for_completion_timeout (&msginfo->waitevent,HZ ); + t =wait_for_completion_timeout (&msginfo->waitevent,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto cleanup;
drivers/staging/hv/connection.c +1 -1
@@ -135,7 +135,7 @@ int vmbus_connect(void) }/* Wait for the connection response */ - t =wait_for_completion_timeout (&msginfo->waitevent,HZ ); + t =wait_for_completion_timeout (&msginfo->waitevent,5 *HZ );if (t ==0 ) {spin_lock_irqsave (&vmbus_connection.channelmsg_lock, flags);
PATCH 1/102 USB: serial: add IDs for WinChipHead USB->RS232 adapter
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wolfgang Denk <[email protected]>
commit 026dfaf18973404a01f488d6aa556a8c466e06a4 upstream.
Add ID 4348:5523 for WinChipHead USB->RS 232 adapter with Prolifec PL2303 chipset
--- drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 4 ++++ 2 files changed, 5 insertions(+)
drivers/usb/serial/pl2303.c +1 -0
@@ -91,6 +91,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, + { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) }, { } /* Terminating entry */ };
drivers/usb/serial/pl2303.h +4 -0
@@ -144,3 +144,7 @@/* ADLINK ND-6530 RS232,RS485 and RS422 adapter */ #define ADLINK_VENDOR_ID 0x0b63#define ADLINK_ND6530_PRODUCT_ID 0x6530 + +/* WinChipHead USB->RS 232 adapter */ +#define WINCHIPHEAD_VENDOR_ID 0x4348 +#define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523
PATCH 32/102 IB/srp: Avoid duplicate devices from LUN scan
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Bart Van Assche <[email protected]>
commit fd1b6c4a693c9cac59375ffb36ffe5d7c079037c upstream.
SCSI scanning of a channel:id:lun triplet in Linux works as follows (function scsi_scan_target() in drivers/scsi/scsi_scan.c):
- If lun == SCAN_WILD_CARD, send a REPORT LUNS command to the target and process the result.
- If lun != SCAN_WILD_CARD, send an INQUIRY command to the LUN corresponding to the specified channel:id:lun triplet to verify whether the LUN exists.
So a SCSI driver must either take the channel and target id values in account in its quecommand() function or it should declare that it only supports one channel and one target id.
Currently the ib_srp driver does neither. As a result scanning the SCSI bus via e.g. rescan-scsi-bus.sh causes many duplicate SCSI devices to be created. For each 0:0:L device, several duplicates are created with the same LUN number and with (C:I) != (0:0). Fix this by declaring that the ib_srp driver only supports one channel and one target id.
--- drivers/infiniband/ulp/srp/ib_srp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/srp/ib_srp.c +2 -0
@@ -2127,6 +2127,8 @@ static ssize_t srp_create_target(structreturn -ENOMEM ; target_host->transportt = ib_srp_transport_template; + target_host->max_channel =0 ; + target_host->max_id =1 ; target_host->max_lun =SRP_MAX_LUN ; target_host->max_cmd_len =sizeof ((struct srp_cmd *) (void *)0L )->cdb;
PATCH 33/102 libsas: remove expander from dev list on error
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Luben Tuikov <[email protected]>
commit 5911e963d3718e306bcac387b83e259aa4228896 upstream.
If expander discovery fails (sas_discover_expander()), remove the expander from the port device list (sas_ex_discover_expander()), before freeing it. Else the list is corrupted and, e.g., when we attempt to send SMP commands to other devices, the kernel oopses.
--- drivers/scsi/libsas/sas_expander.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/libsas/sas_expander.c +3 -0
@@ -849,6 +849,9 @@ static struct domain_device *sas_ex_disc res =sas_discover_expander (child);if (res) { +spin_lock_irq (&parent->port->dev_list_lock); +list_del (&child->dev_list_node); +spin_unlock_irq (&parent->port->dev_list_lock);kfree (child);return NULL ; }
PATCH 36/102 irq_work, ppc: Fix up arch hooks
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Zijlstra <[email protected]>
commit 4f8b50bbbe63ae4ec6bea28a90a9a603c745ea71 upstream.
Commit e360adbe29 ("irq_work: Add generic hardirq context callbacks") fouled up the ppc bit, not properly naming the arch specific function that raises the 'self-IPI'.
--- arch/powerpc/kernel/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/time.c +1 -1
@@ -544,7 +544,7 @@ DEFINE_PER_CPU(u8, irq_work_pending);#endif /* 32 vs 64 bit */ -void set_irq_work_pending (void ) +void arch_irq_work_raise (void ) {preempt_disable ();set_irq_work_pending_flag ();
PATCH 40/102 perf: Fix software event overflow
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Zijlstra <[email protected]>
The below patch is for -stable only, upstream has a much larger patch that contains the below hunk in commit a8b0ca17b80e92faab46ee7179ba9e99ccb61233
Vince found that under certain circumstances software event overflows go wrong and deadlock. Avoid trying to delete a timer from the timer callback.
--- kernel/events/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/events/core.c +2 -5
@@ -5016,11 +5016,8 @@ static int __perf_event_overflow(structif (events &&atomic_dec_and_test (&event->event_limit)) { ret =1 ; event->pending_kill =POLL_HUP ; -if (nmi) { - event->pending_disable =1 ; -irq_work_queue (&event->pending); - }else -perf_event_disable (event); + event->pending_disable =1 ; +irq_work_queue (&event->pending); }if (event->overflow_handler)
PATCH 41/102 Blacklist Traxdata CDR4120 and IOMEGA Zip drive to avoid lock ups.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Werner Fink <[email protected]>
commit 82103978189e9731658cd32da5eb85ab7b8542b8 upstream.
This patch resulted from the discussion at
https://bugzilla.novell.com/show_bug.cgi?id=679277,
https://bugzilla.novell.com/show_bug.cgi?id=681840 .
--- drivers/scsi/scsi_devinfo.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/scsi_devinfo.c +2 -0
@@ -197,6 +197,7 @@ static struct { {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, {"IBM", "2105", NULL, BLIST_RETRY_HWERROR}, {"iomega", "jaz 1GB", "J.86", BLIST_NOTQ | BLIST_NOLUN}, + {"IOMEGA", "ZIP", NULL, BLIST_NOTQ | BLIST_NOLUN}, {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, {"INSITE", "I325VM", NULL, BLIST_KEY},
@@ -243,6 +244,7 @@ static struct { {"Tornado-", "F4", "*", BLIST_NOREPORTLUN}, {"TOSHIBA", "CDROM", NULL, BLIST_ISROM}, {"TOSHIBA", "CD-ROM", NULL, BLIST_ISROM}, + {"Traxdata", "CDR4120", NULL, BLIST_NOLUN}, /* locks up */ {"USB2.0", "SMARTMEDIA/XD", NULL, BLIST_FORCELUN | BLIST_INQUIRY_36}, {"WangDAT", "Model 2600", "01.7", BLIST_SELECT_NO_ATN}, {"WangDAT", "Model 3200", "02.2", BLIST_SELECT_NO_ATN},
PATCH 23/102 ath6kl: cache firmware
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Kalle Valo <[email protected]>
commit b42a7b1bc7c0f535dfe35b2c934f239c60bb8d30 upstream.
Drivers should not request firmware during resume. Fix ath6kl to cache the firmware instead.
--- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 49 +++++++++++++------ drivers/staging/ath6kl/os/linux/include/ar6000_drv.h | 9 +++ 2 files changed, 43 insertions(+), 15 deletions(-)
drivers/staging/ath6kl/os/linux/ar6000_drv.c +34 -15
@@ -954,9 +954,13 @@ ar6000_transfer_bin_file(struct ar6_softconst char *filename;const struct firmware *fw_entry;u32 fw_entry_size; +u8 **buf; +size_t *buf_len;switch (file) {case AR6K_OTP_FILE : + buf = &ar->fw_otp; + buf_len = &ar->fw_otp_len;if (ar->arVersion.target_ver ==AR6003_REV1_VERSION ) { filename =AR6003_REV1_OTP_FILE ; }else if (ar->arVersion.target_ver ==AR6003_REV2_VERSION ) {
@@ -970,6 +974,8 @@ ar6000_transfer_bin_file(struct ar6_softbreak ;case AR6K_FIRMWARE_FILE : + buf = &ar->fw; + buf_len = &ar->fw_len;if (ar->arVersion.target_ver ==AR6003_REV1_VERSION ) { filename =AR6003_REV1_FIRMWARE_FILE ; }else if (ar->arVersion.target_ver ==AR6003_REV2_VERSION ) {
@@ -1028,6 +1034,8 @@ ar6000_transfer_bin_file(struct ar6_softbreak ;case AR6K_PATCH_FILE : + buf = &ar->fw_patch; + buf_len = &ar->fw_patch_len;if (ar->arVersion.target_ver ==AR6003_REV1_VERSION ) { filename =AR6003_REV1_PATCH_FILE ; }else if (ar->arVersion.target_ver ==AR6003_REV2_VERSION ) {
@@ -1041,6 +1049,8 @@ ar6000_transfer_bin_file(struct ar6_softbreak ;case AR6K_BOARD_DATA_FILE : + buf = &ar->fw_data; + buf_len = &ar->fw_data_len;if (ar->arVersion.target_ver ==AR6003_REV1_VERSION ) { filename =AR6003_REV1_BOARD_DATA_FILE ; }else if (ar->arVersion.target_ver ==AR6003_REV2_VERSION ) {
@@ -1057,23 +1067,29 @@ ar6000_transfer_bin_file(struct ar6_softAR_DEBUG_PRINTF (ATH_DEBUG_ERR , ("Unknown file type: %d\n" , file));return A_ERROR ; } -if ((A_REQUEST_FIRMWARE (&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) !=0 ) - { -AR_DEBUG_PRINTF (ATH_DEBUG_ERR , ("Failed to get %s\n" , filename)); -return A_ENOENT ; + +if (*buf ==NULL ) { +if ((A_REQUEST_FIRMWARE (&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) !=0 ) { +AR_DEBUG_PRINTF (ATH_DEBUG_ERR , ("Failed to get %s\n" , filename)); +return A_ENOENT ; + } + + *buf =kmemdup (fw_entry->data, fw_entry->size,GFP_KERNEL ); + *buf_len = fw_entry->size; +A_RELEASE_FIRMWARE (fw_entry); }#ifdef SOFTMAC_FILE_USED -if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) { -ar6000_softmac_update (ar, (u8 *)fw_entry->data, fw_entry->size); +if (file==AR6K_BOARD_DATA_FILE && *buf_len) { +ar6000_softmac_update (ar, *buf, *buf_len); }#endif - fw_entry_size = fw_entry->size; + fw_entry_size = *buf_len;/* Load extended board data for AR6003 */ -if ((file==AR6K_BOARD_DATA_FILE ) && (fw_entry->data)) { +if ((file==AR6K_BOARD_DATA_FILE ) && *buf) {u32 board_ext_address;u32 board_ext_data_size;u32 board_data_size;
@@ -1089,14 +1105,13 @@ ar6000_transfer_bin_file(struct ar6_softAR_DEBUG_PRINTF (ATH_DEBUG_INFO , ("Board extended Data download address: 0x%x\n" , board_ext_address));/* check whether the target has allocated memory for extended board data and file contains extended board data */ -if ((board_ext_address) && (fw_entry->size == (board_data_size + board_ext_data_size))) { +if ((board_ext_address) && (*buf_len == (board_data_size + board_ext_data_size))) {u32 param; - status =BMIWriteMemory (ar->arHifDevice, board_ext_address, (u8 *)(fw_entry->data + board_data_size), board_ext_data_size); + status =BMIWriteMemory (ar->arHifDevice, board_ext_address, (u8 *)(*buf + board_data_size), board_ext_data_size);if (status) {AR_DEBUG_PRINTF (ATH_DEBUG_ERR , ("BMI operation failed: %d\n" , __LINE__)); -A_RELEASE_FIRMWARE (fw_entry);return A_ERROR ; }
@@ -1110,17 +1125,16 @@ ar6000_transfer_bin_file(struct ar6_soft }if (compressed) { - status =BMIFastDownload (ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size); + status =BMIFastDownload (ar->arHifDevice, address, *buf, fw_entry_size); }else { - status =BMIWriteMemory (ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size); + status =BMIWriteMemory (ar->arHifDevice, address, *buf, fw_entry_size); }if (status) {AR_DEBUG_PRINTF (ATH_DEBUG_ERR , ("BMI operation failed: %d\n" , __LINE__)); -A_RELEASE_FIRMWARE (fw_entry);return A_ERROR ; } -A_RELEASE_FIRMWARE (fw_entry); +return 0 ; }
@@ -2088,6 +2102,11 @@ ar6000_destroy(struct net_device *dev, uar6000_remove_ap_interface ();#endif /*CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */ +kfree (ar->fw_otp); +kfree (ar->fw); +kfree (ar->fw_patch); +kfree (ar->fw_data); +AR_DEBUG_PRINTF (ATH_DEBUG_INFO ,("-ar6000_destroy \n" )); }
drivers/staging/ath6kl/os/linux/include/ar6000_drv.h +9 -0
@@ -651,6 +651,15 @@ struct ar6_softc {void *arApDev;#endif u8 arAutoAuthStage; + +u8 *fw_otp; +size_t fw_otp_len; +u8 *fw; +size_t fw_len; +u8 *fw_patch; +size_t fw_patch_len; +u8 *fw_data; +size_t fw_data_len; };#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
PATCH 44/102 fix crash in scsi_dispatch_cmd()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: James Bottomley <[email protected]>
commit bfe159a51203c15d23cb3158fffdc25ec4b4dda1 upstream.
USB surprise removal of sr is triggering an oops in scsi_dispatch_command(). What seems to be happening is that USB is hanging on to a queue reference until the last close of the upper device, so the crash is caused by surprise remove of a mounted CD followed by attempted unmount.
The problem is that USB doesn't issue its final commands as part of the SCSI teardown path, but on last close when the block queue is long gone. The long term fix is probably to make sr do the teardown in the same way as sd (so remove all the lower bits on ejection, but keep the upper disk alive until last close of user space). However, the current oops can be simply fixed by not allowing any commands to be sent to a dead queue.
--- block/blk-core.c | 3 +++ block/blk-exec.c | 7 +++++++ drivers/scsi/scsi_lib.c | 2 ++ 3 files changed, 12 insertions(+)
block/blk-core.c +3 -0
@@ -839,6 +839,9 @@ struct request *blk_get_request(struct r {struct request *rq; +if (unlikely (test_bit (QUEUE_FLAG_DEAD , &q->queue_flags))) +return NULL ; +BUG_ON (rw !=READ && rw !=WRITE );spin_lock_irq (q->queue_lock);
block/blk-exec.c +7 -0
@@ -50,6 +50,13 @@ void blk_execute_rq_nowait(struct reques {int where = at_head ?ELEVATOR_INSERT_FRONT :ELEVATOR_INSERT_BACK ; +if (unlikely (test_bit (QUEUE_FLAG_DEAD , &q->queue_flags))) { + rq->errors = -ENXIO ; +if (rq->end_io) + rq->end_io (rq, rq->errors); +return ; + } + rq->rq_disk = bd_disk; rq->end_io = done;WARN_ON (irqs_disabled ());
drivers/scsi/scsi_lib.c +2 -0
@@ -213,6 +213,8 @@ int scsi_execute(struct scsi_device *sdeint ret =DRIVER_ERROR <<24 ; req =blk_get_request (sdev->request_queue, write, __GFP_WAIT); +if (!req) +return ret;if (bufflen &&blk_rq_map_kern (sdev->request_queue, req, buffer, bufflen, __GFP_WAIT))
PATCH 45/102 pmcraid: reject negative request size
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit b5b515445f4f5a905c5dd27e6e682868ccd6c09d upstream.
There's a code path in pmcraid that can be reached via device ioctl that causes all sorts of ugliness, including heap corruption or triggering the OOM killer due to consecutive allocation of large numbers of pages.
First, the user can call pmcraid_chr_ioctl(), with a type PMCRAID_PASSTHROUGH_IOCTL. This calls through to pmcraid_ioctl_passthrough(). Next, a pmcraid_passthrough_ioctl_buffer is copied in, and the request_size variable is set to buffer->ioarcb.data_transfer_length, which is an arbitrary 32-bit signed value provided by the user. If a negative value is provided here, bad things can happen. For example, pmcraid_build_passthrough_ioadls() is called with this request_size, which immediately calls pmcraid_alloc_sglist() with a negative size. The resulting math on allocating a scatter list can result in an overflow in the kzalloc() call (if num_elem is 0, the sglist will be smaller than expected), or if num_elem is unexpectedly large the subsequent loop will call alloc_pages() repeatedly, a high number of pages will be allocated and the OOM killer might be invoked.
It looks like preventing this value from being negative in pmcraid_ioctl_passthrough() would be sufficient.
--- drivers/scsi/pmcraid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/pmcraid.c +3 -0
@@ -3871,6 +3871,9 @@ static long pmcraid_ioctl_passthrough(pmcraid_err ("couldn't build passthrough ioadls\n" ); goto out_free_buffer; } + }else if (request_size <0 ) { + rc = -EINVAL ; + goto out_free_buffer; }/* If data is being written into the device, copy the data from user
PATCH 48/102 drm/radeon/kms: fix DP training for DPEncoderService revision bigger than 1.1
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jerome Glisse <[email protected]>
commit 5a96a899bbdee86024ab9ea6d02b9e242faacbed upstream.
DPEncoderService newer than 1.1 can't properly program the DP (display port) link training. When facing such version use the DIGxEncoderControl method instead. Fix DP link training on some R7XX.
--- drivers/gpu/drm/radeon/atombios_dp.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +18 -4
@@ -627,6 +627,7 @@ struct radeon_dp_link_train_info {u8 train_set[4 ];u8 link_status[DP_LINK_STATUS_SIZE ];u8 tries; +bool use_dpencoder; };static void radeon_dp_update_vs_emph (struct radeon_dp_link_train_info *dp_info)
@@ -646,7 +647,7 @@ static void radeon_dp_set_tp(struct radeint rtp =0 ;/* set training pattern on the source */ -if (ASIC_IS_DCE4 (dp_info->rdev)) { +if (ASIC_IS_DCE4 (dp_info->rdev) || !dp_info->use_dpencoder) {switch (tp) {case DP_TRAINING_PATTERN_1 : rtp =ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN1 ;
@@ -706,7 +707,7 @@ static int radeon_dp_link_train_init(strradeon_write_dpcd_reg (dp_info->radeon_connector,DP_LINK_BW_SET , tmp);/* start training on the source */ -if (ASIC_IS_DCE4 (dp_info->rdev)) +if (ASIC_IS_DCE4 (dp_info->rdev) || !dp_info->use_dpencoder)atombios_dig_encoder_setup (dp_info->encoder,ATOM_ENCODER_CMD_DP_LINK_TRAINING_START ,0 );else
@@ -731,7 +732,7 @@ static int radeon_dp_link_train_finish(s DP_TRAINING_PATTERN_DISABLE);/* disable the training pattern on the source */ -if (ASIC_IS_DCE4 (dp_info->rdev)) +if (ASIC_IS_DCE4 (dp_info->rdev) || !dp_info->use_dpencoder)atombios_dig_encoder_setup (dp_info->encoder,ATOM_ENCODER_CMD_DP_LINK_TRAINING_COMPLETE ,0 );else
@@ -869,7 +870,8 @@ void radeon_dp_link_train(struct drm_encstruct radeon_connector *radeon_connector;struct radeon_connector_atom_dig *dig_connector;struct radeon_dp_link_train_info dp_info; -u8 tmp; +int index; +u8 tmp, frev, crev;if (!radeon_encoder->enc_priv)return ;
@@ -884,6 +886,18 @@ void radeon_dp_link_train(struct drm_enc (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_eDP)) return; +/* DPEncoderService newer than 1.1 can't program properly the +* training pattern. When facing such version use the +* DIGXEncoderControl (X== 1 | 2) +*/ + dp_info.use_dpencoder = true; + index =GetIndexIntoMasterTable (COMMAND , DPEncoderService); +if (atom_parse_cmd_header (rdev->mode_info.atom_context, index, &frev, &crev)) { +if (crev >1 ) { + dp_info.use_dpencoder = false; + } + } + dp_info.enc_id =0 ;if (dig->dig_encoder) dp_info.enc_id |=ATOM_DP_CONFIG_DIG2_ENCODER ;
PATCH 49/102 drm/radeon/kms: add missing vddci setting on NI+
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 4639dd21e759e32125adc7171abf6cb8140d54cf upstream.
Need to add vddci setting to pm init as well as resume. Fixes hangs on load on some boards.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=38754
--- drivers/gpu/drm/radeon/radeon_pm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_pm.c +3 -0
@@ -594,6 +594,9 @@ int radeon_pm_init(struct radeon_deviceif (rdev->pm.default_vddc)radeon_atom_set_voltage (rdev, rdev->pm.default_vddc,SET_VOLTAGE_TYPE_ASIC_VDDC ); +if (rdev->pm.default_vddci) +radeon_atom_set_voltage (rdev, rdev->pm.default_vddci, +SET_VOLTAGE_TYPE_ASIC_VDDCI );if (rdev->pm.default_sclk)radeon_set_engine_clock (rdev, rdev->pm.default_sclk);if (rdev->pm.default_mclk)
PATCH 51/102 ALSA: hda - Fix duplicated DAC assignments for Realtek
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Takashi Iwai <[email protected]>
commit c48a8fb0d31d6147d8d76b8e2ad7f51a2fbb5c4d upstream.
Copying hp_pins and speaker_pins from line_out_pins may confuse the parser, and it can lead to duplicated initializations for the same pin with a wrong DAC assignment. The problem appears in 3.0 kernel code.
--- sound/pci/hda/patch_realtek.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +5 -2
@@ -1578,13 +1578,15 @@ static void alc_init_auto_hp(struct hda_if (present ==3 ) spec->automute_hp_lo =1 ;/* both HP and LO automute */ -if (!cfg->speaker_pins[0 ]) { +if (!cfg->speaker_pins[0 ] && + cfg->line_out_type ==AUTO_PIN_SPEAKER_OUT ) {memcpy (cfg->speaker_pins, cfg->line_out_pins,sizeof (cfg->speaker_pins)); cfg->speaker_outs = cfg->line_outs; } -if (!cfg->hp_pins[0 ]) { +if (!cfg->hp_pins[0 ] && + cfg->line_out_type ==AUTO_PIN_HP_OUT ) {memcpy (cfg->hp_pins, cfg->line_out_pins,sizeof (cfg->hp_pins)); cfg->hp_outs = cfg->line_outs;
@@ -1603,6 +1605,7 @@ static void alc_init_auto_hp(struct hda_ spec->automute_mode =ALC_AUTOMUTE_PIN ; }if (spec->automute && cfg->line_out_pins[0 ] && + cfg->speaker_pins[0 ] && cfg->line_out_pins[0 ] != cfg->hp_pins[0 ] && cfg->line_out_pins[0 ] != cfg->speaker_pins[0 ]) {for (i =0 ; i < cfg->line_outs; i++) {
PATCH 24/102 ath6kl: fix crash when interface is closed but scan is ongoing
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Kalle Valo <[email protected]>
commit 98ab5c7755b5cc9e1a8f2a57ccb22eac5e13ec50 upstream.
When ath6kl module was resumed while a scan was ongoing, for example during suspend, the driver would crash in ar6k_cfg80211_scanComplete_event():
[26581.586440] Call Trace: [26581.586440] [<f99ffeda>] ? ar6k_cfg80211_scanComplete_event+0xaa/0xaa [ath6kl] [26581.586440] [<f9a0a020>] wmi_iterate_nodes+0xb/0xd [ath6kl] [26581.586440] [<f99ffe78>] ar6k_cfg80211_scanComplete_event+0x48/0xaa [ath6kl] [26581.586440] [<f9a038ae>] ar6000_close+0x77/0x7e [ath6kl] [26581.586440] [<c139c25d>] __dev_close_many+0x87/0xab [26581.586440] [<c139c30a>] dev_close_many+0x54/0xab [26581.586440] [<c139c437>] rollback_registered_many+0xa5/0x19e [26581.586440] [<c139c595>] rollback_registered+0x23/0x2f [26581.586440] [<c139c5ed>] unregister_netdevice_queue+0x4c/0x69 [26581.586440] [<c139c6b2>] unregister_netdev+0x18/0x1f [26581.586440] [<f9a00d4c>] ar6000_destroy+0xf8/0x115 [ath6kl] [26581.586440] [<f9a0c765>] ar6k_cleanup_module+0x20/0x29 [ath6kl] [26581.586440] [<c1062843>] sys_delete_module+0x181/0x1d9 [26581.586440] [<c105876b>] ? lock_release_holdtime+0x2b/0xcd [26581.586440] [<c10b55dc>] ? sys_munmap+0x3b/0x42 [26581.586440] [<c14a99dc>] ? restore_all+0xf/0xf [26581.586440] [<c14aeb6c>] sysenter_do_call+0x12/0x32 [26581.586440] Code: 89 53 6c 75 07 89 d8 e8 c0 ff ff ff 89 f0 e8 2c f2 a9 c7 5b 5e 5d c3 55 89 e5 57 56 53 89 c3 83 ec 08 89 55 f0 8d 78 04 89 4d ec <8b> b0 b8 00 00 00 46 89 b0 b8 00 00 00 89 f8 e8 ae ed a9 c7 8b
Fix the function not to iterate nodes when the scan is aborted. The nodes are already freed when the module is being unloaded. Patch "ath6kl: Fix a kernel panic furing suspend/resume" tried to fix this already but it wasn't enough as a pointer was still used even after the null check. This patch removes the null check entirely as the wmi structure is not accessed anymore during module unload.
Also fix a bug where the status was checked as a bitfield with '&' operator. But it's not a bitfield, just a regular (enum like) value.
--- drivers/staging/ath6kl/os/linux/cfg80211.c | 31 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/staging/ath6kl/os/linux/cfg80211.c +18 -13
@@ -867,26 +867,31 @@ ar6k_cfg80211_scanComplete_event(structAR_DEBUG_PRINTF (ATH_DEBUG_INFO , ("%s: status %d\n" , __func__, status)); -if (ar->scan_request) - { -/* Translate data to cfg80211 mgmt format */ -if (ar->arWmi) -wmi_iterate_nodes (ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy); +if (!ar->scan_request) +return ; -cfg80211_scan_done (ar->scan_request, - ((status &A_ECANCELED ) || (status &A_EBUSY )) ? true : false); +if ((status ==A_ECANCELED ) || (status ==A_EBUSY )) { +cfg80211_scan_done (ar->scan_request, true); + goto out; + } + +/* Translate data to cfg80211 mgmt format */ +wmi_iterate_nodes (ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy); -if (ar->scan_request->n_ssids && - ar->scan_request->ssids[0 ].ssid_len) { +cfg80211_scan_done (ar->scan_request, false); + +if (ar->scan_request->n_ssids && + ar->scan_request->ssids[0 ].ssid_len) {u8 i;for (i =0 ; i < ar->scan_request->n_ssids; i++) { -wmi_probedSsid_cmd (ar->arWmi, i+1 ,DISABLE_SSID_FLAG , -0 ,NULL ); +wmi_probedSsid_cmd (ar->arWmi, i+1 ,DISABLE_SSID_FLAG , +0 ,NULL ); } - } - ar->scan_request =NULL ; } + +out: + ar->scan_request =NULL ; } static int
PATCH 26/102 CIFS: Fix oops while mounting with prefixpath
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Pavel Shilovsky <[email protected]>
commit f5bc1e755d23d022bf948904386337fc3e5e29a8 upstream.
commit fec11dd9a0109fe52fd631e5c510778d6cbff6cc caused a regression when we have already mounted //server/share/a and want to mount //server/share/a/b.
The problem is that lookup_one_len calls __lookup_hash with nd pointer as NULL. Then __lookup_hash calls do_revalidate in the case when dentry exists and we end up with NULL pointer deference in cifs_d_revalidate:
if (nd->flags & LOOKUP_RCU)
return -ECHILD;
Fix this by checking nd for NULL.
--- fs/cifs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dir.c +1 -1
@@ -641,7 +641,7 @@ lookup_out:static int cifs_d_revalidate (struct dentry *direntry,struct nameidata *nd) { -if (nd->flags &LOOKUP_RCU ) +if (nd && (nd->flags &LOOKUP_RCU ))return -ECHILD ;if (direntry->d_inode) {
PATCH 29/102 ethtool: Allow zero-length register dumps again
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ben Hutchings <[email protected]>
commit 67ae7cf1eeda777f79259c4c6cb17a0bd28dee71 upstream.
Some drivers (ab)use the ethtool_ops::get_regs operation to expose only a hardware revision ID. Commit a77f5db361ed9953b5b749353ea2c7fed2bf8d93 ('ethtool: Allocate register dump buffer with vmalloc()') had the side-effect of breaking these, as vmalloc() returns a null pointer for size=0 whereas kmalloc() did not.
For backward-compatibility, allow zero-length dumps again.
--- net/core/ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/ethtool.c +2 -2
@@ -1227,7 +1227,7 @@ static int ethtool_get_regs(struct net_d regs.len = reglen; regbuf =vzalloc (reglen); -if (!regbuf) +if (reglen && !regbuf)return -ENOMEM ; ops->get_regs (dev, ®s, regbuf);
@@ -1236,7 +1236,7 @@ static int ethtool_get_regs(struct net_dif (copy_to_user (useraddr, ®s,sizeof (regs))) goto out; useraddr += offsetof(struct ethtool_regs , data); -if (copy_to_user (useraddr, regbuf, regs.len)) +if (regbuf &©_to_user (useraddr, regbuf, regs.len)) goto out; ret =0 ;
PATCH 28/102 jme: Fix unmap error (Causing system freeze)
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Guo-Fu Tseng <[email protected]>
commit 94c5b41b327e08de0ddf563237855f55080652a1 upstream.
This patch add the missing dma_unmap().
Which solved the critical issue of system freeze on heavy load.
Michal Miroslaw's rejected patch:
[PATCH v2 10/46] net: jme: convert to generic DMA API Pointed out the issue also, thank you Michal. But the fix was incorrect. It would unmap needed address when low memory.
Got lots of feedback from End user and Gentoo Bugzilla.
https://bugs.gentoo.org/show_bug.cgi?id=373109
Thank you all. :)
--- drivers/net/jme.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/jme.c +14 -6
@@ -753,20 +753,28 @@ jme_make_new_rx_buf(struct jme_adapter *struct jme_ring *rxring = &(jme->rxring[0 ]);struct jme_buffer_info *rxbi = rxring->bufinf + i;struct sk_buff *skb; +dma_addr_t mapping; skb =netdev_alloc_skb (jme->dev, jme->dev->mtu +RX_EXTRA_LEN );if (unlikely (!skb))return -ENOMEM ; + mapping =pci_map_page (jme->pdev,virt_to_page (skb->data), +offset_in_page (skb->data),skb_tailroom (skb), +PCI_DMA_FROMDEVICE ); +if (unlikely (pci_dma_mapping_error (jme->pdev, mapping))) { +dev_kfree_skb (skb); +return -ENOMEM ; + } + +if (likely (rxbi->mapping)) +pci_unmap_page (jme->pdev, rxbi->mapping, + rxbi->len,PCI_DMA_FROMDEVICE ); + rxbi->skb = skb; rxbi->len =skb_tailroom (skb); - rxbi->mapping =pci_map_page (jme->pdev, -virt_to_page (skb->data), -offset_in_page (skb->data), - rxbi->len, -PCI_DMA_FROMDEVICE ); - + rxbi->mapping = mapping;return 0 ; }
PATCH 30/102 firewire: cdev: return -ENOTTY for unimplemented ioctls, not -EINVAL
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stefan Richter <[email protected]>
commit d873d794235efa590ab3c94d5ee22bb1fab19ac4 upstream.
Quoted 5 lines · On Jun 27 Linus Torvalds wrote:
The correct error code for "I don't understand this ioctl" is ENOTTY. The naming may be odd, but you should think of that error value as a "unrecognized ioctl number, you're feeding me random numbers that I don't understand and I assume for historical reasons that you tried to do some tty operation on me".
[...]
Quoted 13 lines
The EINVAL thing goes way back, and is a disaster. It predates Linux itself, as far as I can tell. You'll find lots of man-pages that have this line in it:
EINVAL Request or argp is not valid.
and it shows up in POSIX etc. And sadly, it generally shows up _before_ the line that says
ENOTTY The specified request does not apply to the kind of object
that the descriptor d references.so a lot of people get to the EINVAL, and never even notice the ENOTTY.
[...]
Quoted 3 lines
At least glibc (and hopefully other C libraries) use a _string_ that makes much more sense: strerror(ENOTTY) is "Inappropriate ioctl for device"
So let's correct this in the <linux/firewire-cdev.h> ABI while it is still young, relative to distributor adoption.
Side note: We return -ENOTTY not only on _IOC_TYPE or _IOC_NR mismatch, but also on _IOC_SIZE mismatch. An ioctl with an unsupported size of argument structure can be seen as an unsupported version of that ioctl.
--- drivers/firewire/core-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firewire/core-cdev.c +1 -1
@@ -1583,7 +1583,7 @@ static int dispatch_ioctl(struct clientif (_IOC_TYPE (cmd) !='#' ||_IOC_NR (cmd) >=ARRAY_SIZE (ioctl_handlers) ||_IOC_SIZE (cmd) >sizeof (buffer)) -return -EINVAL ; +return -ENOTTY ;if (_IOC_DIR (cmd) == _IOC_READ)memset (&buffer,0 ,_IOC_SIZE (cmd));
PATCH 31/102 firewire: cdev: prevent race between first get_info ioctl and bus reset event queuing
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stefan Richter <[email protected]>
commit 93b37905f70083d6143f5f4dba0a45cc64379a62 upstream.
Between open(2) of a /dev/fw* and the first FW_CDEV_IOC_GET_INFO ioctl(2) on it, the kernel already queues FW_CDEV_EVENT_BUS_RESET events to be read(2) by the client. The get_info ioctl is practically always issued right away after open, hence this condition only occurs if the client opens during a bus reset, especially during a rapid series of bus resets.
The problem with this condition is twofold:
- These bus reset events carry the (as yet undocumented) @closure value of 0. But it is not the kernel's place to choose closures; they are privat to the client. E.g., this 0 value forced from the kernel makes it unsafe for clients to dereference it as a pointer to a closure object without NULL pointer check.
- It is impossible for clients to determine the relative order of bus reset events from get_info ioctl(2) versus those from read(2), except in one way: By comparison of closure values. Again, such a procedure imposes complexity on clients and reduces freedom in use of the bus reset closure.
So, change the ABI to suppress queuing of bus reset events before the first FW_CDEV_IOC_GET_INFO ioctl was issued by the client.
Note, this ABI change cannot be version-controlled. The kernel cannot distinguish old from new clients before the first FW_CDEV_IOC_GET_INFO ioctl.
We will try to back-merge this change into currently maintained stable/ longterm series, and we only document the new behaviour. The old behavior is now considered a kernel bug, which it basically is.
--- drivers/firewire/core-cdev.c | 18 ++++++++++-------- include/linux/firewire-cdev.h | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/firewire/core-cdev.c +10 -8
@@ -253,14 +253,11 @@ static int fw_device_op_open(struct inodinit_waitqueue_head (&client->wait);init_waitqueue_head (&client->tx_flush_wait);INIT_LIST_HEAD (&client->phy_receiver_link); +INIT_LIST_HEAD (&client->link);kref_init (&client->kref); file->private_data = client; -mutex_lock (&device->client_list_mutex); -list_add_tail (&client->link, &device->client_list); -mutex_unlock (&device->client_list_mutex); -return nonseekable_open (inode, file); }
@@ -451,15 +448,20 @@ static int ioctl_get_info(struct clientif (ret !=0 )return -EFAULT ; +mutex_lock (&client->device->client_list_mutex); + client->bus_reset_closure = a->bus_reset_closure;if (a->bus_reset !=0 ) {fill_bus_reset_event (&bus_reset, client); -if (copy_to_user (u64_to_uptr (a->bus_reset), - &bus_reset,sizeof (bus_reset))) -return -EFAULT ; + ret =copy_to_user (u64_to_uptr (a->bus_reset), + &bus_reset,sizeof (bus_reset)); } +if (ret ==0 &&list_empty (&client->link)) +list_add_tail (&client->link, &client->device->client_list); -return 0 ; +mutex_unlock (&client->device->client_list_mutex); + +return ret ? -EFAULT :0 ; } static int add_client_resource(struct client *client,
include/linux/firewire-cdev.h +3 -0
@@ -475,6 +475,9 @@ union fw_cdev_event {* of the bus. This does not cause a bus reset to happen. * @bus_reset_closure: Value of &closure in this and subsequent bus reset events * @card: The index of the card this device belongs to +* +* As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2) +* is started by this ioctl. */ struct fw_cdev_get_info {__u32 version;
PATCH 64/102 cciss: do not attempt to read from a write-only register
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "Stephen M. Cameron" <[email protected]>
commit 07d0c38e7d84f911c72058a124c7f17b3c779a65 upstream.
Most smartarrays will tolerate it, but some new ones don't.
Note: this is a regression caused by commit 1ddd5049
--- drivers/block/cciss.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/cciss.h +1 -1
@@ -223,7 +223,7 @@ static void SA5_submit_command( ctlr_inf h->ctlr, c->busaddr);#endif /* CCISS_DEBUG */ writel (c->busaddr, h->vaddr +SA5_REQUEST_PORT_OFFSET ); -readl (h->vaddr +SA5_REQUEST_PORT_OFFSET ); +readl (h->vaddr +SA5_SCRATCHPAD_OFFSET ); h->commands_outstanding++;if ( h->commands_outstanding > h->max_outstanding) h->max_outstanding = h->commands_outstanding;
PATCH 22/102 ASoC: Mark cache as dirty when suspending
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mark Brown <[email protected]>
commit 7be4ba24a3ea53bc8ade841635e4d4a59e98ceb5 upstream.
Since quite a few drivers are not managing to flag the cache as needing to be resynced after suspend and it's a reasonable thing to do flag the cache as needing sync automatically when suspending.
The expectation is that systems will mainly only keep the CODEC powered when doing audio through the CODEC so we won't actually suspend the device anyway; drivers which want to can override this behaviour when they resume.
--- sound/soc/soc-core.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/soc-core.c +1 -0
@@ -1124,6 +1124,7 @@ int snd_soc_suspend(struct device *dev)case SND_SOC_BIAS_OFF : codec->driver->suspend (codec,PMSG_SUSPEND ); codec->suspended =1 ; + codec->cache_sync =1 ;break ;default :dev_dbg (codec->dev,"CODEC is on over suspend\n" );
PATCH 66/102 geode: reflect mfgpt dependency on mfd
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "Philip A. Prindeville" <[email protected]>
commit 703f03c896fdbd726b809066ae279df513992f0e upstream.
As stated in drivers/mfd/cs5535-mfd.c, the mfd driver exposes the BARs which then make the GPIO, MFGPT, ACPI, etc. all visible to the system.
So the dependencies of the MFGPT stuff have changed, and most people expect Kconfig to bring in the necessary dependencies. Without them, the module fails to load and most people don't understand why because the details of the rewrite aren't captured anywhere most people who know to look.
This dependency needs to be reflected in Kconfig.
--- drivers/misc/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/misc/Kconfig +1 -2
@@ -245,8 +245,7 @@ config SGI_XP config CS5535_MFGPT tristate "CS5535/CS5536 Geode Multi-Function General Purpose Timer (MFGPT) support" - depends on PCI - depends on X86 + depends on PCI && X86 && MFD_CS5535 default n help This driver provides access to MFGPT functionality for other
PATCH 67/102 mm/futex: fix futex writes on archs with SW tracking of dirty & young
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit 2efaca927f5cd7ecd0f1554b8f9b6a9a2c329c03 upstream.
I haven't reproduced it myself but the fail scenario is that on such machines (notably ARM and some embedded powerpc), if you manage to hit that futex path on a writable page whose dirty bit has gone from the PTE, you'll livelock inside the kernel from what I can tell.
It will go in a loop of trying the atomic access, failing, trying gup to "fix it up", getting succcess from gup, go back to the atomic access, failing again because dirty wasn't fixed etc...
So I think you essentially hang in the kernel.
The scenario is probably rare'ish because affected architecture are embedded and tend to not swap much (if at all) so we probably rarely hit the case where dirty is missing or young is missing, but I think Shan has a piece of SW that can reliably reproduce it using a shared writable mapping & fork or something like that.
On archs who use SW tracking of dirty & young, a page without dirty is effectively mapped read-only and a page without young unaccessible in the PTE.
Additionally, some architectures might lazily flush the TLB when relaxing write protection (by doing only a local flush), and expect a fault to invalidate the stale entry if it's still present on another processor.
The futex code assumes that if the "in_atomic()" access -EFAULT's, it can "fix it up" by causing get_user_pages() which would then be equivalent to taking the fault.
However that isn't the case. get_user_pages() will not call handle_mm_fault() in the case where the PTE seems to have the right permissions, regardless of the dirty and young state. It will eventually update those bits ... in the struct page, but not in the PTE.
Additionally, it will not handle the lazy TLB flushing that can be required by some architectures in the fault case.
Basically, gup is the wrong interface for the job. The patch provides a more appropriate one which boils down to just calling handle_mm_fault() since what we are trying to do is simulate a real page fault.
The futex code currently attempts to write to user memory within a pagefault disabled section, and if that fails, tries to fix it up using get_user_pages().
This doesn't work on archs where the dirty and young bits are maintained by software, since they will gate access permission in the TLB, and will not be updated by gup().
In addition, there's an expectation on some archs that a spurious write fault triggers a local TLB flush, and that is missing from the picture as well.
I decided that adding those "features" to gup() would be too much for this already too complex function, and instead added a new simpler fixup_user_fault() which is essentially a wrapper around handle_mm_fault() which the futex code can call.
--- include/linux/mm.h | 2 + kernel/futex.c | 4 +-- mm/memory.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 3 deletions(-)
include/linux/mm.h +2 -0
@@ -985,6 +985,8 @@ int get_user_pages(struct task_struct *tint get_user_pages_fast (unsigned long start,int nr_pages,int write,struct page **pages);struct page *get_dump_page (unsigned long addr); +extern int fixup_user_fault (struct task_struct *tsk,struct mm_struct *mm, +unsigned long address,unsigned int fault_flags);extern int try_to_release_page (struct page * page,gfp_t gfp_mask);extern void do_invalidatepage (struct page *page,unsigned long offset);
kernel/futex.c +2 -2
@@ -355,8 +355,8 @@ static int fault_in_user_writeable(u32 _int ret;down_read (&mm->mmap_sem); - ret =get_user_pages (current, mm, (unsigned long )uaddr, -1 ,1 ,0 ,NULL ,NULL ); + ret =fixup_user_fault (current, mm, (unsigned long )uaddr, +FAULT_FLAG_WRITE );up_read (&mm->mmap_sem);return ret <0 ? ret :0 ;
mm/memory.c +57 -1
64 lines not on this page · raw message
PATCH 70/102 ext4: fix i_blocks/quota accounting when extent insertion fails
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Maxim Patlasov <[email protected]>
commit 7132de744ba76930d13033061018ddd7e3e8cd91 upstream.
The current implementation of ext4_free_blocks() always calls dquot_free_block This looks quite sensible in the most cases: blocks to be freed are associated with inode and were accounted in quota and i_blocks some time ago.
However, there is a case when blocks to free were not accounted by the time calling ext4_free_blocks() yet:
1. delalloc is on, write_begin pre-allocated some space in quota
2. write-back happens, ext4 allocates some blocks in ext4_ext_map_blocks()
3. then ext4_ext_map_blocks() gets an error (e.g. ENOSPC) from ext4_ext_insert_extent() and calls ext4_free_blocks().
In this scenario, ext4_free_blocks() calls dquot_free_block() who, in turn, decrements i_blocks for blocks which were not accounted yet (due to delalloc) After clean umount, e2fsck reports something like:
Quoted 1 line
Inode 21,
i_blocksis 5080, should be 5128. Fix<y>?
because i_blocks was erroneously decremented as explained above.
The patch fixes the problem by passing the new flag EXT4_FREE_BLOCKS_NO_QUOT_UPDATE to ext4_free_blocks(), to request that the dquot_free_block() call be skipped.
--- fs/ext4/ext4.h | 1 + fs/ext4/extents.c | 4 +++- fs/ext4/mballoc.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -526,6 +526,7 @@ struct ext4_new_group_data {#define EXT4_FREE_BLOCKS_METADATA 0x0001#define EXT4_FREE_BLOCKS_FORGET 0x0002#define EXT4_FREE_BLOCKS_VALIDATED 0x0004 +#define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008/* * ioctl commands
fs/ext4/extents.c +3 -1
@@ -3601,12 +3601,14 @@ int ext4_ext_map_blocks(handle_t *handle err =ext4_ext_insert_extent (handle, inode, path, &newex, flags);if (err) { +int fb_flags = flags &EXT4_GET_BLOCKS_DELALLOC_RESERVE ? +EXT4_FREE_BLOCKS_NO_QUOT_UPDATE :0 ;/* free data blocks we just allocated */ /* not a good idea to call discard here directly, * but otherwise we'd need to call it every free() */ ext4_discard_preallocations (inode);ext4_free_blocks (handle, inode,NULL ,ext4_ext_pblock (&newex), -ext4_ext_get_actual_len (&newex),0 ); +ext4_ext_get_actual_len (&newex), fb_flags); goto out2; }
fs/ext4/mballoc.c +1 -1
@@ -4637,7 +4637,7 @@ do_more: }ext4_mark_super_dirty (sb); error_return: -if (freed) +if (freed && !(flags &EXT4_FREE_BLOCKS_NO_QUOT_UPDATE ))dquot_free_block (inode, freed);brelse (bitmap_bh);ext4_std_error (sb, err);
PATCH 69/102 xtensa: prevent arbitrary read in ptrace
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit 0d0138ebe24b94065580bd2601f8bb7eb6152f56 upstream.
Prevent an arbitrary kernel read. Check the user pointer with access_ok() before copying data in.
--- arch/xtensa/kernel/ptrace.c | 3 +++ 1 file changed, 3 insertions(+)
arch/xtensa/kernel/ptrace.c +3 -0
@@ -147,6 +147,9 @@ int ptrace_setxregs(struct task_struct *elf_xtregs_t *xtregs = uregs;int ret =0 ; +if (!access_ok (VERIFY_READ , uregs,sizeof (elf_xtregs_t))) +return -EFAULT ; +#if XTENSA_HAVE_COPROCESSORS /* Flush all coprocessors before we overwrite them. */ coprocessor_flush_all (ti);
PATCH 73/102 ecryptfs: Make inode bdi consistent with superblock bdi
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thieu Le <[email protected]>
commit 985ca0e626e195ea08a1a82b8dbeb6719747429a upstream.
Make the inode mapping bdi consistent with the superblock bdi so that dirty pages are flushed properly.
--- fs/ecryptfs/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/ecryptfs/inode.c +1 -0
@@ -69,6 +69,7 @@ static int ecryptfs_inode_set(struct ino inode->i_ino = lower_inode->i_ino; inode->i_version++; inode->i_mapping->a_ops = &ecryptfs_aops; + inode->i_mapping->backing_dev_info = inode->i_sb->s_bdi;if (S_ISLNK (inode->i_mode)) inode->i_op = &ecryptfs_symlink_iops;
PATCH 74/102 eCryptfs: Unlock keys needed by ecryptfsd
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tyler Hicks <[email protected]>
commit b2987a5e05ec7a1af7ca42e5d5349d7a22753031 upstream.
Fixes a regression caused by b5695d04634fa4ccca7dcbc05bb4a66522f02e0b
Kernel keyring keys containing eCryptfs authentication tokens should not be write locked when calling out to ecryptfsd to wrap and unwrap file encryption keys. The eCryptfs kernel code can not hold the key's write lock because ecryptfsd needs to request the key after receiving such a request from the kernel.
Without this fix, all file opens and creates will timeout and fail when using the eCryptfs PKI infrastructure. This is not an issue when using passphrase-based mount keys, which is the most widely deployed eCryptfs configuration.
--- fs/ecryptfs/keystore.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-)
fs/ecryptfs/keystore.c +25 -22
@@ -1868,11 +1868,6 @@ int ecryptfs_parse_packet_set(struct ecr* just one will be sufficient to decrypt to get the FEK. */ find_next_matching_auth_tok: found_auth_tok =0 ; -if (auth_tok_key) { -up_write (&(auth_tok_key->sem)); -key_put (auth_tok_key); - auth_tok_key =NULL ; - }list_for_each_entry (auth_tok_list_item, &auth_tok_list, list) { candidate_auth_tok = &auth_tok_list_item->auth_tok;if (unlikely (ecryptfs_verbosity >0 )) {
@@ -1909,14 +1904,22 @@ found_matching_auth_tok:memcpy (&(candidate_auth_tok->token.private_key), &(matching_auth_tok->token.private_key),sizeof (struct ecryptfs_private_key )); +up_write (&(auth_tok_key->sem)); +key_put (auth_tok_key); rc =decrypt_pki_encrypted_session_key (candidate_auth_tok, crypt_stat); }else if (candidate_auth_tok->token_type ==ECRYPTFS_PASSWORD ) {memcpy (&(candidate_auth_tok->token.password), &(matching_auth_tok->token.password),sizeof (struct ecryptfs_password )); +up_write (&(auth_tok_key->sem)); +key_put (auth_tok_key); rc =decrypt_passphrase_encrypted_session_key ( candidate_auth_tok, crypt_stat); + }else { +up_write (&(auth_tok_key->sem)); +key_put (auth_tok_key); + rc = -EINVAL ; }if (rc) {struct ecryptfs_auth_tok_list_item *auth_tok_list_item_tmp;
@@ -1956,15 +1959,12 @@ found_matching_auth_tok: out_wipe_list:wipe_auth_tok_list (&auth_tok_list); out: -if (auth_tok_key) { -up_write (&(auth_tok_key->sem)); -key_put (auth_tok_key); - }return rc; }static int -pki_encrypt_session_key (struct ecryptfs_auth_tok *auth_tok, +pki_encrypt_session_key (struct key *auth_tok_key, +struct ecryptfs_auth_tok *auth_tok,struct ecryptfs_crypt_stat *crypt_stat,struct ecryptfs_key_record *key_rec) {
@@ -1979,6 +1979,8 @@ pki_encrypt_session_key(struct ecryptfs_ crypt_stat->cipher, crypt_stat->key_size), crypt_stat, &payload, &payload_len); +up_write (&(auth_tok_key->sem)); +key_put (auth_tok_key);if (rc) {ecryptfs_printk (KERN_ERR ,"Error generating tag 66 packet\n" ); goto out;
@@ -2008,6 +2010,8 @@ out:* write_tag_1_packet - Write an RFC2440-compatible tag 1 (public key) packet * @dest: Buffer into which to write the packet * @remaining_bytes: Maximum number of bytes that can be writtn +* @auth_tok_key: The authentication token key to unlock and put when done with +* @auth_tok * @auth_tok: The authentication token used for generating the tag 1 packet * @crypt_stat: The cryptographic context * @key_rec: The key record struct for the tag 1 packet
@@ -2018,7 +2022,7 @@ out:*/ static int write_tag_1_packet (char *dest,size_t *remaining_bytes, -struct ecryptfs_auth_tok *auth_tok, +struct key *auth_tok_key,struct ecryptfs_auth_tok *auth_tok,struct ecryptfs_crypt_stat *crypt_stat,struct ecryptfs_key_record *key_rec,size_t *packet_size) {
@@ -2039,12 +2043,15 @@ write_tag_1_packet(char *dest, size_t *rmemcpy (key_rec->enc_key, auth_tok->session_key.encrypted_key, auth_tok->session_key.encrypted_key_size); +up_write (&(auth_tok_key->sem)); +key_put (auth_tok_key); goto encrypted_session_key_set; }if (auth_tok->session_key.encrypted_key_size ==0 ) auth_tok->session_key.encrypted_key_size = auth_tok->token.private_key.key_size; - rc =pki_encrypt_session_key (auth_tok, crypt_stat, key_rec); + rc =pki_encrypt_session_key (auth_tok_key, auth_tok, crypt_stat, + key_rec);if (rc) {printk (KERN_ERR "Failed to encrypt session key via a key " "module; rc = [%d]\n" , rc);
@@ -2421,6 +2428,8 @@ ecryptfs_generate_key_packet_set(char *d &max, auth_tok, crypt_stat, key_rec, &written); +up_write (&(auth_tok_key->sem)); +key_put (auth_tok_key);if (rc) {ecryptfs_printk (KERN_WARNING ,"Error " "writing tag 3 packet\n" );
@@ -2438,8 +2447,8 @@ ecryptfs_generate_key_packet_set(char *d } (*len) += written; }else if (auth_tok->token_type ==ECRYPTFS_PRIVATE_KEY ) { - rc =write_tag_1_packet (dest_base + (*len), - &max, auth_tok, + rc =write_tag_1_packet (dest_base + (*len), &max, + auth_tok_key, auth_tok, crypt_stat, key_rec, &written);if (rc) { ecryptfs_printk(KERN_WARNING, "Error "
@@ -2448,14 +2457,13 @@ ecryptfs_generate_key_packet_set(char *d } (*len) += written; }else { +up_write (&(auth_tok_key->sem)); +key_put (auth_tok_key);ecryptfs_printk (KERN_WARNING ,"Unsupported " "authentication token type\n" ); rc = -EINVAL ; goto out_free; } -up_write (&(auth_tok_key->sem)); -key_put (auth_tok_key); - auth_tok_key =NULL ; }if (likely (max >0 )) { dest_base[(*len)] =0x00 ;
@@ -2468,11 +2476,6 @@ out_free: out:if (rc) (*len) =0 ; -if (auth_tok_key) { -up_write (&(auth_tok_key->sem)); -key_put (auth_tok_key); - } -mutex_unlock (&crypt_stat->keysig_list_mutex);return rc; }
PATCH 75/102 nfsd: dont break lease on CLAIM_DELEGATE_CUR
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Casey Bodley <[email protected]>
commit 0c12eaffdf09466f36a9ffe970dda8f4aeb6efc0 upstream.
CLAIM_DELEGATE_CUR is used in response to a broken lease; allowing it to break the lease and return EAGAIN leaves the client unable to make progress in returning the delegation
nfs4_get_vfs_file() now takes struct nfsd4_open for access to the claim type, and calls nfsd_open() with NFSD_MAY_NOT_BREAK_LEASE when claim type is CLAIM_DELEGATE_CUR
--- fs/nfsd/nfs4state.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
fs/nfsd/nfs4state.c +12 -6
@@ -2556,12 +2556,18 @@ static inline int nfs4_access_to_access(return flags; } -static __be32 nfs4_get_vfs_file (struct svc_rqst *rqstp,struct nfs4_file -*fp,struct svc_fh *cur_fh,u32 nfs4_access) +static __be32 nfs4_get_vfs_file (struct svc_rqst *rqstp,struct nfs4_file *fp, +struct svc_fh *cur_fh,struct nfsd4_open *open) {__be32 status; -int oflag =nfs4_access_to_omode (nfs4_access); -int access =nfs4_access_to_access (nfs4_access); +int oflag =nfs4_access_to_omode (open->op_share_access); +int access =nfs4_access_to_access (open->op_share_access); + +/* CLAIM_DELEGATE_CUR is used in response to a broken lease; +* allowing it to break the lease and return EAGAIN leaves the +* client unable to make progress in returning the delegation */ +if (open->op_claim_type ==NFS4_OPEN_CLAIM_DELEGATE_CUR ) + access |=NFSD_MAY_NOT_BREAK_LEASE ;if (!fp->fi_fds[oflag]) { status = nfsd_open(rqstp, cur_fh, S_IFREG, access,
@@ -2586,7 +2592,7 @@ nfs4_new_open(struct svc_rqst *rqstp, stif (stp ==NULL )return nfserr_resource; - status =nfs4_get_vfs_file (rqstp, fp, cur_fh, open->op_share_access); + status =nfs4_get_vfs_file (rqstp, fp, cur_fh, open);if (status) {kmem_cache_free (stateid_slab, stp);return status;
@@ -2619,7 +2625,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp new_access = !test_bit (op_share_access, &stp->st_access_bmap);if (new_access) { - status =nfs4_get_vfs_file (rqstp, fp, cur_fh, op_share_access); + status =nfs4_get_vfs_file (rqstp, fp, cur_fh, open);if (status)return status; }
PATCH 76/102 nfsd4: remember to put RW access on stateid destruction
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 499f3edc23ca0431f3a0a6736b3a40944c81bf3b upstream.
Without this, for example,
open read
open read+write
close
will result in a struct file leak.
Regression from 7d94784293096c0a46897acdb83be5abd9278ece "nfsd4: fix downgrade/lock logic".
--- fs/nfsd/nfs4state.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
fs/nfsd/nfs4state.c +6 -11
@@ -381,14 +381,6 @@ static int nfs4_access_to_omode(u32 acceBUG (); } -static int nfs4_access_bmap_to_omode (struct nfs4_stateid *stp) -{ -unsigned int access; - -set_access (&access, stp->st_access_bmap); -return nfs4_access_to_omode (access); -} -static void unhash_generic_stateid (struct nfs4_stateid *stp) {list_del (&stp->st_hash);
@@ -398,11 +390,14 @@ static void unhash_generic_stateid(strucstatic void free_generic_stateid (struct nfs4_stateid *stp) { -int oflag; +int i;if (stp->st_access_bmap) { - oflag =nfs4_access_bmap_to_omode (stp); -nfs4_file_put_access (stp->st_file, oflag); +for (i =1 ; i <4 ; i++) { +if (test_bit (i, &stp->st_access_bmap)) +nfs4_file_put_access (stp->st_file, +nfs4_access_to_omode (i)); + } }put_nfs4_file (stp->st_file);kmem_cache_free (stateid_slab, stp);
PATCH 78/102 svcrpc: fix list-corrupting race on nfsd shutdown
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit ebc63e531cc6a457595dd110b07ac530eae788c3 upstream.
After commit 3262c816a3d7fb1eaabce633caa317887ed549ae "[PATCH] knfsd:
split svc_serv into pools", svc_delete_xprt (then svc_delete_socket) no longer removed its xpt_ready (then sk_ready) field from whatever list it was on, noting that there was no point since the whole list was about to be destroyed anyway.
That was mostly true, but forgot that a few svc_xprt_enqueue()'s might still be hanging around playing with the about-to-be-destroyed list, and could get themselves into trouble writing to freed memory if we left this xprt on the list after freeing it.
(This is actually functionally identical to a patch made first by Ben Greear, but with more comments.)
--- net/sunrpc/svc_xprt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/sunrpc/svc_xprt.c +6 -5
@@ -902,12 +902,13 @@ void svc_delete_xprt(struct svc_xprt *xpif (!test_and_set_bit (XPT_DETACHED , &xprt->xpt_flags))list_del_init (&xprt->xpt_list);/* -* We used to delete the transport from whichever list -* it's sk_xprt.xpt_ready node was on, but we don't actually -* need to. This is because the only time we're called -* while still attached to a queue, the queue itself -* is about to be destroyed (in svc_destroy). +* The only time we're called while xpt_ready is still on a list +* is while the list itself is about to be destroyed (in +* svc_destroy). BUT svc_xprt_enqueue could still be attempting +* to add new entries to the sp_sockets list, so we can't leave +* a freed xprt on it. */ +list_del_init (&xprt->xpt_ready);if (test_bit (XPT_TEMP , &xprt->xpt_flags)) serv->sv_tmpcnt--;spin_unlock_bh (&serv->sv_lock);
PATCH 79/102 NFSv4: Dont use the delegation->inode in nfs_mark_return_delegation()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <[email protected]>
commit ed1e6211a0a134ff23592c6f057af982ad5dab52 upstream.
nfs_mark_return_delegation() is usually called without any locking, and so it is not safe to dereference delegation->inode. Since the inode is only used to discover the nfs_client anyway, it makes more sense to have the callers pass a valid pointer to the nfs_server as a parameter.
--- fs/nfs/delegation.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/nfs/delegation.c +8 -8
@@ -398,12 +398,11 @@ int nfs_inode_return_delegation(struct ireturn err; } -static void nfs_mark_return_delegation (struct nfs_delegation *delegation) +static void nfs_mark_return_delegation (struct nfs_server *server, +struct nfs_delegation *delegation) { -struct nfs_client *clp =NFS_SERVER (delegation->inode)->nfs_client; -set_bit (NFS_DELEGATION_RETURN , &delegation->flags); -set_bit (NFS4CLNT_DELEGRETURN , &clp->cl_state); +set_bit (NFS4CLNT_DELEGRETURN , &server->nfs_client->cl_state); }/**
@@ -441,7 +440,7 @@ static void nfs_mark_return_all_delegatiif ((delegation->type == (FMODE_READ |FMODE_WRITE )) && !(flags &FMODE_WRITE ))continue ;if (delegation->type & flags) -nfs_mark_return_delegation (delegation); +nfs_mark_return_delegation (server, delegation); } }
@@ -508,7 +507,7 @@ static void nfs_mark_return_unreferencedlist_for_each_entry_rcu (delegation, &server->delegations, super_list) {if (test_and_clear_bit (NFS_DELEGATION_REFERENCED , &delegation->flags))continue ; -nfs_mark_return_delegation (delegation); +nfs_mark_return_delegation (server, delegation); } }
@@ -539,7 +538,8 @@ void nfs_expire_unreferenced_delegationsint nfs_async_inode_return_delegation (struct inode *inode,const nfs4_stateid *stateid) { -struct nfs_client *clp =NFS_SERVER (inode)->nfs_client; +struct nfs_server *server =NFS_SERVER (inode); +struct nfs_client *clp = server->nfs_client;struct nfs_delegation *delegation;rcu_read_lock ();
@@ -549,7 +549,7 @@ int nfs_async_inode_return_delegation(strcu_read_unlock ();return -ENOENT ; } -nfs_mark_return_delegation (delegation); +nfs_mark_return_delegation (server, delegation);rcu_read_unlock ();nfs_delegation_run_state_manager (clp);
PATCH 81/102 proc: fix a race in do_io_accounting()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vasiliy Kulikov <[email protected]>
commit 293eb1e7772b25a93647c798c7b89bf26c2da2e0 upstream.
If an inode's mode permits opening /proc/PID/io and the resulting file descriptor is kept across execve() of a setuid or similar binary, the ptrace_may_access() check tries to prevent using this fd against the task with escalated privileges.
Unfortunately, there is a race in the check against execve(). If execve() is processed after the ptrace check, but before the actual io information gathering, io statistics will be gathered from the privileged process. At least in theory this might lead to gathering sensible information (like ssh/ftp password length) that wouldn't be available otherwise.
Holding task->signal->cred_guard_mutex while gathering the io information should protect against the race.
The order of locking is similar to the one inside of ptrace_attach():
first goes cred_guard_mutex, then lock_task_sighand().
--- fs/proc/base.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
fs/proc/base.c +13 -3
@@ -2707,9 +2707,16 @@ static int do_io_accounting(struct task_ {struct task_io_accounting acct = task->ioac;unsigned long flags; +int result; -if (!ptrace_may_access (task,PTRACE_MODE_READ )) -return -EACCES ; + result =mutex_lock_killable (&task->signal->cred_guard_mutex); +if (result) +return result; + +if (!ptrace_may_access (task,PTRACE_MODE_READ )) { + result = -EACCES ; + goto out_unlock; + }if (whole &&lock_task_sighand (task, &flags)) {struct task_struct *t = task;
@@ -2720,7 +2727,7 @@ static int do_io_accounting(struct task_unlock_task_sighand (task, &flags); } -return sprintf (buffer, + result =sprintf (buffer,"rchar: %llu\n" "wchar: %llu\n" "syscr: %llu\n"
@@ -2735,6 +2742,9 @@ static int do_io_accounting(struct task_ (unsigned long long )acct.read_bytes, (unsigned long long )acct.write_bytes, (unsigned long long)acct.cancelled_write_bytes); +out_unlock: +mutex_unlock (&task->signal->cred_guard_mutex); +return result; }static int proc_tid_io_accounting (struct task_struct *task,char *buffer)
PATCH 83/102 EHCI: only power off port if over-current is active
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sergei Shtylyov <[email protected]>
commit 81463c1d707186adbbe534016cd1249edeab0dac upstream.
MAX4967 USB power supply chip we use on our boards signals over-current when power is not enabled; once it's enabled, over-current signal returns to normal. That unfortunately caused the endless stream of "over-current change on port" messages. The EHCI root hub code reacts on every over-current signal change with powering off the port -- such change event is generated the moment the port power is enabled, so once enabled the power is immediately cut off. I think we should only cut off power when we're seeing the active over-current signal, so I'm adding such check to that code. I also think that the fact that we've cut off the port power should be reflected in the result of GetPortStatus request immediately, hence I'm adding a PORTSCn register readback after write...
--- drivers/usb/host/ehci-hub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-hub.c +2 -1
@@ -891,10 +891,11 @@ static int ehci_hub_control (* power switching; they're allowed to just limit the * current. khubd will turn the power back on. */ -if (HCS_PPC (ehci->hcs_params)){ +if ((temp &PORT_OC ) &&HCS_PPC (ehci->hcs_params)) {ehci_writel (ehci, temp & ~(PORT_RWC_BITS |PORT_POWER ), status_reg); + temp =ehci_readl (ehci, status_reg); } }
PATCH 84/102 EHCI: fix direction handling for interrupt data toggles
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit e04f5f7e423018bcec84c11af2058cdce87816f3 upstream.
This patch (as1480) fixes a rather obscure bug in ehci-hcd. The qh_update() routine needs to know the number and direction of the endpoint corresponding to its QH argument. The number can be taken directly from the QH data structure, but the direction isn't stored there. The direction is taken instead from the first qTD linked to the QH.
However, it turns out that for interrupt transfers, qh_update() gets called before the qTDs are linked to the QH. As a result, qh_update() computes a bogus direction value, which messes up the endpoint toggle handling. Under the right combination of circumstances this causes usb_reset_endpoint() not to work correctly, which causes packets to be dropped and communications to fail.
Now, it's silly for the QH structure not to have direct access to all the descriptor information for the corresponding endpoint. Ultimately it may get a pointer to the usb_host_endpoint structure; for now, adding a copy of the direction flag solves the immediate problem.
This allows the Spyder2 color-calibration system (a low-speed USB device that sends all its interrupt data packets with the toggle set to 0 and hance requires constant use of usb_reset_endpoint) to work when connected through a high-speed hub. Thanks to Graeme Gill for supplying the hardware that allowed me to track down this bug.
--- drivers/usb/host/ehci-q.c | 3 ++- drivers/usb/host/ehci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-q.c +2 -1
@@ -103,7 +103,7 @@ qh_update (struct ehci_hcd *ehci, structif (!(hw->hw_info1 &cpu_to_hc32 (ehci,1 <<14 ))) {unsigned is_out, epnum; - is_out = !(qtd->hw_token &cpu_to_hc32 (ehci,1 <<8 )); + is_out = qh->is_out; epnum = (hc32_to_cpup (ehci, &hw->hw_info1) >>8 ) &0x0f ;if (unlikely (!usb_gettoggle (qh->dev, epnum, is_out))) { hw->hw_token &= ~cpu_to_hc32 (ehci,QTD_TOGGLE );
@@ -946,6 +946,7 @@ done: hw = qh->hw; hw->hw_info1 =cpu_to_hc32 (ehci, info1); hw->hw_info2 =cpu_to_hc32 (ehci, info2); + qh->is_out = !is_input;usb_settoggle (urb->dev,usb_pipeendpoint (urb->pipe), !is_input,1 );qh_refresh (ehci, qh);return qh;
drivers/usb/host/ehci.h +1 -0
@@ -375,6 +375,7 @@ struct ehci_qh {#define NO_FRAME ((unsigned short)~0)/* pick new start */ struct usb_device *dev;/* access to TT */ + unsigned is_out:1; /* bulk or intr OUT */ unsigned clearing_tt:1; /* Clear-TT-Buf in progress */ };
PATCH 58/102 powerpc/kdump: Fix timeout in crash_kexec_wait_realmode
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michael Neuling <[email protected]>
commit 63f21a56f1cc0b800a4c00349c59448f82473d19 upstream.
The existing code it pretty ugly. How about we clean it up even more like this?
From: Anton Blanchard <[email protected]>
We check for timeout expiry in the outer loop, but we also need to check it in the inner loop or we can lock up forever waiting for a CPU to hit real mode.
--- arch/powerpc/kernel/crash.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/powerpc/kernel/crash.c +1 -5
@@ -242,12 +242,8 @@ static void crash_kexec_wait_realmode(inwhile (paca[i].kexec_state <KEXEC_STATE_REAL_MODE ) {barrier (); -if (!cpu_possible (i)) { +if (!cpu_possible (i) || !cpu_online (i) || (msecs <=0 ))break ; - } -if (!cpu_online (i)) { -break ; - } msecs--;mdelay (1 ); }
PATCH 57/102 oprofile, x86: Fix nmi-unsafe callgraph support
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Robert Richter <[email protected]>
commit a0e3e70243f5b270bc3eca718f0a9fa5e6b8262e upstream.
Current oprofile's x86 callgraph support may trigger page faults throwing the BUG_ON(in_nmi()) message below. This patch fixes this by using the same nmi-safe copy-from-user code as in perf.
------------[ cut here ]------------ kernel BUG at .../arch/x86/kernel/traps.c:436! invalid opcode: 0000 [#1] SMP last sysfs file: /sys/devices/pci0000:00/0000:00:0a.0/0000:07:00.0/0000:08:04.0/net/eth0/broadcast CPU 5 Modules linked in:
Pid: 8611, comm: opcontrol Not tainted 2.6.39-00007-gfe47ae7 #1 Advanced Micro Device Anaheim/Anaheim
RIP: 0010:[<ffffffff813e8e35>] [<ffffffff813e8e35>] do_nmi+0x22/0x1ee RSP: 0000:ffff88042fd47f28 EFLAGS: 00010002 RAX: ffff88042c0a7fd8 RBX: 0000000000000001 RCX: 00000000c0000101 RDX: 00000000ffff8804 RSI: ffffffffffffffff RDI: ffff88042fd47f58 RBP: ffff88042fd47f48 R08: 0000000000000004 R09: 0000000000001484 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88042fd47f58 R13: 0000000000000000 R14: ffff88042fd47d98 R15: 0000000000000020 FS: 00007fca25e56700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000074 CR3: 000000042d28b000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process opcontrol (pid: 8611, threadinfo ffff88042c0a6000, task ffff88042c532310) Stack: 0000000000000000 0000000000000001 ffff88042c0a7fd8 0000000000000000 ffff88042fd47de8 ffffffff813e897a 0000000000000020 ffff88042fd47d98 0000000000000000 ffff88042c0a7fd8 ffff88042fd47de8 0000000000000074 Call Trace: <NMI> [<ffffffff813e897a>] nmi+0x1a/0x20 [<ffffffff813f08ab>] ? bad_to_user+0x25/0x771 <<EOE>> Code: ff 59 5b 41 5c 41 5d c9 c3 55 65 48 8b 04 25 88 b5 00 00 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 f6 80 47 e0 ff ff 04 74 04 <0f> 0b eb fe 81 80 44 e0 ff ff 00 00 01 04 65 ff 04 25 c4 0f 01 RIP [<ffffffff813e8e35>] do_nmi+0x22/0x1ee RSP <ffff88042fd47f28> ---[ end trace ed6752185092104b ]--- Kernel panic - not syncing: Fatal exception in interrupt Pid: 8611, comm: opcontrol Tainted: G D 2.6.39-00007-gfe47ae7 #1 Call Trace: <NMI> [<ffffffff813e5e0a>] panic+0x8c/0x188 [<ffffffff813e915c>] oops_end+0x81/0x8e [<ffffffff8100403d>] die+0x55/0x5e [<ffffffff813e8c45>] do_trap+0x11c/0x12b [<ffffffff810023c8>] do_invalid_op+0x91/0x9a [<ffffffff813e8e35>] ? do_nmi+0x22/0x1ee [<ffffffff8131e6fa>] ? oprofile_add_sample+0x83/0x95 [<ffffffff81321670>] ? op_amd_check_ctrs+0x4f/0x2cf [<ffffffff813ee4d5>] invalid_op+0x15/0x20 [<ffffffff813e8e35>] ? do_nmi+0x22/0x1ee [<ffffffff813e8e7a>] ? do_nmi+0x67/0x1ee [<ffffffff813e897a>] nmi+0x1a/0x20 [<ffffffff813f08ab>] ? bad_to_user+0x25/0x771 <<EOE>>
--- arch/x86/oprofile/backtrace.c | 56 +++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-)
arch/x86/oprofile/backtrace.c +47 -9
@@ -11,10 +11,12 @@#include <linux/oprofile.h> #include <linux/sched.h> #include <linux/mm.h> +#include <linux/compat.h> +#include <linux/highmem.h> +#include <asm/ptrace.h> #include <asm/uaccess.h> #include <asm/stacktrace.h> -#include <linux/compat.h> static int backtrace_stack (void *data,char *name) {
@@ -36,17 +38,53 @@ static struct stacktrace_ops backtrace_o .walk_stack = print_context_stack, }; +/* from arch/x86/kernel/cpu/perf_event.c: */ + +/* +* best effort, GUP based copy_from_user() that assumes IRQ or NMI context +*/ +static unsigned long +copy_from_user_nmi (void *to,const void __user *from,unsigned long n) +{ +unsigned long offset, addr = (unsigned long )from; +unsigned long size, len =0 ; +struct page *page; +void *map; +int ret; + +do { + ret =__get_user_pages_fast (addr,1 ,0 , &page); +if (!ret) +break ; + + offset = addr & (PAGE_SIZE -1 ); + size =min (PAGE_SIZE - offset, n - len); + + map =kmap_atomic (page); +memcpy (to, map+offset, size); +kunmap_atomic (map); +put_page (page); + + len += size; + to += size; + addr += size; + + }while (len < n); + +return len; +} +#ifdef CONFIG_COMPAT static struct stack_frame_ia32 *dump_user_backtrace_32 (struct stack_frame_ia32 *head) { +/* Also check accessibility of one struct frame_head beyond: */ struct stack_frame_ia32 bufhead[2 ];struct stack_frame_ia32 *fp; +unsigned long bytes; -/* Also check accessibility of one struct frame_head beyond */ -if (!access_ok (VERIFY_READ , head,sizeof (bufhead))) -return NULL ; -if (__copy_from_user_inatomic (bufhead, head,sizeof (bufhead))) + bytes =copy_from_user_nmi (bufhead, head,sizeof (bufhead)); +if (bytes !=sizeof (bufhead))return NULL ; fp = (struct stack_frame_ia32 *)compat_ptr (bufhead[0 ].next_frame);
@@ -87,12 +125,12 @@ x86_backtrace_32(struct pt_regs * conststatic struct stack_frame *dump_user_backtrace (struct stack_frame *head) { +/* Also check accessibility of one struct frame_head beyond: */ struct stack_frame bufhead[2 ]; +unsigned long bytes; -/* Also check accessibility of one struct stack_frame beyond */ -if (!access_ok (VERIFY_READ , head,sizeof (bufhead))) -return NULL ; -if (__copy_from_user_inatomic (bufhead, head,sizeof (bufhead))) + bytes =copy_from_user_nmi (bufhead, head,sizeof (bufhead)); +if (bytes !=sizeof (bufhead))return NULL ;oprofile_add_trace (bufhead[0 ].return_address);
PATCH 61/102 tracing: Have "enable" file use refcounts like the "filter" file
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Steven Rostedt <[email protected]>
commit 40ee4dffff061399eb9358e0c8fcfbaf8de4c8fe upstream.
The "enable" file for the event system can be removed when a module is unloaded and the event system only has events from that module. As the event system nr_events count goes to zero, it may be freed if its ref_count is also set to zero.
Like the "filter" file, the "enable" file may be opened by a task and referenced later, after a module has been unloaded and the events for that event system have been removed.
Although the "filter" file referenced the event system structure, the "enable" file only references a pointer to the event system name. Since the name is freed when the event system is removed, it is possible that an access to the "enable" file may reference a freed pointer.
Update the "enable" file to use the subsystem_open() routine that the "filter" file uses, to keep a reference to the event system structure while the "enable" file is opened.
--- kernel/trace/trace_events.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
kernel/trace/trace_events.c +22 -9
@@ -557,7 +557,7 @@ system_enable_read(struct file *filp, ch loff_t *ppos) {const char set_to_char[4 ] = {'?' ,'0' ,'1' ,'X' }; -const char *system = filp->private_data; +struct event_subsystem *system = filp->private_data;struct ftrace_event_call *call;char buf[2 ];int set =0 ;
@@ -568,7 +568,7 @@ system_enable_read(struct file *filp, chif (!call->name || !call->class || !call->class->reg)continue ; -if (system &&strcmp (call->class->system, system) !=0 ) +if (system &&strcmp (call->class->system, system->name) !=0 )continue ;/*
@@ -598,7 +598,8 @@ static ssize_t system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { - const char *system = filp->private_data; + struct event_subsystem *system = filp->private_data; +const char *name =NULL ;unsigned long val;char buf[64 ];ssize_t ret;
@@ -622,7 +623,14 @@ system_enable_write(struct file *filp, cif (val !=0 && val !=1 )return -EINVAL ; - ret =__ftrace_set_clr_event (NULL , system,NULL , val); +/* +* Opening of "enable" adds a ref count to system, +* so the name is safe to use. +*/ +if (system) + name = system->name; + + ret =__ftrace_set_clr_event (NULL , name,NULL , val);if (ret) goto out;
@@ -862,6 +870,9 @@ static int subsystem_open(struct inode *struct event_subsystem *system =NULL ;int ret; +if (!inode->i_private) + goto skip_search; +/* Make sure the system still exists */ mutex_lock (&event_mutex);list_for_each_entry (system, &event_subsystems, list) {
@@ -880,8 +891,9 @@ static int subsystem_open(struct inode *if (system != inode->i_private)return -ENODEV ; + skip_search: ret =tracing_open_generic (inode, filp); -if (ret <0 ) +if (ret <0 && system)put_system (system);return ret;
@@ -891,7 +903,8 @@ static int subsystem_release(struct inod {struct event_subsystem *system = inode->i_private; -put_system (system); +if (system) +put_system (system);return 0 ; }
@@ -1041,10 +1054,11 @@ static const struct file_operations ftra };static const struct file_operations ftrace_system_enable_fops = { - .open = tracing_open_generic, + .open = subsystem_open, .read = system_enable_read, .write = system_enable_write, .llseek = default_llseek, + .release = subsystem_release, };static const struct file_operations ftrace_show_header_fops = {
@@ -1133,8 +1147,7 @@ event_subsystem_dir(const char *name, st "'%s/filter' entry\n", name); } -trace_create_file ("enable" ,0644 , system->entry, - (void *)system->name, +trace_create_file ("enable" ,0644 , system->entry, system, &ftrace_system_enable_fops);return system->entry;
PATCH 63/102 PCI: ARI is a PCIe v2 feature
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wright <[email protected]>
commit 864d296cf948aef0fa32b81407541572583f7572 upstream.
The function pci_enable_ari() may mistakenly set the downstream port of a v1 PCIe switch in ARI Forwarding mode. This is a PCIe v2 feature, and with an SR-IOV device on that switch port believing the switch above is ARI capable it may attempt to use functions 8-255, translating into invalid (non-zero) device numbers for that bus. This has been seen to cause Completion Timeouts and general misbehaviour including hangs and panics.
--- drivers/pci/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pci/pci.c +6 -1
@@ -1905,7 +1905,7 @@ void pci_enable_ari(struct pci_dev *dev) {int pos;u32 cap; -u16 ctrl; +u16 flags, ctrl;struct pci_dev *bridge;if (!pci_is_pcie (dev) || dev->devfn)
@@ -1923,6 +1923,11 @@ void pci_enable_ari(struct pci_dev *dev)if (!pos)return ; +/* ARI is a PCIe v2 feature */ +pci_read_config_word (bridge, pos +PCI_EXP_FLAGS , &flags); +if ((flags &PCI_EXP_FLAGS_VERS ) <2 ) +return ; +pci_read_config_dword (bridge, pos +PCI_EXP_DEVCAP2 , &cap);if (!(cap &PCI_EXP_DEVCAP2_ARI ))return ;
PATCH 85/102 cfg80211: really ignore the regulatory request
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sven Neumann <[email protected]>
commit a203c2aa4cefccb879c879b8e1cad1a09a679e55 upstream.
At the beginning of wiphy_update_regulatory() a check is performed whether the request is to be ignored. Then the request is sent to the driver nevertheless. This happens even if last_request points to NULL, leading to a crash in the driver:
[<bf01d864>] (lbs_set_11d_domain_info+0x28/0x1e4 [libertas]) from [<c03b714c>] (wiphy_update_regulatory+0x4d0/0x4f4) [<c03b714c>] (wiphy_update_regulatory+0x4d0/0x4f4) from [<c03b4008>] (wiphy_register+0x354/0x420) [<c03b4008>] (wiphy_register+0x354/0x420) from [<bf01b17c>] (lbs_cfg_register+0x80/0x164 [libertas]) [<bf01b17c>] (lbs_cfg_register+0x80/0x164 [libertas]) from [<bf020e64>] (lbs_start_card+0x20/0x88 [libertas]) [<bf020e64>] (lbs_start_card+0x20/0x88 [libertas]) from [<bf02cbd8>] (if_sdio_probe+0x898/0x9c0 [libertas_sdio])
Fix this by returning early. Also remove the out: label as it is not any longer needed.
--- net/wireless/reg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/wireless/reg.c +3 -2
@@ -1125,12 +1125,13 @@ void wiphy_update_regulatory(struct wiphenum ieee80211_band band;if (ignore_reg_update (wiphy, initiator)) - goto out; +return ; +for (band =0 ; band <IEEE80211_NUM_BANDS ; band++) {if (wiphy->bands[band])handle_band (wiphy, band, initiator); } -out: +reg_process_beacons (wiphy);reg_process_ht_flags (wiphy);if (wiphy->reg_notifier)
PATCH 54/102 pnfs: let layoutcommit handle a list of lseg
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peng Tao <[email protected]>
commit a9bae5666d0510ad69bdb437371c9a3e6b770705 upstream.
There can be multiple lseg per file, so layoutcommit should be able to handle it.
--- fs/nfs/nfs4proc.c | 8 +++++++- fs/nfs/pnfs.c | 32 ++++++++++++++++---------------- fs/nfs/pnfs.h | 2 ++ include/linux/nfs_xdr.h | 2 +- 4 files changed, 26 insertions(+), 18 deletions(-)
fs/nfs/nfs4proc.c +7 -1
@@ -5850,9 +5850,15 @@ nfs4_layoutcommit_done(struct rpc_task *static void nfs4_layoutcommit_release (void *calldata) {struct nfs4_layoutcommit_data *data = calldata; +struct pnfs_layout_segment *lseg, *tmp;/* Matched by references in pnfs_set_layoutcommit */ -put_lseg (data->lseg); +list_for_each_entry_safe (lseg, tmp, &data->lseg_list, pls_lc_list) { +list_del_init (&lseg->pls_lc_list); +if (test_and_clear_bit (NFS_LSEG_LAYOUTCOMMIT , + &lseg->pls_flags)) +put_lseg (lseg); + }put_rpccred (data->cred);kfree (data); }
fs/nfs/pnfs.c +16 -16
@@ -224,6 +224,7 @@ static void init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg) { INIT_LIST_HEAD(&lseg->pls_list); +INIT_LIST_HEAD (&lseg->pls_lc_list);atomic_set (&lseg->pls_refcount,1 );smp_mb ();set_bit (NFS_LSEG_VALID , &lseg->pls_flags);
@@ -1201,16 +1202,17 @@ pnfs_try_to_read_data(struct nfs_read_da }/* -* Currently there is only one (whole file) write lseg. +* There can be multiple RW segments. */ -static struct pnfs_layout_segment *pnfs_list_write_lseg (struct inode *inode) +static void pnfs_list_write_lseg (struct inode *inode,struct list_head *listp) { -struct pnfs_layout_segment *lseg, *rv =NULL ; +struct pnfs_layout_segment *lseg; -list_for_each_entry (lseg, &NFS_I (inode)->layout->plh_segs, pls_list) -if (lseg->pls_range.iomode ==IOMODE_RW ) - rv = lseg; -return rv; +list_for_each_entry (lseg, &NFS_I (inode)->layout->plh_segs, pls_list) { +if (lseg->pls_range.iomode ==IOMODE_RW && +test_bit (NFS_LSEG_LAYOUTCOMMIT , &lseg->pls_flags)) +list_add (&lseg->pls_lc_list, listp); + } }void
@@ -1222,12 +1224,14 @@ pnfs_set_layoutcommit(struct nfs_write_dspin_lock (&nfsi->vfs_inode.i_lock);if (!test_and_set_bit (NFS_INO_LAYOUTCOMMIT , &nfsi->flags)) { -/* references matched in nfs4_layoutcommit_release */ -get_lseg (wdata->lseg); mark_as_dirty = true;dprintk ("%s: Set layoutcommit for inode %lu " , __func__, wdata->inode->i_ino); } +if (!test_and_set_bit (NFS_LSEG_LAYOUTCOMMIT , &wdata->lseg->pls_flags)) { +/* references matched in nfs4_layoutcommit_release */ +get_lseg (wdata->lseg); + }if (end_pos > nfsi->layout->plh_lwb) nfsi->layout->plh_lwb = end_pos;spin_unlock (&nfsi->vfs_inode.i_lock);
@@ -1254,7 +1258,6 @@ pnfs_layoutcommit_inode(struct inode *in {struct nfs4_layoutcommit_data *data;struct nfs_inode *nfsi =NFS_I (inode); -struct pnfs_layout_segment *lseg;loff_t end_pos;int status =0 ;
@@ -1271,17 +1274,15 @@ pnfs_layoutcommit_inode(struct inode *in goto out; } +INIT_LIST_HEAD (&data->lseg_list);spin_lock (&inode->i_lock);if (!test_and_clear_bit (NFS_INO_LAYOUTCOMMIT , &nfsi->flags)) {spin_unlock (&inode->i_lock);kfree (data); goto out; } -/* -* Currently only one (whole file) write lseg which is referenced -* in pnfs_set_layoutcommit and will be found. -*/ - lseg =pnfs_list_write_lseg (inode); + +pnfs_list_write_lseg (inode, &data->lseg_list); end_pos = nfsi->layout->plh_lwb; nfsi->layout->plh_lwb =0 ;
@@ -1291,7 +1292,6 @@ pnfs_layoutcommit_inode(struct inode *inspin_unlock (&inode->i_lock); data->args.inode = inode; - data->lseg = lseg; data->cred =get_rpccred (nfsi->layout->plh_lc_cred);nfs_fattr_init (&data->fattr); data->args.bitmask =NFS_SERVER (inode)->cache_consistency_bitmask;
fs/nfs/pnfs.h +2 -0
@@ -36,10 +36,12 @@enum {NFS_LSEG_VALID =0 ,/* cleared when lseg is recalled/returned */ NFS_LSEG_ROC ,/* roc bit received from server */ +NFS_LSEG_LAYOUTCOMMIT ,/* layoutcommit bit set for layoutcommit */ };struct pnfs_layout_segment {struct list_head pls_list; +struct list_head pls_lc_list;struct pnfs_layout_range pls_range;atomic_t pls_refcount;unsigned long pls_flags;
include/linux/nfs_xdr.h +1 -1
@@ -262,7 +262,7 @@ struct nfs4_layoutcommit_res {struct nfs4_layoutcommit_data {struct rpc_task task;struct nfs_fattr fattr; -struct pnfs_layout_segment *lseg; +struct list_head lseg_list;struct rpc_cred *cred;struct nfs4_layoutcommit_args args;struct nfs4_layoutcommit_res res;
PATCH 97/102 watchdog: shwdt: fix usage of mod_timer
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Engraf <[email protected]>
commit bea1906620ce72b63f83735c4cc2642b25ec54ae upstream.
Fix the usage of mod_timer() and make the driver usable. mod_timer() must be called with an absolute timeout in jiffies. The old implementation used a relative timeout thus the hardware watchdog was never triggered.
--- drivers/watchdog/shwdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/shwdt.c +1 -1
@@ -64,7 +64,7 @@* misses its deadline, the kernel timer will allow the WDT to overflow. */ static int clock_division_ratio =WTCSR_CKS_4096 ; -#define next_ping_period (cks) msecs_to_jiffies(cks - 4) +#define next_ping_period (cks) (jiffies + msecs_to_jiffies(cks - 4))static const struct watchdog_info sh_wdt_info;static struct platform_device *sh_wdt_dev;
PATCH 98/102 ALSA: sound/core/pcm_compat.c: adjust array index
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Julia Lawall <[email protected]>
commit ca9380fd68514c7bc952282c1b4fc70607e9fe43 upstream.
Convert array index from the loop bound to the loop index.
A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e1,e2,ar;
@@
for(e1 = 0; e1 < e2; e1++) { <...
ar[
- e2
+ e1
]
...> }
// </smpl>
--- sound/core/pcm_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/pcm_compat.c +1 -1
@@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(stkfree (bufs);return -EFAULT ; } - bufs[ch] =compat_ptr (ptr); + bufs[i] =compat_ptr (ptr); bufptr++; }if (dir ==SNDRV_PCM_STREAM_PLAYBACK )
PATCH 100/102 dm snapshot: flush disk cache when merging
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mikulas Patocka <[email protected]>
commit 762a80d9fc9f690a3a35983f3b4619a220650808 upstream.
This patch makes dm-snapshot flush disk cache when writing metadata for merging snapshot.
Without cache flushing the disk may reorder metadata write and other data writes and there is a possibility of data corruption in case of power fault.
--- drivers/md/dm-snap-persistent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-snap-persistent.c +1 -1
@@ -753,7 +753,7 @@ static int persistent_commit_merge(strucfor (i =0 ; i < nr_merged; i++)clear_exception (ps, ps->current_committed -1 - i); - r =area_io (ps,WRITE ); + r =area_io (ps,WRITE_FLUSH_FUA );if (r <0 )return r;
PATCH 89/102 powerpc/pseries/hvconsole: Fix dropped console output
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Anton Blanchard <[email protected]>
commit 51d33021425e1f905beb4208823146f2fb6517da upstream.
Return -EAGAIN when we get H_BUSY back from the hypervisor. This makes the hvc console driver retry, avoiding dropped printks.
--- arch/powerpc/platforms/pseries/hvconsole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/hvconsole.c +1 -1
@@ -73,7 +73,7 @@ int hvc_put_chars(uint32_t vtermno, consif (ret ==H_SUCCESS )return count;if (ret ==H_BUSY ) -return 0 ; +return -EAGAIN ;return -EIO ; }
PATCH 91/102 ipc/sem.c: fix race with concurrent semtimedop() timeouts and IPC_RMID
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Manfred Spraul <[email protected]>
commit d694ad62bf539dbb20a0899ac2a954555f9e4a83 upstream.
If a semaphore array is removed and in parallel a sleeping task is woken up (signal or timeout, does not matter), then the woken up task does not wait until wake_up_sem_queue_do() is completed. This will cause crashes, because wake_up_sem_queue_do() will read from a stale pointer.
The fix is simple: Regardless of anything, always call get_queue_result(). This function waits until wake_up_sem_queue_do() has finished it's task.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=27142
--- ipc/sem.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
ipc/sem.c +11 -2
@@ -1456,15 +1456,24 @@ SYSCALL_DEFINE4(semtimedop, int, semid, } sma =sem_lock (ns, semid); + +/* +* Wait until it's guaranteed that no wakeup_sem_queue_do() is ongoing. +*/ + error =get_queue_result (&queue); + +/* +* Array removed? If yes, leave without sem_unlock(). +*/ if (IS_ERR (sma)) { error = -EIDRM ; goto out_free; } - error =get_queue_result (&queue);/* -* If queue.status != -EINTR we are woken up by another process +* If queue.status != -EINTR we are woken up by another process. +* Leave without unlink_queue(), but with sem_unlock(). */ if (error != -EINTR ) {
PATCH 94/102 oom: task->mm == NULL doesnt mean the memory was freed
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit c027a474a68065391c8773f6e83ed5412657e369 upstream.
exit_mm() sets ->mm == NULL then it does mmput()->exit_mmap() which frees the memory.
However select_bad_process() checks ->mm != NULL before TIF_MEMDIE, so it continues to kill other tasks even if we have the oom-killed task freeing its memory.
Change select_bad_process() to check ->mm after TIF_MEMDIE, but skip the tasks which have already passed exit_notify() to ensure a zombie with TIF_MEMDIE set can't block oom-killer. Alternatively we could probably clear TIF_MEMDIE after exit_mmap().
--- mm/oom_kill.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/oom_kill.c +3 -1
@@ -303,7 +303,7 @@ static struct task_struct *select_bad_pr do_each_thread(g, p) {unsigned int points; -if (!p->mm) +if (p->exit_state)continue ;if (oom_unkillable_task (p, mem, nodemask))continue ;
@@ -319,6 +319,8 @@ static struct task_struct *select_bad_pr*/ if (test_tsk_thread_flag (p,TIF_MEMDIE ))return ERR_PTR (-1UL ); +if (!p->mm) +continue ;if (p->flags &PF_EXITING ) {/*
PATCH 93/102 AppArmor: Fix masking of capabilities in complain mode
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: John Johansen <[email protected]>
commit 25e75dff519bcce2cb35023105e7df51d7b9e691 upstream.
AppArmor is masking the capabilities returned by capget against the capabilities mask in the profile. This is wrong, in complain mode the profile has effectively all capabilities, as the profile restrictions are not being enforced, merely tested against to determine if an access is known by the profile.
This can result in the wrong behavior of security conscience applications like sshd which examine their capability set, and change their behavior accordingly. In this case because of the masked capability set being returned sshd fails due to DAC checks, even when the profile is in complain mode.
Kernels affected: 2.6.36 - 3.0.
--- security/apparmor/lsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/lsm.c +1 -1
@@ -127,7 +127,7 @@ static int apparmor_capget(struct task_s *inheritable = cred->cap_inheritable; *permitted = cred->cap_permitted; -if (!unconfined (profile)) { +if (!unconfined (profile) && !COMPLAIN_MODE (profile)) { *effective =cap_intersect (*effective, profile->caps.allow); *permitted =cap_intersect (*permitted, profile->caps.allow); }
PATCH 92/102 AppArmor: Fix reference to rcu protected pointer outside of rcu_read_lock
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: John Johansen <[email protected]>
commit 04fdc099f9c80c7775dbac388fc97e156d4d47e7 upstream.
The pointer returned from tracehook_tracer_task() is only valid inside the rcu_read_lock. However the tracer pointer obtained is being passed to aa_may_ptrace outside of the rcu_read_lock critical section.
Mover the aa_may_ptrace test into the rcu_read_lock critical section, to fix this.
Kernels affected: 2.6.36 - 3.0
--- security/apparmor/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/domain.c +1 -1
@@ -73,7 +73,6 @@ static int may_change_ptraced_domain(str cred =get_task_cred (tracer); tracerp =aa_cred_profile (cred); } -rcu_read_unlock ();/* not ptraced */ if (!tracer ||unconfined (tracerp))
@@ -82,6 +81,7 @@ static int may_change_ptraced_domain(str error =aa_may_ptrace (tracer, tracerp, to_profile,PTRACE_MODE_ATTACH ); out: +rcu_read_unlock ();if (cred)put_cred (cred);
PATCH 90/102 hvc_console: Improve tty/console put_chars handling
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hendrik Brueckner <[email protected]>
commit 8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 upstream.
Currently, the hvc_console_print() function drops console output if the hvc backend's put_chars() returns 0. This patch changes this behavior to allow a retry through returning -EAGAIN.
This change also affects the hvc_push() function. Both functions are changed to handle -EAGAIN and to retry the put_chars() operation.
If a hvc backend returns -EAGAIN, the retry handling differs:
- hvc_console_print() spins to write the complete console output.
- hvc_push() behaves the same way as for returning 0.
Now hvc backends can indirectly control the way how console output is handled through the hvc console layer.
--- drivers/tty/hvc/hvc_console.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/hvc/hvc_console.c +5 -3
@@ -163,8 +163,10 @@ static void hvc_console_print(struct con }else { r = cons_ops[index]->put_chars (vtermnos[index], c, i);if (r <=0 ) { -/* throw away chars on error */ - i =0 ; +/* throw away characters on error +* but spin in case of -EAGAIN */ +if (r != -EAGAIN ) + i =0 ; }else if (r >0 ) { i -= r;if (i >0 )
@@ -448,7 +450,7 @@ static int hvc_push(struct hvc_struct *h n = hp->ops->put_chars (hp->vtermno, hp->outbuf, hp->n_outbuf);if (n <=0 ) { -if (n ==0 ) { +if (n ==0 || n == -EAGAIN ) { hp->do_wakeup =1 ;return 0 ; }
PATCH 87/102 tty/serial: Fix XSCALE serial ports, e.g. ce4100
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stephen Warren <[email protected]>
commit 5568181f188ae9485a0cdbea5ea48f63d186a298 upstream.
Commit 4539c24fe4f92c09ee668ef959d3e8180df619b9 "tty/serial: Add explicit PORT_TEGRA type" introduced separate flags describing the need for IER bits UUE and RTOIE. Both bits are required for the XSCALE port type. While that patch updated uart_config[] as required, the auto-probing code wasn't updated to set the RTOIE flag when an XSCALE port type was detected. This caused such ports to stop working. This patch rectifies that.
--- drivers/tty/serial/8250.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250.c +1 -1
@@ -1107,7 +1107,7 @@ static void autoconfig_16550a(struct uar*/ DEBUG_AUTOCONF ("Xscale " ); up->port.type =PORT_XSCALE ; - up->capabilities |=UART_CAP_UUE ; + up->capabilities |=UART_CAP_UUE |UART_CAP_RTOIE ;return ; } }else {
PATCH 86/102 memcg: fix behavior of mem_cgroup_resize_limit()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daisuke Nishimura <[email protected]>
commit 108b6a78463bb8c7163e4f9779f36ad8bbade334 upstream.
Commit 22a668d7c3ef ("memcg: fix behavior under memory.limit equals to memsw.limit") introduced "memsw_is_minimum" flag, which becomes true when mem_limit == memsw_limit. The flag is checked at the beginning of reclaim, and "noswap" is set if the flag is true, because using swap is meaningless in this case.
This works well in most cases, but when we try to shrink mem_limit, which is the same as memsw_limit now, we might fail to shrink mem_limit because swap doesn't used.
This patch fixes this behavior by:
- check MEM_CGROUP_RECLAIM_SHRINK at the begining of reclaim
- If it is set, don't set "noswap" flag even if memsw_is_minimum is true.
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
@@ -1730,7 +1730,7 @@ static int mem_cgroup_hierarchical_recla excess =res_counter_soft_limit_excess (&root_mem->res) >>PAGE_SHIFT ;/* If memsw_is_minimum==1, swap-out is of-no-use. */ -if (!check_soft && root_mem->memsw_is_minimum) +if (!check_soft && !shrink && root_mem->memsw_is_minimum) noswap = true;while (1 ) {
PATCH 102/102 dm: fix idr leak on module removal
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alasdair G Kergon <[email protected]>
commit d15b774c2920d55e3d58275c97fbe3adc3afde38 upstream.
Destroy _minor_idr when unloading the core dm module. (Found by kmemleak.)
--- drivers/md/dm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/md/dm.c +8 -2
@@ -37,6 +37,8 @@ static const char *_name = DM_NAME;static unsigned int major =0 ;static unsigned int _major =0 ; +static DEFINE_IDR (_minor_idr); +static DEFINE_SPINLOCK (_minor_lock);/* * For bio-based dm.
@@ -313,6 +315,12 @@ static void __exit dm_exit(void)while (i--) _exits[i](); + +/* +* Should be empty by this point. +*/ +idr_remove_all (&_minor_idr); +idr_destroy (&_minor_idr); }/*
@@ -1705,8 +1713,6 @@ static int dm_any_congested(void *conges/*----------------------------------------------------------------- * An IDR is used to keep track of allocated minor numbers. *---------------------------------------------------------------*/ -static DEFINE_IDR (_minor_idr); -static void free_minor (int minor) {spin_lock (&_minor_lock);
PATCH 101/102 dm mpath: fix potential NULL pointer in feature arg processing
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mike Snitzer <[email protected]>
commit 286f367dad40beb3234a18c17391d03ba939a7f3 upstream.
Avoid dereferencing a NULL pointer if the number of feature arguments supplied is fewer than indicated.
--- drivers/md/dm-mpath.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/dm-mpath.c +5 -0
@@ -807,6 +807,11 @@ static int parse_features(struct arg_setif (!argc)return 0 ; +if (argc > as->argc) { + ti->error ="not enough arguments for features" ; +return -EINVAL ; + } + do { param_name = shift(as); argc--;
PATCH 99/102 dm io: flush cpu cache with vmapped io
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mikulas Patocka <[email protected]>
commit bb91bc7bacb906c9f3a9b22744c53fa7564b51ba upstream.
For normal kernel pages, CPU cache is synchronized by the dma layer. However, this is not done for pages allocated with vmalloc. If we do I/O to/from vmallocated pages, we must synchronize CPU cache explicitly.
Prior to doing I/O on vmallocated page we must call flush_kernel_vmap_range to flush dirty cache on the virtual address. After finished read we must call invalidate_kernel_vmap_range to invalidate cache on the virtual address, so that accesses to the virtual address return newly read data and not stale data from CPU cache.
This patch fixes metadata corruption on dm-snapshots on PA-RISC and possibly other architectures with caches indexed by virtual address.
--- drivers/md/dm-io.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/md/dm-io.c +27 -2
@@ -38,6 +38,8 @@ struct io {struct dm_io_client *client;io_notify_fn callback;void *context; +void *vma_invalidate_address; +unsigned long vma_invalidate_size; } __attribute__((aligned(DM_IO_MAX_REGIONS)));static struct kmem_cache *_dm_io_cache;
@@ -116,6 +118,10 @@ static void dec_count(struct io *io, unsset_bit (region, &io->error_bits);if (atomic_dec_and_test (&io->count)) { +if (io->vma_invalidate_size) +invalidate_kernel_vmap_range (io->vma_invalidate_address, + io->vma_invalidate_size); +if (io->sleeper)wake_up_process (io->sleeper);
@@ -159,6 +165,9 @@ struct dpages {unsigned context_u;void *context_ptr; + +void *vma_invalidate_address; +unsigned long vma_invalidate_size; };/*
@@ -377,6 +386,9 @@ static int sync_io(struct dm_io_client * io->sleeper = current; io->client = client; + io->vma_invalidate_address = dp->vma_invalidate_address; + io->vma_invalidate_size = dp->vma_invalidate_size; +dispatch_io (rw, num_regions, where, dp, io,1 );while (1 ) {
@@ -415,13 +427,21 @@ static int async_io(struct dm_io_client io->callback = fn; io->context = context; + io->vma_invalidate_address = dp->vma_invalidate_address; + io->vma_invalidate_size = dp->vma_invalidate_size; +dispatch_io (rw, num_regions, where, dp, io,0 );return 0 ; } -static int dp_init (struct dm_io_request *io_req,struct dpages *dp) +static int dp_init (struct dm_io_request *io_req,struct dpages *dp, +unsigned long size) {/* Set up dpages based on memory type */ + + dp->vma_invalidate_address =NULL ; + dp->vma_invalidate_size =0 ; +switch (io_req->mem.type) {case DM_IO_PAGE_LIST :list_dp_init (dp, io_req->mem.ptr.pl, io_req->mem.offset);
@@ -432,6 +452,11 @@ static int dp_init(struct dm_io_requestbreak ;case DM_IO_VMA : +flush_kernel_vmap_range (io_req->mem.ptr.vma, size); +if ((io_req->bi_rw &RW_MASK ) ==READ ) { + dp->vma_invalidate_address = io_req->mem.ptr.vma; + dp->vma_invalidate_size = size; + }vm_dp_init (dp, io_req->mem.ptr.vma);break ;
@@ -460,7 +485,7 @@ int dm_io(struct dm_io_request *io_req,int r;struct dpages dp; - r =dp_init (io_req, &dp); + r =dp_init (io_req, &dp, (unsigned long )where->count <<SECTOR_SHIFT );if (r)return r;
PATCH 96/102 GFS2: Fix mount hang caused by certain access pattern to sysfs files
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Steven Whitehouse <[email protected]>
commit 19237039919088781b4191a00bdc1284d8fea1dd upstream.
Depending upon the order of userspace/kernel during the mount process, this can result in a hang without the _all version of the completion.
--- fs/gfs2/ops_fstype.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/gfs2/ops_fstype.c +2 -2
@@ -1018,13 +1018,13 @@ hostdata_error: fsname++;if (lm->lm_mount ==NULL ) {fs_info (sdp,"Now mounting FS...\n" ); -complete (&sdp->sd_locking_init); +complete_all (&sdp->sd_locking_init);return 0 ; } ret = lm->lm_mount (sdp, fsname);if (ret ==0 )fs_info (sdp,"Joined cluster. Now mounting FS...\n" ); -complete (&sdp->sd_locking_init); +complete_all (&sdp->sd_locking_init);return ret; }
PATCH 95/102 rt2x00: Add device ID for RT539F device.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Gertjan van Wingerde <[email protected]>
commit 71e0b38c2914018b01f3f08b43ee9e3328197699 upstream.
--- drivers/net/wireless/rt2x00/rt2800pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rt2x00/rt2800pci.c +1 -0
@@ -1158,6 +1158,7 @@ static DEFINE_PCI_DEVICE_TABLE(rt2800pci#endif #ifdef CONFIG_RT2800PCI_RT53XX { PCI_DEVICE(0x1814, 0x5390) }, + { PCI_DEVICE(0x1814, 0x539f) }, #endif { 0, } };
PATCH 62/102 XZ: Fix missing <linux/kernel.h> include
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Lasse Collin <[email protected]>
commit 81d67439855a7f928d90965d832aa4f2fb677342 upstream.
<linux/kernel.h> is needed for min_t. The old version happened to work on x86 because <asm/unaligned.h> indirectly includes <linux/kernel.h>, but it didn't work on ARM.
<linux/kernel.h> includes <asm/byteorder.h> so it's not necessary to include it explicitly anymore.
--- lib/xz/xz_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/xz/xz_private.h +1 -1
@@ -12,7 +12,7 @@#ifdef __KERNEL__# include <linux/xz.h> -# include <asm/byteorder.h> +# include <linux/kernel.h> # include <asm/unaligned.h> /* XZ_PREBOOT may be defined only via decompress_unxz.c. */ # ifndef XZ_PREBOOT
PATCH 60/102 tracing: Fix bug when reading system filters on module removal
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Steven Rostedt <[email protected]>
commit e9dbfae53eeb9fc3d4bb7da3df87fa9875f5da02 upstream.
The event system is freed when its nr_events is set to zero. This happens when a module created an event system and then later the module is removed. Modules may share systems, so the system is allocated when it is created and freed when the modules are unloaded and all the events under the system are removed (nr_events set to zero).
The problem arises when a task opened the "filter" file for the system. If the module is unloaded and it removed the last event for that system, the system structure is freed. If the task that opened the filter file accesses the "filter" file after the system has been freed, the system will access an invalid pointer.
By adding a ref_count, and using it to keep track of what is using the event system, we can free it after all users are finished with the event system.
--- kernel/trace/trace.h | 1 kernel/trace/trace_events.c | 86 ++++++++++++++++++++++++++++++++----- kernel/trace/trace_events_filter.c | 6 ++ 3 files changed, 82 insertions(+), 11 deletions(-)
kernel/trace/trace.h +1 -0
@@ -677,6 +677,7 @@ struct event_subsystem {struct dentry *entry;struct event_filter *filter;int nr_events; +int ref_count; };#define FILTER_PRED_INVALID ((unsigned short)-1)
kernel/trace/trace_events.c +75 -11
133 lines not on this page · raw message
kernel/trace/trace_events_filter.c +6 -0
@@ -1886,6 +1886,12 @@ int apply_subsystem_event_filter(structmutex_lock (&event_mutex); +/* Make sure the system still has events */ +if (!system->nr_events) { + err = -ENODEV ; + goto out_unlock; + } +if (!strcmp (strstrip (filter_string),"0" )) {filter_free_subsystem_preds (system);remove_filter_string (system->filter);
PATCH 59/102 irq_work, alpha: Fix up arch hooks
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Zijlstra <[email protected]>
commit 0f933625e7b6c3d91878ae95e341bf1984db7eaf upstream.
Commit e360adbe29 ("irq_work: Add generic hardirq context callbacks") fouled up the Alpha bit, not properly naming the arch specific function that raises the 'self-IPI'.
--- arch/alpha/kernel/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/kernel/time.c +1 -1
@@ -91,7 +91,7 @@ DEFINE_PER_CPU(u8, irq_work_pending);#define test_irq_work_pending () __get_cpu_var(irq_work_pending)#define clear_irq_work_pending () __get_cpu_var(irq_work_pending) = 0 -void set_irq_work_pending (void ) +void arch_irq_work_raise (void ) {set_irq_work_pending_flag (); }
PATCH 56/102 kexec, x86: Fix incorrect jump back address if not preserving context
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Huang Ying <[email protected]>
commit 050438ed5a05b25cdf287f5691e56a58c2606997 upstream.
In kexec jump support, jump back address passed to the kexeced kernel via function calling ABI, that is, the function call return address is the jump back entry.
Furthermore, jump back entry == 0 should be used to signal that the jump back or preserve context is not enabled in the original kernel.
But in the current implementation the stack position used for function call return address is not cleared context preservation is disabled. The patch fixes this bug.
--- arch/x86/kernel/relocate_kernel_32.S | 2 ++ arch/x86/kernel/relocate_kernel_64.S | 2 ++ 2 files changed, 4 insertions(+)
arch/x86/kernel/relocate_kernel_32.S +2 -0
@@ -97,6 +97,8 @@ relocate_kernel: ret identity_mapped: + /* set return address to 0 if not preserving context */ + pushl $0 /* store the start address on the stack */ pushl %edx
arch/x86/kernel/relocate_kernel_64.S +2 -0
@@ -100,6 +100,8 @@ relocate_kernel: ret identity_mapped: + /* set return address to 0 if not preserving context */ + pushq $0 /* store the start address on the stack */ pushq %rdx
PATCH 82/102 n_gsm: fix the wrong FCS handling
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "Du, Alek" <[email protected]>
commit f086ced17191fa0c5712539d2b680eae3dc972a1 upstream.
FCS could be GSM0_SOF, so will break state machine...
[This byte isn't quoted in any way so a SOF here doesn't imply an error
occurred.]
--- drivers/tty/n_gsm.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/tty/n_gsm.c +0 -4
@@ -1823,10 +1823,6 @@ static void gsm0_receive(struct gsm_muxbreak ;case GSM_FCS :/* FCS follows the packet */ gsm->received_fcs = c; -if (c ==GSM0_SOF ) { - gsm->state =GSM_SEARCH ; -break ; - }gsm_queue (gsm); gsm->state =GSM_SSOF ;break ;
PATCH 80/102 NFS: Fix spurious readdir cookie loop messages
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <[email protected]>
commit 0c0308066ca53fdf1423895f3a42838b67b3a5a8 upstream.
If the directory contents change, then we have to accept that the file->f_pos value may shrink if we do a 'search-by-cookie'. In that case, we should turn off the loop detection and let the NFS client try to recover.
The patch also fixes a second loop detection bug by ensuring that after turning on the ctx->duped flag, we read at least one new cookie into ctx->dir_cookie before attempting to match with ctx->dup_cookie.
--- fs/nfs/dir.c | 56 ++++++++++++++++++++++++++++--------------------- include/linux/nfs_fs.h | 3 +- 2 files changed, 35 insertions(+), 24 deletions(-)
fs/nfs/dir.c +33 -23
@@ -134,18 +134,19 @@ const struct inode_operations nfs4_dir_i#endif /* CONFIG_NFS_V4 */ -static struct nfs_open_dir_context *alloc_nfs_open_dir_context (struct rpc_cred *cred) +static struct nfs_open_dir_context *alloc_nfs_open_dir_context (struct inode *dir,struct rpc_cred *cred) {struct nfs_open_dir_context *ctx; ctx =kmalloc (sizeof (*ctx),GFP_KERNEL );if (ctx !=NULL ) { ctx->duped =0 ; + ctx->attr_gencount =NFS_I (dir)->attr_gencount; ctx->dir_cookie =0 ; ctx->dup_cookie =0 ; ctx->cred =get_rpccred (cred); - }else - ctx =ERR_PTR (-ENOMEM ); -return ctx; +return ctx; + } +return ERR_PTR (-ENOMEM ); }static void put_nfs_open_dir_context (struct nfs_open_dir_context *ctx)
@@ -173,7 +174,7 @@ nfs_opendir(struct inode *inode, struct cred =rpc_lookup_cred ();if (IS_ERR (cred))return PTR_ERR (cred); - ctx =alloc_nfs_open_dir_context (cred); + ctx =alloc_nfs_open_dir_context (inode, cred);if (IS_ERR (ctx)) { res =PTR_ERR (ctx); goto out;
@@ -323,7 +324,6 @@ int nfs_readdir_search_for_pos(struct nf {loff_t diff = desc->file->f_pos - desc->current_index;unsigned int index; -struct nfs_open_dir_context *ctx = desc->file->private_data;if (diff <0 ) goto out_eof;
@@ -336,7 +336,6 @@ int nfs_readdir_search_for_pos(struct nf index = (unsigned int )diff; *desc->dir_cookie = array->array[index].cookie; desc->cache_entry_index = index; - ctx->duped =0 ;return 0 ; out_eof: desc->eof =1 ;
@@ -349,14 +348,33 @@ int nfs_readdir_search_for_cookie(structint i;loff_t new_pos;int status = -EAGAIN ; -struct nfs_open_dir_context *ctx = desc->file->private_data;for (i =0 ; i < array->size; i++) {if (array->array[i].cookie == *desc->dir_cookie) { +struct nfs_inode *nfsi =NFS_I (desc->file->f_path.dentry->d_inode); +struct nfs_open_dir_context *ctx = desc->file->private_data; + new_pos = desc->current_index + i; -if (new_pos < desc->file->f_pos) { +if (ctx->attr_gencount != nfsi->attr_gencount + || (nfsi->cache_validity & (NFS_INO_INVALID_ATTR |NFS_INO_INVALID_DATA ))) { + ctx->duped =0 ; + ctx->attr_gencount = nfsi->attr_gencount; + }else if (new_pos < desc->file->f_pos) { +if (ctx->duped >0 + && ctx->dup_cookie == *desc->dir_cookie) { +if (printk_ratelimit ()) { +pr_notice ("NFS: directory %s/%s contains a readdir loop." +"Please contact your server vendor. " +"Offending cookie: %llu\n" , + desc->file->f_dentry->d_parent->d_name.name, + desc->file->f_dentry->d_name.name, + *desc->dir_cookie); + } + status = -ELOOP ; + goto out; + } ctx->dup_cookie = *desc->dir_cookie; - ctx->duped =1 ; + ctx->duped =-1 ; } desc->file->f_pos = new_pos; desc->cache_entry_index = i;
@@ -368,6 +386,7 @@ int nfs_readdir_search_for_cookie(structif (*desc->dir_cookie == array->last_cookie) desc->eof =1 ; } +out:return status; }
@@ -740,19 +759,6 @@ int nfs_do_filldir(nfs_readdir_descriptostruct nfs_cache_array *array =NULL ;struct nfs_open_dir_context *ctx = file->private_data; -if (ctx->duped !=0 && ctx->dup_cookie == *desc->dir_cookie) { -if (printk_ratelimit ()) { -pr_notice ("NFS: directory %s/%s contains a readdir loop. " -"Please contact your server vendor. " -"Offending cookie: %llu\n" , - file->f_dentry->d_parent->d_name.name, - file->f_dentry->d_name.name, - *desc->dir_cookie); - } - res = -ELOOP ; - goto out; - } - array =nfs_readdir_get_array (desc->page);if (IS_ERR (array)) { res =PTR_ERR (array);
@@ -774,6 +780,8 @@ int nfs_do_filldir(nfs_readdir_descripto *desc->dir_cookie = array->array[i+1 ].cookie; else *desc->dir_cookie = array->last_cookie; +if (ctx->duped !=0 ) + ctx->duped =1 ; }if (array->eof_index >=0 ) desc->eof =1 ;
@@ -805,6 +813,7 @@ int uncached_readdir(nfs_readdir_descripstruct page *page =NULL ;int status;struct inode *inode = desc->file->f_path.dentry->d_inode; +struct nfs_open_dir_context *ctx = desc->file->private_data;dfprintk (DIRCACHE ,"NFS: uncached_readdir() searching for cookie %Lu\n" , (unsigned long long )*desc->dir_cookie);
@@ -818,6 +827,7 @@ int uncached_readdir(nfs_readdir_descrip desc->page_index =0 ; desc->last_cookie = *desc->dir_cookie; desc->page = page; + ctx->duped =0 ; status =nfs_readdir_xdr_to_array (desc, page, inode);if (status <0 )
include/linux/nfs_fs.h +2 -1
@@ -99,9 +99,10 @@ struct nfs_open_context {struct nfs_open_dir_context {struct rpc_cred *cred; +unsigned long attr_gencount;__u64 dir_cookie;__u64 dup_cookie; -int duped; +signed char duped; };/*
PATCH 77/102 nfsd4: fix file leak on open_downgrade
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit f197c27196a5e7631b89e2e92daa096fcf7c302c upstream.
Stateid's hold a read reference for a read open, a write reference for a write open, and an additional one of each for each read+write open. The latter wasn't getting put on a downgrade, so something like:
open RW
open R
downgrade to R
was resulting in a file leak.
Also fix an imbalance in an error path.
Regression from 7d94784293096c0a46897acdb83be5abd9278ece "nfsd4: fix downgrade/lock logic".
--- fs/nfsd/nfs4state.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-)
fs/nfsd/nfs4state.c +8 -23
@@ -2332,15 +2332,6 @@ out:return ret; } -static inline void -nfs4_file_downgrade (struct nfs4_file *fp,unsigned int share_access) -{ -if (share_access &NFS4_SHARE_ACCESS_WRITE ) -nfs4_file_put_access (fp,O_WRONLY ); -if (share_access &NFS4_SHARE_ACCESS_READ ) -nfs4_file_put_access (fp,O_RDONLY ); -} -static void nfsd_break_one_deleg (struct nfs4_delegation *dp) {/* We're assuming the state code never drops its reference
@@ -2627,7 +2618,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp status =nfsd4_truncate (rqstp, cur_fh, open);if (status) {if (new_access) { -int oflag =nfs4_access_to_omode (new_access); +int oflag =nfs4_access_to_omode (op_share_access);nfs4_file_put_access (fp, oflag); }return status;
@@ -3385,18 +3376,15 @@ out:return status; } - -/* -* unset all bits in union bitmap (bmap) that -* do not exist in share (from successful OPEN_DOWNGRADE) -*/ -static void -reset_union_bmap_access (unsigned long access,unsigned long *bmap) +static inline void nfs4_file_downgrade (struct nfs4_stateid *stp,unsigned int to_access) {int i; +for (i =1 ; i <4 ; i++) { -if ((i & access) != i) -__clear_bit (i, bmap); +if (test_bit (i, &stp->st_access_bmap) && !(i & to_access)) { +nfs4_file_put_access (stp->st_file, i); +__clear_bit (i, &stp->st_access_bmap); + } } }
@@ -3417,7 +3405,6 @@ nfsd4_open_downgrade(struct svc_rqst *rq {__be32 status;struct nfs4_stateid *stp; -unsigned int share_access; dprintk("NFSD: nfsd4_open_downgrade on file %.*s\n", (int)cstate->current_fh.fh_dentry->d_name.len,
@@ -3446,10 +3433,8 @@ nfsd4_open_downgrade(struct svc_rqst *rq stp->st_deny_bmap, od->od_share_deny); goto out; } -set_access (&share_access, stp->st_access_bmap); -nfs4_file_downgrade (stp->st_file, share_access & ~od->od_share_access); +nfs4_file_downgrade (stp, od->od_share_access); -reset_union_bmap_access (od->od_share_access, &stp->st_access_bmap);reset_union_bmap_deny (od->od_share_deny, &stp->st_deny_bmap);update_stateid (&stp->st_stateid);
PATCH 55/102 pnfs: use lwb as layoutcommit length
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peng Tao <[email protected]>
commit 3557c6c3be5b2ca0b11365db7f8a813253eb520b upstream.
Using NFS4_MAX_UINT64 will break current protocol.
--- fs/nfs/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4xdr.c +1 -1
@@ -1888,7 +1888,7 @@ encode_layoutcommit(struct xdr_stream *x *p++ =cpu_to_be32 (OP_LAYOUTCOMMIT );/* Only whole file layouts */ p =xdr_encode_hyper (p,0 );/* offset */ - p =xdr_encode_hyper (p,NFS4_MAX_UINT64 );/* length */ + p =xdr_encode_hyper (p, args->lastbytewritten +1 );/* length */ *p++ =cpu_to_be32 (0 );/* reclaim */ p =xdr_encode_opaque_fixed (p, args->stateid.data,NFS4_STATEID_SIZE ); *p++ =cpu_to_be32 (1 );/* newoffset = TRUE */
PATCH 72/102 ext3: Fix oops in ext3_try_to_allocate_with_rsv()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kara <[email protected]>
commit ad95c5e9bc8b5885f94dce720137cac8fa8da4c9 upstream.
Block allocation is called from two places: ext3_get_blocks_handle() and ext3_xattr_block_set(). These two callers are not necessarily synchronized because xattr code holds only xattr_sem and i_mutex, and ext3_get_blocks_handle() may hold only truncate_mutex when called from writepage() path. Block reservation code does not expect two concurrent allocations to happen to the same inode and thus assertions can be triggered or reservation structure corruption can occur.
Fix the problem by taking truncate_mutex in xattr code to serialize allocations.
--- fs/ext3/xattr.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/ext3/xattr.c +10 -2
@@ -803,8 +803,16 @@ inserted:/* We need to allocate a new block */ ext3_fsblk_t goal =ext3_group_first_block_no (sb,EXT3_I (inode)->i_block_group); -ext3_fsblk_t block =ext3_new_block (handle, inode, - goal, &error); +ext3_fsblk_t block; + +/* +* Protect us agaist concurrent allocations to the +* same inode from ext3_..._writepage(). Reservation +* code does not expect racing allocations. +*/ +mutex_lock (&EXT3_I (inode)->truncate_mutex); + block =ext3_new_block (handle, inode, goal, &error); +mutex_unlock (&EXT3_I (inode)->truncate_mutex);if (error) goto cleanup;ea_idebug (inode,"creating block %d" , block);
PATCH 71/102 ext4: free allocated and pre-allocated blocks when check_eofblocks_fl fails
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jiaying Zhang <[email protected]>
commit 575a1d4bdfa2ea9fc10733013136145b497e1be0 upstream.
Upon corrupted inode or disk failures, we may fail after we already allocate some blocks from the inode or take some blocks from the inode's preallocation list, but before we successfully insert the corresponding extent to the extent tree. In this case, we should free any allocated blocks and discard the inode's preallocated blocks because the entries in the inode's preallocation list may be in an inconsistent state.
--- fs/ext4/extents.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/ext4/extents.c +3 -4
@@ -3596,10 +3596,9 @@ int ext4_ext_map_blocks(handle_t *handle } err =check_eofblocks_fl (handle, inode, map->m_lblk, path, ar.len); -if (err) - goto out2; - - err =ext4_ext_insert_extent (handle, inode, path, &newex, flags); +if (!err) + err =ext4_ext_insert_extent (handle, inode, path, + &newex, flags);if (err) {int fb_flags = flags &EXT4_GET_BLOCKS_DELALLOC_RESERVE ?EXT4_FREE_BLOCKS_NO_QUOT_UPDATE :0 ;
PATCH 68/102 mm/backing-dev.c: reset bdi min_ratio in bdi_unregister()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Zijlstra <[email protected]>
commit ccb6108f5b0b541d3eb332c3a73e645c0f84278e upstream.
Vito said:
: The system has many usb disks coming and going day to day, with their : respective bdi's having min_ratio set to 1 when inserted. It works for : some time until eventually min_ratio can no longer be set, even when the : active set of bdi's seen in /sys/class/bdi/*/min_ratio doesn't add up to : anywhere near 100.
:
: This then leads to an unrelated starvation problem caused by write-heavy : fuse mounts being used atop the usb disks, a problem the min_ratio setting : at the underlying devices bdi effectively prevents.
Fix this leakage by resetting the bdi min_ratio when unregistering the BDI.
--- mm/backing-dev.c | 1 + 1 file changed, 1 insertion(+)
mm/backing-dev.c +1 -0
@@ -606,6 +606,7 @@ static void bdi_prune_sb(struct backing_void bdi_unregister (struct backing_dev_info *bdi) {if (bdi->dev) { +bdi_set_min_ratio (bdi,0 );trace_writeback_bdi_unregister (bdi);bdi_prune_sb (bdi);del_timer_sync (&bdi->wb.wakeup_timer);
PATCH 65/102 drivers/firmware/sigma.c needs MODULE_LICENSE
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Randy Dunlap <[email protected]>
commit 27c46a2546c75c6814562e85b751e3d64c188ad5 upstream.
Fix module tainting message:
sigma: module license 'unspecified' taints kernel.
--- drivers/firmware/sigma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/firmware/sigma.c +3 -0
@@ -11,6 +11,7 @@#include <linux/firmware.h> #include <linux/kernel.h> #include <linux/i2c.h> +#include <linux/module.h> #include <linux/sigma.h> /* Return: 0==OK, <0==error, =1 ==no more actions */
@@ -113,3 +114,5 @@ int process_sigma_firmware(struct i2c_clreturn ret; }EXPORT_SYMBOL (process_sigma_firmware); + +MODULE_LICENSE ("GPL" );
PATCH 27/102 staging: brcm80211: fix for reported log spam problem
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Roland Vossen <[email protected]>
commit 37c962d195005d009e130e65a9e55960996c3cab upstream.
Every few minutes, this message would appear in syslog:
ieee80211 ph0: wl_ops_bss_info_changed: BSS idle: true (implement)
The message has been deleted, the driver requires no special action on this particular event (). See: https://bugzilla.kernel.org/show_bug.cgi?id=38162
--- drivers/staging/brcm80211/brcmsmac/wl_mac80211.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/brcm80211/brcmsmac/wl_mac80211.c +0 -5
@@ -449,11 +449,6 @@ wl_ops_bss_info_changed(struct ieee80211wiphy_err (wiphy,"%s: qos enabled: %s (implement)\n" , __func__, info->qos ?"true" :"false" ); } -if (changed &BSS_CHANGED_IDLE ) { -/* Idle changed for this BSS/interface */ -wiphy_err (wiphy,"%s: BSS idle: %s (implement)\n" , __func__, - info->idle ?"true" :"false" ); - }return ; }
PATCH 25/102 ath9k_hw: Fix incorrect key_miss handling
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Senthil Balasubramanian <[email protected]>
commit 0472ade031b5c0c69c21cf96acf64c50eb9ba3c2 upstream.
Decryping frames on key_miss handling shouldn't be done for Michael MIC failed frames as h/w would have already decrypted such frames successfully anyway.
Also leaving CRC and PHY error(where the frame is going to be dropped anyway), we are left to prcoess Decrypt error for which s/w decrypt is selected anway and so having key_miss as a separate check doesn't serve anything. So making key_miss handling mutually exlusive with other RX status handling makes much more sense.
This patch addresses an issue with STA not reporting MIC failure events resulting in STA being disconnected immediately.
--- drivers/net/wireless/ath/ath9k/ar9003_mac.c | 3 +-- drivers/net/wireless/ath/ath9k/mac.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mac.c +1 -2
@@ -629,8 +629,7 @@ int ath9k_hw_process_rxdesc_edma(struct rxs->rs_status |=ATH9K_RXERR_DECRYPT ; else if (rxsp->status11 & AR_MichaelErr) rxs->rs_status |= ATH9K_RXERR_MIC; - -if (rxsp->status11 & AR_KeyMiss) + else if (rxsp->status11 & AR_KeyMiss) rxs->rs_status |= ATH9K_RXERR_DECRYPT; }
drivers/net/wireless/ath/ath9k/mac.c +1 -2
@@ -645,8 +645,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a rs->rs_status |=ATH9K_RXERR_DECRYPT ; else if (ads.ds_rxstatus8 & AR_MichaelErr) rs->rs_status |= ATH9K_RXERR_MIC; - -if (ads.ds_rxstatus8 & AR_KeyMiss) + else if (ads.ds_rxstatus8 & AR_KeyMiss) rs->rs_status |= ATH9K_RXERR_DECRYPT; }
PATCH 53/102 pnfs: save layoutcommit cred at layout header init
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peng Tao <[email protected]>
commit 9fa4075878a5faac872a63f4a97ce79c776264e9 upstream.
No need to save it for every lseg.
No need to save it at every pnfs_set_layoutcommit.
--- fs/nfs/pnfs.c | 21 +++++++++++---------- fs/nfs/pnfs.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-)
fs/nfs/pnfs.c +11 -10
@@ -189,6 +189,7 @@ static void pnfs_free_layout_hdr(struct pnfs_layout_hdr *lo) {struct pnfs_layoutdriver_type *ld =NFS_SERVER (lo->plh_inode)->pnfs_curr_ld; +put_rpccred (lo->plh_lc_cred);return ld->alloc_layout_hdr ? ld->free_layout_hdr (lo) :kfree (lo); }
@@ -805,7 +806,9 @@ out: }static struct pnfs_layout_hdr * -alloc_init_layout_hdr (struct inode *ino,gfp_t gfp_flags) +alloc_init_layout_hdr (struct inode *ino, +struct nfs_open_context *ctx, +gfp_t gfp_flags) {struct pnfs_layout_hdr *lo;
@@ -817,11 +820,14 @@ alloc_init_layout_hdr(struct inode *ino,INIT_LIST_HEAD (&lo->plh_segs);INIT_LIST_HEAD (&lo->plh_bulk_recall); lo->plh_inode = ino; + lo->plh_lc_cred =get_rpccred (ctx->state->owner->so_cred);return lo; }static struct pnfs_layout_hdr * -pnfs_find_alloc_layout (struct inode *ino,gfp_t gfp_flags) +pnfs_find_alloc_layout (struct inode *ino, +struct nfs_open_context *ctx, +gfp_t gfp_flags) {struct nfs_inode *nfsi =NFS_I (ino);struct pnfs_layout_hdr *new =NULL ;
@@ -836,7 +842,7 @@ pnfs_find_alloc_layout(struct inode *inoreturn nfsi->layout; }spin_unlock (&ino->i_lock); - new =alloc_init_layout_hdr (ino, gfp_flags); + new =alloc_init_layout_hdr (ino, ctx, gfp_flags);spin_lock (&ino->i_lock);if (likely (nfsi->layout ==NULL ))/* Won the race? */
@@ -928,7 +934,7 @@ pnfs_update_layout(struct inode *ino,if (!pnfs_enabled_sb (NFS_SERVER (ino)))return NULL ;spin_lock (&ino->i_lock); - lo =pnfs_find_alloc_layout (ino, gfp_flags); + lo =pnfs_find_alloc_layout (ino, ctx, gfp_flags);if (lo ==NULL ) {dprintk ("%s ERROR: can't get pnfs_layout_hdr\n" , __func__); goto out_unlock;
@@ -1218,8 +1224,6 @@ pnfs_set_layoutcommit(struct nfs_write_dif (!test_and_set_bit (NFS_INO_LAYOUTCOMMIT , &nfsi->flags)) {/* references matched in nfs4_layoutcommit_release */ get_lseg (wdata->lseg); - wdata->lseg->pls_lc_cred = -get_rpccred (wdata->args.context->state->owner->so_cred); mark_as_dirty = true;dprintk ("%s: Set layoutcommit for inode %lu " , __func__, wdata->inode->i_ino);
@@ -1251,7 +1255,6 @@ pnfs_layoutcommit_inode(struct inode *instruct nfs4_layoutcommit_data *data;struct nfs_inode *nfsi =NFS_I (inode);struct pnfs_layout_segment *lseg; -struct rpc_cred *cred;loff_t end_pos;int status =0 ;
@@ -1281,9 +1284,7 @@ pnfs_layoutcommit_inode(struct inode *in lseg =pnfs_list_write_lseg (inode); end_pos = nfsi->layout->plh_lwb; - cred = lseg->pls_lc_cred; nfsi->layout->plh_lwb =0 ; - lseg->pls_lc_cred =NULL ;memcpy (&data->args.stateid.data, nfsi->layout->plh_stateid.data,sizeof (nfsi->layout->plh_stateid.data));
@@ -1291,7 +1292,7 @@ pnfs_layoutcommit_inode(struct inode *in data->args.inode = inode; data->lseg = lseg; - data->cred = cred; + data->cred =get_rpccred (nfsi->layout->plh_lc_cred);nfs_fattr_init (&data->fattr); data->args.bitmask =NFS_SERVER (inode)->cache_consistency_bitmask; data->res.fattr = &data->fattr;
fs/nfs/pnfs.h +1 -1
@@ -44,7 +44,6 @@ struct pnfs_layout_segment {atomic_t pls_refcount;unsigned long pls_flags;struct pnfs_layout_hdr *pls_layout; -struct rpc_cred *pls_lc_cred;/* LAYOUTCOMMIT credential */ };enum pnfs_try_status {
@@ -124,6 +123,7 @@ struct pnfs_layout_hdr {u32 plh_barrier;/* ignore lower seqids */ unsigned long plh_flags;loff_t plh_lwb;/* last write byte for layoutcommit */ +struct rpc_cred *plh_lc_cred;/* layoutcommit cred */ struct inode *plh_inode; };
PATCH 52/102 pnfs: save layoutcommit lwb at layout header
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peng Tao <[email protected]>
commit acff5880539fe33897d016c0f3dcf062e67c61b6 upstream.
No need to save it for every lseg.
--- fs/nfs/nfs4filelayout.c | 2 +- fs/nfs/pnfs.c | 10 ++++++---- fs/nfs/pnfs.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-)
fs/nfs/nfs4filelayout.c +1 -1
@@ -170,7 +170,7 @@ filelayout_set_layoutcommit(struct nfs_wpnfs_set_layoutcommit (wdata);dprintk ("%s ionde %lu pls_end_pos %lu\n" , __func__, wdata->inode->i_ino, - (unsigned long ) wdata->lseg->pls_end_pos); + (unsigned long )NFS_I (wdata->inode)->layout->plh_lwb); }/*
fs/nfs/pnfs.c +6 -4
@@ -1224,9 +1224,11 @@ pnfs_set_layoutcommit(struct nfs_write_ddprintk ("%s: Set layoutcommit for inode %lu " , __func__, wdata->inode->i_ino); } -if (end_pos > wdata->lseg->pls_end_pos) - wdata->lseg->pls_end_pos = end_pos; +if (end_pos > nfsi->layout->plh_lwb) + nfsi->layout->plh_lwb = end_pos;spin_unlock (&nfsi->vfs_inode.i_lock); +dprintk ("%s: lseg %p end_pos %llu\n" , + __func__, wdata->lseg, nfsi->layout->plh_lwb);/* if pnfs_layoutcommit_inode() runs between inode locks, the next one * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */
@@ -1278,9 +1280,9 @@ pnfs_layoutcommit_inode(struct inode *in*/ lseg =pnfs_list_write_lseg (inode); - end_pos = lseg->pls_end_pos; + end_pos = nfsi->layout->plh_lwb; cred = lseg->pls_lc_cred; - lseg->pls_end_pos =0 ; + nfsi->layout->plh_lwb =0 ; lseg->pls_lc_cred =NULL ; memcpy(&data->args.stateid.data, nfsi->layout->plh_stateid.data,
fs/nfs/pnfs.h +1 -1
@@ -45,7 +45,6 @@ struct pnfs_layout_segment {unsigned long pls_flags;struct pnfs_layout_hdr *pls_layout;struct rpc_cred *pls_lc_cred;/* LAYOUTCOMMIT credential */ -loff_t pls_end_pos;/* LAYOUTCOMMIT write end */ };enum pnfs_try_status {
@@ -124,6 +123,7 @@ struct pnfs_layout_hdr {unsigned long plh_block_lgets;/* block LAYOUTGET if >0 */ u32 plh_barrier;/* ignore lower seqids */ unsigned long plh_flags; +loff_t plh_lwb;/* last write byte for layoutcommit */ struct inode *plh_inode; };
PATCH 50/102 ALSA: virtuoso: fix silent analog output on Xonar Essence ST Deluxe
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Clemens Ladisch <[email protected]>
commit c81c6b356b52d3fcb4d531d149573fc100aad643 upstream.
Commit dd203fa97bd5 (ALSA: virtuoso: remove non-working controls on Essence ST Deluxe) made it impossible to adjust the volume after the driver initialized it to muted.
Ensure that those DACs that can be accessed with I2C are initialized to the same volume that is the reset default of the DAC without I2C.
--- sound/pci/oxygen/xonar_pcm179x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/pci/oxygen/xonar_pcm179x.c +4 -1
@@ -327,8 +327,10 @@ static void pcm1796_init(struct oxygen * {struct xonar_pcm179x *data = chip->model_data; - data->pcm1796_regs[0 ][18 -PCM1796_REG_BASE ] =PCM1796_MUTE | + data->pcm1796_regs[0 ][18 -PCM1796_REG_BASE ] =PCM1796_DMF_DISABLED |PCM1796_FMT_24_I2S |PCM1796_ATLD ; +if (!data->broken_i2c) + data->pcm1796_regs[0 ][18 -PCM1796_REG_BASE ] |=PCM1796_MUTE ; data->pcm1796_regs[0 ][19 -PCM1796_REG_BASE ] =PCM1796_FLT_SHARP |PCM1796_ATS_1 ; data->pcm1796_regs[0][20 - PCM1796_REG_BASE] =
@@ -1123,6 +1125,7 @@ int __devinit get_xonar_pcm179x_model(st chip->model.control_filter = xonar_st_h6_control_filter; chip->model.dac_channels_pcm =8 ; chip->model.dac_channels_mixer =8 ; + chip->model.dac_volume_min =255 ; chip->model.dac_mclks =OXYGEN_MCLKS (256 ,128 ,128 );break ; }
PATCH 47/102 drm/radeon/kms: fix i2c map for rv250/280
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 6dd666333ddee39903d86f870d5c40d9f100e0cc upstream.
Those chips have crt2_ddc bus.
Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=39672
--- drivers/gpu/drm/radeon/radeon_combios.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_combios.c +2 -1
@@ -779,7 +779,8 @@ void radeon_combios_i2c_init(struct rade } } } - }else if (rdev->family >=CHIP_R200 ) { + }else if ((rdev->family ==CHIP_R200 ) || + (rdev->family >=CHIP_R300 )) {/* 0x68 */ i2c =combios_setup_i2c_bus (rdev,DDC_MONID ,0 ,0 ); rdev->i2c_bus[3 ] =radeon_i2c_create (dev, &i2c,"MONID" );
PATCH 46/102 hpsa: do not attempt to read from a write-only register
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "Stephen M. Cameron" <[email protected]>
commit fec62c368b9c8b05d5124ca6c3b8336b537f26f3 upstream.
Most smartarrays tolerate it, but a few new ones don't. Without this change some newer Smart Arrays will lock up and i/o will grind to a halt.
--- drivers/scsi/hpsa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.h +1 -1
@@ -214,7 +214,7 @@ static void SA5_submit_command(struct ctdev_dbg (&h->pdev->dev,"Sending %x, tag = %x\n" , c->busaddr, c->Header.Tag.lower);writel (c->busaddr, h->vaddr +SA5_REQUEST_PORT_OFFSET ); - (void )readl (h->vaddr +SA5_REQUEST_PORT_OFFSET ); + (void )readl (h->vaddr +SA5_SCRATCHPAD_OFFSET ); h->commands_outstanding++;if (h->commands_outstanding > h->max_outstanding) h->max_outstanding = h->commands_outstanding;
PATCH 43/102 ses: requesting a fault indication
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Douglas Gilbert <[email protected]>
commit 2a350cab9daf9a46322d83b091bb05cf54ccf6ab upstream.
Noticed that when the sysfs interface of the SCSI SES driver was used to request a fault indication the LED flashed but the buzzer didn't sound. So it was doing what REQUEST IDENT (locate) should do.
Changelog:
- fix the setting of REQUEST FAULT for the device slot and array device slot elements in the enclosure control diagnostic page
- note the potentially defective code that reads the FAULT SENSED and FAULT REQUESTED bits from the enclosure status diagnostic page
The attached patch is against git/scsi-misc-2.6
--- drivers/scsi/ses.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/ses.c +5 -1
@@ -160,6 +160,10 @@ static unsigned char *ses_get_page2_descreturn NULL ; } +/* For device slot and array device slot elements, byte 3 bit 6 +* is "fault sensed" while byte 3 bit 5 is "fault reqstd". As this +* code stands these bits are shifted 4 positions right so in +* sysfs they will appear as bits 2 and 1 respectively. Strange. */ static void ses_get_fault (struct enclosure_device *edev,struct enclosure_component *ecomp) {
@@ -181,7 +185,7 @@ static int ses_set_fault(struct enclosur/* zero is disabled */ break ;case ENCLOSURE_SETTING_ENABLED : - desc[2 ] =0x02 ; + desc[3 ] =0x20 ;break ;default :/* SES doesn't do the SGPIO blink settings */
PATCH 42/102 sr: check_events() ignore GET_EVENT when TUR says otherwise
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Kay Sievers <[email protected]>
commit 79b9677d885d1a792bc103f2febb06f91f92de43 upstream.
Some broken devices indicates that media has changed on every GET_EVENT_STATUS_NOTIFICATION. This translates into MEDIA_CHANGE uevent on every open() which lets udev run into a loop.
Verify GET_EVENT result against TUR and if it generates spurious events for several times in a row, ignore the GET_EVENT events, and trust only the TUR status.
This is the log of a USB stick with a (broken) fake CDROM drive:
scsi 5:0:0:0: Direct-Access SanDisk U3 Cruzer Micro 8.02 PQ: 0 ANSI: 0 CCS
sd 5:0:0:0: Attached scsi generic sg3 type 0
scsi 5:0:0:1: CD-ROM SanDisk U3 Cruzer Micro 8.02 PQ: 0 ANSI: 0
sd 5:0:0:0: [sdb] Attached SCSI removable disk
sr2: scsi3-mmc drive: 48x/48x tray
sr 5:0:0:1: Attached scsi CD-ROM sr2
sr 5:0:0:1: Attached scsi generic sg4 type 5
sr2: GET_EVENT and TUR disagree continuously, suppress GET_EVENT events sd 5:0:0:0: [sdb] 31777279 512-byte logical blocks: (16.2 GB/15.1 GiB) sd 5:0:0:0: [sdb] No Caching mode page present
sd 5:0:0:0: [sdb] Assuming drive cache: write through
sd 5:0:0:0: [sdb] No Caching mode page present
sd 5:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
-tj: Updated to consider only spurious GET_EVENT events among
different types of disagreement and allow using TUR for kernel event polling after GET_EVENT is ignored.
--- drivers/scsi/sr.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- drivers/scsi/sr.h | 7 +++++++ 2 files changed, 49 insertions(+), 4 deletions(-)
drivers/scsi/sr.c +42 -4
@@ -221,14 +221,33 @@ static unsigned int sr_check_events(strureturn 0 ; events =sr_get_events (cd->device); + cd->get_event_changed |= events &DISK_EVENT_MEDIA_CHANGE ; + +/* +* If earlier GET_EVENT_STATUS_NOTIFICATION and TUR did not agree +* for several times in a row. We rely on TUR only for this likely +* broken device, to prevent generating incorrect media changed +* events for every open(). +*/ +if (cd->ignore_get_event) { + events &= ~DISK_EVENT_MEDIA_CHANGE ; + goto do_tur; + } +/* * GET_EVENT_STATUS_NOTIFICATION is enough unless MEDIA_CHANGE * is being cleared. Note that there are devices which hang * if asked to execute TUR repeatedly. */ -if (!(clearing &DISK_EVENT_MEDIA_CHANGE )) - goto skip_tur; +if (cd->device->changed) { + events |=DISK_EVENT_MEDIA_CHANGE ; + cd->device->changed =0 ; + cd->tur_changed = true; + } +if (!(clearing &DISK_EVENT_MEDIA_CHANGE )) +return events; +do_tur:/* let's see whether the media is there with TUR */ last_present = cd->media_present; ret =scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr);
@@ -242,12 +261,31 @@ static unsigned int sr_check_events(stru (scsi_sense_valid (&sshdr) && sshdr.asc !=0x3a );if (last_present != cd->media_present) - events |=DISK_EVENT_MEDIA_CHANGE ; -skip_tur: + cd->device->changed =1 ; +if (cd->device->changed) { events |=DISK_EVENT_MEDIA_CHANGE ; cd->device->changed =0 ; + cd->tur_changed = true; + } + +if (cd->ignore_get_event) +return events; + +/* check whether GET_EVENT is reporting spurious MEDIA_CHANGE */ +if (!cd->tur_changed) { +if (cd->get_event_changed) { +if (cd->tur_mismatch++ >8 ) { +sdev_printk (KERN_WARNING , cd->device, +"GET_EVENT and TUR disagree continuously, suppress GET_EVENT events\n" ); + cd->ignore_get_event = true; + } + }else { + cd->tur_mismatch =0 ; + } } + cd->tur_changed = false; + cd->get_event_changed = false;return events; }
drivers/scsi/sr.h +7 -0
@@ -41,6 +41,13 @@ typedef struct scsi_cd { unsigned readcd_known:1; /* drive supports READ_CD (0xbe) */ unsigned readcd_cdda:1; /* reading audio data using READ_CD */ unsigned media_present:1; /* media is present */ + +/* GET_EVENT spurious event handling, blk layer guarantees exclusion */ +int tur_mismatch;/* nr of get_event TUR mismatches */ + bool tur_changed:1; /* changed according to TUR */ + bool get_event_changed:1; /* changed according to GET_EVENT */ + bool ignore_get_event:1; /* GET_EVENT is unreliable, use TUR */ +struct cdrom_device_info cdi;/* We hold gendisk and scsi_device references on probe and use * the refs on this kref to decide when to release them */
PATCH 39/102 x86, intel, power: Initialize MSR_IA32_ENERGY_PERF_BIAS
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Len Brown <[email protected]>
commit abe48b108247e9b90b4c6739662a2e5c765ed114 upstream.
Since 2.6.36 (23016bf0d25), Linux prints the existence of "epb" in /proc/cpuinfo, Since 2.6.38 (d5532ee7b40), the x86_energy_perf_policy(8) utility has been available in-tree to update MSR_IA32_ENERGY_PERF_BIAS.
However, the typical BIOS fails to initialize the MSR, presumably because this is handled by high-volume shrink-wrap operating systems...
Linux distros, on the other hand, do not yet invoke x86_energy_perf_policy(8). As a result, WSM-EP, SNB, and later hardware from Intel will run in its default hardware power-on state (performance), which assumes that users care for performance at all costs and not for energy efficiency. While that is fine for performance benchmarks, the hardware's intended default operating point is "normal" mode...
Initialize the MSR to the "normal" by default during kernel boot.
x86_energy_perf_policy(8) is available to change the default after boot, should the user have a different preference.
--- arch/x86/include/asm/msr-index.h | 3 +++ arch/x86/kernel/cpu/intel.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+)
arch/x86/include/asm/msr-index.h +3 -0
@@ -259,6 +259,9 @@#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2#define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0 +#define ENERGY_PERF_BIAS_PERFORMANCE 0 +#define ENERGY_PERF_BIAS_NORMAL 6 +#define ENERGY_PERF_BIAS_POWERSWAVE 15#define MSR_IA32_PACKAGE_THERM_STATUS 0x000001b1
arch/x86/kernel/cpu/intel.c +18 -0
@@ -456,6 +456,24 @@ static void __cpuinit init_intel(structif (cpu_has (c,X86_FEATURE_VMX ))detect_vmx_virtcap (c); + +/* +* Initialize MSR_IA32_ENERGY_PERF_BIAS if BIOS did not. +* x86_energy_perf_policy(8) is available to change it at run-time +*/ +if (cpu_has (c,X86_FEATURE_EPB )) { +u64 epb; + +rdmsrl (MSR_IA32_ENERGY_PERF_BIAS , epb); +if ((epb &0xF ) ==0 ) { +printk_once (KERN_WARNING ,"x86: updated energy_perf_bias" +" to 'normal' from 'performance'\n" +"You can view and update epb via utility," +" such as x86_energy_perf_policy(8)\n" ); + epb = (epb & ~0xF ) |ENERGY_PERF_BIAS_NORMAL ; +wrmsrl (MSR_IA32_ENERGY_PERF_BIAS , epb); + } + } }#ifdef CONFIG_X86_32
PATCH 38/102 perf tools: Fix endian conversion reading event attr from file header
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Ahern <[email protected]>
commit eda3913bb70ecebac13adccffe1e7f96e93cee02 upstream.
The perf_event_attr struct has two __u32's at the top and they need to be swapped individually.
With this change I was able to analyze a perf.data collected in a 32-bit PPC VM on an x86 system. I tested both 32-bit and 64-bit binaries for the Intel analysis side; both read the PPC perf.data file correctly.
-v2:
- changed the existing perf_event__attr_swap() to swap only elements of perf_event_attr and exported it for use in swapping the attributes in the file header
- updated swap_ops used for processing events
--- tools/perf/util/header.c | 5 ++++- tools/perf/util/session.c | 30 ++++++++++++++++++------------ tools/perf/util/session.h | 1 + 3 files changed, 23 insertions(+), 13 deletions(-)
tools/perf/util/header.c +4 -1
@@ -877,9 +877,12 @@ int perf_session__read_header(struct perstruct perf_evsel *evsel;off_t tmp; -if (perf_header__getbuffer64 (header, fd, &f_attr,sizeof (f_attr))) +if (readn (fd, &f_attr,sizeof (f_attr)) <=0 ) goto out_errno; +if (header->needs_swap) +perf_event__attr_swap (&f_attr.attr); + tmp =lseek (fd,0 ,SEEK_CUR ); evsel =perf_evsel__new (&f_attr.attr, i);
tools/perf/util/session.c +18 -12
@@ -407,20 +407,26 @@ static void perf_event__read_swap(union event->read.id =bswap_64 (event->read.id); } -static void perf_event__attr_swap (union perf_event *event) +/* exported for swapping attributes in file header */ +void perf_event__attr_swap (struct perf_event_attr *attr) +{ + attr->type =bswap_32 (attr->type); + attr->size =bswap_32 (attr->size); + attr->config =bswap_64 (attr->config); + attr->sample_period =bswap_64 (attr->sample_period); + attr->sample_type =bswap_64 (attr->sample_type); + attr->read_format =bswap_64 (attr->read_format); + attr->wakeup_events =bswap_32 (attr->wakeup_events); + attr->bp_type =bswap_32 (attr->bp_type); + attr->bp_addr =bswap_64 (attr->bp_addr); + attr->bp_len =bswap_64 (attr->bp_len); +} + +static void perf_event__hdr_attr_swap (union perf_event *event) {size_t size; - event->attr.attr.type =bswap_32 (event->attr.attr.type); - event->attr.attr.size =bswap_32 (event->attr.attr.size); - event->attr.attr.config =bswap_64 (event->attr.attr.config); - event->attr.attr.sample_period =bswap_64 (event->attr.attr.sample_period); - event->attr.attr.sample_type =bswap_64 (event->attr.attr.sample_type); - event->attr.attr.read_format =bswap_64 (event->attr.attr.read_format); - event->attr.attr.wakeup_events =bswap_32 (event->attr.attr.wakeup_events); - event->attr.attr.bp_type =bswap_32 (event->attr.attr.bp_type); - event->attr.attr.bp_addr =bswap_64 (event->attr.attr.bp_addr); - event->attr.attr.bp_len =bswap_64 (event->attr.attr.bp_len); +perf_event__attr_swap (&event->attr.attr); size = event->header.size; size -= (void *)&event->attr.id - (void *)event;
@@ -448,7 +454,7 @@ static perf_event__swap_op perf_event__s [PERF_RECORD_LOST] = perf_event__all64_swap, [PERF_RECORD_READ] = perf_event__read_swap, [PERF_RECORD_SAMPLE] = perf_event__all64_swap, - [PERF_RECORD_HEADER_ATTR] = perf_event__attr_swap, + [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, [PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap, [PERF_RECORD_HEADER_BUILD_ID] = NULL,
tools/perf/util/session.h +1 -0
@@ -112,6 +112,7 @@ int perf_session__set_kallsyms_ref_reloc u64 addr);void mem_bswap_64 (void *src,int byte_size); +void perf_event__attr_swap (struct perf_event_attr *attr);int perf_session__create_kernel_maps (struct perf_session *self);
PATCH 37/102 perf tools, x86: Fix 32-bit compile on 64-bit system
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Ahern <[email protected]>
commit 08a4a43fc407d780bdde36d98f89c0dbb2a6be6b upstream.
Builds for 32-bit perf binaries on a 64-bit host currently fail with this error:
[...]
bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
bench/../../../arch/x86/lib/memcpy_64.S:29: Error: bad register name %rdi' bench/../../../arch/x86/lib/memcpy_64.S:34: Error: invalid instruction suffix for movs' bench/../../../arch/x86/lib/memcpy_64.S:50: Error: bad register name %rdi' bench/../../../arch/x86/lib/memcpy_64.S:61: Error: bad register name %rdi'
...
The problem is the detection of the host arch without considering passed in flags. This change fixes 32-bit builds via:
make EXTRA_CFLAGS=-m32
and 64-bit builds still reference the memcpy_64.S.
--- tools/perf/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/Makefile +4 -1
@@ -52,7 +52,10 @@ ifeq ($(ARCH),i386) endif ifeq ($(ARCH),x86_64) ARCH := x86 - IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1) + IS_X86_64 := 0 + ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) + IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1) + endif ifeq (${IS_X86_64}, 1) RAW_ARCH := x86_64 ARCH_CFLAGS := -DARCH_X86_64
PATCH 35/102 mac80211: Restart STA timers only on associated state
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Rajkumar Manoharan <[email protected]>
commit 676b58c27475a9defccc025fea1cbd2b141ee539 upstream.
A panic was observed when the device is failed to resume properly, and there are no running interfaces. ieee80211_reconfig tries to restart STA timers on unassociated state.
--- net/mac80211/mlme.c | 3 +++ 1 file changed, 3 insertions(+)
net/mac80211/mlme.c +3 -0
@@ -2200,6 +2200,9 @@ void ieee80211_sta_restart(struct ieee80 {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; +if (!ifmgd->associated) +return ; +if (test_and_clear_bit (TMR_RUNNING_TIMER , &ifmgd->timers_running))add_timer (&ifmgd->timer);if (test_and_clear_bit (TMR_RUNNING_CHANSW , &ifmgd->timers_running))
PATCH 34/102 rtlwifi: rtl8192cu: Fix duplicate if test
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Larry Finger <[email protected]>
commit 1288aa4e80145d9f4196df32f717b4c1cf6aab61 upstream.
A typo causes routine rtl92cu_phy_rf6052_set_cck_txpower() to test the same condition twice. The problem was found using cppcheck-1.49, and the proper fix was verified against the pre-mac80211 version of the code.
--- drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8192cu/rf.c +1 -1
@@ -104,7 +104,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower( tx_agc[RF90_PATH_A ] =0x10101010 ; tx_agc[RF90_PATH_B ] =0x10101010 ; }else if (rtlpriv->dm.dynamic_txhighpower_lvl == -TXHIGHPWRLEVEL_LEVEL1 ) { +TXHIGHPWRLEVEL_LEVEL2 ) { tx_agc[RF90_PATH_A ] =0x00000000 ; tx_agc[RF90_PATH_B ] =0x00000000 ; }else {
PATCH 9/102 Staging: hv: storvsc: Increase the timeout value in the storvsc driver
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit 46d2eb6d82ef44be58ae192c35e8cd52485f02eb upstream.
On some loaded windows hosts, we have discovered that the host may not respond to guest requests within the specified time (one second) as evidenced by the guest timing out. Fix this problem by increasing the timeout to 5 seconds.
It may be useful to apply this patch to the 3.0 kernel as well. the 3.0 kernel as well.
--- drivers/staging/hv/storvsc.c | 8 ++++---- drivers/staging/hv/storvsc_drv.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hv/storvsc.c +4 -4
@@ -135,7 +135,7 @@ static int storvsc_channel_init(struct hif (ret !=0 ) goto cleanup; - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto cleanup;
@@ -163,7 +163,7 @@ static int storvsc_channel_init(struct hif (ret !=0 ) goto cleanup; - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto cleanup;
@@ -192,7 +192,7 @@ static int storvsc_channel_init(struct hif (ret !=0 ) goto cleanup; - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto cleanup;
@@ -222,7 +222,7 @@ static int storvsc_channel_init(struct hif (ret !=0 ) goto cleanup; - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto cleanup;
drivers/staging/hv/storvsc_drv.c +1 -1
@@ -393,7 +393,7 @@ static int storvsc_host_reset(struct hv_if (ret !=0 ) goto cleanup; - t =wait_for_completion_timeout (&request->wait_event,HZ ); + t =wait_for_completion_timeout (&request->wait_event,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto cleanup;
PATCH 7/102 staging: r8192e_pci: Handle duplicate PCI ID 0x10ec:0x8192 conflict with rtl8192se
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Larry Finger <[email protected]>
commit 1c50bf7e415cf6ce9545dbecc2ac0d89d3916c53 upstream.
There are two devices with PCI ID 0x10ec:0x8192, namely RTL8192E and RTL8192SE. The method of distinguishing them is by the revision ID at offset 0x8 of the PCI configuration space. If the value is 0x10, then the device uses rtl8192se for a driver.
--- drivers/staging/rtl8192e/r8192E_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/staging/rtl8192e/r8192E_core.c +6 -0
@@ -4532,6 +4532,7 @@ static int __devinit rtl8192_pci_probe(su8 unit =0 ;int ret = -ENODEV ;unsigned long pmem_start, pmem_len, pmem_flags; +u8 revisionid;RT_TRACE (COMP_INIT ,"Configuring chip resources\n" );
@@ -4592,6 +4593,11 @@ static int __devinit rtl8192_pci_probe(spci_write_config_byte (pdev,0x41 ,0x00 ); +pci_read_config_byte (pdev,0x08 , &revisionid); +/* If the revisionid is 0x10, the device uses rtl8192se. */ +if (pdev->device ==0x8192 && revisionid ==0x10 ) + goto fail1; +pci_read_config_byte (pdev,0x05 , &unit);pci_write_config_byte (pdev,0x05 , unit & (~0x04 ));
PATCH 6/102 Staging: usbip: vhci-hcd: Do not kill already dead RX/TX kthread
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tobias Klauser <[email protected]>
commit 8547d4cc2b616e4f1dafebe2c673fc986422b506 upstream.
When unbinding a device on the host which was still attached on the client, I got a NULL pointer dereference on the client. This turned out to be due to kthread_stop() being called on an already dead kthread.
Here is how I was able to reproduce the problem:
server:# usbip bind -b 1-2
client:# usbip attach -h server -b 1-2
server:# usbip unbind -b 1-2
This patch fixes the problem by checking the kthread before attempting to kill it, as it is done on the opposite side in stub_shutdown_connection().
--- drivers/staging/usbip/vhci_hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/usbip/vhci_hcd.c +2 -2
@@ -846,9 +846,9 @@ static void vhci_shutdown_connection(str }/* kill threads related to this sdev, if v.c. exists */ -if (vdev->ud.tcp_rx) +if (vdev->ud.tcp_rx && !task_is_dead (vdev->ud.tcp_rx))kthread_stop (vdev->ud.tcp_rx); -if (vdev->ud.tcp_tx) +if (vdev->ud.tcp_tx && !task_is_dead (vdev->ud.tcp_tx))kthread_stop (vdev->ud.tcp_tx);pr_info ("stop threads\n" );
PATCH 4/102 bridge: send proper message_age in config BPDU
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: stephen hemminger <[email protected]>
commit 0c03150e7ea8f7fcd03cfef29385e0010b22ee92 upstream.
A bridge topology with three systems:
+------+ +------+
| A(2) |--| B(1) |
+------+ +------+
\ /
+------+
| C(3) |
+------+What is supposed to happen:
* bridge with the lowest ID is elected root (for example: B)
* C detects that A->C is higher cost path and puts in blocking state
What happens. Bridge with lowest id (B) is elected correctly as root and things start out fine initially. But then config BPDU doesn't get transmitted from A -> C. Because of that the link from A-C is transistioned to the forwarding state.
The root cause of this is that the configuration messages is generated with bogus message age, and dropped before sending.
In the standardmessage_age is supposed to be:
the time since the generation of the Configuration BPDU by the Root that instigated the generation of this Configuration BPDU.
Reimplement this by recording the timestamp (age + jiffies) when recording config information. The old code incorrectly used the time elapsed on the ageing timer which was incorrect.
See also:
https://bugzilla.vyatta.com/show_bug.cgi?id=7164
--- net/bridge/br_private.h | 1 + net/bridge/br_stp.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
net/bridge/br_private.h +1 -0
@@ -124,6 +124,7 @@ struct net_bridge_portbridge_id designated_bridge;u32 path_cost;u32 designated_cost; +unsigned long designated_age;struct timer_list forward_delay_timer;struct timer_list hold_timer;
net/bridge/br_stp.c +2 -2
@@ -164,8 +164,7 @@ void br_transmit_config(struct net_bridgelse {struct net_bridge_port *root =br_get_port (br, br->root_port); - bpdu.message_age = br->max_age - - (root->message_age_timer.expires - jiffies) + bpdu.message_age = (jiffies - root->designated_age) +MESSAGE_AGE_INCR ; } bpdu.max_age = br->max_age;
@@ -189,6 +188,7 @@ static inline void br_record_config_info p->designated_cost = bpdu->root_path_cost; p->designated_bridge = bpdu->bridge_id; p->designated_port = bpdu->port_id; + p->designated_age = jiffies + bpdu->message_age;mod_timer (&p->message_age_timer, jiffies + (p->br->max_age - bpdu->message_age));
PATCH 18/102 drivers/rtc/rtc-tegra.c: properly initialize spinlock
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
commit e57ee01750c4954fd0b5e3c6109cd4b870880eb9 upstream.
Using __SPIN_LOCK_UNLOCKED for a dynamically allocated lock is wrong and breaks the build with PREEMPT_RT_FULL.
--- drivers/rtc/rtc-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-tegra.c +1 -1
@@ -343,7 +343,7 @@ static int __devinit tegra_rtc_probe(str/* set context info. */ info->pdev = pdev; - info->tegra_rtc_lock =__SPIN_LOCK_UNLOCKED (info->tegra_rtc_lock); +spin_lock_init (&info->tegra_rtc_lock);platform_set_drvdata (pdev, info);
PATCH 17/102 rtc: limit frequency
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Gleixner <[email protected]>
commit 431e2bcc371016824f419baa745f82388258f3ee upstream.
Due to the hrtimer self rearming mode a user can DoS the machine simply because it's starved by hrtimer events.
The RTC hrtimer is self rearming. We really need to limit the frequency to something sensible.
--- drivers/rtc/interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/interface.c +1 -1
@@ -708,7 +708,7 @@ int rtc_irq_set_freq(struct rtc_device *int err =0 ;unsigned long flags; -if (freq <=0 ) +if (freq <=0 || freq >5000 )return -EINVAL ; retry:spin_lock_irqsave (&rtc->irq_task_lock, flags);
PATCH 16/102 rtc: fix hrtimer deadlock
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Gleixner <[email protected]>
commit b830ac1d9a2262093bb0f3f6a2fd2a1c8278daf5 upstream.
Ben reported a lockup related to rtc. The lockup happens due to:
CPU0 CPU1
rtc_irq_set_state() __run_hrtimer()
spin_lock_irqsave(&rtc->irq_task_lock) rtc_handle_legacy_irq();
spin_lock(&rtc->irq_task_lock);
hrtimer_cancel()
while (callback_running);So the running callback never finishes as it's blocked on rtc->irq_task_lock.
Use hrtimer_try_to_cancel() instead and drop rtc->irq_task_lock while waiting for the callback. Fix this for both rtc_irq_set_state() and rtc_irq_set_freq().
--- drivers/rtc/interface.c | 56 +++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 19 deletions(-)
drivers/rtc/interface.c +37 -19
@@ -636,6 +636,29 @@ void rtc_irq_unregister(struct rtc_devic }EXPORT_SYMBOL_GPL (rtc_irq_unregister); +static int rtc_update_hrtimer (struct rtc_device *rtc,int enabled) +{ +/* +* We unconditionally cancel the timer here, because otherwise +* we could run into BUG_ON(timer->state != HRTIMER_STATE_CALLBACK); +* when we manage to start the timer before the callback +* returns HRTIMER_RESTART. +* +* We cannot use hrtimer_cancel() here as a running callback +* could be blocked on rtc->irq_task_lock and hrtimer_cancel() +* would spin forever. +*/ +if (hrtimer_try_to_cancel (&rtc->pie_timer) <0 ) +return -1 ; + +if (enabled) { +ktime_t period =ktime_set (0 ,NSEC_PER_SEC / rtc->irq_freq); + +hrtimer_start (&rtc->pie_timer, period,HRTIMER_MODE_REL ); + } +return 0 ; +} +/** * rtc_irq_set_state - enable/disable 2^N Hz periodic IRQs * @rtc: the rtc device
@@ -651,24 +674,21 @@ int rtc_irq_set_state(struct rtc_deviceint err =0 ;unsigned long flags; +retry:spin_lock_irqsave (&rtc->irq_task_lock, flags);if (rtc->irq_task !=NULL && task ==NULL ) err = -EBUSY ;if (rtc->irq_task != task) err = -EACCES ; -if (err) - goto out; - -if (enabled) { -ktime_t period =ktime_set (0 ,NSEC_PER_SEC /rtc->irq_freq); -hrtimer_start (&rtc->pie_timer, period,HRTIMER_MODE_REL ); - }else { -hrtimer_cancel (&rtc->pie_timer); +if (!err) { +if (rtc_update_hrtimer (rtc, enabled) <0 ) { +spin_unlock_irqrestore (&rtc->irq_task_lock, flags); +cpu_relax (); + goto retry; + } + rtc->pie_enabled = enabled; } - rtc->pie_enabled = enabled; -out:spin_unlock_irqrestore (&rtc->irq_task_lock, flags); -return err; }EXPORT_SYMBOL_GPL (rtc_irq_set_state);
@@ -690,20 +710,18 @@ int rtc_irq_set_freq(struct rtc_device *if (freq <=0 )return -EINVAL ; - +retry:spin_lock_irqsave (&rtc->irq_task_lock, flags);if (rtc->irq_task !=NULL && task ==NULL ) err = -EBUSY ;if (rtc->irq_task != task) err = -EACCES ; -if (err ==0 ) { +if (!err) { rtc->irq_freq = freq; -if (rtc->pie_enabled) { -ktime_t period; -hrtimer_cancel (&rtc->pie_timer); - period =ktime_set (0 ,NSEC_PER_SEC /rtc->irq_freq); -hrtimer_start (&rtc->pie_timer, period, -HRTIMER_MODE_REL ); +if (rtc->pie_enabled &&rtc_update_hrtimer (rtc,1 ) <0 ) { +spin_unlock_irqrestore (&rtc->irq_task_lock, flags); +cpu_relax (); + goto retry; } }spin_unlock_irqrestore (&rtc->irq_task_lock, flags);
PATCH 15/102 rtc: handle errors correctly in rtc_irq_set_state()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Gleixner <[email protected]>
commit 2c4f57d12df7696d65b0247bfd57fd082a7719e6 upstream.
The code checks the correctness of the parameters, but unconditionally arms/disarms the hrtimer.
The result is that a random task might arm/disarm rtc timer and surprise the real owner by either generating events or by stopping them.
--- drivers/rtc/interface.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/rtc/interface.c +3 -0
@@ -656,6 +656,8 @@ int rtc_irq_set_state(struct rtc_device err = -EBUSY ;if (rtc->irq_task != task) err = -EACCES ; +if (err) + goto out;if (enabled) {ktime_t period =ktime_set (0 ,NSEC_PER_SEC /rtc->irq_freq);
@@ -664,6 +666,7 @@ int rtc_irq_set_state(struct rtc_devicehrtimer_cancel (&rtc->pie_timer); } rtc->pie_enabled = enabled; +out:spin_unlock_irqrestore (&rtc->irq_task_lock, flags);return err;