3.4.106-rc1 review
Subsystems (5)
cover 3.4.106-rc1 review
From: Zefan Li <[email protected]>
This is the start of the stable review cycle for the 3.4.106 release. There are 177 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 Fri Jan 30 03:58:34 UTC 2015. Anything received after that time might be too late.
A combined patch relative to 3.4.105 will be posted as an additional response to this. A shortlog and diffstat can be found below.
thanks,
Zefan Li
--------------------
Aaro Koskinen (1):
MIPS: oprofile: Fix backtrace on 64-bit kernel
Adel Gadllah (2):
USB: quirks: enable device-qualifier quirk for another Elan
touchscreen
USB: quirks: enable device-qualifier quirk for yet another Elan
touchscreen
Al Viro (1):
fix misuses of f_count() in ppp and netlink
Alan Stern (1):
usb-storage: handle a skipped data phase
Alex Deucher (2):
drm/radeon: remove invalid pci id
drm/radeon: add missing crtc unlock when setting up the MC
Alexey Khoroshilov (2):
dm log userspace: fix memory leak in dm_ulog_tfr_init failure path
can: esd_usb2: fix memory leak on disconnect
Anatol Pomozov (1):
ALSA: pcm: use the same dma mmap codepath both for arm and arm64
Andreas Bomholtz (1):
USB: cp210x: add support for Seluxit USB dongle
Andreas Noever (1):
PCI: pciehp: Prevent NULL dereference during probe
Andy Adamson (1):
NFSv4.1: Fix an NFSv4.1 state renewal regression
Andy Honig (2):
KVM: x86: Prevent host from panicking on shared MSR writes.
KVM: x86: Improve thread safety in pit
Andy Lutomirski (8):
x86,kvm,vmx: Preserve CR4 across VM entry
x86, apic: Handle a bad TSC more gracefully
x86_64, traps: Stop using IST for #SS
x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C x86_64, traps: Rework bad_iret
x86/asm/traps: Disable tracing and kprobes in fixup_bad_iret and
sync_regs
x86, kvm: Clear paravirt_enabled on KVM guests for espfix32's benefit x86/tls: Validate TLS entries to protect espfix
Andy Shevchenko (2):
spi: dw-mid: respect 8 bit mode
spi: dw-mid: terminate ongoing transfers at exit
Anton Blanchard (1):
powerpc: do_notify_resume can be called with bad thread_info flags
argument
Artem Bityutskiy (3):
UBIFS: remove mst_mutex
UBIFS: fix a race condition
UBIFS: fix free log space calculation
Bart Van Assche (1):
srp-target: Retry when QP creation fails with ENOMEM
Ben Hutchings (1):
x86: Reject x32 executables if x32 ABI not supported
Benjamin Coddington (1):
lockd: Try to reconnect if statd has moved
Benjamin Herrenschmidt (1):
of/base: Fix PowerPC address parsing hack
Borislav Petkov (1):
mpc85xx_edac: Make L2 interrupt shared too
Brian Silverman (1):
futex: Fix a race condition between REQUEUE_PI and task death
Bryan O'Donoghue (2):
x86/intel/quark: Switch off CR4.PGE so TLB flush uses CR3 instead
serial: 8250: Add Quark X1000 to 8250_pci.c
Catalin Marinas (1):
futex: Ensure get_futex_key_refs() always implies a barrier
Cesar Eduardo Barros (1):
crypto: more robust crypto_memneq
Champion Chen (1):
Bluetooth: Fix issue with USB suspend in btusb driver
Chao Yu (1):
ecryptfs: avoid to access NULL pointer when write metadata in xattr
Chris Mason (1):
Btrfs: fix kfree on list_head in btrfs_lookup_csums_range error
cleanup
Christian Borntraeger (1):
KVM: s390: unintended fallthrough for external call
Christoph Hellwig (1):
scsi: only re-lock door after EH on devices that were reset
Cong Wang (1):
freezer: Do not freeze tasks killed by OOM killer
Cyril Brulebois (1):
wireless: rt2x00: add new rt2800usb device
Dan Williams (1):
USB: option: add Haier CE81B CDMA modem
Daniel Borkmann (1):
random: add and use memzero_explicit() for clearing data
Daniele Palmas (1):
usb: option: add support for Telit LE910
Darrick J. Wong (1):
ext4: check EA value offset when loading
Dave Hansen (1):
x86: Require exact match for 'noxsave' command line option
David Daney (1):
MIPS: tlbex: Properly fix HUGE TLB Refill exception handler
David Matlack (2):
kvm: x86: fix stale mmio cache bug
kvm: don't take vcpu mutex for obviously invalid vcpu ioctls
David Rientjes (1):
mm, thp: fix collapsing of hugepages on madvise
Dirk Brandewie (1):
cpufreq: expose scaling_cur_freq sysfs file for set_policy() drivers
Dmitry Kasatkin (1):
evm: check xattr value length and type in evm_inode_setxattr()
Dmitry Torokhov (1):
Input: synaptics - gate forcepad support by DMI check
Douglas Lehr (1):
PCI: Increase IBM ipr SAS Crocodile BARs to at least system page size
Eric Sandeen (1):
ext4: fix reservation overflow in ext4_da_write_begin
Eric W. Biederman (1):
mnt: Prevent pivot_root from creating a loop in the mount tree
Fabio Estevam (1):
ASoC: sgtl5000: Fix SMALL_POP bit definition
Felipe Balbi (1):
usb: dwc3: gadget: fix set_halt() bug with pending transfers
Frans Klaver (1):
usb: serial: ftdi_sio: add Awinda Station and Dongle products
Geert Uytterhoeven (1):
m68k: Disable/restore interrupts in hwreg_present()/hwreg_write()
Grant Likely (1):
of: Fix overflow bug in string property parsing functions
Guenter Roeck (1):
Revert "percpu: free percpu allocation info for uniprocessor system"
Hans de Goede (5):
Input: i8042 - add noloop quirk for Asus X750LN
Input: i8042 - quirks for Fujitsu Lifebook A544 and Lifebook AH544
samsung-laptop: Add broken-acpi-video quirk for NC210/NC110
acer-wmi: Add acpi_backlight=video quirk for the Acer KAV80
usb: Do not allow usb_alloc_streams on unconfigured devices
Heinz Mauelshagen (1):
dm raid: ensure superblock's size matches device's logical block size
Herbert Xu (1):
macvtap: Fix csum_start when VLAN tags are present
Huacai Chen (1):
MIPS: tlbex: Fix a missing statement for HUGETLB
Ilya Dryomov (1):
libceph: do not crash on large auth tickets
Imre Deak (2):
PM / Sleep: fix recovery during resuming from hibernation tty/vt: don't set font mappings on vc not supporting this
J. Bruce Fields (1):
nfsd4: fix crash on unknown operation number
Jack Pham (1):
usb: dwc3: gadget: Properly initialize LINK TRB
James Ralston (1):
ahci: Add Device IDs for Intel Sunrise Point PCH
Jan Kara (11):
ext4: don't check quota format when there are no quota files
vfs: fix data corruption when blocksize < pagesize for mmaped data
ext3: Don't check quota format when there are no quota files
scsi: Fix error handling in SCSI_IOCTL_SEND_COMMAND lib/bitmap.c: fix undefined shift in __bitmap_shift_{left|right}()
ext4: fix overflow when updating superblock backups after resize
ext4: fix oops when loading block bitmap failed
ext4: bail out from make_indexed_dir() on first error
block: Fix computation of merged request priority
nfs: Fix use of uninitialized variable in nfs_getattr()
mm: Remove false WARN_ON from pagecache_isize_extended()
Joe Savage (1):
USB: serial: cp210x: added Ketra N1 wireless interface support
Joe Thornber (1):
dm bufio: update last_accessed when relinking a buffer
Johan Hedberg (1):
Bluetooth: Fix setting correct security level when initiating SMP
Johan Hovold (5):
USB: kobil_sct: fix non-atomic allocation in write path
USB: opticon: fix non-atomic allocation in write path
USB: cdc-acm: add device id for GW Instek AFG-2225
USB: core: add device-qualifier quirk
USB: cdc-acm: only raise DTR on transitions from B0
Johannes Berg (2):
mac80211: properly flush delayed scan work on interface removal
mac80211: fix use-after-free in defragmentation
Jonathan Cameron (1):
staging:iio:impedance-analyzer:ad5933 unwind use of IIO_CHAN macro.
K. Y. Srinivasan (5):
Drivers: hv: vmbus: Cleanup vmbus_post_msg()
Drivers: hv: vmbus: Cleanup vmbus_teardown_gpadl()
Drivers: hv: vmbus: Cleanup vmbus_establish_gpadl()
Drivers: hv: vmbus: Fix a bug in vmbus_open()
Drivers: hv: vmbus: Cleanup vmbus_close_internal()
Kees Cook (1):
firmware_class: make sure fw requests contain a name
Krzysztof Kozlowski (1):
power: charger-manager: Fix NULL pointer exception with missing
cm-fuel-gauge
Kuninori Morimoto (1):
ASoC: fsi: remove unsupported PAUSE flag
Lars-Peter Clausen (2):
staging:iio:ad5933: Drop "raw" from channel names staging:iio:ade7758: Fix check if channels are enabled in prenable
Lu Baolu (1):
USB: Add device quirk for ASUS T100 Base Station keyboard
Mathias Krause (1):
posix-timers: Fix stack info leak in timer_create()
Max Filippov (1):
xtensa: re-wire umount syscall to sys_oldumount
Michael S. Tsirkin (2):
virtio_pci: fix virtio spec compliance on restore
kvm: x86: don't kill guest on unknown exit reason
Michal Hocko (1):
OOM, PM: OOM killed task shouldn't escape PM suspend
Mike Snitzer (1):
block: fix alignment_offset math that assumes io_min is a power-of-2
Miklos Szeredi (1):
audit: keep inode pinned
Mikulas Patocka (3):
framebuffer: fix border color
fs: make cont_expand_zero interruptible
dm bufio: change __GFP_IO to __GFP_FS in shrinker callbacks
Nadav Amit (5):
KVM: x86: Check non-canonical addresses upon WRMSR
KVM: x86: Fix wrong masking on relative jump/call
KVM: x86: Emulator fixes for eip canonical checks on near branches
KVM: x86: Handle errors when RIP is set during far jumps
KVM: x86: Fix uninitialized op->type for some immediate values
Nadav Har'El (1):
nEPT: Nested INVEPT
Nathaniel Ting (1):
USB: serial: cp210x: add Silicon Labs 358x VID and PID
Oleg Nesterov (2):
kernel/fork.c:copy_process(): unify
CLONE_THREAD-or-thread_group_leader code
introduce for_each_thread() to replace the buggy while_each_thread()
Oliver Neukum (1):
xhci: no switching back on non-ULT Haswell
Ondrej Zary (1):
libata-sff: Fix controllers with no ctl port
Pali Rohár (2):
Input: alps - ignore potential bare packets when device is out of sync
Input: alps - allow up to 2 invalid packets without resetting device
Paolo Bonzini (1):
KVM: x86: use new CS.RPL as CPL during task switch
Patrick Riphagen (2):
USB: serial: ftdi_sio: Annotate the current Xsens PID assignments
USB: serial: ftdi_sio: Add support for new Xsens devices
Perry Hung (1):
usb: serial: ftdi_sio: add "bricked" FTDI device PID
Peter Hurley (3):
serial: Fix divide-by-zero fault in uart_get_divisor()
tty: Fix high cpu load if tty is unreleaseable
tty: Prevent "read/write wait queue active!" log flooding
Petr Matousek (1):
kvm: vmx: handle invvpid vm exit gracefully
Quentin Casasnovas (1):
kvm: fix excessive pages un-pinning in kvm_iommu_map error path.
Quinn Tran (1):
target: Fix queue full status NULL pointer for
SCF_TRANSPORT_TASK_SENSE
Rabin Vincent (1):
tracing/syscalls: Ignore numbers outside NR_syscalls' range
Ray Jui (1):
spi: pl022: Fix incorrect dma_unmap_sg
Ricardo Ribalda Delgado (1):
PCI: Generate uppercase hex for modalias interface class
Sasha Levin (1):
kernel: add support for gcc 5
Scott Carter (1):
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE
Controller
Sinclair Yeh (1):
drm/vmwgfx: Filter out modes those cannot be supported by the current
VRAM size.
Stanislaw Gruszka (2):
rt2800: correct BBP1_TX_POWER_CTRL mask
rt2x00: do not align payload on modern H/W
Stefan Richter (1):
firewire: cdev: prevent kernel stack leaking into ioctl arguments
Stephen Smalley (1):
selinux: fix inode security list corruption
Takashi Iwai (3):
ALSA: emu10k1: Fix deadlock in synth voice lookup
ALSA: pcm: Zero-clear reserved fields of PCM status ioctl in compat
mode
ALSA: usb-audio: Fix device_del() sysfs warnings at disconnect
Tetsuo Handa (1):
fs: Fix theoretical division by 0 in super_cache_scan().
Theodore Ts'o (2):
ext4: don't orphan or truncate the boot loader inode
ext4: add ext4_iget_normal() which is to be used for dir tree lookups
Thomas Körper (1):
can: dev: avoid calling kfree_skb() from interrupt context
Trond Myklebust (2):
NFSv4: fix open/lock state recovery error handling
NFSv4: Ensure that we remove NFSv4.0 delegations when state has
expired
Vlad Catoi (1):
ALSA: usb-audio: Add support for Steinberg UR22 USB interface
Wang Nan (1):
cgroup/kmemleak: add kmemleak_free() for cgroup deallocations.
Will Deacon (2):
zap_pte_range: update addr when forcing flush after TLB batching
faiure
tracing/syscalls: Fix perf syscall tracing when syscall_nr == -1
Willy Tarreau (3):
Documentation: lzo: document part of the encoding Revert "lzo: properly check for overruns"
lzo: check for length overrun in variable length encoding.
Xiubo Li (2):
regmap: debugfs: fix possbile NULL pointer dereference
regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.
Yann Droneaud (1):
fanotify: enable close-on-exec on events' fd when requested in
fanotify_init()
Yijing Wang (1):
sysfs: driver core: Fix glue dir race condition by gdp_mutex
Documentation/lzo.txt | 164 +++++++++++++++ arch/m68k/mm/hwtest.c | 6 + arch/mips/mm/tlbex.c | 5 + arch/mips/oprofile/backtrace.c | 2 +- arch/powerpc/kernel/entry_64.S | 6 + arch/s390/kvm/interrupt.c | 1 + arch/x86/include/asm/elf.h | 5 +- arch/x86/include/asm/kvm_host.h | 17 +- arch/x86/include/asm/page_32_types.h | 1 - arch/x86/include/asm/page_64_types.h | 11 +- arch/x86/include/asm/vmx.h | 2 + arch/x86/kernel/apic/apic.c | 4 +- arch/x86/kernel/cpu/common.c | 2 + arch/x86/kernel/cpu/intel.c | 15 ++ arch/x86/kernel/dumpstack_64.c | 1 - arch/x86/kernel/entry_64.S | 84 ++------ arch/x86/kernel/kvm.c | 9 +- arch/x86/kernel/kvmclock.c | 1 - arch/x86/kernel/tls.c | 23 +++ arch/x86/kernel/traps.c | 69 +++++-- arch/x86/kernel/tsc.c | 5 +- arch/x86/kvm/emulate.c | 257 +++++++++++++++++------- arch/x86/kvm/i8254.c | 2 + arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/svm.c | 8 +- arch/x86/kvm/vmx.c | 51 ++++- arch/x86/kvm/x86.c | 38 +++- arch/x86/kvm/x86.h | 20 +- arch/xtensa/include/asm/unistd.h | 3 +- block/blk-settings.c | 4 +- block/scsi_ioctl.c | 3 +- drivers/ata/ahci.c | 5 + drivers/ata/libata-sff.c | 20 +- drivers/ata/pata_serverworks.c | 13 +- drivers/base/core.c | 4 +- drivers/base/firmware_class.c | 3 + drivers/base/regmap/regmap-debugfs.c | 7 +- drivers/base/regmap/regmap.c | 5 + drivers/bluetooth/btusb.c | 9 + drivers/char/random.c | 10 +- drivers/cpufreq/cpufreq.c | 23 ++- drivers/edac/mpc85xx_edac.c | 3 +- drivers/firewire/core-cdev.c | 3 +- drivers/gpu/drm/radeon/evergreen.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 16 +- drivers/hv/channel.c | 47 +++-- drivers/hv/connection.c | 17 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 8 + drivers/input/mouse/alps.c | 11 +- drivers/input/mouse/synaptics.c | 22 +- drivers/input/mouse/synaptics.h | 8 +- drivers/input/serio/i8042-x86ia64io.h | 22 ++ drivers/md/dm-bufio.c | 11 +- drivers/md/dm-log-userspace-transfer.c | 2 +- drivers/md/dm-raid.c | 11 +- drivers/net/can/dev.c | 2 +- drivers/net/can/usb/esd_usb2.c | 1 + drivers/net/macvtap.c | 2 + drivers/net/ppp/ppp_generic.c | 2 +- drivers/net/wireless/rt2x00/rt2800.h | 2 +- drivers/net/wireless/rt2x00/rt2800usb.c | 1 + drivers/net/wireless/rt2x00/rt2x00queue.c | 50 ++--- drivers/of/address.c | 19 +- drivers/of/base.c | 88 ++------ drivers/of/selftest.c | 64 +++++- drivers/pci/hotplug/pciehp_core.c | 7 + drivers/pci/pci-sysfs.c | 2 +- drivers/pci/quirks.c | 20 ++ drivers/platform/x86/acer-wmi.c | 11 + drivers/platform/x86/samsung-laptop.c | 10 + drivers/power/charger-manager.c | 5 + drivers/scsi/scsi_error.c | 4 +- drivers/spi/spi-dw-mid.c | 7 +- drivers/spi/spi-pl022.c | 2 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 47 ++++- drivers/staging/iio/meter/ade7758_ring.c | 2 +- drivers/target/target_core_transport.c | 3 +- drivers/tty/serial/8250/8250_pci.c | 21 ++ drivers/tty/serial/serial_core.c | 2 +- drivers/tty/tty_io.c | 13 +- drivers/tty/vt/consolemap.c | 4 + drivers/usb/class/cdc-acm.c | 6 +- drivers/usb/core/hcd.c | 2 + drivers/usb/core/hub.c | 9 +- drivers/usb/core/quirks.c | 10 + drivers/usb/dwc3/ep0.c | 4 +- drivers/usb/dwc3/gadget.c | 17 +- drivers/usb/dwc3/gadget.h | 2 +- drivers/usb/host/xhci-pci.c | 14 -- drivers/usb/serial/cp210x.c | 3 + drivers/usb/serial/ftdi_sio.c | 5 + drivers/usb/serial/ftdi_sio_ids.h | 23 ++- drivers/usb/serial/kobil_sct.c | 4 +- drivers/usb/serial/opticon.c | 2 +- drivers/usb/serial/option.c | 10 + drivers/usb/storage/transport.c | 26 +++ drivers/video/console/bitblit.c | 3 +- drivers/video/console/fbcon_ccw.c | 3 +- drivers/video/console/fbcon_cw.c | 3 +- drivers/video/console/fbcon_ud.c | 3 +- drivers/virtio/virtio_pci.c | 33 ++- fs/btrfs/file-item.c | 2 +- fs/buffer.c | 8 + fs/ecryptfs/inode.c | 2 +- fs/ext3/super.c | 7 - fs/ext4/ext4.h | 1 + fs/ext4/ialloc.c | 4 + fs/ext4/inode.c | 32 ++- fs/ext4/namei.c | 33 +-- fs/ext4/resize.c | 2 +- fs/ext4/super.c | 9 +- fs/ext4/xattr.c | 32 ++- fs/ioprio.c | 14 +- fs/lockd/mon.c | 6 + fs/namespace.c | 3 + fs/nfs/inode.c | 2 +- fs/nfs/nfs4proc.c | 26 ++- fs/nfs/nfs4renewd.c | 12 +- fs/nfs/nfs4state.c | 16 +- fs/nfsd/nfs4proc.c | 3 +- fs/notify/fanotify/fanotify_user.c | 2 +- fs/super.c | 2 + fs/ubifs/commit.c | 10 +- fs/ubifs/log.c | 19 +- fs/ubifs/master.c | 7 +- fs/ubifs/super.c | 1 - fs/ubifs/ubifs.h | 2 - include/drm/drm_pciids.h | 1 - include/linux/blkdev.h | 5 +- include/linux/compiler-gcc.h | 3 + include/linux/compiler-gcc5.h | 66 ++++++ include/linux/compiler-intel.h | 7 + include/linux/init_task.h | 2 + include/linux/khugepaged.h | 17 +- include/linux/mm.h | 1 + include/linux/of.h | 84 ++++++-- include/linux/oom.h | 4 + include/linux/sched.h | 12 ++ include/linux/string.h | 4 +- include/linux/usb/quirks.h | 6 + kernel/audit_tree.c | 1 + kernel/exit.c | 1 + kernel/fork.c | 22 +- kernel/freezer.c | 3 + kernel/futex.c | 24 ++- kernel/posix-timers.c | 1 + kernel/power/hibernate.c | 8 +- kernel/power/process.c | 40 +++- kernel/trace/trace_syscalls.c | 8 +- lib/bitmap.c | 8 +- lib/lzo/lzo1x_decompress_safe.c | 103 +++++----- lib/string.c | 16 ++ mm/huge_memory.c | 11 +- mm/memory.c | 4 +- mm/mmap.c | 8 +- mm/oom_kill.c | 17 ++ mm/page_alloc.c | 8 + mm/page_cgroup.c | 1 + mm/percpu.c | 2 - mm/truncate.c | 61 +++++- net/bluetooth/smp.c | 5 +- net/ceph/crypto.c | 169 ++++++++++++---- net/mac80211/iface.c | 7 +- net/mac80211/rx.c | 14 +- security/integrity/evm/evm_main.c | 9 +- security/selinux/hooks.c | 2 +- sound/core/pcm_compat.c | 2 + sound/core/pcm_native.c | 2 +- sound/pci/emu10k1/emu10k1_callback.c | 6 +- sound/soc/codecs/sgtl5000.c | 3 +- sound/soc/codecs/sgtl5000.h | 2 +- sound/soc/sh/fsi.c | 3 +- sound/usb/card.c | 9 +- sound/usb/quirks-table.h | 30 +++ virt/kvm/iommu.c | 8 +- virt/kvm/kvm_main.c | 4 + 176 files changed, 2061 insertions(+), 705 deletions(-) create mode 100644 Documentation/lzo.txt create mode 100644 include/linux/compiler-gcc5.h
Signature · 1 line
1.9.1
PATCH 1/91 KVM: s390: Fix user triggerable bug in dead code
From: Christian Borntraeger <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 614a80e474b227cace52fd6e3c790554db8a396e upstream.
In the early days, we had some special handling for the KVM_EXIT_S390_SIEIC exit, but this was gone in 2009 with commit d7b0b5eb3000 (KVM: s390: Make psw available on all exits, not just a subset).
Now this switch statement is just a sanity check for userspace not messing with the kvm_run structure. Unfortunately, this allows userspace to trigger a kernel BUG. Let's just remove this switch statement.
[lizf: Backported to 3.4:
- adjust context
- no KVM_EXIT_S390_TSCH and KVM_EXIT_DEBUG in 3.4]
--- arch/s390/kvm/kvm-s390.c | 11 ----------- 1 file changed, 11 deletions(-)
arch/s390/kvm/kvm-s390.c +0 -11
@@ -566,17 +566,6 @@ rerun_vcpu:BUG_ON (vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] ==NULL ); -switch (kvm_run->exit_reason) { -case KVM_EXIT_S390_SIEIC : -case KVM_EXIT_UNKNOWN : -case KVM_EXIT_INTR : -case KVM_EXIT_S390_RESET : -case KVM_EXIT_S390_UCONTROL : -break ; -default : -BUG (); - } - vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask; vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;if (kvm_run->kvm_dirty_regs &KVM_SYNC_PREFIX ) {
Signature · 1 line
1.9.1
Re: [PATCH 3.4 01/91] KVM: s390: Fix user triggerable bug in dead code
Oops... Please ignore those patches that have been released as 3.4.105. I forgot to remove them when I was preparing patches for 3.4.106.
Quoted 5 lines · On 2015/1/28 12:06, [email protected] wrote:
From: Christian Borntraeger <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
PATCH 1/177 kvm: x86: fix stale mmio cache bug
In reply to [email protected]From: David Matlack <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 56f17dd3fbc44adcdbc3340fe3988ddb833a47a7 upstream.
The following events can lead to an incorrect KVM_EXIT_MMIO bubbling up to userspace:
(1) Guest accesses gpa X without a memory slot. The gfn is cached in struct kvm_vcpu_arch (mmio_gfn). On Intel EPT-enabled hosts, KVM sets the SPTE write-execute-noread so that future accesses cause EPT_MISCONFIGs.
(2) Host userspace creates a memory slot via KVM_SET_USER_MEMORY_REGION covering the page just accessed.
(3) Guest attempts to read or write to gpa X again. On Intel, this generates an EPT_MISCONFIG. The memory slot generation number that was incremented in (2) would normally take care of this but we fast path mmio faults through quickly_check_mmio_pf(), which only checks the per-vcpu mmio cache. Since we hit the cache, KVM passes a KVM_EXIT_MMIO up to userspace.
This patch fixes the issue by using the memslot generation number to validate the mmio cache.
--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/x86.h | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -0
@@ -453,6 +453,7 @@ struct kvm_vcpu_arch {u64 mmio_gva;unsigned access;gfn_t mmio_gfn; +u64 mmio_gen;struct kvm_pmu pmu;
arch/x86/kvm/mmu.c +1 -1
@@ -2842,7 +2842,7 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)if (!VALID_PAGE (vcpu->arch.mmu.root_hpa))return ; -vcpu_clear_mmio_info (vcpu, ~0ul ); +vcpu_clear_mmio_info (vcpu,MMIO_GVA_ANY );kvm_mmu_audit (vcpu,AUDIT_PRE_SYNC );if (vcpu->arch.mmu.root_level ==PT64_ROOT_LEVEL ) {hpa_t root = vcpu->arch.mmu.root_hpa;
arch/x86/kvm/x86.h +15 -5
@@ -78,15 +78,23 @@ static inline void vcpu_cache_mmio_info(struct kvm_vcpu *vcpu, vcpu->arch.mmio_gva = gva &PAGE_MASK ; vcpu->arch.access = access; vcpu->arch.mmio_gfn = gfn; + vcpu->arch.mmio_gen =kvm_memslots (vcpu->kvm)->generation; +} + +static inline bool vcpu_match_mmio_gen (struct kvm_vcpu *vcpu) +{ +return vcpu->arch.mmio_gen ==kvm_memslots (vcpu->kvm)->generation; }/* -* Clear the mmio cache info for the given gva, -* specially, if gva is ~0ul, we clear all mmio cache info. +* Clear the mmio cache info for the given gva. If gva is MMIO_GVA_ANY, we +* clear all mmio cache info. */ +#define MMIO_GVA_ANY (~(gva_t)0) +static inline void vcpu_clear_mmio_info (struct kvm_vcpu *vcpu,gva_t gva) { -if (gva != (~0ul ) && vcpu->arch.mmio_gva != (gva &PAGE_MASK )) +if (gva !=MMIO_GVA_ANY && vcpu->arch.mmio_gva != (gva &PAGE_MASK ))return ; vcpu->arch.mmio_gva =0 ;
@@ -94,7 +102,8 @@ static inline void vcpu_clear_mmio_info(struct kvm_vcpu *vcpu, gva_t gva)static inline bool vcpu_match_mmio_gva (struct kvm_vcpu *vcpu,unsigned long gva) { -if (vcpu->arch.mmio_gva && vcpu->arch.mmio_gva == (gva &PAGE_MASK )) +if (vcpu_match_mmio_gen (vcpu) && vcpu->arch.mmio_gva && + vcpu->arch.mmio_gva == (gva &PAGE_MASK ))return true;return false;
@@ -102,7 +111,8 @@ static inline bool vcpu_match_mmio_gva(struct kvm_vcpu *vcpu, unsigned long gva)static inline bool vcpu_match_mmio_gpa (struct kvm_vcpu *vcpu,gpa_t gpa) { -if (vcpu->arch.mmio_gfn && vcpu->arch.mmio_gfn == gpa >>PAGE_SHIFT ) +if (vcpu_match_mmio_gen (vcpu) && vcpu->arch.mmio_gfn && + vcpu->arch.mmio_gfn == gpa >>PAGE_SHIFT )return true;return false;
Signature · 1 line
1.9.1
PATCH 2/177 UBIFS: remove mst_mutex
In reply to [email protected]From: Artem Bityutskiy <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 07e19dff63e3d5d6500d831e36554ac9b1b0560e upstream.
The 'mst_mutex' is not needed since because 'ubifs_write_master()' is only called on the mount path and commit path. The mount path is sequential and there is no parallelism, and the commit path is also serialized - there is only one commit going on at a time.
--- fs/ubifs/commit.c | 2 -- fs/ubifs/master.c | 7 +++---- fs/ubifs/super.c | 1 - fs/ubifs/ubifs.h | 2 -- 4 files changed, 3 insertions(+), 9 deletions(-)
fs/ubifs/commit.c +0 -2
@@ -174,7 +174,6 @@ static int do_commit(struct ubifs_info *c)if (err) goto out; -mutex_lock (&c->mst_mutex); c->mst_node->cmt_no =cpu_to_le64 (c->cmt_no); c->mst_node->log_lnum =cpu_to_le32 (new_ltail_lnum); c->mst_node->root_lnum =cpu_to_le32 (zroot.lnum);
@@ -204,7 +203,6 @@ static int do_commit(struct ubifs_info *c)else c->mst_node->flags &= ~cpu_to_le32 (UBIFS_MST_NO_ORPHS ); err =ubifs_write_master (c); -mutex_unlock (&c->mst_mutex);if (err) goto out;
fs/ubifs/master.c +3 -4
@@ -352,10 +352,9 @@ int ubifs_read_master(struct ubifs_info *c)* ubifs_write_master - write master node. * @c: UBIFS file-system description object * -* This function writes the master node. The caller has to take the -* @c->mst_mutex lock before calling this function. Returns zero in case of -* success and a negative error code in case of failure. The master node is -* written twice to enable recovery. +* This function writes the master node. Returns zero in case of success and a +* negative error code in case of failure. The master node is written twice to +* enable recovery. */ int ubifs_write_master (struct ubifs_info *c) {
fs/ubifs/super.c +0 -1
@@ -1984,7 +1984,6 @@ static struct ubifs_info *alloc_ubifs_info(struct ubi_volume_desc *ubi)mutex_init (&c->lp_mutex);mutex_init (&c->tnc_mutex);mutex_init (&c->log_mutex); -mutex_init (&c->mst_mutex);mutex_init (&c->umount_mutex);mutex_init (&c->bu_mutex);mutex_init (&c->write_reserve_mutex);
fs/ubifs/ubifs.h +0 -2
@@ -1041,7 +1041,6 @@ struct ubifs_debug_info;* * @mst_node: master node * @mst_offs: offset of valid master node -* @mst_mutex: protects the master node area, @mst_node, and @mst_offs * * @max_bu_buf_len: maximum bulk-read buffer length * @bu_mutex: protects the pre-allocated bulk-read buffer and @c->bu
@@ -1281,7 +1280,6 @@ struct ubifs_info {struct ubifs_mst_node *mst_node;int mst_offs; -struct mutex mst_mutex;int max_bu_buf_len;struct mutex bu_mutex;
Signature · 1 line
1.9.1
PATCH 2/91 regmap: Fix handling of volatile registers for format_write() chips
In reply to [email protected]From: Mark Brown <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 5844a8b9d98ec11ce1d77610daacf3f0a0e14715 upstream.
A previous over-zealous factorisation of code means that we only treat registers as volatile if they are readable. For most devices this is fine since normally most registers can be read and volatility implies readability but for format_write() devices where there is no readback from the hardware and we use volatility to mean simply uncacheability this means that we end up treating all registers as cacheble.
A bigger refactoring of the code to clarify this is in order but as a fix make a minimal change and only check readability when checking volatility if there is no format_write() operation defined for the device.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -48,7 +48,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg)bool regmap_volatile (struct regmap *map,unsigned int reg) { -if (!regmap_readable (map, reg)) +if (!map->format.format_write && !regmap_readable (map, reg))return false;if (map->volatile_reg)
Signature · 1 line
1.9.1
PATCH 3/177 UBIFS: fix a race condition
In reply to [email protected]From: Artem Bityutskiy <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 052c28073ff26f771d44ef33952a41d18dadd255 upstream.
Hu ([email protected]) discovered a race condition which may lead to a situation when UBIFS is unable to mount the file-system after an unclean reboot. The problem is theoretical, though.
In UBIFS, we have the log, which basically a set of LEBs in a certain area. The log has the tail and the head.
Every time user writes data to the file-system, the UBIFS journal grows, and the log grows as well, because we append new reference nodes to the head of the log. So the head moves forward all the time, while the log tail stays at the same position.
At any time, the UBIFS master node points to the tail of the log. When we mount the file-system, we scan the log, and we always start from its tail, because this is where the master node points to. The only occasion when the tail of the log changes is the commit operation.
The commit operation has 2 phases - "commit start" and "commit end". The former is relatively short, and does not involve much I/O. During this phase we mostly just build various in-memory lists of the things which have to be written to the flash media during "commit end" phase.
During the commit start phase, what we do is we "clean" the log. Indeed, the commit operation will index all the data in the journal, so the entire journal "disappears", and therefore the data in the log become unneeded. So we just move the head of the log to the next LEB, and write the CS node there. This LEB will be the tail of the new log when the commit operation finishes.
When the "commit start" phase finishes, users may write more data to the file-system, in parallel with the ongoing "commit end" operation. At this point the log tail was not changed yet, it is the same as it had been before we started the commit. The log head keeps moving forward, though.
The commit operation now needs to write the new master node, and the new master node should point to the new log tail. After this the LEBs between the old log tail and the new log tail can be unmapped and re-used again.
And here is the possible problem. We do 2 operations: (a) We first update the log tail position in memory (see 'ubifs_log_end_commit()'). (b) And then we write the master node (see the big lock of code in 'do_commit()').
But nothing prevents the log head from moving forward between (a) and (b), and the log head may "wrap" now to the old log tail. And when the "wrap" happens, the contends of the log tail gets erased. Now a power cut happens and we are in trouble. We end up with the old master node pointing to the old tail, which was erased. And replay fails because it expects the master node to point to the correct log tail at all times.
This patch merges the abovementioned (a) and (b) operations by moving the master node change code to the 'ubifs_log_end_commit()' function, so that it runs with the log mutex locked, which will prevent the log from being changed benween operations (a) and (b).
--- fs/ubifs/commit.c | 8 +++----- fs/ubifs/log.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-)
fs/ubifs/commit.c +3 -5
@@ -166,10 +166,6 @@ static int do_commit(struct ubifs_info *c) err =ubifs_orphan_end_commit (c);if (err) goto out; - old_ltail_lnum = c->ltail_lnum; - err =ubifs_log_end_commit (c, new_ltail_lnum); -if (err) - goto out; err =dbg_check_old_index (c, &zroot);if (err) goto out;
@@ -202,7 +198,9 @@ static int do_commit(struct ubifs_info *c) c->mst_node->flags |=cpu_to_le32 (UBIFS_MST_NO_ORPHS ); else c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_NO_ORPHS); - err =ubifs_write_master (c); + + old_ltail_lnum = c->ltail_lnum; + err =ubifs_log_end_commit (c, new_ltail_lnum);if (err) goto out;
fs/ubifs/log.c +8 -3
@@ -453,9 +453,9 @@ out:* @ltail_lnum: new log tail LEB number * * This function is called on when the commit operation was finished. It -* moves log tail to new position and unmaps LEBs which contain obsolete data. -* Returns zero in case of success and a negative error code in case of -* failure. +* moves log tail to new position and updates the master node so that it stores +* the new log tail LEB number. Returns zero in case of success and a negative +* error code in case of failure. */ int ubifs_log_end_commit (struct ubifs_info *c,int ltail_lnum) {
@@ -483,7 +483,12 @@ int ubifs_log_end_commit(struct ubifs_info *c, int ltail_lnum)spin_unlock (&c->buds_lock); err =dbg_check_bud_bytes (c); +if (err) + goto out; + err =ubifs_write_master (c); + +out:mutex_unlock (&c->log_mutex);return err; }
Signature · 1 line
1.9.1
PATCH 3/91 drm/i915: Remove bogus __init annotation from DMI callbacks
In reply to [email protected]From: Mathias Krause <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit bbe1c2740d3a25aa1dbe5d842d2ff09cddcdde0a upstream.
The __init annotations for the DMI callback functions are wrong as this code can be called even after the module has been initialized, e.g. like this:
# echo 1 > /sys/bus/pci/devices/0000:00:02.0/remove # modprobe i915 # echo 1 > /sys/bus/pci/rescan
The first command will remove the PCI device from the kernel's device list so the second command won't see it right away. But as it registers a PCI driver it'll see it on the third command. If the system happens to match one of the DMI table entries we'll try to call a function in long released memory and generate an Oops, at best.
Fix this by removing the bogus annotation.
Modpost should have caught that one but it ignores section reference mismatches from the .rodata section. :/
--- drivers/gpu/drm/i915/intel_bios.c | 2 +- drivers/gpu/drm/i915/intel_crt.c | 2 +- drivers/gpu/drm/i915/intel_lvds.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +1 -1
@@ -651,7 +651,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)DRM_DEBUG_KMS ("Set default to SSC at %dMHz\n" , dev_priv->lvds_ssc_freq); } -static int __init intel_no_opregion_vbt_callback (const struct dmi_system_id *id) +static int intel_no_opregion_vbt_callback (const struct dmi_system_id *id) { DRM_DEBUG_KMS("Falling back to manually reading VBT from " "VBIOS ROM for %s\n",
drivers/gpu/drm/i915/intel_crt.c +1 -1
@@ -564,7 +564,7 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { .destroy = intel_encoder_destroy, }; -static int __init intel_no_crt_dmi_callback (const struct dmi_system_id *id) +static int intel_no_crt_dmi_callback (const struct dmi_system_id *id) {DRM_DEBUG_KMS ("Skipping CRT initialization for %s\n" , id->ident);return 1 ;
drivers/gpu/drm/i915/intel_lvds.c +1 -1
@@ -619,7 +619,7 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = { .destroy = intel_encoder_destroy, }; -static int __init intel_no_lvds_dmi_callback (const struct dmi_system_id *id) +static int intel_no_lvds_dmi_callback (const struct dmi_system_id *id) {DRM_DEBUG_KMS ("Skipping LVDS initialization for %s\n" , id->ident);return 1 ;
Signature · 1 line
1.9.1
PATCH 4/177 UBIFS: fix free log space calculation
In reply to [email protected]From: Artem Bityutskiy <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit ba29e721eb2df6df8f33c1f248388bb037a47914 upstream.
Hu (hujianyang <[email protected]>) discovered an issue in the 'empty_log_bytes()' function, which calculates how many bytes are left in the log:
"
If 'c->lhead_lnum + 1 == c->ltail_lnum' and 'c->lhead_offs == c->leb_size', 'h' would equalent to 't' and 'empty_log_bytes()' would return 'c->log_bytes' instead of 0.
"
At this point it is not clear what would be the consequences of this, and whether this may lead to any problems, but this patch addresses the issue just in case.
--- fs/ubifs/log.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ubifs/log.c +6 -2
@@ -110,10 +110,14 @@ static inline long long empty_log_bytes(const struct ubifs_info *c) h = (long long )c->lhead_lnum * c->leb_size + c->lhead_offs; t = (long long )c->ltail_lnum * c->leb_size; -if (h >= t) +if (h > t)return c->log_bytes - h + t; -else +else if (h != t)return t - h; +else if (c->lhead_lnum != c->ltail_lnum) +return 0 ; +else +return c->log_bytes; }/**
Signature · 1 line
1.9.1
PATCH 4/91 get rid of propagate_umount() mistakenly treating slaves as busy.
In reply to [email protected]From: Al Viro <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 88b368f27a094277143d8ecd5a056116f6a41520 upstream.
The check in __propagate_umount() ("has somebody explicitly mounted something on that slave?") is done *before* taking the already doomed victims out of the child lists.
[lizf: Backported to 3.4:
- adjust context
- s/hlist_for_each_entry/list_for_each_entry/]
--- fs/namespace.c | 4 +++- fs/pnode.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
fs/namespace.c +3 -1
@@ -1066,6 +1066,9 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)for (p = mnt; p; p =next_mnt (p, mnt))list_move (&p->mnt_hash, &tmp_list); +list_for_each_entry (p, &tmp_list, mnt_hash) +list_del_init (&p->mnt_child); +if (propagate)propagate_umount (&tmp_list);
@@ -1076,7 +1079,6 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)if (p->mnt_ns)__mnt_make_shortterm (p); p->mnt_ns =NULL ; -list_del_init (&p->mnt_child);if (mnt_has_parent (p)) { p->mnt_parent->mnt_ghosts++;dentry_reset_mounted (p->mnt_mountpoint);
fs/pnode.c +3 -1
@@ -333,8 +333,10 @@ static void __propagate_umount(struct mount *mnt)* umount the child only if the child has no * other children */ -if (child &&list_empty (&child->mnt_mounts)) +if (child &&list_empty (&child->mnt_mounts)) { +list_del_init (&child->mnt_child);list_move_tail (&child->mnt_hash, &mnt->mnt_hash); + } } }
Signature · 1 line
1.9.1
PATCH 5/177 Bluetooth: Fix issue with USB suspend in btusb driver
In reply to [email protected]From: Champion Chen <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 85560c4a828ec9c8573840c9b66487b6ae584768 upstream.
Suspend could fail for some platforms because btusb_suspend==> btusb_stop_traffic ==> usb_kill_anchored_urbs.
When btusb_bulk_complete returns before system suspend and resubmits an URB, the system cannot enter suspend state.
--- drivers/bluetooth/btusb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/bluetooth/btusb.c +9 -0
@@ -304,6 +304,9 @@ static void btusb_intr_complete(struct urb *urb)BT_ERR ("%s corrupted event packet" , hdev->name); hdev->stat.err_rx++; } + }else if (urb->status == -ENOENT ) { +/* Avoid suspend failed when usb_kill_urb */ +return ; }if (!test_bit (BTUSB_INTR_RUNNING , &data->flags))
@@ -392,6 +395,9 @@ static void btusb_bulk_complete(struct urb *urb)BT_ERR ("%s corrupted ACL packet" , hdev->name); hdev->stat.err_rx++; } + }else if (urb->status == -ENOENT ) { +/* Avoid suspend failed when usb_kill_urb */ +return ; }if (!test_bit (BTUSB_BULK_RUNNING , &data->flags))
@@ -486,6 +492,9 @@ static void btusb_isoc_complete(struct urb *urb) hdev->stat.err_rx++; } } + }else if (urb->status == -ENOENT ) { +/* Avoid suspend failed when usb_kill_urb */ +return ; }if (!test_bit (BTUSB_ISOC_RUNNING , &data->flags))
Signature · 1 line
1.9.1
PATCH 5/91 drm/vmwgfx: Fix a potential infinite spin waiting for fifo idle
In reply to [email protected]From: Thomas Hellstrom <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit f01ea0c3d9db536c64d47922716d8b3b8f21d850 upstream.
The code waiting for fifo idle was incorrect and could possibly spin forever under certain circumstances.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +2 -1
@@ -163,8 +163,9 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)mutex_lock (&dev_priv->hw_mutex); +vmw_write (dev_priv,SVGA_REG_SYNC ,SVGA_SYNC_GENERIC );while (vmw_read (dev_priv,SVGA_REG_BUSY ) !=0 ) -vmw_write (dev_priv,SVGA_REG_SYNC ,SVGA_SYNC_GENERIC ); + ; dev_priv->last_read_seqno =ioread32 (fifo_mem +SVGA_FIFO_FENCE );
Signature · 1 line
1.9.1
PATCH 6/91 ALSA: hda - Fix COEF setups for ALC1150 codec
In reply to [email protected]From: Takashi Iwai <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit acf08081adb5e8fe0519eb97bb49797ef52614d6 upstream.
ALC1150 codec seems to need the COEF- and PLL-setups just like its compatible ALC882 codec. Some machines (e.g. SunMicro X10SAT) show the problem like too low output volumes unless the COEF setup is applied.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -811,6 +811,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)case 0x10ec0885 :case 0x10ec0887 :/*case 0x10ec0889:*/ /* this causes an SPDIF problem */ +case 0x10ec0900 :alc889_coef_init (codec);break ;case 0x10ec0888 :
@@ -5516,6 +5517,7 @@ static int patch_alc882(struct hda_codec *codec)switch (codec->vendor_id) {case 0x10ec0882 :case 0x10ec0885 : +case 0x10ec0900 :break ;default :/* ALC883 and variants */
Signature · 1 line
1.9.1
PATCH 6/177 KVM: s390: unintended fallthrough for external call
In reply to [email protected]From: Christian Borntraeger <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit f346026e55f1efd3949a67ddd1dcea7c1b9a615e upstream.
We must not fallthrough if the conditions for external call are not met.
--- arch/s390/kvm/interrupt.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/kvm/interrupt.c +1 -0
@@ -43,6 +43,7 @@ static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu,return 0 ;if (vcpu->arch.sie_block->gcr[0 ] &0x2000ul )return 1 ; +return 0 ;case KVM_S390_INT_EMERGENCY :if (psw_extint_disabled (vcpu))return 0 ;
Signature · 1 line
1.9.1
PATCH 7/91 ACPI / cpuidle: fix deadlock between cpuidle_lock and cpu_hotplug.lock
In reply to [email protected]From: Jiri Kosina <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 6726655dfdd2dc60c035c690d9f10cb69d7ea075 upstream.
There is a following AB-BA dependency between cpu_hotplug.lock and cpuidle_lock:
1) cpu_hotplug.lock -> cpuidle_lockenable_nonboot_cpus()
_cpu_up()
cpu_hotplug_begin()
LOCK(cpu_hotplug.lock)
cpu_notify()
...
acpi_processor_hotplug()
cpuidle_pause_and_lock()
LOCK(cpuidle_lock)
2) cpuidle_lock -> cpu_hotplug.lockacpi_os_execute_deferred() workqueue
...
acpi_processor_cst_has_changed()
cpuidle_pause_and_lock()
LOCK(cpuidle_lock)
get_online_cpus()
LOCK(cpu_hotplug.lock)
Fix this by reversing the order acpi_processor_cst_has_changed() does thigs -- let it first execute the protection against CPU hotplug by calling get_online_cpus() and obtain the cpuidle lock only after that (and perform the symmentric change when allowing CPUs hotplug again and dropping cpuidle lock).
Spotted by lockdep.
--- drivers/acpi/processor_idle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/processor_idle.c +2 -2
@@ -1195,9 +1195,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)if (pr->id ==0 &&cpuidle_get_driver () == &acpi_idle_driver) { -cpuidle_pause_and_lock ();/* Protect against cpu-hotplug */ get_online_cpus (); +cpuidle_pause_and_lock ();/* Disable all cpuidle devices */ for_each_online_cpu (cpu) {
@@ -1222,8 +1222,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)cpuidle_enable_device (&_pr->power.dev); } } -put_online_cpus ();cpuidle_resume_and_unlock (); +put_online_cpus (); }return 0 ;
Signature · 1 line
1.9.1
Re: [PATCH 3.4 07/91] ACPI / cpuidle: fix deadlock between cpuidle_lock and cpu_hotplug.lock
Quoted 3 lines · On Wed, 28 Jan 2015, [email protected] wrote:
From: Jiri Kosina <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
Please don't forget to include followup deadlock fix as well:
https://lkml.org/lkml/2015/1/20/983
Quoted 72 lines
------------------
commit
6726655dfdd2dc60c035c690d9f10cb69d7ea075upstream.There is a following AB-BA dependency between cpu_hotplug.lock and
cpuidle_lock:1) cpu_hotplug.lock ->
cpuidle_lockenable_nonboot_cpus()
_cpu_up()
cpu_hotplug_begin()
LOCK(cpu_hotplug.lock)
cpu_notify()
...
acpi_processor_hotplug()
cpuidle_pause_and_lock()
LOCK(cpuidle_lock)2)
cpuidle_lock-> cpu_hotplug.lockacpi_os_execute_deferred()workqueue
...
acpi_processor_cst_has_changed()
cpuidle_pause_and_lock()
LOCK(cpuidle_lock)
get_online_cpus()
LOCK(cpu_hotplug.lock)Fix this by reversing the order
acpi_processor_cst_has_changed()does thigs -- let it first execute the protection against CPU hotplug by callingget_online_cpus()and obtain the cpuidle lock only after that (and perform the symmentric change when allowing CPUs hotplug again and dropping cpuidle lock).Spotted by lockdep.
Signed-off-by Jiri Kosina <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>Signed-off-by Zefan Li <[email protected]>--- drivers/acpi/processor_idle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/acpi/processor_idle.c +2
-2@@ -1195,9 +1195,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)if (pr->id ==0 &&cpuidle_get_driver () == &acpi_idle_driver) { -cpuidle_pause_and_lock ();/* Protect against cpu-hotplug */ get_online_cpus (); +cpuidle_pause_and_lock ();/* Disable all cpuidle devices */ for_each_online_cpu (cpu) {@@ -1222,8 +1222,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)cpuidle_enable_device (&_pr->power.dev); } } -put_online_cpus ();cpuidle_resume_and_unlock (); +put_online_cpus (); }return 0 ;Signature · 1 line
1.9.1
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: [PATCH 3.4 07/91] ACPI / cpuidle: fix deadlock between cpuidle_lock and cpu_hotplug.lock
Quoted 7 lines · Jiri Kosina
Quoted 3 lines
From: Jiri Kosina <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
Please don't forget to include followup deadlock fix as well:
https://lkml.org/lkml/2015/1/20/983
Err, I responded to a wrong e-mail, ENOTENOUGHCOFEE. Sorry for the noise.
Signature · 2 lines
Jiri Kosina SUSE Labs
PATCH 7/177 PCI: pciehp: Prevent NULL dereference during probe
In reply to [email protected]From: Andreas Noever <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit bceee4a97eb58bd0e80e39eff11b506ddd9e7ad3 upstream.
pciehp assumes that dev->subordinate, the struct pci_bus for a bridge's secondary bus, exists. But we do not create that bus if we run out of bus numbers during enumeration. This leads to a NULL dereference in init_slot() (and other places).
Change pciehp_probe() to return -ENODEV when no secondary bus is present.
--- drivers/pci/hotplug/pciehp_core.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pci/hotplug/pciehp_core.c +7 -0
@@ -237,6 +237,13 @@ static int pciehp_probe(struct pcie_device *dev)else if (pciehp_acpi_slot_detection_check (dev->port)) goto err_out_none; +if (!dev->port->subordinate) { +/* Can happen if we run out of bus numbers during probe */ +dev_err (&dev->device, +"Hotplug bridge without secondary bus, ignoring\n" ); + goto err_out_none; + } + ctrl =pcie_init (dev);if (!ctrl) {dev_err (&dev->device,"Controller initialization failed\n" );
Signature · 1 line
1.9.1
PATCH 8/177 PCI: Increase IBM ipr SAS Crocodile BARs to at least system page size
In reply to [email protected]From: Douglas Lehr <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 9fe373f9997b48fcd6222b95baf4a20c134b587a upstream.
The Crocodile chip occasionally comes up with 4k and 8k BAR sizes. Due to an erratum, setting the SR-IOV page size causes the physical function BARs to expand to the system page size. Since ppc64 uses 64k pages, when Linux tries to assign the smaller resource sizes to the now 64k BARs the address will be truncated and the BARs will overlap.
Force Linux to allocate the resource as a full page, which avoids the overlap.
--- drivers/pci/quirks.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/pci/quirks.c +20 -0
@@ -28,6 +28,7 @@#include <linux/ioport.h> #include <linux/sched.h> #include <linux/ktime.h> +#include <linux/mm.h> #include <asm/dma.h> /* isa_dma_bridge_buggy */ #include "pci.h"
@@ -291,6 +292,25 @@ static void __devinit quirk_citrine(struct pci_dev *dev) }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_IBM ,PCI_DEVICE_ID_IBM_CITRINE , quirk_citrine); +/* On IBM Crocodile ipr SAS adapters, expand BAR to system page size */ +static void quirk_extend_bar_to_page (struct pci_dev *dev) +{ +int i; + +for (i =0 ; i <PCI_STD_RESOURCE_END ; i++) { +struct resource *r = &dev->resource[i]; + +if (r->flags &IORESOURCE_MEM &&resource_size (r) <PAGE_SIZE ) { + r->end =PAGE_SIZE -1 ; + r->start =0 ; + r->flags |=IORESOURCE_UNSET ; +dev_info (&dev->dev,"expanded BAR %d to page size: %pR\n" , + i, r); + } + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_IBM ,0x034a , quirk_extend_bar_to_page); +/* * S3 868 and 968 chips report region size equal to 32M, but they decode 64M. * If it's needed, re-allocate the region.
Signature · 1 line
1.9.1
PATCH 8/91 regulatory: add NUL to alpha2
In reply to [email protected]From: Eliad Peller <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit a5fe8e7695dc3f547e955ad2b662e3e72969e506 upstream.
alpha2 is defined as 2-chars array, but is used in multiple places as string (e.g. with nla_put_string calls), which might leak kernel data.
Solve it by simply adding an extra char for the NULL terminator, making such operations safe.
--- include/net/regulatory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/regulatory.h +1 -1
@@ -97,7 +97,7 @@ struct ieee80211_reg_rule {struct ieee80211_regdomain {u32 n_reg_rules; -char alpha2[2 ]; +char alpha2[3 ];u8 dfs_region;struct ieee80211_reg_rule reg_rules[]; };
Signature · 1 line
1.9.1
PATCH 9/177 Bluetooth: Fix setting correct security level when initiating SMP
In reply to [email protected]From: Johan Hedberg <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 5eb596f55cacc2389554a8d7572d90d5e9d4269d upstream.
We can only determine the final security level when both pairing request and response have been exchanged. When initiating pairing the starting target security level is set to MEDIUM unless explicitly specified to be HIGH, so that we can still perform pairing even if the remote doesn't have MITM capabilities. However, once we've received the pairing response we should re-consult the remote and local IO capabilities and upgrade the target security level if necessary.
Without this patch the resulting Long Term Key will occasionally be reported to be unauthenticated when it in reality is an authenticated one.
--- net/bluetooth/smp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/bluetooth/smp.c +4 -1
@@ -325,8 +325,11 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, }/* Not Just Works/Confirm results in MITM Authentication */ -if (method !=JUST_CFM ) +if (method !=JUST_CFM ) {set_bit (SMP_FLAG_MITM_AUTH , &smp->smp_flags); +if (hcon->pending_sec_level <BT_SECURITY_HIGH ) + hcon->pending_sec_level =BT_SECURITY_HIGH ; + }/* If both devices have Keyoard-Display I/O, the master * Confirms and the slave Enters the passkey.
Signature · 1 line
1.9.1
PATCH 9/91 percpu: fix pcpu_alloc_pages() failure path
In reply to [email protected]From: Tejun Heo <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit f0d279654dea22b7a6ad34b9334aee80cda62cde upstream.
When pcpu_alloc_pages() fails midway, pcpu_free_pages() is invoked to free what has already been allocated. The invocation is across the whole requested range and pcpu_free_pages() will try to free all non-NULL pages; unfortunately, this is incorrect as pcpu_get_pages_and_bitmap(), unlike what its comment suggests, doesn't clear the pages array and thus the array may have entries from the previous invocations making the partial failure path free incorrect pages.
Fix it by open-coding the partial freeing of the already allocated pages.
--- mm/percpu-vm.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
mm/percpu-vm.c +15 -6
@@ -108,7 +108,7 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk, int page_start, int page_end) {const gfp_t gfp =GFP_KERNEL | __GFP_HIGHMEM | __GFP_COLD; -unsigned int cpu; +unsigned int cpu, tcpu;int i;for_each_possible_cpu (cpu) {
@@ -116,14 +116,23 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk,struct page **pagep = &pages[pcpu_page_idx (cpu, i)]; *pagep =alloc_pages_node (cpu_to_node (cpu), gfp,0 ); -if (!*pagep) { -pcpu_free_pages (chunk, pages, populated, - page_start, page_end); -return -ENOMEM ; - } +if (!*pagep) + goto err; } }return 0 ; + +err: +while (--i >= page_start) +__free_page (pages[pcpu_page_idx (cpu, i)]); + +for_each_possible_cpu (tcpu) { +if (tcpu == cpu) +break ; +for (i = page_start; i < page_end; i++) +__free_page (pages[pcpu_page_idx (tcpu, i)]); + } +return -ENOMEM ; }/**
Signature · 1 line
1.9.1
PATCH 10/177 Revert "percpu: free percpu allocation info for uniprocessor system"
In reply to [email protected]From: Guenter Roeck <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit bb2e226b3bef596dd56be97df655d857b4603923 upstream.
This reverts commit 3189eddbcafc ("percpu: free percpu allocation info for uniprocessor system").
The commit causes a hang with a crisv32 image. This may be an architecture problem, but at least for now the revert is necessary to be able to boot a crisv32 image.
--- mm/percpu.c | 2 -- 1 file changed, 2 deletions(-)
mm/percpu.c +0 -2
@@ -1907,8 +1907,6 @@ void __init setup_per_cpu_areas(void)if (pcpu_setup_first_chunk (ai, fc) <0 ) panic("Failed to initialize percpu areas."); - - pcpu_free_alloc_info(ai); }#endif /* CONFIG_SMP */
Signature · 1 line
1.9.1
PATCH 10/91 percpu: perform tlb flush after pcpu_map_pages() failure
In reply to [email protected]From: Tejun Heo <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 849f5169097e1ba35b90ac9df76b5bb6f9c0aabd upstream.
If pcpu_map_pages() fails midway, it unmaps the already mapped pages. Currently, it doesn't flush tlb after the partial unmapping. This may be okay in most cases as the established mapping hasn't been used at that point but it can go wrong and when it goes wrong it'd be extremely difficult to track down.
Flush tlb after the partial unmapping.
--- mm/percpu-vm.c | 1 + 1 file changed, 1 insertion(+)
mm/percpu-vm.c +1 -0
@@ -272,6 +272,7 @@ err:__pcpu_unmap_pages (pcpu_chunk_addr (chunk, tcpu, page_start), page_end - page_start); } +pcpu_post_unmap_tlb_flush (chunk, page_start, page_end);return err; }
Signature · 1 line
1.9.1
PATCH 11/177 USB: serial: cp210x: added Ketra N1 wireless interface support
In reply to [email protected]From: Joe Savage <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit bfc2d7dfdd761ae3beccdb26abebe03cef042f46 upstream.
Added support for Ketra N1 wireless interface, which uses the Silicon Labs' CP2104 USB to UART bridge with customized PID 8946.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -128,6 +128,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ + { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
Signature · 1 line
1.9.1
PATCH 11/91 percpu: free percpu allocation info for uniprocessor system
In reply to [email protected]From: Honggang Li <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 3189eddbcafcc4d827f7f19facbeddec4424eba8 upstream.
Currently, only SMP system free the percpu allocation info. Uniprocessor system should free it too. For example, one x86 UML virtual machine with 256MB memory, UML kernel wastes one page memory.
--- mm/percpu.c | 2 ++ 1 file changed, 2 insertions(+)
mm/percpu.c +2 -0
@@ -1907,6 +1907,8 @@ void __init setup_per_cpu_areas(void)if (pcpu_setup_first_chunk (ai, fc) <0 )panic ("Failed to initialize percpu areas." ); + + pcpu_free_alloc_info(ai); }#endif /* CONFIG_SMP */
Signature · 1 line
1.9.1
PATCH 12/177 USB: cp210x: add support for Seluxit USB dongle
In reply to [email protected]From: Andreas Bomholtz <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit dee80ad12d2b1b304286a707fde7ab05d1fc7bab upstream.
Added the Seluxit ApS USB Serial Dongle to cp210x driver.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -162,6 +162,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ + { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ { USB_DEVICE(0x1FB9, 0x0100) }, /* Lake Shore Model 121 Current Source */
Signature · 1 line
1.9.1
PATCH 12/91 cgroup: reject cgroup names with ' '
In reply to [email protected]From: Alban Crequy <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 71b1fb5c4473a5b1e601d41b109bdfe001ec82e0 upstream.
/proc/<pid>/cgroup contains one cgroup path on each line. If cgroup names are allowed to contain "\n", applications cannot parse /proc/<pid>/cgroup safely.
[lizf: Backported to 3.4:
- adjust context
- s/name/dentry->d_name.name/]
--- kernel/cgroup.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/cgroup.c +5 -0
@@ -3838,6 +3838,11 @@ static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) {struct cgroup *c_parent = dentry->d_parent->d_fsdata; +/* Do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable. +*/ +if (strchr (dentry->d_name.name,'\n' )) +return -EINVAL ; +/* the vfs holds inode->i_mutex already */ return cgroup_create (c_parent, dentry, mode |S_IFDIR ); }
Signature · 1 line
1.9.1
PATCH 13/177 PCI: Generate uppercase hex for modalias interface class
In reply to [email protected]From: Ricardo Ribalda Delgado <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 89ec3dcf17fd3fa009ecf8faaba36828dd6bc416 upstream.
Some implementations of modprobe fail to load the driver for a PCI device automatically because the "interface" part of the modalias from the kernel is lowercase, and the modalias from file2alias is uppercase.
The "interface" is the low-order byte of the Class Code, defined in PCI r3.0, Appendix D. Most interface types defined in the spec do not use alpha characters, so they won't be affected. For example, 00h, 01h, 10h, 20h, etc. are unaffected.
Print the "interface" byte of the Class Code in uppercase hex, as we already do for the Vendor ID, Device ID, Class, etc.
--- drivers/pci/pci-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +1 -1
@@ -173,7 +173,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, {struct pci_dev *pci_dev =to_pci_dev (dev); - return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x\n", + return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X\n", pci_dev->vendor, pci_dev->device, pci_dev->subsystem_vendor, pci_dev->subsystem_device, (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
Signature · 1 line
1.9.1
PATCH 13/91 rtlwifi: rtl8192cu: Add new ID
In reply to [email protected]From: Larry Finger <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c66517165610b911e4c6d268f28d8c640832dbd1 upstream.
The Sitecom WLA-2102 adapter uses this driver.
--- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +1 -0
@@ -306,6 +306,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ + {RTL_USB_DEVICE(0x0df6, 0x0070, rtl92cu_hal_cfg)}, /*Sitecom - 150N */ {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/
Signature · 1 line
1.9.1
PATCH 14/177 USB: Add device quirk for ASUS T100 Base Station keyboard
In reply to [email protected]From: Lu Baolu <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit ddbe1fca0bcb87ca8c199ea873a456ca8a948567 upstream.
This full-speed USB device generates spurious remote wakeup event as soon as USB_DEVICE_REMOTE_WAKEUP feature is set. As the result, Linux can't enter system suspend and S0ix power saving modes once this keyboard is used.
This patch tries to introduce USB_QUIRK_IGNORE_REMOTE_WAKEUP quirk. With this quirk set, wakeup capability will be ignored during device configure.
This patch could be back-ported to kernels as old as 2.6.39.
--- drivers/usb/core/hub.c | 6 ++++-- drivers/usb/core/quirks.c | 4 ++++ include/linux/usb/quirks.h | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +4 -2
@@ -1638,8 +1638,10 @@ void usb_set_device_state(struct usb_device *udev, || new_state == USB_STATE_SUSPENDED) ;/* No change to wakeup settings */ else if (new_state == USB_STATE_CONFIGURED) - wakeup = udev->actconfig->desc.bmAttributes - &USB_CONFIG_ATT_WAKEUP ; + wakeup = (udev->quirks & +USB_QUIRK_IGNORE_REMOTE_WAKEUP ) ?0 : + udev->actconfig->desc.bmAttributes & +USB_CONFIG_ATT_WAKEUP ; else wakeup =0 ; }
drivers/usb/core/quirks.c +4 -0
@@ -158,6 +158,10 @@ static const struct usb_device_id usb_interface_quirk_list[] = { { USB_VENDOR_AND_INTERFACE_INFO(0x046d, USB_CLASS_VIDEO, 1, 0), .driver_info = USB_QUIRK_RESET_RESUME }, + /* ASUS Base Station(T100) */ + { USB_DEVICE(0x0b05, 0x17e0), .driver_info = + USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + { } /* terminating entry must be last */ };
include/linux/usb/quirks.h +3 -0
@@ -30,4 +30,7 @@descriptor */ #define USB_QUIRK_DELAY_INIT 0x00000040 +/* device generates spurious wakeup, ignore remote wakeup capability */ +#define USB_QUIRK_IGNORE_REMOTE_WAKEUP 0x00000200 +#endif /* __LINUX_USB_QUIRKS_H */
Signature · 1 line
1.9.1
PATCH 14/91 ahci: Add Device IDs for Intel 9 Series PCH
In reply to [email protected]From: James Ralston <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 1b071a0947dbce5c184c12262e02540fbc493457 upstream.
This patch adds the AHCI mode SATA Device IDs for the Intel 9 Series PCH.
--- drivers/ata/ahci.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/ata/ahci.c +8 -0
@@ -305,6 +305,14 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ + { PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */ + { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series AHCI */ + { PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */ + { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series RAID */ + { PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */ + { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ + { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ + { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID *//* JMicron 360/1/3/5/6, match class to avoid IDE function */ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
Signature · 1 line
1.9.1
PATCH 15/91 ata_piix: Add Device IDs for Intel 9 Series PCH
In reply to [email protected]From: James Ralston <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 6cad1376954e591c3c41500c4e586e183e7ffe6d upstream.
This patch adds the IDE mode SATA Device IDs for the Intel 9 Series PCH.
--- drivers/ata/ata_piix.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/ata/ata_piix.c +8 -0
@@ -362,6 +362,14 @@ static const struct pci_device_id piix_pci_tbl[] = { { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt },/* SATA Controller IDE (Coleto Creek) */ { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, +/* SATA Controller IDE (9 Series) */ + { 0x8086, 0x8c88, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, +/* SATA Controller IDE (9 Series) */ + { 0x8086, 0x8c89, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, +/* SATA Controller IDE (9 Series) */ + { 0x8086, 0x8c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, +/* SATA Controller IDE (9 Series) */ + { 0x8086, 0x8c81, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, { } /* terminate list */ };
Signature · 1 line
1.9.1
PATCH 15/177 firmware_class: make sure fw requests contain a name
In reply to [email protected]From: Kees Cook <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 471b095dfe0d693a8d624cbc716d1ee4d74eb437 upstream.
An empty firmware request name will trigger warnings when building device names. Make sure this is caught earlier and rejected.
The warning was visible via the test_firmware.ko module interface:
echo -ne "\x00" > /sys/devices/virtual/misc/test_firmware/trigger_request
--- drivers/base/firmware_class.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/firmware_class.c +3 -0
@@ -588,6 +588,9 @@ request_firmware(const struct firmware **firmware_p, const char *name,struct firmware_priv *fw_priv;int ret; +if (!name || name[0 ] =='\0' ) +return -EINVAL ; + fw_priv =_request_firmware_prepare (firmware_p, name, device, true, false);if (IS_ERR_OR_NULL (fw_priv))
Signature · 1 line
1.9.1
PATCH 16/177 Drivers: hv: vmbus: Cleanup vmbus_post_msg()
In reply to [email protected]From: "K. Y. Srinivasan" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit fdeebcc62279119dbeafbc1a2e39e773839025fd upstream.
Posting messages to the host can fail because of transient resource related failures. Correctly deal with these failures and increase the number of attempts to post the message before giving up.
In this version of the patch, I have normalized the error code to Linux error code.
--- drivers/hv/connection.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/hv/connection.c +14 -3
@@ -294,10 +294,21 @@ int vmbus_post_msg(void *buffer, size_t buflen)* insufficient resources. Retry the operation a couple of * times before giving up. */ -while (retries <3 ) { - ret =hv_post_message (conn_id,1 , buffer, buflen); -if (ret !=HV_STATUS_INSUFFICIENT_BUFFERS ) +while (retries <10 ) { + ret =hv_post_message (conn_id,1 , buffer, buflen); + +switch (ret) { +case HV_STATUS_INSUFFICIENT_BUFFERS : + ret = -ENOMEM ; +case -ENOMEM : +break ; +case HV_STATUS_SUCCESS :return ret; +default : +pr_err ("hv_post_msg() failed; error code:%d\n" , ret); +return -EINVAL ; + } + retries++;msleep (100 ); }
Signature · 1 line
1.9.1
PATCH 16/91 USB: ftdi_sio: add support for NOVITUS Bono E thermal printer
In reply to [email protected]From: Johan Hovold <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit ee444609dbae8afee420c3243ce4c5f442efb622 upstream.
Add device id for NOVITUS Bono E thermal printer.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -750,6 +750,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, + { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) },
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -828,6 +828,12 @@#define TELLDUS_TELLSTICK_PID 0x0C30/* RF control dongle 433 MHz using FT232RL */ /* +* NOVITUS printers +*/ +#define NOVITUS_VID 0x1a28 +#define NOVITUS_BONO_E_PID 0x6010 + +/* * RT Systems programming cables for various ham radios */ #define RTSYSTEMS_VID 0x2100/* Vendor ID */
Signature · 1 line
1.9.1
PATCH 17/177 Drivers: hv: vmbus: Cleanup vmbus_teardown_gpadl()
In reply to [email protected]From: "K. Y. Srinivasan" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 66be653083057358724d56d817e870e53fb81ca7 upstream.
Eliminate calls to BUG_ON() by properly handling errors. In cases where rollback is possible, we will return the appropriate error to have the calling code decide how to rollback state. In the case where we are transferring ownership of the guest physical pages to the host, we will wait for the host to respond.
--- drivers/hv/channel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/hv/channel.c +6 -5
@@ -472,7 +472,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)struct vmbus_channel_gpadl_teardown *msg;struct vmbus_channel_msginfo *info;unsigned long flags; -int ret, t; +int ret; info =kmalloc (sizeof (*info) +sizeof (struct vmbus_channel_gpadl_teardown ),GFP_KERNEL );
@@ -494,11 +494,12 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) ret =vmbus_post_msg (msg,sizeof (struct vmbus_channel_gpadl_teardown )); -BUG_ON (ret !=0 ); - t =wait_for_completion_timeout (&info->waitevent,5 *HZ ); -BUG_ON (t ==0 ); +if (ret) + goto post_msg_err; + +wait_for_completion (&info->waitevent); -/* Received a torndown response */ +post_msg_err:spin_lock_irqsave (&vmbus_connection.channelmsg_lock, flags);list_del (&info->msglistentry);spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags);
Signature · 1 line
1.9.1
PATCH 17/91 USB: sierra: avoid CDC class functions on "68A3" devices
In reply to [email protected]From: Bjørn Mork <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 049255f51644c1105775af228396d187402a5934 upstream.
Sierra Wireless Direct IP devices using the 68A3 product ID can be configured for modes including a CDC ECM class function. The known example uses interface numbers 12 and 13 for the ECM control and data interfaces respectively, consistent with CDC MBIM function interface numbering on other Sierra devices.
It seems cleaner to restrict this driver to the ff/ff/ff vendor specific interfaces rather than increasing the already long interface number blacklist. This should be more future proof if Sierra adds more class functions using interface numbers not yet in the blacklist.
--- drivers/usb/serial/sierra.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/serial/sierra.c +4 -2
@@ -296,14 +296,16 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */ .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist }, - { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ +/* Sierra Wireless Direct IP modems */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68A3, 0xFF, 0xFF, 0xFF), .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist },/* AT&T Direct IP LTE modems */ { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist }, - { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ +/* Airprime/Sierra Wireless Direct IP modems */ + { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68A3, 0xFF, 0xFF, 0xFF), .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist },
Signature · 1 line
1.9.1
PATCH 18/177 Drivers: hv: vmbus: Cleanup vmbus_establish_gpadl()
In reply to [email protected]From: "K. Y. Srinivasan" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 72c6b71c245dac8f371167d97ef471b367d0b66b upstream.
Eliminate the call to BUG_ON() by waiting for the host to respond. We are trying to reclaim the ownership of memory that was given to the host and so we will have to wait until the host responds.
--- drivers/hv/channel.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/hv/channel.c +1 -4
@@ -400,7 +400,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,u32 next_gpadl_handle;unsigned long flags;int ret =0 ; -int t; next_gpadl_handle =atomic_read (&vmbus_connection.next_gpadl_handle);atomic_inc (&vmbus_connection.next_gpadl_handle);
@@ -447,9 +446,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } } - t =wait_for_completion_timeout (&msginfo->waitevent,5 *HZ ); -BUG_ON (t ==0 ); - +wait_for_completion (&msginfo->waitevent);/* At this point, we received the gpadl created msg */ *gpadl_handle = gpadlmsg->gpadl;
Signature · 1 line
1.9.1
PATCH 18/91 USB: sierra: add 1199:68AA device ID
In reply to [email protected]From: Bjørn Mork <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 5b3da69285c143b7ea76b3b9f73099ff1093ab73 upstream.
This VID:PID is used for some Direct IP devices behaving identical to the already supported 0F3D:68AA devices.
--- drivers/usb/serial/sierra.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/sierra.c +3 -0
@@ -300,6 +300,9 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68A3, 0xFF, 0xFF, 0xFF), .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), + .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist + },/* AT&T Direct IP LTE modems */ {USB_DEVICE_AND_INTERFACE_INFO (0x0F3D ,0x68AA ,0xFF ,0xFF ,0xFF ), .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
Signature · 1 line
1.9.1
PATCH 19/177 Drivers: hv: vmbus: Fix a bug in vmbus_open()
In reply to [email protected]From: "K. Y. Srinivasan" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 45d727cee9e200f5b351528b9fb063b69cf702c8 upstream.
Fix a bug in vmbus_open() and properly propagate the error. I would like to thank Dexuan Cui <[email protected]> for identifying the issue.
--- drivers/hv/channel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hv/channel.c +3 -1
@@ -207,8 +207,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, ret =vmbus_post_msg (open_msg,sizeof (struct vmbus_channel_open_channel )); -if (ret !=0 ) +if (ret !=0 ) { + err = ret; goto error1; + } t =wait_for_completion_timeout (&open_info->waitevent,5 *HZ );if (t ==0 ) {
Signature · 1 line
1.9.1
PATCH 19/91 xen/manage: Always freeze/thaw processes when suspend/resuming
In reply to [email protected]From: Ross Lagerwall <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 61a734d305e16944b42730ef582a7171dc733321 upstream.
Always freeze processes when suspending and thaw processes when resuming to prevent a race noticeable with HVM guests.
This prevents a deadlock where the khubd kthread (which is designed to be freezable) acquires a usb device lock and then tries to allocate memory which requires the disk which hasn't been resumed yet. Meanwhile, the xenwatch thread deadlocks waiting for the usb device lock.
Freezing processes fixes this because the khubd thread is only thawed after the xenwatch thread finishes resuming all the devices.
--- drivers/xen/manage.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/xen/manage.c +0 -7
@@ -109,16 +109,11 @@ static void do_suspend(void) shutting_down =SHUTDOWN_SUSPEND ; -#ifdef CONFIG_PREEMPT -/* If the kernel is preemptible, we need to freeze all the processes -to prevent them from being in the middle of a pagetable update -during suspend. */ err =freeze_processes ();if (err) {printk (KERN_ERR "xen suspend: freeze failed %d\n" , err); goto out; } -#endif err =dpm_suspend_start (PMSG_FREEZE );if (err) {
@@ -170,10 +165,8 @@ out_resume:clock_was_set (); out_thaw: -#ifdef CONFIG_PREEMPTthaw_processes (); out: -#endif shutting_down = SHUTDOWN_INVALID; }#endif /* CONFIG_HIBERNATE_CALLBACKS */
Signature · 1 line
1.9.1
PATCH 20/177 Drivers: hv: vmbus: Cleanup vmbus_close_internal()
In reply to [email protected]From: "K. Y. Srinivasan" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 98d731bb064a9d1817a6ca9bf8b97051334a7cfe upstream.
Eliminate calls to BUG_ON() in vmbus_close_internal(). We have chosen to potentially leak memory, than crash the guest in case of failures.
In this version of the patch I have addressed comments from Dan Carpenter ([email protected]).
--- drivers/hv/channel.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/hv/channel.c +21 -6
@@ -531,11 +531,28 @@ void vmbus_close(struct vmbus_channel *channel) ret =vmbus_post_msg (msg,sizeof (struct vmbus_channel_close_channel )); -BUG_ON (ret !=0 ); +if (ret) { +pr_err ("Close failed: close post msg return is %d\n" , ret); +/* +* If we failed to post the close msg, +* it is perhaps better to leak memory. +*/ +return ; + } +/* Tear down the gpadl for the channel's ring buffer */ -if (channel->ringbuffer_gpadlhandle) -vmbus_teardown_gpadl (channel, - channel->ringbuffer_gpadlhandle); +if (channel->ringbuffer_gpadlhandle) { + ret =vmbus_teardown_gpadl (channel, + channel->ringbuffer_gpadlhandle); +if (ret) { +pr_err ("Close failed: teardown gpadl return %d\n" , ret); +/* +* If we failed to teardown gpadl, +* it is perhaps better to leak memory. +*/ +return ; + } + }/* Cleanup the ring buffers for this channel */ hv_ringbuffer_cleanup (&channel->outbound);
@@ -543,8 +560,6 @@ void vmbus_close(struct vmbus_channel *channel)free_pages ((unsigned long )channel->ringbuffer_pages,get_order (channel->ringbuffer_pagecount *PAGE_SIZE )); - - }EXPORT_SYMBOL_GPL (vmbus_close);
Signature · 1 line
1.9.1
PATCH 20/91 block: Fix dev_t minor allocation lifetime
In reply to [email protected]From: Keith Busch <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 2da78092dda13f1efd26edbbf99a567776913750 upstream.
Releases the dev_t minor when all references are closed to prevent another device from acquiring the same major/minor.
Since the partition's release may be invoked from call_rcu's soft-irq context, the ext_dev_idr's mutex had to be replaced with a spinlock so as not so sleep.
[lizf: Backported to 3.4:
- adjust context
- remove idr_preload() and idr_preload_end()]
--- block/genhd.c | 18 +++++++++--------- block/partition-generic.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-)
block/genhd.c +9 -9
@@ -27,10 +27,10 @@ struct kobject *block_depr;/* for extended dynamic devt allocation, currently only one major is used */ #define NR_EXT_DEVT (1 << MINORBITS) -/* For extended devt allocation. ext_devt_mutex prevents look up +/* For extended devt allocation. ext_devt_lock prevents look up * results from going away underneath its user. */ -static DEFINE_MUTEX (ext_devt_mutex); +static DEFINE_SPINLOCK (ext_devt_lock);static DEFINE_IDR (ext_devt_idr);static struct device_type disk_type;
@@ -420,13 +420,13 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt)do {if (!idr_pre_get (&ext_devt_idr,GFP_KERNEL ))return -ENOMEM ; -mutex_lock (&ext_devt_mutex); +spin_lock (&ext_devt_lock); rc =idr_get_new (&ext_devt_idr, part, &idx);if (!rc && idx >=NR_EXT_DEVT ) {idr_remove (&ext_devt_idr, idx); rc = -EBUSY ; } -mutex_unlock (&ext_devt_mutex); +spin_unlock (&ext_devt_lock); }while (rc == -EAGAIN );if (rc)
@@ -453,9 +453,9 @@ void blk_free_devt(dev_t devt)return ;if (MAJOR (devt) ==BLOCK_EXT_MAJOR ) { -mutex_lock (&ext_devt_mutex); +spin_lock (&ext_devt_lock);idr_remove (&ext_devt_idr,blk_mangle_minor (MINOR (devt))); -mutex_unlock (&ext_devt_mutex); +spin_unlock (&ext_devt_lock); } }
@@ -662,7 +662,6 @@ void del_gendisk(struct gendisk *disk)if (!sysfs_deprecated)sysfs_remove_link (block_depr,dev_name (disk_to_dev (disk)));device_del (disk_to_dev (disk)); -blk_free_devt (disk_to_dev (disk)->devt); }EXPORT_SYMBOL (del_gendisk);
@@ -687,13 +686,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno) }else {struct hd_struct *part; -mutex_lock (&ext_devt_mutex); +spin_lock (&ext_devt_lock); part =idr_find (&ext_devt_idr,blk_mangle_minor (MINOR (devt)));if (part &&get_disk (part_to_disk (part))) { *partno = part->partno; disk =part_to_disk (part); } -mutex_unlock (&ext_devt_mutex); +spin_unlock (&ext_devt_lock); }return disk;
@@ -1101,6 +1100,7 @@ static void disk_release(struct device *dev) {struct gendisk *disk =dev_to_disk (dev); +blk_free_devt (dev->devt);disk_release_events (disk);kfree (disk->random);disk_replace_part_tbl (disk,NULL );
block/partition-generic.c +1 -1
@@ -211,6 +211,7 @@ static const struct attribute_group *part_attr_groups[] = {static void part_release (struct device *dev) {struct hd_struct *p =dev_to_part (dev); +blk_free_devt (dev->devt);free_part_stats (p);free_part_info (p);kfree (p);
@@ -253,7 +254,6 @@ void delete_partition(struct gendisk *disk, int partno)rcu_assign_pointer (ptbl->last_lookup,NULL );kobject_put (part->holder_dir);device_del (part_to_dev (part)); -blk_free_devt (part_devt (part));hd_struct_put (part); }
Signature · 1 line
1.9.1
PATCH 21/177 spi: dw-mid: respect 8 bit mode
In reply to [email protected]From: Andy Shevchenko <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit b41583e7299046abdc578c33f25ed83ee95b9b31 upstream.
In case of 8 bit mode and DMA usage we end up with every second byte written as
0. We have to respect bits_per_word settings what this patch actually does.
--- drivers/spi/spi-dw-mid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-dw-mid.c +2 -2
@@ -136,7 +136,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) txconf.dst_addr = dws->dma_addr; txconf.dst_maxburst =LNW_DMA_MSIZE_16 ; txconf.src_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; - txconf.dst_addr_width =DMA_SLAVE_BUSWIDTH_2_BYTES ; + txconf.dst_addr_width = dws->dma_width; txconf.device_fc = false; txchan->device->device_control(txchan, DMA_SLAVE_CONFIG,
@@ -159,7 +159,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) rxconf.src_addr = dws->dma_addr; rxconf.src_maxburst =LNW_DMA_MSIZE_16 ; rxconf.dst_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; - rxconf.src_addr_width =DMA_SLAVE_BUSWIDTH_2_BYTES ; + rxconf.src_addr_width = dws->dma_width; rxconf.device_fc = false; rxchan->device->device_control(rxchan, DMA_SLAVE_CONFIG,
Signature · 1 line
1.9.1
PATCH 21/91 usb: dwc3: core: fix order of PM runtime calls
In reply to [email protected]From: Felipe Balbi <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit fed33afce0eda44a46ae24d93aec1b5198c0bac4 upstream.
Currently, we disable pm_runtime before all register accesses are done, this is dangerous and might lead to abort exceptions due to the driver trying to access a register which is clocked by a clock which was long gated.
Fix that by moving pm_runtime_put_sync() and pm_runtime_disable() as the last thing we do before returning from our ->remove() method.
--- drivers/usb/dwc3/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/core.c +3 -3
@@ -563,9 +563,6 @@ static int __devexit dwc3_remove(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -pm_runtime_put (&pdev->dev); -pm_runtime_disable (&pdev->dev); -dwc3_debugfs_exit (dwc);switch (dwc->mode) {
@@ -586,6 +583,9 @@ static int __devexit dwc3_remove(struct platform_device *pdev)dwc3_core_exit (dwc); +pm_runtime_put (&pdev->dev); +pm_runtime_disable (&pdev->dev); +return 0 ; }
Signature · 1 line
1.9.1
PATCH 22/91 ahci: add pcid for Marvel 0x9182 controller
In reply to [email protected]From: Murali Karicheri <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c5edfff9db6f4d2c35c802acb4abe0df178becee upstream.
Keystone K2E EVM uses Marvel 0x9182 controller. This requires support for the ID in the ahci driver.
[lizf: Backported to 3.4:
- adjust context
- s/PCI_VENDOR_ID_MARVELL_EXT/0x1b4b/]
--- drivers/ata/ahci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ata/ahci.c +2 -0
@@ -443,6 +443,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ { PCI_DEVICE(0x1b4b, 0x917a), .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ + { PCI_DEVICE(0x1b4b, 0x9182), + .driver_data = board_ahci_yes_fbs }, /* 88se9182 */ { PCI_DEVICE(0x1b4b, 0x9192), .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ { PCI_DEVICE(0x1b4b, 0x91a3),
Signature · 1 line
1.9.1
PATCH 22/177 spi: dw-mid: terminate ongoing transfers at exit
In reply to [email protected]From: Andy Shevchenko <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 8e45ef682cb31fda62ed4eeede5d9745a0a1b1e2 upstream.
Do full clean up at exit, means terminate all ongoing DMA transfers.
--- drivers/spi/spi-dw-mid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-dw-mid.c +3 -0
@@ -89,7 +89,10 @@ err_exit:static void mid_spi_dma_exit (struct dw_spi *dws) { +dmaengine_terminate_all (dws->txchan);dma_release_channel (dws->txchan); + +dmaengine_terminate_all (dws->rxchan);dma_release_channel (dws->rxchan); }
Signature · 1 line
1.9.1
PATCH 23/91 drm/radeon: add connector quirk for fujitsu board
In reply to [email protected]From: Alex Deucher <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 1952f24d0fa6292d65f886887af87ba8ac79b3ba upstream.
Vbios connector table lists non-existent VGA port.
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=83184
--- drivers/gpu/drm/radeon/radeon_atombios.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/radeon/radeon_atombios.c +7 -0
@@ -463,6 +463,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, } } +/* Fujitsu D3003-S2 board lists DVI-I as DVI-I and VGA */ +if ((dev->pdev->device ==0x9805 ) && + (dev->pdev->subsystem_vendor ==0x1734 ) && + (dev->pdev->subsystem_device ==0x11bd )) { +if (*connector_type ==DRM_MODE_CONNECTOR_VGA ) +return false; + }return true; }
Signature · 1 line
1.9.1
PATCH 23/177 kvm: don't take vcpu mutex for obviously invalid vcpu ioctls
In reply to [email protected]From: David Matlack <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 2ea75be3219571d0ec009ce20d9971e54af96e09 upstream.
vcpu ioctls can hang the calling thread if issued while a vcpu is running. However, invalid ioctls can happen when userspace tries to probe the kind of file descriptors (e.g. isatty() calls ioctl(TCGETS)); in that case, we know the ioctl is going to be rejected as invalid anyway and we can fail before trying to take the vcpu mutex.
This patch does not change functionality, it just makes invalid ioctls fail faster.
--- virt/kvm/kvm_main.c | 4 ++++ 1 file changed, 4 insertions(+)
virt/kvm/kvm_main.c +4 -0
@@ -52,6 +52,7 @@#include <asm/processor.h> #include <asm/io.h> +#include <asm/ioctl.h> #include <asm/uaccess.h> #include <asm/pgtable.h>
@@ -1744,6 +1745,9 @@ static long kvm_vcpu_ioctl(struct file *filp,if (vcpu->kvm->mm != current->mm)return -EIO ; +if (unlikely (_IOC_TYPE (ioctl) !=KVMIO )) +return -EINVAL ; +#if defined(CONFIG_S390 ) || defined(CONFIG_PPC )/* * Special cases: vcpu ioctls that are asynchronous to vcpu execution,
Signature · 1 line
1.9.1
PATCH 24/91 usb: host: xhci: fix compliance mode workaround
In reply to [email protected]From: Felipe Balbi <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 96908589a8b2584b1185f834d365f5cc360e8226 upstream.
Commit 71c731a (usb: host: xhci: Fix Compliance Mode on SN65LVP3502CP Hardware) implemented a workaround for a known issue with Texas Instruments' USB 3.0 redriver IC but it left a condition where any xHCI host would be taken out of reset if port was placed in compliance mode and there was no device connected to the port.
That condition would trigger a fake connection to a non-existent device so that usbcore would trigger a warm reset of the port, thus taking the link out of reset.
This has the side-effect of preventing any xHCI host connected to a Linux machine from starting and running the USB 3.0 Electrical Compliance Suite because the port will mysteriously taken out of compliance mode and, thus, xHCI won't step through the necessary compliance patterns for link validation.
This patch fixes the issue by just adding a missing check for XHCI_COMP_MODE_QUIRK inside xhci_hub_report_usb3_link_state() when PORT_CAS isn't set.
This patch should be backported to all kernels containing commit 71c731a.
[lizf: Backported to 3.4:
- s/xhci_hub_report_usb3_link_state/xhci_hub_report_link_state/]
--- drivers/usb/host/xhci-hub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-hub.c +5 -3
@@ -463,7 +463,8 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, }/* Updates Link Status for super Speed port */ -static void xhci_hub_report_link_state (u32 *status,u32 status_reg) +static void xhci_hub_report_link_state (struct xhci_hcd *xhci, +u32 *status,u32 status_reg) {u32 pls = status_reg &PORT_PLS_MASK ;
@@ -502,7 +503,8 @@ static void xhci_hub_report_link_state(u32 *status, u32 status_reg)* in which sometimes the port enters compliance mode * caused by a delay on the host-device negotiation. */ -if (pls ==USB_SS_PORT_LS_COMP_MOD ) +if ((xhci->quirks &XHCI_COMP_MODE_QUIRK ) && + (pls ==USB_SS_PORT_LS_COMP_MOD )) pls |=USB_PORT_STAT_CONNECTION ; }
@@ -680,7 +682,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, }/* Update Port Link State for super speed ports*/ if (hcd->speed ==HCD_USB3 ) { -xhci_hub_report_link_state (&status, temp); +xhci_hub_report_link_state (xhci, &status, temp);/* * Verify if all USB3 Ports Have entered U0 already. * Delete Compliance Mode Timer if so.
Signature · 1 line
1.9.1
PATCH 24/177 x86/intel/quark: Switch off CR4.PGE so TLB flush uses CR3 instead
In reply to [email protected]From: Bryan O'Donoghue <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit ee1b5b165c0a2f04d2107e634e51f05d0eb107de upstream.
Quark x1000 advertises PGE via the standard CPUID method PGE bits exist in Quark X1000's PTEs. In order to flush an individual PTE it is necessary to reload CR3 irrespective of the PTE.PGE bit.
See Quark Core_DevMan_001.pdf section 6.4.11
This bug was fixed in Galileo kernels, unfixed vanilla kernels are expected to crash and burn on this platform.
--- arch/x86/kernel/cpu/intel.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/x86/kernel/cpu/intel.c +15 -0
@@ -143,6 +143,21 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)setup_clear_cpu_cap (X86_FEATURE_ERMS ); } } + +/* +* Intel Quark Core DevMan_001.pdf section 6.4.11 +* "The operating system also is required to invalidate (i.e., flush) +* the TLB when any changes are made to any of the page table entries. +* The operating system must reload CR3 to cause the TLB to be flushed" +* +* As a result cpu_has_pge() in arch/x86/include/asm/tlbflush.h should +* be false so that __flush_tlb_all() causes CR3 insted of CR4.PGE +* to be modified +*/ +if (c->x86 ==5 && c->x86_model ==9 ) { +pr_info ("Disabling PGE capability bit\n" ); +setup_clear_cpu_cap (X86_FEATURE_PGE ); + } }#ifdef CONFIG_X86_32
Signature · 1 line
1.9.1
PATCH 25/91 Input: elantech - fix detection of touchpad on ASUS s301l
In reply to [email protected]From: Hans de Goede <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 271329b3c798b2102120f5df829071c211ef00ed upstream.
Adjust Elantech signature validation to account fo rnewer models of touchpads.
--- drivers/input/mouse/elantech.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/input/mouse/elantech.c +7 -0
@@ -1218,6 +1218,13 @@ static bool elantech_is_signature_valid(const unsigned char *param)if (param[1 ] ==0 )return true; +/* +* Some models have a revision higher then 20. Meaning param[2] may +* be 10 or 20, skip the rates check for these. +*/ +if (param[0 ] ==0x46 && (param[1 ] &0xef ) ==0x0f && param[2 ] <40 ) +return true; +for (i =0 ; i <ARRAY_SIZE (rates); i++)if (param[2 ] == rates[i])return false;
Signature · 1 line
1.9.1
PATCH 25/177 lockd: Try to reconnect if statd has moved
In reply to [email protected]From: Benjamin Coddington <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 173b3afceebe76fa2205b2c8808682d5b541fe3c upstream.
If rpc.statd is restarted, upcalls to monitor hosts can fail with ECONNREFUSED. In that case force a lookup of statd's new port and retry the upcall.
--- fs/lockd/mon.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/lockd/mon.c +6 -0
@@ -114,6 +114,12 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, msg.rpc_proc = &clnt->cl_procinfo[proc]; status =rpc_call_sync (clnt, &msg,0 ); +if (status == -ECONNREFUSED ) { +dprintk ("lockd: NSM upcall RPC failed, status=%d, forcing rebind\n" , + status); +rpc_force_rebind (clnt); + status =rpc_call_sync (clnt, &msg,RPC_TASK_SOFTCONN ); + }if (status <0 )dprintk ("lockd: NSM upcall RPC failed, status=%d\n" , status);
Signature · 1 line
1.9.1
PATCH 26/91 USB: ftdi_sio: Add support for GE Healthcare Nemo Tracker device
In reply to [email protected]From: Taylor Braun-Jones <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 9c491c372d677b6420e0f8c6361fe422791662cc upstream.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 8 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -960,6 +960,8 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },/* ekey Devices */ { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, +/* GE Healthcare devices */ + { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -1382,3 +1382,9 @@* ekey biometric systems GmbH (http://ekey.net/) */ #define FTDI_EKEY_CONV_USB_PID 0xCB08/* Converter USB */ + +/* +* GE Healthcare devices +*/ +#define GE_HEALTHCARE_VID 0x1901 +#define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015
Signature · 1 line
1.9.1
PATCH 26/177 power: charger-manager: Fix NULL pointer exception with missing cm-fuel-gauge
In reply to [email protected]From: Krzysztof Kozlowski <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 661a88860274e059fdb744dfaa98c045db7b5d1d upstream.
NULL pointer exception happens during charger-manager probe if 'cm-fuel-gauge' property is not present.
[ 2.448536] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 2.456572] pgd = c0004000 [ 2.459217] [00000000] *pgd=00000000 [ 2.462759] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 2.468047] Modules linked in: [ 2.471089] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc6-00251-ge44cf96cd525-dirty #969 [ 2.479765] task: ea890000 ti: ea87a000 task.ti: ea87a000 [ 2.485161] PC is at strcmp+0x4/0x30 [ 2.488719] LR is at power_supply_match_device_by_name+0x10/0x1c [ 2.494695] pc : [<c01f4220>] lr : [<c030fe38>] psr: a0000113 [ 2.494695] sp : ea87bde0 ip : 00000000 fp : eaa97010 [ 2.506150] r10: 00000004 r9 : ea97269c r8 : ea3bbfd0 [ 2.511360] r7 : eaa97000 r6 : c030fe28 r5 : 00000000 r4 : ea3b0000 [ 2.517869] r3 : 0000006d r2 : 00000000 r1 : 00000000 r0 : c057c195 [ 2.524381] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel [ 2.531671] Control: 10c5387d Table: 4000404a DAC: 00000015 [ 2.537399] Process swapper/0 (pid: 1, stack limit = 0xea87a240) [ 2.543388] Stack: (0xea87bde0 to 0xea87c000) [ 2.547733] bde0: ea3b0210 c026b1c8 eaa97010 eaa97000 eaa97010 eabb60a8 ea3b0210 00000000 [ 2.555891] be00: 00000008 ea2db210 ea1a3410 c030fee0 ea3bbf90 c03138fc c068969c c013526c [ 2.564050] be20: eaa040c0 00000000 c068969c 00000000 eaa040c0 ea2da300 00000002 00000000 [ 2.572208] be40: 00000001 ea2da3c0 00000000 00000001 00000000 eaa97010 c068969c 00000000 [ 2.580367] be60: 00000000 c068969c 00000000 00000002 00000000 c026b71c c026b6f0 eaa97010 [ 2.588527] be80: c0e82530 c026a330 00000000 eaa97010 c068969c eaa97044 00000000 c061df50 [ 2.596686] bea0: ea87a000 c026a4dc 00000000 c068969c c026a448 c0268b5c ea8054a8 eaa8fd50 [ 2.604845] bec0: c068969c ea2db180 c06801f8 c0269b18 c0590f68 c068969c c0656c98 c068969c [ 2.613004] bee0: c0656c98 ea3bbe40 c06988c0 c026aaf0 00000000 c0656c98 c0656c98 c00088a4 [ 2.621163] bf00: 00000000 c0055f48 00000000 00000004 00000000 ea890000 c05dbc54 c062c178 [ 2.629323] bf20: c0603518 c005f674 00000001 ea87a000 eb7ff83b c0476440 00000091 c003d41c [ 2.637482] bf40: c05db344 00000007 eb7ff858 00000007 c065a76c c0647d24 00000007 c062c170 [ 2.645642] bf60: c06988c0 00000091 c062c178 c0603518 00000000 c0603cc4 00000007 00000007 [ 2.653801] bf80: c0603518 c0c0c0c0 00000000 c0453948 00000000 00000000 00000000 00000000 [ 2.661959] bfa0: 00000000 c0453950 00000000 c000e728 00000000 00000000 00000000 00000000 [ 2.670118] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.678277] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0 [ 2.686454] [<c01f4220>] (strcmp) from [<c030fe38>] (power_supply_match_device_by_name+0x10/0x1c) [ 2.695303] [<c030fe38>] (power_supply_match_device_by_name) from [<c026b1c8>] (class_find_device+0x54/0xac) [ 2.705106] [<c026b1c8>] (class_find_device) from [<c030fee0>] (power_supply_get_by_name+0x1c/0x30) [ 2.714137] [<c030fee0>] (power_supply_get_by_name) from [<c03138fc>] (charger_manager_probe+0x3d8/0xe58) [ 2.723683] [<c03138fc>] (charger_manager_probe) from [<c026b71c>] (platform_drv_probe+0x2c/0x5c) [ 2.732532] [<c026b71c>] (platform_drv_probe) from [<c026a330>] (driver_probe_device+0x10c/0x224) [ 2.741384] [<c026a330>] (driver_probe_device) from [<c026a4dc>] (__driver_attach+0x94/0x98) [ 2.749813] [<c026a4dc>] (__driver_attach) from [<c0268b5c>] (bus_for_each_dev+0x54/0x88) [ 2.757969] [<c0268b5c>] (bus_for_each_dev) from [<c0269b18>] (bus_add_driver+0xd4/0x1d0) [ 2.766123] [<c0269b18>] (bus_add_driver) from [<c026aaf0>] (driver_register+0x78/0xf4) [ 2.774110] [<c026aaf0>] (driver_register) from [<c00088a4>] (do_one_initcall+0x80/0x1bc) [ 2.782276] [<c00088a4>] (do_one_initcall) from [<c0603cc4>] (kernel_init_freeable+0x100/0x1cc) [ 2.790952] [<c0603cc4>] (kernel_init_freeable) from [<c0453950>] (kernel_init+0x8/0xec) [ 2.799029] [<c0453950>] (kernel_init) from [<c000e728>] (ret_from_fork+0x14/0x2c) [ 2.806572] Code: e12fff1e e1a03000 eafffff7 e4d03001 (e4d12001) [ 2.812832] ---[ end trace 7f12556111b9e7ef ]---
--- drivers/power/charger-manager.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/power/charger-manager.c +5 -0
@@ -808,6 +808,11 @@ static int charger_manager_probe(struct platform_device *pdev) goto err_no_charger_stat; } +if (!desc->psy_fuel_gauge) { +dev_err (&pdev->dev,"No fuel gauge power supply defined\n" ); +return -EINVAL ; + } +/* Counting index only */ while (desc->psy_charger_stat[i]) i++;
Signature · 1 line
1.9.1
PATCH 27/177 rt2800: correct BBP1_TX_POWER_CTRL mask
In reply to [email protected]From: Stanislaw Gruszka <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 01f7feeaf4528bec83798316b3c811701bac5d3e upstream.
Two bits control TX power on BBP_R1 register. Correct the mask, otherwise we clear additional bit on BBP_R1 register, what can have unknown, possible negative effect.
--- drivers/net/wireless/rt2x00/rt2800.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rt2x00/rt2800.h +1 -1
@@ -1751,7 +1751,7 @@ struct mac_iveiv_entry {* 2 - drop tx power by 12dBm, * 3 - increase tx power by 6dBm */ -#define BBP1_TX_POWER_CTRL FIELD8(0x07) +#define BBP1_TX_POWER_CTRL FIELD8(0x03)#define BBP1_TX_ANTENNA FIELD8(0x18)/*
Signature · 1 line
1.9.1
PATCH 27/91 uwb: init beacon cache entry before registering uwb device
In reply to [email protected]From: Thomas Pugliese <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 675f0ab2fe5a0f7325208e60b617a5f32b86d72c upstream.
Make sure the uwb_dev->bce entry is set before calling uwb_dev_add in uwbd_dev_onair so that usermode will only see the device after it is properly initialized. This fixes a kernel panic that can occur if usermode tries to access the IEs sysfs attribute of a UWB device before the driver has had a chance to set the beacon cache entry.
--- drivers/uwb/lc-dev.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/uwb/lc-dev.c +9 -4
@@ -441,16 +441,19 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) uwb_dev->mac_addr = *bce->mac_addr; uwb_dev->dev_addr = bce->dev_addr;dev_set_name (&uwb_dev->dev, macbuf); + +/* plug the beacon cache */ + bce->uwb_dev = uwb_dev; + uwb_dev->bce = bce; +uwb_bce_get (bce);/* released in uwb_dev_sys_release() */ + result =uwb_dev_add (uwb_dev, &rc->uwb_dev.dev, rc);if (result <0 ) {dev_err (dev,"new device %s: cannot instantiate device\n" , macbuf); goto error_dev_add; } -/* plug the beacon cache */ - bce->uwb_dev = uwb_dev; - uwb_dev->bce = bce; -uwb_bce_get (bce);/* released in uwb_dev_sys_release() */ +dev_info (dev,"uwb device (mac %s dev %s) connected to %s %s\n" , macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name,dev_name (rc->uwb_dev.dev.parent));
@@ -458,6 +461,8 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce)return ; error_dev_add: + bce->uwb_dev =NULL ; +uwb_bce_put (bce);kfree (uwb_dev);return ; }
Signature · 1 line
1.9.1
PATCH 28/177 Documentation: lzo: document part of the encoding
In reply to [email protected]From: Willy Tarreau <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d98a0526434d27e261f622cf9d2e0028b5ff1a00 upstream.
Add a complete description of the LZO format as processed by the decompressor. I have not found a public specification of this format hence this analysis, which will be used to better understand the code.
--- Documentation/lzo.txt | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Documentation/lzo.txt
Documentation/lzo.txt new file +164 -0
@@ -0,0 +1,164 @@ + +LZO stream format as understood by Linux's LZO decompressor +=========================================================== + +Introduction + + This is not a specification. No specification seems to be publicly available + for the LZO stream format. This document describes what input format the LZO + decompressor as implemented in the Linux kernel understands. The file subject + of this analysis is lib/lzo/lzo1x_decompress_safe.c. No analysis was made on + the compressor nor on any other implementations though it seems likely that + the format matches the standard one. The purpose of this document is to + better understand what the code does in order to propose more efficient fixes + for future bug reports. + +Description + + The stream is composed of a series of instructions, operands, and data. The + instructions consist in a few bits representing an opcode, and bits forming + the operands for the instruction, whose size and position depend on the + opcode and on the number of literals copied by previous instruction. The + operands are used to indicate : + + - a distance when copying data from the dictionary (past output buffer) + - a length (number of bytes to copy from dictionary) + - the number of literals to copy, which is retained in variable "state" + as a piece of information for next instructions. + + Optionally depending on the opcode and operands, extra data may follow. These + extra data can be a complement for the operand (eg: a length or a distance + encoded on larger values), or a literal to be copied to the output buffer. + + The first byte of the block follows a different encoding from other bytes, it + seems to be optimized for literal use only, since there is no dictionary yet + prior to that byte. + + Lengths are always encoded on a variable size starting with a small number + of bits in the operand. If the number of bits isn't enough to represent the + length, up to 255 may be added in increments by consuming more bytes with a + rate of at most 255 per extra byte (thus the compression ratio cannot exceed + around 255:1). The variable length encoding using #bits is always the same : + + length = byte & ((1 << #bits) - 1) + if (!length) { + length = ((1 << #bits) - 1) + length += 255*(number of zero bytes) + length += first-non-zero-byte + } + length += constant (generally 2 or 3) + + For references to the dictionary, distances are relative to the output + pointer. Distances are encoded using very few bits belonging to certain + ranges, resulting in multiple copy instructions using different encodings. + Certain encodings involve one extra byte, others involve two extra bytes + forming a little-endian 16-bit quantity (marked LE16 below). + + After any instruction except the large literal copy, 0, 1, 2 or 3 literals + are copied before starting the next instruction. The number of literals that + were copied may change the meaning and behaviour of the next instruction. In + practice, only one instruction needs to know whether 0, less than 4, or more + literals were copied. This is the information stored in the <state> variable + in this implementation. This number of immediate literals to be copied is + generally encoded in the last two bits of the instruction but may also be + taken from the last two bits of an extra operand (eg: distance). + + End of stream is declared when a block copy of distance 0 is seen. Only one + instruction may encode this distance (0001HLLL), it takes one LE16 operand + for the distance, thus requiring 3 bytes. + + IMPORTANT NOTE : in the code some length checks are missing because certain + instructions are called under the assumption that a certain number of bytes + follow because it has already been garanteed before parsing the instructions. + They just have to "refill" this credit if they consume extra bytes. This is + an implementation design choice independant on the algorithm or encoding. + +Byte sequences + + First byte encoding : + + 0..17 : follow regular instruction encoding, see below. It is worth + noting that codes 16 and 17 will represent a block copy from + the dictionary which is empty, and that they will always be + invalid at this place. + + 18..21 : copy 0..3 literals + state = (byte - 17) = 0..3 [ copy <state> literals ] + skip byte + + 22..255 : copy literal string + length = (byte - 17) = 4..238 + state = 4 [ don't copy extra literals ] + skip byte + + Instruction encoding : + + 0 0 0 0 X X X X (0..15) + Depends on the number of literals copied by the last instruction. + If last instruction did not copy any literal (state == 0), this + encoding will be a copy of 4 or more literal, and must be interpreted + like this : + + 0 0 0 0 L L L L (0..15) : copy long literal string + length = 3 + (L ?: 15 + (zero_bytes * 255) + non_zero_byte) + state = 4 (no extra literals are copied) + + If last instruction used to copy between 1 to 3 literals (encoded in + the instruction's opcode or distance), the instruction is a copy of a + 2-byte block from the dictionary within a 1kB distance. It is worth + noting that this instruction provides little savings since it uses 2 + bytes to encode a copy of 2 other bytes but it encodes the number of + following literals for free. It must be interpreted like this : + + 0 0 0 0 D D S S (0..15) : copy 2 bytes from <= 1kB distance + length = 2 + state = S (copy S literals after this block) + Always followed by exactly one byte : H H H H H H H H + distance = (H << 2) + D + 1 + + If last instruction used to copy 4 or more literals (as detected by + state == 4), the instruction becomes a copy of a 3-byte block from the + dictionary from a 2..3kB distance, and must be interpreted like this : + + 0 0 0 0 D D S S (0..15) : copy 3 bytes from 2..3 kB distance + length = 3 + state = S (copy S literals after this block) + Always followed by exactly one byte : H H H H H H H H + distance = (H << 2) + D + 2049 + + 0 0 0 1 H L L L (16..31) + Copy of a block within 16..48kB distance (preferably less than 10B) + length = 2 + (L ?: 7 + (zero_bytes * 255) + non_zero_byte) + Always followed by exactly one LE16 : D D D D D D D D : D D D D D D S S + distance = 16384 + (H << 14) + D + state = S (copy S literals after this block) + End of stream is reached if distance == 16384 + + 0 0 1 L L L L L (32..63) + Copy of small block within 16kB distance (preferably less than 34B) + length = 2 + (L ?: 31 + (zero_bytes * 255) + non_zero_byte) + Always followed by exactly one LE16 : D D D D D D D D : D D D D D D S S + distance = D + 1 + state = S (copy S literals after this block) + + 0 1 L D D D S S (64..127) + Copy 3-4 bytes from block within 2kB distance + state = S (copy S literals after this block) + length = 3 + L + Always followed by exactly one byte : H H H H H H H H + distance = (H << 3) + D + 1 + + 1 L L D D D S S (128..255) + Copy 5-8 bytes from block within 2kB distance + state = S (copy S literals after this block) + length = 5 + L + Always followed by exactly one byte : H H H H H H H H + distance = (H << 3) + D + 1 + +Authors + + This document was written by Willy Tarreau <[email protected]> on 2014/07/19 during an + analysis of the decompression code available in Linux 3.16-rc5. The code is + tricky, it is possible that this document contains mistakes or that a few + corner cases were overlooked. In any case, please report any doubt, fix, or + proposed updates to the author(s) so that the document can be updated.
Signature · 1 line
1.9.1
PATCH 28/91 Input: synaptics - add support for ForcePads
In reply to [email protected]From: Dmitry Torokhov <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 5715fc764f7753d464dbe094b5ef9cffa6e479a4 upstream.
ForcePads are found on HP EliteBook 1040 laptops. They lack any kind of physical buttons, instead they generate primary button click when user presses somewhat hard on the surface of the touchpad. Unfortunately they also report primary button click whenever there are 2 or more contacts on the pad, messing up all multi-finger gestures (2-finger scrolling, multi-finger tapping, etc). To cope with this behavior we introduce a delay (currently 50 msecs) in reporting primary press in case more contacts appear.
--- drivers/input/mouse/synaptics.c | 68 +++++++++++++++++++++++++++++++---------- drivers/input/mouse/synaptics.h | 11 +++++++ 2 files changed, 63 insertions(+), 16 deletions(-)
drivers/input/mouse/synaptics.c +52 -16
@@ -517,10 +517,61 @@ static int synaptics_parse_hw_state(const unsigned char buf[], ((buf[0 ] &0x04 ) >>1 ) | ((buf[3] & 0x04) >> 2)); +if ((SYN_CAP_ADV_GESTURE (priv->ext_cap_0c) || +SYN_CAP_IMAGE_SENSOR (priv->ext_cap_0c)) && + hw->w ==2 ) { +synaptics_parse_agm (buf, priv, hw); +return 1 ; + } + + hw->x = (((buf[3 ] &0x10 ) <<8 ) | + ((buf[1 ] &0x0f ) <<8 ) | + buf[4 ]); + hw->y = (((buf[3 ] &0x20 ) <<7 ) | + ((buf[1 ] &0xf0 ) <<4 ) | + buf[5 ]); + hw->z = buf[2 ]; + hw->left = (buf[0 ] &0x01 ) ?1 :0 ; hw->right = (buf[0 ] &0x02 ) ?1 :0 ; -if (SYN_CAP_CLICKPAD (priv->ext_cap_0c)) { +if (SYN_CAP_FORCEPAD (priv->ext_cap_0c)) { +/* +* ForcePads, like Clickpads, use middle button +* bits to report primary button clicks. +* Unfortunately they report primary button not +* only when user presses on the pad above certain +* threshold, but also when there are more than one +* finger on the touchpad, which interferes with +* out multi-finger gestures. +*/ +if (hw->z ==0 ) { +/* No contacts */ + priv->press = priv->report_press = false; + }else if (hw->w >=4 && ((buf[0 ] ^ buf[3 ]) &0x01 )) { +/* +* Single-finger touch with pressure above +* the threshold. If pressure stays long +* enough, we'll start reporting primary +* button. We rely on the device continuing +* sending data even if finger does not +* move. +*/ +if (!priv->press) { + priv->press_start = jiffies; + priv->press = true; + }else if (time_after (jiffies, + priv->press_start + +msecs_to_jiffies (50 ))) { + priv->report_press = true; + } + }else { + priv->press = false; + } + + hw->left = priv->report_press; + + }else if (SYN_CAP_CLICKPAD (priv->ext_cap_0c)) {/* * Clickpad's button is transmitted as middle button, * however, since it is primary button, we will report
@@ -539,21 +590,6 @@ static int synaptics_parse_hw_state(const unsigned char buf[], hw->down = ((buf[0 ] ^ buf[3 ]) &0x02 ) ?1 :0 ; } -if ((SYN_CAP_ADV_GESTURE (priv->ext_cap_0c) || -SYN_CAP_IMAGE_SENSOR (priv->ext_cap_0c)) && - hw->w ==2 ) { -synaptics_parse_agm (buf, priv, hw); -return 1 ; - } - - hw->x = (((buf[3 ] &0x10 ) <<8 ) | - ((buf[1 ] &0x0f ) <<8 ) | - buf[4 ]); - hw->y = (((buf[3 ] &0x20 ) <<7 ) | - ((buf[1 ] &0xf0 ) <<4 ) | - buf[5 ]); - hw->z = buf[2 ]; -if (SYN_CAP_MULTI_BUTTON_NO (priv->ext_cap) && ((buf[0 ] ^ buf[3 ]) &0x02 )) {switch (SYN_CAP_MULTI_BUTTON_NO (priv->ext_cap) & ~0x01 ) {
drivers/input/mouse/synaptics.h +11 -0
@@ -77,6 +77,11 @@* 2 0x08 image sensor image sensor tracks 5 fingers, but only * reports 2. * 2 0x20 report min query 0x0f gives min coord reported +* 2 0x80 forcepad forcepad is a variant of clickpad that +* does not have physical buttons but rather +* uses pressure above certain threshold to +* report primary clicks. Forcepads also have +* clickpad bit set. */ #define SYN_CAP_CLICKPAD (ex0c) ((ex0c) & 0x100000)/* 1-button ClickPad */ #define SYN_CAP_CLICKPAD2BTN (ex0c) ((ex0c) & 0x000100)/* 2-button ClickPad */
@@ -85,6 +90,7 @@#define SYN_CAP_ADV_GESTURE (ex0c) ((ex0c) & 0x080000)#define SYN_CAP_REDUCED_FILTERING (ex0c) ((ex0c) & 0x000400)#define SYN_CAP_IMAGE_SENSOR (ex0c) ((ex0c) & 0x000800) +#define SYN_CAP_FORCEPAD (ex0c) ((ex0c) & 0x008000)/* synaptics modes query bits */ #define SYN_MODE_ABSOLUTE (m) ((m) & (1 << 7))
@@ -174,6 +180,11 @@ struct synaptics_data {*/ struct synaptics_hw_state agm;bool agm_pending;/* new AGM packet received */ + +/* ForcePad handling */ +unsigned long press_start; +bool press; +bool report_press; };void synaptics_module_init (void );
Signature · 1 line
1.9.1
PATCH 29/177 Revert "lzo: properly check for overruns"
In reply to [email protected]From: Willy Tarreau <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit af958a38a60c7ca3d8a39c918c1baa2ff7b6b233 upstream.
This reverts commit 206a81c ("lzo: properly check for overruns").
As analysed by Willem Pinckaers, this fix is still incomplete on certain rare corner cases, and it is easier to restart from the original code.
--- lib/lzo/lzo1x_decompress_safe.c | 62 ++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 41 deletions(-)
lib/lzo/lzo1x_decompress_safe.c +21 -41
@@ -19,31 +19,11 @@#include <linux/lzo.h> #include "lzodefs.h" -#define HAVE_IP (t, x) \ - (((size_t)(ip_end - ip) >= (size_t)(t + x)) && \ - (((t + x) >= t) && ((t + x) >= x))) - -#define HAVE_OP (t, x) \ - (((size_t)(op_end - op) >= (size_t)(t + x)) && \ - (((t + x) >= t) && ((t + x) >= x))) - -#define NEED_IP (t, x) \ - do { \ - if (!HAVE_IP(t, x)) \ - goto input_overrun; \ - } while (0) - -#define NEED_OP (t, x) \ - do { \ - if (!HAVE_OP(t, x)) \ - goto output_overrun; \ - } while (0) - -#define TEST_LB (m_pos) \ - do { \ - if ((m_pos) < out) \ - goto lookbehind_overrun; \ - } while (0) +#define HAVE_IP (x) ((size_t)(ip_end - ip) >= (size_t)(x)) +#define HAVE_OP (x) ((size_t)(op_end - op) >= (size_t)(x)) +#define NEED_IP (x) if (!HAVE_IP(x)) goto input_overrun +#define NEED_OP (x) if (!HAVE_OP(x)) goto output_overrun +#define TEST_LB (m_pos) if ((m_pos) < out) goto lookbehind_overrunint lzo1x_decompress_safe (const unsigned char *in,size_t in_len,unsigned char *out,size_t *out_len)
@@ -78,14 +58,14 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,while (unlikely (*ip ==0 )) { t +=255 ; ip++; -NEED_IP (1 ,0 ); +NEED_IP (1 ); } t +=15 + *ip++; } t +=3 ; copy_literal_run:#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS ) -if (likely (HAVE_IP (t,15 ) &&HAVE_OP (t,15 ))) { +if (likely (HAVE_IP (t +15 ) &&HAVE_OP (t +15 ))) {const unsigned char *ie = ip + t;unsigned char *oe = op + t; do {
@@ -101,8 +81,8 @@ copy_literal_run: } else#endif { -NEED_OP (t,0 ); -NEED_IP (t,3 ); +NEED_OP (t); +NEED_IP (t +3 );do { *op++ = *ip++; }while (--t >0 );
@@ -115,7 +95,7 @@ copy_literal_run: m_pos -= t >>2 ; m_pos -= *ip++ <<2 ;TEST_LB (m_pos); -NEED_OP (2 ,0 ); +NEED_OP (2 ); op[0 ] = m_pos[0 ]; op[1 ] = m_pos[1 ]; op +=2 ;
@@ -139,10 +119,10 @@ copy_literal_run:while (unlikely (*ip ==0 )) { t +=255 ; ip++; -NEED_IP (1 ,0 ); +NEED_IP (1 ); } t +=31 + *ip++; -NEED_IP (2 ,0 ); +NEED_IP (2 ); } m_pos = op -1 ; next =get_unaligned_le16 (ip);
@@ -157,10 +137,10 @@ copy_literal_run:while (unlikely (*ip ==0 )) { t +=255 ; ip++; -NEED_IP (1 ,0 ); +NEED_IP (1 ); } t +=7 + *ip++; -NEED_IP (2 ,0 ); +NEED_IP (2 ); } next =get_unaligned_le16 (ip); ip +=2 ;
@@ -174,7 +154,7 @@ copy_literal_run:#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS )if (op - m_pos >=8 ) {unsigned char *oe = op + t; -if (likely (HAVE_OP (t,15 ))) { +if (likely (HAVE_OP (t +15 ))) { do { COPY8(op, m_pos); op += 8;
@@ -184,7 +164,7 @@ copy_literal_run: m_pos +=8 ; }while (op < oe); op = oe; -if (HAVE_IP (6 ,0 )) { +if (HAVE_IP (6 )) { state = next;COPY4 (op, ip); op += next;
@@ -192,7 +172,7 @@ copy_literal_run:continue ; } }else { -NEED_OP (t,0 ); +NEED_OP (t);do { *op++ = *m_pos++; }while (op < oe);
@@ -201,7 +181,7 @@ copy_literal_run:#endif {unsigned char *oe = op + t; -NEED_OP (t,0 ); +NEED_OP (t); op[0 ] = m_pos[0 ]; op[1 ] = m_pos[1 ]; op +=2 ;
@@ -214,15 +194,15 @@ match_next: state = next; t = next;#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS ) -if (likely (HAVE_IP (6 ,0 ) &&HAVE_OP (4 ,0 ))) { +if (likely (HAVE_IP (6 ) &&HAVE_OP (4 ))) {COPY4 (op, ip); op += t; ip += t; } else#endif { -NEED_IP (t,3 ); -NEED_OP (t,0 ); +NEED_IP (t +3 ); +NEED_OP (t);while (t >0 ) { *op++ = *ip++; t--;
Signature · 1 line
1.9.1
PATCH 29/91 libceph: gracefully handle large reply messages from the mon
In reply to [email protected]From: Sage Weil <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 73c3d4812b4c755efeca0140f606f83772a39ce4 upstream.
We preallocate a few of the message types we get back from the mon. If we get a larger message than we are expecting, fall back to trying to allocate a new one instead of blindly using the one we have.
--- net/ceph/mon_client.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/ceph/mon_client.c +8 -0
@@ -1042,7 +1042,15 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,if (!m) {pr_info ("alloc_msg unknown type %d\n" , type); *skip =1 ; + }else if (front_len > m->front_max) { +pr_warning ("mon_alloc_msg front %d > prealloc %d (%u#%llu)\n" , + front_len, m->front_max, + (unsigned int )con->peer_name.type, +le64_to_cpu (con->peer_name.num)); +ceph_msg_put (m); + m =ceph_msg_new (type, front_len,GFP_NOFS , false); } +return m; }
Signature · 1 line
1.9.1
PATCH 30/91 libceph: add process_one_ticket() helper
In reply to [email protected]From: Ilya Dryomov <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 597cda357716a3cf8d994cb11927af917c8d71fa upstream.
Add a helper for processing individual cephx auth tickets. Needed for the next commit, which deals with allocating ticket buffers. (Most of the diff here is whitespace - view with git diff -b).
--- net/ceph/auth_x.c | 228 +++++++++++++++++++++++++++++------------------------- 1 file changed, 124 insertions(+), 104 deletions(-)
net/ceph/auth_x.c +124 -104
@@ -129,17 +129,131 @@ static void remove_ticket_handler(struct ceph_auth_client *ac,kfree (th); } +static int process_one_ticket (struct ceph_auth_client *ac, +struct ceph_crypto_key *secret, +void **p,void *end, +void *dbuf,void *ticket_buf) +{ +struct ceph_x_info *xi = ac->private; +int type; +u8 tkt_struct_v, blob_struct_v; +struct ceph_x_ticket_handler *th; +void *dp, *dend; +int dlen; +char is_enc; +struct timespec validity; +struct ceph_crypto_key old_key; +void *tp, *tpend; +struct ceph_timespec new_validity; +struct ceph_crypto_key new_session_key; +struct ceph_buffer *new_ticket_blob; +unsigned long new_expires, new_renew_after; +u64 new_secret_id; +int ret; + +ceph_decode_need (p, end,sizeof (u32) +1 , bad); + + type =ceph_decode_32 (p); +dout (" ticket type %d %s\n" , type,ceph_entity_type_name (type)); + + tkt_struct_v =ceph_decode_8 (p); +if (tkt_struct_v !=1 ) + goto bad; + + th =get_ticket_handler (ac, type); +if (IS_ERR (th)) { + ret =PTR_ERR (th); + goto out; + } + +/* blob for me */ + dlen =ceph_x_decrypt (secret, p, end, dbuf, +TEMP_TICKET_BUF_LEN ); +if (dlen <=0 ) { + ret = dlen; + goto out; + } +dout (" decrypted %d bytes\n" , dlen); + dp = dbuf; + dend = dp + dlen; + + tkt_struct_v =ceph_decode_8 (&dp); +if (tkt_struct_v !=1 ) + goto bad; + +memcpy (&old_key, &th->session_key,sizeof (old_key)); + ret =ceph_crypto_key_decode (&new_session_key, &dp, dend); +if (ret) + goto out; + +ceph_decode_copy (&dp, &new_validity,sizeof (new_validity)); +ceph_decode_timespec (&validity, &new_validity); + new_expires =get_seconds () + validity.tv_sec; + new_renew_after = new_expires - (validity.tv_sec /4 ); +dout (" expires=%lu renew_after=%lu\n" , new_expires, + new_renew_after); + +/* ticket blob for service */ +ceph_decode_8_safe (p, end, is_enc, bad); + tp = ticket_buf; +if (is_enc) { +/* encrypted */ +dout (" encrypted ticket\n" ); + dlen =ceph_x_decrypt (&old_key, p, end, ticket_buf, +TEMP_TICKET_BUF_LEN ); +if (dlen <0 ) { + ret = dlen; + goto out; + } + dlen =ceph_decode_32 (&tp); + }else { +/* unencrypted */ +ceph_decode_32_safe (p, end, dlen, bad); +ceph_decode_need (p, end, dlen, bad); +ceph_decode_copy (p, ticket_buf, dlen); + } + tpend = tp + dlen; +dout (" ticket blob is %d bytes\n" , dlen); +ceph_decode_need (&tp, tpend,1 +sizeof (u64), bad); + blob_struct_v =ceph_decode_8 (&tp); + new_secret_id =ceph_decode_64 (&tp); + ret =ceph_decode_buffer (&new_ticket_blob, &tp, tpend); +if (ret) + goto out; + +/* all is well, update our ticket */ +ceph_crypto_key_destroy (&th->session_key); +if (th->ticket_blob) +ceph_buffer_put (th->ticket_blob); + th->session_key = new_session_key; + th->ticket_blob = new_ticket_blob; + th->validity = new_validity; + th->secret_id = new_secret_id; + th->expires = new_expires; + th->renew_after = new_renew_after; +dout (" got ticket service %d (%s) secret_id %lld len %d\n" , + type,ceph_entity_type_name (type), th->secret_id, + (int )th->ticket_blob->vec.iov_len); + xi->have_keys |= th->service; + +out: +return ret; + +bad: + ret = -EINVAL ; + goto out; +} +static int ceph_x_proc_ticket_reply (struct ceph_auth_client *ac,struct ceph_crypto_key *secret,void *buf,void *end) { -struct ceph_x_info *xi = ac->private; -int num;void *p = buf; -int ret;char *dbuf;char *ticket_buf;u8 reply_struct_v; +u32 num; +int ret; dbuf =kmalloc (TEMP_TICKET_BUF_LEN ,GFP_NOFS );if (!dbuf)
@@ -150,112 +264,18 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,if (!ticket_buf) goto out_dbuf; -ceph_decode_need (&p, end,1 +sizeof (u32), bad); - reply_struct_v =ceph_decode_8 (&p); +ceph_decode_8_safe (&p, end, reply_struct_v, bad);if (reply_struct_v !=1 ) - goto bad; - num =ceph_decode_32 (&p); -dout ("%d tickets\n" , num); -while (num--) { -int type; -u8 tkt_struct_v, blob_struct_v; -struct ceph_x_ticket_handler *th; -void *dp, *dend; -int dlen; -char is_enc; -struct timespec validity; -struct ceph_crypto_key old_key; -void *tp, *tpend; -struct ceph_timespec new_validity; -struct ceph_crypto_key new_session_key; -struct ceph_buffer *new_ticket_blob; -unsigned long new_expires, new_renew_after; -u64 new_secret_id; - -ceph_decode_need (&p, end,sizeof (u32) +1 , bad); - - type =ceph_decode_32 (&p); -dout (" ticket type %d %s\n" , type,ceph_entity_type_name (type)); - - tkt_struct_v =ceph_decode_8 (&p); -if (tkt_struct_v !=1 ) - goto bad; - - th =get_ticket_handler (ac, type); -if (IS_ERR (th)) { - ret =PTR_ERR (th); - goto out; - } - -/* blob for me */ - dlen =ceph_x_decrypt (secret, &p, end, dbuf, -TEMP_TICKET_BUF_LEN ); -if (dlen <=0 ) { - ret = dlen; - goto out; - } -dout (" decrypted %d bytes\n" , dlen); - dend = dbuf + dlen; - dp = dbuf; - - tkt_struct_v =ceph_decode_8 (&dp); -if (tkt_struct_v !=1 ) - goto bad; +return -EINVAL ; -memcpy (&old_key, &th->session_key,sizeof (old_key)); - ret =ceph_crypto_key_decode (&new_session_key, &dp, dend); -if (ret) - goto out; +ceph_decode_32_safe (&p, end, num, bad); +dout ("%d tickets\n" , num); -ceph_decode_copy (&dp, &new_validity,sizeof (new_validity)); -ceph_decode_timespec (&validity, &new_validity); - new_expires =get_seconds () + validity.tv_sec; - new_renew_after = new_expires - (validity.tv_sec /4 ); -dout (" expires=%lu renew_after=%lu\n" , new_expires, - new_renew_after); - -/* ticket blob for service */ -ceph_decode_8_safe (&p, end, is_enc, bad); - tp = ticket_buf; -if (is_enc) { -/* encrypted */ -dout (" encrypted ticket\n" ); - dlen =ceph_x_decrypt (&old_key, &p, end, ticket_buf, -TEMP_TICKET_BUF_LEN ); -if (dlen <0 ) { - ret = dlen; - goto out; - } - dlen =ceph_decode_32 (&tp); - }else { -/* unencrypted */ -ceph_decode_32_safe (&p, end, dlen, bad); -ceph_decode_need (&p, end, dlen, bad); -ceph_decode_copy (&p, ticket_buf, dlen); - } - tpend = tp + dlen; -dout (" ticket blob is %d bytes\n" , dlen); -ceph_decode_need (&tp, tpend,1 +sizeof (u64), bad); - blob_struct_v =ceph_decode_8 (&tp); - new_secret_id =ceph_decode_64 (&tp); - ret =ceph_decode_buffer (&new_ticket_blob, &tp, tpend); +while (num--) { + ret =process_one_ticket (ac, secret, &p, end, + dbuf, ticket_buf);if (ret) goto out; - -/* all is well, update our ticket */ -ceph_crypto_key_destroy (&th->session_key); -if (th->ticket_blob) -ceph_buffer_put (th->ticket_blob); - th->session_key = new_session_key; - th->ticket_blob = new_ticket_blob; - th->validity = new_validity; - th->secret_id = new_secret_id; - th->expires = new_expires; - th->renew_after = new_renew_after; -dout (" got ticket service %d (%s) secret_id %lld len %d\n" , - type,ceph_entity_type_name (type), th->secret_id, - (int )th->ticket_blob->vec.iov_len); - xi->have_keys |= th->service; } ret =0 ;
Signature · 1 line
1.9.1
PATCH 30/177 lzo: check for length overrun in variable length encoding.
In reply to [email protected]From: Willy Tarreau <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 72cf90124e87d975d0b2114d930808c58b4c05e4 upstream.
This fix ensures that we never meet an integer overflow while adding 255 while parsing a variable length encoding. It works differently from commit 206a81c ("lzo: properly check for overruns") because instead of ensuring that we don't overrun the input, which is tricky to guarantee due to many assumptions in the code, it simply checks that the cumulated number of 255 read cannot overflow by bounding this number.
The MAX_255_COUNT is the maximum number of times we can add 255 to a base count without overflowing an integer. The multiply will overflow when multiplying 255 by more than MAXINT/255. The sum will overflow earlier depending on the base count. Since the base count is taken from a u8 and a few bits, it is safe to assume that it will always be lower than or equal to 2*255, thus we can always prevent any overflow by accepting two less 255 steps.
This patch also reduces the CPU overhead and actually increases performance by 1.1% compared to the initial code, while the previous fix costs 3.1% (measured on x86_64).
The fix needs to be backported to all currently supported stable kernels.
--- lib/lzo/lzo1x_decompress_safe.c | 43 +++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-)
lib/lzo/lzo1x_decompress_safe.c +37 -6
@@ -25,6 +25,16 @@#define NEED_OP (x) if (!HAVE_OP(x)) goto output_overrun#define TEST_LB (m_pos) if ((m_pos) < out) goto lookbehind_overrun +/* This MAX_255_COUNT is the maximum number of times we can add 255 to a base +* count without overflowing an integer. The multiply will overflow when +* multiplying 255 by more than MAXINT/255. The sum will overflow earlier +* depending on the base count. Since the base count is taken from a u8 +* and a few bits, it is safe to assume that it will always be lower than +* or equal to 2*255, thus we can always prevent any overflow by accepting +* two less 255 steps. See Documentation/lzo.txt for more information. +*/ +#define MAX_255_COUNT ((((size_t)~0) / 255) - 2) +int lzo1x_decompress_safe (const unsigned char *in,size_t in_len,unsigned char *out,size_t *out_len) {
@@ -55,12 +65,19 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,if (t <16 ) {if (likely (state ==0 )) {if (unlikely (t ==0 )) { +size_t offset; +const unsigned char *ip_last = ip; +while (unlikely (*ip ==0 )) { - t +=255 ; ip++;NEED_IP (1 ); } - t +=15 + *ip++; + offset = ip - ip_last; +if (unlikely (offset >MAX_255_COUNT )) +return LZO_E_ERROR ; + + offset = (offset <<8 ) - offset; + t += offset +15 + *ip++; } t +=3 ; copy_literal_run:
@@ -116,12 +133,19 @@ copy_literal_run: }else if (t >=32 ) { t = (t &31 ) + (3 -1 );if (unlikely (t ==2 )) { +size_t offset; +const unsigned char *ip_last = ip; +while (unlikely (*ip ==0 )) { - t +=255 ; ip++;NEED_IP (1 ); } - t +=31 + *ip++; + offset = ip - ip_last; +if (unlikely (offset >MAX_255_COUNT )) +return LZO_E_ERROR ; + + offset = (offset <<8 ) - offset; + t += offset +31 + *ip++;NEED_IP (2 ); } m_pos = op -1 ;
@@ -134,12 +158,19 @@ copy_literal_run: m_pos -= (t &8 ) <<11 ; t = (t &7 ) + (3 -1 );if (unlikely (t ==2 )) { +size_t offset; +const unsigned char *ip_last = ip; +while (unlikely (*ip ==0 )) { - t +=255 ; ip++;NEED_IP (1 ); } - t +=7 + *ip++; + offset = ip - ip_last; +if (unlikely (offset >MAX_255_COUNT )) +return LZO_E_ERROR ; + + offset = (offset <<8 ) - offset; + t += offset +7 + *ip++;NEED_IP (2 ); } next =get_unaligned_le16 (ip);
Signature · 1 line
1.9.1
PATCH 31/91 libceph: do not hard code max auth ticket len
In reply to [email protected]From: Ilya Dryomov <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c27a3e4d667fdcad3db7b104f75659478e0c68d8 upstream.
We hard code cephx auth ticket buffer size to 256 bytes. This isn't enough for any moderate setups and, in case tickets themselves are not encrypted, leads to buffer overflows (ceph_x_decrypt() errors out, but ceph_decode_copy() doesn't - it's just a memcpy() wrapper). Since the buffer is allocated dynamically anyway, allocated it a bit later, at the point where we know how much is going to be needed.
--- net/ceph/auth_x.c | 64 +++++++++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 35 deletions(-)
net/ceph/auth_x.c +29 -35
@@ -13,8 +13,6 @@#include "auth_x.h" #include "auth_x_protocol.h" -#define TEMP_TICKET_BUF_LEN 256 -static void ceph_x_validate_tickets (struct ceph_auth_client *ac,int *pneed);static int ceph_x_is_authenticated (struct ceph_auth_client *ac)
@@ -64,7 +62,7 @@ static int ceph_x_encrypt(struct ceph_crypto_key *secret, }static int ceph_x_decrypt (struct ceph_crypto_key *secret, -void **p,void *end,void *obuf,size_t olen) +void **p,void *end,void **obuf,size_t olen) {struct ceph_x_encrypt_header head;size_t head_len =sizeof (head);
@@ -75,8 +73,14 @@ static int ceph_x_decrypt(struct ceph_crypto_key *secret,return -EINVAL ;dout ("ceph_x_decrypt len %d\n" , len); - ret =ceph_decrypt2 (secret, &head, &head_len, obuf, &olen, - *p, len); +if (*obuf ==NULL ) { + *obuf =kmalloc (len,GFP_NOFS ); +if (!*obuf) +return -ENOMEM ; + olen = len; + } + + ret =ceph_decrypt2 (secret, &head, &head_len, *obuf, &olen, *p, len);if (ret)return ret;if (head.struct_v !=1 ||le64_to_cpu (head.magic) !=CEPHX_ENC_MAGIC )
@@ -131,18 +135,19 @@ static void remove_ticket_handler(struct ceph_auth_client *ac,static int process_one_ticket (struct ceph_auth_client *ac,struct ceph_crypto_key *secret, -void **p,void *end, -void *dbuf,void *ticket_buf) +void **p,void *end) {struct ceph_x_info *xi = ac->private;int type;u8 tkt_struct_v, blob_struct_v;struct ceph_x_ticket_handler *th; +void *dbuf =NULL ;void *dp, *dend;int dlen;char is_enc;struct timespec validity;struct ceph_crypto_key old_key; +void *ticket_buf =NULL ;void *tp, *tpend;struct ceph_timespec new_validity;struct ceph_crypto_key new_session_key;
@@ -167,8 +172,7 @@ static int process_one_ticket(struct ceph_auth_client *ac, }/* blob for me */ - dlen =ceph_x_decrypt (secret, p, end, dbuf, -TEMP_TICKET_BUF_LEN ); + dlen =ceph_x_decrypt (secret, p, end, &dbuf,0 );if (dlen <=0 ) { ret = dlen; goto out;
@@ -195,20 +199,25 @@ static int process_one_ticket(struct ceph_auth_client *ac,/* ticket blob for service */ ceph_decode_8_safe (p, end, is_enc, bad); - tp = ticket_buf;if (is_enc) {/* encrypted */ dout (" encrypted ticket\n" ); - dlen =ceph_x_decrypt (&old_key, p, end, ticket_buf, -TEMP_TICKET_BUF_LEN ); + dlen =ceph_x_decrypt (&old_key, p, end, &ticket_buf,0 );if (dlen <0 ) { ret = dlen; goto out; } + tp = ticket_buf; dlen =ceph_decode_32 (&tp); }else {/* unencrypted */ ceph_decode_32_safe (p, end, dlen, bad); + ticket_buf =kmalloc (dlen,GFP_NOFS ); +if (!ticket_buf) { + ret = -ENOMEM ; + goto out; + } + tp = ticket_buf;ceph_decode_need (p, end, dlen, bad);ceph_decode_copy (p, ticket_buf, dlen); }
@@ -237,6 +246,8 @@ static int process_one_ticket(struct ceph_auth_client *ac, xi->have_keys |= th->service; out: +kfree (ticket_buf); +kfree (dbuf);return ret; bad:
@@ -249,21 +260,10 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, void *buf, void *end) { void *p = buf; -char *dbuf; -char *ticket_buf;u8 reply_struct_v;u32 num;int ret; - dbuf =kmalloc (TEMP_TICKET_BUF_LEN ,GFP_NOFS ); -if (!dbuf) -return -ENOMEM ; - - ret = -ENOMEM ; - ticket_buf =kmalloc (TEMP_TICKET_BUF_LEN ,GFP_NOFS ); -if (!ticket_buf) - goto out_dbuf; -ceph_decode_8_safe (&p, end, reply_struct_v, bad);if (reply_struct_v !=1 )return -EINVAL ;
@@ -272,22 +272,15 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,dout ("%d tickets\n" , num);while (num--) { - ret =process_one_ticket (ac, secret, &p, end, - dbuf, ticket_buf); + ret =process_one_ticket (ac, secret, &p, end);if (ret) - goto out; +return ret; } - ret =0 ; -out: -kfree (ticket_buf); -out_dbuf: -kfree (dbuf); -return ret; +return 0 ; bad: - ret = -EINVAL ; - goto out; +return -EINVAL ; } static int ceph_x_build_authorizer(struct ceph_auth_client *ac,
@@ -603,13 +596,14 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac,struct ceph_x_ticket_handler *th;int ret =0 ;struct ceph_x_authorize_reply reply; +void *preply = &reply;void *p = au->reply_buf;void *end = p +sizeof (au->reply_buf); th =get_ticket_handler (ac, au->service);if (IS_ERR (th))return PTR_ERR (th); - ret =ceph_x_decrypt (&th->session_key, &p, end, &reply,sizeof (reply)); + ret =ceph_x_decrypt (&th->session_key, &p, end, &preply,sizeof (reply));if (ret <0 )return ret;if (ret !=sizeof (reply))
Signature · 1 line
1.9.1
PATCH 31/177 regmap: debugfs: fix possbile NULL pointer dereference
In reply to [email protected]From: Xiubo Li <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 2c98e0c1cc6b8e86f1978286c3d4e0769ee9d733 upstream.
If 'map->dev' is NULL and there will lead dev_name() to be NULL pointer dereference. So before dev_name(), we need to have check of the map->dev pionter.
We also should make sure that the 'name' pointer shouldn't be NULL for debugfs_create_dir(). So here using one default "dummy" debugfs name when the 'name' pointer and 'map->dev' are both NULL.
--- drivers/base/regmap/regmap-debugfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/base/regmap/regmap-debugfs.c +6 -1
@@ -244,7 +244,12 @@ static const struct file_operations regmap_access_fops = {void regmap_debugfs_init (struct regmap *map) { - map->debugfs =debugfs_create_dir (dev_name (map->dev), +const char *devname ="dummy" ; + +if (map->dev) + devname =dev_name (map->dev); + + map->debugfs =debugfs_create_dir (devname, regmap_debugfs_root);if (!map->debugfs) {dev_warn (map->dev,"Failed to create debugfs directory\n" );
Signature · 1 line
1.9.1
PATCH 32/91 Input: serport - add compat handling for SPIOCSTYPE ioctl
In reply to [email protected]From: John Sung <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit a80d8b02751060a178bb1f7a6b7a93645a7a308b upstream.
When running a 32-bit inputattach utility in a 64-bit system, there will be error code "inputattach: can't set device type". This is caused by the serport device driver not supporting compat_ioctl, so that SPIOCSTYPE ioctl fails.
--- drivers/input/serio/serport.c | 45 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-)
drivers/input/serio/serport.c +38 -7
@@ -21,6 +21,7 @@#include <linux/init.h> #include <linux/serio.h> #include <linux/tty.h> +#include <linux/compat.h> MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" );MODULE_DESCRIPTION ("Input device TTY line discipline" );
@@ -196,28 +197,55 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, ureturn 0 ; } +static void serport_set_type (struct tty_struct *tty,unsigned long type) +{ +struct serport *serport = tty->disc_data; + + serport->id.proto = type &0x000000ff ; + serport->id.id = (type &0x0000ff00 ) >>8 ; + serport->id.extra = (type &0x00ff0000 ) >>16 ; +} +/* * serport_ldisc_ioctl() allows to set the port protocol, and device ID */ -static int serport_ldisc_ioctl (struct tty_struct * tty,struct file * file,unsigned int cmd,unsigned long arg) +static int serport_ldisc_ioctl (struct tty_struct *tty,struct file *file, +unsigned int cmd,unsigned long arg) { -struct serport *serport = (struct serport *) tty->disc_data; -unsigned long type; -if (cmd ==SPIOCSTYPE ) { +unsigned long type; +if (get_user (type, (unsigned long __user *) arg))return -EFAULT ; - serport->id.proto = type &0x000000ff ; - serport->id.id = (type &0x0000ff00 ) >>8 ; - serport->id.extra = (type &0x00ff0000 ) >>16 ; +serport_set_type (tty, type); +return 0 ; + } + +return -EINVAL ; +} + +#ifdef CONFIG_COMPAT +#define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t) +static long serport_ldisc_compat_ioctl (struct tty_struct *tty, +struct file *file, +unsigned int cmd,unsigned long arg) +{ +if (cmd ==COMPAT_SPIOCSTYPE ) { +void __user *uarg =compat_ptr (arg); +compat_ulong_t compat_type; + +if (get_user (compat_type, (compat_ulong_t __user *)uarg)) +return -EFAULT ; +serport_set_type (tty, compat_type);return 0 ; }return -EINVAL ; } +#endif static void serport_ldisc_write_wakeup (struct tty_struct * tty) {
@@ -241,6 +269,9 @@ static struct tty_ldisc_ops serport_ldisc = { .close = serport_ldisc_close, .read = serport_ldisc_read, .ioctl = serport_ldisc_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = serport_ldisc_compat_ioctl, +#endif .receive_buf = serport_ldisc_receive, .write_wakeup = serport_ldisc_write_wakeup };
Signature · 1 line
1.9.1
PATCH 32/177 regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.
In reply to [email protected]From: Xiubo Li <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d6b41cb06044a7d895db82bdd54f6e4219970510 upstream.
Since we cannot make sure the 'val_count' will always be none zero here, and then if it equals to zero, the kmemdup() will return ZERO_SIZE_PTR, which equals to ((void *)16).
So this patch fix this with just doing the zero check before calling kmemdup().
--- drivers/base/regmap/regmap.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/base/regmap/regmap.c +5 -0
@@ -600,6 +600,11 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,if (val_bytes ==1 ) { wval = (void *)val; }else { +if (!val_count) { + ret = -EINVAL ; + goto out; + } + wval =kmemdup (val, val_count * val_bytes,GFP_KERNEL );if (!wval) { ret = -ENOMEM ;
Signature · 1 line
1.9.1
PATCH 33/177 libata-sff: Fix controllers with no ctl port
In reply to [email protected]From: Ondrej Zary <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 6d8ca28fa688a9354bc9fbc935bdaeb3651b6677 upstream.
Currently, ata_sff_softreset is skipped for controllers with no ctl port. But that also skips ata_sff_dev_classify required for device detection. This means that libata is currently broken on controllers with no ctl port.
No device connected:
[ 1.872480] pata_isapnp 01:01.02: activated [ 1.889823] scsi2 : pata_isapnp [ 1.890109] ata3: PATA max PIO0 cmd 0x1e8 ctl 0x0 irq 11 [ 6.888110] ata3.01: qc timeout (cmd 0xec) [ 6.888179] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 16.888085] ata3.01: qc timeout (cmd 0xec) [ 16.888147] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 46.888086] ata3.01: qc timeout (cmd 0xec) [ 46.888148] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 51.888100] ata3.00: qc timeout (cmd 0xec) [ 51.888160] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x5) [ 61.888079] ata3.00: qc timeout (cmd 0xec) [ 61.888141] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x5) [ 91.888089] ata3.00: qc timeout (cmd 0xec) [ 91.888152] ata3.00: failed to IDENTIFY (I/O error, err_mask=0x5)
ATAPI device connected:
[ 1.882061] pata_isapnp 01:01.02: activated [ 1.893430] scsi2 : pata_isapnp [ 1.893719] ata3: PATA max PIO0 cmd 0x1e8 ctl 0x0 irq 11 [ 6.892107] ata3.01: qc timeout (cmd 0xec) [ 6.892171] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 16.892079] ata3.01: qc timeout (cmd 0xec) [ 16.892138] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 46.892079] ata3.01: qc timeout (cmd 0xec) [ 46.892138] ata3.01: failed to IDENTIFY (I/O error, err_mask=0x5) [ 46.908586] ata3.00: ATAPI: ACER CD-767E/O, V1.5X, max PIO2, CDB intr [ 46.924570] ata3.00: configured for PIO0 (device error ignored) [ 46.926295] scsi 2:0:0:0: CD-ROM ACER CD-767E/O 1.5X PQ: 0 ANSI: 5 [ 46.984519] sr0: scsi3-mmc drive: 6x/6x xa/form2 tray [ 46.984592] cdrom: Uniform CD-ROM driver Revision: 3.20
So don't skip ata_sff_softreset, just skip the reset part of ata_bus_softreset if the ctl port is not available.
This makes IDE port on ES968 behave correctly:
No device connected:
[ 4.670888] pata_isapnp 01:01.02: activated [ 4.673207] scsi host2: pata_isapnp [ 4.673675] ata3: PATA max PIO0 cmd 0x1e8 ctl 0x0 irq 11 [ 7.081840] Adding 2541652k swap on /dev/sda2. Priority:-1 extents:1 across:2541652k
ATAPI device connected:
[ 4.704362] pata_isapnp 01:01.02: activated [ 4.706620] scsi host2: pata_isapnp [ 4.706877] ata3: PATA max PIO0 cmd 0x1e8 ctl 0x0 irq 11 [ 4.872782] ata3.00: ATAPI: ACER CD-767E/O, V1.5X, max PIO2, CDB intr [ 4.888673] ata3.00: configured for PIO0 (device error ignored) [ 4.893984] scsi 2:0:0:0: CD-ROM ACER CD-767E/O 1.5X PQ: 0 ANSI: 5 [ 7.015578] Adding 2541652k swap on /dev/sda2. Priority:-1 extents:1 across:2541652k
--- drivers/ata/libata-sff.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/ata/libata-sff.c +9 -11
@@ -2008,13 +2008,15 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,DPRINTK ("ata%u: bus reset via SRST\n" , ap->print_id); -/* software reset. causes dev0 to be selected */ -iowrite8 (ap->ctl, ioaddr->ctl_addr); -udelay (20 );/* FIXME: flush */ -iowrite8 (ap->ctl |ATA_SRST , ioaddr->ctl_addr); -udelay (20 );/* FIXME: flush */ -iowrite8 (ap->ctl, ioaddr->ctl_addr); - ap->last_ctl = ap->ctl; +if (ap->ioaddr.ctl_addr) { +/* software reset. causes dev0 to be selected */ +iowrite8 (ap->ctl, ioaddr->ctl_addr); +udelay (20 );/* FIXME: flush */ +iowrite8 (ap->ctl |ATA_SRST , ioaddr->ctl_addr); +udelay (20 );/* FIXME: flush */ +iowrite8 (ap->ctl, ioaddr->ctl_addr); + ap->last_ctl = ap->ctl; + }/* wait the port to become ready */ return ata_sff_wait_after_reset (&ap->link, devmask, deadline);
@@ -2215,10 +2217,6 @@ void ata_sff_error_handler(struct ata_port *ap)spin_unlock_irqrestore (ap->lock, flags); -/* ignore ata_sff_softreset if ctl isn't accessible */ -if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr) - softreset =NULL ; -/* ignore built-in hardresets if SCR access is not available */ if ((hardreset == sata_std_hardreset || hardreset == sata_sff_hardreset) && !sata_scr_valid (&ap->link))
Signature · 1 line
1.9.1
PATCH 33/91 usb: hub: take hub->hdev reference when processing from eventlist
In reply to [email protected]From: Joe Lawrence <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c605f3cdff53a743f6d875b76956b239deca1272 upstream.
During surprise device hotplug removal tests, it was observed that hub_events may try to call usb_lock_device on a device that has already been freed. Protect the usb_device by taking out a reference (under the hub_event_lock) when hub_events pulls it off the list, returning the reference after hub_events is finished using it.
--- drivers/usb/core/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +3 -1
@@ -3729,9 +3729,10 @@ static void hub_events(void) hub = list_entry(tmp, struct usb_hub, event_list);kref_get (&hub->kref); + hdev = hub->hdev; +usb_get_dev (hdev);spin_unlock_irq (&hub_event_lock); - hdev = hub->hdev; hub_dev = hub->intfdev; intf =to_usb_interface (hub_dev); dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n",
@@ -3946,6 +3947,7 @@ static void hub_events(void)usb_autopm_put_interface (intf); loop_disconnected:usb_unlock_device (hdev); +usb_put_dev (hdev);kref_put (&hub->kref, hub_release); }/* end while (1) */
Signature · 1 line
1.9.1
PATCH 34/177 NFSv4: fix open/lock state recovery error handling
In reply to [email protected]From: Trond Myklebust <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit df817ba35736db2d62b07de6f050a4db53492ad8 upstream.
The current open/lock state recovery unfortunately does not handle errors such as NFS4ERR_CONN_NOT_BOUND_TO_SESSION correctly. Instead of looping, just proceeds as if the state manager is finished recovering. This patch ensures that we loop back, handle higher priority errors and complete the open/lock state recovery.
--- fs/nfs/nfs4state.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
fs/nfs/nfs4state.c +6 -10
@@ -1515,7 +1515,8 @@ restart:if (status <0 ) {set_bit (ops->owner_flag_bit, &sp->so_flags);nfs4_put_state_owner (sp); -return nfs4_recovery_handle_error (clp, status); + status =nfs4_recovery_handle_error (clp, status); +return (status !=0 ) ? status : -EAGAIN ; }nfs4_put_state_owner (sp);
@@ -1524,7 +1525,7 @@ restart:spin_unlock (&clp->cl_lock); }rcu_read_unlock (); -return status; +return 0 ; }static int nfs4_check_lease (struct nfs_client *clp)
@@ -1796,23 +1797,18 @@ static void nfs4_state_manager(struct nfs_client *clp)if (test_bit (NFS4CLNT_RECLAIM_REBOOT , &clp->cl_state)) { status =nfs4_do_reclaim (clp, clp->cl_mvops->reboot_recovery_ops); -if (test_bit (NFS4CLNT_LEASE_EXPIRED , &clp->cl_state) || -test_bit (NFS4CLNT_SESSION_RESET , &clp->cl_state)) -continue ; -nfs4_state_end_reclaim_reboot (clp); -if (test_bit (NFS4CLNT_RECLAIM_NOGRACE , &clp->cl_state)) +if (status == -EAGAIN )continue ;if (status <0 ) goto out_error; +nfs4_state_end_reclaim_reboot (clp); }/* Now recover expired state... */ if (test_and_clear_bit (NFS4CLNT_RECLAIM_NOGRACE , &clp->cl_state)) { status =nfs4_do_reclaim (clp, clp->cl_mvops->nograce_recovery_ops); -if (test_bit (NFS4CLNT_LEASE_EXPIRED , &clp->cl_state) || -test_bit (NFS4CLNT_SESSION_RESET , &clp->cl_state) || -test_bit (NFS4CLNT_RECLAIM_REBOOT , &clp->cl_state)) +if (status == -EAGAIN )continue ;if (status <0 ) goto out_error;
Signature · 1 line
1.9.1
PATCH 34/91 storage: Add single-LUN quirk for Jaz USB Adapter
In reply to [email protected]From: Mark <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c66f1c62e85927357e7b3f4c701614dcb5c498a2 upstream.
The Iomega Jaz USB Adapter is a SCSI-USB converter cable. The hardware seems to be identical to e.g. the Microtech XpressSCSI, using a Shuttle/ SCM chip set. However its firmware restricts it to only work with Jaz drives.
On connecting the cable a message like this appears four times in the log:
reset full speed USB device number 4 using uhci_hcd
That's non-fatal but the US_FL_SINGLE_LUN quirk fixes it.
--- drivers/usb/storage/unusual_devs.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/storage/unusual_devs.h +6 -0
@@ -733,6 +733,12 @@ UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x0100, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_SINGLE_LUN ), +UNUSUAL_DEV (0x059b ,0x0040 ,0x0100 ,0x0100 , +"Iomega" , +"Jaz USB Adapter" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_SINGLE_LUN ), +/* Reported by <[email protected]> */ UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, "LaCie",
Signature · 1 line
1.9.1
PATCH 35/177 serial: 8250: Add Quark X1000 to 8250_pci.c
In reply to [email protected]From: Bryan O'Donoghue <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 1ede7dcca3c4fa15a518ab0473126f9c3e621e4c upstream.
Quark X1000 contains two designware derived 8250 serial ports. Each port has a unique PCI configuration space consisting of BAR0:UART BAR1:DMA respectively.
Unlike the standard 8250 the register width is 32 bits for RHR,IER etc The Quark UART has a fundamental clock @ 44.2368 MHz allowing for a bitrate of up to about 2.76 megabits per second.
This patch enables standard 8250 mode
--- drivers/tty/serial/8250/8250_pci.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/tty/serial/8250/8250_pci.c +21 -0
@@ -1164,6 +1164,7 @@ pci_xr17c154_setup(struct serial_private *priv,#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a +#define PCI_DEVICE_ID_INTEL_QRK_UART 0x0936/* Unknown vendors/cards - this should not be in linux/pci_ids.h */ #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
@@ -1686,6 +1687,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .init = pci_eg20t_init, .setup = pci_default_setup, }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_QRK_UART, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_default_setup, + },/* * Cronyx Omega PCI (PLX-chip based) */
@@ -1894,6 +1902,7 @@ enum pci_board_num_t { pbn_ADDIDATA_PCIe_4_3906250, pbn_ADDIDATA_PCIe_8_3906250, pbn_ce4100_1_115200, + pbn_qrk, pbn_omegapci, pbn_NETMOS9900_2s_115200, pbn_brcm_trumanage,
@@ -2592,6 +2601,12 @@ static struct pciserial_board pci_boards[] __devinitdata = { .base_baud = 921600, .reg_shift = 2, }, + [pbn_qrk] = { + .flags = FL_BASE0, + .num_ports = 1, + .base_baud = 2764800, + .reg_shift = 2, + }, [pbn_omegapci] = { .flags = FL_BASE0, .num_ports = 8,
@@ -4164,6 +4179,12 @@ static struct pci_device_id serial_pci_tbl[] = { pbn_ce4100_1_115200 },/* +* Intel Quark x1000 +*/ + {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_QRK_UART , +PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , + pbn_qrk }, +/* * Cronyx Omega PCI */ { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_CRONYX_OMEGA,
Signature · 1 line
1.9.1
PATCH 35/91 xhci: Fix null pointer dereference if xhci initialization fails
In reply to [email protected]From: Mathias Nyman <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c207e7c50f31113c24a9f536fcab1e8a256985d7 upstream.
If xhci initialization fails before the roothub bandwidth domains (xhci->rh_bw[i]) are allocated it will oops when trying to access rh_bw members in xhci_mem_cleanup().
--- drivers/usb/host/xhci-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +1 -1
@@ -1813,7 +1813,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) } num_ports =HCS_MAX_PORTS (xhci->hcs_params1); -for (i =0 ; i < num_ports; i++) { +for (i =0 ; i < num_ports && xhci->rh_bw; i++) {struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;for (j =0 ; j <XHCI_MAX_INTERVAL ; j++) {struct list_head *ep = &bwt->interval_bw[j].endpoints;
Signature · 1 line
1.9.1
PATCH 36/177 framebuffer: fix border color
In reply to [email protected]From: Mikulas Patocka <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit f74a289b9480648a654e5afd8458c2263c03a1e1 upstream.
The framebuffer code uses the current background color to fill the border when switching consoles, however, this results in inconsistent behavior. For example:
- start Midnigh Commander
- the border is black
- switch to another console and switch back
- the border is cyan
- type something into the command line in mc
- the border is cyan
- switch to another console and switch back
- the border is black
- press F9 to go to menu
- the border is black
- switch to another console and switch back
- the border is dark blue
When switching to a console with Midnight Commander, the border is random color that was left selected by the slang subsystem.
This patch fixes this inconsistency by always using black as the background color when switching consoles.
--- drivers/video/console/bitblit.c | 3 +-- drivers/video/console/fbcon_ccw.c | 3 +-- drivers/video/console/fbcon_cw.c | 3 +-- drivers/video/console/fbcon_ud.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-)
drivers/video/console/bitblit.c +1 -2
@@ -205,7 +205,6 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,static void bit_clear_margins (struct vc_data *vc,struct fb_info *info,int bottom_only) { -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ;unsigned int cw = vc->vc_font.width;unsigned int ch = vc->vc_font.height;unsigned int rw = info->var.xres - (vc->vc_cols*cw);
@@ -214,7 +213,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,unsigned int bs = info->var.yres - bh;struct fb_fillrect region; - region.color =attr_bgcol_ec (bgshift, vc, info); + region.color =0 ; region.rop =ROP_COPY ;if (rw && !bottom_only) {
drivers/video/console/fbcon_ccw.c +1 -2
@@ -197,9 +197,8 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,unsigned int bh = info->var.xres - (vc->vc_rows*ch);unsigned int bs = vc->vc_rows*ch;struct fb_fillrect region; -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ; - region.color =attr_bgcol_ec (bgshift,vc,info); + region.color =0 ; region.rop =ROP_COPY ;if (rw && !bottom_only) {
drivers/video/console/fbcon_cw.c +1 -2
@@ -181,9 +181,8 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,unsigned int bh = info->var.xres - (vc->vc_rows*ch);unsigned int rs = info->var.yres - rw;struct fb_fillrect region; -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ; - region.color =attr_bgcol_ec (bgshift,vc,info); + region.color =0 ; region.rop =ROP_COPY ;if (rw && !bottom_only) {
drivers/video/console/fbcon_ud.c +1 -2
@@ -227,9 +227,8 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,unsigned int rw = info->var.xres - (vc->vc_cols*cw);unsigned int bh = info->var.yres - (vc->vc_rows*ch);struct fb_fillrect region; -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ; - region.color =attr_bgcol_ec (bgshift,vc,info); + region.color =0 ; region.rop =ROP_COPY ;if (rw && !bottom_only) {
Signature · 1 line
1.9.1
PATCH 36/91 futex: Unlock hb->lock in futex_wait_requeue_pi() error path
In reply to [email protected]From: Thomas Gleixner <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 13c42c2f43b19aab3195f2d357db00d1e885eaa8 upstream.
futex_wait_requeue_pi() calls futex_wait_setup(). If futex_wait_setup() succeeds it returns with hb->lock held and preemption disabled. Now the sanity check after this does:
if (match_futex(&q.key, &key2)) {
ret = -EINVAL;
goto out_put_keys;
}which releases the keys but does not release hb->lock.
So we happily return to user space with hb->lock held and therefor preemption disabled.
Unlock hb->lock before taking the exit route.
--- kernel/futex.c | 1 + 1 file changed, 1 insertion(+)
kernel/futex.c +1 -0
@@ -2460,6 +2460,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,* shared futexes. We need to compare the keys: */ if (match_futex (&q.key, &key2)) { +queue_unlock (&q, hb); ret = -EINVAL ; goto out_put_keys; }
Signature · 1 line
1.9.1
PATCH 37/91 alarmtimer: Return relative times in timer_gettime
In reply to [email protected]From: Richard Larocque <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit e86fea764991e00a03ff1e56409ec9cacdbda4c9 upstream.
Returns the time remaining for an alarm timer, rather than the time at which it is scheduled to expire. If the timer has already expired or it is not currently scheduled, the it_value's members are set to zero.
This new behavior matches that of the other posix-timers and the POSIX specifications.
This is a change in user-visible behavior, and may break existing applications. Hopefully, few users rely on the old incorrect behavior.
[lizf: Backported to 3.4:
- add alarm_expires_remaining() introduced by commit 6cffe00f7d4e]
--- kernel/time/alarmtimer.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
kernel/time/alarmtimer.c +17 -7
@@ -232,6 +232,12 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) } +ktime_t alarm_expires_remaining (const struct alarm *alarm) +{ +struct alarm_base *base = &alarm_bases[alarm->type]; +return ktime_sub (alarm->node.expires, base->gettime ()); +} +#ifdef CONFIG_RTC_CLASS /** * alarmtimer_suspend - Suspend time callback
@@ -525,18 +531,22 @@ static int alarm_timer_create(struct k_itimer *new_timer)* @new_timer: k_itimer pointer * @cur_setting: itimerspec data to fill * -* Copies the itimerspec data out from the k_itimer +* Copies out the current itimerspec data */ static void alarm_timer_get (struct k_itimer *timr,struct itimerspec *cur_setting) { -memset (cur_setting,0 ,sizeof (struct itimerspec )); +ktime_t relative_expiry_time = +alarm_expires_remaining (&(timr->it.alarm.alarmtimer)); + +if (ktime_to_ns (relative_expiry_time) >0 ) { + cur_setting->it_value =ktime_to_timespec (relative_expiry_time); + }else { + cur_setting->it_value.tv_sec =0 ; + cur_setting->it_value.tv_nsec =0 ; + } - cur_setting->it_interval = -ktime_to_timespec (timr->it.alarm.interval); - cur_setting->it_value = -ktime_to_timespec (timr->it.alarm.alarmtimer.node.expires); -return ; + cur_setting->it_interval =ktime_to_timespec (timr->it.alarm.interval); }/**
Signature · 1 line
1.9.1
PATCH 37/177 mpc85xx_edac: Make L2 interrupt shared too
In reply to [email protected]From: Borislav Petkov <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit a18c3f16a907b8977ef65fc8dd71ed3f7b751748 upstream.
The other two interrupt handlers in this driver are shared, except this one. When loading the driver, it fails like this.
So make the IRQ line shared.
Freescale(R) MPC85xx EDAC driver, (C) 2006 Montavista Softwarempc85xx_mc_err_probe: No ECC DIMMs discovered
EDAC DEVICE0: Giving out device to module MPC85xx_edac controller mpc85xx_l2_err: DEV mpc85xx_l2_err (INTERRUPT)
genirq: Flags mismatch irq 16. 00000000 ([EDAC] L2 err) vs. 00000080 ([EDAC] PCI err)mpc85xx_l2_err_probe: Unable to request irq 16 for MPC85xx L2 errremove_proc_entry: removing non-empty directory 'irq/16', leaking at least 'aerdrv'
------------[ cut here ]------------ WARNING: at fs/proc/generic.c:521 Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc5-dirty #1 task: ee058000 ti: ee046000 task.ti: ee046000 NIP: c016c0c4 LR: c016c0c4 CTR: c037b51c REGS: ee047c10 TRAP: 0700 Not tainted (3.17.0-rc5-dirty) MSR: 00029000 <CE,EE,ME> CR: 22008022 XER: 20000000
GPR00: c016c0c4 ee047cc0 ee058000 00000053 00029000 00000000 c037c744 00000003
GPR08: c09aab28 c09aab24 c09aab28 00000156 20008028 00000000 c0002ac8 00000000
GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000139 c0950394
GPR24: c09f0000 ee5585b0 ee047d08 c0a10000 ee047d08 ee15f808 00000002 ee03f660 NIP [c016c0c4] remove_proc_entry
LR [c016c0c4] remove_proc_entry
Call Trace:
remove_proc_entry (unreliable)unregister_irq_procfree_descirq_free_descsmpc85xx_l2_err_probeplatform_drv_probereally_probe__driver_attachbus_for_each_devbus_add_driverdriver_registermpc85xx_mc_initdo_one_initcallkernel_init_freeablekernel_initret_from_kernel_thread
Instruction dump: ...
--- drivers/edac/mpc85xx_edac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/edac/mpc85xx_edac.c +2 -1
@@ -577,7 +577,8 @@ static int __devinit mpc85xx_l2_err_probe(struct platform_device *op)if (edac_op_state ==EDAC_OPSTATE_INT ) { pdata->irq =irq_of_parse_and_map (op->dev.of_node,0 ); res =devm_request_irq (&op->dev, pdata->irq, - mpc85xx_l2_isr,IRQF_DISABLED , + mpc85xx_l2_isr, +IRQF_DISABLED |IRQF_SHARED ,"[EDAC] L2 err" , edac_dev);if (res <0 ) { printk(KERN_ERR
Signature · 1 line
1.9.1
PATCH 38/177 NFSv4.1: Fix an NFSv4.1 state renewal regression
In reply to [email protected]From: Andy Adamson <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d1f456b0b9545f1606a54cd17c20775f159bd2ce upstream.
Commit 2f60ea6b8ced ("NFSv4: The NFSv4.0 client must send RENEW calls if it holds a delegation") set the NFS4_RENEW_TIMEOUT flag in nfs4_renew_state, and does not put an nfs41_proc_async_sequence call, the NFSv4.1 lease renewal heartbeat
call, on the wire to renew the NFSv4.1 state if the flag was not set.
The NFS4_RENEW_TIMEOUT flag is set when "now" is after the last renewal (cl_last_renewal) plus the lease time divided by 3. This is arbitrary and sometimes does the following:
In normal operation, the only way a future state renewal call is put on the wire is via a call to nfs4_schedule_state_renewal, which schedules a nfs4_renew_state workqueue task. nfs4_renew_state determines if the NFS4_RENEW_TIMEOUT should be set, and the calls nfs41_proc_async_sequence, which only gets sent if the NFS4_RENEW_TIMEOUT flag is set. Then the nfs41_proc_async_sequence rpc_release function schedules another state remewal via nfs4_schedule_state_renewal.
Without this change we can get into a state where an application stops accessing the NFSv4.1 share, state renewal calls stop due to the NFS4_RENEW_TIMEOUT flag _not_ being set. The only way to recover from this situation is with a clientid re-establishment, once the application resumes and the server has timed out the lease and so returns NFS4ERR_BAD_SESSION on the subsequent SEQUENCE operation.
An example application:
open, lock, write a file.
sleep for 6 * lease (could be less)
ulock, close.
In the above example with NFSv4.1 delegations enabled, without this change, there are no OP_SEQUENCE state renewal calls during the sleep, and the clientid is recovered due to lease expiration on the close.
This issue does not occur with NFSv4.1 delegations disabled, nor with NFSv4.0, with or without delegations enabled.
--- fs/nfs/nfs4proc.c | 2 +- fs/nfs/nfs4renewd.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +1 -1
@@ -5796,7 +5796,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *crint ret =0 ;if ((renew_flags &NFS4_RENEW_TIMEOUT ) ==0 ) -return 0 ; +return -EAGAIN ; task =_nfs41_proc_sequence (clp, cred, &nfs41_sequence_ops);if (IS_ERR (task)) ret =PTR_ERR (task);
fs/nfs/nfs4renewd.c +10 -2
@@ -88,10 +88,18 @@ nfs4_renew_state(struct work_struct *work) }nfs_expire_all_delegations (clp); }else { +int ret; +/* Queue an asynchronous RENEW. */ - ops->sched_state_renewal (clp, cred, renew_flags); + ret = ops->sched_state_renewal (clp, cred, renew_flags);put_rpccred (cred); - goto out_exp; +switch (ret) { +default : + goto out_exp; +case -EAGAIN : +case -ENOMEM : +break ; + } } }else { dprintk("%s: failed to call renewd. Reason: lease not expired \n",
Signature · 1 line
1.9.1
PATCH 38/91 alarmtimer: Do not signal SIGEV_NONE timers
In reply to [email protected]From: Richard Larocque <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 265b81d23a46c39df0a735a3af4238954b41a4c2 upstream.
Avoids sending a signal to alarm timers created with sigev_notify set to SIGEV_NONE by checking for that special case in the timeout callback.
The regular posix timers avoid sending signals to SIGEV_NONE timers by not scheduling any callbacks for them in the first place. Although it would be possible to do something similar for alarm timers, it's simpler to handle this as a special case in the timeout.
Prior to this patch, the alarm timer would ignore the sigev_notify value and try to deliver signals to the process anyway. Even worse, the sanity check for the value of sigev_signo is skipped when SIGEV_NONE was specified, so the signal number could be bogus. If sigev_signo was an unitialized value (as it often would be if SIGEV_NONE is used), then it's hard to predict which signal will be sent.
--- kernel/time/alarmtimer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/time/alarmtimer.c +4 -2
@@ -456,8 +456,10 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, { struct k_itimer *ptr = container_of(alarm, struct k_itimer, it.alarm.alarmtimer); -if (posix_timer_event (ptr,0 ) !=0 ) - ptr->it_overrun++; +if ((ptr->it_sigev_notify & ~SIGEV_THREAD_ID ) !=SIGEV_NONE ) { +if (posix_timer_event (ptr,0 ) !=0 ) + ptr->it_overrun++; + }/* Re-add periodic timers */ if (ptr->it.alarm.interval.tv64) {
Signature · 1 line
1.9.1
PATCH 39/91 alarmtimer: Lock k_itimer during timer callback
In reply to [email protected]From: Richard Larocque <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 474e941bed9262f5fa2394f9a4a67e24499e5926 upstream.
Locks the k_itimer's it_lock member when handling the alarm timer's expiry callback.
The regular posix timers defined in posix-timers.c have this lock held during timout processing because their callbacks are routed through posix_timer_fn(). The alarm timers follow a different path, so they ought to grab the lock somewhere else.
--- kernel/time/alarmtimer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
kernel/time/alarmtimer.c +8 -2
@@ -454,8 +454,12 @@ static enum alarmtimer_type clock2alarm(clockid_t clockid)static enum alarmtimer_restart alarm_handle_timer (struct alarm *alarm,ktime_t now) { +unsigned long flags; struct k_itimer *ptr = container_of(alarm, struct k_itimer, it.alarm.alarmtimer); +enum alarmtimer_restart result =ALARMTIMER_NORESTART ; + +spin_lock_irqsave (&ptr->it_lock, flags);if ((ptr->it_sigev_notify & ~SIGEV_THREAD_ID ) !=SIGEV_NONE ) {if (posix_timer_event (ptr,0 ) !=0 ) ptr->it_overrun++;
@@ -465,9 +469,11 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm,if (ptr->it.alarm.interval.tv64) { ptr->it_overrun +=alarm_forward (alarm, now, ptr->it.alarm.interval); -return ALARMTIMER_RESTART ; + result =ALARMTIMER_RESTART ; } -return ALARMTIMER_NORESTART ; +spin_unlock_irqrestore (&ptr->it_lock, flags); + +return result; }/**
Signature · 1 line
1.9.1
PATCH 39/177 m68k: Disable/restore interrupts in hwreg_present()/hwreg_write()
In reply to [email protected]From: Geert Uytterhoeven <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit e4dc601bf99ccd1c95b7e6eef1d3cf3c4b0d4961 upstream.
hwreg_present() and hwreg_write() temporarily change the VBR register to another vector table. This table contains a valid bus error handler only, all other entries point to arbitrary addresses.
If an interrupt comes in while the temporary table is active, the processor will start executing at such an arbitrary address, and the kernel will crash.
While most callers run early, before interrupts are enabled, or explicitly disable interrupts, Finn Thain pointed out that macsonic has one callsite that doesn't, causing intermittent boot crashes. There's another unsafe callsite in hilkbd.
Fix this for good by disabling and restoring interrupts inside hwreg_present() and hwreg_write().
Explicitly disabling interrupts can be removed from the callsites later.
--- arch/m68k/mm/hwtest.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/m68k/mm/hwtest.c +6 -0
@@ -28,9 +28,11 @@int hwreg_present (volatile void *regp ) {int ret =0 ; +unsigned long flags;long save_sp, save_vbr;long tmp_vectors[3 ]; +local_irq_save (flags); __asm__ __volatile__ ("movec %/vbr,%2\n\t" "movel #Lberr1,%4@(8)\n\t"
@@ -46,6 +48,7 @@ int hwreg_present( volatile void *regp ) : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) : "a" (regp), "a" (tmp_vectors) ); +local_irq_restore (flags);return ( ret ); }
@@ -58,9 +61,11 @@ EXPORT_SYMBOL(hwreg_present);int hwreg_write (volatile void *regp,unsigned short val ) {int ret; +unsigned long flags;long save_sp, save_vbr;long tmp_vectors[3 ]; +local_irq_save (flags); __asm__ __volatile__ ("movec %/vbr,%2\n\t" "movel #Lberr2,%4@(8)\n\t"
@@ -78,6 +83,7 @@ int hwreg_write( volatile void *regp, unsigned short val ) : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) : "a" (regp), "a" (tmp_vectors), "g" (val) ); +local_irq_restore (flags);return ( ret ); }
Signature · 1 line
1.9.1
PATCH 40/177 dm bufio: update last_accessed when relinking a buffer
In reply to [email protected]From: Joe Thornber <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit eb76faf53b1ff7a77ce3f78cc98ad392ac70c2a0 upstream.
The 'last_accessed' member of the dm_buffer structure was only set when the the buffer was created. This led to each buffer being discarded after dm_bufio_max_age time even if it was used recently. In practice this resulted in all thinp metadata being evicted soon after being read -- this is particularly problematic for metadata intensive workloads like multithreaded small random IO.
'last_accessed' is now updated each time the buffer is moved to the head of the LRU list, so the buffer is now properly discarded if it was not used in dm_bufio_max_age time.
--- drivers/md/dm-bufio.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-bufio.c +1 -0
@@ -467,6 +467,7 @@ static void __relink_lru(struct dm_buffer *b, int dirty) b->list_mode = dirty;list_del (&b->lru_list);list_add (&b->lru_list, &c->lru[dirty]); + b->last_accessed = jiffies; }/*----------------------------------------------------------------
Signature · 1 line
1.9.1
PATCH 40/91 don't bugger nd->seq on set_root_rcu() from follow_dotdot_rcu()
In reply to [email protected]From: Al Viro <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 7bd88377d482e1eae3c5329b12e33cfd664fa6a9 upstream.
return the value instead, and have path_init() do the assignment. Broken by "vfs: Fix absolute RCU path walk failures due to uninitialized seq number", which was Cc-stable with 2.6.38+ as destination. This one should go where it went.
To avoid dummy value returned in case when root is already set (it would do no harm, actually, since the only caller that doesn't ignore the return value is guaranteed to have nd->root *not* set, but it's more obvious that way), lift the check into callers. And do the same to set_root(), to keep them in sync.
[lizf: Backported to 3.4:
- remove the changes to follow_link() as it doesn't call set_root()]
--- fs/namei.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
fs/namei.c +15 -15
@@ -553,24 +553,22 @@ static int complete_walk(struct nameidata *nd) static __always_inline void set_root(struct nameidata *nd) { -if (!nd->root.mnt) -get_fs_root (current->fs, &nd->root); +get_fs_root (current->fs, &nd->root); }static int link_path_walk (const char *,struct nameidata *); -static __always_inline void set_root_rcu(struct nameidata *nd) +static __always_inline unsigned set_root_rcu (struct nameidata *nd) { -if (!nd->root.mnt) { -struct fs_struct *fs = current->fs; -unsigned seq; +struct fs_struct *fs = current->fs; +unsigned seq, res; -do { - seq =read_seqcount_begin (&fs->seq); - nd->root = fs->root; - nd->seq =__read_seqcount_begin (&nd->root.dentry->d_seq); - }while (read_seqcount_retry (&fs->seq, seq)); - } +do { + seq =read_seqcount_begin (&fs->seq); + nd->root = fs->root; + res =__read_seqcount_begin (&nd->root.dentry->d_seq); + }while (read_seqcount_retry (&fs->seq, seq)); +return res; } static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link)
@@ -928,7 +926,8 @@ static void follow_mount_rcu(struct nameidata *nd)static int follow_dotdot_rcu (struct nameidata *nd) { -set_root_rcu (nd); +if (!nd->root.mnt) +set_root_rcu (nd);while (1 ) { if (nd->path.dentry == nd->root.dentry &&
@@ -1031,7 +1030,8 @@ static void follow_mount(struct path *path)static void follow_dotdot (struct nameidata *nd) { -set_root (nd); +if (!nd->root.mnt) +set_root (nd);while (1 ) {struct dentry *old = nd->path.dentry;
@@ -1633,7 +1633,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,if (flags &LOOKUP_RCU ) {br_read_lock (vfsmount_lock);rcu_read_lock (); -set_root_rcu (nd); + nd->seq =set_root_rcu (nd); }else {set_root (nd);path_get (&nd->root);
Signature · 1 line
1.9.1
PATCH 41/177 dm log userspace: fix memory leak in dm_ulog_tfr_init failure path
In reply to [email protected]From: Alexey Khoroshilov <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 56ec16cb1e1ce46354de8511eef962a417c32c92 upstream.
If cn_add_callback() fails in dm_ulog_tfr_init(), it does not deallocate prealloced memory but calls cn_del_callback().
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/md/dm-log-userspace-transfer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-log-userspace-transfer.c +1 -1
@@ -272,7 +272,7 @@ int dm_ulog_tfr_init(void) r =cn_add_callback (&ulog_cn_id,"dmlogusr" , cn_ulog_callback);if (r) { -cn_del_callback (&ulog_cn_id); +kfree (prealloced_cn_msg);return r; }
Signature · 1 line
1.9.1
PATCH 41/91 jiffies: Fix timeval conversion to jiffies
In reply to [email protected]From: Andrew Hunter <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d78c9300c51d6ceed9f6d078d4e9366f259de28c upstream.
timeval_to_jiffies tried to round a timeval up to an integral number of jiffies, but the logic for doing so was incorrect: intervals corresponding to exactly N jiffies would become N+1. This manifested itself particularly repeatedly stopping/starting an itimer:
setitimer(ITIMER_PROF, &val, NULL);setitimer(ITIMER_PROF, NULL, &val);
would add a full tick to val, _even if it was exactly representable in terms of jiffies_ (say, the result of a previous rounding.) Doing this repeatedly would cause unbounded growth in val. So fix the math.
Here's what was wrong with the conversion: we essentially computed (eliding seconds)
jiffies = usec * (NSEC_PER_USEC/TICK_NSEC)
by using scaling arithmetic, which took the best approximation of NSEC_PER_USEC/TICK_NSEC with denominator of 2^USEC_JIFFIE_SC = x/(2^USEC_JIFFIE_SC), and computed:
jiffies = (usec * x) >> USEC_JIFFIE_SC
and rounded this calculation up in the intermediate form (since we can't necessarily exactly represent TICK_NSEC in usec.) But the scaling arithmetic is a (very slight) *over*approximation of the true value; that is, instead of dividing by (1 usec/ 1 jiffie), we effectively divided by (1 usec/1 jiffie)-epsilon (rounding down). This would normally be fine, but we want to round timeouts up, and we did so by adding 2^USEC_JIFFIE_SC - 1 before the shift; this would be fine if our division was exact, but dividing this by the slightly smaller factor was equivalent to adding just _over_ 1 to the final result (instead of just _under_ 1, as desired.)
In particular, with HZ=1000, we consistently computed that 10000 usec was 11 jiffies; the same was true for any exact multiple of TICK_NSEC.
We could possibly still round in the intermediate form, adding something less than 2^USEC_JIFFIE_SC - 1, but easier still is to convert usec->nsec, round in nanoseconds, and then convert using time*spec*_to_jiffies. This adds one constant multiplication, and is not observably slower in microbenchmarks on recent x86 hardware.
Tested: the following program:
int main() {
struct itimerval zero = {{0, 0}, {0, 0}};
/* Initially set to 10 ms. */
struct itimerval initial = zero;
initial.it_interval.tv_usec = 10000;
setitimer(ITIMER_PROF, &initial, NULL);
/* Save and restore several times. */
for (size_t i = 0; i < 10; ++i) {
struct itimerval prev;
setitimer(ITIMER_PROF, &zero, &prev);
/* on old kernels, this goes up by TICK_USEC every iteration */
printf("previous value: %ld %ld %ld %ld\n",
prev.it_interval.tv_sec, prev.it_interval.tv_usec,
prev.it_value.tv_sec, prev.it_value.tv_usec);
setitimer(ITIMER_PROF, &prev, NULL);
}
return 0;
}--- include/linux/jiffies.h | 12 ----------- kernel/time.c | 54 +++++++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 36 deletions(-)
include/linux/jiffies.h +0 -12
@@ -259,23 +259,11 @@ extern unsigned long preset_lpj;#define SEC_JIFFIE_SC (32 - SHIFT_HZ)#endif #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) -#define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19)#define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ TICK_NSEC -1) / (u64)TICK_NSEC))#define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ TICK_NSEC -1) / (u64)TICK_NSEC)) -#define USEC_CONVERSION \ - ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\ - TICK_NSEC -1) / (u64)TICK_NSEC)) -/* -* USEC_ROUND is used in the timeval to jiffie conversion. See there -* for more details. It is the scaled resolution rounding value. Note -* that it is a 64-bit value. Since, when it is applied, we are already -* in jiffies (albit scaled), it is nothing but the bits we will shift -* off. -*/ -#define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)/* * The maximum jiffie value is (MAX_INT >> 1). Here we translate that * into seconds. The 64-bit case will overflow if we are not careful,
kernel/time.c +30 -24
84 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 42/91 MIPS: ZBOOT: add missing <linux/string.h> include
In reply to [email protected]From: Aurelien Jarno <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 29593fd5a8149462ed6fad0d522234facdaee6c8 upstream.
Commit dc4d7b37 (MIPS: ZBOOT: gather string functions into string.c) moved the string related functions into a separate file, which might cause the following build error, depending on the configuration:
| CC arch/mips/boot/compressed/decompress.o | In file included from linux/arch/mips/boot/compressed/../../../../lib/decompress_unxz.c:234:0, | from linux/arch/mips/boot/compressed/decompress.c:67: | linux/arch/mips/boot/compressed/../../../../lib/xz/xz_dec_stream.c: In function 'fill_temp': | linux/arch/mips/boot/compressed/../../../../lib/xz/xz_dec_stream.c:162:2: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration] | cc1: some warnings being treated as errors | linux/scripts/Makefile.build:308: recipe for target 'arch/mips/boot/compressed/decompress.o' failed | make[6]: *** [arch/mips/boot/compressed/decompress.o] Error 1 | linux/arch/mips/Makefile:308: recipe for target 'vmlinuz' failed
It does not fail with the standard configuration, as when CONFIG_DYNAMIC_DEBUG is not enabled <linux/string.h> gets included in include/linux/dynamic_debug.h. There might be other ways for it to get indirectly included.
We can't add the include directly in xz_dec_stream.c as some architectures might want to use a different version for the boot/ directory (see for example arch/x86/boot/string.h).
Patchwork: https://patchwork.linux-mips.org/patch/7420/
--- arch/mips/boot/compressed/decompress.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/boot/compressed/decompress.c +1 -0
@@ -13,6 +13,7 @@#include <linux/types.h> #include <linux/kernel.h> +#include <linux/string.h> #include <asm/addrspace.h>
Signature · 1 line
1.9.1
PATCH 42/177 ecryptfs: avoid to access NULL pointer when write metadata in xattr
In reply to [email protected]From: Chao Yu <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 35425ea2492175fd39f6116481fe98b2b3ddd4ca upstream.
Christopher Head 2014-06-28 05:26:20 UTC described:
"I tried to reproduce this on 3.12.21. Instead, when I do "echo hello > foo" in an ecryptfs mount with ecryptfs_xattr specified, I get a kernel crash:
BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff8110eb39>] fsstack_copy_attr_all+0x2/0x61 PGD d7840067 PUD b2c3c067 PMD 0 Oops: 0002 [#1] SMP Modules linked in: nvidia(PO) CPU: 3 PID: 3566 Comm: bash Tainted: P O 3.12.21-gentoo-r1 #2 Hardware name: ASUSTek Computer Inc. G60JX/G60JX, BIOS 206 03/15/2010 task: ffff8801948944c0 ti: ffff8800bad70000 task.ti: ffff8800bad70000 RIP: 0010:[<ffffffff8110eb39>] [<ffffffff8110eb39>] fsstack_copy_attr_all+0x2/0x61 RSP: 0018:ffff8800bad71c10 EFLAGS: 00010246 RAX: 00000000000181a4 RBX: ffff880198648480 RCX: 0000000000000000 RDX: 0000000000000004 RSI: ffff880172010450 RDI: 0000000000000000 RBP: ffff880198490e40 R08: 0000000000000000 R09: 0000000000000000 R10: ffff880172010450 R11: ffffea0002c51e80 R12: 0000000000002000 R13: 000000000000001a R14: 0000000000000000 R15: ffff880198490e40 FS: 00007ff224caa700(0000) GS:ffff88019fcc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000000bb07f000 CR4: 00000000000007e0 Stack: ffffffff811826e8 ffff8800a39d8000 0000000000000000 000000000000001a ffff8800a01d0000 ffff8800a39d8000 ffffffff81185fd5 ffffffff81082c2c 00000001a39d8000 53d0abbc98490e40 0000000000000037 ffff8800a39d8220 Call Trace: [<ffffffff811826e8>] ? ecryptfs_setxattr+0x40/0x52 [<ffffffff81185fd5>] ? ecryptfs_write_metadata+0x1b3/0x223 [<ffffffff81082c2c>] ? should_resched+0x5/0x23 [<ffffffff8118322b>] ? ecryptfs_initialize_file+0xaf/0xd4 [<ffffffff81183344>] ? ecryptfs_create+0xf4/0x142 [<ffffffff810f8c0d>] ? vfs_create+0x48/0x71 [<ffffffff810f9c86>] ? do_last.isra.68+0x559/0x952 [<ffffffff810f7ce7>] ? link_path_walk+0xbd/0x458 [<ffffffff810fa2a3>] ? path_openat+0x224/0x472 [<ffffffff810fa7bd>] ? do_filp_open+0x2b/0x6f [<ffffffff81103606>] ? __alloc_fd+0xd6/0xe7 [<ffffffff810ee6ab>] ? do_sys_open+0x65/0xe9 [<ffffffff8157d022>] ? system_call_fastpath+0x16/0x1b RIP [<ffffffff8110eb39>] fsstack_copy_attr_all+0x2/0x61 RSP <ffff8800bad71c10> CR2: 0000000000000000 ---[ end trace df9dba5f1ddb8565 ]---"
If we create a file when we mount with ecryptfs_xattr_metadata option, we will encounter a crash in this path:
->ecryptfs_create
->ecryptfs_initialize_file
->ecryptfs_write_metadata
->ecryptfs_write_metadata_to_xattr
->ecryptfs_setxattr
->fsstack_copy_attr_allIt's because our dentry->d_inode used in fsstack_copy_attr_all is NULL, and it will be initialized when ecryptfs_initialize_file finish.
So we should skip copying attr from lower inode when the value of ->d_inode is invalid.
--- fs/ecryptfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ecryptfs/inode.c +1 -1
@@ -1093,7 +1093,7 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, } rc =vfs_setxattr (lower_dentry, name, value, size, flags); -if (!rc) +if (!rc && dentry->d_inode)fsstack_copy_attr_all (dentry->d_inode, lower_dentry->d_inode); out:return rc;
Signature · 1 line
1.9.1
PATCH 43/177 pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
In reply to [email protected]From: Scott Carter <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 37017ac6849e772e67dd187ba2fbd056c4afa533 upstream.
The Broadcom OSB4 IDE Controller (vendor and device IDs: 1166:0211) does not support 64-KB DMA transfers.
Whenever a 64-KB DMA transfer is attempted,
the transfer fails and messages similar to the following are written to the console log:
[ 2431.851125] sr 0:0:0:0: [sr0] Unhandled sense code [ 2431.851139] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 2431.851152] sr 0:0:0:0: [sr0] Sense Key : Hardware Error [current] [ 2431.851166] sr 0:0:0:0: [sr0] Add. Sense: Logical unit communication time-out [ 2431.851182] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 76 f4 00 00 40 00 [ 2431.851210] end_request: I/O error, dev sr0, sector 121808
When the libata and pata_serverworks modules
are recompiled with ATA_DEBUG and ATA_VERBOSE_DEBUG defined in libata.h, the 64-KB transfer size in the scatter-gather list can be seen in the console log:
[ 2664.897267] sr 9:0:0:0: [sr0] Send: [ 2664.897274] 0xf63d85e0 [ 2664.897283] sr 9:0:0:0: [sr0] CDB: [ 2664.897288] Read(10): 28 00 00 00 7f b4 00 00 40 00 [ 2664.897319] buffer = 0xf6d6fbc0, bufflen = 131072, queuecommand 0xf81b7700 [ 2664.897331] ata_scsi_dump_cdb: CDB (1:0,0,0) 28 00 00 00 7f b4 00 00 40 [ 2664.897338] ata_scsi_translate: ENTER [ 2664.897345] ata_sg_setup: ENTER, ata1 [ 2664.897356] ata_sg_setup: 3 sg elements mapped [ 2664.897364] ata_bmdma_fill_sg: PRD[0] = (0x66FD2000, 0xE000) [ 2664.897371] ata_bmdma_fill_sg: PRD[1] = (0x65000000, 0x10000) ------------------------------------------------------> ======= [ 2664.897378] ata_bmdma_fill_sg: PRD[2] = (0x66A10000, 0x2000) [ 2664.897386] ata1: ata_dev_select: ENTER, device 0, wait 1 [ 2664.897422] ata_sff_tf_load: feat 0x1 nsect 0x0 lba 0x0 0x0 0xFC [ 2664.897428] ata_sff_tf_load: device 0xA0 [ 2664.897448] ata_sff_exec_command: ata1: cmd 0xA0 [ 2664.897457] ata_scsi_translate: EXIT [ 2664.897462] leaving scsi_dispatch_cmnd() [ 2664.897497] Doing sr request, dev = sr0, block = 0 [ 2664.897507] sr0 : reading 64/256 512 byte blocks. [ 2664.897553] ata_sff_hsm_move: ata1: protocol 7 task_state 1 (dev_stat 0x58) [ 2664.897560] atapi_send_cdb: send cdb [ 2666.910058] ata_bmdma_port_intr: ata1: host_stat 0x64 [ 2666.910079] __ata_sff_port_intr: ata1: protocol 7 task_state 3 [ 2666.910093] ata_sff_hsm_move: ata1: protocol 7 task_state 3 (dev_stat 0x51) [ 2666.910101] ata_sff_hsm_move: ata1: protocol 7 task_state 4 (dev_stat 0x51) [ 2666.910129] sr 9:0:0:0: [sr0] Done: [ 2666.910136] 0xf63d85e0 TIMEOUT
lspci shows that the driver used for the Broadcom OSB4 IDE Controller is pata_serverworks:
00:0f.1 IDE interface: Broadcom OSB4 IDE Controller (prog-if 8e [Master SecP SecO PriP])
Flags: bus master, medium devsel, latency 64
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
I/O ports at 0170 [size=8]
I/O ports at 0374 [size=4]
I/O ports at 1440 [size=16]
Kernel driver in use: pata_serverworksThe pata_serverworks driver supports five distinct device IDs, one being the OSB4 and the other four belonging to the CSB series. The CSB series appears to support 64-KB DMA transfers,
as tests on a machine with an SAI2 motherboard
containing a Broadcom CSB5 IDE Controller (vendor and device IDs: 1166:0212) showed no problems with 64-KB DMA transfers.
This problem was first discovered when attempting to install openSUSE from a DVD on a machine with an STL2 motherboard.
Using the pata_serverworks module,
older releases of openSUSE will not install at all due to the timeouts. Releases of openSUSE prior to 11.3 can be installed by disabling the pata_serverworks module using the brokenmodules boot parameter, which causes the serverworks module to be used instead.
Recent releases of openSUSE (12.2 and later) include better error recovery and will install, though very slowly.
On all openSUSE releases, the problem can be recreated
on a machine containing a Broadcom OSB4 IDE Controller
by mounting an install DVD and running a command similar to the following:
find /mnt -type f -print | xargs cat > /dev/null
The patch below corrects the problem.
Similar to the other ATA drivers that do not support 64-KB DMA transfers, the patch changes the ata_port_operations qc_prep vector to point to a routine that breaks any 64-KB segment into two 32-KB segments and
changes the scsi_host_template sg_tablesize element to reduce by half the number of scatter/gather elements allowed.
These two changes affect only the OSB4.
--- drivers/ata/pata_serverworks.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/ata/pata_serverworks.c +11 -2
@@ -252,12 +252,18 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adevpci_write_config_byte (pdev,0x54 , ultra_cfg); } -static struct scsi_host_template serverworks_sht = { +static struct scsi_host_template serverworks_osb4_sht = { +ATA_BMDMA_SHT (DRV_NAME ), + .sg_tablesize =LIBATA_DUMB_MAX_PRD , +}; + +static struct scsi_host_template serverworks_csb_sht = {ATA_BMDMA_SHT (DRV_NAME ), };static struct ata_port_operations serverworks_osb4_port_ops = { .inherits = &ata_bmdma_port_ops, + .qc_prep = ata_bmdma_dumb_qc_prep, .cable_detect = serverworks_cable_detect, .mode_filter = serverworks_osb4_filter, .set_piomode = serverworks_set_piomode,
@@ -266,6 +272,7 @@ static struct ata_port_operations serverworks_osb4_port_ops = {static struct ata_port_operations serverworks_csb_port_ops = { .inherits = &serverworks_osb4_port_ops, + .qc_prep = ata_bmdma_qc_prep, .mode_filter = serverworks_csb_filter, };
@@ -405,6 +412,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id } };const struct ata_port_info *ppi[] = { &info[id->driver_data],NULL }; +struct scsi_host_template *sht = &serverworks_csb_sht;int rc; rc =pcim_enable_device (pdev);
@@ -418,6 +426,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id/* Select non UDMA capable OSB4 if we can't do fixups */ if (rc <0 ) ppi[0 ] = &info[1 ]; + sht = &serverworks_osb4_sht; }/* setup CSB5/CSB6 : South Bridge and IDE option RAID */ else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ||
@@ -434,7 +443,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id ppi[1 ] = &ata_dummy_port_info; } -return ata_pci_bmdma_init_one (pdev, ppi, &serverworks_sht,NULL ,0 ); +return ata_pci_bmdma_init_one (pdev, ppi, sht,NULL ,0 ); }#ifdef CONFIG_PM
Signature · 1 line
1.9.1
PATCH 43/91 perf: Fix a race condition in perf_remove_from_context()
In reply to [email protected]From: Cong Wang <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 3577af70a2ce4853d58e57d832e687d739281479 upstream.
We saw a kernel soft lockup in perf_remove_from_context(), it looks like the perf process, when exiting, could not go out of the retry loop. Meanwhile, the target process was forking a child. So either the target process should execute the smp function call to deactive the event (if it was running) or it should do a context switch which deactives the event.
It seems we optimize out a context switch in perf_event_context_sched_out(), and what's more important, we still test an obsolete task pointer when retrying, so no one actually would deactive that event in this situation. Fix it directly by reloading the task pointer in perf_remove_from_context().
This should cure the above soft lockup.
--- kernel/events/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kernel/events/core.c +10 -0
@@ -1702,6 +1702,16 @@ retry:*/ if (ctx->is_active) {raw_spin_unlock_irq (&ctx->lock); +/* +* Reload the task pointer, it might have been changed by +* a concurrent perf_event_context_sched_out(). +*/ + task = ctx->task; +/* +* Reload the task pointer, it might have been changed by +* a concurrent perf_event_context_sched_out(). +*/ + task = ctx->task; goto retry; }
Signature · 1 line
1.9.1
PATCH 44/91 ASoC: samsung-i2s: Check secondary DAI exists before referencing
In reply to [email protected]From: Charles Keepax <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 133c2681c4a0c1b589d138c2fdd0f131bdce20ed upstream.
In a couple of places the driver is missing a check to ensure there is a secondary DAI before it de-references the pointer to it, causing a null pointer de-reference. This patch adds a check to avoid this.
--- sound/soc/samsung/i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/samsung/i2s.c +1 -1
@@ -392,7 +392,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,if (dir ==SND_SOC_CLOCK_IN ) rfs =0 ; - if ((rfs && other->rfs && (other->rfs != rfs)) || + if ((rfs && other && other->rfs && (other->rfs != rfs)) || (any_active(i2s) && (((dir == SND_SOC_CLOCK_IN) && !(mod & MOD_CDCLKCON)) ||
Signature · 1 line
1.9.1
PATCH 44/177 x86: Reject x32 executables if x32 ABI not supported
In reply to [email protected]From: Ben Hutchings <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 0e6d3112a4e95d55cf6dca88f298d5f4b8f29bd1 upstream.
It is currently possible to execve() an x32 executable on an x86_64 kernel that has only ia32 compat enabled. However all its syscalls will fail, even _exit(). This usually causes it to segfault.
Change the ELF compat architecture check so that x32 executables are rejected if we don't support the x32 ABI.
--- arch/x86/include/asm/elf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/elf.h +3 -2
@@ -155,8 +155,9 @@ do { \#define elf_check_arch (x) \ ((x)->e_machine == EM_X86_64) -#define compat_elf_check_arch (x) \ - (elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64) +#define compat_elf_check_arch (x) \ + (elf_check_arch_ia32(x) || \ + (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))#if __USER32_DS != __USER_DS# error "The following code assumes __USER32_DS == __USER_DS"
Signature · 1 line
1.9.1
PATCH 45/91 Input: i8042 - add Fujitsu U574 to no_timeout dmi table
In reply to [email protected]From: Hans de Goede <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit cc18a69c92d0972bc2fc5a047ee3be1e8398171b upstream.
https://bugzilla.kernel.org/show_bug.cgi?id=69731
--- drivers/input/serio/i8042-x86ia64io.h | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +8 -0
@@ -601,6 +601,14 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), }, }, + { + /* Fujitsu U574 laptop */ + /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"), + }, + }, { } };
Signature · 1 line
1.9.1
PATCH 45/177 fs: Fix theoretical division by 0 in super_cache_scan().
In reply to [email protected]From: Tetsuo Handa <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 475d0db742e3755c6b267f48577ff7cbb7dfda0d upstream.
total_objects could be 0 and is used as a denom.
While total_objects is a "long", total_objects == 0 unlikely happens for 3.12 and later kernels because 32-bit architectures would not be able to hold (1 << 32) objects. However, total_objects == 0 may happen for kernels between 3.1 and 3.11 because total_objects in prune_super() was an "int" and (e.g.) x86_64 architecture might be able to hold (1 << 32) objects.
--- fs/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/super.c +2 -0
@@ -69,6 +69,8 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc) total_objects = sb->s_nr_dentry_unused + sb->s_nr_inodes_unused + fs_objects +1 ; +if (!total_objects) + total_objects =1 ;if (sc->nr_to_scan) {int dentries;
Signature · 1 line
1.9.1
PATCH 46/91 Input: i8042 - add nomux quirk for Avatar AVIU-145A6
In reply to [email protected]From: Hans de Goede <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d2682118f4bb3ceb835f91c1a694407a31bb7378 upstream.
The sys_vendor / product_name are somewhat generic unfortunately, so this may lead to some false positives. But nomux usually does no harm, where as not having it clearly is causing problems on the Avatar AVIU-145A6.
https://bugzilla.kernel.org/show_bug.cgi?id=77391
--- drivers/input/serio/i8042-x86ia64io.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +7 -0
@@ -458,6 +458,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), }, }, + { + /* Avatar AVIU-145A6 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Intel"), + DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"), + }, + }, { } };
Signature · 1 line
1.9.1
PATCH 46/177 fs: make cont_expand_zero interruptible
In reply to [email protected]From: Mikulas Patocka <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c2ca0fcd202863b14bd041a7fece2e789926c225 upstream.
This patch makes it possible to kill a process looping in cont_expand_zero. A process may spend a lot of time in this function, so it is desirable to be able to kill it.
It happened to me that I wanted to copy a piece data from the disk to a file. By mistake, I used the "seek" parameter to dd instead of "skip". Due to the "seek" parameter, dd attempted to extend the file and became stuck doing so - the only possibility was to reset the machine or wait many hours until the filesystem runs out of space and cont_expand_zero fails. We need this patch to be able to terminate the process.
--- fs/buffer.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/buffer.c +5 -0
@@ -2221,6 +2221,11 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, err =0 ;balance_dirty_pages_ratelimited (mapping); + +if (unlikely (fatal_signal_pending (current))) { + err = -EINTR ; + goto out; + } }/* page covers the boundary, find the boundary offset */
Signature · 1 line
1.9.1
PATCH 47/177 fix misuses of f_count() in ppp and netlink
In reply to [email protected]From: Al Viro <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 24dff96a37a2ca319e75a74d3929b2de22447ca6 upstream.
we used to check for "nobody else could start doing anything with that opened file" by checking that refcount was 2 or less - one for descriptor table and one we'd acquired in fget() on the way to wherever we are. That was race-prone (somebody else might have had a reference to descriptor table and do fget() just as we'd been checking) and it had become flat-out incorrect back when we switched to fget_light() on those codepaths - unlike fget(), it doesn't grab an extra reference unless the descriptor table is shared. The same change allowed a race-free check, though - we are safe exactly when refcount is less than 2.
It was a long time ago; pre-2.6.12 for ioctl() (the codepath leading to ppp one) and 2.6.17 for sendmsg() (netlink one). OTOH, netlink hadn't grown that check until 3.9 and ppp used to live in drivers/net, not drivers/net/ppp until 3.1. The bug existed well before that, though, and the same fix used to apply in old location of file.
--- drivers/net/ppp/ppp_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ppp/ppp_generic.c +1 -1
@@ -588,7 +588,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (file == ppp->owner)ppp_shutdown_interface (ppp); } -if (atomic_long_read (&file->f_count) <=2 ) { +if (atomic_long_read (&file->f_count) <2 ) {ppp_release (NULL , file); err =0 ; }else
Signature · 1 line
1.9.1
PATCH 47/91 iscsi-target: Fix memory corruption in iscsit_logout_post_handler_diffcid
In reply to [email protected]From: Nicholas Bellinger <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit b53b0d99d6fbf7d44330395349a895521cfdbc96 upstream.
This patch fixes a bug in iscsit_logout_post_handler_diffcid() where a pointer used as storage for list_for_each_entry() was incorrectly being used to determine if no matching entry had been found.
This patch changes iscsit_logout_post_handler_diffcid() to key off bool conn_found to determine if the function needs to exit early.
--- drivers/target/iscsi/iscsi_target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target.c +3 -1
@@ -4297,6 +4297,7 @@ static void iscsit_logout_post_handler_diffcid( {struct iscsi_conn *l_conn;struct iscsi_session *sess = conn->sess; +bool conn_found = false;if (!sess)return ;
@@ -4305,12 +4306,13 @@ static void iscsit_logout_post_handler_diffcid(list_for_each_entry (l_conn, &sess->sess_conn_list, conn_list) {if (l_conn->cid == cid) {iscsit_inc_conn_usage_count (l_conn); + conn_found = true;break ; } }spin_unlock_bh (&sess->conn_lock); -if (!l_conn) +if (!conn_found)return ;if (l_conn->sock)
Signature · 1 line
1.9.1
PATCH 48/177 block: fix alignment_offset math that assumes io_min is a power-of-2
In reply to [email protected]From: Mike Snitzer <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit b8839b8c55f3fdd60dc36abcda7e0266aff7985c upstream.
The math in both blk_stack_limits() and queue_limit_alignment_offset() assume that a block device's io_min (aka minimum_io_size) is always a power-of-2. Fix the math such that it works for non-power-of-2 io_min.
This issue (of alignment_offset != 0) became apparent when testing dm-thinp with a thinp blocksize that matches a RAID6 stripesize of 1280K. Commit fdfb4c8c1 ("dm thin: set minimum_io_size to pool's data block size") unlocked the potential for alignment_offset != 0 due to the dm-thin-pool's io_min possibly being a non-power-of-2.
--- block/blk-settings.c | 4 ++-- include/linux/blkdev.h | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-)
block/blk-settings.c +2 -2
@@ -538,7 +538,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, bottom =max (b->physical_block_size, b->io_min) + alignment;/* Verify that top and bottom intervals line up */ -if (max (top, bottom) & (min (top, bottom) -1 )) { +if (max (top, bottom) %min (top, bottom)) { t->misaligned =1 ; ret =-1 ; }
@@ -579,7 +579,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,/* Find lowest common alignment_offset */ t->alignment_offset =lcm (t->alignment_offset, alignment) - & (max (t->physical_block_size, t->io_min) -1 ); + %max (t->physical_block_size, t->io_min);/* Verify that new alignment_offset is on a logical block boundary */ if (t->alignment_offset & (t->logical_block_size -1 )) {
include/linux/blkdev.h +2 -3
@@ -1069,10 +1069,9 @@ static inline int queue_alignment_offset(struct request_queue *q)static inline int queue_limit_alignment_offset (struct queue_limits *lim,sector_t sector) {unsigned int granularity =max (lim->physical_block_size, lim->io_min); -unsigned int alignment = (sector <<9 ) & (granularity -1 ); +unsigned int alignment =sector_div (sector, granularity >>9 ) <<9 ; -return (granularity + lim->alignment_offset - alignment) - & (granularity -1 ); +return (granularity + lim->alignment_offset - alignment) % granularity; }static inline int bdev_alignment_offset (struct block_device *bdev)
Signature · 1 line
1.9.1
PATCH 48/91 iscsi-target: avoid NULL pointer in iscsi_copy_param_list failure
In reply to [email protected]From: Joern Engel <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 8ae757d09c45102b347a1bc2867f54ffc1ab8fda upstream.
In iscsi_copy_param_list() a failed iscsi_param_list memory allocation currently invokes iscsi_release_param_list() to cleanup, and will promptly trigger a NULL pointer dereference.
Instead, go ahead and return for the first iscsi_copy_param_list() failure case.
Found by coverity.
--- drivers/target/iscsi/iscsi_target_parameters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target_parameters.c +1 -1
@@ -552,7 +552,7 @@ int iscsi_copy_param_list( param_list =kzalloc (sizeof (struct iscsi_param_list ),GFP_KERNEL );if (!param_list) {pr_err ("Unable to allocate memory for struct iscsi_param_list.\n" ); - goto err_out; +return -1 ; }INIT_LIST_HEAD (¶m_list->param_list);INIT_LIST_HEAD (¶m_list->extra_response_list);
Signature · 1 line
1.9.1
PATCH 49/91 NFSv4: Fix another bug in the close/open_downgrade code
In reply to [email protected]From: Trond Myklebust <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit cd9288ffaea4359d5cfe2b8d264911506aed26a4 upstream.
James Drew reports another bug whereby the NFS client is now sending an OPEN_DOWNGRADE in a situation where it should really have sent a
CLOSE: the client is opening the file for O_RDWR, but then trying to do a downgrade to O_RDONLY, which is not allowed by the NFSv4 spec.
--- fs/nfs/nfs4proc.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
fs/nfs/nfs4proc.c +15 -15
@@ -2063,23 +2063,23 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) is_rdwr =test_bit (NFS_O_RDWR_STATE , &state->flags); is_rdonly =test_bit (NFS_O_RDONLY_STATE , &state->flags); is_wronly =test_bit (NFS_O_WRONLY_STATE , &state->flags); -/* Calculate the current open share mode */ - calldata->arg.fmode =0 ; -if (is_rdonly || is_rdwr) - calldata->arg.fmode |=FMODE_READ ; -if (is_wronly || is_rdwr) - calldata->arg.fmode |=FMODE_WRITE ;/* Calculate the change in open mode */ + calldata->arg.fmode =0 ;if (state->n_rdwr ==0 ) { -if (state->n_rdonly ==0 ) { - call_close |= is_rdonly || is_rdwr; - calldata->arg.fmode &= ~FMODE_READ ; - } -if (state->n_wronly ==0 ) { - call_close |= is_wronly || is_rdwr; - calldata->arg.fmode &= ~FMODE_WRITE ; - } - } +if (state->n_rdonly ==0 ) + call_close |= is_rdonly; +else if (is_rdonly) + calldata->arg.fmode |=FMODE_READ ; +if (state->n_wronly ==0 ) + call_close |= is_wronly; +else if (is_wronly) + calldata->arg.fmode |=FMODE_WRITE ; + }else if (is_rdwr) + calldata->arg.fmode |=FMODE_READ |FMODE_WRITE ; + +if (calldata->arg.fmode ==0 ) + call_close |= is_rdwr; +spin_unlock (&state->owner->so_lock);if (!call_close) {
Signature · 1 line
1.9.1
PATCH 49/177 fanotify: enable close-on-exec on events' fd when requested in fanotify_init()
In reply to [email protected]From: Yann Droneaud <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 0b37e097a648aa71d4db1ad108001e95b69a2da4 upstream.
According to commit 80af258867648 ("fanotify: groups can specify their f_flags for new fd"), file descriptors created as part of file access notification events inherit flags from the event_f_flags argument passed to syscall fanotify_init(2)[1].
Unfortunately O_CLOEXEC is currently silently ignored.
Indeed, event_f_flags are only given to dentry_open(), which only seems to care about O_ACCMODE and O_PATH in do_dentry_open(), O_DIRECT in open_check_o_direct() and O_LARGEFILE in generic_file_open().
It's a pity, since, according to some lookup on various search engines and
http://codesearch.debian.net/, there's already some userspace code which use O_CLOEXEC:
- in systemd's readahead[2]:
fanotify_fd = fanotify_init(FAN_CLOEXEC|FAN_NONBLOCK, O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_NOATIME);
- in clsync[3]:
#define FANOTIFY_EVFLAGS (O_LARGEFILE|O_RDONLY|O_CLOEXEC)
int fanotify_d = fanotify_init(FANOTIFY_FLAGS, FANOTIFY_EVFLAGS);- in examples [4] from "Filesystem monitoring in the Linux kernel" article[5] by Aleksander Morgado:
if ((fanotify_fd = fanotify_init (FAN_CLOEXEC,
O_RDONLY | O_CLOEXEC | O_LARGEFILE)) < 0)
Additionally, since commit 48149e9d3a7e ("fanotify: check file flags passed in fanotify_init"). having O_CLOEXEC as part of fanotify_init() second argument is expressly allowed.
So it seems expected to set close-on-exec flag on the file descriptors if userspace is allowed to request it with O_CLOEXEC.
But Andrew Morton raised[6] the concern that enabling now close-on-exec might break existing applications which ask for O_CLOEXEC but expect the file descriptor to be inherited across exec().
In the other hand, as reported by Mihai Dontu[7] close-on-exec on the file descriptor returned as part of file access notify can break applications due to deadlock. So close-on-exec is needed for most applications.
More, applications asking for close-on-exec are likely expecting it to be enabled, relying on O_CLOEXEC being effective. If not, it might weaken their security, as noted by Jan Kara[8].
So this patch replaces call to macro get_unused_fd() by a call to function get_unused_fd_flags() with event_f_flags value as argument. This way O_CLOEXEC flag in the second argument of fanotify_init(2) syscall is interpreted and close-on-exec get enabled when requested.
[1] http://man7.org/linux/man-pages/man2/fanotify_init.2.html
[2] http://cgit.freedesktop.org/systemd/systemd/tree/src/readahead/readahead-collect.c?id=v208#n294
[3] https://github.com/xaionaro/clsync/blob/v0.2.1/sync.c#L1631
https://github.com/xaionaro/clsync/blob/v0.2.1/configuration.h#L38
[4] http://www.lanedo.com/~aleksander/fanotify/fanotify-example.c
[5] http://www.lanedo.com/2013/filesystem-monitoring-linux-kernel/
[6] http://lkml.kernel.org/r/[email protected]
[7] http://lkml.kernel.org/r/20141002095046.3715eb69@mdontu-l
[8] http://lkml.kernel.org/r/[email protected]
Reviewed by: Heinrich Schuchardt <[email protected]>
--- fs/notify/fanotify/fanotify_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/notify/fanotify/fanotify_user.c +1 -1
@@ -67,7 +67,7 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)pr_debug ("%s: group=%p event=%p\n" , __func__, group, event); - client_fd =get_unused_fd (); + client_fd =get_unused_fd_flags (group->fanotify_data.f_flags);if (client_fd <0 )return client_fd;
Signature · 1 line
1.9.1
PATCH 50/177 Input: synaptics - gate forcepad support by DMI check
In reply to [email protected]From: Dmitry Torokhov <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit aa972409951e0675e07918620427517cad5090e0 upstream.
Unfortunately, ForcePad capability is not actually exported over PS/2, so we have to resort to DMI checks.
--- drivers/input/mouse/synaptics.c | 22 +++++++++++++++++++++- drivers/input/mouse/synaptics.h | 8 ++------ 2 files changed, 23 insertions(+), 7 deletions(-)
drivers/input/mouse/synaptics.c +21 -1
@@ -506,6 +506,8 @@ static void synaptics_parse_agm(const unsigned char buf[], priv->agm_pending = true; } +static bool is_forcepad; +static int synaptics_parse_hw_state (const unsigned char buf[],struct synaptics_data *priv,struct synaptics_hw_state *hw)
@@ -535,7 +537,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[], hw->left = (buf[0 ] &0x01 ) ?1 :0 ; hw->right = (buf[0 ] &0x02 ) ?1 :0 ; -if (SYN_CAP_FORCEPAD (priv->ext_cap_0c)) { +if (is_forcepad) {/* * ForcePads, like Clickpads, use middle button * bits to report primary button clicks.
@@ -1512,6 +1514,18 @@ static const struct dmi_system_id min_max_dmi_table[] __initconst = { { } }; +static const struct dmi_system_id forcepad_dmi_table[]__initconst = { +#if defined(CONFIG_DMI) && defined(CONFIG_X86) + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Hewlett-Packard" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"HP EliteBook Folio 1040 G1" ), + }, + }, +#endif + { } +}; +void __init synaptics_module_init (void ) {const struct dmi_system_id *min_max_dmi;
@@ -1522,6 +1536,12 @@ void __init synaptics_module_init(void) min_max_dmi =dmi_first_match (min_max_dmi_table);if (min_max_dmi) quirk_min_max = min_max_dmi->driver_data; + +/* +* Unfortunately ForcePad capability is not exported over PS/2, +* so we have to resort to checking DMI. +*/ + is_forcepad =dmi_check_system (forcepad_dmi_table); }static int __synaptics_init (struct psmouse *psmouse,bool absolute_mode)
drivers/input/mouse/synaptics.h +2 -6
@@ -76,12 +76,9 @@* for noise. * 2 0x08 image sensor image sensor tracks 5 fingers, but only * reports 2. +* 2 0x01 uniform clickpad whole clickpad moves instead of being +* hinged at the top. * 2 0x20 report min query 0x0f gives min coord reported -* 2 0x80 forcepad forcepad is a variant of clickpad that -* does not have physical buttons but rather -* uses pressure above certain threshold to -* report primary clicks. Forcepads also have -* clickpad bit set. */ #define SYN_CAP_CLICKPAD (ex0c) ((ex0c) & 0x100000)/* 1-button ClickPad */ #define SYN_CAP_CLICKPAD2BTN (ex0c) ((ex0c) & 0x000100)/* 2-button ClickPad */
@@ -90,7 +87,6 @@#define SYN_CAP_ADV_GESTURE (ex0c) ((ex0c) & 0x080000)#define SYN_CAP_REDUCED_FILTERING (ex0c) ((ex0c) & 0x000400)#define SYN_CAP_IMAGE_SENSOR (ex0c) ((ex0c) & 0x000800) -#define SYN_CAP_FORCEPAD (ex0c) ((ex0c) & 0x008000)/* synaptics modes query bits */ #define SYN_MODE_ABSOLUTE (m) ((m) & (1 << 7))
Signature · 1 line
1.9.1
PATCH 50/91 libiscsi: fix potential buffer overrun in __iscsi_conn_send_pdu
In reply to [email protected]From: Mike Christie <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit db9bfd64b14a3a8f1868d2164518fdeab1b26ad1 upstream.
This patches fixes a potential buffer overrun in __iscsi_conn_send_pdu. This function is used by iscsi drivers and userspace to send iscsi PDUs/ commands. For login commands, we have a set buffer size. For all other commands we do not support data buffers.
This was reported by Dan Carpenter here:
http://www.spinics.net/lists/linux-scsi/msg66838.html
--- drivers/scsi/libiscsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/scsi/libiscsi.c +10 -0
@@ -718,11 +718,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,return NULL ; } +if (data_size >ISCSI_DEF_MAX_RECV_SEG_LEN ) { +iscsi_conn_printk (KERN_ERR , conn,"Invalid buffer len of %u for login task. Max len is %u\n" , data_size,ISCSI_DEF_MAX_RECV_SEG_LEN ); +return NULL ; + } + task = conn->login_task; }else {if (session->state !=ISCSI_STATE_LOGGED_IN )return NULL ; +if (data_size !=0 ) { +iscsi_conn_printk (KERN_ERR , conn,"Can not send data buffer of len %u for op 0x%x\n" , data_size, opcode); +return NULL ; + } +BUG_ON (conn->c_stage ==ISCSI_CONN_INITIAL_STAGE );BUG_ON (conn->c_stage ==ISCSI_CONN_STOPPED );
Signature · 1 line
1.9.1
PATCH 51/177 Input: i8042 - add noloop quirk for Asus X750LN
In reply to [email protected]From: Hans de Goede <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 9ff84a17302aeb8913ff244ecc0d8f9d219fecb5 upstream.
Without this the aux port does not get detected, and consequently the touchpad will not work.
https://bugzilla.redhat.com/show_bug.cgi?id=1110011
--- drivers/input/serio/i8042-x86ia64io.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +6 -0
@@ -101,6 +101,12 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { }, { .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"), + }, + }, + { + .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"Compaq" ),DMI_MATCH (DMI_PRODUCT_NAME ,"ProLiant" ), DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
Signature · 1 line
1.9.1
PATCH 51/91 USB: storage: Add quirk for Adaptec USBConnect 2000 USB-to-SCSI Adapter
In reply to [email protected]From: Mark <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 67d365a57a51fb9dece6a5ceb504aa381cae1e5b upstream.
The Adaptec USBConnect 2000 is another SCSI-USB converter which uses Shuttle Technology/SCM Microsystems chips. The US_FL_SCM_MULT_TARG quirk is required to use SCSI devices with ID other than 0.
I don't have a USBConnect 2000, but based on the other entries for Shuttle/ SCM-based converters this patch is very likely correct. I used 0x0000 and 0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which bcdDevice value the product uses.
--- drivers/usb/storage/unusual_devs.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/storage/unusual_devs.h +6 -0
@@ -93,6 +93,12 @@ UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x0001, "PhotoSmart R707", USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), +UNUSUAL_DEV (0x03f3 ,0x0001 ,0x0000 ,0x9999 , +"Adaptec" , +"USBConnect 2000" , +USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), +/* Reported by Sebastian Kapfer <[email protected]> * and Olaf Hering <[email protected]> (different bcd's, same vendor/product) * for USB floppies that need the SINGLE_LUN enforcement.
Signature · 1 line
1.9.1
PATCH 52/91 USB: storage: Add quirk for Ariston Technologies iConnect USB to SCSI adapter
In reply to [email protected]From: Mark <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit b6a3ed677991558ce09046397a7c4d70530d15b3 upstream.
Hi,
The Ariston Technologies iConnect 025 and iConnect 050 (also known as e.g. iSCSI-50) are SCSI-USB converters which use Shuttle Technology/SCM Microsystems chips. Only the connectors differ; both have the same USB ID. The US_FL_SCM_MULT_TARG quirk is required to use SCSI devices with ID other than 0.
I don't have one of these, but based on the other entries for Shuttle/ SCM-based converters this patch is very likely correct. I used 0x0000 and 0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which bcdDevice value the products use.
--- drivers/usb/storage/unusual_devs.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/storage/unusual_devs.h +6 -0
@@ -1952,6 +1952,12 @@ UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), +UNUSUAL_DEV (0x1822 ,0x0001 ,0x0000 ,0x9999 , +"Ariston Technologies" , +"iConnect USB to SCSI adapter" , +USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), +/* Reported by Hans de Goede <[email protected]> * These Appotech controllers are found in Picture Frames, they provide a * (buggy) emulation of a cdrom drive which contains the windows software
Signature · 1 line
1.9.1
PATCH 52/177 kernel: add support for gcc 5
In reply to [email protected]From: Sasha Levin <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 71458cfc782eafe4b27656e078d379a34e472adf upstream.
We're missing include/linux/compiler-gcc5.h which is required now because gcc branched off to v5 in trunk.
Just copy the relevant bits out of include/linux/compiler-gcc4.h, no new code is added as of now.
This fixes a build error when using gcc 5.
--- include/linux/compiler-gcc5.h | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 include/linux/compiler-gcc5.h
include/linux/compiler-gcc5.h new file +66 -0
@@ -0,0 +1,66 @@ +#ifndef __LINUX_COMPILER_H +#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead." +#endif + +#define __used __attribute__((__used__)) +#define __must_check __attribute__((warn_unused_result)) +#define __compiler_offsetof (a, b) __builtin_offsetof(a, b) + +/* Mark functions as cold. gcc will assume any path leading to a call +to them will be unlikely. This means a lot of manual unlikely()s +are unnecessary now for any paths leading to the usual suspects +like BUG(), printk(), panic() etc. [but let's keep them for now for +older compilers] + +Early snapshots of gcc 4.3 don't support this and we can't detect this +in the preprocessor, but we can live with this because they're unreleased. +Maketime probing would be overkill here. + +gcc also has a __attribute__((__hot__)) to move hot functions into +a special section, but I don't see any sense in this right now in +the kernel context */ +#define __cold __attribute__((__cold__)) + +#define __UNIQUE_ID (prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) + +#ifndef __CHECKER__ +# define __compiletime_warning (message) __attribute__((warning(message))) +# define __compiletime_error (message) __attribute__((error(message))) +#endif /* __CHECKER__ */ + +/* +* Mark a position in code as unreachable. This can be used to +* suppress control flow warnings after asm blocks that transfer +* control elsewhere. +* +* Early snapshots of gcc 4.5 don't support this and we can't detect +* this in the preprocessor, but we can live with this because they're +* unreleased. Really, we need to have autoconf for the kernel. +*/ +#define unreachable () __builtin_unreachable() + +/* Mark a function definition as prohibited from being cloned. */ +#define __noclone __attribute__((__noclone__)) + +/* +* Tell the optimizer that something else uses this function or variable. +*/ +#define __visible __attribute__((externally_visible)) + +/* +* GCC 'asm goto' miscompiles certain code sequences: +* +* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 +* +* Work it around via a compiler barrier quirk suggested by Jakub Jelinek. +* Fixed in GCC 4.8.2 and later versions. +* +* (asm goto is automatically volatile - the naming reflects this.) +*/ +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) + +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP +#define __HAVE_BUILTIN_BSWAP32__ +#define __HAVE_BUILTIN_BSWAP64__ +#define __HAVE_BUILTIN_BSWAP16__ +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
Signature · 1 line
1.9.1
PATCH 53/177 ALSA: emu10k1: Fix deadlock in synth voice lookup
In reply to [email protected]From: Takashi Iwai <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 95926035b187cc9fee6fb61385b7da9c28123f74 upstream.
The emu10k1 voice allocator takes voice_lock spinlock. When there is no empty stream available, it tries to release a voice used by synth, and calls get_synth_voice. The callback function, snd_emu10k1_synth_get_voice(), however, also takes the voice_lock, thus it deadlocks.
The fix is simply removing the voice_lock holds in snd_emu10k1_synth_get_voice(), as this is always called in the spinlock context.
--- sound/pci/emu10k1/emu10k1_callback.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/pci/emu10k1/emu10k1_callback.c +2 -4
@@ -85,6 +85,8 @@ snd_emu10k1_ops_setup(struct snd_emux *emux)* get more voice for pcm * * terminate most inactive voice and give it as a pcm voice. +* +* voice_lock is already held. */ int snd_emu10k1_synth_get_voice (struct snd_emu10k1 *hw)
@@ -92,12 +94,10 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw)struct snd_emux *emu;struct snd_emux_voice *vp;struct best_voice best[V_END ]; -unsigned long flags;int i; emu = hw->synth; -spin_lock_irqsave (&emu->voice_lock, flags);lookup_voices (emu, hw, best,1 );/* no OFF voices */ for (i =0 ; i <V_END ; i++) {if (best[i].voice >=0 ) {
@@ -113,11 +113,9 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) vp->emu->num_voices--; vp->ch =-1 ; vp->state =SNDRV_EMUX_ST_OFF ; -spin_unlock_irqrestore (&emu->voice_lock, flags);return ch; } } -spin_unlock_irqrestore (&emu->voice_lock, flags);/* not found */ return -ENOMEM ;
Signature · 1 line
1.9.1
PATCH 53/91 USB: storage: Add quirks for Entrega/Xircom USB to SCSI converters
In reply to [email protected]From: Mark <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c80b4495c61636edc58fe1ce300f09f24db28e10 upstream.
This patch adds quirks for Entrega Technologies (later Xircom PortGear) USB- SCSI converters. They use Shuttle Technology EUSB-01/EUSB-S1 chips. The US_FL_SCM_MULT_TARG quirk is needed to allow multiple devices on the SCSI chain to be accessed. Without it only the (single) device with SCSI ID 0 can be used.
The standalone converter sold by Entrega had model number U1-SC25. Xircom acquired Entrega and re-branded the product line PortGear. The PortGear USB to SCSI Converter (model PGSCSI) is internally identical to the Entrega product, but later models may use a different USB ID. The Entrega-branded units have USB ID 1645:0007, as does my Xircom PGSCSI, but the Windows and Macintosh drivers also support 085A:0028.
Entrega also sold the "Mac USB Dock", which provides two USB ports, a Mac (8-pin mini-DIN) serial port and a SCSI port. It appears to the computer as a four-port hub, USB-serial, and USB-SCSI converters. The USB-SCSI part may have initially used the same ID as the standalone U1-SC25 (1645:0007), but later production used 085A:0026.
My Xircom PortGear PGSCSI has bcdDevice=0x0100. Units with bcdDevice=0x0133 probably also exist.
This patch adds quirks for 1645:0007, 085A:0026 and 085A:0028. The Windows driver INF file also mentions 085A:0032 "PortStation SCSI Module", but I couldn't find any mention of that actually existing in the wild; perhaps it was cancelled before release?
--- drivers/usb/storage/unusual_devs.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/usb/storage/unusual_devs.h +20 -0
@@ -1117,6 +1117,18 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE), +UNUSUAL_DEV (0x085a ,0x0026 ,0x0100 ,0x0133 , +"Xircom" , +"PortGear USB-SCSI (Mac USB Dock)" , +USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_euscsi_init, +US_FL_SCM_MULT_TARG ), + +UNUSUAL_DEV (0x085a ,0x0028 ,0x0100 ,0x0133 , +"Xircom" , +"PortGear USB to SCSI Converter" , +USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_euscsi_init, +US_FL_SCM_MULT_TARG ), +/* Submitted by Jan De Luyck <[email protected]> */ UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, "CITIZEN",
@@ -1937,6 +1949,14 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), +/* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) +* and Mac USB Dock USB-SCSI */ +UNUSUAL_DEV (0x1645 ,0x0007 ,0x0100 ,0x0133 , +"Entrega Technologies" , +"USB to SCSI Converter" , +USB_SC_DEVICE ,USB_PR_DEVICE , usb_stor_euscsi_init, +US_FL_SCM_MULT_TARG ), +/* Reported by Robert Schedel <[email protected]> * Note: this is a 'super top' device like the above 14cd/6600 device */ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
Signature · 1 line
1.9.1
PATCH 54/91 can: flexcan: mark TX mailbox as TX_INACTIVE
In reply to [email protected]From: Marc Kleine-Budde <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c32fe4ad3e4861b2bfa1f44114c564935a123dda upstream.
This patch fixes the initialization of the TX mailbox. It is now correctly initialized as TX_INACTIVE not RX_EMPTY.
--- drivers/net/can/flexcan.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/can/flexcan.c +13 -2
@@ -134,6 +134,17 @@/* FLEXCAN message buffers */ #define FLEXCAN_MB_CNT_CODE (x) (((x) & 0xf) << 24) +#define FLEXCAN_MB_CODE_RX_INACTIVE (0x0 << 24) +#define FLEXCAN_MB_CODE_RX_EMPTY (0x4 << 24) +#define FLEXCAN_MB_CODE_RX_FULL (0x2 << 24) +#define FLEXCAN_MB_CODE_RX_OVERRRUN (0x6 << 24) +#define FLEXCAN_MB_CODE_RX_RANSWER (0xa << 24) + +#define FLEXCAN_MB_CODE_TX_INACTIVE (0x8 << 24) +#define FLEXCAN_MB_CODE_TX_ABORT (0x9 << 24) +#define FLEXCAN_MB_CODE_TX_DATA (0xc << 24) +#define FLEXCAN_MB_CODE_TX_TANSWER (0xe << 24) +#define FLEXCAN_MB_CNT_SRR BIT(22)#define FLEXCAN_MB_CNT_IDE BIT(21)#define FLEXCAN_MB_CNT_RTR BIT(20)
@@ -734,8 +745,8 @@ static int flexcan_chip_start(struct net_device *dev)netdev_dbg (dev,"%s: writing ctrl=0x%08x" , __func__, reg_ctrl);flexcan_write (reg_ctrl, ®s->ctrl); -/* Abort any pending TX, mark Mailbox as INACTIVE */ -flexcan_write (FLEXCAN_MB_CNT_CODE (0x4 ), +/* mark TX mailbox as INACTIVE */ +flexcan_write (FLEXCAN_MB_CODE_TX_INACTIVE , ®s->cantxfg[FLEXCAN_TX_BUF_ID ].can_ctrl);/* acceptance mask/acceptance code (accept everything) */
Signature · 1 line
1.9.1
PATCH 54/177 mnt: Prevent pivot_root from creating a loop in the mount tree
In reply to [email protected]From: "Eric W. Biederman" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 0d0826019e529f21c84687521d03f60cd241ca7d upstream.
Andy Lutomirski recently demonstrated that when chroot is used to set the root path below the path for the new ``root'' passed to pivot_root the pivot_root system call succeeds and leaks mounts.
In examining the code I see that starting with a new root that is below the current root in the mount tree will result in a loop in the mount tree after the mounts are detached and then reattached to one another. Resulting in all kinds of ugliness including a leak of that mounts involved in the leak of the mount loop.
Prevent this problem by ensuring that the new mount is reachable from the current root of the mount tree.
[Added stable cc. Fixes CVE-2014-7970. --Andy]
--- fs/namespace.c | 3 +++ 1 file changed, 3 insertions(+)
fs/namespace.c +3 -0
@@ -2508,6 +2508,9 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,/* make sure we can reach put_old from new_root */ if (!is_path_reachable (real_mount (old.mnt), old.dentry, &new)) goto out4; +/* make certain new is below the root */ +if (!is_path_reachable (new_mnt, new.dentry, &root)) + goto out4;br_write_lock (vfsmount_lock);detach_mnt (new_mnt, &parent_path);detach_mnt (root_mnt, &root_parent);
Signature · 1 line
1.9.1
PATCH 55/91 can: flexcan: correctly initialize mailboxes
In reply to [email protected]From: David Jander <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit fc05b884a31dbf259cc73cc856e634ec3acbebb6 upstream.
Apparently mailboxes may contain random data at startup, causing some of them being prepared for message reception. This causes overruns being missed or even confusing the IRQ check for trasmitted messages, increasing the transmit counter instead of the error counter.
This patch initializes all mailboxes after the FIFO as RX_INACTIVE.
--- drivers/net/can/flexcan.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/can/flexcan.c +7 -0
@@ -680,6 +680,7 @@ static int flexcan_chip_start(struct net_device *dev)struct flexcan_regs __iomem *regs = priv->base;int err;u32 reg_mcr, reg_ctrl; +int i;/* enable module */ flexcan_chip_enable (priv);
@@ -745,6 +746,12 @@ static int flexcan_chip_start(struct net_device *dev)netdev_dbg (dev,"%s: writing ctrl=0x%08x" , __func__, reg_ctrl);flexcan_write (reg_ctrl, ®s->ctrl); +/* clear and invalidate all mailboxes first */ +for (i =FLEXCAN_TX_BUF_ID ; i <ARRAY_SIZE (regs->cantxfg); i++) { +flexcan_write (FLEXCAN_MB_CODE_RX_INACTIVE , + ®s->cantxfg[i].can_ctrl); + } +/* mark TX mailbox as INACTIVE */ flexcan_write (FLEXCAN_MB_CODE_TX_INACTIVE , ®s->cantxfg[FLEXCAN_TX_BUF_ID ].can_ctrl);
Signature · 1 line
1.9.1
PATCH 55/177 virtio_pci: fix virtio spec compliance on restore
In reply to [email protected]From: "Michael S. Tsirkin" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 6fbc198cf623944ab60a1db6d306a4d55cdd820d upstream.
On restore, virtio pci does the following:
+ set features
+ init vqs etc - device can be used at this point!
+ set ACKNOWLEDGE,DRIVER and DRIVER_OK status bits
This is in violation of the virtio spec, which
requires the following order:
- ACKNOWLEDGE
- DRIVER
- init vqs
- DRIVER_OK
This behaviour will break with hypervisors that assume spec compliant behaviour. It seems like a good idea to have this patch applied to stable branches to reduce the support butden for the hypervisors.
--- drivers/virtio/virtio_pci.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/virtio/virtio_pci.c +30 -3
@@ -745,6 +745,7 @@ static int virtio_pci_restore(struct device *dev)struct pci_dev *pci_dev =to_pci_dev (dev);struct virtio_pci_device *vp_dev =pci_get_drvdata (pci_dev);struct virtio_driver *drv; +unsigned status =0 ;int ret; drv = container_of(vp_dev->vdev.dev.driver,
@@ -755,14 +756,40 @@ static int virtio_pci_restore(struct device *dev)return ret;pci_set_master (pci_dev); +/* We always start by resetting the device, in case a previous +* driver messed it up. */ +vp_reset (&vp_dev->vdev); + +/* Acknowledge that we've seen the device. */ + status |=VIRTIO_CONFIG_S_ACKNOWLEDGE ; +vp_set_status (&vp_dev->vdev, status); + +/* Maybe driver failed before freeze. +* Restore the failed status, for debugging. */ + status |= vp_dev->saved_status &VIRTIO_CONFIG_S_FAILED ; +vp_set_status (&vp_dev->vdev, status); + +if (!drv) +return 0 ; + +/* We have a driver! */ + status |=VIRTIO_CONFIG_S_DRIVER ; +vp_set_status (&vp_dev->vdev, status); +vp_finalize_features (&vp_dev->vdev); -if (drv && drv->restore) +if (drv->restore) { ret = drv->restore (&vp_dev->vdev); +if (ret) { + status |=VIRTIO_CONFIG_S_FAILED ; +vp_set_status (&vp_dev->vdev, status); +return ret; + } + }/* Finally, tell the device we're all set */ -if (!ret) -vp_set_status (&vp_dev->vdev, vp_dev->saved_status); + status |=VIRTIO_CONFIG_S_DRIVER_OK ; +vp_set_status (&vp_dev->vdev, status);return ret; }
Signature · 1 line
1.9.1
PATCH 56/91 can: flexcan: implement workaround for errata ERR005829
In reply to [email protected]From: David Jander <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 25e924450fcb23c11c07c95ea8964dd9f174652e upstream.
This patch implements the workaround mentioned in ERR005829:
ERR005829: FlexCAN: FlexCAN does not transmit a message that is enabled to be transmitted in a specific moment during the arbitration process.
Workaround: The workaround consists of two extra steps after setting up a message for transmission:
Step 8: Reserve the first valid mailbox as an inactive mailbox (CODE=0b1000). If RX FIFO is disabled, this mailbox must be message buffer 0. Otherwise, the first valid mailbox can be found using the "RX FIFO filters" table in the FlexCAN chapter of the chip reference manual.
Step 9: Write twice INACTIVE code (0b1000) into the first valid mailbox.
--- drivers/net/can/flexcan.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/can/flexcan.c +15 -1
@@ -123,7 +123,9 @@ FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT)/* FLEXCAN interrupt flag register (IFLAG) bits */ -#define FLEXCAN_TX_BUF_ID 8 +/* Errata ERR005829 step7: Reserve first valid MB */ +#define FLEXCAN_TX_BUF_RESERVED 8 +#define FLEXCAN_TX_BUF_ID 9#define FLEXCAN_IFLAG_BUF (x) BIT(x)#define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7)#define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6)
@@ -317,6 +319,14 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)flexcan_write (can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID ].can_id);flexcan_write (ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID ].can_ctrl); +/* Errata ERR005829 step8: +* Write twice INACTIVE(0x8) code to first MB. +*/ +flexcan_write (FLEXCAN_MB_CODE_TX_INACTIVE , + ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED ].can_ctrl); +flexcan_write (FLEXCAN_MB_CODE_TX_INACTIVE , + ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED ].can_ctrl); +return NETDEV_TX_OK ; }
@@ -752,6 +762,10 @@ static int flexcan_chip_start(struct net_device *dev) ®s->cantxfg[i].can_ctrl); } +/* Errata ERR005829: mark first TX mailbox as INACTIVE */ +flexcan_write (FLEXCAN_MB_CODE_TX_INACTIVE , + ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED ].can_ctrl); +/* mark TX mailbox as INACTIVE */ flexcan_write (FLEXCAN_MB_CODE_TX_INACTIVE , ®s->cantxfg[FLEXCAN_TX_BUF_ID ].can_ctrl);
Signature · 1 line
1.9.1
PATCH 56/177 selinux: fix inode security list corruption
In reply to [email protected]From: Stephen Smalley <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 923190d32de4428afbea5e5773be86bea60a9925 upstream.
sb_finish_set_opts() can race with inode_free_security() when initializing inode security structures for inodes created prior to initial policy load or by the filesystem
during ->mount(). This appears to have always been
a possible race, but commit 3dc91d4 ("SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()") made it more evident by immediately reusing the unioned list/rcu element of the inode security structure for call_rcu() upon an inode_free_security(). But the underlying issue was already present before that commit as a possible use-after-free of isec.
Shivnandan Kumar reported the list corruption and proposed a patch to split the list and rcu elements out of the union as separate fields of the inode_security_struct so that setting the rcu element would not affect the list element. However, this would merely hide the issue and not truly fix the code.
This patch instead moves up the deletion of the list entry prior to dropping the sbsec->isec_lock initially. Then, if the inode is dropped subsequently, there will be no further references to the isec.
--- security/selinux/hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/hooks.c +1 -1
@@ -436,6 +436,7 @@ next_inode:list_entry (sbsec->isec_head.next, struct inode_security_struct, list);struct inode *inode = isec->inode; +list_del_init (&isec->list);spin_unlock (&sbsec->isec_lock); inode =igrab (inode);if (inode) {
@@ -444,7 +445,6 @@ next_inode:iput (inode); }spin_lock (&sbsec->isec_lock); -list_del_init (&isec->list); goto next_inode; }spin_unlock (&sbsec->isec_lock);
Signature · 1 line
1.9.1
PATCH 57/91 can: flexcan: put TX mailbox into TX_INACTIVE mode after tx-complete
In reply to [email protected]From: Marc Kleine-Budde <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit de5944883ebbedbf5adc8497659772f5da7b7d72 upstream.
After sending a RTR frame the TX mailbox becomes a RX_EMPTY mailbox. To avoid side effects when the RX-FIFO is full, this patch puts the TX mailbox into TX_INACTIVE mode in the transmission complete interrupt handler. This, of course, leaves a race window between the actual completion of the transmission and the handling of tx-complete interrupt. However this is the best we can do without busy polling the tx complete interrupt.
--- drivers/net/can/flexcan.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/can/flexcan.c +3 -0
@@ -633,6 +633,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)if (reg_iflag1 & (1 <<FLEXCAN_TX_BUF_ID )) { stats->tx_bytes +=can_get_echo_skb (dev,0 ); stats->tx_packets++; +/* after sending a RTR frame mailbox is in RX mode */ +flexcan_write (FLEXCAN_MB_CODE_TX_INACTIVE , + ®s->cantxfg[FLEXCAN_TX_BUF_ID ].can_ctrl);flexcan_write ((1 <<FLEXCAN_TX_BUF_ID ), ®s->iflag1);netif_wake_queue (dev); }
Signature · 1 line
1.9.1
PATCH 57/177 futex: Ensure get_futex_key_refs() always implies a barrier
In reply to [email protected]From: Catalin Marinas <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 76835b0ebf8a7fe85beb03c75121419a7dec52f0 upstream.
Commit b0c29f79ecea (futexes: Avoid taking the hb->lock if there's nothing to wake up) changes the futex code to avoid taking a lock when there are no waiters. This code has been subsequently fixed in commit 11d4616bd07f (futex: revert back to the explicit waiter counting code). Both the original commit and the fix-up rely on get_futex_key_refs() to always imply a barrier.
However, for private futexes, none of the cases in the switch statement of get_futex_key_refs() would be hit and the function completes without a memory barrier as required before checking the "waiters" in futex_wake() -> hb_waiters_pending(). The consequence is a race with a thread waiting on a futex on another CPU, allowing the waker thread to read "waiters == 0" while the waiter thread to have read "futex_val == locked" (in kernel).
Without this fix, the problem (user space deadlocks) can be seen with Android bionic's mutex implementation on an arm64 multi-cluster system.
--- kernel/futex.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/futex.c +2 -0
@@ -212,6 +212,8 @@ static void drop_futex_key_refs(union futex_key *key)case FUT_OFF_MMSHARED :mmdrop (key->private.mm);break ; +default : +smp_mb ();/* explicit MB (B) */ } }
Signature · 1 line
1.9.1
PATCH 58/91 can: at91_can: add missing prepare and unprepare of the clock
In reply to [email protected]From: David Dueck <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit e77980e50bc2850599d4d9c0192b67a9ffd6daac upstream.
In order to make the driver work with the common clock framework, this patch converts the clk_enable()/clk_disable() to clk_prepare_enable()/clk_disable_unprepare(). While there, add the missing error handling.
--- drivers/net/can/at91_can.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/can/at91_can.c +5 -3
@@ -1115,7 +1115,9 @@ static int at91_open(struct net_device *dev)struct at91_priv *priv =netdev_priv (dev);int err; -clk_enable (priv->clk); + err =clk_prepare_enable (priv->clk); +if (err) +return err;/* check or determine and set bittime */ err =open_candev (dev);
@@ -1139,7 +1141,7 @@ static int at91_open(struct net_device *dev) out_close:close_candev (dev); out: -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);return err; }
@@ -1156,7 +1158,7 @@ static int at91_close(struct net_device *dev)at91_chip_stop (dev,CAN_STATE_STOPPED );free_irq (dev->irq, dev); -clk_disable (priv->clk); +clk_disable_unprepare (priv->clk);close_candev (dev);
Signature · 1 line
1.9.1
PATCH 58/177 x86,kvm,vmx: Preserve CR4 across VM entry
In reply to [email protected]From: Andy Lutomirski <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d974baa398f34393db76be45f7d4d04fbdbb4a0a upstream.
CR4 isn't constant; at least the TSD and PCE bits can vary.
TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks like it's correct.
This adds a branch and a read from cr4 to each vm entry. Because it is extremely likely that consecutive entries into the same vcpu will have the same host cr4 value, this fixes up the vmcs instead of restoring cr4 after the fact. A subsequent patch will add a kernel-wide cr4 shadow, reducing the overhead in the common case to just two memory reads and a branch.
[lizf: Backported to 3.4:
- adjust context
- add parameter struct vcpu_vmx *vmx to vmx_set_constant_host_state()]
--- arch/x86/kvm/vmx.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx.c +17 -4
@@ -388,6 +388,7 @@ struct vcpu_vmx {u16 fs_sel, gs_sel, ldt_sel;int gs_ldt_reload_needed;int fs_reload_needed; +unsigned long vmcs_host_cr4;/* May not match real cr4 */ } host_state;struct {int vm86_active;
@@ -3622,16 +3623,21 @@ static void vmx_disable_intercept_for_msr(u32 msr, bool longmode_only)* Note that host-state that does change is set elsewhere. E.g., host-state * that is set differently for each CPU is set in vmx_vcpu_load(), not here. */ -static void vmx_set_constant_host_state (void ) +static void vmx_set_constant_host_state (struct vcpu_vmx *vmx) {u32 low32, high32;unsigned long tmpl;struct desc_ptr dt; +unsigned long cr4;vmcs_writel (HOST_CR0 ,read_cr0 () |X86_CR0_TS );/* 22.2.3 */ -vmcs_writel (HOST_CR4 ,read_cr4 ());/* 22.2.3, 22.2.5 */ vmcs_writel (HOST_CR3 ,read_cr3 ());/* 22.2.3 FIXME: shadow tables */ +/* Save the most likely value for this task's CR4 in the VMCS. */ + cr4 =read_cr4 (); +vmcs_writel (HOST_CR4 , cr4);/* 22.2.3, 22.2.5 */ + vmx->host_state.vmcs_host_cr4 = cr4; +vmcs_write16 (HOST_CS_SELECTOR , __KERNEL_CS);/* 22.2.4 */ vmcs_write16 (HOST_DS_SELECTOR , __KERNEL_DS);/* 22.2.4 */ vmcs_write16 (HOST_ES_SELECTOR , __KERNEL_DS);/* 22.2.4 */
@@ -3753,7 +3759,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)vmcs_write16 (HOST_FS_SELECTOR ,0 );/* 22.2.4 */ vmcs_write16 (HOST_GS_SELECTOR ,0 );/* 22.2.4 */ -vmx_set_constant_host_state (); +vmx_set_constant_host_state (vmx);#ifdef CONFIG_X86_64 rdmsrl (MSR_FS_BASE , a);vmcs_writel (HOST_FS_BASE , a);/* 22.2.4 */
@@ -6101,6 +6107,7 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx)static void __noclone vmx_vcpu_run (struct kvm_vcpu *vcpu) {struct vcpu_vmx *vmx =to_vmx (vcpu); +unsigned long cr4;if (is_guest_mode (vcpu) && !vmx->nested.nested_run_pending) {struct vmcs12 *vmcs12 =get_vmcs12 (vcpu);
@@ -6131,6 +6138,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)if (test_bit (VCPU_REGS_RIP , (unsigned long *)&vcpu->arch.regs_dirty))vmcs_writel (GUEST_RIP , vcpu->arch.regs[VCPU_REGS_RIP ]); + cr4 =read_cr4 (); +if (unlikely (cr4 != vmx->host_state.vmcs_host_cr4)) { +vmcs_writel (HOST_CR4 , cr4); + vmx->host_state.vmcs_host_cr4 = cr4; + } +/* When single-stepping over STI and MOV SS, we must clear the * corresponding interruptibility bits in the guest state. Otherwise * vmentry fails as it then expects bit 14 (BS) in pending debug
@@ -6589,7 +6602,7 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)* Other fields are different per CPU, and will be set later when * vmx_vcpu_load() is called, and when vmx_save_host_state() is called. */ -vmx_set_constant_host_state (); +vmx_set_constant_host_state (vmx);/* * HOST_RSP is normally set correctly in vmx_vcpu_run() just before
Signature · 1 line
1.9.1
PATCH 59/91 ALSA: pcm: fix fifo_size frame calculation
In reply to [email protected]From: Clemens Ladisch <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit a9960e6a293e6fc3ed414643bb4e4106272e4d0a upstream.
The calculated frame size was wrong because snd_pcm_format_physical_width() actually returns the number of bits, not bytes.
Use snd_pcm_format_size() instead, which not only returns bytes, but also simplifies the calculation.
--- sound/core/pcm_lib.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/core/pcm_lib.c +5 -3
@@ -1693,14 +1693,16 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, {struct snd_pcm_hw_params *params = arg;snd_pcm_format_t format; -int channels, width; +int channels; +ssize_t frame_size; params->fifo_size = substream->runtime->hw.fifo_size;if (!(substream->runtime->hw.info &SNDRV_PCM_INFO_FIFO_IN_FRAMES )) { format =params_format (params); channels =params_channels (params); - width =snd_pcm_format_physical_width (format); - params->fifo_size /= width * channels; + frame_size =snd_pcm_format_size (format, channels); +if (frame_size >0 ) + params->fifo_size /= (unsigned )frame_size; }return 0 ; }
Signature · 1 line
1.9.1
PATCH 59/177 ext4: check EA value offset when loading
In reply to [email protected]From: "Darrick J. Wong" <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit a0626e75954078cfacddb00a4545dde821170bc5 upstream.
When loading extended attributes, check each entry's value offset to make sure it doesn't collide with the entries.
Without this check it is easy to crash the kernel by mounting a malicious FS containing a file with an EA wherein e_value_offs = 0 and e_value_size > 0 and then deleting the EA, which corrupts the name list.
(See the f_ea_value_crash test's FS image in e2fsprogs for an example.)
--- fs/ext4/xattr.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
fs/ext4/xattr.c +24 -8
@@ -144,14 +144,28 @@ ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) }static int -ext4_xattr_check_names (struct ext4_xattr_entry *entry,void *end) +ext4_xattr_check_names (struct ext4_xattr_entry *entry,void *end, +void *value_start) { -while (!IS_LAST_ENTRY (entry)) { -struct ext4_xattr_entry *next =EXT4_XATTR_NEXT (entry); +struct ext4_xattr_entry *e = entry; + +while (!IS_LAST_ENTRY (e)) { +struct ext4_xattr_entry *next =EXT4_XATTR_NEXT (e);if ((void *)next >= end)return -EIO ; - entry = next; + e = next; } + +while (!IS_LAST_ENTRY (entry)) { +if (entry->e_value_size !=0 && + (value_start +le16_to_cpu (entry->e_value_offs) < + (void *)e +sizeof (__u32) || + value_start +le16_to_cpu (entry->e_value_offs) + +le32_to_cpu (entry->e_value_size) > end)) +return -EIO ; + entry =EXT4_XATTR_NEXT (entry); + } +return 0 ; }
@@ -161,7 +175,8 @@ ext4_xattr_check_block(struct buffer_head *bh)if (BHDR (bh)->h_magic !=cpu_to_le32 (EXT4_XATTR_MAGIC ) ||BHDR (bh)->h_blocks !=cpu_to_le32 (1 ))return -EIO ; -return ext4_xattr_check_names (BFIRST (bh), bh->b_data + bh->b_size); +return ext4_xattr_check_names (BFIRST (bh), bh->b_data + bh->b_size, + bh->b_data); } static inline int
@@ -274,7 +289,7 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name, header =IHDR (inode, raw_inode); entry =IFIRST (header); end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; - error =ext4_xattr_check_names (entry, end); + error =ext4_xattr_check_names (entry, end, entry);if (error) goto cleanup; error = ext4_xattr_find_entry(&entry, name_index, name,
@@ -402,7 +417,7 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; - error =ext4_xattr_check_names (IFIRST (header), end); + error =ext4_xattr_check_names (IFIRST (header), end,IFIRST (header));if (error) goto cleanup; error = ext4_xattr_list_entries(dentry, IFIRST(header),
@@ -914,7 +929,8 @@ ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i, is->s.here = is->s.first; is->s.end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size;if (ext4_test_inode_state (inode,EXT4_STATE_XATTR )) { - error =ext4_xattr_check_names (IFIRST (header), is->s.end); + error =ext4_xattr_check_names (IFIRST (header), is->s.end, +IFIRST (header));if (error)return error;/* Find the named attribute. */
Signature · 1 line
1.9.1
PATCH 60/91 Fix nasty 32-bit overflow bug in buffer i/o code.
In reply to [email protected]From: Anton Altaparmakov <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit f2d5a94436cc7cc0221b9a81bba2276a25187dd3 upstream.
On 32-bit architectures, the legacy buffer_head functions are not always handling the sector number with the proper 64-bit types, and will thus fail on 4TB+ disks.
Any code that uses __getblk() (and thus bread(), breadahead(), sb_bread(), sb_breadahead(), sb_getblk()), and calls it using a 64-bit block on a 32-bit arch (where "long" is 32-bit) causes an inifinite loop in __getblk_slow() with an infinite stream of errors logged to dmesg like this:
__find_get_block_slow() failed. block=6740375944, b_blocknr=2445408648 b_state=0x00000020, b_size=512
device sda1 blocksize: 512
Note how in hex block is 0x191C1F988 and b_blocknr is 0x91C1F988 i.e. the top 32-bits are missing (in this case the 0x1 at the top).
This is because grow_dev_page() is broken and has a 32-bit overflow due to shifting the page index value (a pgoff_t - which is just 32 bits on 32-bit architectures) left-shifted as the block number. But the top bits to get lost as the pgoff_t is not type cast to sector_t / 64-bit before the shift.
This patch fixes this issue by type casting "index" to sector_t before doing the left shift.
Note this is not a theoretical bug but has been seen in the field on a 4TiB hard drive with logical sector size 512 bytes.
This patch has been verified to fix the infinite loop problem on 3.17-rc5 kernel using a 4TB disk image mounted using "-o loop". Without this patch doing a "find /nt" where /nt is an NTFS volume causes the inifinite loop 100% reproducibly whilst with the patch it works fine as expected.
--- fs/buffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/buffer.c +4 -2
@@ -971,7 +971,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, bh =page_buffers (page);if (bh->b_size == size) { end_block =init_page_buffers (page, bdev, - index << sizebits, size); + (sector_t )index << sizebits, + size); goto done; }if (!try_to_free_buffers (page))
@@ -992,7 +993,8 @@ grow_dev_page(struct block_device *bdev, sector_t block,*/ spin_lock (&inode->i_mapping->private_lock);link_dev_buffers (page, bh); - end_block =init_page_buffers (page, bdev, index << sizebits, size); + end_block =init_page_buffers (page, bdev, (sector_t )index << sizebits, + size);spin_unlock (&inode->i_mapping->private_lock); done: ret = (block < end_block) ?1 : -ENXIO ;
Signature · 1 line
1.9.1
PATCH 60/177 ext4: don't check quota format when there are no quota files
In reply to [email protected]From: Jan Kara <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 279bf6d390933d5353ab298fcc306c391a961469 upstream.
The check whether quota format is set even though there are no quota files with journalled quota is pointless and it actually makes it impossible to turn off journalled quotas (as there's no way to unset journalled quota format). Just remove the check.
--- fs/ext4/super.c | 7 ------- 1 file changed, 7 deletions(-)
fs/ext4/super.c +0 -7
@@ -1642,13 +1642,6 @@ static int parse_options(char *options, struct super_block *sb, "not specified"); return 0; } - }else { -if (sbi->s_jquota_fmt) { -ext4_msg (sb,KERN_ERR ,"journaled quota format " -"specified with no journaling " -"enabled" ); -return 0 ; - } }#endif if (test_opt (sb,DIOREAD_NOLOCK )) {
Signature · 1 line
1.9.1
PATCH 61/91 parisc: Only use -mfast-indirect-calls option for 32-bit kernel builds
In reply to [email protected]From: John David Anglin <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d26a7730b5874a5fa6779c62f4ad7c5065a94723 upstream.
In spite of what the GCC manual says, the -mfast-indirect-calls has never been supported in the 64-bit parisc compiler. Indirect calls have always been done using function descriptors irrespective of the -mfast-indirect-calls option.
Recently, it was noticed that a function descriptor was always requested when the -mfast-indirect-calls option was specified. This caused problems when the option was used in application code and doesn't make any sense because the whole point of the option is to avoid using a function descriptor for indirect calls.
Fixing this broke 64-bit kernel builds.
I will fix GCC but for now we need the attached change. This results in the same kernel code as before.
--- arch/parisc/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/parisc/Makefile +6 -1
@@ -51,7 +51,12 @@ cflags-y := -pipe # These flags should be implied by an hppa-linux configuration, but they # are not in gcc 3.2. -cflags-y += -mno-space-regs -mfast-indirect-calls +cflags-y += -mno-space-regs + +# -mfast-indirect-calls is only relevant for 32-bit kernels. +ifndef CONFIG_64BIT +cflags-y += -mfast-indirect-calls +endif # Currently we save and restore fpregs on all kernel entry/interruption paths. # If that gets optimized, we might need to disable the use of fpregs in the
Signature · 1 line
1.9.1
PATCH 61/177 target: Fix queue full status NULL pointer for SCF_TRANSPORT_TASK_SENSE
In reply to [email protected]From: Quinn Tran <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 082f58ac4a48d3f5cb4597232cb2ac6823a96f43 upstream.
During temporary resource starvation at lower transport layer, command is placed on queue full retry path, which expose this problem. The TCM queue full handling of SCF_TRANSPORT_TASK_SENSE currently sends the same cmd twice to lower layer. The 1st time led to cmd normal free path. The 2nd time cause Null pointer access.
This regression bug was originally introduced v3.1-rc code in the following commit:
commit e057f53308a5f071556ee80586b99ee755bf07f5
Author: Christoph Hellwig <[email protected]> Date: Mon Oct 17 13:56:41 2011 -0400
target: remove the transport_qf_callback se_cmd callback
--- drivers/target/target_core_transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/target/target_core_transport.c +1 -2
@@ -3284,8 +3284,7 @@ static void transport_complete_qf(struct se_cmd *cmd)if (cmd->se_cmd_flags &SCF_TRANSPORT_TASK_SENSE ) { ret = cmd->se_tfo->queue_status (cmd); -if (ret) - goto out; + goto out; }switch (cmd->data_direction) {
Signature · 1 line
1.9.1
PATCH 62/91 sched: Fix unreleased llc_shared_mask bit during CPU hotplug
In reply to [email protected]From: Wanpeng Li <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 03bd4e1f7265548832a76e7919a81f3137c44fd1 upstream.
The following bug can be triggered by hot adding and removing a large number of xen domain0's vcpus repeatedly:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000004 IP: [..] find_busiest_group PGD 5a9d5067 PUD 13067 PMD 0 Oops: 0000 [#3] SMP [...] Call Trace: load_balance ? _raw_spin_unlock_irqrestore idle_balance __schedule schedule schedule_timeout ? lock_timer_base schedule_timeout_uninterruptible msleep lock_device_hotplug_sysfs online_store dev_attr_store sysfs_write_file vfs_write SyS_write system_call_fastpath
Last level cache shared mask is built during CPU up and the build_sched_domain() routine takes advantage of it to setup the sched domain CPU topology.
However, llc_shared_mask is not released during CPU disable, which leads to an invalid sched domainCPU topology.
This patch fix it by releasing the llc_shared_mask correctly during CPU disable.
Yasuaki also reported that this can happen on real hardware:
https://lkml.org/lkml/2014/7/22/1018
His case is here:
== Here is an example on my system. My system has 4 sockets and each socket has 15 cores and HT is enabled. In this case, each core of sockes is numbered as follows: | CPU# Socket#0 | 0-14 , 60-74 Socket#1 | 15-29, 75-89 Socket#2 | 30-44, 90-104 Socket#3 | 45-59, 105-119 Then llc_shared_mask of CPU#30 has 0x3fff80000001fffc0000000. It means that last level cache of Socket#2 is shared with CPU#30-44 and 90-104. When hot-removing socket#2 and #3, each core of sockets is numbered as follows: | CPU# Socket#0 | 0-14 , 60-74 Socket#1 | 15-29, 75-89 But llc_shared_mask is not cleared. So llc_shared_mask of CPU#30 remains having 0x3fff80000001fffc0000000. After that, when hot-adding socket#2 and #3, each core of sockets is numbered as follows: | CPU# Socket#0 | 0-14 , 60-74 Socket#1 | 15-29, 75-89 Socket#2 | 30-59 Socket#3 | 90-119 Then llc_shared_mask of CPU#30 becomes 0x3fff8000fffffffc0000000. It means that last level cache of Socket#2 is shared with CPU#30-59 and 90-104. So the mask has the wrong value.
--- arch/x86/kernel/smpboot.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/smpboot.c +3 -0
@@ -1248,6 +1248,9 @@ static void remove_siblinginfo(int cpu)for_each_cpu (sibling,cpu_sibling_mask (cpu))cpumask_clear_cpu (cpu,cpu_sibling_mask (sibling)); +for_each_cpu (sibling,cpu_llc_shared_mask (cpu)) +cpumask_clear_cpu (cpu,cpu_llc_shared_mask (sibling)); +cpumask_clear (cpu_llc_shared_mask (cpu));cpumask_clear (cpu_sibling_mask (cpu));cpumask_clear (cpu_core_mask (cpu)); c->phys_proc_id =0 ;
Signature · 1 line
1.9.1
PATCH 62/177 vfs: fix data corruption when blocksize < pagesize for mmaped data
In reply to [email protected]From: Jan Kara <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 90a8020278c1598fafd071736a0846b38510309c upstream.
->page_mkwrite() is used by filesystems to allocate blocks under a page which is becoming writeably mmapped in some process' address space. This allows a filesystem to return a page fault if there is not enough space available, user exceeds quota or similar problem happens, rather than silently discarding data later when writepage is called.
However VFS fails to call ->page_mkwrite() in all the cases where filesystems need it when blocksize < pagesize. For example when blocksize = 1024, pagesize = 4096 the following is problematic:
ftruncate(fd, 0);
pwrite(fd, buf, 1024, 0);
map = mmap(NULL, 1024, PROT_WRITE, MAP_SHARED, fd, 0);
map[0] = 'a'; ----> page_mkwrite() for index 0 is called
ftruncate(fd, 10000); /* or even pwrite(fd, buf, 1, 10000) */ mremap(map, 1024, 10000, 0);
map[4095] = 'a'; ----> no page_mkwrite() called
At the moment ->page_mkwrite() is called, filesystem can allocate only one block for the page because i_size == 1024. Otherwise it would create blocks beyond i_size which is generally undesirable. But later at ->writepage() time, we also need to store data at offset 4095 but we don't have block allocated for it.
This patch introduces a helper function filesystems can use to have ->page_mkwrite() called at all the necessary moments.
[lizf: Backported to 3.4:
- adjust context
- truncate_setsize() already has an oldsize variable]
--- fs/buffer.c | 3 +++ include/linux/mm.h | 1 + mm/truncate.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 63 insertions(+), 3 deletions(-)
fs/buffer.c +3 -0
@@ -1982,6 +1982,7 @@ int generic_write_end(struct file *file, struct address_space *mapping, struct page *page, void *fsdata) { struct inode *inode = mapping->host; +loff_t old_size = inode->i_size;int i_size_changed =0 ; copied =block_write_end (file, mapping, pos, len, copied, page, fsdata);
@@ -2001,6 +2002,8 @@ int generic_write_end(struct file *file, struct address_space *mapping,unlock_page (page);page_cache_release (page); +if (old_size < pos) +pagecache_isize_extended (inode, old_size, pos);/* * Don't mark the inode dirty under page lock. First, it unnecessarily * makes the holding time of page lock longer. Second, it forces lock
include/linux/mm.h +1 -0
@@ -953,6 +953,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,extern void truncate_pagecache (struct inode *inode,loff_t old,loff_t new);extern void truncate_setsize (struct inode *inode,loff_t newsize); +void pagecache_isize_extended (struct inode *inode,loff_t from,loff_t to);extern int vmtruncate (struct inode *inode,loff_t offset);extern int vmtruncate_range (struct inode *inode,loff_t offset,loff_t end);void truncate_pagecache_range (struct inode *inode,loff_t offset,loff_t end);
mm/truncate.c +59 -3
81 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 63/177 ext4: don't orphan or truncate the boot loader inode
In reply to [email protected]From: Theodore Ts'o <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit e2bfb088fac03c0f621886a04cffc7faa2b49b1d upstream.
The boot loader inode (inode #5) should never be visible in the directory hierarchy, but it's possible if the file system is corrupted that there will be a directory entry that points at inode #5. In order to avoid accidentally trashing it, when such a directory inode is opened, the inode will be marked as a bad inode, so that it's not possible to modify (or read) the inode from userspace.
Unfortunately, when we unlink this (invalid/illegal) directory entry, we will put the bad inode on the ophan list, and then when try to unlink the directory, we don't actually remove the bad inode from the orphan list before freeing in-memory inode structure. This means the in-memory orphan list is corrupted, leading to a kernel oops.
In addition, avoid truncating a bad inode in ext4_destroy_inode(), since truncating the boot loader inode is not a smart thing to do.
--- fs/ext4/inode.c | 8 +++----- fs/ext4/namei.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-)
fs/ext4/inode.c +3 -5
@@ -157,16 +157,14 @@ void ext4_evict_inode(struct inode *inode) goto no_delete; } -if (!is_bad_inode (inode)) -dquot_initialize (inode); +if (is_bad_inode (inode)) + goto no_delete; +dquot_initialize (inode);if (ext4_should_order_data (inode))ext4_begin_ordered_truncate (inode,0 );truncate_inode_pages (&inode->i_data,0 ); -if (is_bad_inode (inode)) - goto no_delete; - handle =ext4_journal_start (inode,ext4_blocks_for_truncate (inode)+3 );if (IS_ERR (handle)) {ext4_std_error (inode->i_sb,PTR_ERR (handle));
fs/ext4/namei.c +1 -1
@@ -1992,7 +1992,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)struct ext4_iloc iloc;int err =0 , rc; -if (!ext4_handle_valid (handle)) +if (!ext4_handle_valid (handle) ||is_bad_inode (inode))return 0 ;mutex_lock (&EXT4_SB (sb)->s_orphan_lock);
Signature · 1 line
1.9.1
PATCH 63/91 sched: add macros to define bitops for task atomic flags
In reply to [email protected]From: Zefan Li <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit e0e5070b20e01f0321f97db4e4e174f3f6b49e50 upstream.
This will simplify code when we add new flags.
v3:
- Kees pointed out that no_new_privs should never be cleared, so we shouldn't define task_clear_no_new_privs(). we define 3 macros instead of a single one.
v2:
- updated scripts/tags.sh, suggested by Peter
[lizf: Backported to 3.4:
- adjust context
- remove no_new_priv code
- add atomic_flags to struct task_struct]
--- include/linux/sched.h | 13 +++++++++++++ scripts/tags.sh | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
include/linux/sched.h +13 -0
@@ -1359,6 +1359,7 @@ struct task_struct {/* IRQ handler threads */ unsigned irq_thread:1;#endif +unsigned long atomic_flags;/* Flags needing atomic access. */ pid_t pid;pid_t tgid;
@@ -1866,6 +1867,18 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *#define tsk_used_math (p) ((p)->flags & PF_USED_MATH)#define used_math () tsk_used_math(current) +/* Per-process atomic flags. */ + +#define TASK_PFA_TEST (name, func) \ + static inline bool task_##func(struct task_struct *p) \ + { return test_bit(PFA_##name, &p->atomic_flags); } +#define TASK_PFA_SET (name, func) \ + static inline void task_set_##func(struct task_struct *p) \ + { set_bit(PFA_##name, &p->atomic_flags); } +#define TASK_PFA_CLEAR (name, func) \ + static inline void task_clear_##func(struct task_struct *p) \ + { clear_bit(PFA_##name, &p->atomic_flags); } +/* * task->jobctl flags */
scripts/tags.sh +8 -2
@@ -153,7 +153,10 @@ exuberant() --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ - --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' + --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'\ + --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ + --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ + --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' all_kconfigs | xargs $1 -a \ --langdef=kconfig --language-force=kconfig \
@@ -195,7 +198,10 @@ emacs() --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ - --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' + --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'\ + --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ + --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ + --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' all_kconfigs | xargs $1 -a \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
Signature · 1 line
1.9.1
PATCH 64/91 cpuset: PF_SPREAD_PAGE and PF_SPREAD_SLAB should be atomic flags
In reply to [email protected]From: Zefan Li <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 2ad654bc5e2b211e92f66da1d819e47d79a866f0 upstream.
When we change cpuset.memory_spread_{page,slab}, cpuset will flip PF_SPREAD_{PAGE,SLAB} bit of tsk->flags for each task in that cpuset. This should be done using atomic bitops, but currently we don't, which is broken.
Tetsuo reported a hard-to-reproduce kernel crash on RHEL6, which happened when one thread tried to clear PF_USED_MATH while at the same time another thread tried to flip PF_SPREAD_PAGE/PF_SPREAD_SLAB. They both operate on the same task.
Here's the full report:
https://lkml.org/lkml/2014/9/19/230
To fix this, we make PF_SPREAD_PAGE and PF_SPREAD_SLAB atomic flags.
v4:
- updated mm/slab.c. (Fengguang Wu)
- updated Documentation.
[lizf: Backported to 3.4:
- adjust context
- check current->flags & PF_MEMPOLICY rather than current->mempolicy]
--- Documentation/cgroups/cpusets.txt | 6 +++--- include/linux/cpuset.h | 4 ++-- include/linux/sched.h | 12 ++++++++++-- kernel/cpuset.c | 9 +++++---- mm/slab.c | 4 ++-- 5 files changed, 22 insertions(+), 13 deletions(-)
Documentation/cgroups/cpusets.txt +3 -3
@@ -345,14 +345,14 @@ the named feature on. The implementation is simple. Setting the flag 'cpuset.memory_spread_page' turns on a per-process flag -PF_SPREAD_PAGE for each task that is in that cpuset or subsequently +PFA_SPREAD_PAGE for each task that is in that cpuset or subsequently joins that cpuset. The page allocation calls for the page cache -is modified to perform an inline check for this PF_SPREAD_PAGE task +is modified to perform an inline check for this PFA_SPREAD_PAGE task flag, and if set, a call to a new routine cpuset_mem_spread_node() returns the node to prefer for the allocation. Similarly, setting 'cpuset.memory_spread_slab' turns on the flag -PF_SPREAD_SLAB, and appropriately marked slab caches will allocate +PFA_SPREAD_SLAB, and appropriately marked slab caches will allocate pages from the node returned by cpuset_mem_spread_node(). The cpuset_mem_spread_node() routine is also simple. It uses the
include/linux/cpuset.h +2 -2
@@ -74,12 +74,12 @@ extern int cpuset_slab_spread_node(void);static inline int cpuset_do_page_mem_spread (void ) { -return current->flags &PF_SPREAD_PAGE ; +return task_spread_page (current); }static inline int cpuset_do_slab_mem_spread (void ) { -return current->flags &PF_SPREAD_SLAB ; +return task_spread_slab (current); }extern int current_cpuset_is_being_rebound (void );
include/linux/sched.h +10 -2
@@ -1834,8 +1834,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *#define PF_KTHREAD 0x00200000/* I am a kernel thread */ #define PF_RANDOMIZE 0x00400000/* randomize virtual address space */ #define PF_SWAPWRITE 0x00800000/* Allowed to write to swap */ -#define PF_SPREAD_PAGE 0x01000000/* Spread page cache over cpuset */ -#define PF_SPREAD_SLAB 0x02000000/* Spread some slab caches over cpuset */ #define PF_THREAD_BOUND 0x04000000/* Thread bound to specific cpu */ #define PF_MCE_EARLY 0x08000000/* Early kill for mce process policy */ #define PF_MEMPOLICY 0x10000000/* Non-default NUMA mempolicy */
@@ -1868,6 +1866,8 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *#define used_math () tsk_used_math(current)/* Per-process atomic flags. */ +#define PFA_SPREAD_PAGE 1/* Spread page cache over cpuset */ +#define PFA_SPREAD_SLAB 2/* Spread some slab caches over cpuset */ #define TASK_PFA_TEST (name, func) \ static inline bool task_##func(struct task_struct *p) \
@@ -1970,6 +1970,14 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) }#endif +TASK_PFA_TEST(SPREAD_PAGE, spread_page) +TASK_PFA_SET(SPREAD_PAGE, spread_page) +TASK_PFA_CLEAR(SPREAD_PAGE, spread_page) + +TASK_PFA_TEST(SPREAD_SLAB, spread_slab) +TASK_PFA_SET(SPREAD_SLAB, spread_slab) +TASK_PFA_CLEAR (SPREAD_SLAB , spread_slab) +/* * Do not use outside of architecture code which knows its limitations. *
kernel/cpuset.c +5 -4
@@ -326,13 +326,14 @@ static void cpuset_update_task_spread_flag(struct cpuset *cs, struct task_struct *tsk) {if (is_spread_page (cs)) - tsk->flags |=PF_SPREAD_PAGE ; +task_set_spread_page (tsk);else - tsk->flags &= ~PF_SPREAD_PAGE ; +task_clear_spread_page (tsk); +if (is_spread_slab (cs)) - tsk->flags |=PF_SPREAD_SLAB ; +task_set_spread_slab (tsk);else - tsk->flags &= ~PF_SPREAD_SLAB ; +task_clear_spread_slab (tsk); }/*
mm/slab.c +2 -2
@@ -3321,7 +3321,7 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags)#ifdef CONFIG_NUMA /* -* Try allocating on another node if PF_SPREAD_SLAB|PF_MEMPOLICY. +* Try allocating on another node if PFA_SPREAD_SLAB|PF_MEMPOLICY. * * If we are in_interrupt, then process context, including cpusets and * mempolicy, may not apply and should not be used for allocation policy.
@@ -3562,7 +3562,7 @@ __do_cache_alloc(struct kmem_cache *cache, gfp_t flags) {void *objp; -if (unlikely (current->flags & (PF_SPREAD_SLAB |PF_MEMPOLICY ))) { +if (unlikely ((current->flags &PF_MEMPOLICY ) ||cpuset_do_slab_mem_spread ())) { objp =alternate_node_alloc (cache, flags);if (objp) goto out;
Signature · 1 line
1.9.1
PATCH 64/177 ext4: add ext4_iget_normal() which is to be used for dir tree lookups
In reply to [email protected]From: Theodore Ts'o <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit f4bb2981024fc91b23b4d09a8817c415396dbabb upstream.
If there is a corrupted file system which has directory entries that point at reserved, metadata inodes, prohibit them from being used by treating them the same way we treat Boot Loader inodes --- that is, mark them to be bad inodes. This prohibits them from being opened, deleted, or modified via chmod, chown, utimes, etc.
In particular, this prevents a corrupted file system which has a directory entry which points at the journal inode from being deleted and its blocks released, after which point Much Hilarity Ensues.
--- fs/ext4/ext4.h | 1 + fs/ext4/inode.c | 7 +++++++ fs/ext4/namei.c | 4 ++-- fs/ext4/super.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -1891,6 +1891,7 @@ int ext4_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create);extern struct inode *ext4_iget (struct super_block *,unsigned long ); +extern struct inode *ext4_iget_normal (struct super_block *,unsigned long );extern int ext4_write_inode (struct inode *,struct writeback_control *);extern int ext4_setattr (struct dentry *,struct iattr *); extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
fs/ext4/inode.c +7 -0
@@ -3838,6 +3838,13 @@ bad_inode:return ERR_PTR (ret); } +struct inode *ext4_iget_normal (struct super_block *sb,unsigned long ino) +{ +if (ino <EXT4_FIRST_INO (sb) && ino !=EXT4_ROOT_INO ) +return ERR_PTR (-EIO ); +return ext4_iget (sb, ino); +} +static int ext4_inode_blocks_set (handle_t *handle,struct ext4_inode *raw_inode,struct ext4_inode_info *ei)
fs/ext4/namei.c +2 -2
@@ -1051,7 +1051,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru dentry->d_name.name);return ERR_PTR (-EIO ); } - inode =ext4_iget (dir->i_sb, ino); + inode =ext4_iget_normal (dir->i_sb, ino);if (inode ==ERR_PTR (-ESTALE )) { EXT4_ERROR_INODE(dir, "deleted inode referenced: %u",
@@ -1087,7 +1087,7 @@ struct dentry *ext4_get_parent(struct dentry *child)return ERR_PTR (-EIO ); } -return d_obtain_alias (ext4_iget (child->d_inode->i_sb, ino)); +return d_obtain_alias (ext4_iget_normal (child->d_inode->i_sb, ino)); }#define S_SHIFT 12
fs/ext4/super.c +1 -1
@@ -1041,7 +1041,7 @@ static struct inode *ext4_nfs_get_inode(struct super_block *sb,* Currently we don't know the generation for parent directory, so * a generation of 0 means "accept any" */ - inode =ext4_iget (sb, ino); + inode =ext4_iget_normal (sb, ino);if (IS_ERR (inode))return ERR_CAST (inode);if (generation && inode->i_generation != generation) {
Signature · 1 line
1.9.1
PATCH 65/91 MIPS: mcount: Adjust stack pointer for static trace in MIPS32
In reply to [email protected]From: Markos Chandras <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 8a574cfa2652545eb95595d38ac2a0bb501af0ae upstream.
Every mcount() call in the MIPS 32-bit kernel is done as follows:
[...]
move at, ra
jal _mcount
addiu sp, sp, -8
[...]
but upon returning from the mcount() function, the stack pointer is not adjusted properly. This is explained in details in 58b69401c797 (MIPS: Function tracer: Fix broken function tracing).
Commit ad8c396936e3 ("MIPS: Unbreak function tracer for 64-bit kernel.) fixed the stack manipulation for 64-bit but it didn't fix it completely for MIPS32.
Patchwork: https://patchwork.linux-mips.org/patch/7792/
--- arch/mips/kernel/mcount.S | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/mips/kernel/mcount.S +12 -0
@@ -119,7 +119,11 @@ NESTED(_mcount, PT_SIZE, ra) nop #endif b ftrace_stub +#ifdef CONFIG_32BIT + addiu sp, sp, 8 +#else nop +#endif static_trace: MCOUNT_SAVE_REGS
@@ -129,6 +133,9 @@ static_trace: move a1, AT /* arg2: parent's return address */ MCOUNT_RESTORE_REGS +#ifdef CONFIG_32BIT + addiu sp, sp, 8 +#endif .globl ftrace_stub ftrace_stub: RETURN_BACK
@@ -177,6 +184,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra) jal prepare_ftrace_return nop MCOUNT_RESTORE_REGS +#ifndef CONFIG_DYNAMIC_FTRACE +#ifdef CONFIG_32BIT + addiu sp, sp, 8 +#endif +#endif RETURN_BACK END(ftrace_graph_caller)
Signature · 1 line
1.9.1
PATCH 65/177 ext4: fix reservation overflow in ext4_da_write_begin
In reply to [email protected]From: Eric Sandeen <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 0ff8947fc5f700172b37cbca811a38eb9cb81e08 upstream.
Delalloc write journal reservations only reserve 1 credit, to update the inode if necessary. However, it may happen once in a filesystem's lifetime that a file will cross the 2G threshold, and require the LARGE_FILE feature to be set in the superblock as well, if it was not set already.
This overruns the transaction reservation, and can be demonstrated simply on any ext4 filesystem without the LARGE_FILE feature already set:
dd if=/dev/zero of=testfile bs=1 seek=2147483646 count=1 \
conv=notrunc of=testfile
sync
dd if=/dev/zero of=testfile bs=1 seek=2147483647 count=1 \
conv=notrunc of=testfile
leads to:
EXT4-fs: ext4_do_update_inode:4296: aborting transaction: error 28 in __ext4_handle_dirty_super EXT4-fs error (device loop0) in ext4_do_update_inode:4301: error 28
EXT4-fs error (device loop0) in ext4_reserve_inode_write:4757: Readonly filesystem EXT4-fs error (device loop0) in ext4_dirty_inode:4876: error 28
EXT4-fs error (device loop0) in ext4_da_write_end:2685: error 28
Adjust the number of credits based on whether the flag is already set, and whether the current write may extend past the LARGE_FILE limit.
[lizf: Backported to 3.4:
- adjust context
- ext4_journal_start() has no parameter type]
--- fs/ext4/inode.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
fs/ext4/inode.c +16 -1
@@ -2408,6 +2408,20 @@ static int ext4_nonda_switch(struct super_block *sb)return 0 ; } +/* We always reserve for an inode update; the superblock could be there too */ +static int ext4_da_write_credits (struct inode *inode,loff_t pos,unsigned len) +{ +if (likely (EXT4_HAS_RO_COMPAT_FEATURE (inode->i_sb, +EXT4_FEATURE_RO_COMPAT_LARGE_FILE ))) +return 1 ; + +if (pos + len <=0x7fffffffULL ) +return 1 ; + +/* We might need to update the superblock to set LARGE_FILE */ +return 2 ; +} +static int ext4_da_write_begin (struct file *file,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags,struct page **pagep,void **fsdata)
@@ -2434,7 +2448,8 @@ retry:* to journalling the i_disksize update if writes to the end * of file which has an already mapped buffer. */ - handle =ext4_journal_start (inode,1 ); + handle =ext4_journal_start (inode, +ext4_da_write_credits (inode, pos, len));if (IS_ERR (handle)) { ret =PTR_ERR (handle); goto out;
Signature · 1 line
1.9.1
PATCH 66/177 crypto: more robust crypto_memneq
In reply to [email protected]From: Cesar Eduardo Barros <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit fe8c8a126806fea4465c43d62a1f9d273a572bf5 upstream.
[Only use the compiler.h portion of this patch, to get the OPTIMIZER_HIDE_VAR() macro, which we need for other -stable patches
- gregkh]
Disabling compiler optimizations can be fragile, since a new optimization could be added to -O0 or -Os that breaks the assumptions the code is making.
Instead of disabling compiler optimizations, use a dummy inline assembly (based on RELOC_HIDE) to block the problematic kinds of optimization, while still allowing other optimizations to be applied to the code.
The dummy inline assembly is added after every OR, and has the accumulator variable as its input and output. The compiler is forced to assume that the dummy inline assembly could both depend on the accumulator variable and change the accumulator variable, so it is forced to compute the value correctly before the inline assembly, and cannot assume anything about its value after the inline assembly.
This change should be enough to make crypto_memneq work correctly (with data-independent timing) even if it is inlined at its call sites. That can be done later in a followup patch.
Compile-tested on x86_64.
--- include/linux/compiler-gcc.h | 3 +++ include/linux/compiler-intel.h | 7 +++++++ 2 files changed, 10 insertions(+)
include/linux/compiler-gcc.h +3 -0
@@ -37,6 +37,9 @@ __asm__ ("" :"=r" (__ptr) :"0" (ptr)); \ (typeof(ptr)) (__ptr + (off)); }) +/* Make the optimizer believe the variable can be manipulated arbitrarily. */ +#define OPTIMIZER_HIDE_VAR (var) __asm__ ("" : "=r" (var) : "0" (var)) +#ifdef __CHECKER__#define __must_be_array (arr) 0#else
include/linux/compiler-intel.h +7 -0
@@ -15,6 +15,7 @@*/ #undef barrier#undef RELOC_HIDE +#undef OPTIMIZER_HIDE_VAR#define barrier () __memory_barrier()
@@ -23,6 +24,12 @@ __ptr = (unsigned long ) (ptr); \ (typeof(ptr)) (__ptr + (off)); }) +/* This should act as an optimization barrier on var. +* Given that this compiler does not have inline assembly, a compiler barrier +* is the best we can do. +*/ +#define OPTIMIZER_HIDE_VAR (var) barrier() +/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */ #define __must_be_array (a) 0
Signature · 1 line
1.9.1
PATCH 66/91 nilfs2: fix data loss with mmap()
In reply to [email protected]From: Andreas Rohner <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 56d7acc792c0d98f38f22058671ee715ff197023 upstream.
This bug leads to reproducible silent data loss, despite the use of msync(), sync() and a clean unmount of the file system. It is easily reproducible with the following script:
----------------[BEGIN SCRIPT]-------------------- mkfs.nilfs2 -f /dev/sdb
mount /dev/sdb /mnt
dd if=/dev/zero bs=1M count=30 of=/mnt/testfile
umount /mnt mount /dev/sdb /mnt CHECKSUM_BEFORE="$(md5sum /mnt/testfile)"
/root/mmaptest/mmaptest /mnt/testfile 30 10 5
sync CHECKSUM_AFTER="$(md5sum /mnt/testfile)" umount /mnt mount /dev/sdb /mnt CHECKSUM_AFTER_REMOUNT="$(md5sum /mnt/testfile)" umount /mnt
echo "BEFORE MMAP:\t$CHECKSUM_BEFORE" echo "AFTER MMAP:\t$CHECKSUM_AFTER"
echo "AFTER REMOUNT:\t$CHECKSUM_AFTER_REMOUNT" ----------------[END SCRIPT]--------------------
The mmaptest tool looks something like this (very simplified, with error checking removed):
----------------[BEGIN mmaptest]-------------------- data = mmap(NULL, file_size - file_offset, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, file_offset);
for (i = 0; i < write_count; ++i) {
memcpy(data + i * 4096, buf, sizeof(buf));
msync(data, file_size - file_offset, MS_SYNC))
}
----------------[END mmaptest]--------------------The output of the script looks something like this:
BEFORE MMAP: 281ed1d5ae50e8419f9b978aab16de83 /mnt/testfile AFTER MMAP: 6604a1c31f10780331a6850371b3a313 /mnt/testfile AFTER REMOUNT: 281ed1d5ae50e8419f9b978aab16de83 /mnt/testfile
So it is clear, that the changes done using mmap() do not survive a remount. This can be reproduced a 100% of the time. The problem was introduced in commit 136e8770cd5d ("nilfs2: fix issue of nilfs_set_page_dirty() for page at EOF boundary").
If the page was read with mpage_readpage() or mpage_readpages() for example, then it has no buffers attached to it. In that case page_has_buffers(page) in nilfs_set_page_dirty() will be false. Therefore nilfs_set_file_dirty() is never called and the pages are never collected and never written to disk.
This patch fixes the problem by also calling nilfs_set_file_dirty() if the page has no buffers attached to it.
--- fs/nilfs2/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/nilfs2/inode.c +6 -1
@@ -24,6 +24,7 @@#include <linux/buffer_head.h> #include <linux/gfp.h> #include <linux/mpage.h> +#include <linux/pagemap.h> #include <linux/writeback.h> #include <linux/uio.h> #include "nilfs.h"
@@ -195,10 +196,10 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)static int nilfs_set_page_dirty (struct page *page) { +struct inode *inode = page->mapping->host;int ret =__set_page_dirty_nobuffers (page);if (page_has_buffers (page)) { -struct inode *inode = page->mapping->host;unsigned nr_dirty =0 ;struct buffer_head *bh, *head;
@@ -221,6 +222,10 @@ static int nilfs_set_page_dirty(struct page *page)if (nr_dirty)nilfs_set_file_dirty (inode, nr_dirty); + }else if (ret) { +unsigned nr_dirty =1 << (PAGE_CACHE_SHIFT - inode->i_blkbits); + +nilfs_set_file_dirty (inode, nr_dirty); }return ret; }
Signature · 1 line
1.9.1
PATCH 67/91 ocfs2/dlm: do not get resource spinlock if lockres is new
In reply to [email protected]From: Joseph Qi <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 5760a97c7143c208fa3a8f8cad0ed7dd672ebd28 upstream.
There is a deadlock case which reported by Guozhonghua:
https://oss.oracle.com/pipermail/ocfs2-devel/2014-September/010079.html
This case is caused by &res->spinlock and &dlm->master_lock misordering in different threads.
It was introduced by commit 8d400b81cc83 ("ocfs2/dlm: Clean up refmap helpers"). Since lockres is new, it doesn't not require the &res->spinlock. So remove it.
--- fs/ocfs2/dlm/dlmmaster.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
fs/ocfs2/dlm/dlmmaster.c +10 -8
@@ -653,12 +653,9 @@ void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm,clear_bit (bit, res->refmap); } - -void dlm_lockres_grab_inflight_ref (struct dlm_ctxt *dlm, +static void __dlm_lockres_grab_inflight_ref (struct dlm_ctxt *dlm,struct dlm_lock_resource *res) { -assert_spin_locked (&res->spinlock); - res->inflight_locks++; mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name,
@@ -666,6 +663,13 @@ void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, __builtin_return_address(0)); } +void dlm_lockres_grab_inflight_ref (struct dlm_ctxt *dlm, +struct dlm_lock_resource *res) +{ +assert_spin_locked (&res->spinlock); +__dlm_lockres_grab_inflight_ref (dlm, res); +} +void dlm_lockres_drop_inflight_ref (struct dlm_ctxt *dlm,struct dlm_lock_resource *res) {
@@ -855,10 +859,8 @@ lookup:/* finally add the lockres to its hash bucket */ __dlm_insert_lockres (dlm, res); -/* Grab inflight ref to pin the resource */ -spin_lock (&res->spinlock); -dlm_lockres_grab_inflight_ref (dlm, res); -spin_unlock (&res->spinlock); +/* since this lockres is new it doesn't not require the spinlock */ +__dlm_lockres_grab_inflight_ref (dlm, res);/* get an extra ref on the mle in case this is a BLOCK * if so, the creator of the BLOCK may try to put the last
Signature · 1 line
1.9.1
PATCH 67/177 random: add and use memzero_explicit() for clearing data
In reply to [email protected]From: Daniel Borkmann <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d4c5efdb97773f59a2b711754ca0953f24516739 upstream.
zatimend has reported that in his environment (3.16/gcc4.8.3/corei7) memset() calls which clear out sensitive data in extract_{buf,entropy, entropy_user}() in random driver are being optimized away by gcc.
Add a helper memzero_explicit() (similarly as explicit_bzero() variants) that can be used in such cases where a variable with sensitive data is being cleared out in the end. Other use cases might also be in crypto code. [ I have put this into lib/string.c though, as it's always built-in and doesn't need any dependencies then. ]
Fixes kernel bugzilla: 82041
[lizf: Backported to 3.4:
- adjust context
- another memset() in extract_buf() needs to be converted]
--- drivers/char/random.c | 10 +++++----- include/linux/string.h | 4 +++- lib/string.c | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-)
drivers/char/random.c +5 -5
@@ -932,8 +932,8 @@ static void extract_buf(struct entropy_store *r, __u8 *out)* pool while mixing, and hash one final time. */ sha_transform (hash.w, extract, workspace); -memset (extract,0 ,sizeof (extract)); -memset (workspace,0 ,sizeof (workspace)); +memzero_explicit (extract,sizeof (extract)); +memzero_explicit (workspace,sizeof (workspace));/* * In case the hash function has some recognizable output
@@ -956,7 +956,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out) }memcpy (out, &hash,EXTRACT_SIZE ); -memset (&hash,0 ,sizeof (hash)); +memzero_explicit (&hash,sizeof (hash)); } static ssize_t extract_entropy(struct entropy_store *r, void *buf,
@@ -989,7 +989,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf, }/* Wipe data just returned from memory */ -memset (tmp,0 ,sizeof (tmp)); +memzero_explicit (tmp,sizeof (tmp));return ret; }
@@ -1027,7 +1027,7 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf, }/* Wipe data just returned from memory */ -memset (tmp,0 ,sizeof (tmp)); +memzero_explicit (tmp,sizeof (tmp));return ret; }
include/linux/string.h +3 -1
@@ -133,7 +133,7 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);#endif extern ssize_t memory_read_from_buffer (void *to,size_t count,loff_t *ppos, -const void *from,size_t available); +const void *from,size_t available);/** * strstarts - does @str start with @prefix?
@@ -144,5 +144,7 @@ static inline bool strstarts(const char *str, const char *prefix) {return strncmp (str, prefix,strlen (prefix)) ==0 ; } + +void memzero_explicit (void *s,size_t count);#endif #endif /* _LINUX_STRING_H_ */
lib/string.c +16 -0
@@ -586,6 +586,22 @@ void *memset(void *s, int c, size_t count)EXPORT_SYMBOL (memset);#endif +/** +* memzero_explicit - Fill a region of memory (e.g. sensitive +* keying data) with 0s. +* @s: Pointer to the start of the area. +* @count: The size of the area. +* +* memzero_explicit() doesn't need an arch-specific version as +* it just invokes the one of memset() implicitly. +*/ +void memzero_explicit (void *s,size_t count) +{ +memset (s,0 , count); +OPTIMIZER_HIDE_VAR (s); +} +EXPORT_SYMBOL (memzero_explicit); +#ifndef __HAVE_ARCH_MEMCPY/** * memcpy - Copy one area of memory to another
Signature · 1 line
1.9.1
PATCH 68/177 ALSA: pcm: use the same dma mmap codepath both for arm and arm64
In reply to [email protected]From: Anatol Pomozov <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit a011e213f3700233ed2a676f1ef0a74a052d7162 upstream.
This avoids following kernel crash when try to playback on arm64
[ 107.497203] [<ffffffc00046b310>] snd_pcm_mmap_data_fault+0x90/0xd4 [ 107.503405] [<ffffffc0001541ac>] __do_fault+0xb0/0x498 [ 107.508565] [<ffffffc0001576a0>] handle_mm_fault+0x224/0x7b0 [ 107.514246] [<ffffffc000092640>] do_page_fault+0x11c/0x310 [ 107.519738] [<ffffffc000081100>] do_mem_abort+0x38/0x98
Tested: backported to 3.14 and tried to playback on arm64 machine
--- sound/core/pcm_native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/pcm_native.c +1 -1
@@ -3171,7 +3171,7 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = {#ifndef ARCH_HAS_DMA_MMAP_COHERENT /* This should be defined / handled globally! */ -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM ) || defined(CONFIG_ARM64 )#define ARCH_HAS_DMA_MMAP_COHERENT #endif #endif
Signature · 1 line
1.9.1
PATCH 68/91 shmem: fix nlink for rename overwrite directory
In reply to [email protected]From: Miklos Szeredi <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit b928095b0a7cff7fb9fcf4c706348ceb8ab2c295 upstream.
If overwriting an empty directory with rename, then need to drop the extra nlink.
Test prog:
#include <stdio.h>
#include <fcntl.h>
#include <err.h>
#include <sys/stat.h>
int main(void)
{
const char *test_dir1 = "test-dir1";
const char *test_dir2 = "test-dir2";
int res;
int fd;
struct stat statbuf;
res = mkdir(test_dir1, 0777);
if (res == -1)
err(1, "mkdir(\"%s\")", test_dir1);
res = mkdir(test_dir2, 0777);
if (res == -1)
err(1, "mkdir(\"%s\")", test_dir2);
fd = open(test_dir2, O_RDONLY);
if (fd == -1)
err(1, "open(\"%s\")", test_dir2);
res = rename(test_dir1, test_dir2);
if (res == -1)
err(1, "rename(\"%s\", \"%s\")", test_dir1, test_dir2);
res = fstat(fd, &statbuf);
if (res == -1)
err(1, "fstat(%i)", fd);
if (statbuf.st_nlink != 0) {
fprintf(stderr, "nlink is %lu, should be 0\n", statbuf.st_nlink);
return 1;
}
return 0;
}--- mm/shmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/shmem.c +3 -1
@@ -1725,8 +1725,10 @@ static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, structif (new_dentry->d_inode) { (void )shmem_unlink (new_dir, new_dentry); -if (they_are_dirs) +if (they_are_dirs) { +drop_nlink (new_dentry->d_inode);drop_nlink (old_dir); + } }else if (they_are_dirs) {drop_nlink (old_dir);inc_nlink (new_dir);
Signature · 1 line
1.9.1
PATCH 69/177 ALSA: usb-audio: Add support for Steinberg UR22 USB interface
In reply to [email protected]From: Vlad Catoi <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit f0b127fbfdc8756eba7437ab668f3169280bd358 upstream.
Adding support for Steinberg UR22 USB interface via quirks table patch
See Ubuntu bug report:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1317244
Also see threads:
http://linux-audio.4202.n7.nabble.com/Support-for-Steinberg-UR22-Yamaha-USB-chipset-0499-1509-tc82888.html#a82917
http://www.steinberg.net/forums/viewtopic.php?t=62290
Tested by at least 4 people judging by the threads.
Did not test MIDI interface, but audio output and capture both are functional. Built 3.17 kernel with this driver on Ubuntu 14.04 & tested with mpg123 Patch applied to 3.13 Ubuntu kernel works well enough for daily use.
--- sound/usb/quirks-table.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
sound/usb/quirks-table.h +30 -0
@@ -301,6 +301,36 @@ YAMAHA_DEVICE(0x105d, NULL), } } }, +{ + USB_DEVICE(0x0499, 0x1509), + .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { +/* .vendor_name = "Yamaha", */ +/* .product_name = "Steinberg UR22", */ + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = (const struct snd_usb_audio_quirk []) { + { + .ifnum =1 , + .type =QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum =2 , + .type =QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum =3 , + .type =QUIRK_MIDI_YAMAHA + }, + { + .ifnum =4 , + .type =QUIRK_IGNORE_INTERFACE + }, + { + .ifnum =-1 + } + } + } +},YAMAHA_DEVICE (0x2000 ,"DGP-7" ),YAMAHA_DEVICE (0x2001 ,"DGP-5" ), YAMAHA_DEVICE(0x2002, NULL),
Signature · 1 line
1.9.1
PATCH 69/91 ARM: 8165/1: alignment: don't break misaligned NEON load/store
In reply to [email protected]From: Robin Murphy <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 5ca918e5e3f9df4634077c06585c42bc6a8d699a upstream.
The alignment fixup incorrectly decodes faulting ARM VLDn/VSTn instructions (where the optional alignment hint is given but incorrect) as LDR/STR, leading to register corruption. Detect these and correctly treat them as unhandled, so that userspace gets the fault it expects.
--- arch/arm/mm/alignment.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mm/alignment.c +3 -0
@@ -39,6 +39,7 @@* This code is not portable to processors with late data abort handling. */ #define CODING_BITS (i) (i & 0x0e000000) +#define COND_BITS (i) (i & 0xf0000000)#define LDST_I_BIT (i) (i & (1 << 26))/* Immediate constant */ #define LDST_P_BIT (i) (i & (1 << 24))/* Preindex */
@@ -813,6 +814,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)break ;case 0x04000000 :/* ldr or str immediate */ +if (COND_BITS (instr) ==0xf0000000 )/* NEON VLDn, VSTn */ + goto bad; offset.un =OFFSET_BITS (instr); handler = do_alignment_ldrstr;break ;
Signature · 1 line
1.9.1
PATCH 70/91 ASoC: core: fix possible ZERO_SIZE_PTR pointer dereferencing error.
In reply to [email protected]From: Xiubo Li <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 6596aa047b624aeec2ea321962cfdecf9953a383 upstream.
Since we cannot make sure the 'params->num_regs' will always be none zero here, and then if it equals to zero, the kmemdup() will return ZERO_SIZE_PTR, which equals to ((void *)16).
So this patch fix this with just doing the zero check before calling kmemdup().
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -2799,7 +2799,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,unsigned int val;void *data; -if (!codec->using_regmap) +if (!codec->using_regmap || !params->num_regs)return -EINVAL ; data = ucontrol->value.bytes.data;
Signature · 1 line
1.9.1
PATCH 70/177 freezer: Do not freeze tasks killed by OOM killer
In reply to [email protected]From: Cong Wang <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 51fae6da640edf9d266c94f36bc806c63c301991 upstream.
Since f660daac474c6f (oom: thaw threads if oom killed thread is frozen before deferring) OOM killer relies on being able to thaw a frozen task to handle OOM situation but a3201227f803 (freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE) has reorganized the code and stopped clearing freeze flag in __thaw_task. This means that the target task only wakes up and goes into the fridge again because the freezing condition hasn't changed for it. This reintroduces the bug fixed by f660daac474c6f.
Fix the issue by checking for TIF_MEMDIE thread flag in freezing_slow_path and exclude the task from freezing completely. If a task was already frozen it would get woken by __thaw_task from OOM killer and get out of freezer after rechecking freezing().
Changes since v1
- put TIF_MEMDIE check into freezing_slowpath rather than in __refrigerator as per Oleg
- return __thaw_task into oom_scan_process_thread because oom_kill_process will not wake task in the fridge because it is sleeping uninterruptible
--- kernel/freezer.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/freezer.c +3 -0
@@ -36,6 +36,9 @@ bool freezing_slow_path(struct task_struct *p)if (p->flags &PF_NOFREEZE )return false; +if (test_thread_flag (TIF_MEMDIE )) +return false; +if (pm_nosig_freezing ||cgroup_freezing (p))return true;
Signature · 1 line
1.9.1
PATCH 71/177 kernel/fork.c:copy_process(): unify CLONE_THREAD-or-thread_group_leader code
In reply to [email protected]From: Oleg Nesterov <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 80628ca06c5d42929de6bc22c0a41589a834d151 upstream.
Cleanup and preparation for the next changes.
Move the "if (clone_flags & CLONE_THREAD)" code down under "if (likely(p->pid))" and turn it into into the "else" branch. This makes the process/thread initialization more symmetrical and removes one check.
--- kernel/fork.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
kernel/fork.c +7 -8
@@ -1412,14 +1412,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, goto bad_fork_free_pid; } -if (clone_flags &CLONE_THREAD ) { - current->signal->nr_threads++; -atomic_inc (¤t->signal->live); -atomic_inc (¤t->signal->sigcnt); - p->group_leader = current->group_leader; -list_add_tail_rcu (&p->thread_group, &p->group_leader->thread_group); - } -if (likely (p->pid)) {ptrace_init_task (p, (clone_flags &CLONE_PTRACE ) || trace);
@@ -1434,6 +1426,13 @@ static struct task_struct *copy_process(unsigned long clone_flags,list_add_tail (&p->sibling, &p->real_parent->children);list_add_tail_rcu (&p->tasks, &init_task.tasks);__this_cpu_inc (process_counts); + }else { + current->signal->nr_threads++; +atomic_inc (¤t->signal->live); +atomic_inc (¤t->signal->sigcnt); + p->group_leader = current->group_leader; +list_add_tail_rcu (&p->thread_group, + &p->group_leader->thread_group); }attach_pid (p,PIDTYPE_PID , pid); nr_threads++;
Signature · 1 line
1.9.1
PATCH 71/91 mm: migrate: Close race between migration completion and mprotect
In reply to [email protected]From: Mel Gorman <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit d3cb8bf6081b8b7a2dabb1264fe968fd870fa595 upstream.
A migration entry is marked as write if pte_write was true at the time the entry was created. The VMA protections are not double checked when migration entries are being removed as mprotect marks write-migration-entries as read. It means that potentially we take a spurious fault to mark PTEs write again but it's straight-forward. However, there is a race between write migrations being marked read and migrations finishing. This potentially allows a PTE to be write that should have been read. Close this race by double checking the VMA permissions using maybe_mkwrite when migration completes.
--- mm/migrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/migrate.c +4 -1
@@ -139,8 +139,11 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,get_page (new); pte =pte_mkold (mk_pte (new, vma->vm_page_prot)); + +/* Recheck VMA as permissions can change since migration started */ if (is_write_migration_entry (entry)) - pte =pte_mkwrite (pte); + pte =maybe_mkwrite (pte, vma); +#ifdef CONFIG_HUGETLB_PAGE if (PageHuge (new)) pte =pte_mkhuge (pte);
Signature · 1 line
1.9.1
PATCH 72/177 introduce for_each_thread() to replace the buggy while_each_thread()
In reply to [email protected]From: Oleg Nesterov <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 0c740d0afc3bff0a097ad03a1c8df92757516f5c upstream.
while_each_thread() and next_thread() should die, almost every lockless usage is wrong.
1. Unless g == current, the lockless while_each_thread() is not safe.
while_each_thread(g, t) can loop forever if g exits, next_thread() can't reach the unhashed thread in this case. Note that this can happen even if g is the group leader, it can exec.
2. Even if while_each_thread() itself was correct, people often use it wrongly.
It was never safe to just take rcu_read_lock() and loop unless you verify that pid_alive(g) == T, even the first next_thread() can point to the already freed/reused memory.
This patch adds signal_struct->thread_head and task->thread_node to create the normal rcu-safe list with the stable head. The new for_each_thread(g, t) helper is always safe under rcu_read_lock() as long as this task_struct can't go away.
Note: of course it is ugly to have both task_struct->thread_node and the old task_struct->thread_group, we will kill it later, after we change the users of while_each_thread() to use for_each_thread().
Perhaps we can kill it even before we convert all users, we can reimplement next_thread(t) using the new thread_head/thread_node. But we can't do this right now because this will lead to subtle behavioural changes. For example, do/while_each_thread() always sees at least one task, while for_each_thread() can do nothing if the whole thread group has died. Or thread_group_empty(), currently its semantics is not clear unless thread_group_leader(p) and we need to audit the callers before we can change it.
So this patch adds the new interface which has to coexist with the old one for some time, hopefully the next changes will be more or less straightforward and the old one will go away soon.
--- include/linux/init_task.h | 2 ++ include/linux/sched.h | 12 ++++++++++++ kernel/exit.c | 1 + kernel/fork.c | 7 +++++++ 4 files changed, 22 insertions(+)
include/linux/init_task.h +2 -0
@@ -38,6 +38,7 @@ extern struct fs_struct init_fs;#define INIT_SIGNALS (sig) { \ .nr_threads = 1, \ + .thread_head = LIST_HEAD_INIT(init_task.thread_node), \ .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ .shared_pending = { \ .list = LIST_HEAD_INIT(sig.shared_pending.list), \
@@ -202,6 +203,7 @@ extern struct task_group root_task_group; [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ }, \ .thread_group =LIST_HEAD_INIT (tsk.thread_group), \ + .thread_node = LIST_HEAD_INIT(init_signals.thread_head), \ INIT_IDS \ INIT_PERF_EVENTS(tsk) \INIT_TRACE_IRQFLAGS \
include/linux/sched.h +12 -0
@@ -534,6 +534,7 @@ struct signal_struct {atomic_t sigcnt;atomic_t live;int nr_threads; +struct list_head thread_head;wait_queue_head_t wait_chldexit;/* for wait4() */
@@ -1394,6 +1395,7 @@ struct task_struct {/* PID/PID hash table linkage. */ struct pid_link pids[PIDTYPE_MAX ];struct list_head thread_group; +struct list_head thread_node;struct completion *vfork_done;/* for vfork() */ int __user *set_child_tid;/* CLONE_CHILD_SETTID */
@@ -2397,6 +2399,16 @@ extern bool current_is_single_threaded(void);#define while_each_thread (g, t) \ while ((t = next_thread(t)) != g) +#define __for_each_thread (signal, t) \ + list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node) + +#define for_each_thread (p, t) \ + __for_each_thread((p)->signal, t) + +/* Careful: this is a double loop, 'break' won't work as expected. */ +#define for_each_process_thread (p, t) \ + for_each_process(p) for_each_thread(p, t) +static inline int get_nr_threads (struct task_struct *tsk) {return tsk->signal->nr_threads;
kernel/exit.c +1 -0
@@ -74,6 +74,7 @@ static void __unhash_process(struct task_struct *p, bool group_dead)__this_cpu_dec (process_counts); }list_del_rcu (&p->thread_group); +list_del_rcu (&p->thread_node); }/*
kernel/fork.c +7 -0
@@ -1026,6 +1026,11 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) sig->nr_threads =1 ;atomic_set (&sig->live,1 );atomic_set (&sig->sigcnt,1 ); + +/* list_add(thread_node, thread_head) without INIT_LIST_HEAD() */ + sig->thread_head = (struct list_head )LIST_HEAD_INIT (tsk->thread_node); + tsk->thread_node = (struct list_head )LIST_HEAD_INIT (sig->thread_head); +init_waitqueue_head (&sig->wait_chldexit);if (clone_flags &CLONE_NEWPID ) sig->flags |=SIGNAL_UNKILLABLE ;
@@ -1433,6 +1438,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, p->group_leader = current->group_leader;list_add_tail_rcu (&p->thread_group, &p->group_leader->thread_group); +list_add_tail_rcu (&p->thread_node, + &p->signal->thread_head); }attach_pid (p,PIDTYPE_PID , pid); nr_threads++;
Signature · 1 line
1.9.1
PATCH 72/91 perf: fix perf bug in fork()
In reply to [email protected]From: Peter Zijlstra <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 6c72e3501d0d62fc064d3680e5234f3463ec5a86 upstream.
Oleg noticed that a cleanup by Sylvain actually uncovered a bug; by calling perf_event_free_task() when failing sched_fork() we will not yet have done the memset() on ->perf_event_ctxp[] and will therefore try and 'free' the inherited contexts, which are still in use by the parent process. This is bad..
--- kernel/events/core.c | 4 +++- kernel/fork.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)
kernel/events/core.c +3 -1
@@ -7127,8 +7127,10 @@ int perf_event_init_task(struct task_struct *child)for_each_task_context_nr (ctxn) { ret =perf_event_init_context (child, ctxn); -if (ret) +if (ret) { +perf_event_free_task (child);return ret; + } }return 0 ;
kernel/fork.c +3 -2
@@ -1285,7 +1285,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, goto bad_fork_cleanup_policy; retval =audit_alloc (p);if (retval) - goto bad_fork_cleanup_policy; + goto bad_fork_cleanup_perf;/* copy all the process information */ retval =copy_semundo (clone_flags, p);if (retval)
@@ -1480,8 +1480,9 @@ bad_fork_cleanup_semundo:exit_sem (p); bad_fork_cleanup_audit:audit_free (p); -bad_fork_cleanup_policy: +bad_fork_cleanup_perf:perf_event_free_task (p); +bad_fork_cleanup_policy:#ifdef CONFIG_NUMA mpol_put (p->mempolicy); bad_fork_cleanup_cgroup:
Signature · 1 line
1.9.1
PATCH 73/177 OOM, PM: OOM killed task shouldn't escape PM suspend
In reply to [email protected]From: Michal Hocko <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 5695be142e203167e3cb515ef86a88424f3524eb upstream.
PM freezer relies on having all tasks frozen by the time devices are getting frozen so that no task will touch them while they are getting frozen. But OOM killer is allowed to kill an already frozen task in order to handle OOM situtation. In order to protect from late wake ups OOM killer is disabled after all tasks are frozen. This, however, still keeps a window open when a killed task didn't manage to die by the time freeze_processes finishes.
Reduce the race window by checking all tasks after OOM killer has been disabled. This is still not race free completely unfortunately because oom_killer_disable cannot stop an already ongoing OOM killer so a task might still wake up from the fridge and get killed without freeze_processes noticing. Full synchronization of OOM and freezer is, however, too heavy weight for this highly unlikely case.
Introduce and check oom_kills counter which gets incremented early when the allocator enters __alloc_pages_may_oom path and only check all the tasks if the counter changes during the freezing attempt. The counter is updated so early to reduce the race window since allocator checked oom_killer_disabled which is set by PM-freezing code. A false positive will push the PM-freezer into a slow path but that is not a big deal.
Changes since v1
- push the re-check loop out of freeze_processes into check_frozen_processes and invert the condition to make the code more readable as per Rafael
--- include/linux/oom.h | 4 ++++ kernel/power/process.c | 40 +++++++++++++++++++++++++++++++++++++++- mm/oom_kill.c | 17 +++++++++++++++++ mm/page_alloc.c | 8 ++++++++ 4 files changed, 68 insertions(+), 1 deletion(-)
include/linux/oom.h +4 -0
@@ -45,6 +45,10 @@ extern int test_set_oom_score_adj(int new_val);extern unsigned int oom_badness (struct task_struct *p,struct mem_cgroup *memcg,const nodemask_t *nodemask,unsigned long totalpages); + +extern int oom_kills_count (void ); +extern void note_oom_kill (void ); +extern int try_set_zonelist_oom (struct zonelist *zonelist,gfp_t gfp_flags);extern void clear_zonelist_oom (struct zonelist *zonelist,gfp_t gfp_flags);
kernel/power/process.c +39 -1
@@ -114,6 +114,28 @@ static int try_to_freeze_tasks(bool user_only)return todo ? -EBUSY :0 ; } +/* +* Returns true if all freezable tasks (except for current) are frozen already +*/ +static bool check_frozen_processes (void ) +{ +struct task_struct *g, *p; +bool ret = true; + +read_lock (&tasklist_lock); +for_each_process_thread (g, p) { +if (p != current && !freezer_should_skip (p) && + !frozen (p)) { + ret = false; + goto done; + } + } +done: +read_unlock (&tasklist_lock); + +return ret; +} +/** * freeze_processes - Signal user space processes to enter the refrigerator. *
@@ -122,6 +144,7 @@ static int try_to_freeze_tasks(bool user_only)int freeze_processes (void ) {int error; +int oom_kills_saved; error =__usermodehelper_disable (UMH_FREEZING );if (error)
@@ -132,12 +155,27 @@ int freeze_processes(void)printk ("Freezing user space processes ... " ); pm_freezing = true; + oom_kills_saved =oom_kills_count (); error =try_to_freeze_tasks (true);if (!error) { -printk ("done." );__usermodehelper_set_disable_depth (UMH_DISABLED );oom_killer_disable (); + +/* +* There might have been an OOM kill while we were +* freezing tasks and the killed task might be still +* on the way out so we have to double check for race. +*/ +if (oom_kills_count () != oom_kills_saved && + !check_frozen_processes ()) { +__usermodehelper_set_disable_depth (UMH_ENABLED ); +printk ("OOM in progress." ); + error = -EBUSY ; + goto done; + } +printk ("done." ); } +done:printk ("\n" );BUG_ON (in_atomic ());
mm/oom_kill.c +17 -0
@@ -435,6 +435,23 @@ static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order,dump_tasks (memcg, nodemask); } +/* +* Number of OOM killer invocations (including memcg OOM killer). +* Primarily used by PM freezer to check for potential races with +* OOM killed frozen task. +*/ +static atomic_t oom_kills =ATOMIC_INIT (0 ); + +int oom_kills_count (void ) +{ +return atomic_read (&oom_kills); +} + +void note_oom_kill (void ) +{ +atomic_inc (&oom_kills); +} +#define K (x) ((x) << (PAGE_SHIFT-10)) static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, unsigned int points, unsigned long totalpages,
mm/page_alloc.c +8 -0
@@ -1982,6 +1982,14 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, }/* +* PM-freezer should be notified that there might be an OOM killer on +* its way to kill and wake somebody up. This is too early and we might +* end up not killing anything but false positives are acceptable. +* See freeze_processes. +*/ +note_oom_kill (); + +/* * Go through the zonelist yet one more time, keep very high watermark * here, this is only to catch a parallel oom killing, we must fail if * we're still under heavy pressure.
Signature · 1 line
1.9.1
PATCH 73/91 init/Kconfig: Hide printk log config if CONFIG_PRINTK=n
In reply to [email protected]From: Josh Triplett <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 361e9dfbaae84b0b246ed18d1ab7c82a1a41b53e upstream.
The buffers sized by CONFIG_LOG_BUF_SHIFT and CONFIG_LOG_CPU_MAX_BUF_SHIFT do not exist if CONFIG_PRINTK=n, so don't ask about their size at all.
[lizf: Backported to 3.4:
- drop the change to CONFIG_LOG_CPU_MAX_BUF_SHIFT as it doesn't exist in 3.4]
--- init/Kconfig | 1 + 1 file changed, 1 insertion(+)
init/Kconfig +1 -0
@@ -560,6 +560,7 @@ config LOG_BUF_SHIFT int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" range 12 21 default 17 + depends on PRINTK help Select kernel log buffer size as a power of 2. Examples:
Signature · 1 line
1.9.1
PATCH 74/177 MIPS: tlbex: Fix a missing statement for HUGETLB
In reply to [email protected]From: Huacai Chen <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 8393c524a25609a30129e4a8975cf3b91f6c16a5 upstream.
In commit 2c8c53e28f1 (MIPS: Optimize TLB handlers for Octeon CPUs) build_r4000_tlb_refill_handler() is modified. But it doesn't compatible with the original code in HUGETLB case. Because there is a copy & paste error and one line of code is missing. It is very easy to produce a bug with LTP's hugemmap05 test.
Patchwork: https://patchwork.linux-mips.org/patch/7496/
--- arch/mips/mm/tlbex.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/mm/tlbex.c +1 -0
@@ -1283,6 +1283,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void) }#ifdef CONFIG_HUGETLB_PAGE uasm_l_tlb_huge_update (&l, p); +UASM_i_LW (&p,K0 ,0 ,K1 );build_huge_update_entries (&p, htlb_info.huge_pte,K1 );build_huge_tlb_write_entry (&p, &l, &r,K0 , tlb_random, htlb_info.restore_scratch);
Signature · 1 line
1.9.1
PATCH 74/91 genhd: fix leftover might_sleep() in blk_free_devt()
In reply to [email protected]From: Jens Axboe <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 46f341ffcfb5d8530f7d1e60f3be06cce6661b62 upstream.
Commit 2da78092 changed the locking from a mutex to a spinlock, so we now longer sleep in this context. But there was a leftover might_sleep() in there, which now triggers since we do the final free from an RCU callback. Get rid of it.
--- block/genhd.c | 2 -- 1 file changed, 2 deletions(-)
block/genhd.c +0 -2
@@ -447,8 +447,6 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt)*/ void blk_free_devt (dev_t devt) { -might_sleep (); -if (devt ==MKDEV (0 ,0 ))return ;
Signature · 1 line
1.9.1
PATCH 75/177 MIPS: tlbex: Properly fix HUGE TLB Refill exception handler
In reply to [email protected]From: David Daney <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 9e0f162a36914937a937358fcb45e0609ef2bfc4 upstream.
In commit 8393c524a25609 (MIPS: tlbex: Fix a missing statement for HUGETLB), the TLB Refill handler was fixed so that non-OCTEON targets would work properly with huge pages. The change was incorrect in that it broke the OCTEON case.
The problem is shown here:
xxx0: df7a0000 ld k0,0(k1)
.
.
.
xxxc0: df610000 ld at,0(k1)
xxxc4: 335a0ff0 andi k0,k0,0xff0
xxxc8: e825ffcd bbit1 at,0x5,0x0
xxxcc: 003ad82d daddu k1,at,k0
.
.
.In the non-octeon case there is a destructive test for the huge PTE bit, and then at 0, $k0 is reloaded (that is what the 8393c524a25609 patch added).
In the octeon case, we modify k1 in the branch delay slot, but we never need k0 again, so the new load is not needed, but since k1 is modified, if we do the load, we load from a garbage location and then get a nested TLB Refill, which is seen in userspace as either SIGBUS or SIGSEGV (depending on the garbage).
The real fix is to only do this reloading if it is needed, and never where it is harmful.
Patchwork: https://patchwork.linux-mips.org/patch/8151/
--- arch/mips/mm/tlbex.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/mm/tlbex.c +5 -1
@@ -1041,6 +1041,7 @@ static void __cpuinit build_update_entries(u32 **p, unsigned int tmp,struct mips_huge_tlb_info {int huge_pte;int restore_scratch; +bool need_reload_pte; }; static struct mips_huge_tlb_info __cpuinit
@@ -1055,6 +1056,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, rv.huge_pte = scratch; rv.restore_scratch =0 ; + rv.need_reload_pte = false;if (check_for_high_segbits) {UASM_i_MFC0 (p, tmp,C0_BADVADDR );
@@ -1247,6 +1249,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void) }else { htlb_info.huge_pte =K0 ; htlb_info.restore_scratch =0 ; + htlb_info.need_reload_pte = true; vmalloc_mode = refill_noscratch;/* * create the plain linear handler
@@ -1283,7 +1286,8 @@ static void __cpuinit build_r4000_tlb_refill_handler(void) }#ifdef CONFIG_HUGETLB_PAGE uasm_l_tlb_huge_update (&l, p); -UASM_i_LW (&p,K0 ,0 ,K1 ); +if (htlb_info.need_reload_pte) +UASM_i_LW (&p, htlb_info.huge_pte,0 ,K1 );build_huge_update_entries (&p, htlb_info.huge_pte,K1 );build_huge_tlb_write_entry (&p, &l, &r,K0 , tlb_random, htlb_info.restore_scratch);
Signature · 1 line
1.9.1
PATCH 75/91 nl80211: clear skb cb before passing to netlink
In reply to [email protected]From: Johannes Berg <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit bd8c78e78d5011d8111bc2533ee73b13a3bd6c42 upstream.
In testmode and vendor command reply/event SKBs we use the skb cb data to store nl80211 parameters between allocation and sending. This causes the code for CONFIG_NETLINK_MMAP to get confused, because it takes ownership of the skb cb data when the SKB is handed off to netlink, and it doesn't explicitly clear it.
Clear the skb cb explicitly when we're done and before it gets passed to netlink to avoid this issue.
--- net/wireless/nl80211.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/wireless/nl80211.c +6 -0
@@ -5059,6 +5059,9 @@ int cfg80211_testmode_reply(struct sk_buff *skb)void *hdr = ((void **)skb->cb)[1 ];struct nlattr *data = ((void **)skb->cb)[2 ]; +/* clear CB data for netlink core to own from now on */ +memset (skb->cb,0 ,sizeof (skb->cb)); +if (WARN_ON (!rdev->testmode_info)) {kfree_skb (skb);return -EINVAL ;
@@ -5085,6 +5088,9 @@ void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)void *hdr = ((void **)skb->cb)[1 ];struct nlattr *data = ((void **)skb->cb)[2 ]; +/* clear CB data for netlink core to own from now on */ +memset (skb->cb,0 ,sizeof (skb->cb)); +nla_nest_end (skb, data);genlmsg_end (skb, hdr); genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), skb, 0,
Signature · 1 line
1.9.1
PATCH 76/177 cpufreq: expose scaling_cur_freq sysfs file for set_policy() drivers
In reply to [email protected]From: Dirk Brandewie <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit c034b02e213d271b98c45c4a7b54af8f69aaac1e upstream.
Currently the core does not expose scaling_cur_freq for set_policy() drivers this breaks some userspace monitoring tools.
Change the core to expose this file for all drivers and if the set_policy() driver supports the get() callback use it to retrieve the current frequency.
--- drivers/cpufreq/cpufreq.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/cpufreq/cpufreq.c +17 -6
@@ -371,7 +371,18 @@ show_one(cpuinfo_max_freq, cpuinfo.max_freq);show_one (cpuinfo_transition_latency, cpuinfo.transition_latency);show_one (scaling_min_freq, min);show_one (scaling_max_freq, max); -show_one (scaling_cur_freq, cur); + +static ssize_t show_scaling_cur_freq ( +struct cpufreq_policy *policy,char *buf) +{ +ssize_t ret; + +if (cpufreq_driver && cpufreq_driver->setpolicy && cpufreq_driver->get) + ret =sprintf (buf,"%u\n" , cpufreq_driver->get (policy->cpu)); +else + ret =sprintf (buf,"%u\n" , policy->cur); +return ret; +}static int __cpufreq_set_policy (struct cpufreq_policy *data,struct cpufreq_policy *policy);
@@ -818,11 +829,11 @@ static int cpufreq_add_dev_interface(unsigned int cpu,if (ret) goto err_out_kobj_put; } -if (cpufreq_driver->target) { - ret =sysfs_create_file (&policy->kobj, &scaling_cur_freq.attr); -if (ret) - goto err_out_kobj_put; - } + + ret =sysfs_create_file (&policy->kobj, &scaling_cur_freq.attr); +if (ret) + goto err_out_kobj_put; +if (cpufreq_driver->bios_limit) { ret =sysfs_create_file (&policy->kobj, &bios_limit.attr);if (ret)
Signature · 1 line
1.9.1
PATCH 76/91 ext4: propagate errors up to ext4_find_entry()'s callers
In reply to [email protected]From: Theodore Ts'o <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 36de928641ee48b2078d3fe9514242aaa2f92013 upstream.
If we run into some kind of error, such as ENOMEM, while calling ext4_getblk() or ext4_dx_find_entry(), we need to make sure this error gets propagated up to ext4_find_entry() and then to its callers. This way, transient errors such as ENOMEM can get propagated to the VFS. This is important so that the system calls return the appropriate error, and also so that in the case of ext4_lookup(), we return an error instead of a NULL inode, since that will result in a negative dentry cache entry that will stick around long past the OOM condition which caused a transient ENOMEM error.
Google-Bug-Id: #17142205
[lizf: Backported to 3.4:
- adjust context
- s/old.bh/old_bh/g
- s/new.bh/new_bh/g
- drop the changes to ext4_find_delete_entry() and ext4_cross_rename()
- add return value check for one more exr4_find_entry() in ext4_rename()]
--- fs/ext4/ext4.h | 2 +- fs/ext4/namei.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-)
fs/ext4/ext4.h +1 -1
@@ -1674,7 +1674,7 @@ ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)/* * Special error return code only used by dx_probe() and its callers. */ -#define ERR_BAD_DX_DIR -75000 +#define ERR_BAD_DX_DIR (-(MAX_ERRNO - 1))void ext4_get_group_no_and_offset (struct super_block *sb,ext4_fsblk_t blocknr,ext4_group_t *blockgrpp,ext4_grpblk_t *offsetp);
fs/ext4/namei.c +28 -3
@@ -861,7 +861,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,buffer */ int num =0 ;ext4_lblk_t nblocks; -int i, err; +int i, err =0 ;int namelen; *res_dir =NULL ;
@@ -886,7 +886,11 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,* return. Otherwise, fall back to doing a search the * old fashioned way. */ -if (bh || (err !=ERR_BAD_DX_DIR )) +if (err == -ENOENT ) +return NULL ; +if (err && err !=ERR_BAD_DX_DIR ) +return ERR_PTR (err); +if (bh)return bh;dxtrace (printk (KERN_DEBUG "ext4_find_entry: dx failed, " "falling back\n" ));
@@ -917,6 +921,11 @@ restart: } num++; bh =ext4_getblk (NULL , dir, b++,0 , &err); +if (unlikely (err)) { +if (ra_max ==0 ) +return ERR_PTR (err); +break ; + } bh_use[ra_max] = bh;if (bh) ll_rw_block(READ | REQ_META | REQ_PRIO,
@@ -1026,6 +1035,8 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, strureturn ERR_PTR (-ENAMETOOLONG ); bh =ext4_find_entry (dir, &dentry->d_name, &de); +if (IS_ERR (bh)) +return (struct dentry *) bh; inode =NULL ;if (bh) {__u32 ino =le32_to_cpu (de->inode);
@@ -1063,6 +1074,8 @@ struct dentry *ext4_get_parent(struct dentry *child)struct buffer_head *bh; bh =ext4_find_entry (child->d_inode, &dotdot, &de); +if (IS_ERR (bh)) +return (struct dentry *) bh;if (!bh)return ERR_PTR (-ENOENT ); ino =le32_to_cpu (de->inode);
@@ -2137,6 +2150,8 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) retval = -ENOENT ; bh =ext4_find_entry (dir, &dentry->d_name, &de); +if (IS_ERR (bh)) +return PTR_ERR (bh);if (!bh) goto end_rmdir;
@@ -2202,6 +2217,8 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) retval = -ENOENT ; bh =ext4_find_entry (dir, &dentry->d_name, &de); +if (IS_ERR (bh)) +return PTR_ERR (bh);if (!bh) goto end_unlink;
@@ -2418,6 +2435,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,ext4_handle_sync (handle); old_bh =ext4_find_entry (old_dir, &old_dentry->d_name, &old_de); +if (IS_ERR (old_bh)) +return PTR_ERR (old_bh);/* * Check for inode number is _not_ due to possible IO errors. * We might rmdir the source, keep it as pwd of some process
@@ -2431,6 +2450,10 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, new_inode = new_dentry->d_inode; new_bh =ext4_find_entry (new_dir, &new_dentry->d_name, &new_de); +if (IS_ERR (new_bh)) { + retval =PTR_ERR (new_bh); + goto end_rename; + }if (new_bh) {if (!new_inode) {brelse (new_bh);
@@ -2509,7 +2532,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,struct ext4_dir_entry_2 *old_de2; old_bh2 =ext4_find_entry (old_dir, &old_dentry->d_name, &old_de2); -if (old_bh2) { +if (IS_ERR (old_bh2)) { + retval =PTR_ERR (old_bh2); + }else if (old_bh2) { retval =ext4_delete_entry (handle, old_dir, old_de2, old_bh2);brelse (old_bh2);
Signature · 1 line
1.9.1
PATCH 77/177 KVM: x86: Check non-canonical addresses upon WRMSR
In reply to [email protected]From: Nadav Amit <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 854e8bb1aa06c578c2c9145fa6bfe3680ef63b23 upstream.
Upon WRMSR, the CPU should inject #GP if a non-canonical value (address) is written to certain MSRs. The behavior is "almost" identical for AMD and Intel (ignoring MSRs that are not implemented in either architecture since they would anyhow #GP). However, IA32_SYSENTER_ESP and IA32_SYSENTER_EIP cause #GP if non-canonical address is written on Intel but not on AMD (which ignores the top 32-bits).
Accordingly, this patch injects a #GP on the MSRs which behave identically on Intel and AMD. To eliminate the differences between the architecutres, the value which is written to IA32_SYSENTER_ESP and IA32_SYSENTER_EIP is turned to canonical value before writing instead of injecting a #GP.
Some references from Intel and AMD manuals:
According to Intel SDM description of WRMSR instruction #GP is expected on WRMSR "If the source register contains a non-canonical address and ECX specifies one of the following MSRs: IA32_DS_AREA, IA32_FS_BASE, IA32_GS_BASE, IA32_KERNEL_GS_BASE, IA32_LSTAR, IA32_SYSENTER_EIP, IA32_SYSENTER_ESP."
According to AMD manual instruction manual:
LSTAR/CSTAR (SYSCALL): "The WRMSR instruction loads the target RIP into the LSTAR and CSTAR registers. If an RIP written by WRMSR is not in canonical form, a general-protection exception (#GP) occurs."IA32_GS_BASE and IA32_FS_BASE (WRFSBASE/WRGSBASE): "The address written to the base field must be in canonical form or a #GP fault will occur." IA32_KERNEL_GS_BASE (SWAPGS): "The address stored in the KernelGSbase MSR must be in canonical form."
This patch fixes CVE-2014-3610.
[lizf: Backported to 3.4:
- adjust context
- s/msr->index/msr_index and s/msr->data/data]
--- arch/x86/include/asm/kvm_host.h | 14 ++++++++++++++ arch/x86/kvm/svm.c | 2 +- arch/x86/kvm/vmx.c | 2 +- arch/x86/kvm/x86.c | 27 ++++++++++++++++++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-)
arch/x86/include/asm/kvm_host.h +14 -0
@@ -882,6 +882,20 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code)kvm_queue_exception_e (vcpu,GP_VECTOR , error_code); } +static inline u64 get_canonical (u64 la) +{ +return ((int64_t )la <<16 ) >>16 ; +} + +static inline bool is_noncanonical_address (u64 la) +{ +#ifdef CONFIG_X86_64 +return get_canonical (la) != la; +#else +return false; +#endif +} +#define TSS_IOPB_BASE_OFFSET 0x66#define TSS_BASE_SIZE 0x68#define TSS_IOPB_SIZE (65536 / 8)
arch/x86/kvm/svm.c +1 -1
@@ -3212,7 +3212,7 @@ static int wrmsr_interception(struct vcpu_svm *svm) svm->next_rip =kvm_rip_read (&svm->vcpu) +2 ; -if (svm_set_msr (&svm->vcpu, ecx, data)) { +if (kvm_set_msr (&svm->vcpu, ecx, data)) {trace_kvm_msr_write_ex (ecx, data);kvm_inject_gp (&svm->vcpu,0 ); }else {
arch/x86/kvm/vmx.c +1 -1
@@ -4545,7 +4545,7 @@ static int handle_wrmsr(struct kvm_vcpu *vcpu)u64 data = (vcpu->arch.regs[VCPU_REGS_RAX ] &-1u ) | ((u64)(vcpu->arch.regs[VCPU_REGS_RDX ] &-1u ) <<32 ); -if (vmx_set_msr (vcpu, ecx, data) !=0 ) { +if (kvm_set_msr (vcpu, ecx, data) !=0 ) {trace_kvm_msr_write_ex (ecx, data);kvm_inject_gp (vcpu,0 );return 1 ;
arch/x86/kvm/x86.c +26 -1
@@ -858,7 +858,6 @@ void kvm_enable_efer_bits(u64 mask) }EXPORT_SYMBOL_GPL (kvm_enable_efer_bits); -/* * Writes msr value into into the appropriate "register". * Returns 0 on success, non-0 otherwise.
@@ -866,8 +865,34 @@ EXPORT_SYMBOL_GPL(kvm_enable_efer_bits);*/ int kvm_set_msr (struct kvm_vcpu *vcpu,u32 msr_index,u64 data) { +switch (msr_index) { +case MSR_FS_BASE : +case MSR_GS_BASE : +case MSR_KERNEL_GS_BASE : +case MSR_CSTAR : +case MSR_LSTAR : +if (is_noncanonical_address (data)) +return 1 ; +break ; +case MSR_IA32_SYSENTER_EIP : +case MSR_IA32_SYSENTER_ESP : +/* +* IA32_SYSENTER_ESP and IA32_SYSENTER_EIP cause #GP if +* non-canonical address is written on Intel but not on +* AMD (which ignores the top 32-bits, because it does +* not implement 64-bit SYSENTER). +* +* 64-bit code should hence be able to write a non-canonical +* value on AMD. Making the address canonical ensures that +* vmentry does not fail on Intel after writing a non-canonical +* value, and that something deterministic happens if the guest +* invokes 64-bit SYSENTER. +*/ + data =get_canonical (data); + }return kvm_x86_ops->set_msr (vcpu, msr_index, data); } +EXPORT_SYMBOL_GPL (kvm_set_msr);/* * Adapt set_msr() to msr_io()'s calling convention
Signature · 1 line
1.9.1
PATCH 77/91 ext4: avoid trying to kfree an ERR_PTR pointer
In reply to [email protected]From: Theodore Ts'o <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit a9cfcd63e8d206ce4235c355d857c4fbdf0f4587 upstream.
Thanks to Dan Carpenter for extending smatch to find bugs like this. (This was found using a development version of smatch.)
[lizf: Backported to 3.4:
- s/new.bh/new_bh/
- drop the change to ext4_cross_rename()]
--- fs/ext4/namei.c | 1 + fs/ext4/resize.c | 2 ++ 2 files changed, 3 insertions(+)
fs/ext4/namei.c +1 -0
@@ -2452,6 +2452,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, new_bh =ext4_find_entry (new_dir, &new_dentry->d_name, &new_de);if (IS_ERR (new_bh)) { retval =PTR_ERR (new_bh); + new_bh =NULL ; goto end_rename; }if (new_bh) {
fs/ext4/resize.c +2 -0
@@ -528,6 +528,7 @@ handle_bb: bh =bclean (handle, sb, block);if (IS_ERR (bh)) { err =PTR_ERR (bh); + bh =NULL ; goto out; }if (ext4_bg_has_super (sb, group)) {
@@ -556,6 +557,7 @@ handle_ib: bh =bclean (handle, sb, block);if (IS_ERR (bh)) { err =PTR_ERR (bh); + bh =NULL ; goto out; }
Signature · 1 line
1.9.1
PATCH 78/177 KVM: x86: Prevent host from panicking on shared MSR writes.
In reply to [email protected]From: Andy Honig <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 8b3c3104c3f4f706e99365c3e0d2aa61b95f969f upstream.
The previous patch blocked invalid writes directly when the MSR is written. As a precaution, prevent future similar mistakes by gracefulling handle GPs caused by writes to shared MSRs.
[lizf: Backported to 3.4:
- adjust context
- s/wrmsrl_safe/checking_wrmsrl/]
--- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx.c | 7 +++++-- arch/x86/kvm/x86.c | 11 ++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -954,7 +954,7 @@ int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);int kvm_cpu_get_interrupt (struct kvm_vcpu *v);void kvm_define_shared_msr (unsigned index,u32 msr); -void kvm_set_shared_msr (unsigned index,u64 val,u64 mask); +int kvm_set_shared_msr (unsigned index,u64 val,u64 mask);bool kvm_is_linear_rip (struct kvm_vcpu *vcpu,unsigned long linear_rip);
arch/x86/kvm/vmx.c +5 -2
@@ -2210,12 +2210,15 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)break ; msr =find_msr_entry (vmx, msr_index);if (msr) { +u64 old_msr_data = msr->data; msr->data = data;if (msr - vmx->guest_msrs < vmx->save_nmsrs) {preempt_disable (); -kvm_set_shared_msr (msr->index, msr->data, - msr->mask); + ret =kvm_set_shared_msr (msr->index, msr->data, + msr->mask);preempt_enable (); +if (ret) + msr->data = old_msr_data; }break ; }
arch/x86/kvm/x86.c +8 -3
@@ -220,19 +220,24 @@ static void kvm_shared_msr_cpu_online(void)shared_msr_update (i, shared_msrs_global.msrs[i]); } -void kvm_set_shared_msr (unsigned slot,u64 value,u64 mask) +int kvm_set_shared_msr (unsigned slot,u64 value,u64 mask) {struct kvm_shared_msrs *smsr = &__get_cpu_var (shared_msrs); +int err;if (((value ^ smsr->values[slot].curr) & mask) ==0 ) -return ; +return 0 ; smsr->values[slot].curr = value; -wrmsrl (shared_msrs_global.msrs[slot], value); + err =checking_wrmsrl (shared_msrs_global.msrs[slot], value); +if (err) +return 1 ; +if (!smsr->registered) { smsr->urn.on_user_return = kvm_on_user_return;user_return_notifier_register (&smsr->urn); smsr->registered = true; } +return 0 ; }EXPORT_SYMBOL_GPL (kvm_set_shared_msr);
Signature · 1 line
1.9.1
PATCH 78/91 NFS: fix stable regression
In reply to [email protected]From: Sergio Gelato <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
Fix regression introduced in pre-3.14 kernels by cherry-picking aa07c713ecfc0522916f3cd57ac628ea6127c0ec
(NFSD: Call ->set_acl with a NULL ACL structure if no entries).
The affected code was removed in 3.14 by commit 4ac7249ea5a0ceef9f8269f63f33cc873c3fac61
(nfsd: use get_acl and ->set_acl).
The ->set_acl methods are already able to cope with a NULL argument.
--- fs/nfsd/vfs.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfsd/vfs.c +3 -0
@@ -508,6 +508,9 @@ set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key)char *buf =NULL ;int error =0 ; +if (!pacl) +return vfs_setxattr (dentry, key,NULL ,0 ,0 ); + buflen =posix_acl_xattr_size (pacl->a_count); buf =kmalloc (buflen,GFP_KERNEL ); error = -ENOMEM ;
Signature · 1 line
1.9.1
PATCH 79/177 KVM: x86: Improve thread safety in pit
In reply to [email protected]From: Andy Honig <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 2febc839133280d5a5e8e1179c94ea674489dae2 upstream.
There's a race condition in the PIT emulation code in KVM. In __kvm_migrate_pit_timer the pit_timer object is accessed without synchronization. If the race condition occurs at the wrong time this can crash the host kernel.
This fixes CVE-2014-3611.
--- arch/x86/kvm/i8254.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/i8254.c +2 -0
@@ -263,8 +263,10 @@ void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu)return ; timer = &pit->pit_state.pit_timer.timer; +mutex_lock (&pit->pit_state.lock);if (hrtimer_cancel (timer))hrtimer_start_expires (timer,HRTIMER_MODE_ABS ); +mutex_unlock (&pit->pit_state.lock); }static void destroy_pit_timer (struct kvm_pit *pit)
Signature · 1 line
1.9.1
PATCH 79/91 perf: Handle compat ioctl
In reply to [email protected]From: Pawel Moll <[email protected]>
3.4.105-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit b3f207855f57b9c8f43a547a801340bb5cbc59e5 upstream.
When running a 32-bit userspace on a 64-bit kernel (eg. i386 application on x86_64 kernel or 32-bit arm userspace on arm64 kernel) some of the perf ioctls must be treated with special care, as they have a pointer size encoded in the command.
For example, PERF_EVENT_IOC_ID in 32-bit world will be encoded as 0x80042407, but 64-bit kernel will expect 0x80082407. In result the ioctl will fail returning -ENOTTY.
This patch solves the problem by adding code fixing up the size as compat_ioctl file operation.
--- kernel/events/core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
kernel/events/core.c +21 -1
@@ -36,6 +36,7 @@#include <linux/perf_event.h> #include <linux/ftrace_event.h> #include <linux/hw_breakpoint.h> +#include <linux/compat.h> #include "internal.h"
@@ -3360,6 +3361,25 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)return 0 ; } +#ifdef CONFIG_COMPAT +static long perf_compat_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +switch (_IOC_NR (cmd)) { +case _IOC_NR (PERF_EVENT_IOC_SET_FILTER ): +/* Fix up pointer size (usually 4 -> 8 in 32-on-64-bit case */ +if (_IOC_SIZE (cmd) ==sizeof (compat_uptr_t)) { + cmd &= ~IOCSIZE_MASK ; + cmd |=sizeof (void *) <<IOCSIZE_SHIFT ; + } +break ; + } +return perf_ioctl (file, cmd, arg); +} +#else +# define perf_compat_ioctl NULL +#endif +int perf_event_task_enable (void ) {struct perf_event *event;
@@ -3831,7 +3851,7 @@ static const struct file_operations perf_fops = { .read = perf_read, .poll = perf_poll, .unlocked_ioctl = perf_ioctl, - .compat_ioctl = perf_ioctl, + .compat_ioctl = perf_compat_ioctl, .mmap = perf_mmap, .fasync = perf_fasync, };
Signature · 1 line
1.9.1
PATCH 80/177 KVM: x86: Fix wrong masking on relative jump/call
In reply to [email protected]From: Nadav Amit <[email protected]>
3.4.106-rc1 review patch. If anyone has any objections, please let me know.
------------------
commit 05c83ec9b73c8124555b706f6af777b10adf0862 upstream.
Relative jumps and calls do the masking according to the operand size, and not according to the address size as the KVM emulator does today.
This patch fixes KVM behavior.
--- arch/x86/kvm/emulate.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
arch/x86/kvm/emulate.c +22 -5
@@ -459,11 +459,6 @@ register_address_increment(struct x86_emulate_ctxt *ctxt, unsigned long *reg, in *reg = (*reg & ~ad_mask (ctxt)) | ((*reg + inc) &ad_mask (ctxt)); } -static inline void jmp_rel (struct x86_emulate_ctxt *ctxt,int rel) -{ -register_address_increment (ctxt, &ctxt->_eip, rel); -} -static u32 desc_limit_scaled (struct desc_struct *desc) {u32 limit =get_desc_limit (desc);
@@ -537,6 +532,28 @@ static int emulate_nm(struct x86_emulate_ctxt *ctxt)return emulate_exception (ctxt,NM_VECTOR ,0 , false); } +static inline void assign_eip_near (struct x86_emulate_ctxt *ctxt,ulong dst) +{ +switch (ctxt->op_bytes) { +case 2 : + ctxt->_eip = (u16 )dst; +break ; +case 4 : + ctxt->_eip = (u32 )dst; +break ; +case 8 : + ctxt->_eip = dst; +break ; +default : +WARN (1 ,"unsupported eip assignment size\n" ); + } +} + +static inline void jmp_rel (struct x86_emulate_ctxt *ctxt,int rel) +{ +assign_eip_near (ctxt, ctxt->_eip + rel); +} +static u16 get_segment_selector (struct x86_emulate_ctxt *ctxt,unsigned seg) {u16 selector;
Signature · 1 line
1.9.1