3.8.3-stable review
Subsystems (67)
Greg Kroah-Hartman
maintainercover 3.8.3-stable review
This is the start of the stable review cycle for the 3.8.3 release. There are 100 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 me know.
Responses should be made by Thu Mar 14 22:30:28 UTC 2013. 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.8.3-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.8.3-rc1
Hauke Mehrtens <[email protected]>
w1-gpio: fix section mismatch
Greg Kroah-Hartman <[email protected]>
Revert "xen/blkback: Don't trust the handle from the frontend."
Sarah Sharp <[email protected]>
USB: Fix connected device switch to Inactive state.
Sarah Sharp <[email protected]>
USB: Rip out recursive call on warm port reset.
Sarah Sharp <[email protected]>
USB: Prepare for refactoring by adding extra udev checks.
Sarah Sharp <[email protected]>
USB: Don't use EHCI port sempahore for USB 3.0 hubs.
Matthew Garrett <[email protected]>
efi: be more paranoid about available space when creating variables
Seiji Aguchi <[email protected]>
efivars: Disable external interrupt while holding efivars->lock
Steven Rostedt <[email protected]>
ftrace: Update the kconfig for DYNAMIC_FTRACE
Michael Ellerman <[email protected]>
powerpc: Apply early paca fixups to boot_paca and the boot cpu's paca
Jason Cooper <[email protected]>
ARM: kirkwood: of_serial: fix clock gating by removing clock-frequency
Fabio Estevam <[email protected]>
ARM: mxs_defconfig: Make USB host functional again
Andrew Lunn <[email protected]>
gpio: mvebu: Add clk support to prevent lockup
Andrew Lunn <[email protected]>
rtc: rtc-mv: Add support for clk to avoid lockups
Al Viro <[email protected]>
vfs: fix pipe counter breakage
Mathieu Desnoyers <[email protected]>
Fix: compat_rw_copy_check_uvector() misuse in aio, readv, writev, and security keys
David Howells <[email protected]>
keys: fix race with concurrent install_user_keyrings()
Ming Lei <[email protected]>
usbnet: smsc95xx: fix suspend failure
Lee, Chun-Yi <[email protected]>
acer-wmi: avoid the warning of 'devices' may be used uninitialized
Mathias Krause <[email protected]>
crypto: user - fix info leaks in report API
Wei WANG <[email protected]>
mfd: rtsx: Fix issue that booting OS with SD card inserted
Wei WANG <[email protected]>
mfd: rtsx: Optimize card detect flow
Peter Hurley <[email protected]>
x86/kvm: Fix pvclock vsyscall fixmap
Josef Bacik <[email protected]>
Btrfs: cleanup orphan reservation if truncate fails
Josef Bacik <[email protected]>
Btrfs: account for orphan inodes properly during cleanup
Benjamin Tissoires <[email protected]>
HID: logitech-dj: do not directly call hid_output_raw_report() during probe
Marcelo Tosatti <[email protected]>
x86: pvclock kvm: align allocation size to page size
Eric W. Biederman <[email protected]>
userns: Stop oopsing in key_change_session_keyring
Matt Fleming <[email protected]>
efivarfs: return accurate error code in efivarfs_fill_super()
Matt Fleming <[email protected]>
efivars: efivarfs_valid_name() should handle pstore syntax
Nithin Sujir <[email protected]>
tg3: Update link_up flag for phylib devices
Konstantin Khlebnikov <[email protected]>
e1000e: fix pci-device enable-counter balance
Ben Greear <[email protected]>
mac80211: Fix crash due to un-canceled work-items
Pavel Shilovsky <[email protected]>
CIFS: Fix missing of oplock_read value in smb30_values structure
Hillf Danton <[email protected]>
mm/mempolicy.c: fix wrong sp_node insertion
Theodore Ts'o <[email protected]>
random: fix locking dependency with the tasklist_lock
Chris Metcalf <[email protected]>
tile: work around bug in the generic sys_llseek
Eric W. Biederman <[email protected]>
proc: Use nd_jump_link in proc_ns_follow_link
Linus Torvalds <[email protected]>
vfs: don't BUG_ON() if following a /proc fd pseudo-symlink results in a symlink
Takashi Iwai <[email protected]>
ALSA: vmaster: Fix slave change notification
Sean Connor <[email protected]>
ALSA: ice1712: Initialize card->private_data properly
Ben Hutchings <[email protected]>
dmi_scan: fix missing check for _DMI_ signature in smbios_present()
Peter Hurley <[email protected]>
ipc: don't allocate a copy larger than max
Peter Hurley <[email protected]>
ipc: fix potential oops when src msg > 4k w/ MSG_COPY
Patrik Jakobsson <[email protected]>
drm/i915: Turn off hsync and vsync on ADPA when disabling crt
Daniel Vetter <[email protected]>
drm/i915: enable irqs earlier when resuming
Daniel Vetter <[email protected]>
drm/i915: reorder setup sequence to have irqs for output setup
Kenneth Graunke <[email protected]>
drm/i915: Fix Haswell/CRW PCI IDs.
Stéphane Marchesin <[email protected]>
drm/i915: Increase the RC6p threshold.
Will Deacon <[email protected]>
ARM: 7663/1: perf: fix ARMv7 EVTYPE_MASK to include NSH bit
Will Deacon <[email protected]>
ARM: 7659/1: mm: make mm->context.id an atomic64_t variable
Will Deacon <[email protected]>
ARM: 7658/1: mm: fix race updating mm->context.id on ASID rollover
Will Deacon <[email protected]>
ARM: 7657/1: head: fix swapper and idmap population with LPAE and big-endian
Alex Deucher <[email protected]>
drm/radeon: add primary dac adj quirk for R200 board
Alex Deucher <[email protected]>
drm/radeon: don't set hpd, afmt interrupts when interrupts are disabled
Guenter Roeck <[email protected]>
hwmon: (pmbus/ltc2978) Use detected chip ID to select supported functionality
Guenter Roeck <[email protected]>
hwmon: (pmbus/ltc2978) Fix peak attribute handling
Mark Brown <[email protected]>
hwmon: (sht15) Check return value of regulator_enable()
NeilBrown <[email protected]>
md/raid1,raid10: fix deadlock with freeze_array()
NeilBrown <[email protected]>
md: raid0: fix error return from create_stripe_zones.
NeilBrown <[email protected]>
md: fix two bugs when attempting to resize RAID0 array.
Sebastian Riemer <[email protected]>
md: protect against crash upon fsync on ro array
Frederic Weisbecker <[email protected]>
nohz: Make tick_nohz_irq_exit() irq safe
Kees Cook <[email protected]>
proc connector: reject unprivileged listener bumps
Felix Fietkau <[email protected]>
ath9k_hw: improve reset reliability after errors
Felix Fietkau <[email protected]>
ath9k_htc: fix signal strength handling issues
Felix Fietkau <[email protected]>
ath9k: fix RSSI dummy marker value
Bing Zhao <[email protected]>
libertas: fix crash for SD8688
Avinash Patil <[email protected]>
mwifiex: correct sleep delay counter
Johannes Berg <[email protected]>
iwlwifi: always copy first 16 bytes of commands
Rusty Russell <[email protected]>
hw_random: make buffer usable in scatterlist.
Weston Andros Adamson <[email protected]>
NFSv4.1: Hold reference to layout hdr in layoutget
Benny Halevy <[email protected]>
pnfs: fix resend_to_mds for directio
Trond Myklebust <[email protected]>
SUNRPC: Don't start the retransmission timer when out of socket space
Trond Myklebust <[email protected]>
NFS: Don't allow NFS silly-renamed files to be deleted, no signal
Mikulas Patocka <[email protected]>
dm snapshot: add missing module aliases
Mike Christie <[email protected]>
dm: fix limits initialization when there are no data devices
Jun'ichi Nomura <[email protected]>
dm: do not replace bioset for request based dm
Mikulas Patocka <[email protected]>
dm: fix truncated status strings
Jeff Layton <[email protected]>
cifs: ensure that cifs_get_root() only traverses directories
Josef Bacik <[email protected]>
Btrfs: delete inline extents when we find them during logging
Josef Bacik <[email protected]>
Btrfs: copy everything if we've created an inline extent
Thomas Gleixner <[email protected]>
btrfs: Init io_lock after cloning btrfs device struct
Lukas Czerner <[email protected]>
ext4: convert number of blocks to clusters properly
Nicholas Bellinger <[email protected]>
iscsi-target: Fix immediate queue starvation regression with DATAIN
Asias He <[email protected]>
target/pscsi: Fix page increment
K. Y. Srinivasan <[email protected]>
SCSI: storvsc: Initialize the sglist
Dan Carpenter <[email protected]>
SCSI: dc395x: uninitialized variable in device_alloc()
Mattia Dongili <[email protected]>
sony-laptop: fully enable SNY controlled modems
Takahisa Tanaka <[email protected]>
watchdog: sp5100_tco: Write back the original value to reserved bits, instead of zero
Takahisa Tanaka <[email protected]>
watchdog: sp5100_tco: Fix wrong indirect I/O access for getting value of reserved bits
Randy Dunlap <[email protected]>
watchdog: da9055_wdt needs to select WATCHDOG_CORE
Konrad Rzeszutek Wilk <[email protected]>
xen/pci: We don't do multiple MSI's.
Konrad Rzeszutek Wilk <[email protected]>
xen/pat: Disable PAT using pat_enabled value.
Steven Noonan <[email protected]>
xenbus: fix compile failure on ARM with Xen enabled
Alan Stern <[email protected]>
USB: EHCI: revert "remove ASS/PSS polling timeout"
Catalin Marinas <[email protected]>
ARM: 7654/1: Preserve L_PTE_VALID in pte_modify()
Nicolas Pitre <[email protected]>
ARM: 7653/2: do not scale loops_per_jiffy when using a constant delay clock
Russell King <[email protected]>
ARM: fix scheduling while atomic warning in alignment handling code
Russell King <[email protected]>
ARM: VFP: fix emulation of second VFP instruction
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/kirkwood-dns320.dts | 2 - arch/arm/boot/dts/kirkwood-dns325.dts | 1 - arch/arm/boot/dts/kirkwood-dockstar.dts | 1 - arch/arm/boot/dts/kirkwood-dreamplug.dts | 1 - arch/arm/boot/dts/kirkwood-goflexnet.dts | 1 - arch/arm/boot/dts/kirkwood-ib62x0.dts | 1 - arch/arm/boot/dts/kirkwood-iconnect.dts | 1 - arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 1 - arch/arm/boot/dts/kirkwood-km_kirkwood.dts | 1 - arch/arm/boot/dts/kirkwood-lschlv2.dts | 1 - arch/arm/boot/dts/kirkwood-lsxhl.dts | 1 - arch/arm/boot/dts/kirkwood-mplcec4.dts | 1 - arch/arm/boot/dts/kirkwood-ns2-common.dtsi | 1 - arch/arm/boot/dts/kirkwood-nsa310.dts | 1 - arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 2 - arch/arm/boot/dts/kirkwood-topkick.dts | 1 - arch/arm/boot/dts/kirkwood.dtsi | 5 +- arch/arm/configs/mxs_defconfig | 1 + arch/arm/include/asm/delay.h | 1 + arch/arm/include/asm/mmu.h | 8 ++-- arch/arm/include/asm/mmu_context.h | 2 +- arch/arm/include/asm/pgtable.h | 3 +- arch/arm/kernel/asm-offsets.c | 2 +- arch/arm/kernel/head.S | 26 +++++++++-- arch/arm/kernel/perf_event_v7.c | 2 +- arch/arm/kernel/smp.c | 3 ++ arch/arm/lib/delay.c | 1 + arch/arm/mm/alignment.c | 11 ++--- arch/arm/mm/context.c | 25 ++++++---- arch/arm/vfp/vfpmodule.c | 2 +- arch/powerpc/kernel/setup_64.c | 16 +++++-- arch/tile/include/asm/compat.h | 3 ++ arch/tile/kernel/compat.c | 13 ++++++ arch/x86/kernel/kvmclock.c | 11 +++-- arch/x86/kernel/pvclock.c | 2 +- arch/x86/pci/xen.c | 9 ++++ arch/x86/xen/enlighten.c | 10 +++- crypto/ablkcipher.c | 12 ++--- crypto/aead.c | 9 ++-- crypto/ahash.c | 2 +- crypto/blkcipher.c | 6 +-- crypto/crypto_user.c | 22 ++++----- crypto/pcompress.c | 3 +- crypto/rng.c | 2 +- crypto/shash.c | 3 +- drivers/block/xen-blkback/blkback.c | 1 + drivers/char/hw_random/core.c | 19 ++++++-- drivers/char/random.c | 12 +++-- drivers/connector/cn_proc.c | 8 ++++ drivers/firmware/dmi_scan.c | 5 +- drivers/firmware/efivars.c | 210 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------- drivers/gpio/gpio-mvebu.c | 7 +++ drivers/gpu/drm/i915/i915_dma.c | 23 +++++---- drivers/gpu/drm/i915/i915_drv.c | 25 +++++++--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_irq.c | 4 ++ drivers/gpu/drm/i915/intel_crt.c | 2 +- drivers/gpu/drm/i915/intel_pm.c | 2 +- drivers/gpu/drm/radeon/radeon_combios.c | 9 ++++ drivers/gpu/drm/radeon/radeon_irq_kms.c | 12 +++++ drivers/hid/hid-logitech-dj.c | 22 +++++---- drivers/hwmon/pmbus/ltc2978.c | 30 ++++++------ drivers/hwmon/sht15.c | 8 +++- drivers/md/dm-crypt.c | 39 ++++------------ drivers/md/dm-delay.c | 8 ++-- drivers/md/dm-flakey.c | 7 ++- drivers/md/dm-ioctl.c | 14 ++++-- drivers/md/dm-linear.c | 7 ++- drivers/md/dm-mpath.c | 8 ++-- drivers/md/dm-raid.c | 8 ++-- drivers/md/dm-raid1.c | 8 ++-- drivers/md/dm-snap.c | 18 ++++--- drivers/md/dm-stripe.c | 7 ++- drivers/md/dm-thin.c | 80 +++++++++++++++++++------------ drivers/md/dm-verity.c | 8 ++-- drivers/md/dm.c | 42 +++++++++++------ drivers/md/md.c | 7 +++ drivers/md/raid0.c | 5 +- drivers/md/raid1.c | 1 + drivers/md/raid10.c | 1 + drivers/memstick/host/rtsx_pci_ms.c | 7 +++ drivers/mfd/rtsx_pcr.c | 61 +++++++++++++++++++----- drivers/mmc/host/rtsx_pci_sdmmc.c | 18 +++++++ drivers/net/ethernet/broadcom/tg3.c | 14 ++---- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- drivers/net/usb/smsc95xx.c | 6 +++ drivers/net/wireless/ath/ath9k/common.h | 2 +- drivers/net/wireless/ath/ath9k/htc.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 18 ++++--- drivers/net/wireless/ath/ath9k/hw.c | 4 +- drivers/net/wireless/iwlwifi/iwl-devtrace.h | 10 ++-- drivers/net/wireless/iwlwifi/pcie/internal.h | 9 ++++ drivers/net/wireless/iwlwifi/pcie/tx.c | 75 ++++++++++++++++++++++------- drivers/net/wireless/libertas/if_sdio.c | 6 ++- drivers/net/wireless/mwifiex/pcie.c | 2 +- drivers/platform/x86/acer-wmi.c | 3 ++ drivers/platform/x86/sony-laptop.c | 2 +- drivers/rtc/rtc-mv.c | 28 +++++++++-- drivers/scsi/dc395x.c | 2 +- drivers/scsi/storvsc_drv.c | 1 + drivers/target/iscsi/iscsi_target.c | 11 ++++- drivers/target/target_core_pscsi.c | 1 - drivers/usb/core/hub.c | 178 ++++++++++++++++++++++++++++++++++++--------------------------------- drivers/usb/host/ehci-timer.c | 29 ++++++------ drivers/w1/masters/w1-gpio.c | 2 +- drivers/watchdog/Kconfig | 1 + drivers/watchdog/sp5100_tco.c | 27 ++++------- drivers/xen/xenbus/xenbus_client.c | 1 + fs/btrfs/inode.c | 4 ++ fs/btrfs/tree-log.c | 18 +++++++ fs/btrfs/volumes.c | 1 + fs/cifs/cifsfs.c | 5 ++ fs/cifs/smb2ops.c | 1 + fs/compat.c | 15 +++--- fs/ext4/balloc.c | 2 +- fs/ext4/mballoc.c | 8 ++-- fs/ext4/resize.c | 6 +-- fs/ext4/super.c | 2 +- fs/namei.c | 2 - fs/nfs/nfs4filelayout.c | 6 ++- fs/nfs/nfs4proc.c | 11 ++++- fs/nfs/pnfs.c | 14 ++++-- fs/nfs/pnfs.h | 6 ++- fs/nfs/unlink.c | 20 +++++--- fs/pipe.c | 3 ++ fs/proc/namespaces.c | 12 ++--- include/linux/device-mapper.h | 4 +- include/linux/mfd/rtsx_pci.h | 2 + ipc/msg.c | 6 ++- ipc/msgutil.c | 3 -- kernel/time/tick-sched.c | 7 ++- kernel/trace/Kconfig | 24 ++++++---- mm/mempolicy.c | 2 +- mm/process_vm_access.c | 8 ---- net/mac80211/mlme.c | 11 +++++ net/sunrpc/xprt.c | 6 ++- security/keys/compat.c | 4 +- security/keys/process_keys.c | 4 +- sound/core/vmaster.c | 5 +- sound/pci/ice1712/ice1712.c | 2 + 141 files changed, 1044 insertions(+), 606 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/100 ARM: VFP: fix emulation of second VFP instruction
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 5e4ba617c1b584b2e376f31a63bd4e734109318a upstream.
Martin Storsjö reports that the sequence:
ee312ac1 vsub.f32 s4, s3, s2
ee702ac0 vsub.f32 s5, s1, s0
e59f0028 ldr r0, [pc, #40]
ee111a90 vmov r1, s3on Raspberry Pi (implementor 41 architecture 1 part 20 variant b rev 5) where s3 is a denormal and s2 is zero results in incorrect behaviour - the instruction "vsub.f32 s5, s1, s0" is not executed:
VFP: bounce: trigger ee111a90 fpexc d0000780
VFP: emulate: INST=0xee312ac1 SCR=0x00000000
...As we can see, the instruction triggering the exception is the "vmov" instruction, and we emulate the "vsub.f32 s4, s3, s2" but fail to properly take account of the FPEXC_FP2V flag in FPEXC. This is because the test for the second instruction register being valid is bogus, and will always skip emulation of the second instruction.
--- arch/arm/vfp/vfpmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/vfp/vfpmodule.c +1 -1
@@ -413,7 +413,7 @@ void VFP_bounce(u32 trigger, u32 fpexc,* If there isn't a second FP instruction, exit now. Note that * the FPEXC.FP2V bit is valid only if FPEXC.EX is 1. */ -if (fpexc ^ (FPEXC_EX |FPEXC_FP2V )) +if ((fpexc & (FPEXC_EX |FPEXC_FP2V )) != (FPEXC_EX |FPEXC_FP2V )) goto exit;/*
Greg Kroah-Hartman
maintainerPATCH 2/100 ARM: fix scheduling while atomic warning in alignment handling code
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit b255188f90e2bade1bd11a986dd1ca4861869f4d upstream.
Paolo Pisati reports that IPv6 triggers this warning:
BUG: scheduling while atomic: swapper/0/0/0x40000100 Modules linked in: [<c001b1c4>] (unwind_backtrace+0x0/0xf0) from [<c0503c5c>] (__schedule_bug+0x48/0x5c) [<c0503c5c>] (__schedule_bug+0x48/0x5c) from [<c0508608>] (__schedule+0x700/0x740) [<c0508608>] (__schedule+0x700/0x740) from [<c007007c>] (__cond_resched+0x24/0x34) [<c007007c>] (__cond_resched+0x24/0x34) from [<c05086dc>] (_cond_resched+0x3c/0x44) [<c05086dc>] (_cond_resched+0x3c/0x44) from [<c0021f6c>] (do_alignment+0x178/0x78c) [<c0021f6c>] (do_alignment+0x178/0x78c) from [<c00083e0>] (do_DataAbort+0x34/0x98) [<c00083e0>] (do_DataAbort+0x34/0x98) from [<c0509a60>] (__dabt_svc+0x40/0x60) Exception stack(0xc0763d70 to 0xc0763db8)
3d60: e97e805e e97e806e 2c000000 11000000
3d80: ea86bb00 0000002c 00000011 e97e807e c076d2a8 e97e805e e97e806e 0000002c 3da0: 3d000000 c0763dbc c04b98fc c02a8490 00000113 ffffffff [<c0509a60>] (__dabt_svc+0x40/0x60) from [<c02a8490>] (__csum_ipv6_magic+0x8/0xc8)
Fix this by using probe_kernel_address() stead of __get_user().
--- arch/arm/mm/alignment.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/arm/mm/alignment.c +4 -7
@@ -749,7 +749,6 @@ do_alignment(unsigned long addr, unsigneunsigned long instr =0 , instrptr;int (*handler)(unsigned long addr,unsigned long instr,struct pt_regs *regs);unsigned int type; -mm_segment_t fs;unsigned int fault;u16 tinstr =0 ;int isize =4 ;
@@ -760,16 +759,15 @@ do_alignment(unsigned long addr, unsigne instrptr =instruction_pointer (regs); - fs =get_fs (); -set_fs (KERNEL_DS );if (thumb_mode (regs)) { - fault =__get_user (tinstr, (u16 *)(instrptr & ~1 )); +u16 *ptr = (u16 *)(instrptr & ~1 ); + fault =probe_kernel_address (ptr, tinstr);if (!fault) {if (cpu_architecture () >= CPU_ARCH_ARMv7 &&IS_T32 (tinstr)) {/* Thumb-2 32-bit */ u16 tinst2 =0 ; - fault =__get_user (tinst2, (u16 *)(instrptr+2 )); + fault =probe_kernel_address (ptr +1 , tinst2); instr = (tinstr <<16 ) | tinst2; thumb2_32b =1 ; }else {
@@ -778,8 +776,7 @@ do_alignment(unsigned long addr, unsigne } } }else - fault =__get_user (instr, (u32 *)instrptr); -set_fs (fs); + fault =probe_kernel_address (instrptr, instr);if (fault) { type =TYPE_FAULT ;
Greg Kroah-Hartman
maintainerPATCH 3/100 ARM: 7653/2: do not scale loops_per_jiffy when using a constant delay clock
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
commit 70264367a243a68b1d5636ffb570183449803cbe upstream.
When udelay() is implemented using an architected timer, it is wrong to scale loops_per_jiffy when changing the CPU clock frequency since the timer clock remains constant.
The lpj should probably become an implementation detail relevant to the CPU loop based delay routine only and more confined to it. In the mean time this is the minimal fix needed to have expected delays with the timer based implementation when cpufreq is also in use.
--- arch/arm/include/asm/delay.h | 1 + arch/arm/kernel/smp.c | 3 +++ arch/arm/lib/delay.c | 1 + 3 files changed, 5 insertions(+)
arch/arm/include/asm/delay.h +1 -0
@@ -24,6 +24,7 @@ extern struct arm_delay_ops {void (*delay)(unsigned long );void (*const_udelay)(unsigned long );void (*udelay)(unsigned long ); +bool const_clock; } arm_delay_ops;#define __delay (n) arm_delay_ops.delay(n)
arch/arm/kernel/smp.c +3 -0
@@ -693,6 +693,9 @@ static int cpufreq_callback(struct notifif (freq->flags &CPUFREQ_CONST_LOOPS )return NOTIFY_OK ; +if (arm_delay_ops.const_clock) +return NOTIFY_OK ; +if (!per_cpu (l_p_j_ref, cpu)) {per_cpu (l_p_j_ref, cpu) =per_cpu (cpu_data, cpu).loops_per_jiffy;
arch/arm/lib/delay.c +1 -0
@@ -77,6 +77,7 @@ void __init register_current_timer_delay arm_delay_ops.delay = __timer_delay; arm_delay_ops.const_udelay = __timer_const_udelay; arm_delay_ops.udelay = __timer_udelay; + arm_delay_ops.const_clock = true; delay_calibrated = true; }else {pr_info ("Ignoring duplicate/late registration of read_current_timer delay\n" );
Greg Kroah-Hartman
maintainerPATCH 4/100 ARM: 7654/1: Preserve L_PTE_VALID in pte_modify()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Marinas <[email protected]>
commit 69dde4c52dbac2891b49ff9723d9c84efc5baf6f upstream.
Following commit 26ffd0d4 (ARM: mm: introduce present, faulting entries for PAGE_NONE), if a page has been mapped as PROT_NONE, the L_PTE_VALID bit is cleared by the set_pte_ext() code. With LPAE the software and hardware pte share the same location and subsequent modifications of pte range (change_protection()) will leave the L_PTE_VALID bit cleared.
This patch adds the L_PTE_VALID bit to the newprot mask in pte_modify().
--- arch/arm/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/include/asm/pgtable.h +2 -1
@@ -240,7 +240,8 @@ static inline pte_t pte_mkspecial(pte_tstatic inline pte_t pte_modify (pte_t pte,pgprot_t newprot) { -const pteval_t mask =L_PTE_XN |L_PTE_RDONLY |L_PTE_USER |L_PTE_NONE ; +const pteval_t mask =L_PTE_XN |L_PTE_RDONLY |L_PTE_USER | +L_PTE_NONE |L_PTE_VALID ;pte_val (pte) = (pte_val (pte) & ~mask) | (pgprot_val (newprot) & mask);return pte; }
Greg Kroah-Hartman
maintainerPATCH 5/100 USB: EHCI: revert "remove ASS/PSS polling timeout"
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 221f8dfca89276d8aec54c6d07fbe20c281668f0 upstream.
This patch (as1649) reverts commit 55bcdce8a8228223ec4d17d8ded8134ed265d2c5 (USB: EHCI: remove ASS/PSS polling timeout). That commit was written under the assumption that some controllers may take a very long time to turn off their async and periodic schedules. It now appears that in fact the schedules do get turned off reasonably quickly, but some controllers occasionally leave the schedules' status bits turned on and consequently ehci-hcd can't tell that the schedules are off.
VIA controllers in particular have this problem. ehci-hcd tells the hardware to turn off the async schedule, the schedule does get turned off, but the status bit remains on. Since the EHCI spec requires that the schedules not be re-enabled until the previous disable has taken effect, with an unlimited timeout the async schedule never gets turned back on. The resulting symptom is that the system is unable to communicate with USB devices.
--- drivers/usb/host/ehci-timer.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/usb/host/ehci-timer.c +14 -15
@@ -113,15 +113,14 @@ static void ehci_poll_ASS(struct ehci_hcif (want != actual) { -/* Poll again later */ -ehci_enable_event (ehci,EHCI_HRTIMER_POLL_ASS , true); - ++ehci->ASS_poll_count; -return ; +/* Poll again later, but give up after about 20 ms */ +if (ehci->ASS_poll_count++ <20 ) { +ehci_enable_event (ehci,EHCI_HRTIMER_POLL_ASS , true); +return ; + } +ehci_dbg (ehci,"Waited too long for the async schedule status (%x/%x), giving up\n" , + want, actual); } - -if (ehci->ASS_poll_count >20 ) -ehci_dbg (ehci,"ASS poll count reached %d\n" , - ehci->ASS_poll_count); ehci->ASS_poll_count =0 ;/* The status is up-to-date; restart or stop the schedule as needed */
@@ -160,14 +159,14 @@ static void ehci_poll_PSS(struct ehci_hcif (want != actual) { -/* Poll again later */ -ehci_enable_event (ehci,EHCI_HRTIMER_POLL_PSS , true); -return ; +/* Poll again later, but give up after about 20 ms */ +if (ehci->PSS_poll_count++ <20 ) { +ehci_enable_event (ehci,EHCI_HRTIMER_POLL_PSS , true); +return ; + } +ehci_dbg (ehci,"Waited too long for the periodic schedule status (%x/%x), giving up\n" , + want, actual); } - -if (ehci->PSS_poll_count >20 ) -ehci_dbg (ehci,"PSS poll count reached %d\n" , - ehci->PSS_poll_count); ehci->PSS_poll_count =0 ;/* The status is up-to-date; restart or stop the schedule as needed */
Greg Kroah-Hartman
maintainerPATCH 6/100 xenbus: fix compile failure on ARM with Xen enabled
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Noonan <[email protected]>
commit 45e27161c62216c163880d7aed751cb55a65c8e9 upstream.
Adding an include of linux/mm.h resolves this:
drivers/xen/xenbus/xenbus_client.c: In function ‘xenbus_map_ring_valloc_hvm’:
drivers/xen/xenbus/xenbus_client.c:532:66: error: implicit declaration of function ‘page_to_section’ [-Werror=implicit-function-declaration]
--- drivers/xen/xenbus/xenbus_client.c | 1 + 1 file changed, 1 insertion(+)
drivers/xen/xenbus/xenbus_client.c +1 -0
@@ -30,6 +30,7 @@* IN THE SOFTWARE. */ +#include <linux/mm.h> #include <linux/slab.h> #include <linux/types.h> #include <linux/spinlock.h>
Greg Kroah-Hartman
maintainerPATCH 7/100 xen/pat: Disable PAT using pat_enabled value.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit c79c49826270b8b0061b2fca840fc3f013c8a78a upstream.
The git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1 (xen/pat: Disable PAT support for now) explains in details why we want to disable PAT for right now. However that change was not enough and we should have also disabled the pat_enabled value. Otherwise we end up with:
mmap-example:3481 map pfn expected mapping type write-back for [mem 0x00010000-0x00010fff], got uncached-minus
------------[ cut here ]------------ WARNING: at /build/buildd/linux-3.8.0/arch/x86/mm/pat.c:774 untrack_pfn+0xb8/0xd0() mem 0x00010000-0x00010fff], got uncached-minus ------------[ cut here ]------------ WARNING: at /build/buildd/linux-3.8.0/arch/x86/mm/pat.c:774 untrack_pfn+0xb8/0xd0() ... Pid: 3481, comm: mmap-example Tainted: GF 3.8.0-6-generic #13-Ubuntu Call Trace: [<ffffffff8105879f>] warn_slowpath_common+0x7f/0xc0 [<ffffffff810587fa>] warn_slowpath_null+0x1a/0x20 [<ffffffff8104bcc8>] untrack_pfn+0xb8/0xd0 [<ffffffff81156c1c>] unmap_single_vma+0xac/0x100 [<ffffffff81157459>] unmap_vmas+0x49/0x90 [<ffffffff8115f808>] exit_mmap+0x98/0x170 [<ffffffff810559a4>] mmput+0x64/0x100 [<ffffffff810560f5>] dup_mm+0x445/0x660 [<ffffffff81056d9f>] copy_process.part.22+0xa5f/0x1510 [<ffffffff81057931>] do_fork+0x91/0x350 [<ffffffff81057c76>] sys_clone+0x16/0x20 [<ffffffff816ccbf9>] stub_clone+0x69/0x90 [<ffffffff816cc89d>] ? system_call_fastpath+0x1a/0x1f ---[ end trace 4918cdd0a4c9fea4 ]---
(a similar message shows up if you end up launching 'mcelog')
The call chain is (as analyzed by Liu, Jinsong):do_fork
--> copy_process
--> dup_mm
--> dup_mmap
--> copy_page_range
--> track_pfn_copy
--> reserve_pfn_range
--> line 624: flags != want_flagsIt comes from different memory types of page table (_PAGE_CACHE_WB) and MTRR (_PAGE_CACHE_UC_MINUS).
Stefan Bader dug in this deep and found out that:
"That makes it clearer as this will do
reserve_memtype(...)
--> pat_x_mtrr_type
--> mtrr_type_lookup
--> __mtrr_type_lookup
And that can return -1/0xff in case of MTRR not being enabled/initialized. Which is not the case (given there are no messages for it in dmesg). This is not equal to MTRR_TYPE_WRBACK and thus becomes _PAGE_CACHE_UC_MINUS.
It looks like the problem starts early in reserve_memtype:
if (!pat_enabled) {
/* This is identical to page table setting without PAT */
if (new_type) {
if (req_type == _PAGE_CACHE_WC)
*new_type = _PAGE_CACHE_UC_MINUS;
else
*new_type = req_type & _PAGE_CACHE_MASK;
}
return 0;
}This would be what we want, that is clearing the PWT and PCD flags from the supported flags - if pat_enabled is disabled."
This patch does that - disabling PAT.
--- arch/x86/xen/enlighten.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten.c +9 -1
@@ -67,6 +67,7 @@#include <asm/hypervisor.h> #include <asm/mwait.h> #include <asm/pci_x86.h> +#include <asm/pat.h> #ifdef CONFIG_ACPI #include <linux/acpi.h>
@@ -1417,7 +1418,14 @@ asmlinkage void __init xen_start_kernel(*/ acpi_numa =-1 ;#endif - +#ifdef CONFIG_X86_PAT +/* +* For right now disable the PAT. We should remove this once +* git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1 +* (xen/pat: Disable PAT support for now) is reverted. +*/ + pat_enabled =0 ; +#endif /* Don't do the full vcpu_info placement stuff until we have a possible map and a non-dummy shared_info. */ per_cpu (xen_vcpu,0 ) = &HYPERVISOR_shared_info->vcpu_info[0 ];
Greg Kroah-Hartman
maintainerPATCH 8/100 xen/pci: We dont do multiple MSIs.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 884ac2978a295b7df3c4a686d3bff6932bbbb460 upstream.
There is no hypercall to setup multiple MSI per PCI device. As such with these two new commits:
- 08261d87f7d1b6253ab3223756625a5c74532293
PCI/MSI: Enable multiple MSIs with pci_enable_msi_block_auto()
- 5ca72c4f7c412c2002363218901eba5516c476b1
AHCI: Support multiple MSIs
we would call the PHYSDEVOP_map_pirq 'nvec' times with the same contents of the PCI device. Sander discovered that we would get the same PIRQ value 'nvec' times and return said values to the caller. That of course meant that the device was configured only with one MSI and AHCI would fail with:
ahci 0000:00:11.0: version 3.0
xen: registering gsi 19 triggering 0 polarity 1
xen: --> pirq=19 -> irq=19 (gsi=19)
(XEN) [2013-02-27 19:43:07] IOAPIC[0]: Set PCI routing entry (6-19 -> 0x99 -> IRQ 19 Mode:1 Active:1) ahci 0000:00:11.0: AHCI 0001.0200 32 slots 4 ports 6 Gbps 0xf impl SATA mode
ahci 0000:00:11.0: flags: 64bit ncq sntf ilck pm led clo pmp pio slum part
ahci: probe of 0000:00:11.0 failed with error -22
That is b/c in ahci_host_activate the second call to devm_request_threaded_irq would return -EINVAL as we passed in (on the second run) an IRQ that was never initialized.
--- arch/x86/pci/xen.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/pci/xen.c +9 -0
@@ -162,6 +162,9 @@ static int xen_setup_msi_irqs(struct pcistruct msi_desc *msidesc;int *v; +if (type ==PCI_CAP_ID_MSI && nvec >1 ) +return 1 ; + v =kzalloc (sizeof (int ) *max (1 , nvec),GFP_KERNEL );if (!v)return -ENOMEM ;
@@ -220,6 +223,9 @@ static int xen_hvm_setup_msi_irqs(structstruct msi_desc *msidesc;struct msi_msg msg; +if (type ==PCI_CAP_ID_MSI && nvec >1 ) +return 1 ; +list_for_each_entry (msidesc, &dev->msi_list, list) {__read_msi_msg (msidesc, &msg); pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
@@ -263,6 +269,9 @@ static int xen_initdom_setup_msi_irqs(stint ret =0 ;struct msi_desc *msidesc; +if (type ==PCI_CAP_ID_MSI && nvec >1 ) +return 1 ; +list_for_each_entry (msidesc, &dev->msi_list, list) {struct physdev_map_pirq map_irq;domid_t domid;
Greg Kroah-Hartman
maintainerPATCH 9/100 watchdog: da9055_wdt needs to select WATCHDOG_CORE
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
commit 12a5c05cb143105d989abf728a8c769830670e54 upstream.
DA9055_WATCHDOG (introduced in v3.8) needs to select WATCHDOG_CORE so that it will build cleanly. Fixes these build errors:
da9055_wdt.c:(.text+0xe9bc7): undefined reference to watchdog_unregister_device' da9055_wdt.c:(.text+0xe9f4b): undefined reference to watchdog_register_device'
--- drivers/watchdog/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/Kconfig +1 -0
@@ -79,6 +79,7 @@ config DA9052_WATCHDOG config DA9055_WATCHDOG tristate "Dialog Semiconductor DA9055 Watchdog" depends on MFD_DA9055 + select WATCHDOG_CORE help If you say yes here you get support for watchdog on the Dialog Semiconductor DA9055 PMIC.
Greg Kroah-Hartman
maintainerPATCH 10/100 watchdog: sp5100_tco: Fix wrong indirect I/O access for getting value of reserved bits
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahisa Tanaka <[email protected]>
commit 10ab329b5db7e592a3a60b4594e4e5f40b60c45c upstream.
In case of SB800 or later chipset and re-programming MMIO address(*), sp5100_tco module may read incorrect value of reserved bit, because the module reads a value from an incorrect I/O address. However, this bug doesn't cause a problem, because when re-programming MMIO address, by chance the module writes zero (this is BIOS's default value) to the low three bits of register.
* In most cases, PC with SB8x0 or later chipset doesn't need to re-programming MMIO address, because such PC can enable AcpiMmio and can use 0xfed80b00 for watchdog register base address.
This patch fixes this bug.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43176
--- drivers/watchdog/sp5100_tco.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/watchdog/sp5100_tco.c +3 -2
@@ -500,14 +500,15 @@ static unsigned char sp5100_tco_setupdev/* Restore to the low three bits, if chipset is SB8x0(or later) */ if (sp5100_tco_pci->revision >=0x40 ) {u8 reserved_bit; - reserved_bit =inb (base_addr) &0x7 ; +outb (base_addr+0 , index_reg); + reserved_bit =inb (data_reg) &0x7 ; val |= (u32 )reserved_bit; }/* Re-programming the watchdog timer base address */ outb (base_addr+0 , index_reg);/* Low three bits of BASE are reserved */ -outb ((val >>0 ) &0xf8 , data_reg); +outb ((val >>0 ) &0xff , data_reg);outb (base_addr+1 , index_reg);outb ((val >>8 ) &0xff , data_reg);outb (base_addr+2 , index_reg);
Greg Kroah-Hartman
maintainerPATCH 11/100 watchdog: sp5100_tco: Write back the original value to reserved bits, instead of zero
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahisa Tanaka <[email protected]>
commit 41adafbd7b84c66c2cdad857b75d5d45032310a6 upstream.
In case of SP5100 or SB7x0 chipsets, the sp5100_tco module writes zero to reserved bits. The module, however, shouldn't depend on specific default value, and should perform a read-merge-write operation for the reserved bits.
This patch makes the sp5100_tco module perform a read-merge-write operation on all the chipset (sp5100, sb7x0, sb8x0 or later).
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43176
--- drivers/watchdog/sp5100_tco.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/watchdog/sp5100_tco.c +8 -20
@@ -361,7 +361,7 @@ static unsigned char sp5100_tco_setupdev {struct pci_dev *dev =NULL ;const char *dev_name =NULL ; -u32 val; +u32 val, tmp_val;u32 index_reg, data_reg, base_addr;/* Match the PCI device */
@@ -497,31 +497,19 @@ static unsigned char sp5100_tco_setupdevpr_debug ("Got 0x%04x from resource tree\n" , val); } -/* Restore to the low three bits, if chipset is SB8x0(or later) */ -if (sp5100_tco_pci->revision >=0x40 ) { -u8 reserved_bit; -outb (base_addr+0 , index_reg); - reserved_bit =inb (data_reg) &0x7 ; - val |= (u32 )reserved_bit; - } +/* Restore to the low three bits */ +outb (base_addr+0 , index_reg); + tmp_val = val | (inb (data_reg) &0x7 );/* Re-programming the watchdog timer base address */ outb (base_addr+0 , index_reg); -/* Low three bits of BASE are reserved */ -outb ((val >>0 ) &0xff , data_reg); +outb ((tmp_val >>0 ) &0xff , data_reg);outb (base_addr+1 , index_reg); -outb ((val >>8 ) &0xff , data_reg); +outb ((tmp_val >>8 ) &0xff , data_reg);outb (base_addr+2 , index_reg); -outb ((val >>16 ) &0xff , data_reg); +outb ((tmp_val >>16 ) &0xff , data_reg);outb (base_addr+3 , index_reg); -outb ((val >>24 ) &0xff , data_reg); - -/* -* Clear unnecessary the low three bits, -* if chipset is SB8x0(or later) -*/ -if (sp5100_tco_pci->revision >=0x40 ) - val &= ~0x7 ; +outb ((tmp_val >>24 ) &0xff , data_reg);if (!request_mem_region_exclusive (val,SP5100_WDT_MEM_MAP_SIZE , dev_name)) {
Greg Kroah-Hartman
maintainerPATCH 12/100 sony-laptop: fully enable SNY controlled modems
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mattia Dongili <[email protected]>
commit 3ec1c3983d73b1e3d4cfd72afab94c34eceafe8a upstream.
The call to handlers 0x124 and 0x135 (rfkill control) seems to take a bitmask to control various states of the device. For our rfkill we need a fully on/off. SVZ1311Z9R/X's LTE modem needs more bits up.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47751
--- drivers/platform/x86/sony-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/sony-laptop.c +1 -1
@@ -1534,7 +1534,7 @@ static int sony_nc_rfkill_set(void *dataint argument = sony_rfkill_address[(long ) data] +0x100 ;if (!blocked) - argument |=0x030000 ; + argument |=0x070000 ;return sony_call_snc_handle (sony_rfkill_handle, argument, &result); }
Greg Kroah-Hartman
maintainerPATCH 13/100 SCSI: dc395x: uninitialized variable in device_alloc()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 208afec4f3be8c51ad6eebe6611dd6d2ad2fa298 upstream.
This bug was introduced back in bitkeeper days in 2003. We use "dcb->dev_mode" before it has been initialized.
--- drivers/scsi/dc395x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/dc395x.c +1 -1
@@ -3747,13 +3747,13 @@ static struct DeviceCtlBlk *device_alloc dcb->max_command =1 ; dcb->target_id = target; dcb->target_lun = lun; + dcb->dev_mode = eeprom->target[target].cfg0;#ifndef DC395x_NO_DISCONNECT dcb->identify_msg =IDENTIFY (dcb->dev_mode &NTC_DO_DISCONNECT , lun);#else dcb->identify_msg =IDENTIFY (0 , lun);#endif - dcb->dev_mode = eeprom->target[target].cfg0; dcb->inquiry7 =0 ; dcb->sync_mode =0 ; dcb->min_nego_period = clock_period[period_index];
Greg Kroah-Hartman
maintainerPATCH 14/100 SCSI: storvsc: Initialize the sglist
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit 9d2696e658ef4f209955ddaa987d43f1a1bd81a1 upstream.
Properly initialize scatterlist before using it.
--- drivers/scsi/storvsc_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/storvsc_drv.c +1 -0
@@ -467,6 +467,7 @@ static struct scatterlist *create_bounceif (!bounce_sgl)return NULL ; +sg_init_table (bounce_sgl, num_pages);for (i =0 ; i < num_pages; i++) { page_buf =alloc_page (GFP_ATOMIC );if (!page_buf)
Greg Kroah-Hartman
maintainerPATCH 15/100 target/pscsi: Fix page increment
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asias He <[email protected]>
commit 472b72f2db7831d7dbe22ffdff4adee3bd49b05d upstream.
The page++ is wrong. It makes bio_add_pc_page() pointing to a wrong page address if the 'while (len > 0 && data_len > 0) { ... }' loop is executed more than one once.
--- drivers/target/target_core_pscsi.c | 1 - 1 file changed, 1 deletion(-)
drivers/target/target_core_pscsi.c +0 -1
@@ -940,7 +940,6 @@ pscsi_map_sg(struct se_cmd *cmd, struct bio =NULL ; } - page++; len -= bytes; data_len -= bytes; off =0 ;
Greg Kroah-Hartman
maintainerPATCH 16/100 iscsi-target: Fix immediate queue starvation regression with DATAIN
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit fd3a9025c0349bc9b01d627529f54e6e1e389015 upstream.
This patch addresses a v3.5+ regression in iscsi-target where TX thread process context -> handle_response_queue() execution is allowed to run unbounded while servicing constant outgoing flow of ISTATE_SEND_DATAIN response state.
This ends up preventing memory release of StatSN acknowledged commands in a timely manner when under heavy large block streaming DATAIN workloads.
The regression bug was initially introduced with:
commit 6f3c0e69a9c20441bdc6d3b2d18b83b244384ec6
Author: Andy Grover <[email protected]> Date: Tue Apr 3 15:51:09 2012 -0700
target/iscsi: Refactor target_tx_thread immediate+response queue loops
Go ahead and follow original iscsi_target_tx_thread() logic and check to break for immediate queue processing after each DataIN Sequence and/or Response PDU has been sent.
--- drivers/target/iscsi/iscsi_target.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/target/iscsi/iscsi_target.c +9 -2
@@ -3570,6 +3570,10 @@ check_rsp_state:spin_lock_bh (&cmd->istate_lock); cmd->i_state =ISTATE_SENT_STATUS ;spin_unlock_bh (&cmd->istate_lock); + +if (atomic_read (&conn->check_immediate_queue)) +return 1 ; +continue ; }else if (ret ==2 ) {/* Still must send status,
@@ -3659,7 +3663,7 @@ check_rsp_state: }if (atomic_read (&conn->check_immediate_queue)) -break ; +return 1 ; }return 0 ;
@@ -3703,12 +3707,15 @@ restart: signal_pending(current)) goto transport_err; +get_immediate: ret =handle_immediate_queue (conn);if (ret <0 ) goto transport_err; ret =handle_response_queue (conn); -if (ret == -EAGAIN ) +if (ret ==1 ) + goto get_immediate; +else if (ret == -EAGAIN ) goto restart;else if (ret <0 ) goto transport_err;
Greg Kroah-Hartman
maintainerPATCH 17/100 ext4: convert number of blocks to clusters properly
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit 810da240f221d64bf90020f25941b05b378186fe upstream.
We're using macro EXT4_B2C() to convert number of blocks to number of clusters for bigalloc file systems. However, we should be using EXT4_NUM_B2C().
--- fs/ext4/balloc.c | 2 +- fs/ext4/mballoc.c | 8 ++++---- fs/ext4/resize.c | 6 +++--- fs/ext4/super.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-)
fs/ext4/balloc.c +1 -1
@@ -635,7 +635,7 @@ ext4_fsblk_t ext4_count_free_clusters(stbrelse (bitmap_bh);printk (KERN_DEBUG "ext4_count_free_clusters: stored = %llu" ", computed = %llu, %llu\n" , -EXT4_B2C (EXT4_SB (sb),ext4_free_blocks_count (es)), +EXT4_NUM_B2C (EXT4_SB (sb),ext4_free_blocks_count (es)), desc_count, bitmap_count);return bitmap_count;#else
fs/ext4/mballoc.c +4 -4
@@ -3444,7 +3444,7 @@ ext4_mb_new_inode_pa(struct ext4_allocat win = offs; ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - -EXT4_B2C (sbi, win); +EXT4_NUM_B2C (sbi, win);BUG_ON (ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical);BUG_ON (ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); }
@@ -4590,7 +4590,7 @@ do_more:EXT4_BLOCKS_PER_GROUP (sb); count -= overflow; } - count_clusters =EXT4_B2C (sbi, count); + count_clusters =EXT4_NUM_B2C (sbi, count); bitmap_bh =ext4_read_block_bitmap (sb, block_group);if (!bitmap_bh) { err = -EIO ;
@@ -4832,11 +4832,11 @@ int ext4_group_add_blocks(handle_t *handext4_group_desc_csum_set (sb, block_group, desc);ext4_unlock_group (sb, block_group);percpu_counter_add (&sbi->s_freeclusters_counter, -EXT4_B2C (sbi, blocks_freed)); +EXT4_NUM_B2C (sbi, blocks_freed));if (sbi->s_log_groups_per_flex) {ext4_group_t flex_group =ext4_flex_group (sbi, block_group); -atomic_add (EXT4_B2C (sbi, blocks_freed), +atomic_add (EXT4_NUM_B2C (sbi, blocks_freed), &sbi->s_flex_groups[flex_group].free_clusters); }
fs/ext4/resize.c +3 -3
@@ -1247,7 +1247,7 @@ static int ext4_setup_new_descs(handle_text4_inode_table_set (sb, gdp, group_data->inode_table);ext4_free_group_clusters_set (sb, gdp, -EXT4_B2C (sbi, group_data->free_blocks_count)); +EXT4_NUM_B2C (sbi, group_data->free_blocks_count));ext4_free_inodes_set (sb, gdp,EXT4_INODES_PER_GROUP (sb));if (ext4_has_group_desc_csum (sb)) ext4_itable_unused_set(sb, gdp,
@@ -1349,7 +1349,7 @@ static void ext4_update_super(struct sup/* Update the free space counts */ percpu_counter_add (&sbi->s_freeclusters_counter, -EXT4_B2C (sbi, free_blocks)); +EXT4_NUM_B2C (sbi, free_blocks));percpu_counter_add (&sbi->s_freeinodes_counter,EXT4_INODES_PER_GROUP (sb) * flex_gd->count);
@@ -1360,7 +1360,7 @@ static void ext4_update_super(struct sup sbi->s_log_groups_per_flex) {ext4_group_t flex_group; flex_group =ext4_flex_group (sbi, group_data[0 ].group); -atomic_add (EXT4_B2C (sbi, free_blocks), +atomic_add (EXT4_NUM_B2C (sbi, free_blocks), &sbi->s_flex_groups[flex_group].free_clusters);atomic_add (EXT4_INODES_PER_GROUP (sb) * flex_gd->count, &sbi->s_flex_groups[flex_group].free_inodes);
fs/ext4/super.c +1 -1
@@ -3235,7 +3235,7 @@ int ext4_calculate_overhead(struct super }/* Add the journal blocks as well */ if (sbi->s_journal) - overhead +=EXT4_B2C (sbi, sbi->s_journal->j_maxlen); + overhead +=EXT4_NUM_B2C (sbi, sbi->s_journal->j_maxlen); sbi->s_overhead = overhead;smp_wmb ();
Greg Kroah-Hartman
maintainerPATCH 18/100 btrfs: Init io_lock after cloning btrfs device struct
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 1cba0cdf5e4dbcd9e5fa5b54d7a028e55e2ca057 upstream.
__btrfs_close_devices() clones btrfs device structs with memcpy(). Some of the fields in the clone are reinitialized, but it's missing to init io_lock. In mainline this goes unnoticed, but on RT it leaves the plist pointing to the original about to be freed lock struct.
Initialize io_lock after cloning, so no references to the original struct are left.
--- fs/btrfs/volumes.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/volumes.c +1 -0
@@ -647,6 +647,7 @@ static int __btrfs_close_devices(struct new_device->writeable =0 ; new_device->in_fs_metadata =0 ; new_device->can_discard =0 ; +spin_lock_init (&new_device->io_lock);list_replace_rcu (&device->dev_list, &new_device->dev_list);call_rcu (&device->rcu, free_device);
Greg Kroah-Hartman
maintainerPATCH 19/100 Btrfs: copy everything if weve created an inline extent
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit bdc20e67e82cfc4901d3a5a0d79104b0e2296d83 upstream.
I noticed while looking into a tree logging bug that we aren't logging inline extents properly. Since this requires copying and it shouldn't happen too often just force us to copy everything for the inode into the tree log when we have an inline extent. With this patch we have valid data after a crash when we write an inline extent. Thanks,
--- fs/btrfs/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/inode.c +1 -0
@@ -265,6 +265,7 @@ static noinline int cow_file_range_inlinreturn 1 ; } +set_bit (BTRFS_INODE_NEEDS_FULL_SYNC , &BTRFS_I (inode)->runtime_flags);btrfs_delalloc_release_metadata (inode, end +1 - start);btrfs_drop_extent_cache (inode, start, aligned_end -1 ,0 );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 20/100 Btrfs: delete inline extents when we find them during logging
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 124fe663f93162d17b7e391705cac122101e93d8 upstream.
Apparently when we do inline extents we allow the data to overlap the last chunk of the btrfs_file_extent_item, which means that we can possibly have a btrfs_file_extent_item that isn't actually as large as a btrfs_file_extent_item. This messes with us when we try to overwrite the extent when logging new extents since we expect for it to be the right size. To fix this just delete the item and try to do the insert again which will give us the proper sized btrfs_file_extent_item. This fixes a panic where map_private_extent_buffer would blow up because we're trying to write past the end of the leaf. Thanks,
--- fs/btrfs/tree-log.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
fs/btrfs/tree-log.c +18 -0
@@ -3281,6 +3281,7 @@ static int log_one_extent(struct btrfs_tint ret;bool skip_csum =BTRFS_I (inode)->flags &BTRFS_INODE_NODATASUM ; +insert:INIT_LIST_HEAD (&ordered_sums);btrfs_init_map_token (&token); key.objectid =btrfs_ino (inode);
@@ -3296,6 +3297,23 @@ static int log_one_extent(struct btrfs_t leaf = path->nodes[0 ]; fi =btrfs_item_ptr (leaf, path->slots[0 ], struct btrfs_file_extent_item); + +/* +* If we are overwriting an inline extent with a real one then we need +* to just delete the inline extent as it may not be large enough to +* have the entire file_extent_item. +*/ +if (ret &&btrfs_token_file_extent_type (leaf, fi, &token) == +BTRFS_FILE_EXTENT_INLINE ) { + ret =btrfs_del_item (trans, log, path); +btrfs_release_path (path); +if (ret) { + path->really_keep_locks =0 ; +return ret; + } + goto insert; + } +btrfs_set_token_file_extent_generation (leaf, fi, em->generation, &token);if (test_bit (EXTENT_FLAG_PREALLOC , &em->flags)) {
Greg Kroah-Hartman
maintainerPATCH 21/100 cifs: ensure that cifs_get_root() only traverses directories
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit ce2ac52105aa663056dfc17966ebed1bf93e6e64 upstream.
Kjell Braden reported this oops:
[ 833.211970] BUG: unable to handle kernel NULL pointer dereference at (null) [ 833.212816] IP: [< (null)>] (null) [ 833.213280] PGD 1b9b2067 PUD e9f7067 PMD 0 [ 833.213874] Oops: 0010 [#1] SMP [ 833.214344] CPU 0 [ 833.214458] Modules linked in: des_generic md4 nls_utf8 cifs vboxvideo drm snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq bnep rfcomm snd_timer bluetooth snd_seq_device ppdev snd vboxguest parport_pc joydev mac_hid soundcore snd_page_alloc psmouse i2c_piix4 serio_raw lp parport usbhid hid e1000 [ 833.215629] [ 833.215629] Pid: 1752, comm: mount.cifs Not tainted 3.0.0-rc7-bisectcifs-fec11dd9a0+ #18 innotek GmbH VirtualBox/VirtualBox [ 833.215629] RIP: 0010:[<0000000000000000>] [< (null)>] (null) [ 833.215629] RSP: 0018:ffff8800119c9c50 EFLAGS: 00010282 [ 833.215629] RAX: ffffffffa02186c0 RBX: ffff88000c427780 RCX: 0000000000000000 [ 833.215629] RDX: 0000000000000000 RSI: ffff88000c427780 RDI: ffff88000c4362e8 [ 833.215629] RBP: ffff8800119c9c88 R08: ffff88001fc15e30 R09: 00000000d69515c7 [ 833.215629] R10: ffffffffa0201972 R11: ffff88000e8f6a28 R12: ffff88000c4362e8 [ 833.215629] R13: 0000000000000000 R14: 0000000000000000 R15: ffff88001181aaa6 [ 833.215629] FS: 00007f2986171700(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000 [ 833.215629] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 833.215629] CR2: 0000000000000000 CR3: 000000001b982000 CR4: 00000000000006f0 [ 833.215629] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 833.215629] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 833.215629] Process mount.cifs (pid: 1752, threadinfo ffff8800119c8000, task ffff88001c1c16f0) [ 833.215629] Stack: [ 833.215629] ffffffff8116a9b5 ffff8800119c9c88 ffffffff81178075 0000000000000286 [ 833.215629] 0000000000000000 ffff88000c4276c0 ffff8800119c9ce8 ffff8800119c9cc8 [ 833.215629] ffffffff8116b06e ffff88001bc6fc00 ffff88000c4276c0 ffff88000c4276c0 [ 833.215629] Call Trace: [ 833.215629] [<ffffffff8116a9b5>] ? d_alloc_and_lookup+0x45/0x90 [ 833.215629] [<ffffffff81178075>] ? d_lookup+0x35/0x60 [ 833.215629] [<ffffffff8116b06e>] __lookup_hash.part.14+0x9e/0xc0 [ 833.215629] [<ffffffff8116b1d6>] lookup_one_len+0x146/0x1e0 [ 833.215629] [<ffffffff815e4f7e>] ? _raw_spin_lock+0xe/0x20 [ 833.215629] [<ffffffffa01eef0d>] cifs_do_mount+0x26d/0x500 [cifs] [ 833.215629] [<ffffffff81163bd3>] mount_fs+0x43/0x1b0 [ 833.215629] [<ffffffff8117d41a>] vfs_kern_mount+0x6a/0xd0 [ 833.215629] [<ffffffff8117e584>] do_kern_mount+0x54/0x110 [ 833.215629] [<ffffffff8117fdc2>] do_mount+0x262/0x840 [ 833.215629] [<ffffffff81108a0e>] ? __get_free_pages+0xe/0x50 [ 833.215629] [<ffffffff8117f9ca>] ? copy_mount_options+0x3a/0x180 [ 833.215629] [<ffffffff8118075d>] sys_mount+0x8d/0xe0 [ 833.215629] [<ffffffff815ece82>] system_call_fastpath+0x16/0x1b [ 833.215629] Code: Bad RIP value. [ 833.215629] RIP [< (null)>] (null) [ 833.215629] RSP <ffff8800119c9c50> [ 833.215629] CR2: 0000000000000000 [ 833.238525] ---[ end trace ec00758b8d44f529 ]---
When walking down the path on the server, it's possible to hit a symlink. The path walking code assumes that the caller will handle that situation properly, but cifs_get_root() isn't set up for it. This patch prevents the oops by simply returning an error.
A better solution would be to try and chase the symlinks here, but that's fairly complicated to handle.
Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=53221
--- fs/cifs/cifsfs.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/cifs/cifsfs.c +5 -0
@@ -558,6 +558,11 @@ cifs_get_root(struct smb_vol *vol, struc dentry =ERR_PTR (-ENOENT );break ; } +if (!S_ISDIR (dir->i_mode)) { +dput (dentry); + dentry =ERR_PTR (-ENOTDIR ); +break ; + }/* skip separators */ while (*s == sep)
Greg Kroah-Hartman
maintainerPATCH 22/100 dm: fix truncated status strings
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit fd7c092e711ebab55b2688d3859d95dfd0301f73 upstream.
Avoid returning a truncated table or status string instead of setting the DM_BUFFER_FULL_FLAG when the last target of a table fills the buffer.
When processing a table or status request, the function retrieve_status calls ti->type->status. If ti->type->status returns non-zero, retrieve_status assumes that the buffer overflowed and sets DM_BUFFER_FULL_FLAG.
However, targets don't return non-zero values from their status method on overflow. Most targets returns always zero.
If a buffer overflow happens in a target that is not the last in the table, it gets noticed during the next iteration of the loop in retrieve_status; but if a buffer overflow happens in the last target, it goes unnoticed and erroneously truncated data is returned.
In the current code, the targets behave in the following way:
* dm-crypt returns -ENOMEM if there is not enough space to store the key, but it returns 0 on all other overflows.
* dm-thin returns errors from the status method if a disk error happened. This is incorrect because retrieve_status doesn't check the error code, it assumes that all non-zero values mean buffer overflow.
* all the other targets always return 0.
This patch changes the ti->type->status function to return void (because most targets don't use the return code). Overflow is detected inretrieve_status: if the status method fills up the remaining space completely, it is assumed that buffer overflow happened.
--- drivers/md/dm-crypt.c | 39 ++++--------------- drivers/md/dm-delay.c | 8 +--- drivers/md/dm-flakey.c | 7 +-- drivers/md/dm-ioctl.c | 14 ++++--- drivers/md/dm-linear.c | 7 +-- drivers/md/dm-mpath.c | 8 +--- drivers/md/dm-raid.c | 8 +--- drivers/md/dm-raid1.c | 8 +--- drivers/md/dm-snap.c | 16 +++----- drivers/md/dm-stripe.c | 7 +-- drivers/md/dm-thin.c | 82 +++++++++++++++++++++++++----------------- drivers/md/dm-verity.c | 8 +--- include/linux/device-mapper.h | 4 +- 13 files changed, 100 insertions(+), 116 deletions(-)
drivers/md/dm-crypt.c +9 -30
@@ -1234,20 +1234,6 @@ static int crypt_decode_key(u8 *key, chareturn 0 ; } -/* -* Encode key into its hex representation -*/ -static void crypt_encode_key (char *hex,u8 *key,unsigned int size) -{ -unsigned int i; - -for (i =0 ; i < size; i++) { -sprintf (hex,"%02x" , *key); - hex +=2 ; - key++; - } -} -static void crypt_free_tfms (struct crypt_config *cc) {unsigned i;
@@ -1717,11 +1703,11 @@ static int crypt_map(struct dm_target *treturn DM_MAPIO_SUBMITTED ; } -static int crypt_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void crypt_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {struct crypt_config *cc = ti->private; -unsigned int sz =0 ; +unsigned i, sz =0 ;switch (type) {case STATUSTYPE_INFO :
@@ -1731,17 +1717,11 @@ static int crypt_status(struct dm_targetcase STATUSTYPE_TABLE :DMEMIT ("%s " , cc->cipher_string); -if (cc->key_size >0 ) { -if ((maxlen - sz) < ((cc->key_size <<1 ) +1 )) -return -ENOMEM ; - -crypt_encode_key (result + sz, cc->key, cc->key_size); - sz += cc->key_size <<1 ; - }else { -if (sz >= maxlen) -return -ENOMEM ; - result[sz++] ='-' ; - } +if (cc->key_size >0 ) +for (i =0 ; i < cc->key_size; i++) +DMEMIT ("%02x" , cc->key[i]); +else +DMEMIT ("-" );DMEMIT (" %llu %s %llu" , (unsigned long long )cc->iv_offset, cc->dev->name, (unsigned long long )cc->start);
@@ -1751,7 +1731,6 @@ static int crypt_status(struct dm_targetbreak ; } -return 0 ; }static void crypt_postsuspend (struct dm_target *ti)
@@ -1845,7 +1824,7 @@ static int crypt_iterate_devices(structstatic struct target_type crypt_target = { .name ="crypt" , - .version = {1 ,12 ,0 }, + .version = {1 ,12 ,1 }, .module =THIS_MODULE , .ctr = crypt_ctr, .dtr = crypt_dtr,
drivers/md/dm-delay.c +3 -5
@@ -293,8 +293,8 @@ static int delay_map(struct dm_target *treturn delay_bio (dc, dc->read_delay, bio); } -static int delay_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void delay_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {struct delay_c *dc = ti->private;int sz =0 ;
@@ -314,8 +314,6 @@ static int delay_status(struct dm_target dc->write_delay);break ; } - -return 0 ; } static int delay_iterate_devices(struct dm_target *ti,
@@ -337,7 +335,7 @@ out:static struct target_type delay_target = { .name ="delay" , - .version = {1 ,2 ,0 }, + .version = {1 ,2 ,1 }, .module =THIS_MODULE , .ctr = delay_ctr, .dtr = delay_dtr,
drivers/md/dm-flakey.c +3 -4
@@ -337,8 +337,8 @@ static int flakey_end_io(struct dm_targereturn error; } -static int flakey_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void flakey_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {unsigned sz =0 ;struct flakey_c *fc = ti->private;
@@ -368,7 +368,6 @@ static int flakey_status(struct dm_targebreak ; } -return 0 ; }static int flakey_ioctl (struct dm_target *ti,unsigned int cmd,unsigned long arg)
@@ -411,7 +410,7 @@ static int flakey_iterate_devices(structstatic struct target_type flakey_target = { .name ="flakey" , - .version = {1 ,3 ,0 }, + .version = {1 ,3 ,1 }, .module =THIS_MODULE , .ctr = flakey_ctr, .dtr = flakey_dtr,
drivers/md/dm-ioctl.c +9 -5
@@ -1067,6 +1067,7 @@ static void retrieve_status(struct dm_ta num_targets =dm_table_get_num_targets (table);for (i =0 ; i < num_targets; i++) {struct dm_target *ti =dm_table_get_target (table, i); +size_t l; remaining = len - (outptr - outbuf);if (remaining <=sizeof (struct dm_target_spec )) {
@@ -1093,14 +1094,17 @@ static void retrieve_status(struct dm_taif (ti->type->status) {if (param->flags &DM_NOFLUSH_FLAG ) status_flags |=DM_STATUS_NOFLUSH_FLAG ; -if (ti->type->status (ti, type, status_flags, outptr, remaining)) { - param->flags |=DM_BUFFER_FULL_FLAG ; -break ; - } + ti->type->status (ti, type, status_flags, outptr, remaining); }else outptr[0 ] ='\0' ; - outptr +=strlen (outptr) +1 ; + l =strlen (outptr) +1 ; +if (l == remaining) { + param->flags |=DM_BUFFER_FULL_FLAG ; +break ; + } + + outptr += l; used = param->data_start + (outptr - outbuf); outptr =align_ptr (outptr);
drivers/md/dm-linear.c +3 -4
@@ -95,8 +95,8 @@ static int linear_map(struct dm_target *return DM_MAPIO_REMAPPED ; } -static int linear_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void linear_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {struct linear_c *lc = (struct linear_c *) ti->private;
@@ -110,7 +110,6 @@ static int linear_status(struct dm_targe (unsigned long long)lc->start);break ; } -return 0 ; } static int linear_ioctl(struct dm_target *ti, unsigned int cmd,
@@ -155,7 +154,7 @@ static int linear_iterate_devices(structstatic struct target_type linear_target = { .name ="linear" , - .version = {1 ,2 ,0 }, + .version = {1 ,2 ,1 }, .module =THIS_MODULE , .ctr = linear_ctr, .dtr = linear_dtr,
drivers/md/dm-mpath.c +3 -5
@@ -1378,8 +1378,8 @@ static void multipath_resume(struct dm_t* [priority selector-name num_ps_args [ps_args]* * num_paths num_selector_args [path_dev [selector_args]* ]+ ]+ */ -static int multipath_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void multipath_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {int sz =0 ;unsigned long flags;
@@ -1485,8 +1485,6 @@ static int multipath_status(struct dm_ta }spin_unlock_irqrestore (&m->lock, flags); - -return 0 ; }static int multipath_message (struct dm_target *ti,unsigned argc,char **argv)
@@ -1695,7 +1693,7 @@ out:*---------------------------------------------------------------*/ static struct target_type multipath_target = { .name ="multipath" , - .version = {1 ,5 ,0 }, + .version = {1 ,5 ,1 }, .module =THIS_MODULE , .ctr = multipath_ctr, .dtr = multipath_dtr,
drivers/md/dm-raid.c +3 -5
@@ -1201,8 +1201,8 @@ static int raid_map(struct dm_target *tireturn DM_MAPIO_SUBMITTED ; } -static int raid_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void raid_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {struct raid_set *rs = ti->private;unsigned raid_param_cnt =1 ;/* at least 1 for chunksize */
@@ -1344,8 +1344,6 @@ static int raid_status(struct dm_targetDMEMIT (" -" ); } } - -return 0 ; }static int raid_iterate_devices (struct dm_target *ti,iterate_devices_callout_fn fn,void *data)
@@ -1405,7 +1403,7 @@ static void raid_resume(struct dm_targetstatic struct target_type raid_target = { .name ="raid" , - .version = {1 ,4 ,1 }, + .version = {1 ,4 ,2 }, .module =THIS_MODULE , .ctr = raid_ctr, .dtr = raid_dtr,
drivers/md/dm-raid1.c +3 -5
@@ -1347,8 +1347,8 @@ static char device_status_char(struct mi } -static int mirror_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void mirror_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {unsigned int m, sz =0 ;struct mirror_set *ms = (struct mirror_set *) ti->private;
@@ -1383,8 +1383,6 @@ static int mirror_status(struct dm_targeif (ms->features &DM_RAID1_HANDLE_ERRORS )DMEMIT (" 1 handle_errors" ); } - -return 0 ; } static int mirror_iterate_devices(struct dm_target *ti,
@@ -1403,7 +1401,7 @@ static int mirror_iterate_devices(structstatic struct target_type mirror_target = { .name ="mirror" , - .version = {1 ,13 ,1 }, + .version = {1 ,13 ,2 }, .module =THIS_MODULE , .ctr = mirror_ctr, .dtr = mirror_dtr,
drivers/md/dm-snap.c +6 -10
@@ -1837,8 +1837,8 @@ static void snapshot_merge_resume(structstart_merge (s); } -static int snapshot_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void snapshot_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {unsigned sz =0 ;struct dm_snapshot *snap = ti->private;
@@ -1884,8 +1884,6 @@ static int snapshot_status(struct dm_tar maxlen - sz);break ; } - -return 0 ; } static int snapshot_iterate_devices(struct dm_target *ti,
@@ -2139,8 +2137,8 @@ static void origin_resume(struct dm_targ ti->max_io_len =get_origin_minimum_chunksize (dev->bdev); } -static int origin_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void origin_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {struct dm_dev *dev = ti->private;
@@ -2153,8 +2151,6 @@ static int origin_status(struct dm_targesnprintf (result, maxlen,"%s" , dev->name);break ; } - -return 0 ; } static int origin_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
@@ -2181,7 +2177,7 @@ static int origin_iterate_devices(structstatic struct target_type origin_target = { .name ="snapshot-origin" , - .version = {1 ,8 ,0 }, + .version = {1 ,8 ,1 }, .module =THIS_MODULE , .ctr = origin_ctr, .dtr = origin_dtr,
@@ -2194,7 +2190,7 @@ static struct target_type origin_targetstatic struct target_type snapshot_target = { .name ="snapshot" , - .version = {1 ,11 ,0 }, + .version = {1 ,11 ,1 }, .module =THIS_MODULE , .ctr = snapshot_ctr, .dtr = snapshot_dtr,
drivers/md/dm-stripe.c +3 -4
@@ -312,8 +312,8 @@ static int stripe_map(struct dm_target ** */ -static int stripe_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void stripe_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {struct stripe_c *sc = (struct stripe_c *) ti->private;char buffer[sc->stripes +1 ];
@@ -340,7 +340,6 @@ static int stripe_status(struct dm_targe (unsigned long long)sc->stripe[i].physical_start);break ; } -return 0 ; }static int stripe_end_io (struct dm_target *ti,struct bio *bio,int error)
@@ -428,7 +427,7 @@ static int stripe_merge(struct dm_targetstatic struct target_type stripe_target = { .name ="striped" , - .version = {1 ,5 ,0 }, + .version = {1 ,5 ,1 }, .module =THIS_MODULE , .ctr = stripe_ctr, .dtr = stripe_dtr,
drivers/md/dm-thin.c +50 -32
146 lines not on this page · raw message
drivers/md/dm-verity.c +3 -5
@@ -508,8 +508,8 @@ static int verity_map(struct dm_target */* * Status: V (valid) or C (corruption found) */ -static int verity_status (struct dm_target *ti,status_type_t type, -unsigned status_flags,char *result,unsigned maxlen) +static void verity_status (struct dm_target *ti,status_type_t type, +unsigned status_flags,char *result,unsigned maxlen) {struct dm_verity *v = ti->private;unsigned sz =0 ;
@@ -540,8 +540,6 @@ static int verity_status(struct dm_targeDMEMIT ("%02x" , v->salt[x]);break ; } - -return 0 ; } static int verity_ioctl(struct dm_target *ti, unsigned cmd,
@@ -860,7 +858,7 @@ bad:static struct target_type verity_target = { .name ="verity" , - .version = {1 ,1 ,0 }, + .version = {1 ,1 ,1 }, .module =THIS_MODULE , .ctr = verity_ctr, .dtr = verity_dtr,
include/linux/device-mapper.h +2 -2
@@ -68,8 +68,8 @@ typedef void (*dm_postsuspend_fn) (structypedef int (*dm_preresume_fn ) (struct dm_target *ti);typedef void (*dm_resume_fn ) (struct dm_target *ti); -typedef int (*dm_status_fn ) (struct dm_target *ti,status_type_t status_type, -unsigned status_flags,char *result,unsigned maxlen); +typedef void (*dm_status_fn ) (struct dm_target *ti,status_type_t status_type, +unsigned status_flags,char *result,unsigned maxlen);typedef int (*dm_message_fn ) (struct dm_target *ti,unsigned argc,char **argv);
Greg Kroah-Hartman
maintainerPATCH 23/100 dm: do not replace bioset for request based dm
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jun'ichi Nomura <[email protected]>
commit 16245bdc9d3e22d1460341a655c8b5288953bc14 upstream.
This patch fixes a regression introduced in v3.8, which causes oops like this when dm-multipath is used:
general protection fault: 0000 [#1] SMP RIP: 0010:[<ffffffff810fe754>] [<ffffffff810fe754>] mempool_free+0x24/0xb0 Call Trace: <IRQ> [<ffffffff81187417>] bio_put+0x97/0xc0 [<ffffffffa02247a5>] end_clone_bio+0x35/0x90 [dm_mod] [<ffffffff81185efd>] bio_endio+0x1d/0x30 [<ffffffff811f03a3>] req_bio_endio.isra.51+0xa3/0xe0 [<ffffffff811f2f68>] blk_update_request+0x118/0x520 [<ffffffff811f3397>] blk_update_bidi_request+0x27/0xa0 [<ffffffff811f343c>] blk_end_bidi_request+0x2c/0x80 [<ffffffff811f34d0>] blk_end_request+0x10/0x20 [<ffffffffa000b32b>] scsi_io_completion+0xfb/0x6c0 [scsi_mod] [<ffffffffa000107d>] scsi_finish_command+0xbd/0x120 [scsi_mod] [<ffffffffa000b12f>] scsi_softirq_done+0x13f/0x160 [scsi_mod] [<ffffffff811f9fd0>] blk_done_softirq+0x80/0xa0 [<ffffffff81044551>] __do_softirq+0xf1/0x250 [<ffffffff8142ee8c>] call_softirq+0x1c/0x30 [<ffffffff8100420d>] do_softirq+0x8d/0xc0 [<ffffffff81044885>] irq_exit+0xd5/0xe0 [<ffffffff8142f3e3>] do_IRQ+0x63/0xe0 [<ffffffff814257af>] common_interrupt+0x6f/0x6f <EOI> [<ffffffffa021737c>] srp_queuecommand+0x8c/0xcb0 [ib_srp] [<ffffffffa0002f18>] scsi_dispatch_cmd+0x148/0x310 [scsi_mod] [<ffffffffa000a38e>] scsi_request_fn+0x31e/0x520 [scsi_mod] [<ffffffff811f1e57>] __blk_run_queue+0x37/0x50 [<ffffffff811f1f69>] blk_delay_work+0x29/0x40 [<ffffffff81059003>] process_one_work+0x1c3/0x5c0 [<ffffffff8105b22e>] worker_thread+0x15e/0x440 [<ffffffff8106164b>] kthread+0xdb/0xe0 [<ffffffff8142db9c>] ret_from_fork+0x7c/0xb0
The regression was introduced by the changec0820cf5 "dm: introduce per_bio_data", where dm started to replace bioset during table replacement.
For bio-based dm, it is good because clone bios do not exist during the table replacement.
For request-based dm, however, (not-yet-mapped) clone bios may stay in request queue and survive during the table replacement.
So freeing the old bioset could cause the oops in bio_put().
Since the size of front_pad may change only with bio-based dm, it is not necessary to replace bioset for request-based dm.
--- drivers/md/dm.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/md/dm.c +21 -9
@@ -1973,15 +1973,27 @@ static void __bind_mempools(struct mappe {struct dm_md_mempools *p =dm_table_get_md_mempools (t); -if (md->io_pool && (md->tio_pool ||dm_table_get_type (t) ==DM_TYPE_BIO_BASED ) && md->bs) { -/* -* The md already has necessary mempools. Reload just the -* bioset because front_pad may have changed because -* a different table was loaded. -*/ -bioset_free (md->bs); - md->bs = p->bs; - p->bs =NULL ; +if (md->io_pool && md->bs) { +/* The md already has necessary mempools. */ +if (dm_table_get_type (t) ==DM_TYPE_BIO_BASED ) { +/* +* Reload bioset because front_pad may have changed +* because a different table was loaded. +*/ +bioset_free (md->bs); + md->bs = p->bs; + p->bs =NULL ; + }else if (dm_table_get_type (t) ==DM_TYPE_REQUEST_BASED ) { +BUG_ON (!md->tio_pool); +/* +* There's no need to reload with request-based dm +* because the size of front_pad doesn't change. +* Note for future: If you are to reload bioset, +* prep-ed requests in the queue may refer +* to bio from the old bioset, so you must walk +* through the queue to unprep. +*/ + } goto out; }
Greg Kroah-Hartman
maintainerPATCH 24/100 dm: fix limits initialization when there are no data devices
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <[email protected]>
commit 87eb5b21d92a92ac2da3163039d62df88c2b8422 upstream.
dm_calculate_queue_limits will first reset the provided limits to defaults using blk_set_stacking_limits; whereby defeating the purpose of retaining the original live table's limits -- as was intended via commit 3ae706561637331aa578e52bb89ecbba5edcb7a9 ("dm: retain table limits when swapping to new table with no devices").
Fix this improper limits initialization (in the no data devices case) by avoiding the call to dm_calculate_queue_limits.
[patch header revised by Mike Snitzer]
--- drivers/md/dm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/md/dm.c +7 -5
@@ -2433,7 +2433,7 @@ static void dm_queue_flush(struct mapped*/ struct dm_table *dm_swap_table (struct mapped_device *md,struct dm_table *table) { -struct dm_table *live_map, *map =ERR_PTR (-EINVAL ); +struct dm_table *live_map =NULL , *map =ERR_PTR (-EINVAL );struct queue_limits limits;int r;
@@ -2456,10 +2456,12 @@ struct dm_table *dm_swap_table(struct madm_table_put (live_map); } - r =dm_calculate_queue_limits (table, &limits); -if (r) { - map =ERR_PTR (r); - goto out; +if (!live_map) { + r =dm_calculate_queue_limits (table, &limits); +if (r) { + map =ERR_PTR (r); + goto out; + } } map =__bind (md, table, &limits);
Greg Kroah-Hartman
maintainerPATCH 25/100 dm snapshot: add missing module aliases
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 23cb21092eb9dcec9d3604b68d95192b79915890 upstream.
Add module aliases so that autoloading works correctly if the user tries to activate "snapshot-origin" or "snapshot-merge" targets.
Reference: https://bugzilla.redhat.com/889973
--- drivers/md/dm-snap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/dm-snap.c +2 -0
@@ -2303,3 +2303,5 @@ module_exit(dm_snapshot_exit);MODULE_DESCRIPTION (DM_NAME " snapshot target" );MODULE_AUTHOR ("Joe Thornber" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("dm-snapshot-origin" ); +MODULE_ALIAS ("dm-snapshot-merge" );
Greg Kroah-Hartman
maintainerPATCH 26/100 NFS: Dont allow NFS silly-renamed files to be deleted, no signal
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 5a7a613a47a715711b3f2d3322a0eac21d459166 upstream.
Commit 73ca100 broke the code that prevents the client from deleting a silly renamed dentry. This affected "delete on last close" semantics as after that commit, nothing prevented removal of silly-renamed files. As a result, a process holding a file open could easily get an ESTALE on the file in a directory where some other process issued 'rm -rf some_dir_containing_the_file' twice. Before the commit, any attempt at unlinking silly renamed files would fail inside may_delete() with -EBUSY because of the DCACHE_NFSFS_RENAMED flag. The following testcase demonstrates the problem:
tail -f /nfsmnt/dir/file &
rm -rf /nfsmnt/dir
rm -rf /nfsmnt/dir
# second removal does not fail, 'tail' process receives ESTALE
The problem with the above commit is that it unhashes the old and new dentries from the lookup path, even in the normal case when a signal is not encountered and it would have been safe to call d_move. Unfortunately the old dentry has the special DCACHE_NFSFS_RENAMED flag set on it. Unhashing has the side-effect that future lookups call d_alloc(), allocating a new dentry without the special flag for any silly-renamed files. As a result, subsequent calls to unlink silly renamed files do not fail but allow the removal to go through. This will result in ESTALE errors for any other process doing operations on the file.
To fix this, go back to using d_move on success.
For the signal case, it's unclear what we may safely do beyond d_drop.
--- fs/nfs/unlink.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
fs/nfs/unlink.c +13 -7
@@ -336,20 +336,14 @@ static void nfs_async_rename_done(structstruct inode *old_dir = data->old_dir;struct inode *new_dir = data->new_dir;struct dentry *old_dentry = data->old_dentry; -struct dentry *new_dentry = data->new_dentry;if (!NFS_PROTO (old_dir)->rename_done (task, old_dir, new_dir)) {rpc_restart_call_prepare (task);return ; } -if (task->tk_status !=0 ) { +if (task->tk_status !=0 )nfs_cancel_async_unlink (old_dentry); -return ; - } - -d_drop (old_dentry); -d_drop (new_dentry); }/**
@@ -550,6 +544,18 @@ nfs_sillyrename(struct inode *dir, struc error =rpc_wait_for_completion_task (task);if (error ==0 ) error = task->tk_status; +switch (error) { +case 0 : +/* The rename succeeded */ +nfs_set_verifier (dentry,nfs_save_change_attribute (dir)); +d_move (dentry, sdentry); +break ; +case -ERESTARTSYS : +/* The result of the rename is unknown. Play it safe by +* forcing a new lookup */ +d_drop (dentry); +d_drop (sdentry); + }rpc_put_task (task); out_dput:dput (sdentry);
Greg Kroah-Hartman
maintainerPATCH 27/100 SUNRPC: Dont start the retransmission timer when out of socket space
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit a9a6b52ee1baa865283a91eb8d443ee91adfca56 upstream.
If the socket is full, we're better off just waiting until it empties, or until the connection is broken. The reason why we generally don't want to time out is that the call to xprt->ops->release_xprt() will trigger a connection reset, which isn't helpful...
Let's make an exception for soft RPC calls, since they have to provide timeout guarantees.
--- net/sunrpc/xprt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sunrpc/xprt.c +5 -1
@@ -485,13 +485,17 @@ EXPORT_SYMBOL_GPL(xprt_wake_pending_task* xprt_wait_for_buffer_space - wait for transport output buffer to clear * @task: task to be put to sleep * @action: function pointer to be executed after wait +* +* Note that we only set the timer for the case of RPC_IS_SOFT(), since +* we don't in general want to force a socket disconnection due to +* an incomplete RPC call transmission. */ void xprt_wait_for_buffer_space (struct rpc_task *task,rpc_action action) {struct rpc_rqst *req = task->tk_rqstp;struct rpc_xprt *xprt = req->rq_xprt; - task->tk_timeout = req->rq_timeout; + task->tk_timeout =RPC_IS_SOFT (task) ? req->rq_timeout :0 ;rpc_sleep_on (&xprt->pending, task, action); }EXPORT_SYMBOL_GPL (xprt_wait_for_buffer_space);
Greg Kroah-Hartman
maintainerPATCH 28/100 pnfs: fix resend_to_mds for directio
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benny Halevy <[email protected]>
commit 78f33277f96430ea001c39e952f6b8200b2ab850 upstream.
Pass the directio request on pageio_init to clean up the API.
Percolate pg_dreq from original nfs_pageio_descriptor to the pnfs_{read,write}_done_resend_to_mds and use it on respective call to nfs_pageio_init_{read,write} on the newly created nfs_pageio_descriptor.
Reproduced by command:
mount -o vers=4.1 server:/ /mnt
dd bs=128k count=8 if=/dev/zero of=/mnt/dd.out oflag=direct
BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 IP: [<ffffffffa021a3a8>] atomic_inc+0x4/0x9 [nfs] PGD 34786067 PUD 34794067 PMD 0 Oops: 0002 [#1] SMP Modules linked in: nfs_layout_nfsv41_files nfsv4 nfs nfsd lockd nfs_acl auth_rpcgss exportfs sunrpc btrfs zlib_deflate libcrc32c ipv6 autofs4 CPU 1 Pid: 259, comm: kworker/1:2 Not tainted 3.8.0-rc6 #2 Bochs Bochs RIP: 0010:[<ffffffffa021a3a8>] [<ffffffffa021a3a8>] atomic_inc+0x4/0x9 [nfs] RSP: 0018:ffff880038f8fa68 EFLAGS: 00010206 RAX: ffffffffa021a6a9 RBX: ffff880038f8fb48 RCX: 00000000000a0000 RDX: ffffffffa021e616 RSI: ffff8800385e9a40 RDI: 0000000000000028 RBP: ffff880038f8fa68 R08: ffffffff81ad6720 R09: ffff8800385e9510 R10: ffffffffa0228450 R11: ffff880038e87418 R12: ffff8800385e9a40 R13: ffff8800385e9a70 R14: ffff880038f8fb38 R15: ffffffffa0148878 FS: 0000000000000000(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000028 CR3: 0000000034789000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process kworker/1:2 (pid: 259, threadinfo ffff880038f8e000, task ffff880038302480) Stack: ffff880038f8fa78 ffffffffa021a6bf ffff880038f8fa88 ffffffffa021bb82 ffff880038f8fae8 ffffffffa021f454 ffff880038f8fae8 ffffffff8109689d ffff880038f8fab8 ffffffff00000006 0000000000000000 ffff880038f8fb48 Call Trace: [<ffffffffa021a6bf>] nfs_direct_pgio_init+0x16/0x18 [nfs] [<ffffffffa021bb82>] nfs_pgheader_init+0x6a/0x6c [nfs] [<ffffffffa021f454>] nfs_generic_pg_writepages+0x51/0xf8 [nfs] [<ffffffff8109689d>] ? mark_held_locks+0x71/0x99 [<ffffffffa0148878>] ? rpc_release_resources_task+0x37/0x37 [sunrpc] [<ffffffffa021bc25>] nfs_pageio_doio+0x1a/0x43 [nfs] [<ffffffffa021be7c>] nfs_pageio_complete+0x16/0x2c [nfs] [<ffffffffa02608be>] pnfs_write_done_resend_to_mds+0x95/0xc5 [nfsv4] [<ffffffffa0148878>] ? rpc_release_resources_task+0x37/0x37 [sunrpc] [<ffffffffa028e27f>] filelayout_reset_write+0x8c/0x99 [nfs_layout_nfsv41_files] [<ffffffffa028e5f9>] filelayout_write_done_cb+0x4d/0xc1 [nfs_layout_nfsv41_files] [<ffffffffa024587a>] nfs4_write_done+0x36/0x49 [nfsv4] [<ffffffffa021f996>] nfs_writeback_done+0x53/0x1cc [nfs] [<ffffffffa021fb1d>] nfs_writeback_done_common+0xe/0x10 [nfs] [<ffffffffa028e03d>] filelayout_write_call_done+0x28/0x2a [nfs_layout_nfsv41_files] [<ffffffffa01488a1>] rpc_exit_task+0x29/0x87 [sunrpc] [<ffffffffa014a0c9>] __rpc_execute+0x11d/0x3cc [sunrpc] [<ffffffff810969dc>] ? trace_hardirqs_on_caller+0x117/0x173 [<ffffffffa014a39f>] rpc_async_schedule+0x27/0x32 [sunrpc] [<ffffffffa014a378>] ? __rpc_execute+0x3cc/0x3cc [sunrpc] [<ffffffff8105f8c1>] process_one_work+0x226/0x422 [<ffffffff8105f7f4>] ? process_one_work+0x159/0x422 [<ffffffff81094757>] ? lock_acquired+0x210/0x249 [<ffffffffa014a378>] ? __rpc_execute+0x3cc/0x3cc [sunrpc] [<ffffffff810600d8>] worker_thread+0x126/0x1c4 [<ffffffff8105ffb2>] ? manage_workers+0x240/0x240 [<ffffffff81064ef8>] kthread+0xb1/0xb9 [<ffffffff81064e47>] ? __kthread_parkme+0x65/0x65 [<ffffffff815206ec>] ret_from_fork+0x7c/0xb0 [<ffffffff81064e47>] ? __kthread_parkme+0x65/0x65 Code: 00 83 38 02 74 12 48 81 4b 50 00 00 01 00 c7 83 60 07 00 00 01 00 00 00 48 89 df e8 55 fe ff ff 5b 41 5c 5d c3 66 90 55 48 89 e5 <f0> ff 07 5d c3 55 48 89 e5 f0 ff 0f 0f 94 c0 84 c0 0f 95 c0 0f RIP [<ffffffffa021a3a8>] atomic_inc+0x4/0x9 [nfs] RSP <ffff880038f8fa68>
CR2: 0000000000000028
--- fs/nfs/nfs4filelayout.c | 6 ++++-- fs/nfs/pnfs.c | 14 ++++++++++---- fs/nfs/pnfs.h | 6 ++++-- 3 files changed, 18 insertions(+), 8 deletions(-)
fs/nfs/nfs4filelayout.c +4 -2
@@ -99,7 +99,8 @@ static void filelayout_reset_write(struc task->tk_status =pnfs_write_done_resend_to_mds (hdr->inode, &hdr->pages, - hdr->completion_ops); + hdr->completion_ops, + hdr->dreq); } }
@@ -119,7 +120,8 @@ static void filelayout_reset_read(struct task->tk_status =pnfs_read_done_resend_to_mds (hdr->inode, &hdr->pages, - hdr->completion_ops); + hdr->completion_ops, + hdr->dreq); } }
fs/nfs/pnfs.c +10 -4
@@ -1422,13 +1422,15 @@ EXPORT_SYMBOL_GPL(pnfs_generic_pg_test);int pnfs_write_done_resend_to_mds (struct inode *inode,struct list_head *head, -const struct nfs_pgio_completion_ops *compl_ops) +const struct nfs_pgio_completion_ops *compl_ops, +struct nfs_direct_req *dreq) {struct nfs_pageio_descriptor pgio;LIST_HEAD (failed);/* Resend all requests through the MDS */ nfs_pageio_init_write (&pgio, inode,FLUSH_STABLE , compl_ops); + pgio.pg_dreq = dreq;while (!list_empty (head)) {struct nfs_page *req =nfs_list_entry (head->next);
@@ -1463,7 +1465,8 @@ static void pnfs_ld_handle_write_error(sif (!test_and_set_bit (NFS_IOHDR_REDO , &hdr->flags)) data->task.tk_status =pnfs_write_done_resend_to_mds (hdr->inode, &hdr->pages, - hdr->completion_ops); + hdr->completion_ops, + hdr->dreq); }/*
@@ -1578,13 +1581,15 @@ EXPORT_SYMBOL_GPL(pnfs_generic_pg_writepint pnfs_read_done_resend_to_mds (struct inode *inode,struct list_head *head, -const struct nfs_pgio_completion_ops *compl_ops) +const struct nfs_pgio_completion_ops *compl_ops, +struct nfs_direct_req *dreq) {struct nfs_pageio_descriptor pgio;LIST_HEAD (failed);/* Resend all requests through the MDS */ nfs_pageio_init_read (&pgio, inode, compl_ops); + pgio.pg_dreq = dreq;while (!list_empty (head)) {struct nfs_page *req =nfs_list_entry (head->next);
@@ -1615,7 +1620,8 @@ static void pnfs_ld_handle_read_error(stif (!test_and_set_bit (NFS_IOHDR_REDO , &hdr->flags)) data->task.tk_status =pnfs_read_done_resend_to_mds (hdr->inode, &hdr->pages, - hdr->completion_ops); + hdr->completion_ops, + hdr->dreq); }/*
fs/nfs/pnfs.h +4 -2
@@ -230,9 +230,11 @@ struct pnfs_layout_segment *pnfs_update_void nfs4_deviceid_mark_client_invalid (struct nfs_client *clp);int pnfs_read_done_resend_to_mds (struct inode *inode,struct list_head *head, -const struct nfs_pgio_completion_ops *compl_ops); +const struct nfs_pgio_completion_ops *compl_ops, +struct nfs_direct_req *dreq);int pnfs_write_done_resend_to_mds (struct inode *inode,struct list_head *head, -const struct nfs_pgio_completion_ops *compl_ops); +const struct nfs_pgio_completion_ops *compl_ops, +struct nfs_direct_req *dreq);struct nfs4_threshold *pnfs_mdsthreshold_alloc (void );/* nfs4_deviceid_flags */
Greg Kroah-Hartman
maintainerPATCH 29/100 NFSv4.1: Hold reference to layout hdr in layoutget
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weston Andros Adamson <[email protected]>
commit a47970ff7814718fec31b7d966747c6aa1a3545f upstream.
This fixes an oops where a LAYOUTGET is in still in the rpciod queue, but the requesting processes has been killed. Without this, killing the process does the final pnfs_put_layout_hdr() and sets NFS_I(inode)->layout to NULL while the LAYOUTGET rpc task still references it.
Example oops:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000080 IP: [<ffffffffa01bd586>] pnfs_choose_layoutget_stateid+0x37/0xef [nfsv4] PGD 7365b067 PUD 7365d067 PMD 0 Oops: 0000 [#1] SMP DEBUG_PAGEALLOC Modules linked in: nfs_layout_nfsv41_files nfsv4 auth_rpcgss nfs lockd sunrpc ipt_MASQUERADE ip6table_mangle ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 iptable_nat nf_nat_ipv4 nf_nat iptable_mangle ip6table_filter ip6_tables ppdev e1000 i2c_piix4 i2c_core shpchp parport_pc parport crc32c_intel aesni_intel xts aes_x86_64 lrw gf128mul ablk_helper cryptd mptspi scsi_transport_spi mptscsih mptbase floppy autofs4 CPU 0 Pid: 27, comm: kworker/0:1 Not tainted 3.8.0-dros_cthon2013+ #4 VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform RIP: 0010:[<ffffffffa01bd586>] [<ffffffffa01bd586>] pnfs_choose_layoutget_stateid+0x37/0xef [nfsv4] RSP: 0018:ffff88007b0c1c88 EFLAGS: 00010246 RAX: ffff88006ed36678 RBX: 0000000000000000 RCX: 0000000ea877e3bc RDX: ffff88007a729da8 RSI: 0000000000000000 RDI: ffff88007a72b958 RBP: ffff88007b0c1ca8 R08: 0000000000000002 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff88007a72b958 R13: ffff88007a729da8 R14: 0000000000000000 R15: ffffffffa011077e FS: 0000000000000000(0000) GS:ffff88007f600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000080 CR3: 00000000735f8000 CR4: 00000000001407f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process kworker/0:1 (pid: 27, threadinfo ffff88007b0c0000, task ffff88007c2fa0c0) Stack: ffff88006fc05388 ffff88007a72b908 ffff88007b240900 ffff88006fc05388 ffff88007b0c1cd8 ffffffffa01a2170 ffff88007b240900 ffff88007b240900 ffff88007b240970 ffffffffa011077e ffff88007b0c1ce8 ffffffffa0110791 Call Trace: [<ffffffffa01a2170>] nfs4_layoutget_prepare+0x7b/0x92 [nfsv4] [<ffffffffa011077e>] ? __rpc_atrun+0x15/0x15 [sunrpc] [<ffffffffa0110791>] rpc_prepare_task+0x13/0x15 [sunrpc]
--- fs/nfs/nfs4proc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +9 -2
@@ -6087,11 +6087,13 @@ static struct page **nfs4_alloc_pages(sistatic void nfs4_layoutget_release (void *calldata) {struct nfs4_layoutget *lgp = calldata; -struct nfs_server *server =NFS_SERVER (lgp->args.inode); +struct inode *inode = lgp->args.inode; +struct nfs_server *server =NFS_SERVER (inode);size_t max_pages =max_response_pages (server);dprintk ("--> %s\n" , __func__);nfs4_free_pages (lgp->args.layout.pages, max_pages); +pnfs_put_layout_hdr (NFS_I (inode)->layout);put_nfs_open_context (lgp->args.ctx);kfree (calldata);dprintk ("<-- %s\n" , __func__);
@@ -6106,7 +6108,8 @@ static const struct rpc_call_ops nfs4_lastruct pnfs_layout_segment *nfs4_proc_layoutget (struct nfs4_layoutget *lgp,gfp_t gfp_flags) { -struct nfs_server *server =NFS_SERVER (lgp->args.inode); +struct inode *inode = lgp->args.inode; +struct nfs_server *server =NFS_SERVER (inode);size_t max_pages =max_response_pages (server);struct rpc_task *task;struct rpc_message msg = {
@@ -6136,6 +6139,10 @@ nfs4_proc_layoutget(struct nfs4_layoutge lgp->res.layoutp = &lgp->args.layout; lgp->res.seq_res.sr_slot =NULL ;nfs41_init_sequence (&lgp->args.seq_args, &lgp->res.seq_res,0 ); + +/* nfs4_layoutget_release calls pnfs_put_layout_hdr */ +pnfs_get_layout_hdr (NFS_I (inode)->layout); + task =rpc_run_task (&task_setup_data);if (IS_ERR (task))return ERR_CAST (task);
Re: [ 029/100] NFSv4.1: Hold reference to layout hdr in layoutget
Quoted 7 lines · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weston Andros Adamson <[email protected]>
commit
a47970ff7814718fec31b7d966747c6aa1a3545fupstream.
[....]
Quoted 28 lines
fs/nfs/nfs4proc.c +5
-2@@ -6087,11 +6087,13 @@ static struct page **nfs4_alloc_pages(sistatic void nfs4_layoutget_release (void *calldata) {struct nfs4_layoutget *lgp = calldata; -struct nfs_server *server =NFS_SERVER (lgp->args.inode); +struct inode *inode = lgp->args.inode; +struct nfs_server *server =NFS_SERVER (inode);size_t max_pages =max_response_pages (server);dprintk ("--> %s\n" , __func__);nfs4_free_pages (lgp->args.layout.pages, max_pages); +pnfs_put_layout_hdr (NFS_I (inode)->layout);put_nfs_open_context (lgp->args.ctx);kfree (calldata);dprintk ("<-- %s\n" , __func__);@@ -6106,7 +6108,8 @@ static const struct rpc_call_ops nfs4_lastruct pnfs_layout_segment *nfs4_proc_layoutget (struct nfs4_layoutget *lgp,gfp_t gfp_flags) { -struct nfs_server *server =NFS_SERVER (lgp->args.inode); +struct inode *inode = lgp->args.inode; +struct nfs_server *server =NFS_SERVER (inode);size_t max_pages =max_response_pages (server);struct rpc_task *task;struct rpc_message msg = {
fs/nfs/nfs4proc.c nfs4_proc_layoutget(struct nfs4_layoutge · line 6145
Quoted 7 lines
fs/nfs/nfs4proc.c +4
-0@@ -6136,6 +6139,10 @@ nfs4_proc_layoutget(struct nfs4_layoutge lgp->res.layoutp = &lgp->args.layout; lgp->res.seq_res.sr_slot =NULL ;nfs41_init_sequence (&lgp->args.seq_args, &lgp->res.seq_res,0 ); + +/* nfs4_layoutget_release calls pnfs_put_layout_hdr */ +pnfs_get_layout_hdr (NFS_I (inode)->layout); +
But this function also calls nfs4_layoutget_release() if nfs4_alloc_pages() fails, i.e. before it calls pnfs_get_layout_hdr(). This will lead to a reference imbalance.
Ben.
Quoted 10 lines
fs/nfs/nfs4proc.c +0
-1task =rpc_run_task (&task_setup_data);if (IS_ERR (task))return ERR_CAST (task); --To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
Greg Kroah-Hartman
maintainerPATCH 30/100 hw_random: make buffer usable in scatterlist.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rusty Russell <[email protected]>
commit f7f154f1246ccc5a0a7e9ce50932627d60a0c878 upstream.
virtio_rng feeds the randomness buffer handed by the core directly into the scatterlist, since commit bb347d98079a547e80bd4722dee1de61e4dca0e8.
However, if CONFIG_HW_RANDOM=m, the static buffer isn't a linear address (at least on most archs). We could fix this in virtio_rng, but it's actually far easier to just do it in the core as virtio_rng would have to allocate a buffer every time (it doesn't know how much the core will want to read).
--- drivers/char/hw_random/core.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/char/hw_random/core.c +16 -3
@@ -40,6 +40,7 @@#include <linux/init.h> #include <linux/miscdevice.h> #include <linux/delay.h> +#include <linux/slab.h> #include <asm/uaccess.h>
@@ -52,8 +53,12 @@ static struct hwrng *current_rng;static LIST_HEAD (rng_list);static DEFINE_MUTEX (rng_mutex);static int data_avail; -static u8 rng_buffer[SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES] - __cacheline_aligned; +static u8 *rng_buffer; + +static size_t rng_buffer_size (void ) +{ +return SMP_CACHE_BYTES <32 ?32 :SMP_CACHE_BYTES ; +}static inline int hwrng_init (struct hwrng *rng) {
@@ -116,7 +121,7 @@ static ssize_t rng_dev_read(struct fileif (!data_avail) { bytes_read =rng_get_data (current_rng, rng_buffer, -sizeof (rng_buffer), +rng_buffer_size (), !(filp->f_flags &O_NONBLOCK ));if (bytes_read <0 ) { err = bytes_read;
@@ -307,6 +312,14 @@ int hwrng_register(struct hwrng *rng)mutex_lock (&rng_mutex); +/* kmalloc makes this safe for virt_to_page() in virtio_rng.c */ + err = -ENOMEM ; +if (!rng_buffer) { + rng_buffer =kmalloc (rng_buffer_size (),GFP_KERNEL ); +if (!rng_buffer) + goto out_unlock; + } +/* Must not register two RNGs with the same name. */ err = -EEXIST ;list_for_each_entry (tmp, &rng_list, list) {
Greg Kroah-Hartman
maintainerPATCH 31/100 iwlwifi: always copy first 16 bytes of commands
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 8a964f44e01ad3bbc208c3e80d931ba91b9ea786 upstream.
The FH hardware will always write back to the scratch field in commands, even host commands not just TX commands, which can overwrite parts of the command. This is problematic if the command is re-used (with IWL_HCMD_DFL_NOCOPY) and can cause calibration issues.
Address this problem by always putting at least the first 16 bytes into the buffer we also use for the command header and therefore make the DMA engine write back into this.
For commands that are smaller than 16 bytes also always map enough memory for the DMA engine to write back to.
--- drivers/net/wireless/iwlwifi/iwl-devtrace.h | 10 +-- drivers/net/wireless/iwlwifi/pcie/internal.h | 9 +++ drivers/net/wireless/iwlwifi/pcie/tx.c | 75 ++++++++++++++++++++------- 3 files changed, 71 insertions(+), 23 deletions(-)
drivers/net/wireless/iwlwifi/iwl-devtrace.h +4 -6
@@ -349,25 +349,23 @@ TRACE_EVENT(iwlwifi_dev_rx_data, TRACE_EVENT(iwlwifi_dev_hcmd, TP_PROTO(const struct device *dev, struct iwl_host_cmd *cmd, u16 total_size, - const void *hdr, size_t hdr_len), - TP_ARGS(dev, cmd, total_size, hdr, hdr_len), + struct iwl_cmd_header *hdr), + TP_ARGS(dev, cmd, total_size, hdr), TP_STRUCT__entry( DEV_ENTRY __dynamic_array(u8, hcmd, total_size) __field(u32, flags) ), TP_fast_assign( - int i, offset = hdr_len; + int i, offset = sizeof(*hdr); DEV_ASSIGN; __entry->flags = cmd->flags; - memcpy(__get_dynamic_array(hcmd), hdr, hdr_len); + memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { if (!cmd->len[i]) continue; - if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) - continue; memcpy((u8 *)__get_dynamic_array(hcmd) + offset, cmd->data[i], cmd->len[i]); offset += cmd->len[i];
drivers/net/wireless/iwlwifi/pcie/internal.h +9 -0
@@ -182,6 +182,15 @@ struct iwl_queue {#define TFD_TX_CMD_SLOTS 256#define TFD_CMD_SLOTS 32 +/* +* The FH will write back to the first TB only, so we need +* to copy some data into the buffer regardless of whether +* it should be mapped or not. This indicates how much to +* copy, even for HCMDs it must be big enough to fit the +* DRAM scratch from the TX cmd, at least 16 bytes. +*/ +#define IWL_HCMD_MIN_COPY_SIZE 16 +struct iwl_pcie_txq_entry {struct iwl_device_cmd *cmd;struct iwl_device_cmd *copy_cmd;
drivers/net/wireless/iwlwifi/pcie/tx.c +58 -17
147 lines not on this page · raw message
Re: [ 031/100] iwlwifi: always copy first 16 bytes of commands
Quoted 7 lines · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit
8a964f44e01ad3bbc208c3e80d931ba91b9ea786upstream.
[...]
Quoted 2 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +0
-0
[...]
drivers/net/wireless/iwlwifi/pcie/tx.c static int iwl_pcie_enqueue_hcmd(struct · line 1246
Quoted 11 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +4
-1@@ -1221,14 +1238,31 @@ static int iwl_pcie_enqueue_hcmd(struct/* and copy the data that needs to be copied */ cmd_pos = offsetof(struct iwl_device_cmd , payload); + copy_size =sizeof (out_cmd->hdr);for (i =0 ; i <IWL_MAX_CMD_TFDS ; i++) { -if (!cmd->len[i]) +int copy =0 ; + +if (!cmd->len)continue ;
cmd->len is an array, so the new condition is always false. Shouldn't it be 'if (!cmdlen[i])'?
Ben.
Quoted 27 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +19
-5-if (cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | -IWL_HCMD_DFL_DUP )) -break ; -memcpy ((u8 *)out_cmd + cmd_pos, cmd->data[i], cmd->len[i]); - cmd_pos += cmd->len[i]; + +/* need at least IWL_HCMD_MIN_COPY_SIZE copied */ +if (copy_size <IWL_HCMD_MIN_COPY_SIZE ) { + copy =IWL_HCMD_MIN_COPY_SIZE - copy_size; + +if (copy > cmd->len[i]) + copy = cmd->len[i]; + } + +/* copy everything if not nocopy/dup */ +if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | +IWL_HCMD_DFL_DUP ))) + copy = cmd->len[i]; + +if (copy) { +memcpy ((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); + cmd_pos += copy; + copy_size += copy; + } }WARN_ON_ONCE (txq->entries[idx].copy_cmd);
[...]
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
Re: [ 031/100] iwlwifi: always copy first 16 bytes of commands
Quoted 14 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit
8a964f44e01ad3bbc208c3e80d931ba91b9ea786upstream.[...]
Quoted 2 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +0
-0[...]
Quoted 2 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +0
-0@@ -1221,14 +1238,31 @@ static int iwl_pcie_enqueue_hcmd(struct
Quoted 12 lines
drivers/net/wireless/iwlwifi/pcie/tx.c static int iwl_pcie_enqueue_hcmd(struct · line 1246
Quoted 9 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +4
-1/* and copy the data that needs to be copied */ cmd_pos = offsetof(struct iwl_device_cmd , payload); + copy_size =sizeof (out_cmd->hdr);for (i =0 ; i <IWL_MAX_CMD_TFDS ; i++) { -if (!cmd->len[i]) +int copy =0 ; + +if (!cmd->len)continue ;
cmd->lenis an array, so the new condition is always false. Shouldn't it be 'if (!cmdlen[i])'?
To answer myself: no, it should still be 'if (!cmd->len[i])' as this loop needs to include input fragments that will be completely copied into the header fragment.
Ben.
Quoted 31 lines
Ben.
Quoted 27 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +19
-5-if (cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | -IWL_HCMD_DFL_DUP )) -break ; -memcpy ((u8 *)out_cmd + cmd_pos, cmd->data[i], cmd->len[i]); - cmd_pos += cmd->len[i]; + +/* need at least IWL_HCMD_MIN_COPY_SIZE copied */ +if (copy_size <IWL_HCMD_MIN_COPY_SIZE ) { + copy =IWL_HCMD_MIN_COPY_SIZE - copy_size; + +if (copy > cmd->len[i]) + copy = cmd->len[i]; + } + +/* copy everything if not nocopy/dup */ +if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | +IWL_HCMD_DFL_DUP ))) + copy = cmd->len[i]; + +if (copy) { +memcpy ((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); + cmd_pos += copy; + copy_size += copy; + } }WARN_ON_ONCE (txq->entries[idx].copy_cmd);[...]
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
RE: [ 031/100] iwlwifi: always copy first 16 bytes of commands
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +1
-0/* and copy the data that needs to be copied */ cmd_pos = offsetof(struct iwl_device_cmd , payload); + copy_size =sizeof (out_cmd->hdr);for (i =0 ; i <IWL_MAX_CMD_TFDS ; i++) {Quoted 8 lines
drivers/net/wireless/iwlwifi/pcie/tx.c static int iwl_pcie_enqueue_hcmd(struct · line 1246
Quoted 5 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +3
-1-if (!cmd->len[i]) +int copy =0 ; + +if (!cmd->len)continue ;
cmd->lenis an array, so the new condition is always false. Shouldn't it be 'if (!cmdlen[i])'?
Quoted 3 lines
To answer myself: no, it should still be 'if (!cmd->len[i])' as this loop needs to include input fragments that will be completely copied into the header fragment.
Ick, good catch. It luckily doesn't matter as if cmd->len[i] is 0 (in which case we'd continue) the "if (copy)" below saves us in all the different code paths inside the loop. This is still clearly a mistake in the patch though.
I will fix this upstream, I guess you'll want to wait for that for stable? I'll Cc:stable that patch as well.
johannes
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
Re: [ 031/100] iwlwifi: always copy first 16 bytes of commands
Quoted 17 lines · Johannes
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +1
-0/* and copy the data that needs to be copied */ cmd_pos = offsetof(struct iwl_device_cmd , payload); + copy_size =sizeof (out_cmd->hdr);for (i =0 ; i <IWL_MAX_CMD_TFDS ; i++) {Quoted 8 lines
drivers/net/wireless/iwlwifi/pcie/tx.c static int iwl_pcie_enqueue_hcmd(struct · line 1246
Quoted 5 lines
drivers/net/wireless/iwlwifi/pcie/tx.c +3
-1-if (!cmd->len[i]) +int copy =0 ; + +if (!cmd->len)continue ;
cmd->lenis an array, so the new condition is always false. Shouldn't it be 'if (!cmdlen[i])'?Quoted 3 lines
To answer myself: no, it should still be 'if (!cmd->len[i])' as this loop needs to include input fragments that will be completely copied into the header fragment.
Quoted 7 lines
Ick, good catch. It luckily doesn't matter as if cmd->len[i] is 0 (in which case we'd continue) the "if (copy)" below saves us in all the different code paths inside the loop. This is still clearly a mistake in the patch though.
I will fix this upstream, I guess you'll want to wait for that for stable? I'll Cc:stable that patch as well.
I agree with your analysis that this is actually harmless, so no objections to including the patch in stable as it is.
Ben.
Signature · 2 lines
Ben Hutchings Humans are not rational beings; they are rationalising beings.
Greg Kroah-Hartman
maintainerPATCH 32/100 mwifiex: correct sleep delay counter
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avinash Patil <[email protected]>
commit 3e7a4ff7c5b6423ddb644df9c41b8b6d2fb79d30 upstream.
Maximum delay for waking up card is 50 ms. Because of typo in counter, this delay goes to 500ms. This patch fixes the bug.
--- drivers/net/wireless/mwifiex/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mwifiex/pcie.c +1 -1
@@ -291,7 +291,7 @@ static int mwifiex_pm_wakeup_card(struct i++;usleep_range (10 ,20 );/* 50ms max wait */ -if (i ==50000 ) +if (i ==5000 )break ; }
Greg Kroah-Hartman
maintainerPATCH 33/100 libertas: fix crash for SD8688
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bing Zhao <[email protected]>
commit 466026989f112e0546ca39ab00a759af82dbe83a upstream.
For SD8688, FUNC_INIT command is queued before fw_ready flag is set. This causes the following crash as lbs_thread blocks any command if fw_ready is not set.
[ 209.338953] [<c0502248>] (__schedule+0x610/0x764) from [<bf20ae24>] (__lbs_cmd+0xb8/0x130 [libertas]) [ 209.348340] [<bf20ae24>] (__lbs_cmd+0xb8/0x130 [libertas]) from [<bf222474>] (if_sdio_finish_power_on+0xec/0x1b0 [libertas_sdio]) [ 209.360136] [<bf222474>] (if_sdio_finish_power_on+0xec/0x1b0 [libertas_sdio]) from [<bf2226c4>] (if_sdio_power_on+0x18c/0x20c [libertas_sdio]) [ 209.373052] [<bf2226c4>] (if_sdio_power_on+0x18c/0x20c [libertas_sdio]) from [<bf222944>] (if_sdio_probe+0x200/0x31c [libertas_sdio]) [ 209.385316] [<bf222944>] (if_sdio_probe+0x200/0x31c [libertas_sdio]) from [<bf01d820>] (sdio_bus_probe+0x94/0xfc [mmc_core]) [ 209.396748] [<bf01d820>] (sdio_bus_probe+0x94/0xfc [mmc_core]) from [<c02e729c>] (driver_probe_device+0x12c/0x348) [ 209.407214] [<c02e729c>] (driver_probe_device+0x12c/0x348) from [<c02e7530>] (__driver_attach+0x78/0x9c) [ 209.416798] [<c02e7530>] (__driver_attach+0x78/0x9c) from [<c02e5658>] (bus_for_each_dev+0x50/0x88) [ 209.425946] [<c02e5658>] (bus_for_each_dev+0x50/0x88) from [<c02e6810>] (bus_add_driver+0x108/0x268) [ 209.435180] [<c02e6810>] (bus_add_driver+0x108/0x268) from [<c02e782c>] (driver_register+0xa4/0x134) [ 209.444426] [<c02e782c>] (driver_register+0xa4/0x134) from [<bf22601c>] (if_sdio_init_module+0x1c/0x3c [libertas_sdio]) [ 209.455339] [<bf22601c>] (if_sdio_init_module+0x1c/0x3c [libertas_sdio]) from [<c00085b8>] (do_one_initcall+0x98/0x174) [ 209.466236] [<c00085b8>] (do_one_initcall+0x98/0x174) from [<c0076504>] (load_module+0x1c5c/0x1f80) [ 209.475390] [<c0076504>] (load_module+0x1c5c/0x1f80) from [<c007692c>] (sys_init_module+0x104/0x128) [ 209.484632] [<c007692c>] (sys_init_module+0x104/0x128) from [<c0008c40>] (ret_fast_syscall+0x0/0x38)
Fix it by setting fw_ready flag prior to queuing FUNC_INIT command.
--- drivers/net/wireless/libertas/if_sdio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/libertas/if_sdio.c +5 -1
@@ -825,6 +825,11 @@ static void if_sdio_finish_power_on(strusdio_release_host (func); +/* Set fw_ready before queuing any commands so that +* lbs_thread won't block from sending them to firmware. +*/ + priv->fw_ready =1 ; +/* * FUNC_INIT is required for SD8688 WLAN/BT multiple functions */
@@ -839,7 +844,6 @@ static void if_sdio_finish_power_on(strunetdev_alert (priv->dev,"CMD_FUNC_INIT cmd failed\n" ); } - priv->fw_ready =1 ;wake_up (&card->pwron_waitq);if (!card->started) {
Greg Kroah-Hartman
maintainerPATCH 34/100 ath9k: fix RSSI dummy marker value
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit a3d63cadbad97671d740a9698acc2c95d1ca6e79 upstream.
RSSI is being stored internally as s8 in several places. The indication of an unset RSSI value, ATH_RSSI_DUMMY_MARKER, was supposed to have been set to 127, but ended up being set to 0x127 because of a code cleanup mistake. This could lead to invalid signal strength values in a few places.
--- drivers/net/wireless/ath/ath9k/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/common.h +1 -1
@@ -27,7 +27,7 @@#define WME_MAX_BA WME_BA_BMP_SIZE#define ATH_TID_MAX_BUFS (2 * WME_MAX_BA) -#define ATH_RSSI_DUMMY_MARKER 0x127 +#define ATH_RSSI_DUMMY_MARKER 127#define ATH_RSSI_LPF_LEN 10#define RSSI_LPF_THRESHOLD -20#define ATH_RSSI_EP_MULTIPLIER (1<<7)
Greg Kroah-Hartman
maintainerPATCH 35/100 ath9k_htc: fix signal strength handling issues
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 838f427955dcfd16858b0108ce29029da0d56a4e upstream.
The ath9k commit 2ef167557c0a26c88162ecffb017bfcc51eb7b29 (ath9k: fix signal strength reporting issues) fixed an issue where the reported per-frame signal strength reported to mac80211 was being overwritten with an internal average. The same issue is also present in ath9k_htc.
In addition to preventing the driver from overwriting the value, this commit also ensures that the internal average (which is used for ANI) only tracks beacons of the AP that we're connected to.
--- drivers/net/wireless/ath/ath9k/htc.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +1 -0
@@ -22,6 +22,7 @@#include <linux/firmware.h> #include <linux/skbuff.h> #include <linux/netdevice.h> +#include <linux/etherdevice.h> #include <linux/leds.h> #include <linux/slab.h> #include <net/mac80211.h>
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +11 -7
@@ -1067,15 +1067,19 @@ static bool ath9k_rx_prepare(struct ath9 last_rssi = priv->rx.last_rssi; -if (likely (last_rssi !=ATH_RSSI_DUMMY_MARKER )) - rxbuf->rxstatus.rs_rssi =ATH_EP_RND (last_rssi, -ATH_RSSI_EP_MULTIPLIER ); +if (ieee80211_is_beacon (hdr->frame_control) && + !is_zero_ether_addr (common->curbssid) && +ether_addr_equal (hdr->addr3, common->curbssid)) { +s8 rssi = rxbuf->rxstatus.rs_rssi; -if (rxbuf->rxstatus.rs_rssi <0 ) - rxbuf->rxstatus.rs_rssi =0 ; +if (likely (last_rssi !=ATH_RSSI_DUMMY_MARKER )) + rssi =ATH_EP_RND (last_rssi,ATH_RSSI_EP_MULTIPLIER ); -if (ieee80211_is_beacon (fc)) - priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi; +if (rssi <0 ) + rssi =0 ; + + priv->ah->stats.avgbrssi = rssi; + } rx_status->mactime =be64_to_cpu (rxbuf->rxstatus.rs_tstamp); rx_status->band = hw->conf.channel->band;
Greg Kroah-Hartman
maintainerPATCH 36/100 ath9k_hw: improve reset reliability after errors
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 3412f2f086ea7531378fabe756bd4a1109994ae6 upstream.
On many different chips, important aspects of the MAC state are not fully cleared by a warm reset. This can show up as tx/rx hangs, those annoying "DMA failed to stop in 10 ms..." messages or other quirks.
On AR933x, the chip can occasionally get stuck in a way that only a driver unload/reload or a reboot would bring it back to life.
With this patch, a full reset is issued when bringing the chip out of FULL-SLEEP state (after idle), or if either Rx or Tx was not shut down properly. This makes the DMA related error messages disappear completely in my tests on AR933x, and the chip does not get stuck anymore.
--- drivers/net/wireless/ath/ath9k/hw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hw.c +3 -1
@@ -1480,7 +1480,9 @@ static bool ath9k_hw_chip_reset(struct a reset_type =ATH9K_RESET_POWER_ON ; else reset_type =ATH9K_RESET_COLD ; - } + }else if (ah->chip_fullsleep ||REG_READ (ah,AR_Q_TXE ) || + (REG_READ (ah,AR_CR ) &AR_CR_RXE )) + reset_type =ATH9K_RESET_COLD ;if (!ath9k_hw_set_reset_reg (ah, reset_type))return false;
Greg Kroah-Hartman
maintainerPATCH 37/100 proc connector: reject unprivileged listener bumps
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit e70ab977991964a5a7ad1182799451d067e62669 upstream.
While PROC_CN_MCAST_LISTEN/IGNORE is entirely advisory, it was possible for an unprivileged user to turn off notifications for all listeners by sending PROC_CN_MCAST_IGNORE. Instead, require the same privileges as required for a multicast bind.
--- drivers/connector/cn_proc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/connector/cn_proc.c +8 -0
@@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_ (task_active_pid_ns(current) != &init_pid_ns)) return; +/* Can only change if privileged. */ +if (!capable (CAP_NET_ADMIN )) { + err =EPERM ; + goto out; + } + mc_op = (enum proc_cn_mcast_op *)msg->data;switch (*mc_op) {case PROC_CN_MCAST_LISTEN :
@@ -325,6 +331,8 @@ static void cn_proc_mcast_ctl(struct cn_ err =EINVAL ;break ; } + +out:cn_proc_ack (err, msg->seq, msg->ack); }
Greg Kroah-Hartman
maintainerPATCH 38/100 nohz: Make tick_nohz_irq_exit() irq safe
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit e5ab012c3271990e8457055c25cafddc1ae8aa6b upstream.
As it stands, irq_exit() may or may not be called with irqs disabled, depending on __ARCH_IRQ_EXIT_IRQS_DISABLED that the arch can define.
It makes tick_nohz_irq_exit() unsafe. For example two interrupts can race in tick_nohz_stop_sched_tick(): the inner most one computes the expiring time on top of the timer list, then it's interrupted right before reprogramming the clock. The new interrupt enqueues a new timer list timer, it reprogram the clock to take it into account and it exits. The CPUs resumes the inner most interrupt and performs the clock reprogramming without considering the new timer list timer.
This regression has been introduced by:
280f06774afedf849f0b34248ed6aff57d0f6908
("nohz: Separate out irq exit and idle loop dyntick logic")
Let's fix it right now with the appropriate protections.
A saner long term solution will be to remove __ARCH_IRQ_EXIT_IRQS_DISABLED and mandate that irq_exit() is called with interrupts disabled.
--- kernel/time/tick-sched.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/time/tick-sched.c +6 -1
@@ -564,14 +564,19 @@ void tick_nohz_idle_enter(void)*/ void tick_nohz_irq_exit (void ) { +unsigned long flags;struct tick_sched *ts = &__get_cpu_var (tick_cpu_sched);if (!ts->inidle)return ; -/* Cancel the timer because CPU already waken up from the C-states*/ +local_irq_save (flags); + +/* Cancel the timer because CPU already waken up from the C-states */ menu_hrtimer_cancel ();__tick_nohz_idle_enter (ts); + +local_irq_restore (flags); }/**
Greg Kroah-Hartman
maintainerPATCH 39/100 md: protect against crash upon fsync on ro array
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Riemer <[email protected]>
commit bbfa57c0f2243a7c31fd248d22e9861a2802cad5 upstream.
If an fsync occurs on a read-only array, we need to send a completion for the IO and may not increment the active IO count. Otherwise, we hit a bug trace and can't stop the MD array anymore.
By advice of Christoph Hellwig we return success upon a flush request but we return -EROFS for other writes.
We detect flush requests by checking if the bio has zero sectors.
This patch is suitable to any -stable kernel to which it applies.
--- drivers/md/md.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/md.c +4 -0
@@ -307,6 +307,10 @@ static void md_make_request(struct requebio_io_error (bio);return ; } +if (mddev->ro ==1 &&unlikely (rw ==WRITE )) { +bio_endio (bio,bio_sectors (bio) ==0 ?0 : -EROFS ); +return ; + }smp_rmb ();/* Ensure implications of 'active' are visible */ rcu_read_lock ();if (mddev->suspended) {
Greg Kroah-Hartman
maintainerPATCH 40/100 md: fix two bugs when attempting to resize RAID0 array.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit a64685399181780998281fe07309a94b25dd24c3 upstream.
You cannot resize a RAID0 array (in terms of making the devices bigger), but the code doesn't entirely stop you.
So:
disable setting of the available size on each device for RAID0 and Linear devices. This must not change as doing so can change the effective layout of data.
Make sure that the size that raid0_size() reports is accurate, but rounding devices sizes to chunk sizes. As the device sizes cannot change now, this isn't so important, but it is best to be safe.
Without this change:
mdadm --grow /dev/md0 -z max
mdadm --grow /dev/md0 -Z max
then read to the end of the array
can cause a BUG in a RAID0 array.
These bugs have been present ever since it became possible to resize any device, which is a long time. So the fix is suitable for any -stable kerenl.
--- drivers/md/md.c | 3 +++ drivers/md/raid0.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/md/md.c +3 -0
@@ -2998,6 +2998,9 @@ rdev_size_store(struct md_rdev *rdev, co }else if (!sectors) sectors = (i_size_read (rdev->bdev->bd_inode) >>9 ) - rdev->data_offset; +if (!my_mddev->pers->resize) +/* Cannot change size for RAID0 or Linear etc */ +return -EINVAL ; }if (sectors < my_mddev->dev_sectors)return -EINVAL ;/* component must fit device */
drivers/md/raid0.c +2 -1
@@ -411,7 +411,8 @@ static sector_t raid0_size(struct mddev "%s does not support generic reshape\n", __func__);rdev_for_each (rdev, mddev) - array_sectors += rdev->sectors; + array_sectors += (rdev->sectors & + ~(sector_t)(mddev->chunk_sectors-1 ));return array_sectors; }
Greg Kroah-Hartman
maintainerPATCH 41/100 md: raid0: fix error return from create_stripe_zones.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 58ebb34c49fcfcaa029e4b1c1453d92583900f9a upstream.
Create_stripe_zones returns an error slightly differently to raid0_run and to raid0_takeover_*.
The error returned used by the second was wrong and an error would result in mddev->private being set to NULL and sooner or later a crash.
So never return NULL, return ERR_PTR(err), not NULL from create_stripe_zones.
This bug has been present since 2.6.35 so the fix is suitable for any kernel since then.
--- drivers/md/raid0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid0.c +1 -1
@@ -289,7 +289,7 @@ abort:kfree (conf->strip_zone);kfree (conf->devlist);kfree (conf); - *private_conf =NULL ; + *private_conf =ERR_PTR (err);return err; }
Greg Kroah-Hartman
maintainerPATCH 42/100 md/raid1,raid10: fix deadlock with freeze_array()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit ee0b0244030434cdda26777bfb98962447e080cd upstream.
When raid1/raid10 needs to fix a read error, it first drains all pending requests by calling freeze_array(). This calls flush_pending_writes() if it needs to sleep, but some writes may be pending in a per-process plug rather than in the per-array request queue.
When raid1{,0}_unplug() moves the request from the per-process plug to the per-array request queue (from which flush_pending_writes() can flush them), it needs to wake up freeze_array(), or freeze_array() will never flush them and so it will block forever.
So add the requires wake_up() calls.
This bug was introduced by commit
f54a9d0e59c4bea3db733921ca9147612a6f292c
for raid1 and a similar commit for RAID10, and so has been present since linux-3.6. As the bug causes a deadlock I believe this fix is suitable for -stable.
--- drivers/md/raid1.c | 1 + drivers/md/raid10.c | 1 + 2 files changed, 2 insertions(+)
drivers/md/raid1.c +1 -0
@@ -967,6 +967,7 @@ static void raid1_unplug(struct blk_plugbio_list_merge (&conf->pending_bio_list, &plug->pending); conf->pending_count += plug->pending_cnt;spin_unlock_irq (&conf->device_lock); +wake_up (&conf->wait_barrier);md_wakeup_thread (mddev->thread);kfree (plug);return ;
drivers/md/raid10.c +1 -0
@@ -1073,6 +1073,7 @@ static void raid10_unplug(struct blk_plubio_list_merge (&conf->pending_bio_list, &plug->pending); conf->pending_count += plug->pending_cnt;spin_unlock_irq (&conf->device_lock); +wake_up (&conf->wait_barrier);md_wakeup_thread (mddev->thread);kfree (plug);return ;
Greg Kroah-Hartman
maintainerPATCH 43/100 hwmon: (sht15) Check return value of regulator_enable()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 3e78080f81481aa8340374d5a37ae033c1cf4272 upstream.
Not having power is a pretty serious error so check that we are able to enable the supply and error out if we can't.
--- drivers/hwmon/sht15.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/sht15.c +7 -1
@@ -926,7 +926,13 @@ static int sht15_probe(struct platform_dif (voltage) data->supply_uV = voltage; -regulator_enable (data->reg); + ret =regulator_enable (data->reg); +if (ret !=0 ) { +dev_err (&pdev->dev, +"failed to enable regulator: %d\n" , ret); +return ret; + } +/* * Setup a notifier block to update this if another device * causes the voltage to change
Greg Kroah-Hartman
maintainerPATCH 44/100 hwmon: (pmbus/ltc2978) Fix peak attribute handling
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit dbd712c2272764a536e29ad6841dba74989a39d9 upstream.
Peak attributes were not initialized and cleared correctly. Also, temp2_max is only supported on page 0 and thus does not need to be an array.
--- drivers/hwmon/pmbus/ltc2978.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/hwmon/pmbus/ltc2978.c +15 -13
@@ -62,7 +62,7 @@ struct ltc2978_data {int temp_min, temp_max;int vout_min[8 ], vout_max[8 ];int iout_max[2 ]; -int temp2_max[2 ]; +int temp2_max;struct pmbus_driver_info info; };
@@ -204,10 +204,9 @@ static int ltc3880_read_word_data(struct ret =pmbus_read_word_data (client, page,LTC3880_MFR_TEMPERATURE2_PEAK );if (ret >=0 ) { -if (lin11_to_val (ret) - >lin11_to_val (data->temp2_max[page])) - data->temp2_max[page] = ret; - ret = data->temp2_max[page]; +if (lin11_to_val (ret) >lin11_to_val (data->temp2_max)) + data->temp2_max = ret; + ret = data->temp2_max; }break ;case PMBUS_VIRT_READ_VIN_MIN :
@@ -248,11 +247,11 @@ static int ltc2978_write_word_data(strucswitch (reg) {case PMBUS_VIRT_RESET_IOUT_HISTORY : - data->iout_max[page] =0x7fff ; + data->iout_max[page] =0x7c00 ; ret =ltc2978_clear_peaks (client, page, data->id);break ;case PMBUS_VIRT_RESET_TEMP2_HISTORY : - data->temp2_max[page] =0x7fff ; + data->temp2_max =0x7c00 ; ret =ltc2978_clear_peaks (client, page, data->id);break ;case PMBUS_VIRT_RESET_VOUT_HISTORY :
@@ -262,12 +261,12 @@ static int ltc2978_write_word_data(strucbreak ;case PMBUS_VIRT_RESET_VIN_HISTORY : data->vin_min =0x7bff ; - data->vin_max =0 ; + data->vin_max =0x7c00 ; ret =ltc2978_clear_peaks (client, page, data->id);break ;case PMBUS_VIRT_RESET_TEMP_HISTORY : data->temp_min =0x7bff ; - data->temp_max =0x7fff ; + data->temp_max =0x7c00 ; ret =ltc2978_clear_peaks (client, page, data->id);break ;default :
@@ -321,10 +320,11 @@ static int ltc2978_probe(struct i2c_clie info = &data->info; info->write_word_data = ltc2978_write_word_data; - data->vout_min[0 ] =0xffff ; data->vin_min =0x7bff ; + data->vin_max =0x7c00 ; data->temp_min =0x7bff ; - data->temp_max =0x7fff ; + data->temp_max =0x7c00 ; + data->temp2_max =0x7c00 ;switch (id->driver_data) {case ltc2978:
@@ -336,7 +336,6 @@ static int ltc2978_probe(struct i2c_cliefor (i =1 ; i <8 ; i++) { info->func[i] =PMBUS_HAVE_VOUT |PMBUS_HAVE_STATUS_VOUT ; - data->vout_min[i] =0xffff ; }break ;case ltc3880:
@@ -352,11 +351,14 @@ static int ltc2978_probe(struct i2c_clie | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |PMBUS_HAVE_POUT |PMBUS_HAVE_TEMP |PMBUS_HAVE_STATUS_TEMP ; - data->vout_min[1 ] =0xffff ; + data->iout_max[0 ] =0x7c00 ; + data->iout_max[1 ] =0x7c00 ;break ;default :return -ENODEV ; } +for (i =0 ; i < info->pages; i++) + data->vout_min[i] =0xffff ;return pmbus_do_probe (client, id, info); }
Greg Kroah-Hartman
maintainerPATCH 45/100 hwmon: (pmbus/ltc2978) Use detected chip ID to select supported functionality
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit f366fccd0809f13ba20d64cae3c83f7338c88af7 upstream.
We read the chip ID from the chip, use it to determine if the chip ID provided to the driver is correct, and report it if wrong. We should also use the correct chip ID to select supported functionality.
--- drivers/hwmon/pmbus/ltc2978.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ltc2978.c +1 -1
@@ -326,7 +326,7 @@ static int ltc2978_probe(struct i2c_clie data->temp_max =0x7c00 ; data->temp2_max =0x7c00 ; -switch (id->driver_data) { +switch (data->id) {case ltc2978: info->read_word_data = ltc2978_read_word_data; info->pages =8 ;
Greg Kroah-Hartman
maintainerPATCH 46/100 drm/radeon: dont set hpd, afmt interrupts when interrupts are disabled
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit cc9945bf9cac03860b2f7d59882263c965c6e3af upstream.
Avoids splatter if the interrupt handler is not registered due to acceleration being disabled.
--- drivers/gpu/drm/radeon/radeon_irq_kms.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/radeon/radeon_irq_kms.c +12 -0
@@ -400,6 +400,9 @@ void radeon_irq_kms_enable_afmt(struct r {unsigned long irqflags; +if (!rdev->ddev->irq_enabled) +return ; +spin_lock_irqsave (&rdev->irq.lock, irqflags); rdev->irq.afmt[block] = true;radeon_irq_set (rdev);
@@ -419,6 +422,9 @@ void radeon_irq_kms_disable_afmt(struct {unsigned long irqflags; +if (!rdev->ddev->irq_enabled) +return ; +spin_lock_irqsave (&rdev->irq.lock, irqflags); rdev->irq.afmt[block] = false;radeon_irq_set (rdev);
@@ -438,6 +444,9 @@ void radeon_irq_kms_enable_hpd(struct raunsigned long irqflags;int i; +if (!rdev->ddev->irq_enabled) +return ; +spin_lock_irqsave (&rdev->irq.lock, irqflags);for (i =0 ; i <RADEON_MAX_HPD_PINS ; ++i) rdev->irq.hpd[i] |= !!(hpd_mask & (1 << i));
@@ -458,6 +467,9 @@ void radeon_irq_kms_disable_hpd(struct runsigned long irqflags;int i; +if (!rdev->ddev->irq_enabled) +return ; +spin_lock_irqsave (&rdev->irq.lock, irqflags);for (i =0 ; i <RADEON_MAX_HPD_PINS ; ++i) rdev->irq.hpd[i] &= !(hpd_mask & (1 << i));
Greg Kroah-Hartman
maintainerPATCH 47/100 drm/radeon: add primary dac adj quirk for R200 board
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit e8fc41377f5037ff7a661ea06adc05f1daec1548 upstream.
vbios values are wrong leading to colors that are
too bright. Use the default values instead.
--- drivers/gpu/drm/radeon/radeon_combios.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/radeon/radeon_combios.c +9 -0
@@ -970,6 +970,15 @@ struct radeon_encoder_primary_dac *radeo found =1 ; } +/* quirks */ +/* Radeon 9100 (R200) */ +if ((dev->pdev->device ==0x514D ) && + (dev->pdev->subsystem_vendor ==0x174B ) && + (dev->pdev->subsystem_device ==0x7149 )) { +/* vbios value is bad, use the default */ + found =0 ; + } +if (!found)/* fallback to defaults */ radeon_legacy_get_primary_dac_info_from_table (rdev, p_dac);
Greg Kroah-Hartman
maintainerPATCH 48/100 ARM: 7657/1: head: fix swapper and idmap population with LPAE and big-endian
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit d61947a164760ac520cb416768afdf38c33d60e7 upstream.
The LPAE page table format uses 64-bit descriptors, so we need to take endianness into account when populating the swapper and idmap tables during early initialisation.
This patch ensures that we store the two words making up each page table entry in the correct order when running big-endian.
--- arch/arm/kernel/head.S | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
arch/arm/kernel/head.S +22 -4
@@ -184,13 +184,22 @@ __create_page_tables: orr r3, r3, #3 @ PGD block type mov r6, #4 @ PTRS_PER_PGD mov r7, #1 << (55 - 32) @ L_PGD_SWAPPER -1: str r3, [r0], #4 @ set bottom PGD entry bits +1: +#ifdef CONFIG_CPU_ENDIAN_BE8 str r7, [r0], #4 @ set top PGD entry bits + str r3, [r0], #4 @ set bottom PGD entry bits +#else + str r3, [r0], #4 @ set bottom PGD entry bits + str r7, [r0], #4 @ set top PGD entry bits +#endif add r3, r3, #0x1000 @ next PMD table subs r6, r6, #1 bne 1b add r4, r4, #0x1000 @ point to the PMD tables +#ifdef CONFIG_CPU_ENDIAN_BE8 + add r4, r4, #4 @ we only write the bottom word +#endif #endif ldr r7, [r10, #PROCINFO_MM_MMUFLAGS] @ mm_mmuflags
@@ -258,6 +267,11 @@ __create_page_tables: addne r6, r6, #1 << SECTION_SHIFT strne r6, [r3] +#if defined(CONFIG_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8) + sub r4, r4, #4 @ Fixup page table pointer + @ for 64-bit descriptors +#endif + #ifdef CONFIG_DEBUG_LL #if !defined(CONFIG_DEBUG_ICEDCC) && !defined(CONFIG_DEBUG_SEMIHOSTING) /*
@@ -276,13 +290,17 @@ __create_page_tables: orr r3, r7, r3, lsl #SECTION_SHIFT #ifdef CONFIG_ARM_LPAE mov r7, #1 << (54 - 32) @ XN +#ifdef CONFIG_CPU_ENDIAN_BE8 + str r7, [r0], #4 + str r3, [r0], #4 #else - orr r3, r3, #PMD_SECT_XN -#endif str r3, [r0], #4 -#ifdef CONFIG_ARM_LPAE str r7, [r0], #4 #endif +#else + orr r3, r3, #PMD_SECT_XN + str r3, [r0], #4 +#endif #else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */ /* we don't need any serial debugging mappings */
Greg Kroah-Hartman
maintainerPATCH 49/100 ARM: 7658/1: mm: fix race updating mm->context.id on ASID rollover
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 37f47e3d62533c931b04cb409f2eb299e6342331 upstream.
If a thread triggers an ASID rollover, other threads of the same process must be made to wait until the mm->context.id for the shared mm_struct has been updated to new generation and associated book-keeping (e.g. TLB invalidation) has ben performed.
However, there is a *tiny* window where both mm->context.id and the relevant active_asids entry are updated to the new generation, but the TLB flush has not been performed, which could allow another thread to return to userspace with a dirty TLB, potentially leading to data corruption. In reality this will never occur because one CPU would need to perform a context-switch in the time it takes another to do a couple of atomic test/set operations but we should plug the race anyway.
This patch moves the active_asids update until after the potential TLB flush on context-switch.
--- arch/arm/mm/context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mm/context.c +3 -3
@@ -204,11 +204,11 @@ void check_and_switch_context(struct mm_if ((mm->context.id ^atomic64_read (&asid_generation)) >>ASID_BITS )new_context (mm, cpu); -atomic64_set (&per_cpu (active_asids, cpu), mm->context.id); -cpumask_set_cpu (cpu,mm_cpumask (mm)); -if (cpumask_test_and_clear_cpu (cpu, &tlb_flush_pending))local_flush_tlb_all (); + +atomic64_set (&per_cpu (active_asids, cpu), mm->context.id); +cpumask_set_cpu (cpu,mm_cpumask (mm));raw_spin_unlock_irqrestore (&cpu_asid_lock, flags); switch_mm_fastpath:
Greg Kroah-Hartman
maintainerPATCH 50/100 ARM: 7659/1: mm: make mm->context.id an atomic64_t variable
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 8a4e3a9ead7e37ce1505602b564c15da09ac039f upstream.
mm->context.id is updated under asid_lock when a new ASID is allocated to an mm_struct. However, it is also read without the lock when a task is being scheduled and checking whether or not the current ASID generation is up-to-date.
If two threads of the same process are being scheduled in parallel and the bottom bits of the generation in their mm->context.id match the current generation (that is, the mm_struct has not been used for ~2^24 rollovers) then the non-atomic, lockless access to mm->context.id may yield the incorrect ASID.
This patch fixes this issue by making mm->context.id and atomic64_t, ensuring that the generation is always read consistently. For code that only requires access to the ASID bits (e.g. TLB flushing by mm), then the value is accessed directly, which GCC converts to an ldrb.
--- arch/arm/include/asm/mmu.h | 8 ++++---- arch/arm/include/asm/mmu_context.h | 2 +- arch/arm/kernel/asm-offsets.c | 2 +- arch/arm/mm/context.c | 21 +++++++++++++-------- 4 files changed, 19 insertions(+), 14 deletions(-)
arch/arm/include/asm/mmu.h +4 -4
@@ -5,15 +5,15 @@typedef struct {#ifdef CONFIG_CPU_HAS_ASID -u64 id; +atomic64_t id;#endif -unsigned int vmalloc_seq; +unsigned int vmalloc_seq; }mm_context_t ;#ifdef CONFIG_CPU_HAS_ASID #define ASID_BITS 8#define ASID_MASK ((~0ULL) << ASID_BITS) -#define ASID (mm) ((mm)->context.id & ~ASID_MASK) +#define ASID (mm) ((mm)->context.id.counter & ~ASID_MASK)#else #define ASID (mm) (0)#endif
@@ -26,7 +26,7 @@ typedef struct {* modified for 2.6 by Hyok S. Choi <[email protected]> */ typedef struct { -unsigned long end_brk; +unsigned long end_brk; }mm_context_t ;#endif
arch/arm/include/asm/mmu_context.h +1 -1
@@ -25,7 +25,7 @@ void __check_vmalloc_seq(struct mm_struc#ifdef CONFIG_CPU_HAS_ASID void check_and_switch_context (struct mm_struct *mm,struct task_struct *tsk); -#define init_new_context (tsk,mm) ({ mm->context.id = 0; }) +#define init_new_context (tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })#else /* !CONFIG_CPU_HAS_ASID */
arch/arm/kernel/asm-offsets.c +1 -1
@@ -107,7 +107,7 @@ int main(void)BLANK ();#endif #ifdef CONFIG_CPU_HAS_ASID - DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id)); + DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id.counter));BLANK ();#endif DEFINE (VMA_VM_MM , offsetof(struct vm_area_struct , vm_mm));
arch/arm/mm/context.c +13 -8
@@ -149,9 +149,9 @@ static int is_reserved_asid(u64 asid)return 0 ; } -static void new_context (struct mm_struct *mm,unsigned int cpu) +static u64 new_context (struct mm_struct *mm,unsigned int cpu) { -u64 asid = mm->context.id; +u64 asid =atomic64_read (&mm->context.id);u64 generation =atomic64_read (&asid_generation);if (asid !=0 &&is_reserved_asid (asid)) {
@@ -178,13 +178,14 @@ static void new_context(struct mm_structcpumask_clear (mm_cpumask (mm)); } - mm->context.id = asid; +return asid; }void check_and_switch_context (struct mm_struct *mm,struct task_struct *tsk) {unsigned long flags;unsigned int cpu =smp_processor_id (); +u64 asid;if (unlikely (mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))__check_vmalloc_seq (mm);
@@ -195,19 +196,23 @@ void check_and_switch_context(struct mm_*/ cpu_set_reserved_ttbr0 (); -if (!((mm->context.id ^atomic64_read (&asid_generation)) >>ASID_BITS ) - &&atomic64_xchg (&per_cpu (active_asids, cpu), mm->context.id)) + asid =atomic64_read (&mm->context.id); +if (!((asid ^atomic64_read (&asid_generation)) >>ASID_BITS ) + &&atomic64_xchg (&per_cpu (active_asids, cpu), asid)) goto switch_mm_fastpath;raw_spin_lock_irqsave (&cpu_asid_lock, flags);/* Check that our ASID belongs to the current generation. */ -if ((mm->context.id ^atomic64_read (&asid_generation)) >>ASID_BITS ) -new_context (mm, cpu); + asid =atomic64_read (&mm->context.id); +if ((asid ^atomic64_read (&asid_generation)) >>ASID_BITS ) { + asid =new_context (mm, cpu); +atomic64_set (&mm->context.id, asid); + }if (cpumask_test_and_clear_cpu (cpu, &tlb_flush_pending))local_flush_tlb_all (); -atomic64_set (&per_cpu (active_asids, cpu), mm->context.id); +atomic64_set (&per_cpu (active_asids, cpu), asid);cpumask_set_cpu (cpu,mm_cpumask (mm));raw_spin_unlock_irqrestore (&cpu_asid_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 51/100 ARM: 7663/1: perf: fix ARMv7 EVTYPE_MASK to include NSH bit
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit f2fe09b055e2549de41fb107b34c60bac4a1b0cf upstream.
Masked out PMXEVTYPER.NSH means that we can't enable profiling at PL2, regardless of the settings in the HDCR.
This patch fixes the broken mask.
--- arch/arm/kernel/perf_event_v7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/perf_event_v7.c +1 -1
@@ -774,7 +774,7 @@ static const unsigned armv7_a7_perf_cach/* * PMXEVTYPER: Event selection reg */ -#define ARMV7_EVTYPE_MASK 0xc00000ff/* Mask for writable bits */ +#define ARMV7_EVTYPE_MASK 0xc80000ff/* Mask for writable bits */ #define ARMV7_EVTYPE_EVENT 0xff/* Mask for EVENT bits */ /*
Greg Kroah-Hartman
maintainerPATCH 52/100 drm/i915: Increase the RC6p threshold.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stéphane Marchesin <[email protected]>
commit 0920a48719f1ceefc909387a64f97563848c7854 upstream.
This increases GEN6_RC6p_THRESHOLD from 100000 to 150000. For some reason this avoids the gen6_gt_check_fifodbg.isra warnings and associated GPU lockups, which makes my ivy bridge machine stable.
--- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -2572,7 +2572,7 @@ static void gen6_enable_rps(struct drm_dI915_WRITE (GEN6_RC_SLEEP ,0 );I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -I915_WRITE (GEN6_RC6p_THRESHOLD,100000 ); +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 );I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ /* Check if we are enabling RC6 */
Re: [ 052/100] drm/i915: Increase the RC6p threshold.
Quoted 24 lines · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stéphane Marchesin <[email protected]>
commit
0920a48719f1ceefc909387a64f97563848c7854upstream.This increases
GEN6_RC6p_THRESHOLDfrom 100000 to 150000. For some reason this avoids the gen6_gt_check_fifodbg.isra warnings and associated GPU lockups, which makes my ivy bridge machine stable.Signed-off-by Stéphane Marchesin <[email protected]>Acked-by Jesse Barnes <[email protected]>Signed-off-by Daniel Vetter <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_d · line 2578
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -2572,7 +2572,7 @@ static void gen6_enable_rps(struct drm_dI915_WRITE (GEN6_RC_SLEEP ,0 );I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -I915_WRITE (GEN6_RC6p_THRESHOLD,100000 ); +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 );I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ /* Check if we are enabling RC6 */
Is there any reason why this shouldn't be applied to 3.2.y and 3.4.y? The same function and writes are present, only in intel_display.c rather than intel_pm.c.
Ben.
Signature · 2 lines
Ben Hutchings Never attribute to conspiracy what can adequately be explained by stupidity.
Greg Kroah-Hartman
maintainerRe: [ 052/100] drm/i915: Increase the RC6p threshold.
Quoted 32 lines · Ben Hutchings
Quoted 31 lines · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stéphane Marchesin <[email protected]>
commit
0920a48719f1ceefc909387a64f97563848c7854upstream.This increases
GEN6_RC6p_THRESHOLDfrom 100000 to 150000. For some reason this avoids the gen6_gt_check_fifodbg.isra warnings and associated GPU lockups, which makes my ivy bridge machine stable.Signed-off-by Stéphane Marchesin <[email protected]>Acked-by Jesse Barnes <[email protected]>Signed-off-by Daniel Vetter <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -2572,7 +2572,7 @@ static void gen6_enable_rps(struct drm_dI915_WRITE (GEN6_RC_SLEEP ,0 );I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -I915_WRITE (GEN6_RC6p_THRESHOLD,100000 ); +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 );I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_d · line 2578
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-0/* Check if we are enabling RC6 */ Is there any reason why this shouldn't be applied to 3.2.y and 3.4.y? The same function and writes are present, only in
intel_display.crather thanintel_pm.c.
Ah, missed the fact that the file was renamed, nice catch.
I'll apply it to older kernels if the authors and maintainers say it's safe to do so.
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): CADMs+9bmi2fNMV=9OaL-JvBJxu1=HWMYAVMm81v7rKDPnDyewA@mail.gmail.com
Greg Kroah-Hartman
maintainerRe: [ 052/100] drm/i915: Increase the RC6p threshold.
Quoted 53 lines · Stéphane Marchesin
On Mon, Mar 18, 2013 at 12:38 PM, Greg Kroah-Hartman < [email protected]> wrote:
On Mon, Mar 18, 2013 at 01:11:09AM +0000, Ben Hutchings wrote: > On Tue, 2013-03-12 at 15:31 -0700, Greg Kroah-Hartman wrote: > > 3.8-stable review patch. If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Stéphane Marchesin <[email protected]> > > > > commit 0920a48719f1ceefc909387a64f97563848c7854 upstream. > > > > This increases GEN6_RC6p_THRESHOLD from 100000 to 150000. For some > > reason this avoids the gen6_gt_check_fifodbg.isra warnings and > > associated GPU lockups, which makes my ivy bridge machine stable. > > > > Signed-off-by: Stéphane Marchesin <[email protected]> > > Acked-by: Jesse Barnes <[email protected]> > > Signed-off-by: Daniel Vetter <[email protected]> > > Signed-off-by: Greg Kroah-Hartman <[email protected]> > > > > --- > > drivers/gpu/drm/i915/intel_pm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > --- a/drivers/gpu/drm/i915/intel_pm.c > > +++ b/drivers/gpu/drm/i915/intel_pm.c > > @@ -2572,7 +2572,7 @@ static void gen6_enable_rps(struct drm_d > > I915_WRITE(GEN6_RC_SLEEP, 0); > > I915_WRITE(GEN6_RC1e_THRESHOLD, 1000); > > I915_WRITE(GEN6_RC6_THRESHOLD, 50000); > > - I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); > > + I915_WRITE(GEN6_RC6p_THRESHOLD, 150000); > > I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ > > > > /* Check if we are enabling RC6 */ > > Is there any reason why this shouldn't be applied to 3.2.y and 3.4.y? > The same function and writes are present, only in intel_display.c rather > than intel_pm.c. Ah, missed the fact that the file was renamed, nice catch. I'll apply it to older kernels if the authors and maintainers say it's safe to do so.
Quoted 2 lines
It should be safe; I actually wrote this patch against Chrome OS's 3.4 kernel initially.
Ok, now applied to the 3.4-stable queue.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 53/100 drm/i915: Fix Haswell/CRW PCI IDs.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kenneth Graunke <[email protected]>
commit 86c268ed0f9b3b4d51d81dd8fcec533a164414d1 upstream.
The second digit was off by one, which meant we accidentally treated GT(n) as GT(n-1). This also meant no support for GT1 at all.
--- drivers/gpu/drm/i915/i915_drv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +6 -6
@@ -377,15 +377,15 @@ static const struct pci_device_id pciidlINTEL_VGA_DEVICE (0x0A06 , &intel_haswell_m_info),/* ULT GT1 mobile */ INTEL_VGA_DEVICE (0x0A16 , &intel_haswell_m_info),/* ULT GT2 mobile */ INTEL_VGA_DEVICE (0x0A26 , &intel_haswell_m_info),/* ULT GT2 mobile */ -INTEL_VGA_DEVICE (0x0D12 , &intel_haswell_d_info),/* CRW GT1 desktop */ +INTEL_VGA_DEVICE (0x0D02 , &intel_haswell_d_info),/* CRW GT1 desktop */ +INTEL_VGA_DEVICE (0x0D12 , &intel_haswell_d_info),/* CRW GT2 desktop */ INTEL_VGA_DEVICE (0x0D22 , &intel_haswell_d_info),/* CRW GT2 desktop */ -INTEL_VGA_DEVICE (0x0D32 , &intel_haswell_d_info),/* CRW GT2 desktop */ -INTEL_VGA_DEVICE (0x0D1A , &intel_haswell_d_info),/* CRW GT1 server */ +INTEL_VGA_DEVICE (0x0D0A , &intel_haswell_d_info),/* CRW GT1 server */ +INTEL_VGA_DEVICE (0x0D1A , &intel_haswell_d_info),/* CRW GT2 server */ INTEL_VGA_DEVICE (0x0D2A , &intel_haswell_d_info),/* CRW GT2 server */ -INTEL_VGA_DEVICE (0x0D3A , &intel_haswell_d_info),/* CRW GT2 server */ -INTEL_VGA_DEVICE (0x0D16 , &intel_haswell_m_info),/* CRW GT1 mobile */ +INTEL_VGA_DEVICE (0x0D06 , &intel_haswell_m_info),/* CRW GT1 mobile */ +INTEL_VGA_DEVICE (0x0D16 , &intel_haswell_m_info),/* CRW GT2 mobile */ INTEL_VGA_DEVICE (0x0D26 , &intel_haswell_m_info),/* CRW GT2 mobile */ -INTEL_VGA_DEVICE (0x0D36 , &intel_haswell_m_info),/* CRW GT2 mobile */ INTEL_VGA_DEVICE (0x0f30 , &intel_valleyview_m_info),INTEL_VGA_DEVICE (0x0157 , &intel_valleyview_m_info), INTEL_VGA_DEVICE(0x0155, &intel_valleyview_d_info),
Greg Kroah-Hartman
maintainerPATCH 54/100 drm/i915: reorder setup sequence to have irqs for output setup
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 52d7ecedac3f96fb562cb482c139015372728638 upstream.
Otherwise the new&shiny irq-driven gmbus and dp aux code won't work that well. Noticed since the dp aux code doesn't have an automatic fallback with a timeout (since the hw provides for that already).
v2: Simple move drm_irq_install before intel_modeset_gem_init, as suggested by Ben Widawsky.
v3: Now that interrupts are enabled before all connectors are fully set up, we might fall over serving a HPD interrupt while things are still being set up. Instead of jumping through massive hoops and complicating the code with a separate hpd irq enable step, simply block out the hotplug work item from doing anything until things are in place.
v4: Actually, we can enable hotplug processing only after the fbdev is fully set up, since we call down into the fbdev from the hotplug work functions. So stick the hpd enabling right next to the poll helper initialization.
v5: We need to enable irqs before intel_modeset_init, since that function sets up the outputs.
v6: Fixup cleanup sequence, too.
--- drivers/gpu/drm/i915/i915_dma.c | 23 ++++++++++++++--------- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_irq.c | 4 ++++ 3 files changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +14 -9
@@ -1297,19 +1297,21 @@ static int i915_load_modeset_init(structif (ret) goto cleanup_vga_switcheroo; + ret =drm_irq_install (dev); +if (ret) + goto cleanup_gem_stolen; + +/* Important: The output setup functions called by modeset_init need +* working irqs for e.g. gmbus and dp aux transfers. */ intel_modeset_init (dev); ret =i915_gem_init (dev);if (ret) - goto cleanup_gem_stolen; - -intel_modeset_gem_init (dev); + goto cleanup_irq;INIT_WORK (&dev_priv->console_resume_work, intel_console_resume); - ret =drm_irq_install (dev); -if (ret) - goto cleanup_gem; +intel_modeset_gem_init (dev);/* Always safe in the mode setting case. */ /* FIXME: do pre/post-mode set stuff in core KMS code */
@@ -1317,7 +1319,10 @@ static int i915_load_modeset_init(struct ret =intel_fbdev_init (dev);if (ret) - goto cleanup_irq; + goto cleanup_gem; + +/* Only enable hotplug handling once the fbdev is fully set up. */ + dev_priv->enable_hotplug_processing = true;drm_kms_helper_poll_init (dev);
@@ -1326,13 +1331,13 @@ static int i915_load_modeset_init(structreturn 0 ; -cleanup_irq: -drm_irq_uninstall (dev); cleanup_gem:mutex_lock (&dev->struct_mutex);i915_gem_cleanup_ringbuffer (dev);mutex_unlock (&dev->struct_mutex);i915_gem_cleanup_aliasing_ppgtt (dev); +cleanup_irq: +drm_irq_uninstall (dev); cleanup_gem_stolen:i915_gem_cleanup_stolen (dev); cleanup_vga_switcheroo:
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -672,6 +672,7 @@ typedef struct drm_i915_private {u32 hotplug_supported_mask;struct work_struct hotplug_work; +bool enable_hotplug_processing;int num_pipe;int num_pch_pll;
drivers/gpu/drm/i915/i915_irq.c +4 -0
@@ -287,6 +287,10 @@ static void i915_hotplug_work_func(strucstruct drm_mode_config *mode_config = &dev->mode_config;struct intel_encoder *encoder; +/* HPD irq before everything is fully set up. */ +if (!dev_priv->enable_hotplug_processing) +return ; +mutex_lock (&mode_config->mutex);DRM_DEBUG_KMS ("running encoder hotplug functions\n" );
Greg Kroah-Hartman
maintainerPATCH 55/100 drm/i915: enable irqs earlier when resuming
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 15239099d7a7a9ecdc1ccb5b187ae4cda5488ff9 upstream.
We need it to restore the ilk rc6 context, since the gpu wait no requires interrupts. But in general having interrupts around should help in code sanity, since more and more stuff is interrupt driven.
This regression has been introduced in
commit 3e9605018ab3e333d51cc90fccfde2031886763b
Author: Chris Wilson <[email protected]> Date: Tue Nov 27 16:22:54 2012 +0000
drm/i915: Rearrange code to only have a single method for waiting upon the ring
Like in the driver load code we need to make sure that hotplug interrupts don't cause havoc with our modeset state, hence block them with the existing infrastructure. Again we ignore races where we might loose hotplug interrupts ...
Note that the driver load part of the regression has already been fixed in
commit 52d7ecedac3f96fb562cb482c139015372728638
Author: Daniel Vetter <[email protected]> Date: Sat Dec 1 21:03:22 2012 +0100
drm/i915: reorder setup sequence to have irqs for output setup
v2: Add a note to the commit message about which patch fixed the driver load part of the regression. Stable kernels need to backport both patches.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=54691
--- drivers/gpu/drm/i915/i915_drv.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +12 -1
@@ -486,6 +486,7 @@ static int i915_drm_freeze(struct drm_deintel_modeset_disable (dev);drm_irq_uninstall (dev); + dev_priv->enable_hotplug_processing = false; }i915_save_state (dev);
@@ -562,9 +563,19 @@ static int __i915_drm_thaw(struct drm_de error =i915_gem_init_hw (dev);mutex_unlock (&dev->struct_mutex); +/* We need working interrupts for modeset enabling ... */ +drm_irq_install (dev); +intel_modeset_init_hw (dev);intel_modeset_setup_hw_state (dev, false); -drm_irq_install (dev); + +/* +* ... but also need to make sure that hotplug processing +* doesn't cause havoc. Like in the driver load code we don't +* bother with the tiny race here where we might loose hotplug +* notifications. +* */ + dev_priv->enable_hotplug_processing = true; }intel_opregion_init (dev);
Greg Kroah-Hartman
maintainerPATCH 56/100 drm/i915: Turn off hsync and vsync on ADPA when disabling crt
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrik Jakobsson <[email protected]>
commit f40ebd6bcbbd0d30591f42dc16be52b5086a366b upstream.
According to PRM we need to disable hsync and vsync even though ADPA is disabled. The previous code did infact do the opposite so we fix it.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56359
--- drivers/gpu/drm/i915/intel_crt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_crt.c +1 -1
@@ -88,7 +88,7 @@ static void intel_disable_crt(struct intu32 temp; temp =I915_READ (crt->adpa_reg); - temp &= ~(ADPA_HSYNC_CNTL_DISABLE |ADPA_VSYNC_CNTL_DISABLE ); + temp |=ADPA_HSYNC_CNTL_DISABLE |ADPA_VSYNC_CNTL_DISABLE ; temp &= ~ADPA_DAC_ENABLE ;I915_WRITE (crt->adpa_reg, temp); }
Greg Kroah-Hartman
maintainerPATCH 57/100 ipc: fix potential oops when src msg > 4k w/ MSG_COPY
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit e1082f45f1e2bbf6e25f6b614fc6616ebf709d19 upstream.
If the src msg is > 4k, then dest->next points to the next allocated segment; resetting it just prior to dereferencing is bad.
--- ipc/msgutil.c | 3 --- 1 file changed, 3 deletions(-)
ipc/msgutil.c +0 -3
@@ -117,9 +117,6 @@ struct msg_msg *copy_msg(struct msg_msgif (alen >DATALEN_MSG ) alen =DATALEN_MSG ; - dst->next =NULL ; - dst->security =NULL ; -memcpy (dst +1 , src +1 , alen); len -= alen;
Greg Kroah-Hartman
maintainerPATCH 58/100 ipc: dont allocate a copy larger than max
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit 88b9e456b1649722673ffa147914299799dc9041 upstream.
When MSG_COPY is set, a duplicate message must be allocated for the copy before locking the queue. However, the copy could not be larger than was sent which is limited to msg_ctlmax.
--- ipc/msg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
ipc/msg.c +4 -2
@@ -820,15 +820,17 @@ long do_msgrcv(int msqid, void __user *bstruct msg_msg *copy =NULL ;unsigned long copy_number =0 ; + ns = current->nsproxy->ipc_ns; +if (msqid <0 || (long ) bufsz <0 )return -EINVAL ;if (msgflg &MSG_COPY ) { - copy =prepare_copy (buf, bufsz, msgflg, &msgtyp, ©_number); + copy =prepare_copy (buf,min_t (size_t, bufsz, ns->msg_ctlmax), + msgflg, &msgtyp, ©_number);if (IS_ERR (copy))return PTR_ERR (copy); } mode =convert_mode (&msgtyp, msgflg); - ns = current->nsproxy->ipc_ns; msq =msg_lock_check (ns, msqid);if (IS_ERR (msq)) {
Greg Kroah-Hartman
maintainerPATCH 59/100 dmi_scan: fix missing check for _DMI_ signature in smbios_present()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit a40e7cf8f06b4e322ba902e4e9f6a6b0c2daa907 upstream.
Commit 9f9c9cbb6057 ("drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists") hoisted the check for "_DMI_" into dmi_scan_machine(), which means that we don't bother to check for "_DMI_" at offset 16 in an SMBIOS entry. smbios_present() may also call dmi_present() for an address where we found "_SM_", if it failed further validation.
Check for "_DMI_" in smbios_present() before calling dmi_present().
--- drivers/firmware/dmi_scan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/firmware/dmi_scan.c +2 -3
@@ -442,7 +442,6 @@ static int __init dmi_present(const charstatic int __init smbios_present (const char __iomem *p) {u8 buf[32 ]; -int offset =0 ;memcpy_fromio (buf, p,32 );if ((buf[5 ] <32 ) &&dmi_checksum (buf, buf[5 ])) {
@@ -461,9 +460,9 @@ static int __init smbios_present(const c dmi_ver =0x0206 ;break ; } - offset =16 ; +return memcmp (p +16 ,"_DMI_" ,5 ) ||dmi_present (p +16 ); } -return dmi_present (buf + offset); +return 1 ; }void __init dmi_scan_machine (void )
Greg Kroah-Hartman
maintainerPATCH 60/100 ALSA: ice1712: Initialize card->private_data properly
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Connor <[email protected]>
commit 69a4cfdd444d1fe5c24d29b3a063964ac165d2cd upstream.
Set card->private_data in snd_ice1712_create for fixing NULL dereference in snd_ice1712_remove().
--- sound/pci/ice1712/ice1712.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/ice1712/ice1712.c +2 -0
@@ -2594,6 +2594,8 @@ static int snd_ice1712_create(struct sndsnd_ice1712_proc_init (ice);synchronize_irq (pci->irq); + card->private_data = ice; + err =pci_request_regions (pci,"ICE1712" );if (err <0 ) {kfree (ice);
Greg Kroah-Hartman
maintainerPATCH 61/100 ALSA: vmaster: Fix slave change notification
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 2069d483b39a603a5f3428a19d3b4ac89aa97f48 upstream.
When a value of a vmaster slave control is changed, the ctl change notification is sometimes ignored. This happens when the master control overrides, e.g. when the corresponding master control is muted. The reason is that slave_put() returns the value of the actual slave put callback, and it doesn't reflect the virtual slave value change.
This patch fixes the function just to return 1 whenever a slave value is changed.
--- sound/core/vmaster.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/core/vmaster.c +4 -1
@@ -213,7 +213,10 @@ static int slave_put(struct snd_kcontrol }if (!changed)return 0 ; -return slave_put_val (slave, ucontrol); + err =slave_put_val (slave, ucontrol); +if (err <0 ) +return err; +return 1 ; } static int slave_tlv_cmd(struct snd_kcontrol *kcontrol,
Greg Kroah-Hartman
maintainerPATCH 62/100 vfs: dont BUG_ON() if following a /proc fd pseudo-symlink results in a symlink
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 7b54c165a0c012edbaeaa73c5c87cb73721eb580 upstream.
It's "normal" - it can happen if the file descriptor you followed was opened with O_NOFOLLOW.
--- fs/namei.c | 2 -- 1 file changed, 2 deletions(-)
fs/namei.c +0 -2
@@ -693,8 +693,6 @@ void nd_jump_link(struct nameidata *nd, nd->path = *path; nd->inode = nd->path.dentry->d_inode; nd->flags |=LOOKUP_JUMPED ; - -BUG_ON (nd->inode->i_op->follow_link); }static inline void put_link (struct nameidata *nd,struct path *link,void *cookie)
Greg Kroah-Hartman
maintainerPATCH 63/100 proc: Use nd_jump_link in proc_ns_follow_link
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit db04dc679bcc780ad6907943afe24a30de974a1b upstream.
Update proc_ns_follow_link to use nd_jump_link instead of just manually updating nd.path.dentry.
This fixes the BUG_ON(nd->inode != parent->d_inode) reported by Dave Jones and reproduced trivially with mkdir /proc/self/ns/uts/a.
Sigh it looks like the VFS change to require use of nd_jump_link happend while proc_ns_follow_link was baking and since the common case of proc_ns_follow_link continued to work without problems the need for making this change was overlooked.
--- fs/proc/namespaces.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/proc/namespaces.c +6 -6
@@ -118,7 +118,7 @@ static void *proc_ns_follow_link(structstruct super_block *sb = inode->i_sb;struct proc_inode *ei =PROC_I (inode);struct task_struct *task; -struct dentry *ns_dentry; +struct path ns_path;void *error =ERR_PTR (-EACCES ); task =get_proc_task (inode);
@@ -128,14 +128,14 @@ static void *proc_ns_follow_link(structif (!ptrace_may_access (task,PTRACE_MODE_READ )) goto out_put_task; - ns_dentry =proc_ns_get_dentry (sb, task, ei->ns_ops); -if (IS_ERR (ns_dentry)) { - error =ERR_CAST (ns_dentry); + ns_path.dentry =proc_ns_get_dentry (sb, task, ei->ns_ops); +if (IS_ERR (ns_path.dentry)) { + error =ERR_CAST (ns_path.dentry); goto out_put_task; } -dput (nd->path.dentry); - nd->path.dentry = ns_dentry; + ns_path.mnt =mntget (nd->path.mnt); +nd_jump_link (nd, &ns_path); error =NULL ; out_put_task:
Greg Kroah-Hartman
maintainerPATCH 64/100 tile: work around bug in the generic sys_llseek
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Metcalf <[email protected]>
commit 5a114b98661e3aaa0ac085eb931584dce3b0ef9b upstream.
sys_llseek should specify the high and low 32-bit seek values as "unsigned int" but instead it specifies "unsigned long". Since compat syscall arguments are always sign-extended on tile, this means that a seek value of 0xffffffff will be incorrectly interpreted as a value of -1ULL.
To avoid the risk of breaking binary compatibility on architectures that already use sys_llseek this way, we follow the same path as MIPS and provide a wrapper override.
--- arch/tile/include/asm/compat.h | 3 +++ arch/tile/kernel/compat.c | 13 +++++++++++++ 2 files changed, 16 insertions(+)
arch/tile/include/asm/compat.h +3 -0
@@ -296,6 +296,9 @@ long compat_sys_sync_file_range2(int fd,long compat_sys_fallocate (int fd,int mode,u32 offset_lo,u32 offset_hi,u32 len_lo,u32 len_hi); +long compat_sys_llseek (unsigned int fd,unsigned int offset_high, +unsigned int offset_low,loff_t __user * result, +unsigned int origin);/* Assembly trampoline to avoid clobbering r0. */ long _compat_sys_rt_sigreturn (void );
arch/tile/kernel/compat.c +13 -0
@@ -76,6 +76,18 @@ long compat_sys_fallocate(int fd, int mo ((loff_t)len_hi << 32) | len_lo); } +/* +* Avoid bug in generic sys_llseek() that specifies offset_high and +* offset_low as "unsigned long", thus making it possible to pass +* a sign-extended high 32 bits in offset_low. +*/ +long compat_sys_llseek (unsigned int fd,unsigned int offset_high, +unsigned int offset_low,loff_t __user * result, +unsigned int origin) +{ +return sys_llseek (fd, offset_high, offset_low, result, origin); +} +/* Provide the compat syscall number to call mapping. */ #undef __SYSCALL#define __SYSCALL (nr, call) [nr] = (call),
@@ -83,6 +95,7 @@ long compat_sys_fallocate(int fd, int mo/* See comments in sys.c */ #define compat_sys_fadvise64_64 sys32_fadvise64_64#define compat_sys_readahead sys32_readahead +#define sys_llseek compat_sys_llseek/* Call the assembly trampolines where necessary. */ #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn
Greg Kroah-Hartman
maintainerPATCH 65/100 random: fix locking dependency with the tasklist_lock
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit b980955236922ae6106774511c5c05003d3ad225 upstream.
Commit 6133705494bb introduced a circular lock dependency because posix_cpu_timers_exit() is called by release_task(), which is holding a writer lock on tasklist_lock, and this can cause a deadlock since kill_fasync() gets called with nonblocking_pool.lock taken.
There's no reason why kill_fasync() needs to be taken while the random pool is locked, so move it out to fix this locking dependency.
--- drivers/char/random.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/char/random.c +8 -4
@@ -852,6 +852,7 @@ static size_t account(struct entropy_sto int reserved) {unsigned long flags; +int wakeup_write =0 ;/* Hold lock while accounting */ spin_lock_irqsave (&r->lock, flags);
@@ -873,10 +874,8 @@ static size_t account(struct entropy_stoelse r->entropy_count = reserved; -if (r->entropy_count < random_write_wakeup_thresh) { -wake_up_interruptible (&random_write_wait); -kill_fasync (&fasync,SIGIO ,POLL_OUT ); - } +if (r->entropy_count < random_write_wakeup_thresh) + wakeup_write =1 ; } DEBUG_ENT("debiting %zu entropy credits from %s%s\n",
@@ -884,6 +883,11 @@ static size_t account(struct entropy_stospin_unlock_irqrestore (&r->lock, flags); +if (wakeup_write) { +wake_up_interruptible (&random_write_wait); +kill_fasync (&fasync,SIGIO ,POLL_OUT ); + } +return nbytes; }
Greg Kroah-Hartman
maintainerPATCH 66/100 mm/mempolicy.c: fix wrong sp_node insertion
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hillf Danton <[email protected]>
commit 5ca3957510b9fc2a14d3647db518014842f9a2b4 upstream.
n->end is accessed in sp_insert(). Thus it should be update before calling sp_insert(). This mistake may make kernel panic.
--- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -1
@@ -2386,8 +2386,8 @@ restart: *mpol_new = *n->policy;atomic_set (&mpol_new->refcnt,1 );sp_node_init (n_new, n->end, end, mpol_new); -sp_insert (sp, n_new); n->end = start; +sp_insert (sp, n_new); n_new =NULL ; mpol_new =NULL ;break ;
Greg Kroah-Hartman
maintainerPATCH 67/100 CIFS: Fix missing of oplock_read value in smb30_values structure
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Shilovsky <[email protected]>
commit 067785c40e52089993757afa28988c05f3cb2694 upstream.
--- fs/cifs/smb2ops.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/smb2ops.c +1 -0
@@ -744,4 +744,5 @@ struct smb_version_values smb30_values = .cap_unix = 0, .cap_nt_find = SMB2_NT_FIND, .cap_large_files = SMB2_LARGE_FILES, + .oplock_read = SMB2_OPLOCK_LEVEL_II, };
Greg Kroah-Hartman
maintainerPATCH 68/100 mac80211: Fix crash due to un-canceled work-items
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Greear <[email protected]>
commit 499218595a2e8296b7492af32fcca141b7b8184a upstream.
Some mlme work structs are not cancelled on disassociation nor interface deletion, which leads to them running after the memory has been freed
There is not a clean way to cancel these in the disassociation logic because they must be canceled outside of the ifmgd->mtx lock, so just cancel them in mgd_stop logic that tears down the station.
This fixes the crashes we see in 3.7.9+. The crash stack trace itself isn't so helpful, but this warning gives more useful info:
WARNING: at /home/greearb/git/linux-3.7.dev.y/lib/debugobjects.c:261 debug_print_object+0x7c/0x8d() ODEBUG: free active (active state 0) object type: work_struct hint: ieee80211_sta_monitor_work+0x0/0x14 [mac80211] Modules linked in: [...] Pid: 14743, comm: iw Tainted: G C O 3.7.9+ #11 Call Trace: [<ffffffff81087ef8>] warn_slowpath_common+0x80/0x98 [<ffffffff81087fa4>] warn_slowpath_fmt+0x41/0x43 [<ffffffff812a2608>] debug_print_object+0x7c/0x8d [<ffffffff812a2bca>] debug_check_no_obj_freed+0x95/0x1c3 [<ffffffff8114cc69>] slab_free_hook+0x70/0x79 [<ffffffff8114ea3e>] kfree+0x62/0xb7 [<ffffffff8149f465>] netdev_release+0x39/0x3e [<ffffffff8136ad67>] device_release+0x52/0x8a [<ffffffff812937db>] kobject_release+0x121/0x158 [<ffffffff81293612>] kobject_put+0x4c/0x50 [<ffffffff8148f0d7>] netdev_run_todo+0x25c/0x27e
--- net/mac80211/mlme.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/mac80211/mlme.c +11 -0
@@ -4072,6 +4072,17 @@ void ieee80211_mgd_stop(struct ieee80211 {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; +/* +* Make sure some work items will not run after this, +* they will not do anything but might not have been +* cancelled when disconnecting. +*/ +cancel_work_sync (&ifmgd->monitor_work); +cancel_work_sync (&ifmgd->beacon_connection_loss_work); +cancel_work_sync (&ifmgd->request_smps_work); +cancel_work_sync (&ifmgd->csa_connection_drop_work); +cancel_work_sync (&ifmgd->chswitch_work); +mutex_lock (&ifmgd->mtx);if (ifmgd->assoc_data)ieee80211_destroy_assoc_data (sdata, false);
Greg Kroah-Hartman
maintainerPATCH 69/100 e1000e: fix pci-device enable-counter balance
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 4e0855dff094b0d56d6b5b271e0ce7851cc1e063 upstream.
This patch removes redundant and unbalanced pci_disable_device() from __e1000_shutdown(). pci_clear_master() is enough, device can go into suspended state with elevated enable_cnt.
Bug was introduced in commit 23606cf5d1192c2b17912cb2ef6e62f9b11de133 ("e1000e / PCI / PM: Add basic runtime PM support (rev. 4)") in v2.6.35
--- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
@@ -5549,7 +5549,7 @@ static int __e1000_shutdown(struct pci_d*/ e1000e_release_hw_control (adapter); -pci_disable_device (pdev); +pci_clear_master (pdev);return 0 ; }
Re: [ 069/100] e1000e: fix pci-device enable-counter balance
Quoted 1 line · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
Vivek Goyal reported about problem caused by this improper fix.
https://lkml.org/lkml/2013/3/12/529
(this patch also pending to 3.0-stable and 3.4-stable)
Quoted 39 lines
------------------
From: Konstantin Khlebnikov<[email protected]>
commit
4e0855dff094b0d56d6b5b271e0ce7851cc1e063upstream.This patch removes redundant and unbalanced
pci_disable_device()from__e1000_shutdown().pci_clear_master()is enough, device can go into suspended state with elevatedenable_cnt.Bug was introduced in commit
23606cf5d1192c2b17912cb2ef6e62f9b11de133("e1000e / PCI / PM: Add basic runtime PM support (rev. 4)") in v2.6.35Signed-off-by Konstantin Khlebnikov<[email protected]>Cc Bruce Allan<[email protected]>Acked-by Rafael J. Wysocki<[email protected]>Tested-by Borislav Petkov<[email protected]>Tested-by Aaron Brown<[email protected]>Signed-off-by Jeff Kirsher<[email protected]>Signed-off-by Greg Kroah-Hartman<[email protected]>--- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/e1000e/netdev.c +1
-1@@ -5549,7 +5549,7 @@ static int __e1000_shutdown(struct pci_d*/ e1000e_release_hw_control (adapter); -pci_disable_device (pdev); +pci_clear_master (pdev);return 0 ; }
Re: [ 069/100] e1000e: fix pci-device enable-counter balance
Quoted 8 lines · Konstantin Khlebnikov
Quoted 1 line · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
Vivek Goyal reported about problem caused by this improper fix.
https://lkml.org/lkml/2013/3/12/529
(this patch also pending to 3.0-stable and 3.4-stable)
Sorry, I'm wrong. This patch is correct.
Problem in pci_device_shutdown(), that was in another patch.
Quoted 41 lines
Quoted 40 lines
------------------
From: Konstantin Khlebnikov<[email protected]>
commit
4e0855dff094b0d56d6b5b271e0ce7851cc1e063upstream.This patch removes redundant and unbalanced
pci_disable_device()from__e1000_shutdown().pci_clear_master()is enough, device can go into suspended state with elevatedenable_cnt.Bug was introduced in commit
23606cf5d1192c2b17912cb2ef6e62f9b11de133("e1000e / PCI / PM: Add basic runtime PM support (rev. 4)") in v2.6.35Signed-off-by Konstantin Khlebnikov<[email protected]>Cc Bruce Allan<[email protected]>Acked-by Rafael J. Wysocki<[email protected]>Tested-by Borislav Petkov<[email protected]>Tested-by Aaron Brown<[email protected]>Signed-off-by Jeff Kirsher<[email protected]>Signed-off-by Greg Kroah-Hartman<[email protected]>---
drivers/net/ethernet/intel/e1000e/netdev.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/e1000e/netdev.c +1
-1@@ -5549,7 +5549,7 @@ static int __e1000_shutdown(struct pci_d*/ e1000e_release_hw_control (adapter); -pci_disable_device (pdev); +pci_clear_master (pdev);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 70/100 tg3: Update link_up flag for phylib devices
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nithin Sujir <[email protected]>
commit 84421b99cedc3443e76d2a594f3c815d5cb9a8e1 upstream.
Commit f4a46d1f46a8fece34edd2023e054072b02e110d introduced a bug where the ifconfig stats would remain 0 for phylib devices. This is due to tp->link_up flag never becoming true causing tg3_periodic_fetch_stats() to return.
The link_up flag was being updated in tg3_test_and_report_link_chg() after setting up the phy. This function however, is not called for phylib devices since the driver does not do the phy setup.
This patch moves the link_up flag update into the common tg3_link_report() function that gets called for phylib devices as well for non phylib devices when the link state changes.
To avoid updating link_up twice, we replace tg3_carrier_...() calls that are followed by tg3_link_report(), with netif_carrier_...(). We can then remove the unused tg3_carrier_on() function.
--- drivers/net/ethernet/broadcom/tg3.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +5 -9
@@ -1843,6 +1843,8 @@ static void tg3_link_report(struct tg3 *tg3_ump_link_report (tp); } + + tp->link_up =netif_carrier_ok (tp->dev); }static u16 tg3_advert_flowctrl_1000X (u8 flow_ctrl)
@@ -2496,12 +2498,6 @@ static int tg3_phy_reset_5703_4_5(structreturn err; } -static void tg3_carrier_on (struct tg3 *tp) -{ -netif_carrier_on (tp->dev); - tp->link_up = true; -} -static void tg3_carrier_off (struct tg3 *tp) {netif_carrier_off (tp->dev);
@@ -2527,7 +2523,7 @@ static int tg3_phy_reset(struct tg3 *tp)return -EBUSY ;if (netif_running (tp->dev) && tp->link_up) { -tg3_carrier_off (tp); +netif_carrier_off (tp->dev);tg3_link_report (tp); }
@@ -4225,9 +4221,9 @@ static bool tg3_test_and_report_link_chg {if (curr_link_up != tp->link_up) {if (curr_link_up) { -tg3_carrier_on (tp); +netif_carrier_on (tp->dev); }else { -tg3_carrier_off (tp); +netif_carrier_off (tp->dev);if (tp->phy_flags &TG3_PHYFLG_MII_SERDES ) tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT ; }
Greg Kroah-Hartman
maintainerPATCH 71/100 efivars: efivarfs_valid_name() should handle pstore syntax
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit 123abd76edf56c02a76b46d3d673897177ef067b upstream.
Stricter validation was introduced with commit da27a24383b2b ("efivarfs: guid part of filenames are case-insensitive") and commit 47f531e8ba3b ("efivarfs: Validate filenames much more aggressively"), which is necessary for the guid portion of efivarfs filenames, but we don't need to be so strict with the first part, the variable name. The UEFI specification doesn't impose any constraints on variable names other than they be a NULL-terminated string.
The above commits caused a regression that resulted in users seeing the following message,
$ sudo mount -v /sys/firmware/efi/efivars mount: Cannot allocate memory
whenever pstore EFI variables were present in the variable store, since their variable names failed to pass the following check,
/* GUID should be right after the first '-' */
if (s - 1 != strchr(str, '-'))as a typical pstore filename is of the form, dump-type0-10-1-<guid>. The fix is trivial since the guid portion of the filename is GUID_LEN bytes, we can use (len - GUID_LEN) to ensure the '-' character is where we expect it to be.
(The bogus ENOMEM error value will be fixed in a separate patch.)
--- drivers/firmware/efivars.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efivars.c +2 -2
@@ -921,8 +921,8 @@ static bool efivarfs_valid_name(const chif (len <GUID_LEN +2 )return false; -/* GUID should be right after the first '-' */ -if (s -1 !=strchr (str,'-' )) +/* GUID must be preceded by a '-' */ +if (*(s -1 ) !='-' )return false;/*
Greg Kroah-Hartman
maintainerPATCH 72/100 efivarfs: return accurate error code in efivarfs_fill_super()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit feff5dc4f98330d8152b521acc2e18c16712e6c8 upstream.
Joseph was hitting a failure case when mounting efivarfs which resulted in an incorrect error message,
$ sudo mount -v /sys/firmware/efi/efivars mount: Cannot allocate memory
triggered when efivarfs_valid_name() returned -EINVAL.
Make sure we pass accurate return values up the stack if efivarfs_fill_super() fails to build inodes for EFI variables.
--- drivers/firmware/efivars.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/firmware/efivars.c +15 -5
@@ -1110,15 +1110,22 @@ static struct dentry_operations efivarfsstatic struct dentry *efivarfs_alloc_dentry (struct dentry *parent,char *name) { +struct dentry *d;struct qstr q; +int err; q.name = name; q.len =strlen (name); -if (efivarfs_d_hash (NULL ,NULL , &q)) -return NULL ; + err =efivarfs_d_hash (NULL ,NULL , &q); +if (err) +return ERR_PTR (err); + + d =d_alloc (parent, &q); +if (d) +return d; -return d_alloc (parent, &q); +return ERR_PTR (-ENOMEM ); }static int efivarfs_fill_super (struct super_block *sb,void *data,int silent)
@@ -1128,6 +1135,7 @@ static int efivarfs_fill_super(struct sustruct efivar_entry *entry, *n;struct efivars *efivars = &__efivars;char *name; +int err = -ENOMEM ; efivarfs_sb = sb;
@@ -1178,8 +1186,10 @@ static int efivarfs_fill_super(struct su goto fail_name; dentry =efivarfs_alloc_dentry (root, name); -if (!dentry) +if (IS_ERR (dentry)) { + err =PTR_ERR (dentry); goto fail_inode; + }/* copied by the above to local storage in the dentry. */ kfree (name);
@@ -1206,7 +1216,7 @@ fail_inode: fail_name:kfree (name); fail: -return -ENOMEM ; +return err; } static struct dentry *efivarfs_mount(struct file_system_type *fs_type,
Greg Kroah-Hartman
maintainerPATCH 73/100 userns: Stop oopsing in key_change_session_keyring
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit ba0e3427b03c3d1550239779eca5c1c5a53a2152 upstream.
Quoted 39 lines · Dave Jones
Just hit this on Linus' current tree.
[ 89.621770] BUG: unable to handle kernel NULL pointer dereference at 00000000000000c8 [ 89.623111] IP: [<ffffffff810784b0>] commit_creds+0x250/0x2f0 [ 89.624062] PGD 122bfd067 PUD 122bfe067 PMD 0 [ 89.624901] Oops: 0000 [#1] PREEMPT SMP [ 89.625678] Modules linked in: caif_socket caif netrom bridge hidp 8021q garp stp mrp rose llc2 af_rxrpc phonet af_key binfmt_misc bnep l2tp_ppp can_bcm l2tp_core pppoe pppox can_raw scsi_transport_iscsi ppp_generic slhc nfnetlink can ipt_ULOG ax25 decnet irda nfc rds x25 crc_ccitt appletalk atm ipx p8023 psnap p8022 llc lockd sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_conntrack nf_conntrack ip6table_filter ip6_tables btusb bluetooth snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_pcm vhost_net snd_page_alloc snd_timer tun macvtap usb_debug snd rfkill microcode macvlan edac_core pcspkr serio_raw kvm_amd soundcore kvm r8169 mii [ 89.637846] CPU 2 [ 89.638175] Pid: 782, comm: trinity-main Not tainted 3.8.0+ #63 Gigabyte Technology Co., Ltd. GA-MA78GM-S2H/GA-MA78GM-S2H [ 89.639850] RIP: 0010:[<ffffffff810784b0>] [<ffffffff810784b0>] commit_creds+0x250/0x2f0 [ 89.641161] RSP: 0018:ffff880115657eb8 EFLAGS: 00010207 [ 89.641984] RAX: 00000000000003e8 RBX: ffff88012688b000 RCX: 0000000000000000 [ 89.643069] RDX: 0000000000000000 RSI: ffffffff81c32960 RDI: ffff880105839600 [ 89.644167] RBP: ffff880115657ed8 R08: 0000000000000000 R09: 0000000000000000 [ 89.645254] R10: 0000000000000001 R11: 0000000000000246 R12: ffff880105839600 [ 89.646340] R13: ffff88011beea490 R14: ffff88011beea490 R15: 0000000000000000 [ 89.647431] FS: 00007f3ac063b740(0000) GS:ffff88012b200000(0000) knlGS:0000000000000000 [ 89.648660] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 89.649548] CR2: 00000000000000c8 CR3: 0000000122bfc000 CR4: 00000000000007e0 [ 89.650635] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 89.651723] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 89.652812] Process trinity-main (pid: 782, threadinfo ffff880115656000, task ffff88011beea490) [ 89.654128] Stack: [ 89.654433] 0000000000000000 ffff8801058396a0 ffff880105839600 ffff88011beeaa78 [ 89.655769] ffff880115657ef8 ffffffff812c7d9b ffffffff82079be0 0000000000000000 [ 89.657073] ffff880115657f28 ffffffff8106c665 0000000000000002 ffff880115657f58 [ 89.658399] Call Trace: [ 89.658822] [<ffffffff812c7d9b>] key_change_session_keyring+0xfb/0x140 [ 89.659845] [<ffffffff8106c665>] task_work_run+0xa5/0xd0 [ 89.660698] [<ffffffff81002911>] do_notify_resume+0x71/0xb0 [ 89.661581] [<ffffffff816c9a4a>] int_signal+0x12/0x17 [ 89.662385] Code: 24 90 00 00 00 48 8b b3 90 00 00 00 49 8b 4c 24 40 48 39 f2 75 08 e9 83 00 00 00 48 89 ca 48 81 fa 60 29 c3 81 0f 84 41 fe ff ff <48> 8b 8a c8 00 00 00 48 39 ce 75 e4 3b 82 d0 00 00 00 0f 84 4b [ 89.667778] RIP [<ffffffff810784b0>] commit_creds+0x250/0x2f0 [ 89.668733] RSP <ffff880115657eb8> [ 89.669301] CR2: 00000000000000c8My fastest trinity induced oops yet!
Quoted 6 lines
Appears to be..
if ((set_ns == subset_ns->parent) && 850: 48 8b 8a c8 00 00 00 mov 0xc8(%rdx),%rcxfrom the inlined
cred_cap_issubset
By historical accident we have been reading trying to set new->user_ns from new->user_ns. Which is totally silly as new->user_ns is NULL (as is every other field in new except session_keyring at that point).
The intent is clearly to copy all of the fields from old to new so copy old->user_ns into into new->user_ns.
--- security/keys/process_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/process_keys.c +1 -1
@@ -839,7 +839,7 @@ void key_change_session_keyring(struct c new-> sgid = old-> sgid; new->fsgid = old->fsgid; new->user =get_uid (old->user); - new->user_ns =get_user_ns (new->user_ns); + new->user_ns =get_user_ns (old->user_ns); new->group_info =get_group_info (old->group_info); new->securebits = old->securebits;
Greg Kroah-Hartman
maintainerPATCH 74/100 x86: pvclock kvm: align allocation size to page size
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Tosatti <[email protected]>
commit ed55705dd5008b408c48a8459b8b34b01f3de985 upstream.
To match whats mapped via vsyscalls to userspace.
--- arch/x86/kernel/kvmclock.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/x86/kernel/kvmclock.c +6 -5
@@ -218,6 +218,9 @@ static void kvm_shutdown(void)void __init kvmclock_init (void ) {unsigned long mem; +int size; + + size =PAGE_ALIGN (sizeof (struct pvclock_vsyscall_time_info )*NR_CPUS );if (!kvm_para_available ())return ;
@@ -231,16 +234,14 @@ void __init kvmclock_init(void)printk (KERN_INFO "kvm-clock: Using msrs %x and %x" , msr_kvm_system_time, msr_kvm_wall_clock); - mem =memblock_alloc (sizeof (struct pvclock_vsyscall_time_info )*NR_CPUS , -PAGE_SIZE ); + mem =memblock_alloc (size,PAGE_SIZE );if (!mem)return ; hv_clock =__va (mem);if (kvm_register_clock ("boot clock" )) { hv_clock =NULL ; -memblock_free (mem, -sizeof (struct pvclock_vsyscall_time_info )*NR_CPUS ); +memblock_free (mem, size);return ; } pv_time_ops.sched_clock = kvm_clock_read;
@@ -275,7 +276,7 @@ int __init kvm_setup_vsyscall_timeinfo(vstruct pvclock_vcpu_time_info *vcpu_time;unsigned int size; - size =sizeof (struct pvclock_vsyscall_time_info )*NR_CPUS ; + size =PAGE_ALIGN (sizeof (struct pvclock_vsyscall_time_info )*NR_CPUS );preempt_disable (); cpu =smp_processor_id ();
Greg Kroah-Hartman
maintainerPATCH 75/100 HID: logitech-dj: do not directly call hid_output_raw_report() during probe
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit dcd9006b1b053c7b1cebe81333261d4fd492ffeb upstream.
hid_output_raw_report() makes a direct call to usb_control_msg(). However, some USB3 boards have shown that the usb device is not ready during the .probe(). This blocks the entire usb device, and the paired mice, keyboards are not functional. The dmesg output is the following:
[ 11.912287] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:14.0-2/input2 [ 11.912537] logitech-djreceiver 0003:046D:C52B.0003: logi_dj_probe:logi_dj_recv_query_paired_devices error:-32 [ 11.912636] logitech-djreceiver: probe of 0003:046D:C52B.0003 failed with error -32
Relying on the scheduled call to usbhid_submit_report() fixes the problem.
related bugs:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1072082
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1039143
https://bugzilla.redhat.com/show_bug.cgi?id=840391
https://bugzilla.kernel.org/show_bug.cgi?id=49781
--- drivers/hid/hid-logitech-dj.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/hid/hid-logitech-dj.c +14 -8
@@ -459,19 +459,25 @@ static int logi_dj_recv_send_report(stru struct dj_report *dj_report) {struct hid_device *hdev = djrcv_dev->hdev; -int sent_bytes; +struct hid_report *report; +struct hid_report_enum *output_report_enum; +u8 *data = (u8 *)(&dj_report->device_index); +int i; -if (!hdev->hid_output_raw_report) { -dev_err (&hdev->dev,"%s:" -"hid_output_raw_report is null\n" , __func__); + output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT ]; + report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT ]; + +if (!report) { +dev_err (&hdev->dev,"%s: unable to find dj report\n" , __func__);return -ENODEV ; } - sent_bytes = hdev->hid_output_raw_report (hdev, (u8 *) dj_report, -sizeof (struct dj_report ), -HID_OUTPUT_REPORT ); +for (i =0 ; i < report->field[0 ]->report_count; i++) + report->field[0 ]->value[i] = data[i]; + +usbhid_submit_report (hdev, report,USB_DIR_OUT ); -return (sent_bytes <0 ) ? sent_bytes :0 ; +return 0 ; }static int logi_dj_recv_query_paired_devices (struct dj_receiver_dev *djrcv_dev)
Greg Kroah-Hartman
maintainerPATCH 76/100 Btrfs: account for orphan inodes properly during cleanup
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 925396ecf251432d6d0f703a6cfd0cb9e651d936 upstream.
Dave sent me a panic where we were doing the orphan cleanup and panic'ed trying to release our reservation from the orphan block rsv. The reason for this is because our orphan block rsv had been free'd out from underneath us because the transaction commit found that there were no orphan inodes according to its count and decided to free it. This is incorrect so make sure we inc the orphan inodes count so the accounting is all done properly. This would also cause the warning in the orphan commit code normally if you had any orphans to cleanup as they would only decrement the orphan count so you'd get a negative orphan count which could cause problems during runtime. Thanks,
--- fs/btrfs/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/inode.c +1 -0
@@ -2470,6 +2470,7 @@ int btrfs_orphan_cleanup(struct btrfs_ro*/ set_bit (BTRFS_INODE_HAS_ORPHAN_ITEM , &BTRFS_I (inode)->runtime_flags); +atomic_inc (&root->orphan_inodes);/* if we have links, this was a truncate, lets do that */ if (inode->i_nlink) {
Greg Kroah-Hartman
maintainerPATCH 77/100 Btrfs: cleanup orphan reservation if truncate fails
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 4a7d0f6854c4a4ad1dba00a3b128a32d39b9a742 upstream.
I noticed we were getting lots of warnings with xfstest 83 because we have reservations outstanding. This is because we moved the orphan add outside of the truncate, but we don't actually cleanup our reservation if something fails. This fixes the problem and I no longer see warnings. Thanks,
--- fs/btrfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/inode.c +2 -0
@@ -2493,6 +2493,8 @@ int btrfs_orphan_cleanup(struct btrfs_ro goto out; ret =btrfs_truncate (inode); +if (ret) +btrfs_orphan_del (NULL , inode); }else { nr_unlink++; }
Greg Kroah-Hartman
maintainerPATCH 78/100 x86/kvm: Fix pvclock vsyscall fixmap
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hurley <[email protected]>
commit 3d2a80a230250c2534ce5b17503670adaf1d7fff upstream.
The physical memory fixmapped for the pvclock clock_gettime vsyscall was allocated, and thus is not a kernel symbol. __pa() is the proper method to use in this case.
Fixes the crash below when booting a next-20130204+ smp guest on a 3.8-rc5+ KVM host.
[ 0.666410] udevd[97]: starting version 175
[ 0.674043] udevd[97]: udevd:[97]: segfault at ffffffffff5fd020
ip 00007fff069e277f sp 00007fff068c9ef8 error d--- arch/x86/kernel/pvclock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/pvclock.c +1 -1
@@ -185,7 +185,7 @@ int __init pvclock_init_vsyscall(structfor (idx =0 ; idx <= (PVCLOCK_FIXMAP_END -PVCLOCK_FIXMAP_BEGIN ); idx++) {__set_fixmap (PVCLOCK_FIXMAP_BEGIN + idx, -__pa_symbol (i) + (idx*PAGE_SIZE ), +__pa (i) + (idx*PAGE_SIZE ),PAGE_KERNEL_VVAR ); }
Greg Kroah-Hartman
maintainerPATCH 79/100 mfd: rtsx: Optimize card detect flow
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei WANG <[email protected]>
commit 504decc0a063e6a09a1e5b203ca68bc21dfffde9 upstream.
1. Schedule card detect work at the end of the ISR
2. Callback function ops->cd_deglitch may delay for a period of time. It is not proper to call this callback when local irq disabled.
3. Card detect flow can't be executed in parallel with other card reader operations, so it's better to be protected by mutex.
--- drivers/mfd/rtsx_pcr.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/mfd/rtsx_pcr.c +19 -12
@@ -758,7 +758,7 @@ static void rtsx_pci_card_detect(structstruct delayed_work *dwork;struct rtsx_pcr *pcr;unsigned long flags; -unsigned int card_detect =0 ; +unsigned int card_detect =0 , card_inserted, card_removed;u32 irq_status; dwork =to_delayed_work (work);
@@ -766,25 +766,32 @@ static void rtsx_pci_card_detect(structdev_dbg (&(pcr->pci->dev),"--> %s\n" , __func__); +mutex_lock (&pcr->pcr_mutex);spin_lock_irqsave (&pcr->lock, flags); irq_status =rtsx_pci_readl (pcr,RTSX_BIPR );dev_dbg (&(pcr->pci->dev),"irq_status: 0x%08x\n" , irq_status); -if (pcr->card_inserted || pcr->card_removed) { + irq_status &=CARD_EXIST ; + card_inserted = pcr->card_inserted & irq_status; + card_removed = pcr->card_removed; + pcr->card_inserted =0 ; + pcr->card_removed =0 ; + +spin_unlock_irqrestore (&pcr->lock, flags); + +if (card_inserted || card_removed) {dev_dbg (&(pcr->pci->dev),"card_inserted: 0x%x, card_removed: 0x%x\n" , - pcr->card_inserted, pcr->card_removed); + card_inserted, card_removed);if (pcr->ops->cd_deglitch) - pcr->card_inserted = pcr->ops->cd_deglitch (pcr); + card_inserted = pcr->ops->cd_deglitch (pcr); - card_detect = pcr->card_inserted | pcr->card_removed; - pcr->card_inserted =0 ; - pcr->card_removed =0 ; + card_detect = card_inserted | card_removed; } -spin_unlock_irqrestore (&pcr->lock, flags); +mutex_unlock (&pcr->pcr_mutex);if ((card_detect &SD_EXIST ) && pcr->slots[RTSX_SD_CARD ].card_event) pcr->slots[RTSX_SD_CARD].card_event(
@@ -836,10 +843,6 @@ static irqreturn_t rtsx_pci_isr(int irq, } } -if (pcr->card_inserted || pcr->card_removed) -schedule_delayed_work (&pcr->carddet_work, -msecs_to_jiffies (200 )); -if (int_reg & (NEED_COMPLETE_INT |DELINK_INT )) {if (int_reg & (TRANS_FAIL_INT |DELINK_INT )) { pcr->trans_result =TRANS_RESULT_FAIL ;
@@ -852,6 +855,10 @@ static irqreturn_t rtsx_pci_isr(int irq, } } +if (pcr->card_inserted || pcr->card_removed) +schedule_delayed_work (&pcr->carddet_work, +msecs_to_jiffies (200 )); +spin_unlock (&pcr->lock);return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 80/100 mfd: rtsx: Fix issue that booting OS with SD card inserted
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei WANG <[email protected]>
commit c3481955f6c78c8dd99921759306d7469c999ec2 upstream.
Realtek card reader supports both SD and MS card. According to the settings of rtsx MFD driver, SD host will be probed before MS host. If we boot/reboot Linux with SD card inserted, the resetting flow of SD card will succeed, and the following resetting flow of MS is sure to fail. Then MS upper-level driver will ask rtsx driver to turn power off. This request leads to the result that the following SD commands fail and SD card can't be accessed again.
In this commit, Realtek's SD and MS host driver will check whether the card that upper driver requesting is the one existing in the slot. If not, Realtek's host driver will refuse the operation to make sure the exlusive accessing at the same time.
--- drivers/memstick/host/rtsx_pci_ms.c | 7 +++++++ drivers/mfd/rtsx_pcr.c | 30 ++++++++++++++++++++++++++++++ drivers/mmc/host/rtsx_pci_sdmmc.c | 18 ++++++++++++++++++ include/linux/mfd/rtsx_pci.h | 2 ++ 4 files changed, 57 insertions(+)
drivers/memstick/host/rtsx_pci_ms.c +7 -0
@@ -426,6 +426,9 @@ static void rtsx_pci_ms_request(struct mdev_dbg (ms_dev (host),"--> %s\n" , __func__); +if (rtsx_pci_card_exclusive_check (host->pcr,RTSX_MS_CARD )) +return ; +schedule_work (&host->handle_req); }
@@ -441,6 +444,10 @@ static int rtsx_pci_ms_set_param(structdev_dbg (ms_dev (host),"%s: param = %d, value = %d\n" , __func__, param, value); + err =rtsx_pci_card_exclusive_check (host->pcr,RTSX_MS_CARD ); +if (err) +return err; +switch (param) {case MEMSTICK_POWER :if (value ==MEMSTICK_POWER_ON )
drivers/mfd/rtsx_pcr.c +30 -0
@@ -713,6 +713,25 @@ int rtsx_pci_card_power_off(struct rtsx_ }EXPORT_SYMBOL_GPL (rtsx_pci_card_power_off); +int rtsx_pci_card_exclusive_check (struct rtsx_pcr *pcr,int card) +{ +unsigned int cd_mask[] = { + [RTSX_SD_CARD ] =SD_EXIST , + [RTSX_MS_CARD ] =MS_EXIST + }; + +if (!pcr->ms_pmos) { +/* When using single PMOS, accessing card is not permitted +* if the existing card is not the designated one. +*/ +if (pcr->card_exist & (~cd_mask[card])) +return -EIO ; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (rtsx_pci_card_exclusive_check); +int rtsx_pci_switch_output_voltage (struct rtsx_pcr *pcr,u8 voltage) {if (pcr->ops->switch_output_voltage)
@@ -789,6 +808,9 @@ static void rtsx_pci_card_detect(struct card_inserted = pcr->ops->cd_deglitch (pcr); card_detect = card_inserted | card_removed; + + pcr->card_exist |= card_inserted; + pcr->card_exist &= ~card_removed; }mutex_unlock (&pcr->pcr_mutex);
@@ -981,6 +1003,14 @@ static int rtsx_pci_init_hw(struct rtsx_return err; } +/* No CD interrupt if probing driver with card inserted. +* So we need to initialize pcr->card_exist here. +*/ +if (pcr->ops->cd_deglitch) + pcr->card_exist = pcr->ops->cd_deglitch (pcr); +else + pcr->card_exist =rtsx_pci_readl (pcr,RTSX_BIPR ) &CARD_EXIST ; +return 0 ; }
drivers/mmc/host/rtsx_pci_sdmmc.c +18 -0
@@ -678,12 +678,19 @@ static void sdmmc_request(struct mmc_hosstruct mmc_command *cmd = mrq->cmd;struct mmc_data *data = mrq->data;unsigned int data_size =0 ; +int err;if (host->eject) { cmd->error = -ENOMEDIUM ; goto finish; } + err =rtsx_pci_card_exclusive_check (host->pcr,RTSX_SD_CARD ); +if (err) { + cmd->error = err; + goto finish; + } +mutex_lock (&pcr->pcr_mutex);rtsx_pci_start_run (pcr);
@@ -901,6 +908,9 @@ static void sdmmc_set_ios(struct mmc_hosif (host->eject)return ; +if (rtsx_pci_card_exclusive_check (host->pcr,RTSX_SD_CARD )) +return ; +mutex_lock (&pcr->pcr_mutex);rtsx_pci_start_run (pcr);
@@ -1073,6 +1083,10 @@ static int sdmmc_switch_voltage(struct mif (host->eject)return -ENOMEDIUM ; + err =rtsx_pci_card_exclusive_check (host->pcr,RTSX_SD_CARD ); +if (err) +return err; +mutex_lock (&pcr->pcr_mutex);rtsx_pci_start_run (pcr);
@@ -1122,6 +1136,10 @@ static int sdmmc_execute_tuning(struct mif (host->eject)return -ENOMEDIUM ; + err =rtsx_pci_card_exclusive_check (host->pcr,RTSX_SD_CARD ); +if (err) +return err; +mutex_lock (&pcr->pcr_mutex);rtsx_pci_start_run (pcr);
include/linux/mfd/rtsx_pci.h +2 -0
@@ -735,6 +735,7 @@ struct rtsx_pcr {unsigned int card_inserted;unsigned int card_removed; +unsigned int card_exist;struct delayed_work carddet_work;struct delayed_work idle_work;
@@ -799,6 +800,7 @@ int rtsx_pci_switch_clock(struct rtsx_pc u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);int rtsx_pci_card_power_on (struct rtsx_pcr *pcr,int card);int rtsx_pci_card_power_off (struct rtsx_pcr *pcr,int card); +int rtsx_pci_card_exclusive_check (struct rtsx_pcr *pcr,int card);int rtsx_pci_switch_output_voltage (struct rtsx_pcr *pcr,u8 voltage);unsigned int rtsx_pci_card_exist (struct rtsx_pcr *pcr);void rtsx_pci_complete_unfinished_transfer (struct rtsx_pcr *pcr);
Greg Kroah-Hartman
maintainerPATCH 81/100 crypto: user - fix info leaks in report API
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
commit 9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6 upstream.
Three errors resulting in kernel memory disclosure:
1/ The structures used for the netlink based crypto algorithm report API are located on the stack. As snprintf() does not fill the remainder of the buffer with null bytes, those stack bytes will be disclosed to users of the API. Switch to strncpy() to fix this.
2/ crypto_report_one() does not initialize all field of struct crypto_user_alg. Fix this to fix the heap info leak.
3/ For the module name we should copy only as many bytes as module_name() returns -- not as much as the destination buffer could hold. But the current code does not and therefore copies random data from behind the end of the module name, as the module name is always shorter than CRYPTO_MAX_ALG_NAME.
Also switch to use strncpy() to copy the algorithm's name and driver_name. They are strings, after all.
--- crypto/ablkcipher.c | 12 ++++++------ crypto/aead.c | 9 ++++----- crypto/ahash.c | 2 +- crypto/blkcipher.c | 6 +++--- crypto/crypto_user.c | 20 ++++++++++---------- crypto/pcompress.c | 3 +-- crypto/rng.c | 2 +- crypto/shash.c | 3 ++- 8 files changed, 28 insertions(+), 29 deletions(-)
crypto/ablkcipher.c +6 -6
@@ -388,9 +388,9 @@ static int crypto_ablkcipher_report(stru {struct crypto_report_blkcipher rblkcipher; -snprintf (rblkcipher.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"ablkcipher" ); -snprintf (rblkcipher.geniv,CRYPTO_MAX_ALG_NAME ,"%s" , - alg->cra_ablkcipher.geniv ?:"<default>" ); +strncpy (rblkcipher.type,"ablkcipher" ,sizeof (rblkcipher.type)); +strncpy (rblkcipher.geniv, alg->cra_ablkcipher.geniv ?:"<default>" , +sizeof (rblkcipher.geniv)); rblkcipher.blocksize = alg->cra_blocksize; rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
@@ -469,9 +469,9 @@ static int crypto_givcipher_report(struc {struct crypto_report_blkcipher rblkcipher; -snprintf (rblkcipher.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"givcipher" ); -snprintf (rblkcipher.geniv,CRYPTO_MAX_ALG_NAME ,"%s" , - alg->cra_ablkcipher.geniv ?:"<built-in>" ); +strncpy (rblkcipher.type,"givcipher" ,sizeof (rblkcipher.type)); +strncpy (rblkcipher.geniv, alg->cra_ablkcipher.geniv ?:"<built-in>" , +sizeof (rblkcipher.geniv)); rblkcipher.blocksize = alg->cra_blocksize; rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
crypto/aead.c +4 -5
@@ -117,9 +117,8 @@ static int crypto_aead_report(struct sk_struct crypto_report_aead raead;struct aead_alg *aead = &alg->cra_aead; -snprintf (raead.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"aead" ); -snprintf (raead.geniv,CRYPTO_MAX_ALG_NAME ,"%s" , - aead->geniv ?:"<built-in>" ); +strncpy (raead.type,"aead" ,sizeof (raead.type)); +strncpy (raead.geniv, aead->geniv ?:"<built-in>" ,sizeof (raead.geniv)); raead.blocksize = alg->cra_blocksize; raead.maxauthsize = aead->maxauthsize;
@@ -203,8 +202,8 @@ static int crypto_nivaead_report(structstruct crypto_report_aead raead;struct aead_alg *aead = &alg->cra_aead; -snprintf (raead.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"nivaead" ); -snprintf (raead.geniv,CRYPTO_MAX_ALG_NAME ,"%s" , aead->geniv); +strncpy (raead.type,"nivaead" ,sizeof (raead.type)); +strncpy (raead.geniv, aead->geniv,sizeof (raead.geniv)); raead.blocksize = alg->cra_blocksize; raead.maxauthsize = aead->maxauthsize;
crypto/ahash.c +1 -1
@@ -404,7 +404,7 @@ static int crypto_ahash_report(struct sk {struct crypto_report_hash rhash; -snprintf (rhash.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"ahash" ); +strncpy (rhash.type,"ahash" ,sizeof (rhash.type)); rhash.blocksize = alg->cra_blocksize; rhash.digestsize =__crypto_hash_alg_common (alg)->digestsize;
crypto/blkcipher.c +3 -3
@@ -499,9 +499,9 @@ static int crypto_blkcipher_report(struc {struct crypto_report_blkcipher rblkcipher; -snprintf (rblkcipher.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"blkcipher" ); -snprintf (rblkcipher.geniv,CRYPTO_MAX_ALG_NAME ,"%s" , - alg->cra_blkcipher.geniv ?:"<default>" ); +strncpy (rblkcipher.type,"blkcipher" ,sizeof (rblkcipher.type)); +strncpy (rblkcipher.geniv, alg->cra_blkcipher.geniv ?:"<default>" , +sizeof (rblkcipher.geniv)); rblkcipher.blocksize = alg->cra_blocksize; rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
crypto/crypto_user.c +10 -10
@@ -75,7 +75,7 @@ static int crypto_report_cipher(struct s {struct crypto_report_cipher rcipher; -snprintf (rcipher.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"cipher" ); +strncpy (rcipher.type,"cipher" ,sizeof (rcipher.type)); rcipher.blocksize = alg->cra_blocksize; rcipher.min_keysize = alg->cra_cipher.cia_min_keysize;
@@ -94,8 +94,7 @@ static int crypto_report_comp(struct sk_ {struct crypto_report_comp rcomp; -snprintf (rcomp.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"compression" ); - +strncpy (rcomp.type,"compression" ,sizeof (rcomp.type));if (nla_put (skb,CRYPTOCFGA_REPORT_COMPRESS ,sizeof (struct crypto_report_comp ), &rcomp)) goto nla_put_failure;
@@ -108,12 +107,14 @@ nla_put_failure:static int crypto_report_one (struct crypto_alg *alg,struct crypto_user_alg *ualg,struct sk_buff *skb) { -memcpy (&ualg->cru_name, &alg->cra_name,sizeof (ualg->cru_name)); -memcpy (&ualg->cru_driver_name, &alg->cra_driver_name, -sizeof (ualg->cru_driver_name)); -memcpy (&ualg->cru_module_name,module_name (alg->cra_module), -CRYPTO_MAX_ALG_NAME ); +strncpy (ualg->cru_name, alg->cra_name,sizeof (ualg->cru_name)); +strncpy (ualg->cru_driver_name, alg->cra_driver_name, +sizeof (ualg->cru_driver_name)); +strncpy (ualg->cru_module_name,module_name (alg->cra_module), +sizeof (ualg->cru_module_name)); + ualg->cru_type =0 ; + ualg->cru_mask =0 ; ualg->cru_flags = alg->cra_flags; ualg->cru_refcnt =atomic_read (&alg->cra_refcnt);
@@ -122,8 +123,7 @@ static int crypto_report_one(struct crypif (alg->cra_flags &CRYPTO_ALG_LARVAL ) {struct crypto_report_larval rl; -snprintf (rl.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"larval" ); - +strncpy (rl.type,"larval" ,sizeof (rl.type));if (nla_put (skb,CRYPTOCFGA_REPORT_LARVAL ,sizeof (struct crypto_report_larval ), &rl)) goto nla_put_failure;
crypto/pcompress.c +1 -2
@@ -53,8 +53,7 @@ static int crypto_pcomp_report(struct sk {struct crypto_report_comp rpcomp; -snprintf (rpcomp.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"pcomp" ); - +strncpy (rpcomp.type,"pcomp" ,sizeof (rpcomp.type));if (nla_put (skb,CRYPTOCFGA_REPORT_COMPRESS ,sizeof (struct crypto_report_comp ), &rpcomp)) goto nla_put_failure;
crypto/rng.c +1 -1
@@ -65,7 +65,7 @@ static int crypto_rng_report(struct sk_b {struct crypto_report_rng rrng; -snprintf (rrng.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"rng" ); +strncpy (rrng.type,"rng" ,sizeof (rrng.type)); rrng.seedsize = alg->cra_rng.seedsize;
crypto/shash.c +2 -1
@@ -530,7 +530,8 @@ static int crypto_shash_report(struct skstruct crypto_report_hash rhash;struct shash_alg *salg =__crypto_shash_alg (alg); -snprintf (rhash.type,CRYPTO_MAX_ALG_NAME ,"%s" ,"shash" ); +strncpy (rhash.type,"shash" ,sizeof (rhash.type)); + rhash.blocksize = alg->cra_blocksize; rhash.digestsize = salg->digestsize;
Greg Kroah-Hartman
maintainerPATCH 82/100 acer-wmi: avoid the warning of devices may be used uninitialized
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Lee, Chun-Yi" <[email protected]>
commit f24c96eae58aeea4c36fb064cf3ee9734933f8fc upstream.
Fengguang Wu run kernel build test to platform-drivers-x86/linux-next git tree on x86_64 architecture and found a warning that was introduced by 727651bf738b6b917335025d09323d0962eda114 commit:
drivers/platform/x86/acer-wmi.c: In function âWMID_set_capabilitiesâ:drivers/platform/x86/acer-wmi.c:1211: warning: âdevicesâ may be used uninitialized in this function
This patch fixes the above warning message.
--- drivers/platform/x86/acer-wmi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/acer-wmi.c +3 -0
@@ -1204,6 +1204,9 @@ static acpi_status WMID_set_capabilities devices = *((u32 *) obj->buffer.pointer); }else if (obj->type ==ACPI_TYPE_INTEGER ) { devices = (u32 ) obj->integer.value; + }else { +kfree (out.pointer); +return AE_ERROR ; } }else {kfree (out.pointer);
Greg Kroah-Hartman
maintainerPATCH 83/100 usbnet: smsc95xx: fix suspend failure
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit 7643721471117d5f62ca36f328d3dc8d84af4402 upstream.
The three below functions:
smsc95xx_enter_suspend0() smsc95xx_enter_suspend1() smsc95xx_enter_suspend2()
return > 0 in case of success, so they will cause smsc95xx_suspend() to return > 0 and cause suspend failure.
The bug is introduced in commit 3b9f7d(smsc95xx: fix error handling in suspend failure case).
--- drivers/net/usb/smsc95xx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/usb/smsc95xx.c +6 -0
@@ -1340,6 +1340,8 @@ static int smsc95xx_enter_suspend0(struc ret =smsc95xx_read_reg_nopm (dev,PM_CTRL , &val);if (ret <0 )netdev_warn (dev->net,"Error reading PM_CTRL\n" ); +else + ret =0 ;return ret; }
@@ -1392,6 +1394,8 @@ static int smsc95xx_enter_suspend1(struc ret =smsc95xx_write_reg_nopm (dev,PM_CTRL , val);if (ret <0 )netdev_warn (dev->net,"Error writing PM_CTRL\n" ); +else + ret =0 ;return ret; }
@@ -1413,6 +1417,8 @@ static int smsc95xx_enter_suspend2(struc ret =smsc95xx_write_reg_nopm (dev,PM_CTRL , val);if (ret <0 )netdev_warn (dev->net,"Error writing PM_CTRL\n" ); +else + ret =0 ;return ret; }
Greg Kroah-Hartman
maintainerPATCH 84/100 keys: fix race with concurrent install_user_keyrings()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit 0da9dfdd2cd9889201bc6f6f43580c99165cd087 upstream.
This fixes CVE-2013-1792.
There is a race in install_user_keyrings() that can cause a NULL pointer dereference when called concurrently for the same user if the uid and uid-session keyrings are not yet created. It might be possible for an unprivileged user to trigger this by calling keyctl() from userspace in parallel immediately after logging in.
Assume that we have two threads both executing lookup_user_key(), both looking for KEY_SPEC_USER_SESSION_KEYRING.
THREAD A THREAD B =============================== =============================== ==>call install_user_keyrings(); if (!cred->user->session_keyring) ==>call install_user_keyrings() ... user->uid_keyring = uid_keyring; if (user->uid_keyring) return 0; <== key = cred->user->session_keyring [== NULL] user->session_keyring = session_keyring; atomic_inc(&key->usage); [oops]
At the point thread A dereferences cred->user->session_keyring, thread B hasn't updated user->session_keyring yet, but thread A assumes it is populated because install_user_keyrings() returned ok.
The race window is really small but can be exploited if, for example, thread B is interrupted or preempted after initializing uid_keyring, but before doing setting session_keyring.
This couldn't be reproduced on a stock kernel. However, after placing systemtap probe on 'user->session_keyring = session_keyring;' that introduced some delay, the kernel could be crashed reliably.
Fix this by checking both pointers before deciding whether to return. Alternatively, the test could be done away with entirely as it is checked inside the mutex - but since the mutex is global, that may not be the best way.
--- security/keys/process_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/process_keys.c +1 -1
@@ -57,7 +57,7 @@ int install_user_keyrings(void)kenter ("%p{%u}" , user, uid); -if (user->uid_keyring) { +if (user->uid_keyring && user->session_keyring) {kleave (" = 0 [exist]" );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 85/100 Fix: compat_rw_copy_check_uvector() misuse in aio, readv, writev, and security keys
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Desnoyers <[email protected]>
commit 8aec0f5d4137532de14e6554fd5dd201ff3a3c49 upstream.
Looking at mm/process_vm_access.c:process_vm_rw() and comparing it to compat_process_vm_rw() shows that the compatibility code requires an explicit "access_ok()" check before calling compat_rw_copy_check_uvector(). The same difference seems to appear when we compare fs/read_write.c:do_readv_writev() to fs/compat.c:compat_do_readv_writev().
This subtle difference between the compat and non-compat requirements should probably be debated, as it seems to be error-prone. In fact, there are two others sites that use this function in the Linux kernel, and they both seem to get it wrong:
Now shifting our attention to fs/aio.c, we see that aio_setup_iocb() also ends up calling compat_rw_copy_check_uvector() through aio_setup_vectored_rw(). Unfortunately, the access_ok() check appears to be missing. Same situation for security/keys/compat.c:compat_keyctl_instantiate_key_iov().
I propose that we add the access_ok() check directly into compat_rw_copy_check_uvector(), so callers don't have to worry about it, and it therefore makes the compat call code similar to its non-compat counterpart. Place the access_ok() check in the same location where copy_from_user() can trigger a -EFAULT error in the non-compat code, so the ABI behaviors are alike on both compat and non-compat.
While we are here, fix compat_do_readv_writev() so it checks for compat_rw_copy_check_uvector() negative return values.
And also, fix a memory leak in compat_keyctl_instantiate_key_iov() error handling.
--- fs/compat.c | 15 +++++++-------- mm/process_vm_access.c | 8 -------- security/keys/compat.c | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-)
fs/compat.c +7 -8
@@ -558,6 +558,10 @@ ssize_t compat_rw_copy_check_uvector(int } *ret_pointer = iov; + ret = -EFAULT ; +if (!access_ok (VERIFY_READ , uvector, nr_segs*sizeof (*uvector))) + goto out; +/* * Single unix specification: * We should -EINVAL if an element length is not >= 0 and fitting an
@@ -1080,17 +1084,12 @@ static ssize_t compat_do_readv_writev(inif (!file->f_op) goto out; - ret = -EFAULT ; -if (!access_ok (VERIFY_READ , uvector, nr_segs*sizeof (*uvector))) - goto out; - - tot_len =compat_rw_copy_check_uvector (type, uvector, nr_segs, + ret =compat_rw_copy_check_uvector (type, uvector, nr_segs,UIO_FASTIOV , iovstack, &iov); -if (tot_len ==0 ) { - ret =0 ; +if (ret <=0 ) goto out; - } + tot_len = ret; ret =rw_verify_area (type, file, pos, tot_len);if (ret <0 ) goto out;
mm/process_vm_access.c +0 -8
@@ -429,12 +429,6 @@ compat_process_vm_rw(compat_pid_t pid,if (flags !=0 )return -EINVAL ; -if (!access_ok (VERIFY_READ , lvec, liovcnt *sizeof (*lvec))) - goto out; - -if (!access_ok (VERIFY_READ , rvec, riovcnt *sizeof (*rvec))) - goto out; -if (vm_write) rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt, UIO_FASTIOV, iovstack_l,
@@ -459,8 +453,6 @@ free_iovecs:kfree (iov_r);if (iov_l != iovstack_l)kfree (iov_l); - -out:return rc; }
security/keys/compat.c +2 -2
@@ -40,12 +40,12 @@ static long compat_keyctl_instantiate_keARRAY_SIZE (iovstack), iovstack, &iov);if (ret <0 ) -return ret; + goto err;if (ret ==0 ) goto no_payload_free; ret =keyctl_instantiate_key_common (id, iov, ioc, ret, ringid); - +err:if (iov != iovstack)kfree (iov);return ret;
Greg Kroah-Hartman
maintainerPATCH 86/100 vfs: fix pipe counter breakage
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit a930d8790552658140d7d0d2e316af4f0d76a512 upstream.
If you open a pipe for neither read nor write, the pipe code will not add any usage counters to the pipe, causing the 'struct pipe_inode_info" to be potentially released early.
That doesn't normally matter, since you cannot actually use the pipe, but the pipe release code - particularly fasync handling - still expects the actual pipe infrastructure to all be there. And rather than adding NULL pointer checks, let's just disallow this case, the same way we already do for the named pipe ("fifo") case.
This is ancient going back to pre-2.4 days, and until trinity, nobody naver noticed.
--- fs/pipe.c | 3 +++ 1 file changed, 3 insertions(+)
fs/pipe.c +3 -0
@@ -863,6 +863,9 @@ pipe_rdwr_open(struct inode *inode, stru {int ret = -ENOENT ; +if (!(filp->f_mode & (FMODE_READ |FMODE_WRITE ))) +return -EINVAL ; +mutex_lock (&inode->i_mutex);if (inode->i_pipe) {
Greg Kroah-Hartman
maintainerPATCH 87/100 rtc: rtc-mv: Add support for clk to avoid lockups
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Lunn <[email protected]>
commit 89c58c198b252f2bc20657fdd72a2aea788c435c upstream.
The Marvell RTC on Kirkwood makes use of the runit clock. Ensure the driver clk_prepare_enable() this clock, otherwise there is a danger the SoC will lockup when accessing RTC registers with the clock disabled.
--- arch/arm/boot/dts/kirkwood.dtsi | 1 + drivers/rtc/rtc-mv.c | 28 ++++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-)
arch/arm/boot/dts/kirkwood.dtsi +1 -0
@@ -75,6 +75,7 @@ compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc"; reg = <0x10300 0x20>; interrupts = <53>; + clocks = <&gate_clk 7>; }; spi@10600 {
drivers/rtc/rtc-mv.c +24 -4
@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/of.h> #include <linux/delay.h> +#include <linux/clk.h> #include <linux/gfp.h> #include <linux/module.h>
@@ -41,6 +42,7 @@ struct rtc_plat_data {struct rtc_device *rtc;void __iomem *ioaddr;int irq; +struct clk *clk; };static int mv_rtc_set_time (struct device *dev,struct rtc_time *tm)
@@ -221,6 +223,7 @@ static int mv_rtc_probe(struct platform_struct rtc_plat_data *pdata;resource_size_t size;u32 rtc_time; +int ret =0 ; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res)
@@ -239,11 +242,17 @@ static int mv_rtc_probe(struct platform_if (!pdata->ioaddr)return -ENOMEM ; + pdata->clk =devm_clk_get (&pdev->dev,NULL ); +/* Not all SoCs require a clock.*/ +if (!IS_ERR (pdata->clk)) +clk_prepare_enable (pdata->clk); +/* make sure the 24 hours mode is enabled */ rtc_time =readl (pdata->ioaddr +RTC_TIME_REG_OFFS );if (rtc_time &RTC_HOURS_12H_MODE ) {dev_err (&pdev->dev,"24 Hours mode not supported.\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out; }/* make sure it is actually functional */
@@ -252,7 +261,8 @@ static int mv_rtc_probe(struct platform_ rtc_time =readl (pdata->ioaddr +RTC_TIME_REG_OFFS );if (rtc_time ==0x01000000 ) {dev_err (&pdev->dev,"internal RTC not ticking\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto out; } }
@@ -268,8 +278,10 @@ static int mv_rtc_probe(struct platform_ }else pdata->rtc =rtc_device_register (pdev->name, &pdev->dev, &mv_rtc_ops,THIS_MODULE ); -if (IS_ERR (pdata->rtc)) -return PTR_ERR (pdata->rtc); +if (IS_ERR (pdata->rtc)) { + ret =PTR_ERR (pdata->rtc); + goto out; + }if (pdata->irq >=0 ) {writel (0 , pdata->ioaddr +RTC_ALARM_INTERRUPT_MASK_REG_OFFS );
@@ -282,6 +294,11 @@ static int mv_rtc_probe(struct platform_ }return 0 ; +out: +if (!IS_ERR (pdata->clk)) +clk_disable_unprepare (pdata->clk); + +return ret; } static int __exit mv_rtc_remove(struct platform_device *pdev)
@@ -292,6 +309,9 @@ static int __exit mv_rtc_remove(struct pdevice_init_wakeup (&pdev->dev,0 );rtc_device_unregister (pdata->rtc); +if (!IS_ERR (pdata->clk)) +clk_disable_unprepare (pdata->clk); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 88/100 gpio: mvebu: Add clk support to prevent lockup
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Lunn <[email protected]>
commit de88747f514a4e0cca416a8871de2302f4f77790 upstream.
The kirkwood SoC GPIO cores use the runit clock. Add code to clk_prepare_enable() runit, otherwise there is a danger of locking up the SoC by accessing the GPIO registers when runit clock is not ticking.
--- arch/arm/boot/dts/kirkwood.dtsi | 2 ++ drivers/gpio/gpio-mvebu.c | 7 +++++++ 2 files changed, 9 insertions(+)
arch/arm/boot/dts/kirkwood.dtsi +2 -0
@@ -38,6 +38,7 @@ interrupt-controller; #interrupt-cells = <2>; interrupts = <35>, <36>, <37>, <38>; + clocks = <&gate_clk 7>; }; gpio1: gpio@10140 {
@@ -49,6 +50,7 @@ interrupt-controller; #interrupt-cells = <2>; interrupts = <39>, <40>, <41>; + clocks = <&gate_clk 7>; }; serial@12000 {
drivers/gpio/gpio-mvebu.c +7 -0
@@ -41,6 +41,7 @@#include <linux/io.h> #include <linux/of_irq.h> #include <linux/of_device.h> +#include <linux/clk.h> #include <linux/pinctrl/consumer.h> /*
@@ -495,6 +496,7 @@ static int mvebu_gpio_probe(struct platfstruct resource *res;struct irq_chip_generic *gc;struct irq_chip_type *ct; +struct clk *clk;unsigned int ngpios;int soc_variant;int i, cpu, id;
@@ -528,6 +530,11 @@ static int mvebu_gpio_probe(struct platfreturn id; } + clk =devm_clk_get (&pdev->dev,NULL ); +/* Not all SoCs require a clock.*/ +if (!IS_ERR (clk)) +clk_prepare_enable (clk); + mvchip->soc_variant = soc_variant; mvchip->chip.label =dev_name (&pdev->dev); mvchip->chip.dev = &pdev->dev;
Greg Kroah-Hartman
maintainerPATCH 89/100 ARM: mxs_defconfig: Make USB host functional again
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit f6c49da98dd6eacb85034d21d16e1428e03e190f upstream.
commit 09f6ffde2e (USB: EHCI: fix build error by making ChipIdea host a normal EHCI driver) introduced CONFIG_USB_EHCI_HCD as a dependency for USB_CHIPIDEA_HOST.
Select CONFIG_USB_EHCI_HCD, so that USB host can be functional again.
--- arch/arm/configs/mxs_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/mxs_defconfig +1 -0
@@ -118,6 +118,7 @@ CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FONTS=y CONFIG_LOGO=y CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_CHIPIDEA=y CONFIG_USB_CHIPIDEA_HOST=y CONFIG_USB_STORAGE=y
Greg Kroah-Hartman
maintainerPATCH 90/100 ARM: kirkwood: of_serial: fix clock gating by removing clock-frequency
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Cooper <[email protected]>
commit 93fff4ce19f9978cc1c59db42760717477939249 upstream.
When DT support for kirkwood was first introduced, there was no clock infrastructure. As a result, we had to manually pass the clock-frequency to the driver from the device node.
Unfortunately, on kirkwood, with minimal config or all module configs, clock-frequency breaks booting because of_serial doesn't consume the gate_clk when clock-frequency is defined.
The end result on kirkwood is that runit gets gated, and then the boot fails when the kernel tries to write to the serial port.
Fix the issue by removing the clock-frequency parameter from all kirkwood dts files.
Booted on dreamplug without earlyprintk and successfully logged in via ttyS0.
--- arch/arm/boot/dts/kirkwood-dns320.dts | 2 -- arch/arm/boot/dts/kirkwood-dns325.dts | 1 - arch/arm/boot/dts/kirkwood-dockstar.dts | 1 - arch/arm/boot/dts/kirkwood-dreamplug.dts | 1 - arch/arm/boot/dts/kirkwood-goflexnet.dts | 1 - arch/arm/boot/dts/kirkwood-ib62x0.dts | 1 - arch/arm/boot/dts/kirkwood-iconnect.dts | 1 - arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 1 - arch/arm/boot/dts/kirkwood-km_kirkwood.dts | 1 - arch/arm/boot/dts/kirkwood-lschlv2.dts | 1 - arch/arm/boot/dts/kirkwood-lsxhl.dts | 1 - arch/arm/boot/dts/kirkwood-mplcec4.dts | 1 - arch/arm/boot/dts/kirkwood-ns2-common.dtsi | 1 - arch/arm/boot/dts/kirkwood-nsa310.dts | 1 - arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 2 -- arch/arm/boot/dts/kirkwood-topkick.dts | 1 - arch/arm/boot/dts/kirkwood.dtsi | 2 -- 17 files changed, 20 deletions(-)
arch/arm/boot/dts/kirkwood-dns320.dts +0 -2
@@ -42,12 +42,10 @@ ocp@f1000000 { serial@12000 { - clock-frequency = <166666667>; status = "okay"; }; serial@12100 { - clock-frequency = <166666667>; status = "okay"; }; };
arch/arm/boot/dts/kirkwood-dns325.dts +0 -1
@@ -50,7 +50,6 @@ }; }; serial@12000 { - clock-frequency = <200000000>; status = "okay"; }; };
arch/arm/boot/dts/kirkwood-dockstar.dts +0 -1
@@ -37,7 +37,6 @@ }; }; serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-dreamplug.dts +0 -1
@@ -38,7 +38,6 @@ }; }; serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-goflexnet.dts +0 -1
@@ -73,7 +73,6 @@ }; }; serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-ib62x0.dts +0 -1
@@ -51,7 +51,6 @@ }; }; serial@12000 { - clock-frequency = <200000000>; status = "okay"; };
arch/arm/boot/dts/kirkwood-iconnect.dts +0 -1
@@ -78,7 +78,6 @@ }; }; serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts +0 -1
@@ -115,7 +115,6 @@ }; serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-km_kirkwood.dts +0 -1
@@ -34,7 +34,6 @@ }; serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-lschlv2.dts +0 -1
@@ -13,7 +13,6 @@ ocp@f1000000 { serial@12000 { - clock-frequency = <166666667>; status = "okay"; }; };
arch/arm/boot/dts/kirkwood-lsxhl.dts +0 -1
@@ -13,7 +13,6 @@ ocp@f1000000 { serial@12000 { - clock-frequency = <200000000>; status = "okay"; }; };
arch/arm/boot/dts/kirkwood-mplcec4.dts +0 -1
@@ -91,7 +91,6 @@ }; serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-ns2-common.dtsi +0 -1
@@ -23,7 +23,6 @@ }; serial@12000 { - clock-frequency = <166666667>; status = "okay"; };
arch/arm/boot/dts/kirkwood-nsa310.dts +0 -1
@@ -18,7 +18,6 @@ ocp@f1000000 { serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-openblocks_a6.dts +0 -2
@@ -18,12 +18,10 @@ ocp@f1000000 { serial@12000 { - clock-frequency = <200000000>; status = "ok"; }; serial@12100 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood-topkick.dts +0 -1
@@ -17,7 +17,6 @@ ocp@f1000000 { serial@12000 { - clock-frequency = <200000000>; status = "ok"; };
arch/arm/boot/dts/kirkwood.dtsi +0 -2
@@ -59,7 +59,6 @@ reg-shift = <2>; interrupts = <33>; clocks = <&gate_clk 7>; - /* set clock-frequency in board dts */ status = "disabled"; };
@@ -69,7 +68,6 @@ reg-shift = <2>; interrupts = <34>; clocks = <&gate_clk 7>; - /* set clock-frequency in board dts */ status = "disabled"; };
Greg Kroah-Hartman
maintainerPATCH 91/100 powerpc: Apply early paca fixups to boot_paca and the boot cpus paca
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 25e138149c19fa0680147b825be475f5fd57f155 upstream.
In commit 466921c we added a hack to set the paca data_offset to zero so that per-cpu accesses would work on the boot cpu prior to per-cpu areas being setup. This fixed a problem with lockdep touching per-cpu areas very early in boot.
However if we combine CONFIG_LOCK_STAT=y with any of the PPC_EARLY_DEBUG options, we can hit the same problem in udbg_early_init(). To avoid that we need to set the data_offset of the boot_paca also. So factor out the fixup logic and call it for both the boot_paca, and "the paca of the boot cpu".
--- arch/powerpc/kernel/setup_64.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/kernel/setup_64.c +11 -5
@@ -156,6 +156,15 @@ early_param("smt-enabled", early_smt_ena#define check_smt_enabled ()#endif /* CONFIG_SMP */ +/** Fix up paca fields required for the boot cpu */ +static void fixup_boot_paca (void ) +{ +/* The boot cpu is started */ +get_paca ()->cpu_start =1 ; +/* Allow percpu accesses to work until we setup percpu data */ +get_paca ()->data_offset =0 ; +} +/* * Early initialization entry point. This is called by head.S * with MMU translation disabled. We rely on the "feature" of
@@ -185,6 +194,7 @@ void __init early_setup(unsigned long dt/* Assume we're on cpu 0 for now. Don't write to the paca yet! */ initialise_paca (&boot_paca,0 );setup_paca (&boot_paca); +fixup_boot_paca ();/* Initialize lockdep early or else spinlocks will blow */ lockdep_init ();
@@ -205,11 +215,7 @@ void __init early_setup(unsigned long dt/* Now we know the logical id of our boot cpu, setup the paca. */ setup_paca (&paca[boot_cpuid]); - -/* Fix up paca fields required for the boot cpu */ -get_paca ()->cpu_start =1 ; -/* Allow percpu accesses to "work" until we setup percpu data */ -get_paca ()->data_offset =0 ; +fixup_boot_paca ();/* Probe the machine type */ probe_machine ();
Greg Kroah-Hartman
maintainerPATCH 92/100 ftrace: Update the kconfig for DYNAMIC_FTRACE
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit db05021d49a994ee40a9735d9c3cb0060c9babb8 upstream.
The prompt to enable DYNAMIC_FTRACE (the ability to nop and enable function tracing at run time) had a confusing statement:
"enable/disable ftrace tracepoints dynamically"
This was written before tracepoints were added to the kernel, but now that tracepoints have been added, this is very confusing and has confused people enough to give wrong information during presentations.
Not only that, I looked at the help text, and it still references that dreaded daemon that use to wake up once a second to update the nop locations and brick NICs, that hasn't been around for over five years.
Time to bring the text up to the current decade.
--- kernel/trace/Kconfig | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
kernel/trace/Kconfig +14 -10
@@ -416,24 +416,28 @@ config PROBE_EVENTS def_bool n config DYNAMIC_FTRACE - bool "enable/disable ftrace tracepoints dynamically" + bool "enable/disable function tracing dynamically" depends on FUNCTION_TRACER depends on HAVE_DYNAMIC_FTRACE default y help - This option will modify all the calls to ftrace dynamically - (will patch them out of the binary image and replace them - with a No-Op instruction) as they are called. A table is - created to dynamically enable them again. + This option will modify all the calls to function tracing + dynamically (will patch them out of the binary image and + replace them with a No-Op instruction) on boot up. During + compile time, a table is made of all the locations that ftrace + can function trace, and this table is linked into the kernel + image. When this is enabled, functions can be individually + enabled, and the functions not enabled will not affect + performance of the system. + + See the files in /sys/kernel/debug/tracing: + available_filter_functions + set_ftrace_filter + set_ftrace_notrace This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but otherwise has native performance as long as no tracing is active. - The changes to the code are done by a kernel thread that - wakes up once a second and checks to see if any ftrace calls - were made. If so, it runs stop_machine (stops all CPUS) - and modifies the code to jump over the call to ftrace. - config FUNCTION_PROFILER bool "Kernel function profiler" depends on FUNCTION_TRACER
Greg Kroah-Hartman
maintainerPATCH 93/100 efivars: Disable external interrupt while holding efivars->lock
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seiji Aguchi <[email protected]>
commit 81fa4e581d9283f7992a0d8c534bb141eb840a14 upstream.
[Problem]
There is a scenario which efi_pstore fails to log messages in a panic case.
- CPUA holds an efi_var->lock in either efivarfs parts or efi_pstore with interrupt enabled.
- CPUB panics and sends IPI to CPUA in smp_send_stop().
- CPUA stops with holding the lock.
- CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC) but it returns without logging messages.
[Patch Description]
This patch disables an external interruption while holding efivars->lock as follows.
In efi_pstore_write() and get_var_data(), spin_lock/spin_unlock is replaced by spin_lock_irqsave/spin_unlock_irqrestore because they may be called in an interrupt context.
In other functions, they are replaced by spin_lock_irq/spin_unlock_irq. because they are all called from a process context.
By applying this patch, we can avoid the problem above with a following senario.
- CPUA holds an efi_var->lock with interrupt disabled.
- CPUB panics and sends IPI to CPUA in smp_send_stop().
- CPUA receives the IPI after releasing the lock because it is disabling interrupt while holding the lock.
- CPUB waits for one sec until CPUA releases the lock.
- CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC) And it can hold the lock successfully.
--- drivers/firmware/efivars.c | 84 +++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 41 deletions(-)
drivers/firmware/efivars.c +43 -41
@@ -406,10 +406,11 @@ static efi_status_t get_var_data(struct efivars *efivars, struct efi_variable *var) { efi_status_t status; +unsigned long flags; -spin_lock (&efivars->lock); +spin_lock_irqsave (&efivars->lock, flags); status =get_var_data_locked (efivars, var); -spin_unlock (&efivars->lock); +spin_unlock_irqrestore (&efivars->lock, flags);if (status !=EFI_SUCCESS ) { printk(KERN_WARNING "efivars: get_variable() failed 0x%lx!\n",
@@ -538,14 +539,14 @@ efivar_store_raw(struct efivar_entry *enreturn -EINVAL ; } -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); status = efivars->ops->set_variable (new_var->VariableName, &new_var->VendorGuid, new_var->Attributes, new_var->DataSize, new_var->Data); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);if (status !=EFI_SUCCESS ) { printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n",
@@ -714,7 +715,7 @@ static ssize_t efivarfs_file_write(struc* amounts of memory. Pick a default size of 64K if * QueryVariableInfo() isn't supported by the firmware. */ -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);if (!efivars->ops->query_variable_info) status =EFI_UNSUPPORTED ;
@@ -724,7 +725,7 @@ static ssize_t efivarfs_file_write(struc &remaining_size, &max_size); } -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);if (status !=EFI_SUCCESS ) {if (status !=EFI_UNSUPPORTED )
@@ -755,7 +756,7 @@ static ssize_t efivarfs_file_write(struc* set_variable call, and removal of the variable from the efivars * list (in the case of an authenticated delete). */ -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); status = efivars->ops->set_variable(var->var.VariableName, &var->var.VendorGuid,
@@ -763,7 +764,7 @@ static ssize_t efivarfs_file_write(struc data);if (status !=EFI_SUCCESS ) { -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);kfree (data);return efi_status_to_err (status);
@@ -784,21 +785,21 @@ static ssize_t efivarfs_file_write(struc NULL);if (status ==EFI_BUFFER_TOO_SMALL ) { -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);mutex_lock (&inode->i_mutex);i_size_write (inode, newdatasize +sizeof (attributes));mutex_unlock (&inode->i_mutex); }else if (status ==EFI_NOT_FOUND ) {list_del (&var->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);efivar_unregister (var);drop_nlink (inode);d_delete (file->f_dentry);dput (file->f_dentry); }else { -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);pr_warn ("efivarfs: inconsistent EFI variable implementation? " "status = %lx\n" , status); }
@@ -820,11 +821,11 @@ static ssize_t efivarfs_file_read(structvoid *data;ssize_t size =0 ; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); status = efivars->ops->get_variable (var->var.VariableName, &var->var.VendorGuid, &attributes, &datasize,NULL ); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);if (status !=EFI_BUFFER_TOO_SMALL )return efi_status_to_err (status);
@@ -834,12 +835,12 @@ static ssize_t efivarfs_file_read(structif (!data)return -ENOMEM ; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); status = efivars->ops->get_variable (var->var.VariableName, &var->var.VendorGuid, &attributes, &datasize, (data +sizeof (attributes))); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);if (status !=EFI_SUCCESS ) { size =efi_status_to_err (status);
@@ -1005,9 +1006,9 @@ static int efivarfs_create(struct inode goto out;kobject_uevent (&var->kobj,KOBJ_ADD ); -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);list_add (&var->list, &efivars->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);d_instantiate (dentry, inode);dget (dentry); out:
@@ -1024,7 +1025,7 @@ static int efivarfs_unlink(struct inodestruct efivars *efivars = var->efivars;efi_status_t status; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); status = efivars->ops->set_variable(var->var.VariableName, &var->var.VendorGuid,
@@ -1032,14 +1033,14 @@ static int efivarfs_unlink(struct inodeif (status ==EFI_SUCCESS || status ==EFI_NOT_FOUND ) {list_del (&var->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);efivar_unregister (var);drop_nlink (dentry->d_inode);dput (dentry);return 0 ; } -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EINVAL ; };
@@ -1194,13 +1195,13 @@ static int efivarfs_fill_super(struct su/* copied by the above to local storage in the dentry. */ kfree (name); -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); efivars->ops->get_variable (entry->var.VariableName, &entry->var.VendorGuid, &entry->var.Attributes, &size,NULL ); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);mutex_lock (&inode->i_mutex); inode->i_private = entry;
@@ -1263,7 +1264,7 @@ static int efi_pstore_open(struct pstore {struct efivars *efivars = psi->data; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); efivars->walk_entry =list_first_entry (&efivars->list, struct efivar_entry, list);return 0 ;
@@ -1273,7 +1274,7 @@ static int efi_pstore_close(struct pstor {struct efivars *efivars = psi->data; -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return 0 ; }
@@ -1349,8 +1350,9 @@ static int efi_pstore_write(enum pstore_int i, ret =0 ;u64 storage_space, remaining_space, max_variable_size;efi_status_t status =EFI_NOT_FOUND ; +unsigned long flags; -spin_lock (&efivars->lock); +spin_lock_irqsave (&efivars->lock, flags);/* * Check if there is a space enough to log.
@@ -1362,7 +1364,7 @@ static int efi_pstore_write(enum pstore_ &remaining_space, &max_variable_size);if (status || remaining_space < size +DUMP_NAME_LEN *2 ) { -spin_unlock (&efivars->lock); +spin_unlock_irqrestore (&efivars->lock, flags); *id = part;return -ENOSPC ; }
@@ -1376,7 +1378,7 @@ static int efi_pstore_write(enum pstore_ efivars->ops->set_variable (efi_name, &vendor,PSTORE_EFI_ATTRIBUTES , size, psi->buf); -spin_unlock (&efivars->lock); +spin_unlock_irqrestore (&efivars->lock, flags);if (size) ret = efivar_create_sysfs_entry(efivars,
@@ -1403,7 +1405,7 @@ static int efi_pstore_erase(enum pstore_sprintf (name,"dump-type%u-%u-%d-%lu" , type, (unsigned int )id, count, time.tv_sec); -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);for (i =0 ; i <DUMP_NAME_LEN ; i++) efi_name[i] = name[i];
@@ -1447,7 +1449,7 @@ static int efi_pstore_erase(enum pstore_if (found)list_del (&found->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);if (found)efivar_unregister (found);
@@ -1517,7 +1519,7 @@ static ssize_t efivar_create(struct filereturn -EINVAL ; } -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);/* * Does this variable already exist?
@@ -1535,7 +1537,7 @@ static ssize_t efivar_create(struct file } }if (found) { -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EINVAL ; }
@@ -1549,10 +1551,10 @@ static ssize_t efivar_create(struct fileif (status !=EFI_SUCCESS ) {printk (KERN_WARNING "efivars: set_variable() failed: status=%lx\n" , status); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EIO ; } -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);/* Create the entry in sysfs. Locking is not required here */ status = efivar_create_sysfs_entry(efivars,
@@ -1580,7 +1582,7 @@ static ssize_t efivar_delete(struct fileif (!capable (CAP_SYS_ADMIN ))return -EACCES ; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);/* * Does this variable already exist?
@@ -1598,7 +1600,7 @@ static ssize_t efivar_delete(struct file } }if (!found) { -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EINVAL ; }/* force the Attributes/DataSize to 0 to ensure deletion */
@@ -1614,12 +1616,12 @@ static ssize_t efivar_delete(struct fileif (status !=EFI_SUCCESS ) {printk (KERN_WARNING "efivars: set_variable() failed: status=%lx\n" , status); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EIO ; }list_del (&search_efivar->list);/* We need to release this lock before unregistering. */ -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);efivar_unregister (search_efivar);/* It's dead Jim.... */
@@ -1734,9 +1736,9 @@ efivar_create_sysfs_entry(struct efivarskfree (short_name); short_name =NULL ; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);list_add (&new_efivar->list, &efivars->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return 0 ; }
@@ -1805,9 +1807,9 @@ void unregister_efivars(struct efivars *struct efivar_entry *entry, *n;list_for_each_entry_safe (entry, n, &efivars->list, list) { -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);list_del (&entry->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);efivar_unregister (entry); }if (efivars->new_var)
Greg Kroah-Hartman
maintainerPATCH 94/100 efi: be more paranoid about available space when creating variables
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Garrett <[email protected]>
commit 68d929862e29a8b52a7f2f2f86a0600423b093cd upstream.
UEFI variables are typically stored in flash. For various reasons, avaiable space is typically not reclaimed immediately upon the deletion of a variable - instead, the system will garbage collect during initialisation after a reboot.
Some systems appear to handle this garbage collection extremely poorly, failing if more than 50% of the system flash is in use. This can result in the machine refusing to boot. The safest thing to do for the moment is to forbid writes if they'd end up using more than half of the storage space. We can make this more finegrained later if we come up with a method for identifying the broken machines.
--- drivers/firmware/efivars.c | 106 +++++++++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 27 deletions(-)
drivers/firmware/efivars.c +79 -27
@@ -419,6 +419,44 @@ get_var_data(struct efivars *efivars, streturn status; } +static efi_status_t +check_var_size_locked (struct efivars *efivars,u32 attributes, +unsigned long size) +{ +u64 storage_size, remaining_size, max_size; +efi_status_t status; +const struct efivar_operations *fops = efivars->ops; + +if (!efivars->ops->query_variable_info) +return EFI_UNSUPPORTED ; + + status = fops->query_variable_info (attributes, &storage_size, + &remaining_size, &max_size); + +if (status !=EFI_SUCCESS ) +return status; + +if (!storage_size || size > remaining_size || size > max_size || + (remaining_size - size) < (storage_size /2 )) +return EFI_OUT_OF_RESOURCES ; + +return status; +} + + +static efi_status_t +check_var_size (struct efivars *efivars,u32 attributes,unsigned long size) +{ +efi_status_t status; +unsigned long flags; + +spin_lock_irqsave (&efivars->lock, flags); + status =check_var_size_locked (efivars, attributes, size); +spin_unlock_irqrestore (&efivars->lock, flags); + +return status; +} +static ssize_t efivar_guid_read (struct efivar_entry *entry,char *buf) {
@@ -540,11 +578,16 @@ efivar_store_raw(struct efivar_entry *en }spin_lock_irq (&efivars->lock); - status = efivars->ops->set_variable (new_var->VariableName, - &new_var->VendorGuid, - new_var->Attributes, - new_var->DataSize, - new_var->Data); + + status =check_var_size_locked (efivars, new_var->Attributes, + new_var->DataSize +utf16_strsize (new_var->VariableName,1024 )); + +if (status ==EFI_SUCCESS || status ==EFI_UNSUPPORTED ) + status = efivars->ops->set_variable (new_var->VariableName, + &new_var->VendorGuid, + new_var->Attributes, + new_var->DataSize, + new_var->Data);spin_unlock_irq (&efivars->lock);
@@ -695,8 +738,7 @@ static ssize_t efivarfs_file_write(strucu32 attributes;struct inode *inode = file->f_mapping->host;unsigned long datasize = count -sizeof (attributes); -unsigned long newdatasize; -u64 storage_size, remaining_size, max_size; +unsigned long newdatasize, varsize;ssize_t bytes =0 ;if (count <sizeof (attributes))
@@ -715,28 +757,18 @@ static ssize_t efivarfs_file_write(struc* amounts of memory. Pick a default size of 64K if * QueryVariableInfo() isn't supported by the firmware. */ -spin_lock_irq (&efivars->lock); -if (!efivars->ops->query_variable_info) - status =EFI_UNSUPPORTED ; -else { -const struct efivar_operations *fops = efivars->ops; - status = fops->query_variable_info (attributes, &storage_size, - &remaining_size, &max_size); - } - -spin_unlock_irq (&efivars->lock); + varsize = datasize +utf16_strsize (var->var.VariableName,1024 ); + status =check_var_size (efivars, attributes, varsize);if (status !=EFI_SUCCESS ) {if (status !=EFI_UNSUPPORTED )return efi_status_to_err (status); - remaining_size =65536 ; +if (datasize >65536 ) +return -ENOSPC ; } -if (datasize > remaining_size) -return -ENOSPC ; - data =kmalloc (datasize,GFP_KERNEL );if (!data)return -ENOMEM ;
@@ -758,6 +790,19 @@ static ssize_t efivarfs_file_write(struc*/ spin_lock_irq (&efivars->lock); +/* +* Ensure that the available space hasn't shrunk below the safe level +*/ + + status =check_var_size_locked (efivars, attributes, varsize); + +if (status !=EFI_SUCCESS && status !=EFI_UNSUPPORTED ) { +spin_unlock_irq (&efivars->lock); +kfree (data); + +return efi_status_to_err (status); + } + status = efivars->ops->set_variable(var->var.VariableName, &var->var.VendorGuid, attributes, datasize,
@@ -1348,7 +1393,6 @@ static int efi_pstore_write(enum pstore_efi_guid_t vendor =LINUX_EFI_CRASH_GUID ;struct efivars *efivars = psi->data;int i, ret =0 ; -u64 storage_space, remaining_space, max_variable_size;efi_status_t status =EFI_NOT_FOUND ;unsigned long flags;
@@ -1359,11 +1403,11 @@ static int efi_pstore_write(enum pstore_* size: a size of logging data * DUMP_NAME_LEN * 2: a maximum size of variable name */ - status = efivars->ops->query_variable_info (PSTORE_EFI_ATTRIBUTES , - &storage_space, - &remaining_space, - &max_variable_size); -if (status || remaining_space < size +DUMP_NAME_LEN *2 ) { + + status =check_var_size_locked (efivars,PSTORE_EFI_ATTRIBUTES , + size +DUMP_NAME_LEN *2 ); + +if (status) {spin_unlock_irqrestore (&efivars->lock, flags); *id = part;return -ENOSPC ;
@@ -1541,6 +1585,14 @@ static ssize_t efivar_create(struct filereturn -EINVAL ; } + status =check_var_size_locked (efivars, new_var->Attributes, + new_var->DataSize +utf16_strsize (new_var->VariableName,1024 )); + +if (status && status !=EFI_UNSUPPORTED ) { +spin_unlock_irq (&efivars->lock); +return efi_status_to_err (status); + } +/* now *really* create the variable via EFI */ status = efivars->ops->set_variable(new_var->VariableName, &new_var->VendorGuid,
Greg Kroah-Hartman
maintainerPATCH 95/100 USB: Dont use EHCI port sempahore for USB 3.0 hubs.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
[This is upstream commit 0fe51aa5eee51db7c7ecd201d42a977ad79c58b6. It needs to be backported to kernels as old as 3.2, because it fixes the buggy commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a "USB: Handle warm reset failure on empty port."]
The EHCI host controller needs to prevent EHCI initialization when the UHCI or OHCI companion controller is in the middle of a port reset. It uses ehci_cf_port_reset_rwsem to do this. USB 3.0 hubs can't be under an EHCI host controller, so it makes no sense to down the semaphore for USB 3.0 hubs. It also makes the warm port reset code more complex.
Don't down ehci_cf_port_reset_rwsem for USB 3.0 hubs.
--- drivers/usb/core/hub.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/usb/core/hub.c +7 -8
@@ -2661,17 +2661,16 @@ static int hub_port_reset(struct usb_hub {int i, status; -if (!warm) { -/* Block EHCI CF initialization during the port reset. -* Some companion controllers don't like it when they mix. -*/ -down_read (&ehci_cf_port_reset_rwsem); - }else { -if (!hub_is_superspeed (hub->hdev)) { +if (!hub_is_superspeed (hub->hdev)) { +if (warm) {dev_err (hub->intfdev,"only USB3 hub support " "warm reset\n" );return -EINVAL ; } +/* Block EHCI CF initialization during the port reset. +* Some companion controllers don't like it when they mix. +*/ +down_read (&ehci_cf_port_reset_rwsem); }/* Reset the port */
@@ -2709,7 +2708,7 @@ static int hub_port_reset(struct usb_hub port1); done: -if (!warm) +if (!hub_is_superspeed (hub->hdev))up_read (&ehci_cf_port_reset_rwsem);return status;
Greg Kroah-Hartman
maintainerPATCH 96/100 USB: Prepare for refactoring by adding extra udev checks.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
[This is upstream commit 2d4fa940f99663c82ba55b2244638833b388e4e2. It needs to be backported to kernels as old as 3.2, because it fixes the buggy commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a "USB: Handle warm reset failure on empty port."]
The next patch will refactor the hub port code to rip out the recursive call to hub_port_reset on a failed hot reset. In preparation for that, make sure all code paths can deal with being called with a NULL udev. The usb_device will not be valid if warm reset was issued because a port transitioned to the Inactive or Compliance Mode on a device connect.
This patch should have no effect on current behavior.
--- drivers/usb/core/hub.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/usb/core/hub.c +13 -8
@@ -2584,6 +2584,9 @@ static int hub_port_wait_reset(struct usreturn -ENOTCONN ;if ((portstatus &USB_PORT_STAT_ENABLE )) { +if (!udev) +return 0 ; +if (hub_is_wusb (hub)) udev->speed =USB_SPEED_WIRELESS ;else if (hub_is_superspeed (hub->hdev))
@@ -2627,13 +2630,15 @@ static void hub_port_finish_reset(structstruct usb_hcd *hcd;/* TRSTRCY = 10 ms; plus some extra */ msleep (10 +40 ); -update_devnum (udev,0 ); - hcd =bus_to_hcd (udev->bus); -/* The xHC may think the device is already reset, -* so ignore the status. -*/ -if (hcd->driver->reset_device) - hcd->driver->reset_device (hcd, udev); +if (udev) { +update_devnum (udev,0 ); + hcd =bus_to_hcd (udev->bus); +/* The xHC may think the device is already +* reset, so ignore the status. +*/ +if (hcd->driver->reset_device) + hcd->driver->reset_device (hcd, udev); + } }/* FALL THROUGH */ case -ENOTCONN :
@@ -2647,7 +2652,7 @@ static void hub_port_finish_reset(structclear_port_feature (hub->hdev, port1,USB_PORT_FEAT_C_PORT_LINK_STATE ); } -if (!warm) +if (!warm && udev)usb_set_device_state (udev, *status ?USB_STATE_NOTATTACHED :USB_STATE_DEFAULT );
Greg Kroah-Hartman
maintainerPATCH 97/100 USB: Rip out recursive call on warm port reset.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
[This is upstream commit a24a6078754f28528bc91e7e7b3e6ae86bd936d8. It needs to be backported to kernels as old as 3.2, because it fixes the buggy commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a "USB: Handle warm reset failure on empty port."]
When a hot reset fails on a USB 3.0 port, the current port reset code recursively calls hub_port_reset inside hub_port_wait_reset. This isn't ideal, since we should avoid recursive calls in the kernel, and it also doesn't allow us to issue multiple warm resets on reset failures.
Rip out the recursive call. Instead, add code to hub_port_reset to issue a warm reset if the hot reset fails, and try multiple warm resets before giving up on the port.
In hub_port_wait_reset, remove the recursive call and re-indent. The code is basically the same, except:
1. It bails out early if the port has transitioned to Inactive or Compliance Mode after the reset completed.
2. It doesn't consider a connect status change to be a failed reset. If multiple warm resets needed to be issued, the connect status may have changed, so we need to ignore that and look at the port link state instead. hub_port_reset will now do that.
3. It unconditionally sets udev->speed on all types of successful resets. The old recursive code would set the port speed when the second hub_port_reset returned.
The old code did not handle connected devices needing a warm reset well. There were only two situations that the old code handled correctly: an empty port needing a warm reset, and a hot reset that migrated to a warm reset.
When an empty port needed a warm reset, hub_port_reset was called with the warm variable set. The code in hub_port_finish_reset would skip telling the USB core and the xHC host that the device was reset, because otherwise that would result in a NULL pointer dereference.
When a USB 3.0 device reset migrated to a warm reset, the recursive call made the call stack look like this:
hub_port_reset(warm = false)
hub_wait_port_reset(warm = false)
hub_port_reset(warm = true)
hub_wait_port_reset(warm = true) hub_port_finish_reset(warm = true) (return up the call stack to the first wait)
hub_port_finish_reset(warm = false)
The old code didn't want to notify the USB core or the xHC host of device reset twice, so it only did it in the second call to hub_port_finish_reset, when warm was set to false. This was necessary because
before patch two ("USB: Ignore xHCI Reset Device status."), the USB core would pay attention to the xHC Reset Device command error status, and the second call would always fail.
Now that we no longer have the recursive call, and warm can change from false to true in hub_port_reset, we need to have hub_port_finish_reset unconditionally notify the USB core and the xHC of the device reset.
In hub_port_finish_reset, unconditionally clear the connect status change (CSC) bit for USB 3.0 hubs when the port reset is done. If we had to issue multiple warm resets for a device, that bit may have been set if the device went into SS.Inactive and then was successfully warm reset.
--- drivers/usb/core/hub.c | 148 ++++++++++++++++++++++--------------------------- 1 file changed, 67 insertions(+), 81 deletions(-)
drivers/usb/core/hub.c +67 -81
@@ -2538,73 +2538,35 @@ static int hub_port_wait_reset(struct usif ((portstatus &USB_PORT_STAT_RESET )) goto delay; -/* -* Some buggy devices require a warm reset to be issued even -* when the port appears not to be connected. +if (hub_port_warm_reset_required (hub, portstatus)) +return -ENOTCONN ; + +/* Device went away? */ +if (!(portstatus &USB_PORT_STAT_CONNECTION )) +return -ENOTCONN ; + +/* bomb out completely if the connection bounced. A USB 3.0 +* connection may bounce if multiple warm resets were issued, +* but the device may have successfully re-connected. Ignore it. */ -if (!warm) { -/* -* Some buggy devices can cause an NEC host controller -* to transition to the "Error" state after a hot port -* reset. This will show up as the port state in -* "Inactive", and the port may also report a -* disconnect. Forcing a warm port reset seems to make -* the device work. -* -* See https://bugzilla.kernel.org/show_bug.cgi?id=41752 -*/ -if (hub_port_warm_reset_required (hub, portstatus)) { -int ret; +if (!hub_is_superspeed (hub->hdev) && + (portchange &USB_PORT_STAT_C_CONNECTION )) +return -ENOTCONN ; -if ((portchange &USB_PORT_STAT_C_CONNECTION )) -clear_port_feature (hub->hdev, port1, -USB_PORT_FEAT_C_CONNECTION ); -if (portchange &USB_PORT_STAT_C_LINK_STATE ) -clear_port_feature (hub->hdev, port1, -USB_PORT_FEAT_C_PORT_LINK_STATE ); -if (portchange &USB_PORT_STAT_C_RESET ) -clear_port_feature (hub->hdev, port1, -USB_PORT_FEAT_C_RESET ); -dev_dbg (hub->intfdev,"hot reset failed, warm reset port %d\n" , - port1); - ret =hub_port_reset (hub, port1, - udev,HUB_BH_RESET_TIME , - true); -if ((portchange &USB_PORT_STAT_C_CONNECTION )) -clear_port_feature (hub->hdev, port1, -USB_PORT_FEAT_C_CONNECTION ); -return ret; - } -/* Device went away? */ -if (!(portstatus &USB_PORT_STAT_CONNECTION )) -return -ENOTCONN ; - -/* bomb out completely if the connection bounced */ -if ((portchange &USB_PORT_STAT_C_CONNECTION )) -return -ENOTCONN ; - -if ((portstatus &USB_PORT_STAT_ENABLE )) { -if (!udev) -return 0 ; - -if (hub_is_wusb (hub)) - udev->speed =USB_SPEED_WIRELESS ; -else if (hub_is_superspeed (hub->hdev)) - udev->speed =USB_SPEED_SUPER ; -else if (portstatus &USB_PORT_STAT_HIGH_SPEED ) - udev->speed =USB_SPEED_HIGH ; -else if (portstatus &USB_PORT_STAT_LOW_SPEED ) - udev->speed =USB_SPEED_LOW ; -else - udev->speed =USB_SPEED_FULL ; +if ((portstatus &USB_PORT_STAT_ENABLE )) { +if (!udev)return 0 ; - } - }else { -if (!(portstatus &USB_PORT_STAT_CONNECTION ) || -hub_port_warm_reset_required (hub, - portstatus)) -return -ENOTCONN ; +if (hub_is_wusb (hub)) + udev->speed =USB_SPEED_WIRELESS ; +else if (hub_is_superspeed (hub->hdev)) + udev->speed =USB_SPEED_SUPER ; +else if (portstatus &USB_PORT_STAT_HIGH_SPEED ) + udev->speed =USB_SPEED_HIGH ; +else if (portstatus &USB_PORT_STAT_LOW_SPEED ) + udev->speed =USB_SPEED_LOW ; +else + udev->speed =USB_SPEED_FULL ;return 0 ; }
@@ -2622,23 +2584,21 @@ delay: }static void hub_port_finish_reset (struct usb_hub *hub,int port1, -struct usb_device *udev,int *status,bool warm) +struct usb_device *udev,int *status) {switch (*status) {case 0 : -if (!warm) { -struct usb_hcd *hcd; -/* TRSTRCY = 10 ms; plus some extra */ -msleep (10 +40 ); -if (udev) { -update_devnum (udev,0 ); - hcd =bus_to_hcd (udev->bus); -/* The xHC may think the device is already -* reset, so ignore the status. -*/ -if (hcd->driver->reset_device) - hcd->driver->reset_device (hcd, udev); - } +/* TRSTRCY = 10 ms; plus some extra */ +msleep (10 +40 ); +if (udev) { +struct usb_hcd *hcd =bus_to_hcd (udev->bus); + +update_devnum (udev,0 ); +/* The xHC may think the device is already reset, +* so ignore the status. +*/ +if (hcd->driver->reset_device) + hcd->driver->reset_device (hcd, udev); }/* FALL THROUGH */ case -ENOTCONN :
@@ -2651,8 +2611,10 @@ static void hub_port_finish_reset(struct USB_PORT_FEAT_C_BH_PORT_RESET);clear_port_feature (hub->hdev, port1,USB_PORT_FEAT_C_PORT_LINK_STATE ); +clear_port_feature (hub->hdev, port1, +USB_PORT_FEAT_C_CONNECTION ); } -if (!warm && udev) +if (udev)usb_set_device_state (udev, *status ?USB_STATE_NOTATTACHED :USB_STATE_DEFAULT );
@@ -2665,6 +2627,7 @@ static int hub_port_reset(struct usb_hub struct usb_device *udev, unsigned int delay, bool warm) { int i, status; +u16 portchange, portstatus;if (!hub_is_superspeed (hub->hdev)) {if (warm) {
@@ -2696,10 +2659,33 @@ static int hub_port_reset(struct usb_hub status); } -/* return on disconnect or reset */ +/* Check for disconnect or reset */ if (status ==0 || status == -ENOTCONN || status == -ENODEV ) { -hub_port_finish_reset (hub, port1, udev, &status, warm); - goto done; +hub_port_finish_reset (hub, port1, udev, &status); + +if (!hub_is_superspeed (hub->hdev)) + goto done; + +/* +* If a USB 3.0 device migrates from reset to an error +* state, re-issue the warm reset. +*/ +if (hub_port_status (hub, port1, + &portstatus, &portchange) <0 ) + goto done; + +if (!hub_port_warm_reset_required (hub, portstatus)) + goto done; + +/* +* If the port is in SS.Inactive or Compliance Mode, the +* hot or warm reset failed. Try another warm reset. +*/ +if (!warm) { +dev_dbg (hub->intfdev,"hot reset failed, warm reset port %d\n" , + port1); + warm = true; + } } dev_dbg (hub->intfdev,
Greg Kroah-Hartman
maintainerPATCH 98/100 USB: Fix connected device switch to Inactive state.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
[This is upstream commit d3b9d7a9051d7024a93c76a84b2f84b3b66ad6d5. It needs to be backported to kernels as old as 3.2, because it fixes the buggy commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a "USB: Handle warm reset failure on empty port."]
A USB 3.0 device can transition to the Inactive state if a U1 or U2 exit transition fails. The current code in hub_events simply issues a warm reset, but does not call any pre-reset or post-reset driver methods (or unbind/rebind drivers without them). Therefore the drivers won't know their device has just been reset.
hub_events should instead call usb_reset_device. This means hub_port_reset now needs to figure out whether it should issue a warm reset or a hot reset.
Remove the FIXME note about needing disconnect() for a NOTATTACHED device. This patch fixes that.
--- drivers/usb/core/hub.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/usb/core/hub.c +25 -5
@@ -2605,7 +2605,6 @@ static void hub_port_finish_reset(structcase -ENODEV :clear_port_feature (hub->hdev, port1,USB_PORT_FEAT_C_RESET ); -/* FIXME need disconnect() for NOTATTACHED device */ if (hub_is_superspeed (hub->hdev)) {clear_port_feature (hub->hdev, port1,USB_PORT_FEAT_C_BH_PORT_RESET );
@@ -2639,6 +2638,18 @@ static int hub_port_reset(struct usb_hub* Some companion controllers don't like it when they mix. */ down_read (&ehci_cf_port_reset_rwsem); + }else if (!warm) { +/* +* If the caller hasn't explicitly requested a warm reset, +* double check and see if one is needed. +*/ + status =hub_port_status (hub, port1, + &portstatus, &portchange); +if (status <0 ) + goto done; + +if (hub_port_warm_reset_required (hub, portstatus)) + warm = true; }/* Reset the port */
@@ -4730,12 +4741,21 @@ static void hub_events(void)*/ if (hub_port_warm_reset_required (hub, portstatus)) {int status; +struct usb_device *udev = + hub->ports[i -1 ]->child;dev_dbg (hub_dev,"warm reset port %d\n" , i); - status =hub_port_reset (hub, i,NULL , -HUB_BH_RESET_TIME , true); -if (status <0 ) -hub_port_disable (hub, i,1 ); +if (!udev) { + status =hub_port_reset (hub, i, +NULL ,HUB_BH_RESET_TIME , + true); +if (status <0 ) +hub_port_disable (hub, i,1 ); + }else { +usb_lock_device (udev); + status =usb_reset_device (udev); +usb_unlock_device (udev); + } connect_change =0 ; }
Greg Kroah-Hartman
maintainerPATCH 99/100 Revert "xen/blkback: Dont trust the handle from the frontend."
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 01c681d4c70d64cb72142a2823f27c4146a02e63 upstream (ef56ca64ea733c3b88f0bb74b04da128b1dc35d8 in this tree), as it wasn't supposed to have been applied to the stable tree.
--- drivers/block/xen-blkback/blkback.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/xen-blkback/blkback.c +1 -0
@@ -881,6 +881,7 @@ static int dispatch_rw_block_io(struct x goto fail_response; } + preq.dev = req->u.rw.handle; preq.sector_number = req->u.rw.sector_number; preq.nr_sects =0 ;
Greg Kroah-Hartman
maintainerPATCH 100/100 w1-gpio: fix section mismatch
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hauke Mehrtens <[email protected]>
commit 06a8f1feb9e82e5b66f781ba3e39055e3f89a641 upstream.
This fixes the following section mismatch:
WARNING: drivers/w1/masters/w1-gpio.o(.data+0x188): Section mismatch in reference from the variable w1_gpio_driver to the function .init.text:w1_gpio_probe()
The variable w1_gpio_driver references
the function __init w1_gpio_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
--- drivers/w1/masters/w1-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/w1/masters/w1-gpio.c +1 -1
@@ -72,7 +72,7 @@ static int w1_gpio_probe_dt(struct platfreturn 0 ; } -static int __init w1_gpio_probe (struct platform_device *pdev) +static int w1_gpio_probe (struct platform_device *pdev) {struct w1_bus_master *master;struct w1_gpio_platform_data *pdata;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.8.3 release. There are 100 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 me know.
Responses should be made by Thu Mar 14 22:30:28 UTC 2013. Anything received after that time might be too late.
Quoted 7 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.8.3-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Patches applied cleanly to 3.0.68, 3.4.35, and 3.8.2
Compiled and booted on the following systems:
HP EliteBook 6930p Intel(R) Core(TM)2 Duo CPU T9400 @ 2.53GHz HP ProBook 6475b AMD A10-4600M APU with Radeon(tm) HD Graphics
dmesgs for all releases look good. No regressions compared to the previous dmesgs for each of these releases.
Cross-compile tests results:
alpha: defconfig passed on all
arm: defconfig passed on all
arm64: not applicable to 3.0.y, 3.4.y. defconfig passed on 3.8.y
c6x: not applicable to 3.0.y, defconfig passed on 3.4.y, and 3.8.y.
mips: defconfig passed on all
mipsel: defconfig passed on all
powerpc: wii_defconfig passed on all
sh: defconfig passed on all
sparc: defconfig passed on all
tile: tilegx_defconfig passed on all
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 14 lines · Shuah Khan
Quoted 12 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.8.3 release. There are 100 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 me know.
Responses should be made by Thu Mar 14 22:30:28 UTC 2013. 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.8.3-rc1.gzand the diffstat can be found below.
Quoted 7 lines
Quoted 3 lines
thanks,
greg k-h
Patches applied cleanly to 3.0.68, 3.4.35, and 3.8.2
Compiled and booted on the following systems:
Thanks for testing and letting us know.
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.8.3 release. There are 100 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 me know.
Hi,
I'm missing a drivers/net/ethernet/atheros/atl1c patch, namely "atl1c:
restore buffer state".
In fact, it seems the whole netdev stable patch queue is missing:
http://patchwork.ozlabs.org/bundle/davem/stable/?state=*
Unsure what the workflow is here, how are these supposed to make to stable?
Thanks,
Andre
David Miller
maintainerFrom: Andre Heider <[email protected]>
Date: Wed, 13 Mar 2013 09:02:46 +0100
Quoted 7 lines
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.8.3 release. There are 100 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 me know.
Quoted 8 lines
Hi,
I'm missing a
drivers/net/ethernet/atheros/atl1cpatch, namely "atl1c:
restore buffer state".
In fact, it seems the whole netdev stable patch queue is missing:
http://patchwork.ozlabs.org/bundle/davem/stable/?state=*Unsure what the workflow is here, how are these supposed to make to stable?
I submit those patches at a time of my own choosing, and if you read [email protected] you will see when I do that.
I let patches cook in Linus's tree for a week or so before submitting to -stable so that any bugs in those changes are more likely to be discovered before the change is in -stable too.
Quoted 17 lines · David Miller
From: Andre Heider <[email protected]>
Date: Wed, 13 Mar 2013 09:02:46 +0100Quoted 14 lines
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.8.3 release. There are 100 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 me know.
Hi,
I'm missing a
drivers/net/ethernet/atheros/atl1cpatch, namely "atl1c:
restore buffer state".
In fact, it seems the whole netdev stable patch queue is missing:
http://patchwork.ozlabs.org/bundle/davem/stable/?state=*
Quoted 8 lines
Quoted 1 line
Unsure what the workflow is here, how are these supposed to make to stable?
I submit those patches at a time of my own choosing, and if you read [email protected] you will see when I do that.
I let patches cook in Linus's tree for a week or so before submitting to -stable so that any bugs in those changes are more likely to be discovered before the change is in -stable too.
I hoped that a fix I care about makes it to 3.8.3, but ok, that makes sense.
Thanks,
Andre