3.2.82-rc1 review
Subsystems (2)
cover 3.2.82-rc1 review
This is the start of the stable review cycle for the 3.2.82 release. There are 94 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Aug 16 00:00:00 UTC 2016. Anything received after that time might be too late.
A combined patch relative to 3.2.81 will be posted as an additional response to this. A shortlog and diffstat can be found below.
Ben.
-------------
Adrian Hunter (1):
mmc: mmc: Fix partition switch timeout for some eMMCs
[1c447116d017a98c90f8f71c8c5a611e0aa42178]
Al Viro (1):
fix d_walk()/non-delayed __d_free() race
[3d56c25e3bb0726a5c5e16fc2d9e38f8ed763085]
Alex Deucher (1):
drm/radeon: fix asic initialization for virtualized environments
[05082b8bbd1a0ffc74235449c4b8930a8c240f85]
Andrew F. Davis (1):
regmap: cache: Fix typo in cache_bypass parameter description
[267c85860308d36bc163c5573308cd024f659d7c]
Andrew Goodbody (2):
usb: musb: Ensure rx reinit occurs for shared_fifo endpoints
[f3eec0cf784e0d6c47822ca6b66df3d5812af7e6]
usb: musb: Stop bulk endpoint while queue is rotated
[7b2c17f829545df27a910e8d82e133c21c9a8c9c]
Andrey Grodzovsky (1):
xen/pciback: Fix conf_space read/write overlap check.
[02ef871ecac290919ea0c783d05da7eedeffc10e]
Andrey Ryabinin (1):
kernel/sysrq, watchdog, sched/core: Reset watchdog on all CPUs while processing sysrq-w
[57675cb976eff977aefb428e68e4e0236d48a9ff]
Arnd Bergmann (1):
gcov: disable tree-loop-im to reduce stack usage
[c87bf431448b404a6ef5fbabd74c0e3e42157a7f]
Bjorn Helgaas (2):
PCI: Supply CPU physical address (not bus address) to iomem_is_exclusive()
[ca620723d4ff9ea7ed484eab46264c3af871b9ae]
alpha/PCI: Call iomem_is_exclusive() for IORESOURCE_MEM, but not IORESOURCE_IO
[c20e128030caf0537d5e906753eac1c28fefdb75]
Borislav Petkov (1):
x86/amd_nb: Fix boot crash on non-AMD systems
[1ead852dd88779eda12cb09cc894a03d9abfe1ec]
Cameron Gutman (1):
Input: xpad - prevent spurious input from wired Xbox 360 controllers
[1ff5fa3c6732f08e01ae12f12286d4728c9e4d86]
Christophe JAILLET (1):
ALSA: echoaudio: Fix memory allocation
[9c6795a9b3cbb56a9fbfaf43909c5c22999ba317]
Chuck Lever (1):
sunrpc: Update RPCBIND_MAXNETIDLEN
[4b9c7f9db9a003f5c342184dc4401c1b7f2efb39]
Crestez Dan Leonard (1):
iio: Fix error handling in iio_trigger_attach_poll_func
[99543823357966ac938d9a310947e731b67338e6]
Dan Carpenter (3):
ACPI / sysfs: fix error code in get_status()
[f18ebc211e259d4f591e39e74b2aa2de226c9a1d]
KEYS: potential uninitialized variable
[38327424b40bcebe2de92d07312c89360ac9229a]
usb: f_fs: off by one bug in _ffs_func_bind()
[0015f9156092d07b3ec06d37d014328419d5832e]
Dmitry Torokhov (1):
Input: elantech - add more IC body types to the list
[226ba707744a51acb4244724e09caacb1d96aed9]
Duan Jiong (1):
etherdevice: introduce help function eth_zero_addr()
[6d57e9078e880a3dd232d579f42ac437a8f1ef7b]
Eric Dumazet (2):
bonding: prevent out of bound accesses
[f87fda00b6ed232a817c655b8d179b48bde8fdbe]
tcp: make challenge acks less predictable
[75ff39ccc1bd5d3c455b6822ab09e533c551f758]
Geert Uytterhoeven (1):
char: Drop bogus dependency of DEVPORT on !M68K
[309124e2648d668a0c23539c5078815660a4a850]
H. Peter Anvin (1):
x86, build: copy ldlinux.c32 to image.iso
[9c77679cadb118c0aa99e6f88533d91765a131ba]
Helge Deller (1):
parisc: Fix pagefault crash in unaligned __get_user() call
[8b78f260887df532da529f225c49195d18fef36b]
Honggang Li (1):
RDMA/cxgb3: device driver frees DMA memory with different size
[0de4cbb3dddca35ecd06b95918f38439c9c6401f]
Jan Beulich (1):
xenbus: don't BUG() on user mode induced condition
[0beef634b86a1350c31da5fcc2992f0d7c8a622b]
Jann Horn (1):
proc: prevent stacking filesystems on top
[e54ad7f1ee263ffa5a2de9c609d58dfa27b21cd9]
Jason Gunthorpe (1):
IB/mlx4: Properly initialize GRH TClass and FlowLabel in AHs
[8c5122e45a10a9262f872b53f151a592e870f905]
Jeff Mahoney (1):
ecryptfs: don't allow mmap when the lower fs doesn't support it
[f0fe970df3838c202ef6c07a4c2b36838ef0a88b]
Jerome Marchand (1):
cifs: dynamic allocation of ntlmssp blob
[b8da344b74c822e966c6d19d6b2321efe82c5d97]
Jiri Slaby (2):
base: make module_create_drivers_dir race-free
[7e1b1fc4dabd6ec8e28baa0708866e13fa93c9b3]
tty: vt, return error when con_startup fails
[6798df4c5fe0a7e6d2065cf79649a794e5ba7114]
Jonathan Cameron (1):
staging:iio: trigger fixes for repeat request of same trigger and allocation failure
[5dd72ecb0166498852705939163f375d693d37f3]
Joseph Salisbury (1):
ath5k: Change led pin configuration for compaq c700 laptop
[7b9bc799a445aea95f64f15e0083cb19b5789abe]
Joshua Kinard (1):
MIPS: Adjust set_pte() SMP fix to handle R10000_LLSC_WAR
[128639395b2ceacc6a56a0141d0261012bfe04d3]
Kangjie Lu (6):
ALSA: timer: Fix leak in SNDRV_TIMER_IOCTL_PARAMS
[cec8f96e49d9be372fdb0c3836dcf31ec71e457e]
ALSA: timer: Fix leak in events via snd_timer_user_ccallback
[9a47e9cff994f37f7f0dbd9ae23740d0f64f9fe6]
ALSA: timer: Fix leak in events via snd_timer_user_tinterrupt
[e4ec8cc8039a7063e24204299b462bd1383184a5]
USB: usbfs: fix potential infoleak in devio
[681fef8380eb818c0b845fca5d2ab1dcbab114ee]
rds: fix an infoleak in rds_inc_info_copy
[4116def2337991b39919f3b448326e21c40e0dbb]
tipc: fix an infoleak in tipc_nl_compat_link_dump
[5d2be1422e02ccd697ccfcd45c85b4a26e6178e2]
Kirill A. Shutemov (1):
UBIFS: Implement ->migratepage()
[4ac1c17b2044a1b4b2fbed74451947e905fc2992]Krzysztof Kozlowski (1):
crypto: s5p-sss - Fix missed interrupts when working with 8 kB blocks
[79152e8d085fd64484afd473ef6830b45518acba]
Lei Liu (2):
USB: serial: option: add even more ZTE device ids
[74d2a91aec97ab832790c9398d320413ad185321]
USB: serial: option: add more ZTE device ids
[f0d09463c59c2d764a6c6d492cbe6d2c77f27153]
Linus Walleij (1):
iio: accel: kxsd9: fix the usage of spi_w8r8()
[0c1f91b98552da49d9d8eed32b3132a58d2f4598]
Luis de Bethencourt (1):
staging: iio: accel: fix error check
[ef3149eb3ddb7f9125e11c90f8330e371b55cffd]
Luke Dashjr (1):
btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
[4c63c2454eff996c5e27991221106eb511f7db38]
Manfred Schlaegl (1):
Input: pwm-beeper - fix - scheduling while atomic
[f49cf3b8b4c841457244c461c66186a719e13bcc]
Mans Rullgard (1):
ata: sata_dwc_460ex: remove incorrect locking
[55e610cdd28c0ad3dce0652030c0296d549673f3]
Marek Szyprowski (1):
crypto: s5p-sss - fix incorrect usage of scatterlists api
[d1497977fecb9acce05988d6322ad415ef93bb39]
Martin Willi (1):
mac80211_hwsim: Add missing check for HWSIM_ATTR_SIGNAL
[62397da50bb20a6b812c949ef465d7e69fe54bb6]
Masami Hiramatsu (1):
kprobes/x86: Clear TF bit in fault on single-stepping
[dcfc47248d3f7d28df6f531e6426b933de94370d]
Michael Ellerman (2):
powerpc/mm/hash64: Factor out hash preload psize check
[8bbc9b7b001eaab8abf7e9e24edf1bb285c8d825]
powerpc/mm/hash64: Fix subpage protection with 4K HPTE config
[aac55d7573c5d46ed9a62818d5d3e69dd2060105]
Miklos Szeredi (1):
fs: limit filesystem stacking depth
[69c433ed2ecd2d3264efd7afec4439524b319121]
Oleg Nesterov (1):
wait/ptrace: assume __WALL if the child is traced
[bf959931ddb88c4e4366e96dd22e68fa0db9527c]
Oliver Hartkopp (1):
can: fix oops caused by wrong rtnl dellink usage
[25e1ed6e64f52a692ba3191c4fde650aab3ecc07]
Olivier Sobrie (1):
Input: pwm-beeper - remove useless call to pwm_config()
[d1b12075ffa808dce33dd46b7ad035bebf8da215]
Pali Rohár (1):
hwmon: (dell-smm) Restrict fan control and serial number to CAP_SYS_ADMIN by default
[7613663cc186f8f3c50279390ddc60286758001c]
Paolo Bonzini (1):
KVM: x86: fix OOPS after invalid KVM_SET_DEBUGREGS
[d14bdb553f9196169f003058ae1cdabe514470e6]
Paul Moore (1):
audit: fix a double fetch in audit_log_single_execve_arg()
[43761473c254b45883a64441dd0bc85a42f3645c]
Ping Cheng (1):
Input: wacom_w8001 - w8001_MAX_LENGTH should be 13
[12afb34400eb2b301f06b2aa3535497d14faee59]Prarit Bhargava (2):
PCI: Disable all BAR sizing for devices with non-compliant BARs
[ad67b437f187ea818b2860524d10f878fadfdd99]
x86/PCI: Mark Broadwell-EP Home Agent 1 as having non-compliant BARs
[da77b67195de1c65bef4908fa29967c4d0af2da2]
Prasun Maiti (1):
wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel
[3d5fdff46c4b2b9534fa2f9fc78e90a48e0ff724]
Raghava Aditya Renukunta (1):
aacraid: Fix for aac_command_thread hang
[fc4bf75ea300a5e62a2419f89dd0e22189dd7ab7]
Richard Weinberger (2):
mm: Export migrate_page_move_mapping and migrate_page_copy
[1118dce773d84f39ebd51a9fe7261f9169cb056e]
ubi: Make recover_peb power cut aware
[972228d87445dc46c0a01f5f3de673ac017626f7]
Ricky Liang (1):
Input: uinput - handle compat ioctl for UI_SET_PHYS
[affa80bd97f7ca282d1faa91667b3ee9e4c590e6]
Ross Lagerwall (1):
xen/events: Don't move disabled irqs
[f0f393877c71ad227d36705d61d1e4062bc29cf5]
Russell King (1):
ARM: fix PTRACE_SETVFPREGS on SMP systems
[e2dfb4b880146bfd4b6aa8e138c0205407cebbaf]
Scott Bauer (1):
HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands
[93a2001bdfd5376c3dc2158653034c20392d15c5]
Stefan Metzmacher (4):
fs/cifs: correctly to anonymous authentication for the LANMAN authentication
[fa8f3a354bb775ec586e4475bcb07f7dece97e0c]
fs/cifs: correctly to anonymous authentication for the NTLM(v1) authentication
[777f69b8d26bf35ade4a76b08f203c11e048365d]
fs/cifs: correctly to anonymous authentication for the NTLM(v2) authentication
[1a967d6c9b39c226be1b45f13acd4d8a5ab3dc44]
fs/cifs: correctly to anonymous authentication via NTLMSSP
[cfda35d98298131bf38fbad3ce4cd5ecb3cf18db]
Sven Eckelmann (1):
batman-adv: Fix use-after-free/double-free of tt_req_node
[9c4604a298e0a9807eaf2cd912d1ebf24d98fbeb]
Takashi Iwai (3):
ALSA: au88x0: Fix calculation in vortex_wtdma_bufshift()
[62db7152c924e4c060e42b34a69cd39658e8a0dc]
ALSA: dummy: Fix a use-after-free at closing
[d5dbbe6569481bf12dcbe3e12cff72c5f78d272c]
ALSA: timer: Fix negative queue usage by racy accesses
[3fa6993fef634e05d200d141a85df0b044572364]
Tariq Toukan (1):
net/mlx4_core: Fix access to uninitialized index
[2bb07e155bb3e0c722c806723f737cf8020961ef]
Theodore Ts'o (1):
ext4: fix hang when processing corrupted orphaned inode list
[c9eb13a9105e2e418f72e46a2b6da3f49e696902]
Torsten Hilbrich (1):
fs/nilfs2: fix potential underflow in call to crc32_le
[63d2f95d63396059200c391ca87161897b99e74a]
Trond Myklebust (1):
NFS: Fix another OPEN_DOWNGRADE bug
[e547f2628327fec6afd2e03b46f113f614cca05b]
Ursula Braun (1):
qeth: delete napi struct when removing a qeth device
[7831b4ff0d926e0deeaabef9db8800ed069a2757]
Vik Heyndrickx (1):
sched/loadavg: Fix loadavg artifacts on fully idle and on fully loaded systems
[20878232c52329f92423d27a60e48b6a6389e0dd]
William Breathitt Gray (1):
isa: Call isa_bus_init before dependent ISA bus drivers register
[32a5a0c047343b11f581f663a2309cf43d13466f]
Wolfgang Grandegger (1):
can: at91_can: RX queue could get stuck at high bus load
[43200a4480cbbe660309621817f54cbb93907108]
Xiubo Li (1):
kvm: Fix irq route entries exceeding KVM_MAX_IRQ_ROUTES
[caf1ff26e1aa178133df68ac3d40815fed2187d9]
[email protected] (1):
net: ehea: avoid null pointer dereference
[1740c29a46b30a2f157afc473156f157e599d4c2]
Yishai Hadas (1):
IB/mlx4: Fix the SQ size of an RC QP
[f2940e2c76bb554a7fbdd28ca5b90904117a9e96]
Makefile | 6 +- arch/alpha/kernel/pci-sysfs.c | 4 +- arch/arm/kernel/ptrace.c | 2 +- arch/mips/include/asm/pgtable.h | 45 ++-- arch/parisc/kernel/unaligned.c | 10 +- arch/powerpc/mm/hash_utils_64.c | 29 ++- arch/x86/boot/Makefile | 3 + arch/x86/kernel/amd_nb.c | 4 +- arch/x86/kernel/kprobes.c | 12 ++ arch/x86/kvm/x86.c | 5 + arch/x86/pci/fixup.c | 7 + drivers/acpi/sysfs.c | 7 +- drivers/ata/sata_dwc_460ex.c | 4 +- drivers/base/isa.c | 2 +- drivers/base/module.c | 8 +- drivers/base/regmap/regcache.c | 2 +- drivers/char/Kconfig | 1 - drivers/char/i8k.c | 18 +- drivers/crypto/s5p-sss.c | 61 ++++-- drivers/gpu/drm/radeon/radeon_device.c | 21 ++ drivers/hid/usbhid/hiddev.c | 10 +- drivers/infiniband/hw/cxgb3/cxio_hal.c | 2 +- drivers/infiniband/hw/mlx4/ah.c | 2 +- drivers/infiniband/hw/mlx4/qp.c | 2 +- drivers/input/joystick/xpad.c | 4 + drivers/input/misc/pwm-beeper.c | 70 ++++-- drivers/input/misc/uinput.c | 6 + drivers/input/mouse/elantech.c | 8 +- drivers/input/touchscreen/wacom_w8001.c | 2 +- drivers/mmc/core/mmc.c | 7 + drivers/mtd/ubi/eba.c | 19 +- drivers/net/bonding/bond_3ad.c | 13 +- drivers/net/bonding/bond_alb.c | 7 +- drivers/net/bonding/bonding.h | 3 + drivers/net/can/at91_can.c | 5 +- drivers/net/can/dev.c | 6 + drivers/net/ethernet/ibm/ehea/ehea_main.c | 9 +- drivers/net/ethernet/mellanox/mlx4/mcg.c | 4 +- drivers/net/wireless/ath/ath5k/led.c | 2 +- drivers/net/wireless/mac80211_hwsim.c | 1 + drivers/pci/pci-sysfs.c | 7 +- drivers/pci/probe.c | 6 +- drivers/s390/net/qeth_l2_main.c | 1 + drivers/s390/net/qeth_l3_main.c | 1 + drivers/scsi/aacraid/commsup.c | 4 + drivers/staging/iio/accel/kxsd9.c | 4 +- drivers/staging/iio/accel/sca3000_core.c | 2 +- drivers/staging/iio/industrialio-trigger.c | 25 ++- drivers/tty/vt/vt.c | 5 +- drivers/usb/core/devio.c | 9 +- drivers/usb/gadget/f_fs.c | 6 +- drivers/usb/musb/musb_host.c | 21 +- drivers/usb/serial/option.c | 129 ++++++++++- drivers/xen/events.c | 6 +- drivers/xen/xen-pciback/conf_space.c | 6 +- drivers/xen/xenfs/xenbus.c | 14 +- fs/btrfs/ctree.h | 1 + fs/btrfs/file.c | 2 +- fs/btrfs/inode.c | 2 +- fs/btrfs/ioctl.c | 21 ++ fs/cifs/sess.c | 207 ++++++++++-------- fs/dcache.c | 5 +- fs/ecryptfs/file.c | 15 +- fs/ecryptfs/main.c | 7 + fs/ext4/ialloc.c | 10 +- fs/nfs/nfs4proc.c | 5 +- fs/nilfs2/the_nilfs.c | 2 +- fs/proc/root.c | 7 + fs/ubifs/file.c | 24 +++ include/linux/etherdevice.h | 11 + include/linux/fs.h | 11 + include/linux/migrate.h | 3 + include/linux/sunrpc/msg_prot.h | 4 +- kernel/auditsc.c | 333 ++++++++++++++--------------- kernel/exit.c | 29 ++- kernel/sched.c | 17 +- mm/migrate.c | 4 +- net/batman-adv/translation-table.c | 42 +++- net/batman-adv/types.h | 1 + net/ipv4/tcp_input.c | 17 +- net/rds/recv.c | 2 + net/tipc/node.c | 3 +- net/wireless/wext-core.c | 25 ++- security/keys/key.c | 2 +- sound/core/timer.c | 5 +- sound/drivers/dummy.c | 1 + sound/pci/au88x0/au88x0_core.c | 5 +- sound/pci/echoaudio/echoaudio.c | 4 +- virt/kvm/assigned-dev.c | 2 +- 89 files changed, 1031 insertions(+), 477 deletions(-)
Signature · 3 lines
Ben Hutchings
Everything should be made as simple as possible, but not simpler.
- Albert EinsteinPATCH 5/94 alpha/PCI: Call iomem_is_exclusive() for IORESOURCE_MEM, but not IORESOURCE_IO
3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit c20e128030caf0537d5e906753eac1c28fefdb75 upstream.
The alpha pci_mmap_resource() is used for both IORESOURCE_MEM and IORESOURCE_IO resources, but iomem_is_exclusive() is only applicable for IORESOURCE_MEM.
Call iomem_is_exclusive() only for IORESOURCE_MEM resources, and do it earlier to match the generic version of pci_mmap_resource().
--- arch/alpha/kernel/pci-sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/alpha/kernel/pci-sysfs.c +2 -2
@@ -78,10 +78,10 @@ static int pci_mmap_resource(struct kobjif (i >=PCI_ROM_RESOURCE )return -ENODEV ; -if (!__pci_mmap_fits (pdev, i, vma, sparse)) +if (res->flags &IORESOURCE_MEM &&iomem_is_exclusive (res->start))return -EINVAL ; -if (iomem_is_exclusive (res->start)) +if (!__pci_mmap_fits (pdev, i, vma, sparse))return -EINVAL ;pcibios_resource_to_bus (pdev, &bar, res);
PATCH 23/94 x86/PCI: Mark Broadwell-EP Home Agent 1 as having non-compliant BARs
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit da77b67195de1c65bef4908fa29967c4d0af2da2 upstream.
Commit b894157145e4 ("x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs") marked Home Agent 0 & PCU has having non-compliant BARs. Home Agent 1 also has non-compliant BARs.
Mark Home Agent 1 as having non-compliant BARs so the PCI core doesn't touch them.
The problem with these devices is documented in the Xeon v4 specification update:
BDF2 PCI BARs in the Home Agent Will Return Non-Zero Values
During Enumeration
Problem: During system initialization the Operating System may access
the standard PCI BARs (Base Address Registers). Due to this erratum, accesses to the Home Agent BAR registers (Bus 1; Device 18; Function 0,4; Offsets (0x14-0x24) will return non-zero values.
Implication: The operating system may issue a warning. Intel has not
observed any functional failures due to this erratum.
--- arch/x86/pci/fixup.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/pci/fixup.c +7 -0
@@ -539,9 +539,16 @@ static void __devinit twinhead_reserve_k }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x27B9 , twinhead_reserve_killing_zone); +/* +* Broadwell EP Home Agent BARs erroneously return non-zero values when read. +* +* See http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html +* entry BDF2. +*/ static void pci_bdwep_bar (struct pci_dev *dev) { dev->non_compliant_bars =1 ; } +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x6f60 , pci_bdwep_bar);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x6fa0 , pci_bdwep_bar);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x6fc0 , pci_bdwep_bar);
PATCH 24/94 PCI: Disable all BAR sizing for devices with non-compliant BARs
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit ad67b437f187ea818b2860524d10f878fadfdd99 upstream.
b84106b4e229 ("PCI: Disable IO/MEM decoding for devices with non-compliant BARs") disabled BAR sizing for BARs 0-5 of devices that don't comply with the PCI spec. But it didn't do anything for expansion ROM BARs, so we still try to size them, resulting in warnings like this on Broadwell-EP:
pci 0000:ff:12.0: BAR 6: failed to assign [mem size 0x00000001 pref]
Move the non-compliant BAR check from __pci_read_base() up to pci_read_bases() so it applies to the expansion ROM BAR as well as to BARs 0-5.
Note that direct callers of __pci_read_base(), like sriov_init(), will now bypass this check. We haven't had reports of devices with broken SR-IOV BARs yet.
--- drivers/pci/probe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/probe.c +3 -3
@@ -136,9 +136,6 @@ int __pci_read_base(struct pci_dev *dev,u32 l, sz, mask;u16 orig_cmd; -if (dev->non_compliant_bars) -return 0 ; - mask = type ?PCI_ROM_ADDRESS_MASK : ~0 ;if (!dev->mmio_always_on) {
@@ -251,6 +248,9 @@ static void pci_read_bases(struct pci_de {unsigned int pos, reg; +if (dev->non_compliant_bars) +return ; +for (pos =0 ; pos < howmany; pos++) {struct resource *res = &dev->resource[pos]; reg =PCI_BASE_ADDRESS_0 + (pos <<2 );
PATCH 29/94 sunrpc: Update RPCBIND_MAXNETIDLEN
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 4b9c7f9db9a003f5c342184dc4401c1b7f2efb39 upstream.
Commit 176e21ee2ec8 ("SUNRPC: Support for RPC over AF_LOCAL transports") added a 5-character netid, but did not bump RPCBIND_MAXNETIDLEN from 4 to 5.
--- include/linux/sunrpc/msg_prot.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/sunrpc/msg_prot.h +2 -2
@@ -149,9 +149,9 @@ typedef __be32 rpc_fraghdr;/* * Note that RFC 1833 does not put any size restrictions on the -* netid string, but all currently defined netid's fit in 4 bytes. +* netid string, but all currently defined netid's fit in 5 bytes. */ -#define RPCBIND_MAXNETIDLEN (4u) +#define RPCBIND_MAXNETIDLEN (5u)/* * Universal addresses are introduced in RFC 1833 and further spelled
PATCH 30/94 net: ehea: avoid null pointer dereference
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 1740c29a46b30a2f157afc473156f157e599d4c2 upstream.
ehea_get_port may return NULL. Do not dereference NULL value.
--- drivers/net/ethernet/ibm/ehea/ehea_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/ibm/ehea/ehea_main.c +4 -5
@@ -1157,16 +1157,15 @@ static void ehea_parse_eqe(struct ehea_a ec =EHEA_BMASK_GET (NEQE_EVENT_CODE , eqe); portnum =EHEA_BMASK_GET (NEQE_PORTNUM , eqe); port =ehea_get_port (adapter, portnum); +if (!port) { +netdev_err (NULL ,"unknown portnum %x\n" , portnum); +return ; + } dev = port->netdev;switch (ec) {case EHEA_EC_PORTSTATE_CHG :/* port state change */ -if (!port) { -netdev_err (dev,"unknown portnum %x\n" , portnum); -break ; - } -if (EHEA_BMASK_GET (NEQE_PORT_UP , eqe)) {if (!netif_carrier_ok (dev)) { ret =ehea_sense_port_attr (port);
PATCH 41/94 parisc: Fix pagefault crash in unaligned __get_user() call
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 8b78f260887df532da529f225c49195d18fef36b upstream.
One of the debian buildd servers had this crash in the syslog without any other information:
Unaligned handler failed, ret = -2
clock_adjtime (pid 22578): Unaligned data reference (code 28)
CPU: 1 PID: 22578 Comm: clock_adjtime Tainted: G E 4.5.0-2-parisc64-smp #1 Debian 4.5.4-1 task: 000000007d9960f8 ti: 00000001bde7c000 task.ti: 00000001bde7c000
YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00001000000001001111100000001111 Tainted: G E
r00-03 000000ff0804f80f 00000001bde7c2b0 00000000402d2be8 00000001bde7c2b0 r04-07 00000000409e1fd0 00000000fa6f7fff 00000001bde7c148 00000000fa6f7fff r08-11 0000000000000000 00000000ffffffff 00000000fac9bb7b 000000000002b4d4 r12-15 000000000015241c 000000000015242c 000000000000002d 00000000fac9bb7b r16-19 0000000000028800 0000000000000001 0000000000000070 00000001bde7c218 r20-23 0000000000000000 00000001bde7c210 0000000000000002 0000000000000000 r24-27 0000000000000000 0000000000000000 00000001bde7c148 00000000409e1fd0 r28-31 0000000000000001 00000001bde7c320 00000001bde7c350 00000001bde7c218
sr00-03 0000000001200000 0000000001200000 0000000000000000 0000000001200000 sr04-07 0000000000000000 0000000000000000 0000000000000000 0000000000000000
IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000402d2e84 00000000402d2e88
IIR: 0ca0d089 ISR: 0000000001200000 IOR: 00000000fa6f7fff
CPU: 1 CR30: 00000001bde7c000 CR31: ffffffffffffffff
ORIG_R28: 00000002369fe628
IAOQ[0]: compat_get_timex+0x2dc/0x3c0
IAOQ[1]: compat_get_timex+0x2e0/0x3c0
RP(r2): compat_get_timex+0x40/0x3c0
Backtrace: [<00000000402d4608>] compat_SyS_clock_adjtime+0x40/0xc0 [<0000000040205024>] syscall_exit+0x0/0x14
This means the userspace program clock_adjtime called the clock_adjtime() syscall and then crashed inside the compat_get_timex() function. Syscalls should never crash programs, but instead return EFAULT.
The IIR register contains the executed instruction, which disassebles into "ldw 0(sr3,r5),r9".
This load-word instruction is part of __get_user() which tried to read the word at %r5/IOR (0xfa6f7fff). This means the unaligned handler jumped in. The unaligned handler is able to emulate all ldw instructions, but it fails if it fails to read the source e.g. because of page fault.
The following program reproduces the problem:
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/mman.h>
int main(void) {
/* allocate 8k */
char *ptr = mmap(NULL, 2*4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
/* free second half (upper 4k) and make it invalid. */
munmap(ptr+4096, 4096);
/* syscall where first int is unaligned and clobbers into invalid memory region */
/* syscall should return EFAULT */
return syscall(__NR_clock_adjtime, 0, ptr+4095);
}To fix this issue we simply need to check if the faulting instruction address is in the exception fixup table when the unaligned handler failed. If it is, call the fixup routine instead of crashing.
While looking at the unaligned handler I found another issue as well: The target register should not be modified if the handler was unsuccessful.
--- arch/parisc/kernel/unaligned.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/parisc/kernel/unaligned.c +9 -1
@@ -663,7 +663,7 @@ void handle_unaligned(struct pt_regs *rebreak ; } -if (modify &&R1 (regs->iir)) +if (ret ==0 && modify &&R1 (regs->iir)) regs->gr[R1 (regs->iir)] = newbase;
@@ -674,6 +674,14 @@ void handle_unaligned(struct pt_regs *reif (ret) { +/* +* The unaligned handler failed. +* If we were called by __get_user() or __put_user() jump +* to it's exception fixup handler instead of crashing. +*/ +if (!user_mode (regs) &&fixup_exception (regs)) +return ; +printk (KERN_CRIT "Unaligned handler failed, ret = %d\n" , ret);die_if_kernel ("Unaligned data reference" , regs,28 );
PATCH 42/94 x86, build: copy ldlinux.c32 to image.iso
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 9c77679cadb118c0aa99e6f88533d91765a131ba upstream.
For newer versions of Syslinux, we need ldlinux.c32 in addition to isolinux.bin to reside on the boot disk, so if the latter is found, copy it, too, to the isoimage tree.
--- arch/x86/boot/Makefile | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/boot/Makefile +3 -0
@@ -166,6 +166,9 @@ isoimage: $(obj)/bzImage for i in lib lib64 share end ; do \ if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ + if [ -f /usr/$$i/syslinux/ldlinux.c32 ]; then \ + cp /usr/$$i/syslinux/ldlinux.c32 $(obj)/isoimage ; \ + fi ; \ break ; \ fi ; \ if [ $$i = end ] ; then exit 1 ; fi ; \
PATCH 50/94 drm/radeon: fix asic initialization for virtualized environments
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 05082b8bbd1a0ffc74235449c4b8930a8c240f85 upstream.
When executing in a PCI passthrough based virtuzliation environment, the hypervisor will usually attempt to send a PCIe bus reset signal to the ASIC when the VM reboots. In this scenario, the card is not correctly initialized, but we still consider it to be posted. Therefore, in a passthrough based environemnt we should always post the card to guarantee it is in a good state for driver initialization.
Ported from amdgpu commit:
amdgpu: fix asic initialization for virtualized environments
--- drivers/gpu/drm/radeon/radeon_device.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +21 -0
@@ -350,10 +350,31 @@ void radeon_gtt_location(struct radeon_d/* * GPU helpers function. */ + +/** +* radeon_device_is_virtual - check if we are running is a virtual environment +* +* Check if the asic has been passed through to a VM (all asics). +* Used at driver startup. +* Returns true if virtual or false if not. +*/ +static bool radeon_device_is_virtual (void ) +{ +#ifdef CONFIG_X86 +return boot_cpu_has (X86_FEATURE_HYPERVISOR ); +#else +return false; +#endif +} +bool radeon_card_posted (struct radeon_device *rdev) {uint32_t reg; +/* for pass through, always force asic_init */ +if (radeon_device_is_virtual ()) +return false; +if (efi_enabled (EFI_BOOT ) && rdev->pdev->subsystem_vendor ==PCI_VENDOR_ID_APPLE )return false;
PATCH 54/94 kvm: Fix irq route entries exceeding KVM_MAX_IRQ_ROUTES
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xiubo Li <[email protected]>
commit caf1ff26e1aa178133df68ac3d40815fed2187d9 upstream.
These days, we experienced one guest crash with 8 cores and 3 disks, with qemu error logs as bellow:
qemu-system-x86_64: /build/qemu-2.0.0/kvm-all.c:984:kvm_irqchip_commit_routes: Assertion `ret == 0' failed.
And then we found one patch(bdf026317d) in qemu tree, which said could fix this bug.
Execute the following script will reproduce the BUG quickly:
irq_affinity.sh
========================================================================
vda_irq_num=25
vdb_irq_num=27
while [ 1 ]
do
for irq in {1,2,4,8,10,20,40,80}
do
echo $irq > /proc/irq/$vda_irq_num/smp_affinity echo $irq > /proc/irq/$vdb_irq_num/smp_affinity dd if=/dev/vda of=/dev/zero bs=4K count=100 iflag=direct dd if=/dev/vdb of=/dev/zero bs=4K count=100 iflag=direct
done
done
========================================================================
The following qemu log is added in the qemu code and is displayed when this bug reproduced:
kvm_irqchip_commit_routes: max gsi: 1008, nr_allocated_irq_routes: 1024, irq_routes->nr: 1024, gsi_count: 1024.
That's to say when irq_routes->nr == 1024, there are 1024 routing entries, but in the kernel code when routes->nr >= 1024, will just return -EINVAL;
The nr is the number of the routing entries which is in of [1 ~ KVM_MAX_IRQ_ROUTES], not the index in [0 ~ KVM_MAX_IRQ_ROUTES - 1].
This patch fix the BUG above.
--- virt/kvm/assigned-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/assigned-dev.c +1 -1
@@ -826,7 +826,7 @@ long kvm_vm_ioctl_assigned_device(structif (copy_from_user (&routing, argp,sizeof (routing))) goto out; r = -EINVAL ; -if (routing.nr >=KVM_MAX_IRQ_ROUTES ) +if (routing.nr >KVM_MAX_IRQ_ROUTES ) goto out;if (routing.flags) goto out;
PATCH 55/94 KEYS: potential uninitialized variable
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 38327424b40bcebe2de92d07312c89360ac9229a upstream.
If __key_link_begin() failed then "edit" would be uninitialized. I've added a check to fix that.
This allows a random user to crash the kernel, though it's quite difficult to achieve. There are three ways it can be done as the user would have to cause an error to occur in __key_link():
(1) Cause the kernel to run out of memory. In practice, this is difficult to achieve without ENOMEM cropping up elsewhere and aborting the attempt.
(2) Revoke the destination keyring between the keyring ID being looked up and it being tested for revocation. In practice, this is difficult to time correctly because the KEYCTL_REJECT function can only be used from the request-key upcall process. Further, users can only make use of what's in /sbin/request-key.conf, though this does including a rejection debugging test - which means that the destination keyring has to be the caller's session keyring in practice.
(3) Have just enough key quota available to create a key, a new session keyring for the upcall and a link in the session keyring, but not then sufficient quota to create a link in the nominated destination keyring so that it fails with EDQUOT.
The bug can be triggered using option (3) above using something like the following:
echo 80 >/proc/sys/kernel/keys/root_maxbytes keyctl request2 user debug:fred negate @t
The above sets the quota to something much lower (80) to make the bug easier to trigger, but this is dependent on the system. Note also that the name of the keyring created contains a random number that may be between 1 and 10 characters in size, so may throw the test off by changing the amount of quota used.
Assuming the failure occurs, something like the following will be seen:
kfree_debugcheck: out of range ptr 6b6b6b6b6b6b6b68h ------------[ cut here ]------------ kernel BUG at ../mm/slab.c:2821! ... RIP: 0010:[<ffffffff811600f9>] kfree_debugcheck+0x20/0x25 RSP: 0018:ffff8804014a7de8 EFLAGS: 00010092 RAX: 0000000000000034 RBX: 6b6b6b6b6b6b6b68 RCX: 0000000000000000 RDX: 0000000000040001 RSI: 00000000000000f6 RDI: 0000000000000300 RBP: ffff8804014a7df0 R08: 0000000000000001 R09: 0000000000000000 R10: ffff8804014a7e68 R11: 0000000000000054 R12: 0000000000000202 R13: ffffffff81318a66 R14: 0000000000000000 R15: 0000000000000001 ... Call Trace: kfree+0xde/0x1bc assoc_array_cancel_edit+0x1f/0x36 __key_link_end+0x55/0x63 key_reject_and_link+0x124/0x155 keyctl_reject_key+0xb6/0xe0 keyctl_negate_key+0x10/0x12 SyS_keyctl+0x9f/0xe7 do_syscall_64+0x63/0x13a entry_SYSCALL64_slow_path+0x25/0x25
--- security/keys/key.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/key.c +1 -1
@@ -572,7 +572,7 @@ int key_reject_and_link(struct key *key,mutex_unlock (&key_construction_mutex); -if (keyring) +if (keyring && link_ret ==0 )__key_link_end (keyring, key->type, prealloc);/* wake up anyone waiting for a key to be constructed */
PATCH 57/94 isa: Call isa_bus_init before dependent ISA bus drivers register
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: William Breathitt Gray <[email protected]>
commit 32a5a0c047343b11f581f663a2309cf43d13466f upstream.
The isa_bus_init function must be called before drivers which utilize the ISA bus driver are registered. A race condition for initilization exists if device_initcall is used (the isa_bus_init callback is placed in the same initcall level as dependent drivers which use module_init). This patch ensures that isa_bus_init is called first by utilizing postcore_initcall in favor of device_initcall.
--- drivers/base/isa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/isa.c +1 -1
@@ -180,4 +180,4 @@ static int __init isa_bus_init(void)return error; } -device_initcall (isa_bus_init); +postcore_initcall (isa_bus_init);
PATCH 58/94 hwmon: (dell-smm) Restrict fan control and serial number to CAP_SYS_ADMIN by default
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
commit 7613663cc186f8f3c50279390ddc60286758001c upstream.
For security reasons ordinary user must not be able to control fan speed via /proc/i8k by default. Some malicious software running under "nobody" user could be able to turn fan off and cause HW problems. So this patch changes default value of "restricted" parameter to 1.
Also restrict reading of DMI_PRODUCT_SERIAL from /proc/i8k via "restricted" parameter. It is because non root user cannot read DMI_PRODUCT_SERIAL from sysfs file /sys/class/dmi/id/product_serial.
Old non secure behaviour of file /proc/i8k can be achieved by loading this module with "restricted" parameter set to 0.
Note that this patch has effects only for kernels compiled with CONFIG_I8K and only for file /proc/i8k. Hwmon interface provided by this driver was not changed and root access for setting fan speed was needed also before.
--- drivers/char/i8k.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/char/i8k.c +12 -6
@@ -63,6 +63,7 @@static DEFINE_MUTEX (i8k_mutex);static char bios_version[4 ]; +static char bios_machineid[16 ];static struct device *i8k_hwmon_dev;MODULE_AUTHOR ("Massimo Dal Zotto ([email protected])" );
@@ -77,13 +78,13 @@ static int ignore_dmi;module_param (ignore_dmi, bool,0 );MODULE_PARM_DESC (ignore_dmi,"Continue probing hardware even if DMI data does not match" ); -static int restricted; +static int restricted = true;module_param (restricted, bool,0 ); -MODULE_PARM_DESC (restricted,"Allow fan control if SYS_ADMIN capability set" ); +MODULE_PARM_DESC (restricted,"Restrict fan control and serial number to CAP_SYS_ADMIN (default: 1)" );static int power_status;module_param (power_status, bool,0600 ); -MODULE_PARM_DESC (power_status,"Report power status in /proc/i8k" ); +MODULE_PARM_DESC (power_status,"Report power status in /proc/i8k (default: 0)" );static int fan_mult =I8K_FAN_MULT ;module_param (fan_mult, int,0 );
@@ -332,8 +333,11 @@ i8k_ioctl_unlocked(struct file *fp, unsibreak ;case I8K_MACHINE_ID : -memset (buff,0 ,16 ); -strlcpy (buff,i8k_get_dmi_data (DMI_PRODUCT_SERIAL ),sizeof (buff)); +if (restricted && !capable (CAP_SYS_ADMIN )) +return -EPERM ; + +memset (buff,0 ,sizeof (buff)); +strlcpy (buff, bios_machineid,sizeof (buff));break ;case I8K_FN_STATUS :
@@ -450,7 +454,7 @@ static int i8k_proc_show(struct seq_filereturn seq_printf (seq,"%s %s %s %d %d %d %d %d %d %d\n" ,I8K_PROC_FMT , bios_version, -i8k_get_dmi_data (DMI_PRODUCT_SERIAL ), + (restricted && !capable (CAP_SYS_ADMIN )) ?"-1" : bios_machineid, cpu_temp, left_fan, right_fan, left_speed, right_speed, ac_power, fn_key);
@@ -697,6 +701,8 @@ static int __init i8k_probe(void) }strlcpy (bios_version,i8k_get_dmi_data (DMI_BIOS_VERSION ),sizeof (bios_version)); +strlcpy (bios_machineid,i8k_get_dmi_data (DMI_PRODUCT_SERIAL ), +sizeof (bios_machineid));/* * Get SMM Dell signature
PATCH 61/94 mm: Export migrate_page_move_mapping and migrate_page_copy
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 1118dce773d84f39ebd51a9fe7261f9169cb056e upstream.
Export these symbols such that UBIFS can implement ->migratepage.
[bwh: Backported to 3.2: also change migrate_page_move_mapping() from
static to extern, done as part of an earlier commit upstream]
--- mm/migrate.c | 2 ++ 1 file changed, 2 insertions(+)
mm/migrate.c +3 -1
@@ -294,7 +294,7 @@ static inline bool buffer_migrate_lock_b* 2 for pages with a mapping * 3 for pages with a mapping and PagePrivate/PagePrivate2 set. */ -static int migrate_page_move_mapping (struct address_space *mapping, +int migrate_page_move_mapping (struct address_space *mapping,struct page *newpage,struct page *page,struct buffer_head *head,enum migrate_mode mode) {
@@ -377,6 +377,7 @@ static int migrate_page_move_mapping(strreturn 0 ; } +EXPORT_SYMBOL (migrate_page_move_mapping);/* * The expected number of remaining references is the same as that
@@ -476,6 +477,7 @@ void migrate_page_copy(struct page *newpif (PageWriteback (newpage))end_page_writeback (newpage); } +EXPORT_SYMBOL (migrate_page_copy);/************************************************************ * Migration functions
include/linux/migrate.h +3 -0
@@ -43,6 +43,9 @@ extern int migrate_vmas(struct mm_structextern void migrate_page_copy (struct page *newpage,struct page *page);extern int migrate_huge_page_move_mapping (struct address_space *mapping,struct page *newpage,struct page *page); +extern int migrate_page_move_mapping (struct address_space *mapping, +struct page *newpage,struct page *page, +struct buffer_head *head,enum migrate_mode mode);#else #define PAGE_MIGRATION 0
PATCH 66/94 Input: wacom_w8001 - w8001_MAX_LENGTH should be 13
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ping Cheng <[email protected]>
commit 12afb34400eb2b301f06b2aa3535497d14faee59 upstream.
Somehow the patch that added two-finger touch support forgot to update W8001_MAX_LENGTH from 11 to 13.
--- drivers/input/touchscreen/wacom_w8001.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/wacom_w8001.c +1 -1
@@ -28,7 +28,7 @@ MODULE_AUTHOR("Jaya Kumar <jayakumar.lkmMODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL" ); -#define W8001_MAX_LENGTH 11 +#define W8001_MAX_LENGTH 13#define W8001_LEAD_MASK 0x80#define W8001_LEAD_BYTE 0x80#define W8001_TAB_MASK 0x40
PATCH 74/94 NFS: Fix another OPEN_DOWNGRADE bug
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit e547f2628327fec6afd2e03b46f113f614cca05b upstream.
Olga Kornievskaia reports that the following test fails to trigger an OPEN_DOWNGRADE on the wire, and only triggers the final CLOSE.
fd0 = open(foo, RDRW) -- should be open on the wire for "both"
fd1 = open(foo, RDONLY) -- should be open on the wire for "read" close(fd0) -- should trigger an open_downgrade read(fd1)
close(fd1)
The issue is that we're missing a check for whether or not the current state transitioned from an O_RDWR state as opposed to having transitioned from a combination of O_RDONLY and O_WRONLY.
--- fs/nfs/nfs4proc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +2 -3
@@ -2025,12 +2025,11 @@ static void nfs4_close_prepare(struct rp call_close |= is_wronly; else if (is_wronly) calldata->arg.fmode |= FMODE_WRITE; + if (calldata->arg.fmode != (FMODE_READ|FMODE_WRITE)) + call_close |= is_rdwr; }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) {
PATCH 83/94 ecryptfs: don't allow mmap when the lower fs doesn't support it
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit f0fe970df3838c202ef6c07a4c2b36838ef0a88b upstream.
There are legitimate reasons to disallow mmap on certain files, notably in sysfs or procfs. We shouldn't emulate mmap support on file systems that don't offer support natively.
CVE-2016-1583
--- fs/ecryptfs/file.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
fs/ecryptfs/file.c +14 -1
@@ -183,6 +183,19 @@ out:return rc; } +static int ecryptfs_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct file *lower_file =ecryptfs_file_to_lower (file); +/* +* Don't allow mmap on top of file systems that don't support it +* natively. If FILESYSTEM_MAX_STACK_DEPTH > 2 or ecryptfs +* allows recursive mounting, this will need to be extended. +*/ +if (!lower_file->f_op->mmap) +return -ENODEV ; +return generic_file_mmap (file, vma); +} +/** * ecryptfs_open * @inode: inode speciying file to open
@@ -382,7 +395,7 @@ const struct file_operations ecryptfs_ma#ifdef CONFIG_COMPAT .compat_ioctl = ecryptfs_compat_ioctl, #endif - .mmap = generic_file_mmap, + .mmap = ecryptfs_mmap, .open = ecryptfs_open, .flush = ecryptfs_flush, .release = ecryptfs_release,
PATCH 89/94 ALSA: timer: Fix leak in events via snd_timer_user_ccallback
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit 9a47e9cff994f37f7f0dbd9ae23740d0f64f9fe6 upstream.
The stack object “r1” has a total size of 32 bytes. Its field “event” and “val” both contain 4 bytes padding. These 8 bytes padding bytes are sent to user without being initialized.
--- sound/core/timer.c | 1 + 1 file changed, 1 insertion(+)
sound/core/timer.c +1 -0
@@ -1213,6 +1213,7 @@ static void snd_timer_user_ccallback(str tu->tstamp = *tstamp;if ((tu->filter & (1 << event)) ==0 || !tu->tread)return ; +memset (&r1,0 ,sizeof (r1)); r1.event = event; r1.tstamp = *tstamp; r1.val = resolution;
PATCH 93/94 tcp: make challenge acks less predictable
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 75ff39ccc1bd5d3c455b6822ab09e533c551f758 upstream.
Yue Cao claims that current host rate limiting of challenge ACKS (RFC 5961) could leak enough information to allow a patient attacker to hijack TCP sessions. He will soon provide details in an academic paper.
This patch increases the default limit from 100 to 1000, and adds some randomization so that the attacker can no longer hijack sessions without spending a considerable amount of probes.
Based on initial analysis and patch from Linus.
Note that we also have per socket rate limiting, so it is tempting to remove the host limit in the future.
v2: randomize the count of challenge acks per second, not the period.
[bwh: Backported to 3.2:
- Adjust context
- Use ACCESS_ONCE() instead of {READ,WRITE}_ONCE()
- Open-code prandom_u32_max()]
--- net/ipv4/tcp_input.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
net/ipv4/tcp_input.c +12 -5
@@ -87,7 +87,7 @@ int sysctl_tcp_adv_win_scale __read_mostEXPORT_SYMBOL (sysctl_tcp_adv_win_scale);/* rfc5961 challenge ack rate limiting */ -int sysctl_tcp_challenge_ack_limit =100 ; +int sysctl_tcp_challenge_ack_limit =1000 ;int sysctl_tcp_stdurg__read_mostly ;int sysctl_tcp_rfc1337__read_mostly ;
@@ -3715,13 +3715,20 @@ static void tcp_send_challenge_ack(struc/* unprotected vars, we dont care of overwrites */ static u32 challenge_timestamp;static unsigned int challenge_count; -u32 now = jiffies /HZ ; +u32 count, now = jiffies /HZ ;if (now != challenge_timestamp) { +u32 half = (sysctl_tcp_challenge_ack_limit +1 ) >>1 ; + challenge_timestamp = now; - challenge_count =0 ; - } -if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { +ACCESS_ONCE (challenge_count) = + half + (u32)( + ((u64 )random32 () * sysctl_tcp_challenge_ack_limit) + >>32 ); + } + count =ACCESS_ONCE (challenge_count); +if (count >0 ) { +ACCESS_ONCE (challenge_count) = count -1 ;NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPCHALLENGEACK );tcp_send_ack (sk); }
PATCH 28/94 fs/cifs: correctly to anonymous authentication for the NTLM(v2) authentication
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
commit 1a967d6c9b39c226be1b45f13acd4d8a5ab3dc44 upstream.
Only server which map unknown users to guest will allow access using a non-null NTLMv2_Response.
For Samba it's the "map to guest = bad user" option.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
[bwh: Backported to 3.2:
- Adjust context, indentation
- Keep using cERROR()]
---
fs/cifs/sess.c +19 -14
@@ -727,21 +727,26 @@ ssetup_ntlmssp_authenticate:/* LM2 password would be here if we supported it */ pSMB->req_no_secext.CaseInsensitivePasswordLength =0 ; -/* calculate nlmv2 response and session key */ - rc =setup_ntlmv2_rsp (ses, nls_cp); -if (rc) { -cERROR (1 ,"Error %d during NTLMv2 authentication" , rc); - goto ssetup_exit; - } -memcpy (bcc_ptr, ses->auth_key.response +CIFS_SESS_KEY_SIZE , - ses->auth_key.len -CIFS_SESS_KEY_SIZE ); - bcc_ptr += ses->auth_key.len -CIFS_SESS_KEY_SIZE ; +if (ses->user_name !=NULL ) { +/* calculate nlmv2 response and session key */ + rc =setup_ntlmv2_rsp (ses, nls_cp); +if (rc) { +cERROR (1 ,"Error %d during NTLMv2 authentication" , rc); + goto ssetup_exit; + } + +memcpy (bcc_ptr, ses->auth_key.response +CIFS_SESS_KEY_SIZE , + ses->auth_key.len -CIFS_SESS_KEY_SIZE ); + bcc_ptr += ses->auth_key.len -CIFS_SESS_KEY_SIZE ; -/* set case sensitive password length after tilen may get -* assigned, tilen is 0 otherwise. -*/ - pSMB->req_no_secext.CaseSensitivePasswordLength = -cpu_to_le16 (ses->auth_key.len -CIFS_SESS_KEY_SIZE ); +/* set case sensitive password length after tilen may get +* assigned, tilen is 0 otherwise. +*/ + pSMB->req_no_secext.CaseSensitivePasswordLength = +cpu_to_le16 (ses->auth_key.len -CIFS_SESS_KEY_SIZE ); + }else { + pSMB->req_no_secext.CaseSensitivePasswordLength =0 ; + }if (ses->capabilities &CAP_UNICODE ) {if (iov[0 ].iov_len %2 ) {
PATCH 65/94 IB/mlx4: Fix the SQ size of an RC QP
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <[email protected]>
commit f2940e2c76bb554a7fbdd28ca5b90904117a9e96 upstream.
When calculating the required size of an RC QP send queue, leave enough space for masked atomic operations, which require more space than "regular" atomic operation.
--- drivers/infiniband/hw/mlx4/qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/qp.c +1 -1
@@ -283,7 +283,7 @@ static int send_wqe_overhead(enum ib_qp_sizeof (struct mlx4_wqe_raddr_seg );case IB_QPT_RC :return sizeof (struct mlx4_wqe_ctrl_seg ) + -sizeof (struct mlx4_wqe_atomic_seg ) + +sizeof (struct mlx4_wqe_masked_atomic_seg ) +sizeof (struct mlx4_wqe_raddr_seg );case IB_QPT_SMI :case IB_QPT_GSI :
PATCH 15/94 MIPS: Adjust set_pte() SMP fix to handle R10000_LLSC_WAR
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Kinard <[email protected]>
commit 128639395b2ceacc6a56a0141d0261012bfe04d3 upstream.
Update the recent changes to set_pte() that were added in 46011e6ea392 to handle R10000_LLSC_WAR, and format the assembly to match other areas of the MIPS tree using the same WAR.
This also incorporates a patch recently sent in my Markos Chandras, "Remove local LL/SC preprocessor variants", so that patch doesn't need to be applied if this one is accepted.
Patchwork: https://patchwork.linux-mips.org/patch/11103/
[bwh: Backported to 3.2:
- Use {LL,SC}_INSN not __{LL,SC}
- Use literal arch=r4000 instead of MIPS_ISA_ARCH_LEVEL since R6 is not supported]
--- arch/mips/include/asm/pgtable.h | 45 +++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 13 deletions(-)
arch/mips/include/asm/pgtable.h +32 -13
@@ -168,20 +168,39 @@ static inline void set_pte(pte_t *ptep,unsigned long page_global = _PAGE_GLOBAL;unsigned long tmp; - __asm__ __volatile__ ( -" .set push\n" -" .set noreorder\n" -"1: " LL_INSN " %[tmp], %[buddy]\n" -" bnez %[tmp], 2f\n" -" or %[tmp], %[tmp], %[global]\n" -" " SC_INSN " %[tmp], %[buddy]\n" -" beqz %[tmp], 1b\n" -" nop\n" -"2:\n" -" .set pop" - : [buddy]"+m" (buddy->pte), - [tmp]"=&r" (tmp) +if (kernel_uses_llsc &&R10000_LLSC_WAR ) { + __asm__ __volatile__ ( +" .set arch=r4000 \n" +" .set push \n" +" .set noreorder \n" +"1:" LL_INSN " %[tmp], %[buddy] \n" +" bnez %[tmp], 2f \n" +" or %[tmp], %[tmp], %[global] \n" +SC_INSN " %[tmp], %[buddy] \n" +" beqzl %[tmp], 1b \n" +" nop \n" +"2: \n" +" .set pop \n" +" .set mips0 \n" + : [buddy]"+m" (buddy->pte), [tmp]"=&r" (tmp) : [global]"r" (page_global)); + }else if (kernel_uses_llsc) { + __asm__ __volatile__ ( +" .set arch=r4000 \n" +" .set push \n" +" .set noreorder \n" +"1:" LL_INSN " %[tmp], %[buddy] \n" +" bnez %[tmp], 2f \n" +" or %[tmp], %[tmp], %[global] \n" +SC_INSN " %[tmp], %[buddy] \n" +" beqz %[tmp], 1b \n" +" nop \n" +"2: \n" +" .set pop \n" +" .set mips0 \n" + : [buddy]"+m" (buddy->pte), [tmp]"=&r" (tmp) + : [global]"r" (page_global)); + }#else /* !CONFIG_SMP */ if (pte_none (*buddy))pte_val (*buddy) =pte_val (*buddy) | _PAGE_GLOBAL;
Quoted 14 lines · Guenter Roeck
Quoted 9 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.82 release.
There are 94 patches in this series, which will be posted as responses
to this one. If anyone has any issues with these being applied, please
let me know.Quoted 3 lines
Responses should be made by Tue Aug 16 00:00:00 UTC 2016. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 89 pass: 89 fail: 0 Qemu test results: total: 61 pass: 61 fail: 0Details are available at http://kerneltests.org/builders/
Thanks for checking.
Ben.
Signature · 3 lines
Ben Hutchings Make three consecutive correct guesses and you will be considered an expert.
PATCH 67/94 Input: elantech - add more IC body types to the list
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 226ba707744a51acb4244724e09caacb1d96aed9 upstream.
The touchpad in HP Pavilion 14-ab057ca reports it's version as 12 and according to Elan both 11 and 12 are valid IC types and should be identified as hw_version 4.
--- drivers/input/mouse/elantech.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/input/mouse/elantech.c +1 -7
@@ -1284,13 +1284,7 @@ static int elantech_set_properties(struccase 5 : etd->hw_version =3 ;break ; -case 6 : -case 7 : -case 8 : -case 9 : -case 10 : -case 13 : -case 14 : + case 6 ... 14: etd->hw_version =4 ;break ;default :
PATCH 34/94 RDMA/cxgb3: device driver frees DMA memory with different size
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Honggang Li <[email protected]>
commit 0de4cbb3dddca35ecd06b95918f38439c9c6401f upstream.
[ 598.852037] ------------[ cut here ]------------ [ 598.856698] WARNING: at lib/dma-debug.c:887 check_unmap+0xf8/0x920() [ 598.863079] cxgb3 0000:01:00.0: DMA-API: device driver frees DMA memory with different size [device address=0x0000000003310000] [map size=17 bytes] [unmap size=16 bytes] [ 598.878265] Modules linked in: xprtrdma ib_isert iscsi_target_mod ib_iser libiscsi scsi_transport_iscsi ib_srpt target_core_mod ib_srp scsi_transport_srp scsi_tgt ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm ib_sa ib_mad kvm_amd kvm ipmi_devintf ipmi_ssif dcdbas pcspkr ipmi_si sg ipmi_msghandler acpi_power_meter amd64_edac_mod shpchp edac_core sp5100_tco k10temp edac_mce_amd i2c_piix4 acpi_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic crct10dif_common ata_generic iw_cxgb3 pata_acpi ib_core ib_addr mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit drm_kms_helper ttm pata_atiixp drm ahci libahci serio_raw i2c_core cxgb3 libata bnx2 mdio dm_mirror dm_region_hash dm_log dm_mod [ 598.946822] CPU: 3 PID: 11820 Comm: cmtime Not tainted 3.10.0-327.el7.x86_64.debug #1 [ 598.954681] Hardware name: Dell Inc. PowerEdge R415/0GXH08, BIOS 2.0.2 10/22/2012 [ 598.962193] ffff8808077479a8 000000000381a432 ffff880807747960 ffffffff81700918 [ 598.969663] ffff880807747998 ffffffff8108b6c0 ffff880807747a80 ffff8808063f55c0 [ 598.977132] ffffffff833ca850 0000000000000282 ffff88080b1bb800 ffff880807747a00 [ 598.984602] Call Trace: [ 598.987062] [<ffffffff81700918>] dump_stack+0x19/0x1b [ 598.992224] [<ffffffff8108b6c0>] warn_slowpath_common+0x70/0xb0 [ 598.998254] [<ffffffff8108b75c>] warn_slowpath_fmt+0x5c/0x80 [ 599.004033] [<ffffffff813903b8>] check_unmap+0xf8/0x920 [ 599.009369] [<ffffffff81025959>] ? sched_clock+0x9/0x10 [ 599.014702] [<ffffffff81390cee>] debug_dma_free_coherent+0x7e/0xa0 [ 599.021008] [<ffffffffa01ece2c>] cxio_destroy_cq+0xcc/0x160 [iw_cxgb3] [ 599.027654] [<ffffffffa01e8da0>] iwch_destroy_cq+0xf0/0x140 [iw_cxgb3] [ 599.034307] [<ffffffffa01c4bfe>] ib_destroy_cq+0x1e/0x30 [ib_core] [ 599.040601] [<ffffffffa04ff2d2>] ib_uverbs_close+0x302/0x4d0 [ib_uverbs] [ 599.047417] [<ffffffff812335a2>] __fput+0x102/0x310 [ 599.052401] [<ffffffff8123388e>] ____fput+0xe/0x10 [ 599.057297] [<ffffffff810bbde4>] task_work_run+0xb4/0xe0 [ 599.062719] [<ffffffff81092a84>] do_exit+0x304/0xc60 [ 599.067789] [<ffffffff81025905>] ? native_sched_clock+0x35/0x80 [ 599.073820] [<ffffffff81025959>] ? sched_clock+0x9/0x10 [ 599.079153] [<ffffffff8170a49c>] ? _raw_spin_unlock_irq+0x2c/0x50 [ 599.085358] [<ffffffff8109346c>] do_group_exit+0x4c/0xc0 [ 599.090779] [<ffffffff810a8661>] get_signal_to_deliver+0x2e1/0x960 [ 599.097071] [<ffffffff8101c497>] do_signal+0x57/0x6e0 [ 599.102229] [<ffffffff81714bd1>] ? sysret_signal+0x5/0x4e [ 599.107738] [<ffffffff8101cb7f>] do_notify_resume+0x5f/0xb0 [ 599.113418] [<ffffffff81714e7d>] int_signal+0x12/0x17 [ 599.118576] ---[ end trace 1e4653102e7e7019 ]--- [ 599.123211] Mapped at: [ 599.125577] [<ffffffff8138ed8b>] debug_dma_alloc_coherent+0x2b/0x80 [ 599.131968] [<ffffffffa01ec862>] cxio_create_cq+0xf2/0x1f0 [iw_cxgb3] [ 599.139920] [<ffffffffa01e9c05>] iwch_create_cq+0x105/0x4e0 [iw_cxgb3] [ 599.147895] [<ffffffffa0500584>] create_cq.constprop.14+0x184/0x2e0 [ib_uverbs] [ 599.156649] [<ffffffffa05027fb>] ib_uverbs_create_cq+0x10b/0x140 [ib_uverbs]
--- drivers/infiniband/hw/cxgb3/cxio_hal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/cxgb3/cxio_hal.c +1 -1
@@ -327,7 +327,7 @@ int cxio_destroy_cq(struct cxio_rdev *rdkfree (cq->sw_queue);dma_free_coherent (&(rdev_p->rnic_info.pdev->dev), (1UL << (cq->size_log2)) - *sizeof (struct t3_cqe ), cq->queue, + *sizeof (struct t3_cqe ) +1 , cq->queue,dma_unmap_addr (cq, mapping));cxio_hal_put_cqid (rdev_p->rscp, cq->cqid);return err;
PATCH 82/94 xenbus: don't BUG() on user mode induced condition
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 0beef634b86a1350c31da5fcc2992f0d7c8a622b upstream.
Inability to locate a user mode specified transaction ID should not lead to a kernel crash. For other than XS_TRANSACTION_START also don't issue anything to xenbus if the specified ID doesn't match that of any active transaction.
--- drivers/xen/xenfs/xenbus.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/xen/xenfs/xenbus.c +8 -6
@@ -310,11 +310,18 @@ static int xenbus_write_transaction(unsi rc = -ENOMEM ; goto out; } + }else { +list_for_each_entry (trans, &u->transactions, list) +if (trans->handle.id == u->u.msg.tx_id) +break ; +if (&trans->list == &u->transactions) +return -ESRCH ; } reply =xenbus_dev_request_and_reply (&u->u.msg);if (IS_ERR (reply)) { -kfree (trans); +if (msg_type ==XS_TRANSACTION_START ) +kfree (trans); rc =PTR_ERR (reply); goto out; }
@@ -324,12 +331,7 @@ static int xenbus_write_transaction(unsilist_add (&trans->list, &u->transactions); }else if (msg_type ==XS_TRANSACTION_END ) { -list_for_each_entry (trans, &u->transactions, list) -if (trans->handle.id == u->u.msg.tx_id) -break ; -BUG_ON (&trans->list == &u->transactions);list_del (&trans->list); -kfree (trans); }
PATCH 36/94 Input: pwm-beeper - remove useless call to pwm_config()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Sobrie <[email protected]>
commit d1b12075ffa808dce33dd46b7ad035bebf8da215 upstream.
Calling pwm_config() with a period equal to zero always results in error (-EINVAL) and pwm chip config method is never called.
--- drivers/input/misc/pwm-beeper.c | 1 - 1 file changed, 1 deletion(-)
drivers/input/misc/pwm-beeper.c +0 -1
@@ -49,7 +49,6 @@ static int pwm_beeper_event(struct input }if (value ==0 ) { -pwm_config (beeper->pwm,0 ,0 );pwm_disable (beeper->pwm); }else { period =HZ_TO_NANOSECONDS (value);
PATCH 16/94 gcov: disable tree-loop-im to reduce stack usage
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit c87bf431448b404a6ef5fbabd74c0e3e42157a7f upstream.
Enabling CONFIG_GCOV_PROFILE_ALL produces us a lot of warnings like
lib/lz4/lz4hc_compress.c: In function 'lz4_compresshcctx':lib/lz4/lz4hc_compress.c:514:1: warning: the frame size of 1504 bytes is larger than 1024 bytes [-Wframe-larger-than=]
After some investigation, I found that this behavior started with gcc-4.9, and opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69702.
A suggested workaround for it is to use the -fno-tree-loop-im flag that turns off one of the optimization stages in gcc, so the code runs a little slower but does not use excessive amounts of stack.
We could make this conditional on the gcc version, but I could not find an easy way to do this in Kbuild and the benefit would be fairly small, given that most of the gcc version in production are affected now.
I'm marking this for 'stable' backports because it addresses a bug with code generation in gcc that exists in all kernel versions with the affected gcc releases.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -352,7 +352,7 @@ AFLAGS_MODULE = LDFLAGS_MODULE = CFLAGS_KERNEL = AFLAGS_KERNEL = -CFLAGS_GCOV = -fprofile-arcs -ftest-coverage +CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im # Use LINUXINCLUDE when you must reference the include/ directory.
PATCH 49/94 iio: Fix error handling in iio_trigger_attach_poll_func
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Crestez Dan Leonard <[email protected]>
commit 99543823357966ac938d9a310947e731b67338e6 upstream.
When attaching a pollfunc iio_trigger_attach_poll_func will allocate a virtual irq and call the driver's set_trigger_state function. Fix error handling to undo previous steps if any fails.
In particular this fixes handling errors from a driver's set_trigger_state function. When using triggered buffers a failure to enable the trigger used to make the buffer unusable.
--- drivers/staging/iio/industrialio-trigger.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/staging/iio/industrialio-trigger.c +18 -5
@@ -218,22 +218,35 @@ static int iio_trigger_attach_poll_func(/* Prevent the module being removed whilst attached to a trigger */ __module_get (pf->indio_dev->info->driver_module); + +/* Get irq number */ pf->irq =iio_trigger_get_irq (trig); +if (pf->irq <0 ) + goto out_put_module; + +/* Request irq */ ret =request_threaded_irq (pf->irq, pf->h, pf->thread, pf->type, pf->name, pf); -if (ret <0 ) { -module_put (pf->indio_dev->info->driver_module); -return ret; - } +if (ret <0 ) + goto out_put_irq; +/* Enable trigger in driver */ if (trig->ops && trig->ops->set_trigger_state && notinuse) { ret = trig->ops->set_trigger_state (trig, true);if (ret <0 ) -module_put (pf->indio_dev->info->driver_module); + goto out_free_irq; }return ret; + +out_free_irq: +free_irq (pf->irq, pf); +out_put_irq: +iio_trigger_put_irq (trig, pf->irq); +out_put_module: +module_put (pf->indio_dev->info->driver_module); +return ret; } static int iio_trigger_dettach_poll_func(struct iio_trigger *trig,
PATCH 7/94 btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Luke Dashjr <[email protected]>
commit 4c63c2454eff996c5e27991221106eb511f7db38 upstream.
32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr fail.
--- fs/btrfs/ctree.h | 1 + fs/btrfs/file.c | 2 +- fs/btrfs/inode.c | 2 +- fs/btrfs/ioctl.c | 21 +++++++++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-)
fs/btrfs/ctree.h +1 -0
@@ -2749,6 +2749,7 @@ extern const struct dentry_operations bt/* ioctl.c */ long btrfs_ioctl (struct file *file,unsigned int cmd,unsigned long arg); +long btrfs_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg);void btrfs_update_iflags (struct inode *inode);void btrfs_inherit_iflags (struct inode *inode,struct inode *dir); int btrfs_defrag_file(struct inode *inode, struct file *file,
fs/btrfs/file.c +1 -1
@@ -1895,6 +1895,6 @@ const struct file_operations btrfs_file_ .fallocate = btrfs_fallocate, .unlocked_ioctl = btrfs_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = btrfs_ioctl, + .compat_ioctl = btrfs_compat_ioctl,#endif };
fs/btrfs/inode.c +1 -1
@@ -7475,7 +7475,7 @@ static const struct file_operations btrf .readdir = btrfs_real_readdir, .unlocked_ioctl = btrfs_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = btrfs_ioctl, + .compat_ioctl = btrfs_compat_ioctl, #endif .release = btrfs_release_file, .fsync = btrfs_sync_file,
fs/btrfs/ioctl.c +21 -0
@@ -3260,3 +3260,24 @@ long btrfs_ioctl(struct file *file, unsireturn -ENOTTY ; } + +#ifdef CONFIG_COMPAT +long btrfs_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +switch (cmd) { +case FS_IOC32_GETFLAGS : + cmd =FS_IOC_GETFLAGS ; +break ; +case FS_IOC32_SETFLAGS : + cmd =FS_IOC_SETFLAGS ; +break ; +case FS_IOC32_GETVERSION : + cmd =FS_IOC_GETVERSION ; +break ; +default : +return -ENOIOCTLCMD ; + } + +return btrfs_ioctl (file, cmd, (unsigned long )compat_ptr (arg)); +} +#endif
PATCH 27/94 fs/cifs: correctly to anonymous authentication for the NTLM(v1) authentication
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
commit 777f69b8d26bf35ade4a76b08f203c11e048365d upstream.
Only server which map unknown users to guest will allow access using a non-null NTChallengeResponse.
For Samba it's the "map to guest = bad user" option.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
[bwh: Backported to 3.2:
- Adjust context, indentation
- Keep using cERROR()]
---
fs/cifs/sess.c +23 -17
@@ -686,25 +686,31 @@ ssetup_ntlmssp_authenticate:#endif }else if (type ==NTLM ) { pSMB->req_no_secext.Capabilities =cpu_to_le32 (capabilities); - pSMB->req_no_secext.CaseInsensitivePasswordLength = -cpu_to_le16 (CIFS_AUTH_RESP_SIZE ); - pSMB->req_no_secext.CaseSensitivePasswordLength = -cpu_to_le16 (CIFS_AUTH_RESP_SIZE ); +if (ses->user_name !=NULL ) { + pSMB->req_no_secext.CaseInsensitivePasswordLength = +cpu_to_le16 (CIFS_AUTH_RESP_SIZE ); + pSMB->req_no_secext.CaseSensitivePasswordLength = +cpu_to_le16 (CIFS_AUTH_RESP_SIZE ); -/* calculate ntlm response and session key */ - rc =setup_ntlm_response (ses, nls_cp); -if (rc) { -cERROR (1 ,"Error %d during NTLM authentication" , rc); - goto ssetup_exit; - } +/* calculate ntlm response and session key */ + rc =setup_ntlm_response (ses, nls_cp); +if (rc) { +cERROR (1 ,"Error %d during NTLM authentication" , + rc); + goto ssetup_exit; + } -/* copy ntlm response */ -memcpy (bcc_ptr, ses->auth_key.response +CIFS_SESS_KEY_SIZE , -CIFS_AUTH_RESP_SIZE ); - bcc_ptr +=CIFS_AUTH_RESP_SIZE ; -memcpy (bcc_ptr, ses->auth_key.response +CIFS_SESS_KEY_SIZE , -CIFS_AUTH_RESP_SIZE ); - bcc_ptr +=CIFS_AUTH_RESP_SIZE ; +/* copy ntlm response */ +memcpy (bcc_ptr, ses->auth_key.response +CIFS_SESS_KEY_SIZE , +CIFS_AUTH_RESP_SIZE ); + bcc_ptr +=CIFS_AUTH_RESP_SIZE ; +memcpy (bcc_ptr, ses->auth_key.response +CIFS_SESS_KEY_SIZE , +CIFS_AUTH_RESP_SIZE ); + bcc_ptr +=CIFS_AUTH_RESP_SIZE ; + }else { + pSMB->req_no_secext.CaseInsensitivePasswordLength =0 ; + pSMB->req_no_secext.CaseSensitivePasswordLength =0 ; + }if (ses->capabilities &CAP_UNICODE ) {/* unicode strings must be word aligned */
PATCH 31/94 Input: uinput - handle compat ioctl for UI_SET_PHYS
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ricky Liang <[email protected]>
commit affa80bd97f7ca282d1faa91667b3ee9e4c590e6 upstream.
When running a 32-bit userspace on a 64-bit kernel, the UI_SET_PHYS ioctl needs to be treated with special care, as it has the pointer size encoded in the command.
--- drivers/input/misc/uinput.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/misc/uinput.c +6 -0
@@ -786,8 +786,14 @@ static long uinput_ioctl(struct file *fi }#ifdef CONFIG_COMPAT + +#define UI_SET_PHYS_COMPAT _IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t) +static long uinput_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +if (cmd ==UI_SET_PHYS_COMPAT ) + cmd =UI_SET_PHYS ; +return uinput_ioctl_handler (file, cmd, arg,compat_ptr (arg)); }#endif
PATCH 19/94 powerpc/mm/hash64: Fix subpage protection with 4K HPTE config
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit aac55d7573c5d46ed9a62818d5d3e69dd2060105 upstream.
With Linux page size of 64K and hardware only supporting 4K HPTE, if we use subpage protection, we always fail for the subpage 0 as shown below (using the selftest subpage_prot test):
520175565: (4520111850): Failed at 0x3fffad4b0000 (p=13,sp=0,w=0), want=fault, got=pass ! 4520890210: (4520826495): Failed at 0x3fffad5b0000 (p=29,sp=0,w=0), want=fault, got=pass ! 4521574251: (4521510536): Failed at 0x3fffad6b0000 (p=45,sp=0,w=0), want=fault, got=pass ! 4522258324: (4522194609): Failed at 0x3fffad7b0000 (p=61,sp=0,w=0), want=fault, got=pass !
This is because hash preload wrongly inserts the HPTE entry for subpage 0 without looking at the subpage protection information.
Fix it by teaching should_hash_preload() not to preload if we have subpage protection configured for that range.
It appears this has been broken since it was introduced in 2008.
--- arch/powerpc/mm/hash_utils_64.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/powerpc/mm/hash_utils_64.c +9 -1
@@ -1077,8 +1077,16 @@ EXPORT_SYMBOL_GPL(hash_page);#ifdef CONFIG_PPC_MM_SLICES static bool should_hash_preload (struct mm_struct *mm,unsigned long ea) { +int psize =get_slice_psize (mm, ea); +/* We only prefault standard pages for now */ -if (unlikely (get_slice_psize (mm, ea) != mm->context.user_psize)) +if (unlikely (psize != mm->context.user_psize)) +return false; + +/* +* Don't prefault if subpage protection is enabled for the EA. +*/ +if (unlikely ((psize ==MMU_PAGE_4K ) &&subpage_protection (mm, ea)))return false;return true;
PATCH 56/94 IB/mlx4: Properly initialize GRH TClass and FlowLabel in AHs
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
commit 8c5122e45a10a9262f872b53f151a592e870f905 upstream.
When this code was reworked for IBoE support the order of assignments for the sl_tclass_flowlabel got flipped around resulting in TClass & FlowLabel being permanently set to 0 in the packet headers.
This breaks IB routers that rely on these headers, but only affects kernel users - libmlx4 does this properly for user space.
--- drivers/infiniband/hw/mlx4/ah.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/ah.c +1 -1
@@ -65,6 +65,7 @@ static struct ib_ah *create_ib_ah(struct ah->av.ib.port_pd =cpu_to_be32 (to_mpd (pd)->pdn | (ah_attr->port_num <<24 )); ah->av.ib.g_slid = ah_attr->src_path_bits; + ah->av.ib.sl_tclass_flowlabel =cpu_to_be32 (ah_attr->sl <<28 );if (ah_attr->ah_flags &IB_AH_GRH ) { ah->av.ib.g_slid |=0x80 ; ah->av.ib.gid_index = ah_attr->grh.sgid_index;
@@ -82,7 +83,6 @@ static struct ib_ah *create_ib_ah(struct !(1 << ah->av.ib.stat_rate & dev->caps.stat_rate_support)) --ah->av.ib.stat_rate; } - ah->av.ib.sl_tclass_flowlabel =cpu_to_be32 (ah_attr->sl <<28 );return &ah->ibah; }
PATCH 14/94 ACPI / sysfs: fix error code in get_status()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit f18ebc211e259d4f591e39e74b2aa2de226c9a1d upstream.
The problem with ornamental, do-nothing gotos is that they lead to "forgot to set the error code" bugs. We should be returning -EINVAL here but we don't. It leads to an uninitalized variable in counter_show():
drivers/acpi/sysfs.c:603 counter_show()
error: uninitialized symbol 'status'.
--- drivers/acpi/sysfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/sysfs.c +3 -4
@@ -489,23 +489,22 @@ static void acpi_gbl_event_handler(u32 estatic int get_status (u32 index,acpi_event_status *status,acpi_handle *handle) { -int result =0 ; +int result;if (index >= num_gpes +ACPI_NUM_FIXED_EVENTS ) - goto end; +return -EINVAL ;if (index < num_gpes) { result =acpi_get_gpe_device (index, handle);if (result) {ACPI_EXCEPTION ((AE_INFO ,AE_NOT_FOUND ,"Invalid GPE 0x%x\n" , index)); - goto end; +return result; } result =acpi_get_gpe_status (*handle, index, status); }else if (index < (num_gpes +ACPI_NUM_FIXED_EVENTS )) result =acpi_get_event_status (index - num_gpes, status); -end:return result; }
PATCH 8/94 aacraid: Fix for aac_command_thread hang
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Raghava Aditya Renukunta <[email protected]>
commit fc4bf75ea300a5e62a2419f89dd0e22189dd7ab7 upstream.
Typically under error conditions, it is possible for aac_command_thread() to miss the wakeup from kthread_stop() and go back to sleep, causing it to hang aac_shutdown.
In the observed scenario, the adapter is not functioning correctly and so aac_fib_send() never completes (or time-outs depending on how it was called). Shortly after aac_command_thread() starts it performs aac_fib_send(SendHostTime) which hangs. When aac_probe_one /aac_get_adapter_info send time outs, kthread_stop is called which breaks the command thread out of it's hang.
The code will still go back to sleep in schedule_timeout() without checking kthread_should_stop() so it causes aac_probe_one to hang until the schedule_timeout() which is 30 minutes.
Fixed by: Adding another kthread_should_stop() before schedule_timeout()
--- drivers/scsi/aacraid/commsup.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/aacraid/commsup.c +4 -0
@@ -1890,6 +1890,10 @@ int aac_command_thread(void *data)if (difference <=0 ) difference =1 ;set_current_state (TASK_INTERRUPTIBLE ); + +if (kthread_should_stop ()) +break ; +schedule_timeout (difference);if (kthread_should_stop ())
PATCH 33/94 xen/events: Don't move disabled irqs
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
commit f0f393877c71ad227d36705d61d1e4062bc29cf5 upstream.
Commit ff1e22e7a638 ("xen/events: Mask a moving irq") open-coded irq_move_irq() but left out checking if the IRQ is disabled. This broke resuming from suspend since it tries to move a (disabled) irq without holding the IRQ's desc->lock. Fix it by adding in a check for disabled IRQs.
The resulting stacktrace was:
kernel BUG at /build/linux-UbQGH5/linux-4.4.0/kernel/irq/migration.c:31! invalid opcode: 0000 [#1] SMP
Modules linked in: xenfs xen_privcmd ... CPU: 0 PID: 9 Comm: migration/0 Not tainted 4.4.0-22-generic #39-Ubuntu Hardware name: Xen HVM domU, BIOS 4.6.1-xs125180 05/04/2016 task: ffff88003d75ee00 ti: ffff88003d7bc000 task.ti: ffff88003d7bc000 RIP: 0010:[<ffffffff810e26e2>] [<ffffffff810e26e2>] irq_move_masked_irq+0xd2/0xe0 RSP: 0018:ffff88003d7bfc50 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffff88003d40ba00 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000100 RDI: ffff88003d40bad8 RBP: ffff88003d7bfc68 R08: 0000000000000000 R09: ffff88003d000000 R10: 0000000000000000 R11: 000000000000023c R12: ffff88003d40bad0 R13: ffffffff81f3a4a0 R14: 0000000000000010 R15: 00000000ffffffff FS: 0000000000000000(0000) GS:ffff88003da00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fd4264de624 CR3: 0000000037922000 CR4: 00000000003406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffff88003d40ba38 0000000000000024 0000000000000000 ffff88003d7bfca0 ffffffff814c8d92 00000010813ef89d 00000000805ea732 0000000000000009 0000000000000024 ffff88003cc39b80 ffff88003d7bfce0 ffffffff814c8f66 Call Trace: [<ffffffff814c8d92>] eoi_pirq+0xb2/0xf0 [<ffffffff814c8f66>] __startup_pirq+0xe6/0x150 [<ffffffff814ca659>] xen_irq_resume+0x319/0x360 [<ffffffff814c7e75>] xen_suspend+0xb5/0x180 [<ffffffff81120155>] multi_cpu_stop+0xb5/0xe0 [<ffffffff811200a0>] ? cpu_stop_queue_work+0x80/0x80 [<ffffffff811203d0>] cpu_stopper_thread+0xb0/0x140 [<ffffffff810a94e6>] ? finish_task_switch+0x76/0x220 [<ffffffff810ca731>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20 [<ffffffff810a3935>] smpboot_thread_fn+0x105/0x160 [<ffffffff810a3830>] ? sort_range+0x30/0x30 [<ffffffff810a0588>] kthread+0xd8/0xf0 [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0 [<ffffffff8182568f>] ret_from_fork+0x3f/0x70 [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0
--- drivers/xen/events.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/xen/events.c +4 -2
@@ -516,7 +516,8 @@ static void eoi_pirq(struct irq_data *daif (!VALID_EVTCHN (evtchn))return ; -if (unlikely (irqd_is_setaffinity_pending (data))) { +if (unlikely (irqd_is_setaffinity_pending (data)) && +likely (!irqd_irq_disabled (data))) {int masked =test_and_set_mask (evtchn);clear_evtchn (evtchn);
@@ -1446,7 +1447,8 @@ static void ack_dynirq(struct irq_data *if (!VALID_EVTCHN (evtchn))return ; -if (unlikely (irqd_is_setaffinity_pending (data))) { +if (unlikely (irqd_is_setaffinity_pending (data)) && +likely (!irqd_irq_disabled (data))) {int masked =test_and_set_mask (evtchn);clear_evtchn (evtchn);
PATCH 92/94 rds: fix an infoleak in rds_inc_info_copy
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit 4116def2337991b39919f3b448326e21c40e0dbb upstream.
The last field "flags" of object "minfo" is not initialized. Copying this object out may leak kernel stack data. Assign 0 to it to avoid leak.
--- net/rds/recv.c | 2 ++ 1 file changed, 2 insertions(+)
net/rds/recv.c +2 -0
@@ -544,5 +544,7 @@ void rds_inc_info_copy(struct rds_incomi minfo.fport = inc->i_hdr.h_dport; } + minfo.flags =0 ; +rds_info_copy (iter, &minfo,sizeof (minfo)); }
PATCH 68/94 HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Scott Bauer <[email protected]>
commit 93a2001bdfd5376c3dc2158653034c20392d15c5 upstream.
This patch validates the num_values parameter from userland during the HIDIOCGUSAGES and HIDIOCSUSAGES commands. Previously, if the report id was set to HID_REPORT_ID_UNKNOWN, we would fail to validate the num_values parameter leading to a heap overflow.
--- drivers/hid/usbhid/hiddev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hid/usbhid/hiddev.c +5 -5
@@ -515,13 +515,13 @@ static noinline int hiddev_ioctl_usage(s goto inval; }else if (uref->usage_index >= field->report_count) goto inval; - -else if ((cmd ==HIDIOCGUSAGES || cmd ==HIDIOCSUSAGES ) && - (uref_multi->num_values >HID_MAX_MULTI_USAGES || - uref->usage_index + uref_multi->num_values > field->report_count)) - goto inval; } +if ((cmd ==HIDIOCGUSAGES || cmd ==HIDIOCSUSAGES ) && + (uref_multi->num_values >HID_MAX_MULTI_USAGES || + uref->usage_index + uref_multi->num_values > field->report_count)) + goto inval; +switch (cmd) {case HIDIOCGUSAGE : uref->value = field->value[uref->usage_index];
PATCH 78/94 etherdevice: introduce help function eth_zero_addr()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Duan Jiong <[email protected]>
commit 6d57e9078e880a3dd232d579f42ac437a8f1ef7b upstream.
a lot of code has either the memset or an inefficient copy from a static array that contains the all-zeros Ethernet address. Introduce help function eth_zero_addr() to fill an address with all zeros, making the code clearer and allowing us to get rid of some constant arrays.
--- include/linux/etherdevice.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/etherdevice.h +11 -0
@@ -140,6 +140,17 @@ static inline void random_ether_addr(u8 }/** +* eth_zero_addr - Assign zero address +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Assign the zero address to the given address array. +*/ +static inline void eth_zero_addr (u8 *addr) +{ +memset (addr,0x00 ,ETH_ALEN ); +} + +/** * dev_hw_addr_random - Create random MAC and set device flag * @dev: pointer to net_device structure * @hwaddr: Pointer to a six-byte array containing the Ethernet address
PATCH 47/94 usb: musb: Stop bulk endpoint while queue is rotated
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Goodbody <[email protected]>
commit 7b2c17f829545df27a910e8d82e133c21c9a8c9c upstream.
Ensure that the endpoint is stopped by clearing REQPKT before clearing DATAERR_NAKTIMEOUT before rotating the queue on the dedicated bulk endpoint.
This addresses an issue where a race could result in the endpoint receiving data before it was reprogrammed resulting in a warning about such data from musb_rx_reinit before it was thrown away. The data thrown away was a valid packet that had been correctly ACKed which meant the host and device got out of sync.
--- drivers/usb/musb/musb_host.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_host.c +7 -1
@@ -1384,9 +1384,15 @@ static void musb_bulk_rx_nak_timeout(strmusb_ep_select (mbase, ep->epnum); dma =is_dma_capable () ? ep->rx_channel :NULL ; -/* clear nak timeout bit */ +/* +* Need to stop the transaction by clearing REQPKT first +* then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED +* DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2 +*/ rx_csr =musb_readw (epio,MUSB_RXCSR ); rx_csr |=MUSB_RXCSR_H_WZC_BITS ; + rx_csr &= ~MUSB_RXCSR_H_REQPKT ; +musb_writew (epio,MUSB_RXCSR , rx_csr); rx_csr &= ~MUSB_RXCSR_DATAERROR ;musb_writew (epio,MUSB_RXCSR , rx_csr);
PATCH 81/94 qeth: delete napi struct when removing a qeth device
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ursula Braun <[email protected]>
commit 7831b4ff0d926e0deeaabef9db8800ed069a2757 upstream.
A qeth_card contains a napi_struct linked to the net_device during device probing. This struct must be deleted when removing the qeth device, otherwise Panic on oops can occur when qeth devices are repeatedly removed and added.
--- drivers/s390/net/qeth_l2_main.c | 1 + drivers/s390/net/qeth_l3_main.c | 1 + 2 files changed, 2 insertions(+)
drivers/s390/net/qeth_l2_main.c +1 -0
@@ -897,6 +897,7 @@ static void qeth_l2_remove_device(structqeth_l2_set_offline (cgdev);if (card->dev) { +netif_napi_del (&card->napi);unregister_netdev (card->dev); card->dev =NULL ; }
drivers/s390/net/qeth_l3_main.c +1 -0
@@ -3395,6 +3395,7 @@ static void qeth_l3_remove_device(structqeth_l3_set_offline (cgdev);if (card->dev) { +netif_napi_del (&card->napi);unregister_netdev (card->dev); card->dev =NULL ; }
PATCH 86/94 proc: prevent stacking filesystems on top
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit e54ad7f1ee263ffa5a2de9c609d58dfa27b21cd9 upstream.
This prevents stacking filesystems (ecryptfs and overlayfs) from using procfs as lower filesystem. There is too much magic going on inside procfs, and there is no good reason to stack stuff on top of procfs.
(For example, procfs does access checks in VFS open handlers, and ecryptfs by design calls open handlers from a kernel thread that doesn't drop privileges or so.)
--- fs/proc/root.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/proc/root.c +7 -0
@@ -53,6 +53,13 @@ static struct dentry *proc_mount(structif (IS_ERR (sb))return ERR_CAST (sb); +/* +* procfs isn't actually a stacking filesystem; however, there is +* too much magic going on inside it to permit stacking things on +* top of it +*/ + sb->s_stack_depth =FILESYSTEM_MAX_STACK_DEPTH ; +if (!sb->s_root) { sb->s_flags = flags; err =proc_fill_super (sb);
PATCH 69/94 ALSA: dummy: Fix a use-after-free at closing
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d5dbbe6569481bf12dcbe3e12cff72c5f78d272c upstream.
syzkaller fuzzer spotted a potential use-after-free case in snd-dummy driver when hrtimer is used as backend:
Quoted 30 lines
==================================================================
BUG: KASAN: use-after-free in rb_erase+0x1b17/0x2010 at addr ffff88005e5b6f68 Read of size 8 by task syz-executor/8984 =============================================================================BUG kmalloc-192 (Not tainted): kasan: bad access detected
-----------------------------------------------------------------------------Disabling lock debugging due to kernel taint
INFO: Allocated in0xbbbbbbbbbbbbbbbbage=18446705582212484632
....
[< none >]dummy_hrtimer_create+0x49/0x1a0sound/drivers/dummy.c:464
....
INFO: Freed in0xfffd8e09age=18446705496313138713 cpu=2164287125 pid=-1
[< none >]dummy_hrtimer_free+0x68/0x80sound/drivers/dummy.c:481
....Call Trace: [<ffffffff8179e59e>] __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:333 [< inline >] rb_set_parent include/linux/rbtree_augmented.h:111 [< inline >] __rb_erase_augmented include/linux/rbtree_augmented.h:218 [<ffffffff82ca5787>] rb_erase+0x1b17/0x2010 lib/rbtree.c:427 [<ffffffff82cb02e8>] timerqueue_del+0x78/0x170 lib/timerqueue.c:86 [<ffffffff814d0c80>] __remove_hrtimer+0x90/0x220 kernel/time/hrtimer.c:903 [< inline >] remove_hrtimer kernel/time/hrtimer.c:945 [<ffffffff814d23da>] hrtimer_try_to_cancel+0x22a/0x570 kernel/time/hrtimer.c:1046 [<ffffffff814d2742>] hrtimer_cancel+0x22/0x40 kernel/time/hrtimer.c:1066 [<ffffffff85420531>] dummy_hrtimer_stop+0x91/0xb0 sound/drivers/dummy.c:417 [<ffffffff854228bf>] dummy_pcm_trigger+0x17f/0x1e0 sound/drivers/dummy.c:507 [<ffffffff85392170>] snd_pcm_do_stop+0x160/0x1b0 sound/core/pcm_native.c:1106 [<ffffffff85391b26>] snd_pcm_action_single+0x76/0x120 sound/core/pcm_native.c:956 [<ffffffff85391e01>] snd_pcm_action+0x231/0x290 sound/core/pcm_native.c:974
Quoted 8 lines
[< inline >] snd_pcm_stop sound/core/pcm_native.c:1139 [<ffffffff8539754d>] snd_pcm_drop+0x12d/0x1d0 sound/core/pcm_native.c:1784 [<ffffffff8539d3be>] snd_pcm_common_ioctl1+0xfae/0x2150 sound/core/pcm_native.c:2805 [<ffffffff8539ee91>] snd_pcm_capture_ioctl1+0x2a1/0x5e0 sound/core/pcm_native.c:2976 [<ffffffff8539f2ec>] snd_pcm_kernel_ioctl+0x11c/0x160 sound/core/pcm_native.c:3020 [<ffffffff853d9a44>] snd_pcm_oss_sync+0x3a4/0xa30 sound/core/oss/pcm_oss.c:1693 [<ffffffff853da27d>] snd_pcm_oss_release+0x1ad/0x280 sound/core/oss/pcm_oss.c:2483 .....
A workaround is to call hrtimer_cancel() in dummy_hrtimer_sync() which is called certainly before other blocking ops.
--- sound/drivers/dummy.c | 1 + 1 file changed, 1 insertion(+)
sound/drivers/dummy.c +1 -0
@@ -419,6 +419,7 @@ static int dummy_hrtimer_stop(struct sndstatic inline void dummy_hrtimer_sync (struct dummy_hrtimer_pcm *dpcm) { +hrtimer_cancel (&dpcm->timer);tasklet_kill (&dpcm->tasklet); }
PATCH 38/94 mac80211_hwsim: Add missing check for HWSIM_ATTR_SIGNAL
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Martin Willi <[email protected]>
commit 62397da50bb20a6b812c949ef465d7e69fe54bb6 upstream.
A wmediumd that does not send this attribute causes a NULL pointer dereference, as the attribute is accessed even if it does not exist.
The attribute was required but never checked ever since userspace frame forwarding has been introduced. The issue gets more problematic once we allow wmediumd registration from user namespaces.
--- drivers/net/wireless/mac80211_hwsim.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mac80211_hwsim.c +1 -0
@@ -1440,6 +1440,7 @@ static int hwsim_tx_info_frame_received_if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER ] || !info->attrs[HWSIM_ATTR_FLAGS ] || !info->attrs[HWSIM_ATTR_COOKIE ] || + !info->attrs[HWSIM_ATTR_SIGNAL ] || !info->attrs[HWSIM_ATTR_TX_INFO ]) goto out;
PATCH 73/94 ALSA: echoaudio: Fix memory allocation
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
commit 9c6795a9b3cbb56a9fbfaf43909c5c22999ba317 upstream.
'commpage_bak' is allocated with 'sizeof(struct echoaudio)' bytes. We then copy 'sizeof(struct comm_page)' bytes in it.
On my system, smatch complains because one is 2960 and the other is 3072.
This would result in memory corruption or a oops.
--- sound/pci/echoaudio/echoaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/echoaudio/echoaudio.c +2 -2
@@ -2251,11 +2251,11 @@ static int snd_echo_resume(struct pci_deDE_INIT (("resume start\n" ));pci_restore_state (pci); - commpage_bak =kmalloc (sizeof (struct echoaudio ),GFP_KERNEL ); + commpage_bak =kmalloc (sizeof (*commpage),GFP_KERNEL );if (commpage_bak ==NULL )return -ENOMEM ; commpage = chip->comm_page; -memcpy (commpage_bak, commpage,sizeof (struct comm_page )); +memcpy (commpage_bak, commpage,sizeof (*commpage)); err =init_hw (chip, chip->pci->device, chip->pci->subsystem_device);if (err <0 ) {
PATCH 2/94 ath5k: Change led pin configuration for compaq c700 laptop
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Salisbury <[email protected]>
commit 7b9bc799a445aea95f64f15e0083cb19b5789abe upstream.
Commit 09c9bae26b0d3c9472cb6ae45010460a2cee8b8d ("ath5k: add led pin configuration for compaq c700 laptop") added a pin configuration for the Compaq c700 laptop. However, the polarity of the led pin is reversed. It should be red for wifi off and blue for wifi on, but it is the opposite. This bug was reported in the following bug report:
http://pad.lv/972604
--- drivers/net/wireless/ath/ath5k/led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/led.c +1 -1
@@ -75,7 +75,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath5k_led/* HP Compaq CQ60-206US ([email protected]) */ { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137a), ATH_LED(3, 1) },/* HP Compaq C700 ([email protected]) */ - { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) }, + { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 0) },/* LiteOn AR5BXB63 ([email protected]) */ { ATH_SDEVICE(PCI_VENDOR_ID_ATHEROS, 0x3067), ATH_LED(3, 0) },/* IBM-specific AR5212 (all others) */
PATCH 44/94 wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Prasun Maiti <[email protected]>
commit 3d5fdff46c4b2b9534fa2f9fc78e90a48e0ff724 upstream.
iwpriv app uses iw_point structure to send data to Kernel. The iw_point structure holds a pointer. For compatibility Kernel converts the pointer as required for WEXT IOCTLs (SIOCIWFIRST to SIOCIWLAST). Some drivers may use iw_handler_def.private_args to populate iwpriv commands instead of iw_handler_def.private. For those case, the IOCTLs from SIOCIWFIRSTPRIV to SIOCIWLASTPRIV will follow the path ndo_do_ioctl(). Accordingly when the filled up iw_point structure comes from 32 bit iwpriv to 64 bit Kernel, Kernel will not convert the pointer and sends it to driver. So, the driver may get the invalid data.
The pointer conversion for the IOCTLs (SIOCIWFIRSTPRIV to SIOCIWLASTPRIV), which follow the path ndo_do_ioctl(), is mandatory. This patch adds pointer conversion from 32 bit to 64 bit and vice versa, if the ioctl comes from 32 bit iwpriv to 64 bit Kernel.
--- net/wireless/wext-core.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
net/wireless/wext-core.c +23 -2
@@ -952,8 +952,29 @@ static int wireless_process_ioctl(structreturn private (dev, iwr, cmd, info, handler); }/* Old driver API : call driver ioctl handler */ -if (dev->netdev_ops->ndo_do_ioctl) -return dev->netdev_ops->ndo_do_ioctl (dev, ifr, cmd); +if (dev->netdev_ops->ndo_do_ioctl) { +#ifdef CONFIG_COMPAT +if (info->flags &IW_REQUEST_FLAG_COMPAT ) { +int ret =0 ; +struct iwreq iwr_lcl; +struct compat_iw_point *iwp_compat = (void *) &iwr->u.data; + +memcpy (&iwr_lcl, iwr,sizeof (struct iwreq )); + iwr_lcl.u.data.pointer =compat_ptr (iwp_compat->pointer); + iwr_lcl.u.data.length = iwp_compat->length; + iwr_lcl.u.data.flags = iwp_compat->flags; + + ret = dev->netdev_ops->ndo_do_ioctl (dev, (void *) &iwr_lcl, cmd); + + iwp_compat->pointer =ptr_to_compat (iwr_lcl.u.data.pointer); + iwp_compat->length = iwr_lcl.u.data.length; + iwp_compat->flags = iwr_lcl.u.data.flags; + +return ret; + } else +#endif +return dev->netdev_ops->ndo_do_ioctl (dev, ifr, cmd); + }return -EOPNOTSUPP ; }
PATCH 22/94 net/mlx4_core: Fix access to uninitialized index
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <[email protected]>
commit 2bb07e155bb3e0c722c806723f737cf8020961ef upstream.
Prevent using uninitialized or negative index when handling steering entries.
--- drivers/net/ethernet/mellanox/mlx4/mcg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/mcg.c +2 -2
@@ -615,7 +615,7 @@ int mlx4_qp_attach_common(struct mlx4_destruct mlx4_mgm *mgm;u32 members_count;u16 hash; -int index, prev; +int index =-1 , prev;int link =0 ;int i;int err;
@@ -693,7 +693,7 @@ int mlx4_qp_attach_common(struct mlx4_de goto out; out: -if (prot ==MLX4_PROT_ETH ) { +if (prot ==MLX4_PROT_ETH && index !=-1 ) {/* manage the steering entry for promisc mode */ if (new_entry)new_steering_entry (dev,0 , port, steer, index, qp->qpn);
PATCH 18/94 powerpc/mm/hash64: Factor out hash preload psize check
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 8bbc9b7b001eaab8abf7e9e24edf1bb285c8d825 upstream.
Currently we have a check in hash_preload() against the psize, which is only included when CONFIG_PPC_MM_SLICES is enabled. We want to expand this check in a subsequent patch, so factor it out to allow that. As a bonus it removes the #ifdef in the C code.
Unfortunately we can't put this in the existing CONFIG_PPC_MM_SLICES block because it would require a forward declaration.
--- arch/powerpc/mm/hash_utils_64.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
arch/powerpc/mm/hash_utils_64.c +17 -4
@@ -1074,6 +1074,22 @@ int hash_page(unsigned long ea, unsigned }EXPORT_SYMBOL_GPL (hash_page); +#ifdef CONFIG_PPC_MM_SLICES +static bool should_hash_preload (struct mm_struct *mm,unsigned long ea) +{ +/* We only prefault standard pages for now */ +if (unlikely (get_slice_psize (mm, ea) != mm->context.user_psize)) +return false; + +return true; +} +#else +static bool should_hash_preload (struct mm_struct *mm,unsigned long ea) +{ +return true; +} +#endif +void hash_preload (struct mm_struct *mm,unsigned long ea,unsigned long access,unsigned long trap) {
@@ -1085,11 +1101,8 @@ void hash_preload(struct mm_struct *mm,BUG_ON (REGION_ID (ea) !=USER_REGION_ID ); -#ifdef CONFIG_PPC_MM_SLICES -/* We only prefault standard pages for now */ -if (unlikely (get_slice_psize (mm, ea) != mm->context.user_psize)) +if (!should_hash_preload (mm, ea))return ; -#endif DBG_LOW ("hash_preload(mm=%p, mm->pgdir=%p, ea=%016lx, access=%lx," " trap=%lx\n" , mm, mm->pgd, ea, access, trap);
PATCH 13/94 USB: serial: option: add even more ZTE device ids
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lei Liu <[email protected]>
commit 74d2a91aec97ab832790c9398d320413ad185321 upstream.
Add even more ZTE device ids.
--- drivers/usb/serial/option.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
drivers/usb/serial/option.c +54 -0
@@ -1688,6 +1688,60 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff9f, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa0, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa1, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa2, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa3, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa4, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa5, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa6, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa7, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa8, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffa9, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffaa, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffab, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffac, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffae, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffaf, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb0, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb1, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb2, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb3, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb4, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb5, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb6, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb7, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb8, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffb9, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffba, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffbb, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffbc, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffbd, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffbe, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffbf, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc0, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc1, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc2, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc3, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc4, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc5, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc6, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc7, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc8, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffc9, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffca, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffcb, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffcc, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffcd, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffce, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffcf, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffd0, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffd1, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffd2, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffd3, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffd4, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffd5, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffe9, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
PATCH 35/94 Input: xpad - prevent spurious input from wired Xbox 360 controllers
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Cameron Gutman <[email protected]>
commit 1ff5fa3c6732f08e01ae12f12286d4728c9e4d86 upstream.
After initially connecting a wired Xbox 360 controller or sending it a command to change LEDs, a status/response packet is interpreted as controller input. This causes the state of buttons represented in byte 2 of the controller data packet to be incorrect until the next valid input packet. Wireless Xbox 360 controllers are not affected.
Writing a new value to the LED device while holding the Start button and running jstest is sufficient to reproduce this bug. An event will come through with the Start button released.
Xboxdrv also won't attempt to read controller input from a packet where byte 0 is non-zero. It also checks that byte 1 is 0x14, but that value differs between wired and wireless controllers and this code is shared by both. I think just checking byte 0 is enough to eliminate unwanted packets.
The following are some examples of 3-byte status packets I saw:
01 03 02
02 03 00
03 03 03
08 03 00
--- drivers/input/joystick/xpad.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/input/joystick/xpad.c +4 -0
@@ -368,6 +368,10 @@ static void xpad360_process_packet(struc {struct input_dev *dev = xpad->dev; +/* valid pad data */ +if (data[0 ] !=0x00 ) +return ; +/* digital pad */ if (xpad->mapping &MAP_DPAD_TO_BUTTONS ) {/* dpad as buttons (left, right, up, down) */
PATCH 90/94 ALSA: timer: Fix leak in events via snd_timer_user_tinterrupt
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit e4ec8cc8039a7063e24204299b462bd1383184a5 upstream.
The stack object “r1” has a total size of 32 bytes. Its field “event” and “val” both contain 4 bytes padding. These 8 bytes padding bytes are sent to user without being initialized.
--- sound/core/timer.c | 1 + 1 file changed, 1 insertion(+)
sound/core/timer.c +1 -0
@@ -1248,6 +1248,7 @@ static void snd_timer_user_tinterrupt(st }if ((tu->filter & (1 <<SNDRV_TIMER_EVENT_RESOLUTION )) && tu->last_resolution != resolution) { +memset (&r1,0 ,sizeof (r1)); r1.event =SNDRV_TIMER_EVENT_RESOLUTION ; r1.tstamp = tstamp; r1.val = resolution;
PATCH 43/94 fix d_walk()/non-delayed __d_free() race
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 3d56c25e3bb0726a5c5e16fc2d9e38f8ed763085 upstream.
Ascend-to-parent logics in d_walk() depends on all encountered child dentries not getting freed without an RCU delay. Unfortunately, in quite a few cases it is not true, with hard-to-hit oopsable race as the result.
Fortunately, the fix is simiple; right now the rule is "if it ever been hashed, freeing must be delayed" and changing it to "if it ever had a parent, freeing must be delayed" closes that hole and covers all cases the old rule used to cover. Moreover, pipes and sockets remain _not_ covered, so we do not introduce RCU delay in the cases which are the reason for having that delay conditional in the first place.
[bwh: Backported to 3.2:
- Adjust context
- Also set the flag in __d_materialise_dentry())]
--- fs/dcache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/dcache.c +3 -2
@@ -1261,7 +1261,7 @@ struct dentry *d_alloc(struct dentry * pstruct dentry *dentry =__d_alloc (parent->d_sb, name);if (!dentry)return NULL ; - + dentry->d_flags |=DCACHE_RCUACCESS ;spin_lock (&parent->d_lock);/* * don't need child lock because it is not subject
@@ -2011,7 +2011,6 @@ static void __d_rehash(struct dentry * e {BUG_ON (!d_unhashed (entry));hlist_bl_lock (b); - entry->d_flags |=DCACHE_RCUACCESS ;hlist_bl_add_head_rcu (&entry->d_hash, b);hlist_bl_unlock (b); }
@@ -2195,6 +2194,7 @@ static void __d_move(struct dentry * den/* ... and switch the parents */ if (IS_ROOT (dentry)) { + dentry->d_flags |=DCACHE_RCUACCESS ; dentry->d_parent = target->d_parent; target->d_parent = target;INIT_LIST_HEAD (&target->d_child);
@@ -2311,6 +2311,7 @@ static void __d_materialise_dentry(strucswitch_names (dentry, anon);swap (dentry->d_name.hash, anon->d_name.hash); + dentry->d_flags |=DCACHE_RCUACCESS ; dentry->d_parent = (aparent == anon) ? dentry : aparent;list_del (&dentry->d_child);if (!IS_ROOT (dentry))
PATCH 62/94 UBIFS: Implement ->migratepage()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Kirill A. Shutemov" <[email protected]>
commit 4ac1c17b2044a1b4b2fbed74451947e905fc2992 upstream.
During page migrations UBIFS might get confused
and the following assert triggers:
[ 213.480000] UBIFS assert failed in ubifs_set_page_dirty at 1451 (pid 436) [ 213.490000] CPU: 0 PID: 436 Comm: drm-stress-test Not tainted 4.4.4-00176-geaa802524636-dirty #1008 [ 213.490000] Hardware name: Allwinner sun4i/sun5i Families [ 213.490000] [<c0015e70>] (unwind_backtrace) from [<c0012cdc>] (show_stack+0x10/0x14) [ 213.490000] [<c0012cdc>] (show_stack) from [<c02ad834>] (dump_stack+0x8c/0xa0) [ 213.490000] [<c02ad834>] (dump_stack) from [<c0236ee8>] (ubifs_set_page_dirty+0x44/0x50) [ 213.490000] [<c0236ee8>] (ubifs_set_page_dirty) from [<c00fa0bc>] (try_to_unmap_one+0x10c/0x3a8) [ 213.490000] [<c00fa0bc>] (try_to_unmap_one) from [<c00fadb4>] (rmap_walk+0xb4/0x290) [ 213.490000] [<c00fadb4>] (rmap_walk) from [<c00fb1bc>] (try_to_unmap+0x64/0x80) [ 213.490000] [<c00fb1bc>] (try_to_unmap) from [<c010dc28>] (migrate_pages+0x328/0x7a0) [ 213.490000] [<c010dc28>] (migrate_pages) from [<c00d0cb0>] (alloc_contig_range+0x168/0x2f4) [ 213.490000] [<c00d0cb0>] (alloc_contig_range) from [<c010ec00>] (cma_alloc+0x170/0x2c0) [ 213.490000] [<c010ec00>] (cma_alloc) from [<c001a958>] (__alloc_from_contiguous+0x38/0xd8) [ 213.490000] [<c001a958>] (__alloc_from_contiguous) from [<c001ad44>] (__dma_alloc+0x23c/0x274) [ 213.490000] [<c001ad44>] (__dma_alloc) from [<c001ae08>] (arm_dma_alloc+0x54/0x5c) [ 213.490000] [<c001ae08>] (arm_dma_alloc) from [<c035cecc>] (drm_gem_cma_create+0xb8/0xf0) [ 213.490000] [<c035cecc>] (drm_gem_cma_create) from [<c035cf20>] (drm_gem_cma_create_with_handle+0x1c/0xe8) [ 213.490000] [<c035cf20>] (drm_gem_cma_create_with_handle) from [<c035d088>] (drm_gem_cma_dumb_create+0x3c/0x48) [ 213.490000] [<c035d088>] (drm_gem_cma_dumb_create) from [<c0341ed8>] (drm_ioctl+0x12c/0x444) [ 213.490000] [<c0341ed8>] (drm_ioctl) from [<c0121adc>] (do_vfs_ioctl+0x3f4/0x614) [ 213.490000] [<c0121adc>] (do_vfs_ioctl) from [<c0121d30>] (SyS_ioctl+0x34/0x5c) [ 213.490000] [<c0121d30>] (SyS_ioctl) from [<c000f2c0>] (ret_fast_syscall+0x0/0x34)
UBIFS is using PagePrivate() which can have different meanings across filesystems. Therefore the generic page migration code cannot handle this case correctly.
We have to implement our own migration function which basically does a plain copy but also duplicates the page private flag.
UBIFS is not a block device filesystem and cannot use buffer_migrate_page().
[bwh: Backported to 3.2:
- migrate_page_move_mapping() doesn't take an extra_count parameter
- Use literal 0 instead of MIGRATEPAGE_SUCCESS]
--- fs/ubifs/file.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/ubifs/file.c +24 -0
@@ -53,6 +53,7 @@#include <linux/mount.h> #include <linux/namei.h> #include <linux/slab.h> +#include <linux/migrate.h> static int read_block (struct inode *inode,void *addr,unsigned int block,struct ubifs_data_node *dn)
@@ -1421,6 +1422,26 @@ static int ubifs_set_page_dirty(struct preturn ret; } +#ifdef CONFIG_MIGRATION +static int ubifs_migrate_page (struct address_space *mapping, +struct page *newpage,struct page *page,enum migrate_mode mode) +{ +int rc; + + rc =migrate_page_move_mapping (mapping, newpage, page,NULL , mode); +if (rc !=0 ) +return rc; + +if (PagePrivate (page)) { +ClearPagePrivate (page); +SetPagePrivate (newpage); + } + +migrate_page_copy (newpage, page); +return 0 ; +} +#endif +static int ubifs_releasepage (struct page *page,gfp_t unused_gfp_flags) {/*
@@ -1555,6 +1576,9 @@ const struct address_space_operations ub .write_end = ubifs_write_end, .invalidatepage = ubifs_invalidatepage, .set_page_dirty = ubifs_set_page_dirty, +#ifdef CONFIG_MIGRATION + .migratepage = ubifs_migrate_page, +#endif .releasepage = ubifs_releasepage, };
PATCH 45/94 usb: f_fs: off by one bug in _ffs_func_bind()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 0015f9156092d07b3ec06d37d014328419d5832e upstream.
This loop is supposed to set all the .num[] values to -1 but it's off by one so it skips the first element and sets one element past the end of the array.
I've cleaned up the loop a little as well.
[bwh: Backported to 3.2:
- Adjust filename, context
- Add 'i' for iteration but don't bother with 'eps_ptr' as the calculation is simpler here]
---
drivers/usb/gadget/f_fs.c +3 -3
@@ -2165,7 +2165,7 @@ static int ffs_func_bind(struct usb_confconst int high =gadget_is_dualspeed (func->gadget) && func->ffs->hs_descs_count; -int ret; +int ret, i;/* Make it a single chunk, less management later on */ struct {
@@ -2194,8 +2194,8 @@ static int ffs_func_bind(struct usb_confmemset (data->eps,0 ,sizeof data->eps);memcpy (data->raw_descs, ffs->raw_descs +16 ,sizeof data->raw_descs);memset (data->inums,0xff ,sizeof data->inums); -for (ret = ffs->eps_count; ret; --ret) - data->eps[ret].num =-1 ; +for (i =0 ; i < ffs->eps_count; i++) + data->eps[i].num =-1 ;/* Save pointers */ func->eps = data->eps;
PATCH 26/94 fs/cifs: correctly to anonymous authentication for the LANMAN authentication
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
commit fa8f3a354bb775ec586e4475bcb07f7dece97e0c upstream.
Only server which map unknown users to guest will allow access using a non-null LMChallengeResponse.
For Samba it's the "map to guest = bad user" option.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
[bwh: Backported to 3.2:
- Adjust context, indentation
- Keep ses->flags assignment out of the new if-statement]
---
fs/cifs/sess.c +18 -16
@@ -655,23 +655,25 @@ ssetup_ntlmssp_authenticate: pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE ; -/* no capabilities flags in old lanman negotiation */ - - pSMB->old_req.PasswordLength =cpu_to_le16 (CIFS_AUTH_RESP_SIZE ); - -/* Calculate hash with password and copy into bcc_ptr. -* Encryption Key (stored as in cryptkey) gets used if the -* security mode bit in Negottiate Protocol response states -* to use challenge/response method (i.e. Password bit is 1). -*/ - - rc =calc_lanman_hash (ses->password, ses->server->cryptkey, - ses->server->sec_mode &SECMODE_PW_ENCRYPT ? - true : false, lnm_session_key); - +if (ses->user_name !=NULL ) { +/* no capabilities flags in old lanman negotiation */ + pSMB->old_req.PasswordLength =cpu_to_le16 (CIFS_AUTH_RESP_SIZE ); + +/* Calculate hash with password and copy into bcc_ptr. +* Encryption Key (stored as in cryptkey) gets used if the +* security mode bit in Negottiate Protocol response states +* to use challenge/response method (i.e. Password bit is 1). +*/ + rc =calc_lanman_hash (ses->password, ses->server->cryptkey, + ses->server->sec_mode &SECMODE_PW_ENCRYPT ? + true : false, lnm_session_key); + +memcpy (bcc_ptr, (char *)lnm_session_key,CIFS_AUTH_RESP_SIZE ); + bcc_ptr +=CIFS_AUTH_RESP_SIZE ; + }else { + pSMB->old_req.PasswordLength =0 ; + } ses->flags |=CIFS_SES_LANMAN ; -memcpy (bcc_ptr, (char *)lnm_session_key,CIFS_AUTH_RESP_SIZE ); - bcc_ptr +=CIFS_AUTH_RESP_SIZE ;/* can not sign if LANMAN negotiated so no need to calculate signing key? but what if server
PATCH 72/94 iio: accel: kxsd9: fix the usage of spi_w8r8()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit 0c1f91b98552da49d9d8eed32b3132a58d2f4598 upstream.
These two spi_w8r8() calls return a value with is used by the code following the error check. The dubious use was caused by a cleanup patch.
--- drivers/staging/iio/accel/kxsd9.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/accel/kxsd9.c +2 -2
@@ -81,7 +81,7 @@ static int kxsd9_write_scale(struct iio_mutex_lock (&st->buf_lock); ret =spi_w8r8 (st->us,KXSD9_READ (KXSD9_REG_CTRL_C )); -if (ret) +if (ret <0 ) goto error_ret; st->tx[0 ] =KXSD9_WRITE (KXSD9_REG_CTRL_C ); st->tx[1 ] = (ret & ~KXSD9_FS_MASK ) | i;
@@ -166,7 +166,7 @@ static int kxsd9_read_raw(struct iio_devbreak ;case (1 <<IIO_CHAN_INFO_SCALE_SHARED ): ret =spi_w8r8 (st->us,KXSD9_READ (KXSD9_REG_CTRL_C )); -if (ret) +if (ret <0 ) goto error_ret; *val2 = kxsd9_micro_scales[ret &KXSD9_FS_MASK ]; ret =IIO_VAL_INT_PLUS_MICRO ;
PATCH 10/94 char: Drop bogus dependency of DEVPORT on !M68K
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 309124e2648d668a0c23539c5078815660a4a850 upstream.
According to full-history-linux commit d3794f4fa7c3edc3 ("[PATCH] M68k update (part 25)"), port operations are allowed on m68k if CONFIG_ISA is defined.
However, commit 153dcc54df826d2f ("[PATCH] mem driver: fix conditional on isa i/o support") accidentally changed an "||" into an "&&", disabling it completely on m68k. This logic was retained when introducing the DEVPORT symbol in commit 4f911d64e04a44c4 ("Make /dev/port conditional on config symbol").
Drop the bogus dependency on !M68K to fix this.
--- drivers/char/Kconfig | 1 - 1 file changed, 1 deletion(-)
drivers/char/Kconfig +0 -1
@@ -594,7 +594,6 @@ config TELCLOCK config DEVPORT bool - depends on !M68K depends on ISA || PCI default y
PATCH 12/94 USB: serial: option: add more ZTE device ids
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: lei liu <[email protected]>
commit f0d09463c59c2d764a6c6d492cbe6d2c77f27153 upstream.
More ZTE device ids.
--- drivers/usb/serial/option.c | 75 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +74 -1
@@ -1605,7 +1605,79 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffe9, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff42, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff43, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff44, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff45, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff46, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff47, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff48, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff49, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff4a, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff4b, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff4c, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff4d, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff4e, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff4f, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff50, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff51, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff52, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff53, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff54, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff55, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff56, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff57, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff58, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff59, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff5a, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff5b, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff5c, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff5d, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff5e, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff5f, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff60, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff61, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff62, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff63, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff64, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff65, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff66, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff67, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff68, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff69, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff6a, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff6b, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff6c, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff6d, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff6e, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff6f, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff70, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff71, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff72, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff73, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff74, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff75, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff76, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff77, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff78, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff79, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff7a, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff7b, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff7c, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff7d, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff7e, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff7f, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff80, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff81, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff82, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff83, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff84, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff85, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff86, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff87, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff88, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff89, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8a, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8b, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8c, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8d, 0xff, 0xff, 0xff) },
@@ -1616,6 +1688,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffe9, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
PATCH 32/94 wait/ptrace: assume __WALL if the child is traced
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit bf959931ddb88c4e4366e96dd22e68fa0db9527c upstream.
The following program (simplified version of generated by syzkaller)
#include <pthread.h>
#include <unistd.h>
#include <sys/ptrace.h>
#include <stdio.h>
#include <signal.h>
void *thread_func(void *arg)
{
ptrace(PTRACE_TRACEME, 0,0,0);
return 0;
}
int main(void)
{
pthread_t thread;
if (fork())
return 0;
while (getppid() != 1)
;
pthread_create(&thread, NULL, thread_func, NULL);
pthread_join(thread, NULL);
return 0;
}creates an unreapable zombie if /sbin/init doesn't use __WALL.
This is not a kernel bug, at least in a sense that everything works as
expected: debugger should reap a traced sub-thread before it can reap the leader, but without __WALL/__WCLONE do_wait() ignores sub-threads.
Unfortunately, it seems that /sbin/init in most (all?) distributions doesn't use it and we have to change the kernel to avoid the problem. Note also that most init's use sys_waitid() which doesn't allow __WALL, so the necessary user-space fix is not that trivial.
This patch just adds the "ptrace" check into eligible_child(). To some degree this matches the "tsk->ptrace" in exit_notify(), ->exit_signal is mostly ignored when the tracee reports to debugger. Or WSTOPPED, the tracer doesn't need to set this flag to wait for the stopped tracee.
This obviously means the user-visible change: __WCLONE and __WALL no longer have any meaning for debugger. And I can only hope that this won't break something, but at least strace/gdb won't suffer.
We could make a more conservative change. Say, we can take __WCLONE into account, or !thread_group_leader(). But it would be nice to not complicate these historical/confusing checks.
--- kernel/exit.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
kernel/exit.c +20 -9
@@ -1138,17 +1138,28 @@ static int eligible_pid(struct wait_optstask_pid_type (p, wo->wo_type) == wo->wo_pid; } -static int eligible_child (struct wait_opts *wo,struct task_struct *p) +static int +eligible_child (struct wait_opts *wo,bool ptrace,struct task_struct *p) {if (!eligible_pid (wo, p))return 0 ; -/* Wait for all children (clone and not) if __WALL is set; -* otherwise, wait for clone children *only* if __WCLONE is -* set; otherwise, wait for non-clone children *only*. (Note: -* A "clone" child here is one that reports to its parent -* using a signal other than SIGCHLD.) */ -if (((p->exit_signal !=SIGCHLD ) ^ !!(wo->wo_flags & __WCLONE)) - && !(wo->wo_flags & __WALL)) + +/* +* Wait for all children (clone and not) if __WALL is set or +* if it is traced by us. +*/ +if (ptrace || (wo->wo_flags & __WALL)) +return 1 ; + +/* +* Otherwise, wait for clone children *only* if __WCLONE is set; +* otherwise, wait for non-clone children *only*. +* +* Note: a "clone" child here is one that reports to its parent +* using a signal other than SIGCHLD, or a non-leader thread which +* we can only see if it is traced by us. +*/ +if ((p->exit_signal !=SIGCHLD ) ^ !!(wo->wo_flags & __WCLONE))return 0 ;return 1 ;
@@ -1525,7 +1536,7 @@ static int wait_task_continued(struct wastatic int wait_consider_task (struct wait_opts *wo,int ptrace,struct task_struct *p) { -int ret =eligible_child (wo, p); +int ret =eligible_child (wo, ptrace, p);if (!ret)return ret;
PATCH 46/94 usb: musb: Ensure rx reinit occurs for shared_fifo endpoints
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Goodbody <[email protected]>
commit f3eec0cf784e0d6c47822ca6b66df3d5812af7e6 upstream.
shared_fifo endpoints would only get a previous tx state cleared out, the rx state was only cleared for non shared_fifo endpoints Change this so that the rx state is cleared for all endpoints. This addresses an issue that resulted in rx packets being dropped silently.
--- drivers/usb/musb/musb_host.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/usb/musb/musb_host.c +6 -7
@@ -571,14 +571,13 @@ musb_rx_reinit(struct musb *musb, structmusb_writew (ep->regs,MUSB_TXCSR ,0 );/* scrub all previous state, clearing toggle */ - }else { - csr =musb_readw (ep->regs,MUSB_RXCSR ); -if (csr &MUSB_RXCSR_RXPKTRDY ) -WARNING ("rx%d, packet/%d ready?\n" , ep->epnum, -musb_readw (ep->regs,MUSB_RXCOUNT )); - -musb_h_flush_rxfifo (ep,MUSB_RXCSR_CLRDATATOG ); } + csr =musb_readw (ep->regs,MUSB_RXCSR ); +if (csr &MUSB_RXCSR_RXPKTRDY ) +WARNING ("rx%d, packet/%d ready?\n" , ep->epnum, +musb_readw (ep->regs,MUSB_RXCOUNT )); + +musb_h_flush_rxfifo (ep,MUSB_RXCSR_CLRDATATOG );/* target addr and (for multipoint) hub addr/port */ if (musb->is_multipoint) {
PATCH 4/94 PCI: Supply CPU physical address (not bus address) to iomem_is_exclusive()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit ca620723d4ff9ea7ed484eab46264c3af871b9ae upstream.
iomem_is_exclusive() requires a CPU physical address, but on some arches we supplied a PCI bus address instead.
On most arches, pci_resource_to_user(res) returns "res->start", which is a CPU physical address. But on microblaze, mips, powerpc, and sparc, it returns the PCI bus address corresponding to "res->start".
The result is that pci_mmap_resource() may fail when it shouldn't (if the bus address happens to match an existing resource), or it may succeed when it should fail (if the resource is exclusive but the bus address doesn't match it).
Call iomem_is_exclusive() with "res->start", which is always a CPU physical address, not the result of pci_resource_to_user().
--- drivers/pci/pci-sysfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pci/pci-sysfs.c +3 -4
@@ -813,6 +813,9 @@ pci_mmap_resource(struct kobject *kobj,if (i >=PCI_ROM_RESOURCE )return -ENODEV ; +if (res->flags &IORESOURCE_MEM &&iomem_is_exclusive (res->start)) +return -EINVAL ; +if (!pci_mmap_fits (pdev, i, vma,PCI_MMAP_SYSFS )) { WARN(1, "process \"%s\" tried to map 0x%08lx bytes " "at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n",
@@ -830,10 +833,6 @@ pci_mmap_resource(struct kobject *kobj,pci_resource_to_user (pdev, i, res, &start, &end); vma->vm_pgoff += start >>PAGE_SHIFT ; mmap_type = res->flags &IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; - -if (res->flags &IORESOURCE_MEM &&iomem_is_exclusive (start)) -return -EINVAL ; -return pci_mmap_page_range (pdev, vma, mmap_type, write_combine); }
PATCH 20/94 sched/loadavg: Fix loadavg artifacts on fully idle and on fully loaded systems
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vik Heyndrickx <[email protected]>
commit 20878232c52329f92423d27a60e48b6a6389e0dd upstream.
Systems show a minimal load average of 0.00, 0.01, 0.05 even when they have no load at all.
Uptime and /proc/loadavg on all systems with kernels released during the last five years up until kernel version 4.6-rc5, show a 5- and 15-minute minimum loadavg of 0.01 and 0.05 respectively. This should be 0.00 on idle systems, but the way the kernel calculates this value prevents it from getting lower than the mentioned values.
Likewise but not as obviously noticeable, a fully loaded system with no processes waiting, shows a maximum 1/5/15 loadavg of 1.00, 0.99, 0.95 (multiplied by number of cores).
Once the (old) load becomes 93 or higher, it mathematically can never get lower than 93, even when the active (load) remains 0 forever. This results in the strange 0.00, 0.01, 0.05 uptime values on idle systems. Note: 93/2048 = 0.0454..., which rounds up to 0.05.
It is not correct to add a 0.5 rounding (=1024/2048) here, since the result from this function is fed back into the next iteration again, so the result of that +0.5 rounding value then gets multiplied by (2048-2037), and then rounded again, so there is a virtual "ghost" load created, next to the old and active load terms.
By changing the way the internally kept value is rounded, that internal value equivalent now can reach 0.00 on idle, and 1.00 on full load. Upon increasing load, the internally kept load value is rounded up, when the load is decreasing, the load value is rounded down.
The modified code was tested on nohz=off and nohz kernels. It was tested on vanilla kernel 4.6-rc5 and on centos 7.1 kernel 3.10.0-327. It was tested on single, dual, and octal cores system. It was tested on virtual hosts and bare hardware. No unwanted effects have been observed, and the problems that the patch intended to fix were indeed gone.
--- kernel/sched.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/sched.c +7 -4
@@ -3507,10 +3507,13 @@ static long calc_load_fold_active(structstatic unsigned long calc_load (unsigned long load,unsigned long exp,unsigned long active) { - load *= exp; - load += active * (FIXED_1 - exp); - load +=1UL << (FSHIFT -1 ); -return load >>FSHIFT ; +unsigned long newload; + + newload = load * exp + active * (FIXED_1 - exp); +if (active >= load) + newload +=FIXED_1 -1 ; + +return newload /FIXED_1 ; }#ifdef CONFIG_NO_HZ
PATCH 51/94 kprobes/x86: Clear TF bit in fault on single-stepping
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
commit dcfc47248d3f7d28df6f531e6426b933de94370d upstream.
Fix kprobe_fault_handler() to clear the TF (trap flag) bit of the flags register in the case of a fault fixup on single-stepping.
If we put a kprobe on the instruction which caused a page fault (e.g. actual mov instructions in copy_user_*), that fault happens on the single-stepping buffer. In this case, kprobes resets running instance so that the CPU can retry execution on the original ip address.
However, current code forgets to reset the TF bit. Since this fault happens with TF bit set for enabling single-stepping, when it retries, it causes a debug exception and kprobes can not handle it because it already reset itself.
On the most of x86-64 platform, it can be easily reproduced by using kprobe tracer. E.g.
# cd /sys/kernel/debug/tracing # echo p copy_user_enhanced_fast_string+5 > kprobe_events # echo 1 > events/kprobes/enable
And you'll see a kernel panic on do_debug(), since the debug trap is not handled by kprobes.
To fix this problem, we just need to clear the TF bit when resetting running kprobe.
--- arch/x86/kernel/kprobes.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/x86/kernel/kprobes.c +12 -0
@@ -949,7 +949,19 @@ int __kprobes kprobe_fault_handler(struc* normal page fault. */ regs->ip = (unsigned long )cur->addr; +/* +* Trap flag (TF) has been set here because this fault +* happened where the single stepping will be done. +* So clear it by resetting the current kprobe: +*/ + regs->flags &= ~X86_EFLAGS_TF ; + +/* +* If the TF flag was set before the kprobe hit, +* don't touch it: +*/ regs->flags |= kcb->kprobe_old_flags; +if (kcb->kprobe_status ==KPROBE_REENTER )restore_previous_kprobe (kcb);else
PATCH 94/94 audit: fix a double fetch in audit_log_single_execve_arg()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
commit 43761473c254b45883a64441dd0bc85a42f3645c upstream.
There is a double fetch problem in audit_log_single_execve_arg() where we first check the execve(2) argumnets for any "bad" characters which would require hex encoding and then re-fetch the arguments for logging in the audit record[1]. Of course this leaves a window of opportunity for an unsavory application to munge with the data.
This patch reworks things by only fetching the argument data once[2] into a buffer where it is scanned and logged into the audit records(s). In addition to fixing the double fetch, this patch improves on the original code in a few other ways: better handling of large arguments which require encoding, stricter record length checking, and some performance improvements (completely unverified, but we got rid of some strlen() calls, that's got to be a good thing).
As part of the development of this patch, I've also created a basic regression test for the audit-testsuite, the test can be tracked on GitHub at the following link:
* https://github.com/linux-audit/audit-testsuite/issues/25
[1] If you pay careful attention, there is actually a triple fetch problem due to a strnlen_user() call at the top of the function.
[2] This is a tiny white lie, we do make a call to strnlen_user() prior to fetching the argument data. I don't like it, but due to the way the audit record is structured we really have no choice unless we copy the entire argument at once (which would require a rather wasteful allocation). The good news is that with this patch the kernel no longer relies on this strnlen_user() value for anything beyond recording it in the log, we also update it with a trustworthy value whenever possible.
[bwh: Backported to 3.2:
- In audit_log_execve_info() various information is retrieved via the extra parameter struct audit_aux_data_execve *axi
- Adjust context]
--- kernel/auditsc.c | 332 +++++++++++++++++++++++++++---------------------------- 1 file changed, 164 insertions(+), 168 deletions(-)
kernel/auditsc.c +166 -169
@@ -67,6 +67,7 @@#include <linux/syscalls.h> #include <linux/capability.h> #include <linux/fs_struct.h> +#include <linux/uaccess.h> #include "audit.h"
@@ -77,7 +78,8 @@/* Indicates that audit should log the full pathname. */ #define AUDIT_NAME_FULL -1 -/* no execve audit message should be longer than this (userspace limits) */ +/* no execve audit message should be longer than this (userspace limits), +* see the note near the top of audit_log_execve_info() about this value */ #define MAX_EXECVE_AUDIT_LEN 7500/* number of audit rules */
@@ -1026,189 +1028,184 @@ static int audit_log_pid_context(structreturn rc; } -/* -* to_send and len_sent accounting are very loose estimates. We aren't -* really worried about a hard cap to MAX_EXECVE_AUDIT_LEN so much as being -* within about 500 bytes (next page boundary) -* -* why snprintf? an int is up to 12 digits long. if we just assumed when -* logging that a[%d]= was going to be 16 characters long we would be wasting -* space in every audit message. In one 7500 byte message we can log up to -* about 1000 min size arguments. That comes down to about 50% waste of space -* if we didn't do the snprintf to find out how long arg_num_len was. -*/ -static int audit_log_single_execve_arg (struct audit_context *context, -struct audit_buffer **ab, -int arg_num, -size_t *len_sent, -const char __user *p, -char *buf) -{ -char arg_num_len_buf[12 ]; -const char __user *tmp_p = p; -/* how many digits are in arg_num? 5 is the length of ' a=""' */ -size_t arg_num_len =snprintf (arg_num_len_buf,12 ,"%d" , arg_num) +5 ; -size_t len, len_left, to_send; -size_t max_execve_audit_len =MAX_EXECVE_AUDIT_LEN ; -unsigned int i, has_cntl =0 , too_long =0 ; -int ret; - -/* strnlen_user includes the null we don't want to send */ - len_left = len =strnlen_user (p,MAX_ARG_STRLEN ) -1 ; - -/* -* We just created this mm, if we can't find the strings -* we just copied into it something is _very_ wrong. Similar -* for strings that are too long, we should not have created -* any. -*/ -if (unlikely ((len ==-1 ) || len >MAX_ARG_STRLEN -1 )) { -WARN_ON (1 ); -send_sig (SIGKILL , current,0 ); -return -1 ; - } - -/* walk the whole argument looking for non-ascii chars */ -do { -if (len_left >MAX_EXECVE_AUDIT_LEN ) - to_send =MAX_EXECVE_AUDIT_LEN ; -else - to_send = len_left; - ret =copy_from_user (buf, tmp_p, to_send); -/* -* There is no reason for this copy to be short. We just -* copied them here, and the mm hasn't been exposed to user- -* space yet. -*/ -if (ret) { -WARN_ON (1 ); -send_sig (SIGKILL , current,0 ); -return -1 ; - } - buf[to_send] ='\0' ; - has_cntl =audit_string_contains_control (buf, to_send); -if (has_cntl) { -/* -* hex messages get logged as 2 bytes, so we can only -* send half as much in each message -*/ - max_execve_audit_len =MAX_EXECVE_AUDIT_LEN /2 ; -break ; - } - len_left -= to_send; - tmp_p += to_send; - }while (len_left >0 ); - - len_left = len; - -if (len > max_execve_audit_len) - too_long =1 ; - -/* rewalk the argument actually logging the message */ -for (i =0 ; len_left >0 ; i++) { -int room_left; - -if (len_left > max_execve_audit_len) - to_send = max_execve_audit_len; -else - to_send = len_left; - -/* do we have space left to send this argument in this ab? */ - room_left =MAX_EXECVE_AUDIT_LEN - arg_num_len - *len_sent; -if (has_cntl) - room_left -= (to_send *2 ); -else - room_left -= to_send; -if (room_left <0 ) { - *len_sent =0 ; -audit_log_end (*ab); - *ab =audit_log_start (context,GFP_KERNEL ,AUDIT_EXECVE ); -if (!*ab) -return 0 ; - } - -/* -* first record needs to say how long the original string was -* so we can be sure nothing was lost. -*/ -if ((i ==0 ) && (too_long)) -audit_log_format (*ab," a%d_len=%zu" , arg_num, - has_cntl ?2 *len : len); - -/* -* normally arguments are small enough to fit and we already -* filled buf above when we checked for control characters -* so don't bother with another copy_from_user -*/ -if (len >= max_execve_audit_len) - ret =copy_from_user (buf, p, to_send); -else - ret =0 ; -if (ret) { -WARN_ON (1 ); -send_sig (SIGKILL , current,0 ); -return -1 ; - } - buf[to_send] ='\0' ; - -/* actually log it */ -audit_log_format (*ab," a%d" , arg_num); -if (too_long) -audit_log_format (*ab,"[%d]" , i); -audit_log_format (*ab,"=" ); -if (has_cntl) -audit_log_n_hex (*ab, buf, to_send); -else -audit_log_string (*ab, buf); - - p += to_send; - len_left -= to_send; - *len_sent += arg_num_len; -if (has_cntl) - *len_sent += to_send *2 ; -else - *len_sent += to_send; - } -/* include the null we didn't log */ -return len +1 ; -} -static void audit_log_execve_info (struct audit_context *context,struct audit_buffer **ab,struct audit_aux_data_execve *axi) { -int i; -size_t len, len_sent =0 ; -const char __user *p; +long len_max; +long len_rem; +long len_full; +long len_buf; +long len_abuf; +long len_tmp; +bool require_data; +bool encode; +unsigned int iter; +unsigned int arg; +char *buf_head;char *buf; +const char __user *p; + +/* NOTE: this buffer needs to be large enough to hold all the non-arg +* data we put in the audit record for this argument (see the +* code below) ... at this point in time 96 is plenty */ +char abuf[96 ];if (axi->mm != current->mm)return ;/* execve failed, no additional info */ p = (const char __user *)axi->mm->arg_start; -audit_log_format (*ab,"argc=%d" , axi->argc); - -/* -* we need some kernel buffer to hold the userspace args. Just -* allocate one big one rather than allocating one of the right size -* for every single argument inside audit_log_single_execve_arg() -* should be <8k allocation so should be pretty safe. -*/ - buf =kmalloc (MAX_EXECVE_AUDIT_LEN +1 ,GFP_KERNEL ); -if (!buf) { +/* NOTE: we set MAX_EXECVE_AUDIT_LEN to a rather arbitrary limit, the +* current value of 7500 is not as important as the fact that it +* is less than 8k, a setting of 7500 gives us plenty of wiggle +* room if we go over a little bit in the logging below */ +WARN_ON_ONCE (MAX_EXECVE_AUDIT_LEN >7500 ); + len_max =MAX_EXECVE_AUDIT_LEN ; + +/* scratch buffer to hold the userspace args */ + buf_head =kmalloc (MAX_EXECVE_AUDIT_LEN +1 ,GFP_KERNEL ); +if (!buf_head) {audit_panic ("out of memory for argv string\n" );return ; } + buf = buf_head; -for (i =0 ; i < axi->argc; i++) { - len =audit_log_single_execve_arg (context, ab, i, - &len_sent, p, buf); -if (len <=0 ) -break ; - p += len; - } -kfree (buf); +audit_log_format (*ab,"argc=%d" , axi->argc); + + len_rem = len_max; + len_buf =0 ; + len_full =0 ; + require_data = true; + encode = false; + iter =0 ; + arg =0 ; +do { +/* NOTE: we don't ever want to trust this value for anything +* serious, but the audit record format insists we +* provide an argument length for really long arguments, +* e.g. > MAX_EXECVE_AUDIT_LEN, so we have no choice but +* to use strncpy_from_user() to obtain this value for +* recording in the log, although we don't use it +* anywhere here to avoid a double-fetch problem */ +if (len_full ==0 ) + len_full =strnlen_user (p,MAX_ARG_STRLEN ) -1 ; + +/* read more data from userspace */ +if (require_data) { +/* can we make more room in the buffer? */ +if (buf != buf_head) { +memmove (buf_head, buf, len_buf); + buf = buf_head; + } + +/* fetch as much as we can of the argument */ + len_tmp =strncpy_from_user (&buf_head[len_buf], p, + len_max - len_buf); +if (len_tmp == -EFAULT ) { +/* unable to copy from userspace */ +send_sig (SIGKILL , current,0 ); + goto out; + }else if (len_tmp == (len_max - len_buf)) { +/* buffer is not large enough */ + require_data = true; +/* NOTE: if we are going to span multiple +* buffers force the encoding so we stand +* a chance at a sane len_full value and +* consistent record encoding */ + encode = true; + len_full = len_full *2 ; + p += len_tmp; + }else { + require_data = false; +if (!encode) + encode =audit_string_contains_control ( + buf, len_tmp); +/* try to use a trusted value for len_full */ +if (len_full < len_max) + len_full = (encode ? + len_tmp *2 : len_tmp); + p += len_tmp +1 ; + } + len_buf += len_tmp; + buf_head[len_buf] ='\0' ; + +/* length of the buffer in the audit record? */ + len_abuf = (encode ? len_buf *2 : len_buf +2 ); + } + +/* write as much as we can to the audit log */ +if (len_buf >0 ) { +/* NOTE: some magic numbers here - basically if we +* can't fit a reasonable amount of data into the +* existing audit buffer, flush it and start with +* a new buffer */ +if ((sizeof (abuf) +8 ) > len_rem) { + len_rem = len_max; +audit_log_end (*ab); + *ab =audit_log_start (context, +GFP_KERNEL ,AUDIT_EXECVE ); +if (!*ab) + goto out; + } + +/* create the non-arg portion of the arg record */ + len_tmp =0 ; +if (require_data || (iter >0 ) || + ((len_abuf +sizeof (abuf)) > len_rem)) { +if (iter ==0 ) { + len_tmp +=snprintf (&abuf[len_tmp], +sizeof (abuf) - len_tmp, +" a%d_len=%lu" , + arg, len_full); + } + len_tmp +=snprintf (&abuf[len_tmp], +sizeof (abuf) - len_tmp, +" a%d[%d]=" , arg, iter++); + }else + len_tmp +=snprintf (&abuf[len_tmp], +sizeof (abuf) - len_tmp, +" a%d=" , arg); +WARN_ON (len_tmp >=sizeof (abuf)); + abuf[sizeof (abuf) -1 ] ='\0' ; + +/* log the arg in the audit record */ +audit_log_format (*ab,"%s" , abuf); + len_rem -= len_tmp; + len_tmp = len_buf; +if (encode) { +if (len_abuf > len_rem) + len_tmp = len_rem /2 ;/* encoding */ +audit_log_n_hex (*ab, buf, len_tmp); + len_rem -= len_tmp *2 ; + len_abuf -= len_tmp *2 ; + }else { +if (len_abuf > len_rem) + len_tmp = len_rem -2 ;/* quotes */ +audit_log_n_string (*ab, buf, len_tmp); + len_rem -= len_tmp +2 ; +/* don't subtract the "2" because we still need +* to add quotes to the remaining string */ + len_abuf -= len_tmp; + } + len_buf -= len_tmp; + buf += len_tmp; + } + +/* ready to move to the next argument? */ +if ((len_buf ==0 ) && !require_data) { + arg++; + iter =0 ; + len_full =0 ; + require_data = true; + encode = false; + } + }while (arg < axi->argc); + +/* NOTE: the caller handles the final audit_log_end() call */ + +out: +kfree (buf_head); }static void audit_log_cap (struct audit_buffer *ab,char *prefix,kernel_cap_t *cap)
PATCH 76/94 ALSA: au88x0: Fix calculation in vortex_wtdma_bufshift()
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 62db7152c924e4c060e42b34a69cd39658e8a0dc upstream.
vortex_wtdma_bufshift() function does calculate the page index wrongly, first masking then shift, which always results in zero. The proper computation is to first shift, then mask.
--- sound/pci/au88x0/au88x0_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/pci/au88x0/au88x0_core.c +2 -3
@@ -1444,9 +1444,8 @@ static int vortex_wtdma_bufshift(vortex_int page, p, pp, delta, i; page = - (hwread (vortex->mmio,VORTEX_WTDMA_STAT + (wtdma <<2 )) & -WT_SUBBUF_MASK ) - >>WT_SUBBUF_SHIFT ; + (hwread (vortex->mmio,VORTEX_WTDMA_STAT + (wtdma <<2 )) + >>WT_SUBBUF_SHIFT ) &WT_SUBBUF_MASK ;if (dma->nr_periods >=4 ) delta = (page - dma->period_real) &3 ;else {
PATCH 80/94 ALSA: timer: Fix negative queue usage by racy accesses
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3fa6993fef634e05d200d141a85df0b044572364 upstream.
The user timer tu->qused counter may go to a negative value when multiple concurrent reads are performed since both the check and the decrement of tu->qused are done in two individual locked contexts. This results in bogus read outs, and the endless loop in the user-space side.
The fix is to move the decrement of the tu->qused counter into the same spinlock context as the zero-check of the counter.
--- sound/core/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/timer.c +1 -1
@@ -1923,6 +1923,7 @@ static ssize_t snd_timer_user_read(struc qhead = tu->qhead++; tu->qhead %= tu->queue_size; + tu->qused--;spin_unlock_irq (&tu->qlock);if (tu->tread) {
@@ -1936,7 +1937,6 @@ static ssize_t snd_timer_user_read(struc }spin_lock_irq (&tu->qlock); - tu->qused--;if (err <0 ) goto _error; result += unit;
PATCH 17/94 ata: sata_dwc_460ex: remove incorrect locking
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mans Rullgard <[email protected]>
commit 55e610cdd28c0ad3dce0652030c0296d549673f3 upstream.
This lock is already taken in ata_scsi_queuecmd() a few levels up the call stack so attempting to take it here is an error. Moreover, it is pointless in the first place since it only protects a single, atomic assignment.
Enabling lock debugging gives the following output:
=============================================
[ INFO: possible recursive locking detected ]
4.4.0-rc5+ #189 Not tainted
---------------------------------------------
kworker/u2:3/37 is trying to acquire lock:
(&(&host->lock)->rlock){-.-...}, at: [<90283294>] sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c
but task is already holding lock:
(&(&host->lock)->rlock){-.-...}, at: [<902761ac>] ata_scsi_queuecmd+0x2c/0x330
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&(&host->lock)->rlock);
lock(&(&host->lock)->rlock);
*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by kworker/u2:3/37:
#0: ("events_unbound"){.+.+.+}, at: [<9003a0a4>] process_one_work+0x12c/0x430
#1: ((&entry->work)){+.+.+.}, at: [<9003a0a4>] process_one_work+0x12c/0x430
#2: (&bdev->bd_mutex){+.+.+.}, at: [<9011fd54>] __blkdev_get+0x50/0x380
#3: (&(&host->lock)->rlock){-.-...}, at: [<902761ac>] ata_scsi_queuecmd+0x2c/0x330stack backtrace:
CPU: 0 PID: 37 Comm: kworker/u2:3 Not tainted 4.4.0-rc5+ #189
Workqueue: events_unbound async_run_entry_fn
Stack : 90b38e30 00000021 00000003 9b2a6040 00000000 9005f3f0 904fc8dc 00000025
906b96e4 00000000 90528648 9b3336c4 904fc8dc 9009bf18 00000002 00000004
00000000 00000000 9b3336c4 9b3336e4 904fc8dc 9003d074 00000000 90500000
9005e738 00000000 00000000 00000000 00000000 00000000 00000000 00000000
6e657665 755f7374 756f626e 0000646e 00000000 00000000 9b00ca00 9b025000
...
Call Trace:
[<90009d6c>] show_stack+0x88/0xa4
[<90057744>] __lock_acquire+0x1ce8/0x2154
[<900583e4>] lock_acquire+0x64/0x8c
[<9045ff10>] _raw_spin_lock_irqsave+0x54/0x78
[<90283294>] sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c
[<90283484>] sata_dwc_qc_issue+0x1a8/0x24c
[<9026b39c>] ata_qc_issue+0x1f0/0x410
[<90273c6c>] ata_scsi_translate+0xb4/0x200
[<90276234>] ata_scsi_queuecmd+0xb4/0x330
[<9025800c>] scsi_dispatch_cmd+0xd0/0x128
[<90259934>] scsi_request_fn+0x58c/0x638
[<901a3e50>] __blk_run_queue+0x40/0x5c
[<901a83d4>] blk_queue_bio+0x27c/0x28c
[<901a5914>] generic_make_request+0xf0/0x188
[<901a5a54>] submit_bio+0xa8/0x194
[<9011adcc>] submit_bh_wbc.isra.23+0x15c/0x17c
[<9011c908>] block_read_full_page+0x3e4/0x428
[<9009e2e0>] do_read_cache_page+0xac/0x210
[<9009fd90>] read_cache_page+0x18/0x24
[<901bbd18>] read_dev_sector+0x38/0xb0
[<901bd174>] msdos_partition+0xb4/0x5c0
[<901bcb8c>] check_partition+0x140/0x274
[<901bba60>] rescan_partitions+0xa0/0x2b0
[<9011ff68>] __blkdev_get+0x264/0x380
[<901201ac>] blkdev_get+0x128/0x36c
[<901b9378>] add_disk+0x3c0/0x4bc
[<90268268>] sd_probe_async+0x100/0x224
[<90043a44>] async_run_entry_fn+0x50/0x124
[<9003a11c>] process_one_work+0x1a4/0x430
[<9003a4f4>] worker_thread+0x14c/0x4fc
[<900408f4>] kthread+0xd0/0xe8
[<90004338>] ret_from_kernel_thread+0x14/0x1c--- drivers/ata/sata_dwc_460ex.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/ata/sata_dwc_460ex.c +1 -3
@@ -1386,15 +1386,13 @@ static void sata_dwc_exec_command_by_tagstruct ata_taskfile *tf, u8 tag, u32 cmd_issued) { - unsigned long flags; struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);dev_dbg (ap->dev,"%s cmd(0x%02x): %s tag=%d\n" , __func__, tf->command,ata_get_cmd_descript (tf->command), tag); -spin_lock_irqsave (&ap->host->lock, flags); hsdevp->cmd_issued[tag] = cmd_issued; -spin_unlock_irqrestore (&ap->host->lock, flags); +/* * Clear SError before executing a new command. * sata_dwc_scr_write and read can not be used here. Clearing the PM
PATCH 21/94 mmc: mmc: Fix partition switch timeout for some eMMCs
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 1c447116d017a98c90f8f71c8c5a611e0aa42178 upstream.
Some eMMCs set the partition switch timeout too low.
Now typically eMMCs are considered a critical component (e.g. because they store the root file system) and consequently are expected to be reliable. Thus we can neglect the use case where eMMCs can't switch reliably and we might want a lower timeout to facilitate speedy recovery.
Although we could employ a quirk for the cards that are affected (if we could identify them all), as described above, there is little benefit to having a low timeout, so instead simply set a minimum timeout.
The minimum is set to 300ms somewhat arbitrarily - the examples that have been seen had a timeout of 10ms but were sometimes taking 60-70ms.
--- drivers/mmc/core/mmc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mmc/core/mmc.c +7 -0
@@ -235,6 +235,9 @@ static int mmc_get_ext_csd(struct mmc_careturn err; } +/* Minimum partition switch timeout in milliseconds */ +#define MMC_MIN_PART_SWITCH_TIME 300 +/* * Decode extended CSD. */
@@ -325,6 +328,10 @@ static int mmc_read_ext_csd(struct mmc_c/* EXT_CSD value is in units of 10ms, but we store in ms */ card->ext_csd.part_time =10 * ext_csd[EXT_CSD_PART_SWITCH_TIME ]; +/* Some eMMC set the value too low so set a minimum */ +if (card->ext_csd.part_time && + card->ext_csd.part_time <MMC_MIN_PART_SWITCH_TIME ) + card->ext_csd.part_time =MMC_MIN_PART_SWITCH_TIME ;/* Sleep / awake timeout in 100ns units */ if (sa_shift >0 && sa_shift <=0x17 )
PATCH 77/94 x86/amd_nb: Fix boot crash on non-AMD systems
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit 1ead852dd88779eda12cb09cc894a03d9abfe1ec upstream.
Fix boot crash that triggers if this driver is built into a kernel and run on non-AMD systems.
AMD northbridges users call amd_cache_northbridges() and it returns a negative value to signal that we weren't able to cache/detect any northbridges on the system.
At least, it should do so as all its callers expect it to do so. But it does return a negative value only when kmalloc() fails.
Fix it to return -ENODEV if there are no NBs cached as otherwise, amd_nb users like amd64_edac, for example, which relies on it to know whether it should load or not, gets loaded on systems like Intel Xeons where it shouldn't.
--- arch/x86/kernel/amd_nb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/amd_nb.c +2 -2
@@ -59,8 +59,8 @@ int amd_cache_northbridges(void)while ((misc =next_northbridge (misc, amd_nb_misc_ids)) !=NULL ) i++; -if (i ==0 ) -return 0 ; +if (!i) +return -ENODEV ; nb =kzalloc (i *sizeof (struct amd_northbridge ),GFP_KERNEL );if (!nb)
PATCH 91/94 tipc: fix an infoleak in tipc_nl_compat_link_dump
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit 5d2be1422e02ccd697ccfcd45c85b4a26e6178e2 upstream.
link_info.str is a char array of size 60. Memory after the NULL byte is not initialized. Sending the whole object out can cause a leak.
[bwh: Backported to 3.2: the unpadded strcpy() is in tipc_node_get_links()
and no nlattr is involved, so use strncpy()]
---
net/tipc/node.c +2 -1
@@ -485,7 +485,8 @@ struct sk_buff *tipc_node_get_links(conscontinue ; link_info.dest =htonl (n_ptr->addr); link_info.up =htonl (tipc_link_is_up (n_ptr->links[i])); -strcpy (link_info.str, n_ptr->links[i]->name); +strncpy (link_info.str, n_ptr->links[i]->name, +sizeof (link_info.str));tipc_cfg_append_tlv (buf,TIPC_TLV_LINK_INFO , &link_info,sizeof (link_info)); }
PATCH 59/94 can: at91_can: RX queue could get stuck at high bus load
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wolfgang Grandegger <[email protected]>
commit 43200a4480cbbe660309621817f54cbb93907108 upstream.
At high bus load it could happen that "at91_poll()" enters with all RX message boxes filled up. If then at the end the "quota" is exceeded as well, "rx_next" will not be reset to the first RX mailbox and hence the interrupts remain disabled.
--- drivers/net/can/at91_can.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/at91_can.c +3 -2
@@ -727,9 +727,10 @@ static int at91_poll_rx(struct net_devic/* upper group completed, look again in lower */ if (priv->rx_next >get_mb_rx_low_last (priv) && - quota >0 && mb >get_mb_rx_last (priv)) { + mb >get_mb_rx_last (priv)) { priv->rx_next =get_mb_rx_first (priv); - goto again; +if (quota >0 ) + goto again; }return received;
PATCH 88/94 ALSA: timer: Fix leak in SNDRV_TIMER_IOCTL_PARAMS
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit cec8f96e49d9be372fdb0c3836dcf31ec71e457e upstream.
The stack object “tread” has a total size of 32 bytes. Its field “event” and “val” both contain 4 bytes padding. These 8 bytes padding bytes are sent to user without being initialized.
--- sound/core/timer.c | 1 + 1 file changed, 1 insertion(+)
sound/core/timer.c +1 -0
@@ -1712,6 +1712,7 @@ static int snd_timer_user_params(structif (tu->timeri->flags &SNDRV_TIMER_IFLG_EARLY_EVENT ) {if (tu->tread) {struct snd_timer_tread tread; +memset (&tread,0 ,sizeof (tread)); tread.event =SNDRV_TIMER_EVENT_EARLY ; tread.tstamp.tv_sec =0 ; tread.tstamp.tv_nsec =0 ;
PATCH 79/94 bonding: prevent out of bound accesses
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit f87fda00b6ed232a817c655b8d179b48bde8fdbe upstream.
ether_addr_equal_64bits() requires some care about its arguments, namely that 8 bytes might be read, even if last 2 byte values are not used.
KASan detected a violation with null_mac_addr and lacpdu_mcast_addr in bond_3ad.c
Same problem with mac_bcast[] and mac_v6_allmcast[] in bond_alb.c :
Although the 8-byte alignment was there, KASan would detect out of bound accesses.
[bwh: Backported to 3.2:
- Adjust filename
- Drop change to bond_params::ad_actor_system
- Fix one more copy of null_mac_addr to use eth_zero_addr()]
--- drivers/net/bonding/bond_3ad.c | 11 +++++++---- drivers/net/bonding/bond_alb.c | 7 ++----- drivers/net/bonding/bonding.h | 7 ++++++- 3 files changed, 15 insertions(+), 10 deletions(-)
drivers/net/bonding/bond_3ad.c +8 -5
@@ -93,11 +93,14 @@// compare MAC addresses #define MAC_ADDRESS_COMPARE (A ,B ) memcmp(A, B, ETH_ALEN) -static struct mac_addr null_mac_addr = { {0 ,0 ,0 ,0 ,0 ,0 } }; +static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = { +0 ,0 ,0 ,0 ,0 ,0 +};static u16 ad_ticks_per_sec;static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL *HZ ) /1000 ; -static const u8 lacpdu_mcast_addr[ETH_ALEN ] =MULTICAST_LACPDU_ADDR ; +static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = +MULTICAST_LACPDU_ADDR ;// ================= main 802.3ad protocol functions ================== static int ad_lacpdu_send (struct port *port);
@@ -1627,7 +1630,7 @@ static void ad_clear_agg(struct aggregat aggregator->is_individual = false; aggregator->actor_admin_aggregator_key =0 ; aggregator->actor_oper_aggregator_key =0 ; - aggregator->partner_system = null_mac_addr; +eth_zero_addr (aggregator->partner_system.mac_addr_value); aggregator->partner_system_priority =0 ; aggregator->partner_oper_aggregator_key =0 ; aggregator->receive_state =0 ;
@@ -1650,7 +1653,7 @@ static void ad_initialize_agg(struct aggif (aggregator) {ad_clear_agg (aggregator); - aggregator->aggregator_mac_address = null_mac_addr; +eth_zero_addr (aggregator->aggregator_mac_address.mac_addr_value); aggregator->aggregator_identifier =0 ; aggregator->slave =NULL ; }
@@ -1686,7 +1689,7 @@ static void ad_initialize_port(struct poif (port) { port->actor_port_number =1 ; port->actor_port_priority =0xff ; - port->actor_system = null_mac_addr; +eth_zero_addr (port->actor_system.mac_addr_value); port->actor_system_priority =0xffff ; port->actor_port_aggregator_identifier =0 ; port->ntt = false;
drivers/net/bonding/bond_alb.c +2 -5
@@ -45,13 +45,10 @@ -#ifndef __long_aligned -#define __long_aligned __attribute__((aligned((sizeof(long))))) -#endif -static const u8 mac_bcast[ETH_ALEN] __long_aligned = { +static const u8 mac_bcast[ETH_ALEN + 2] __long_aligned = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff }; -static const u8 mac_v6_allmcast[ETH_ALEN] __long_aligned = { +static const u8 mac_v6_allmcast[ETH_ALEN + 2] __long_aligned = {0x33 ,0x33 ,0x00 ,0x00 ,0x00 ,0x01 };static const int alb_delta_in_ticks =HZ /ALB_TIMER_TICKS_PER_SEC ;
drivers/net/bonding/bonding.h +3 -0
@@ -38,6 +38,9 @@ netif_running(dev) && \ netif_carrier_ok(dev)) +#ifndef __long_aligned +#define __long_aligned __attribute__((aligned((sizeof(long))))) +#endif /* * Checks whether slave is ready for transmit. */
PATCH 60/94 ubi: Make recover_peb power cut aware
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 972228d87445dc46c0a01f5f3de673ac017626f7 upstream.
recover_peb() was never power cut aware,
if a power cut happened right after writing the VID header upon next attach UBI would blindly use the new partial written PEB and all data from the old PEB is lost.
In order to make recover_peb() power cut aware, write the new VID with a proper crc and copy_flag set such that the UBI attach process will detect whether the new PEB is completely written or not.
We cannot directly use ubi_eba_atomic_leb_change() since we'd have to unlock the LEB which is facing a write error.
[bwh: Backported to 3.2:
- Adjust context
- Use next_sqnum() instead of ubi_next_sqnum()
- Use ubi_device::peb_buf1 instead of ubi_device::peb_buf
- No need to unlock ubi->fm_eba_sem on error]
--- drivers/mtd/ubi/eba.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/mtd/ubi/eba.c +14 -5
@@ -501,6 +501,7 @@ static int recover_peb(struct ubi_deviceint err, idx =vol_id2idx (ubi, vol_id), new_pnum, data_size, tries =0 ;struct ubi_volume *vol = ubi->volumes[idx];struct ubi_vid_hdr *vid_hdr; +uint32_t crc; vid_hdr =ubi_zalloc_vid_hdr (ubi,GFP_NOFS );if (!vid_hdr)
@@ -522,12 +523,8 @@ retry: goto out_put; } - vid_hdr->sqnum =cpu_to_be64 (next_sqnum (ubi)); - err =ubi_io_write_vid_hdr (ubi, new_pnum, vid_hdr); -if (err) - goto write_error; +ubi_assert (vid_hdr->vol_type ==UBI_VID_DYNAMIC ); - data_size = offset + len;mutex_lock (&ubi->buf_mutex);memset (ubi->peb_buf1 + offset,0xFF , len);
@@ -540,6 +537,18 @@ retry:memcpy (ubi->peb_buf1 + offset, buf, len); + data_size = offset + len; + crc =crc32 (UBI_CRC32_INIT , ubi->peb_buf1, data_size); + vid_hdr->sqnum =cpu_to_be64 (next_sqnum (ubi)); + vid_hdr->copy_flag =1 ; + vid_hdr->data_size =cpu_to_be32 (data_size); + vid_hdr->data_crc =cpu_to_be32 (crc); + err =ubi_io_write_vid_hdr (ubi, new_pnum, vid_hdr); +if (err) { +mutex_unlock (&ubi->buf_mutex); + goto write_error; + } + err =ubi_io_write_data (ubi, ubi->peb_buf1, new_pnum,0 , data_size);if (err) {mutex_unlock (&ubi->buf_mutex);
PATCH 40/94 KVM: x86: fix OOPS after invalid KVM_SET_DEBUGREGS
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit d14bdb553f9196169f003058ae1cdabe514470e6 upstream.
MOV to DR6 or DR7 causes a #GP if an attempt is made to write a 1 to any of bits 63:32. However, this is not detected at KVM_SET_DEBUGREGS time, and the next KVM_RUN oopses:
general protection fault: 0000 [#1] SMP
CPU: 2 PID: 14987 Comm: a.out Not tainted 4.4.9-300.fc23.x86_64 #1
Hardware name: LENOVO 2325F51/2325F51, BIOS G2ET32WW (1.12 ) 05/30/2012
[...]
Call Trace:
[<ffffffffa072c93d>] kvm_arch_vcpu_ioctl_run+0x141d/0x14e0 [kvm]
[<ffffffffa071405d>] kvm_vcpu_ioctl+0x33d/0x620 [kvm]
[<ffffffff81241648>] do_vfs_ioctl+0x298/0x480
[<ffffffff812418a9>] SyS_ioctl+0x79/0x90
[<ffffffff817a0f2e>] entry_SYSCALL_64_fastpath+0x12/0x71
Code: 55 83 ff 07 48 89 e5 77 27 89 ff ff 24 fd 90 87 80 81 0f 23 fe 5d c3 0f 23 c6 5d c3 0f 23 ce 5d c3 0f 23 d6 5d c3 0f 23 de 5d c3 <0f> 23 f6 5d c3 0f 0b 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
RIP [<ffffffff810639eb>] native_set_debugreg+0x2b/0x40
RSP <ffff88005836bd50>Testcase (beautified/reduced from syzkaller output):
#include <unistd.h>
#include <sys/syscall.h>
#include <string.h>
#include <stdint.h>
#include <linux/kvm.h>
#include <fcntl.h>
#include <sys/ioctl.h>
long r[8];
int main()
{
struct kvm_debugregs dr = { 0 };
r[2] = open("/dev/kvm", O_RDONLY);
r[3] = ioctl(r[2], KVM_CREATE_VM, 0);
r[4] = ioctl(r[3], KVM_CREATE_VCPU, 7);
memcpy(&dr,
"\x5d\x6a\x6b\xe8\x57\x3b\x4b\x7e\xcf\x0d\xa1\x72"
"\xa3\x4a\x29\x0c\xfc\x6d\x44\x00\xa7\x52\xc7\xd8"
"\x00\xdb\x89\x9d\x78\xb5\x54\x6b\x6b\x13\x1c\xe9"
"\x5e\xd3\x0e\x40\x6f\xb4\x66\xf7\x5b\xe3\x36\xcb",
48);
r[7] = ioctl(r[4], KVM_SET_DEBUGREGS, &dr);
r[6] = ioctl(r[4], KVM_RUN, 0);
}--- arch/x86/kvm/x86.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kvm/x86.c +5 -0
@@ -2952,6 +2952,11 @@ static int kvm_vcpu_ioctl_x86_set_debugrif (dbgregs->flags)return -EINVAL ; +if (dbgregs->dr6 & ~0xffffffffull ) +return -EINVAL ; +if (dbgregs->dr7 & ~0xffffffffull ) +return -EINVAL ; +memcpy (vcpu->arch.db, dbgregs->db,sizeof (vcpu->arch.db)); vcpu->arch.dr6 = dbgregs->dr6; vcpu->arch.dr7 = dbgregs->dr7;
PATCH 53/94 base: make module_create_drivers_dir race-free
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit 7e1b1fc4dabd6ec8e28baa0708866e13fa93c9b3 upstream.
Modules which register drivers via standard path (driver_register) in parallel can cause a warning:
WARNING: CPU: 2 PID: 3492 at ../fs/sysfs/dir.c:31 sysfs_warn_dup+0x62/0x80 sysfs: cannot create duplicate filename '/module/saa7146/drivers' Modules linked in: hexium_gemini(+) mxb(+) ... ... Call Trace: ... [<ffffffff812e63a2>] sysfs_warn_dup+0x62/0x80 [<ffffffff812e6487>] sysfs_create_dir_ns+0x77/0x90 [<ffffffff8140f2c4>] kobject_add_internal+0xb4/0x340 [<ffffffff8140f5b8>] kobject_add+0x68/0xb0 [<ffffffff8140f631>] kobject_create_and_add+0x31/0x70 [<ffffffff8157a703>] module_add_driver+0xc3/0xd0 [<ffffffff8155e5d4>] bus_add_driver+0x154/0x280 [<ffffffff815604c0>] driver_register+0x60/0xe0 [<ffffffff8145bed0>] __pci_register_driver+0x60/0x70 [<ffffffffa0273e14>] saa7146_register_extension+0x64/0x90 [saa7146] [<ffffffffa0033011>] hexium_init_module+0x11/0x1000 [hexium_gemini]
...
As can be (mostly) seen, driver_register causes this call sequence:
-> bus_add_driver
-> module_add_driver
-> module_create_drivers_dirThe last one creates "drivers" directory in /sys/module/<...>. When this is done in parallel, the directory is attempted to be created twice at the same time.
This can be easily reproduced by loading mxb and hexium_gemini in parallel:
while :; do
modprobe mxb &
modprobe hexium_gemini
wait
rmmod mxb hexium_gemini saa7146_vv saa7146
done
saa7146 calls pci_register_driver for both mxb and hexium_gemini, which means /sys/module/saa7146/drivers is to be created for both of them.
Fix this by a new mutex in module_create_drivers_dir which makes the test-and-create "drivers" dir atomic.
I inverted the condition and removed 'return' to avoid multiple unlocks or a goto.
--- drivers/base/module.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/base/module.c +5 -3
@@ -24,10 +24,12 @@ static char *make_driver_name(struct devstatic void module_create_drivers_dir (struct module_kobject *mk) { -if (!mk || mk->drivers_dir) -return ; +static DEFINE_MUTEX (drivers_dir_mutex); - mk->drivers_dir =kobject_create_and_add ("drivers" , &mk->kobj); +mutex_lock (&drivers_dir_mutex); +if (mk && !mk->drivers_dir) + mk->drivers_dir =kobject_create_and_add ("drivers" , &mk->kobj); +mutex_unlock (&drivers_dir_mutex); }void module_add_driver (struct module *mod,struct device_driver *drv)
PATCH 71/94 staging: iio: accel: fix error check
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Luis de Bethencourt <[email protected]>
commit ef3149eb3ddb7f9125e11c90f8330e371b55cffd upstream.
sca3000_read_ctrl_reg() returns a negative number on failure, check for this instead of zero.
--- drivers/staging/iio/accel/sca3000_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/accel/sca3000_core.c +1 -1
@@ -579,7 +579,7 @@ static ssize_t sca3000_read_frequency(st goto error_ret_mut; ret =sca3000_read_ctrl_reg (st,SCA3000_REG_CTRL_SEL_OUT_CTRL );mutex_unlock (&st->lock); -if (ret) +if (ret <0 ) goto error_ret; val = ret;if (base_freq >0 )
PATCH 25/94 fs/cifs: correctly to anonymous authentication via NTLMSSP
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
commit cfda35d98298131bf38fbad3ce4cd5ecb3cf18db upstream.
See [MS-NLMP] 3.2.5.1.2 Server Receives an AUTHENTICATE_MESSAGE from the Client:
...
Set NullSession to FALSE
If (AUTHENTICATE_MESSAGE.UserNameLen == 0 AND
AUTHENTICATE_MESSAGE.NtChallengeResponse.Length == 0 AND
(AUTHENTICATE_MESSAGE.LmChallengeResponse == Z(1)
OR
AUTHENTICATE_MESSAGE.LmChallengeResponse.Length == 0))
-- Special case: client requested anonymous authentication
Set NullSession to TRUE...
Only server which map unknown users to guest will allow access using a non-null NTChallengeResponse.
For Samba it's the "map to guest = bad user" option.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
---
fs/cifs/sess.c +20 -12
@@ -480,19 +480,27 @@ static int build_ntlmssp_auth_blob(unsig sec_blob->LmChallengeResponse.MaximumLength =0 ; sec_blob->NtChallengeResponse.BufferOffset =cpu_to_le32 (tmp - pbuffer); - rc =setup_ntlmv2_rsp (ses, nls_cp); -if (rc) { -cERROR (1 ,"Error %d during NTLMSSP authentication" , rc); - goto setup_ntlmv2_ret; - } -memcpy (tmp, ses->auth_key.response +CIFS_SESS_KEY_SIZE , - ses->auth_key.len -CIFS_SESS_KEY_SIZE ); - tmp += ses->auth_key.len -CIFS_SESS_KEY_SIZE ; +if (ses->user_name !=NULL ) { + rc =setup_ntlmv2_rsp (ses, nls_cp); +if (rc) { +cERROR (1 ,"Error %d during NTLMSSP authentication" , rc); + goto setup_ntlmv2_ret; + } +memcpy (tmp, ses->auth_key.response +CIFS_SESS_KEY_SIZE , + ses->auth_key.len -CIFS_SESS_KEY_SIZE ); + tmp += ses->auth_key.len -CIFS_SESS_KEY_SIZE ; - sec_blob->NtChallengeResponse.Length = -cpu_to_le16 (ses->auth_key.len -CIFS_SESS_KEY_SIZE ); - sec_blob->NtChallengeResponse.MaximumLength = -cpu_to_le16 (ses->auth_key.len -CIFS_SESS_KEY_SIZE ); + sec_blob->NtChallengeResponse.Length = +cpu_to_le16 (ses->auth_key.len -CIFS_SESS_KEY_SIZE ); + sec_blob->NtChallengeResponse.MaximumLength = +cpu_to_le16 (ses->auth_key.len -CIFS_SESS_KEY_SIZE ); + }else { +/* +* don't send an NT Response for anonymous access +*/ + sec_blob->NtChallengeResponse.Length =0 ; + sec_blob->NtChallengeResponse.MaximumLength =0 ; + }if (ses->domainName ==NULL ) { sec_blob->DomainName.BufferOffset =cpu_to_le32 (tmp - pbuffer);
PATCH 64/94 xen/pciback: Fix conf_space read/write overlap check.
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Grodzovsky <[email protected]>
commit 02ef871ecac290919ea0c783d05da7eedeffc10e upstream.
Current overlap check is evaluating to false a case where a filter field is fully contained (proper subset) of a r/w request. This change applies classical overlap check instead to include all the scenarios.
More specifically, for (Hilscher GmbH CIFX 50E-DP(M/S)) device driver the logic is such that the entire confspace is read and written in 4 byte chunks. In this case as an example, CACHE_LINE_SIZE, LATENCY_TIMER and PCI_BIST are arriving together in one call to xen_pcibk_config_write() with offset == 0xc and size == 4. With the exsisting overlap check the LATENCY_TIMER field (offset == 0xd, length == 1) is fully contained in the write request and hence is excluded from write, which is incorrect.
--- drivers/xen/xen-pciback/conf_space.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/xen/xen-pciback/conf_space.c +2 -4
@@ -183,8 +183,7 @@ int xen_pcibk_config_read(struct pci_dev field_start =OFFSET (cfg_entry); field_end =OFFSET (cfg_entry) + field->size; -if ((req_start >= field_start && req_start < field_end) - || (req_end > field_start && req_end <= field_end)) { +if (req_end > field_start && field_end > req_start) { err =conf_space_read (dev, cfg_entry, field_start, &tmp_val);if (err)
@@ -230,8 +229,7 @@ int xen_pcibk_config_write(struct pci_de field_start =OFFSET (cfg_entry); field_end =OFFSET (cfg_entry) + field->size; -if ((req_start >= field_start && req_start < field_end) - || (req_end > field_start && req_end <= field_end)) { +if (req_end > field_start && field_end > req_start) { tmp_val =0 ; err = xen_pcibk_config_read(dev, field_start,
PATCH 39/94 ARM: fix PTRACE_SETVFPREGS on SMP systems
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit e2dfb4b880146bfd4b6aa8e138c0205407cebbaf upstream.
PTRACE_SETVFPREGS fails to properly mark the VFP register set to be reloaded, because it undoes one of the effects of vfp_flush_hwstate().
Specifically vfp_flush_hwstate() sets thread->vfpstate.hard.cpu to an invalid CPU number, but vfp_set() overwrites this with the original CPU number, thereby rendering the hardware state as apparently "valid", even though the software state is more recent.
Fix this by reverting the previous change.
--- arch/arm/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/ptrace.c +1 -1
@@ -726,8 +726,8 @@ static int vfp_set(struct task_struct *tif (ret)return ret; -vfp_flush_hwstate (thread); thread->vfpstate.hard = new_vfp; +vfp_flush_hwstate (thread);return 0 ; }
PATCH 6/94 crypto: s5p-sss - fix incorrect usage of scatterlists api
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit d1497977fecb9acce05988d6322ad415ef93bb39 upstream.
sg_dma_len() macro can be used only on scattelists which are mapped, so all calls to it before dma_map_sg() are invalid. Replace them by proper check for direct sg segment length read.
[bwh: Backported to 3.2: unaligned DMA is unsupported so there is a different
set of calls to replace]
---
drivers/crypto/s5p-sss.c +4 -4
@@ -210,11 +210,11 @@ static int s5p_set_outdata(struct s5p_ae {int err; -if (!IS_ALIGNED (sg_dma_len (sg),AES_BLOCK_SIZE )) { +if (!IS_ALIGNED (sg->length,AES_BLOCK_SIZE )) { err = -EINVAL ; goto exit; } -if (!sg_dma_len (sg)) { +if (!sg->length) { err = -EINVAL ; goto exit; }
@@ -236,11 +236,11 @@ static int s5p_set_indata(struct s5p_aes {int err; -if (!IS_ALIGNED (sg_dma_len (sg),AES_BLOCK_SIZE )) { +if (!IS_ALIGNED (sg->length,AES_BLOCK_SIZE )) { err = -EINVAL ; goto exit; } -if (!sg_dma_len (sg)) { +if (!sg->length) { err = -EINVAL ; goto exit; }
PATCH 63/94 can: fix oops caused by wrong rtnl dellink usage
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
commit 25e1ed6e64f52a692ba3191c4fde650aab3ecc07 upstream.
For 'real' hardware CAN devices the netlink interface is used to set CAN specific communication parameters. Real CAN hardware can not be created nor removed with the ip tool ...
This patch adds a private dellink function for the CAN device driver interface that does just nothing.
It's a follow up to commit 993e6f2fd ("can: fix oops caused by wrong rtnl newlink usage") but for dellink.
--- drivers/net/can/dev.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/can/dev.c +6 -0
@@ -730,6 +730,11 @@ static int can_newlink(struct net *src_nreturn -EOPNOTSUPP ; } +static void can_dellink (struct net_device *dev,struct list_head *head) +{ +return ; +} +static struct rtnl_link_ops can_link_ops__read_mostly = { .kind ="can" , .maxtype =IFLA_CAN_MAX ,
@@ -737,6 +742,7 @@ static struct rtnl_link_ops can_link_ops .setup = can_setup, .newlink = can_newlink, .changelink = can_changelink, + .dellink = can_dellink, .get_size = can_get_size, .fill_info = can_fill_info, .get_xstats_size = can_get_xstats_size,
PATCH 75/94 batman-adv: Fix use-after-free/double-free of tt_req_node
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 9c4604a298e0a9807eaf2cd912d1ebf24d98fbeb upstream.
The tt_req_node is added and removed from a list inside a spinlock. But the locking is sometimes removed even when the object is still referenced and will be used later via this reference. For example batadv_send_tt_request can create a new tt_req_node (including add to a list) and later re-acquires the lock to remove it from the list and to free it. But at this time another context could have already removed this tt_req_node from the list and freed it.
CPU#0
batadv_batman_skb_recv from net_device 0
-> batadv_iv_ogm_receive
-> batadv_iv_ogm_process
-> batadv_iv_ogm_process_per_outif
-> batadv_tvlv_ogm_receive
-> batadv_tvlv_ogm_receive
-> batadv_tvlv_containers_process
-> batadv_tvlv_call_handler
-> batadv_tt_tvlv_ogm_handler_v1
-> batadv_tt_update_orig
-> batadv_send_tt_request
-> batadv_tt_req_node_new
spin_lock(...)
allocates new tt_req_node and adds it to list
spin_unlock(...)
return tt_req_nodeCPU#1
batadv_batman_skb_recv from net_device 1
-> batadv_recv_unicast_tvlv
-> batadv_tvlv_containers_process
-> batadv_tvlv_call_handler
-> batadv_tt_tvlv_unicast_handler_v1
-> batadv_handle_tt_response
spin_lock(...)
tt_req_node gets removed from list and is freed
spin_unlock(...)CPU#0
<- returned to batadv_send_tt_request
spin_lock(...)
tt_req_node gets removed from list and is freed MEMORY CORRUPTION/SEGFAULT/... spin_unlock(...)
This can only be solved via reference counting to allow multiple contexts to handle the list manipulation while making sure that only the last context holding a reference will free the object.
[bwh: Backported to 3.2:
- Adjust context
- Use struct tt_req_node instead of struct batadv_tt_req_node
- Use list_empty() instead of hlist_unhashed()
- Drop kernel-doc change]
--- net/batman-adv/translation-table.c | 43 ++++++++++++++++++++++++++++++++------ net/batman-adv/types.h | 2 ++ 2 files changed, 39 insertions(+), 6 deletions(-)
net/batman-adv/translation-table.c +37 -5
@@ -952,6 +952,29 @@ uint16_t tt_local_crc(struct bat_priv *breturn total; } +/** +* batadv_tt_req_node_release - free tt_req node entry +* @ref: kref pointer of the tt req_node entry +*/ +static void batadv_tt_req_node_release (struct kref *ref) +{ +struct tt_req_node *tt_req_node; + + tt_req_node = container_of(ref, struct tt_req_node, refcount); + +kfree (tt_req_node); +} + +/** +* batadv_tt_req_node_put - decrement the tt_req_node refcounter and +* possibly release it +* @tt_req_node: tt_req_node to be free'd +*/ +static void batadv_tt_req_node_put (struct tt_req_node *tt_req_node) +{ +kref_put (&tt_req_node->refcount, batadv_tt_req_node_release); +} +static void tt_req_list_free (struct bat_priv *bat_priv) {struct tt_req_node *node, *safe;
@@ -960,7 +983,7 @@ static void tt_req_list_free(struct bat_list_for_each_entry_safe (node, safe, &bat_priv->tt_req_list, list) {list_del (&node->list); -kfree (node); +batadv_tt_req_node_put (node); }spin_unlock_bh (&bat_priv->tt_req_list_lock);
@@ -995,7 +1018,7 @@ static void tt_req_purge(struct bat_privif (is_out_of_time (node->issued_at,TT_REQUEST_TIMEOUT *1000 )) {list_del (&node->list); -kfree (node); +batadv_tt_req_node_put (node); } }spin_unlock_bh (&bat_priv->tt_req_list_lock);
@@ -1020,9 +1043,11 @@ static struct tt_req_node *new_tt_req_noif (!tt_req_node) goto unlock; +kref_init (&tt_req_node->refcount);memcpy (tt_req_node->addr, orig_node->orig,ETH_ALEN ); tt_req_node->issued_at = jiffies; +kref_get (&tt_req_node->refcount);list_add (&tt_req_node->list, &bat_priv->tt_req_list); unlock:spin_unlock_bh (&bat_priv->tt_req_list_lock);
@@ -1174,12 +1199,19 @@ out:hardif_free_ref (primary_if);if (ret)kfree_skb (skb); +if (ret && tt_req_node) {spin_lock_bh (&bat_priv->tt_req_list_lock); -list_del (&tt_req_node->list); +if (!list_empty (&tt_req_node->list)) { +list_del (&tt_req_node->list); +batadv_tt_req_node_put (tt_req_node); + }spin_unlock_bh (&bat_priv->tt_req_list_lock); -kfree (tt_req_node); } + +if (tt_req_node) +batadv_tt_req_node_put (tt_req_node); +return ret; }
@@ -1552,7 +1584,7 @@ void handle_tt_response(struct bat_privif (!compare_eth (node->addr, tt_response->src))continue ;list_del (&node->list); -kfree (node); +batadv_tt_req_node_put (node); }spin_unlock_bh (&bat_priv->tt_req_list_lock);
net/batman-adv/types.h +1 -0
@@ -250,6 +250,7 @@ struct tt_change_node {struct tt_req_node {uint8_t addr[ETH_ALEN ];unsigned long issued_at; +struct kref refcount;struct list_head list; };
PATCH 52/94 kernel/sysrq, watchdog, sched/core: Reset watchdog on all CPUs while processing sysrq-w
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit 57675cb976eff977aefb428e68e4e0236d48a9ff upstream.
Lengthy output of sysrq-w may take a lot of time on slow serial console.
Currently we reset NMI-watchdog on the current CPU to avoid spurious lockup messages. Sometimes this doesn't work since softlockup watchdog might trigger on another CPU which is waiting for an IPI to proceed. We reset softlockup watchdogs on all CPUs, but we do this only after listing all tasks, and this may be too late on a busy system.
So, reset watchdogs CPUs earlier, in for_each_process_thread() loop.
--- kernel/sched.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched.c +4 -2
@@ -6260,14 +6260,16 @@ void show_state_filter(unsigned long sta/* * reset the NMI-timeout, listing all files on a slow * console might take a lot of time: +* Also, reset softlockup watchdogs on all CPUs, because +* another CPU might be blocked waiting for us to process +* an IPI. */ touch_nmi_watchdog (); +touch_all_softlockup_watchdogs ();if (!state_filter || (p->state & state_filter))sched_show_task (p); }while_each_thread (g, p); -touch_all_softlockup_watchdogs (); -#ifdef CONFIG_SCHED_DEBUG sysrq_sched_debug_show ();#endif
PATCH 9/94 ext4: fix hang when processing corrupted orphaned inode list
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit c9eb13a9105e2e418f72e46a2b6da3f49e696902 upstream.
If the orphaned inode list contains inode #5, ext4_iget() returns a bad inode (since the bootloader inode should never be referenced directly). Because of the bad inode, we end up processing the inode repeatedly and this hangs the machine.
This can be reproduced via:
mke2fs -t ext4 /tmp/foo.img 100
debugfs -w -R "ssv last_orphan 5" /tmp/foo.img
mount -o loop /tmp/foo.img /mnt
(But don't do this if you are using an unpatched kernel if you care about the system staying functional. :-)
This bug was found by the port of American Fuzzy Lop into the kernel to find file system problems[1]. (Since it *only* happens if inode #5 shows up on the orphan list --- 3, 7, 8, etc. won't do it, it's not surprising that AFL needed two hours before it found it.)
Reported by: Vegard Nossum <[email protected]>
--- fs/ext4/ialloc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ext4/ialloc.c +6 -4
@@ -999,11 +999,13 @@ struct inode *ext4_orphan_get(struct sup goto iget_failed;/* -* If the orphans has i_nlinks > 0 then it should be able to be -* truncated, otherwise it won't be removed from the orphan list -* during processing and an infinite loop will result. +* If the orphans has i_nlinks > 0 then it should be able to +* be truncated, otherwise it won't be removed from the orphan +* list during processing and an infinite loop will result. +* Similarly, it must not be a bad inode. */ -if (inode->i_nlink && !ext4_can_truncate (inode)) +if ((inode->i_nlink && !ext4_can_truncate (inode)) || +is_bad_inode (inode)) goto bad_orphan;if (NEXT_ORPHAN (inode) > max_ino)
PATCH 70/94 fs/nilfs2: fix potential underflow in call to crc32_le
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Torsten Hilbrich <[email protected]>
commit 63d2f95d63396059200c391ca87161897b99e74a upstream.
The value `bytes' comes from the filesystem which is about to be mounted. We cannot trust that the value is always in the range we expect it to be.
Check its value before using it to calculate the length for the crc32_le call. It value must be larger (or equal) sumoff + 4.
This fixes a kernel bug when accidentially mounting an image file which had the nilfs2 magic value 0x3434 at the right offset 0x406 by chance. The bytes 0x01 0x00 were stored at 0x408 and were interpreted as a s_bytes value of 1. This caused an underflow when substracting sumoff + 4 (20) in the call to crc32_le.
BUG: unable to handle kernel paging request at ffff88021e600000
IP: crc32_le+0x36/0x100
...
Call Trace:
nilfs_valid_sb.part.5+0x52/0x60 [nilfs2]
nilfs_load_super_block+0x142/0x300 [nilfs2]
init_nilfs+0x60/0x390 [nilfs2]
nilfs_mount+0x302/0x520 [nilfs2]
mount_fs+0x38/0x160
vfs_kern_mount+0x67/0x110
do_mount+0x269/0xe00
SyS_mount+0x9f/0x100
entry_SYSCALL_64_fastpath+0x16/0x71--- fs/nilfs2/the_nilfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/the_nilfs.c +1 -1
@@ -425,7 +425,7 @@ static int nilfs_valid_sb(struct nilfs_sif (!sbp ||le16_to_cpu (sbp->s_magic) !=NILFS_SUPER_MAGIC )return 0 ; bytes =le16_to_cpu (sbp->s_bytes); -if (bytes >BLOCK_SIZE ) +if (bytes < sumoff +4 || bytes >BLOCK_SIZE )return 0 ; crc =crc32_le (le32_to_cpu (sbp->s_crc_seed), (unsigned char *)sbp, sumoff);
PATCH 1/94 regmap: cache: Fix typo in cache_bypass parameter description
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Andrew F. Davis" <[email protected]>
commit 267c85860308d36bc163c5573308cd024f659d7c upstream.
Setting the flag 'cache_bypass' will bypass the cache not the hardware. Fix this comment here.
--- drivers/base/regmap/regcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regcache.c +1 -1
@@ -294,7 +294,7 @@ EXPORT_SYMBOL_GPL(regcache_cache_only);* regcache_cache_bypass: Put a register map into cache bypass mode * * @map: map to configure -* @cache_bypass: flag if changes should not be written to the hardware +* @cache_bypass: flag if changes should not be written to the cache * * When a register map is marked with the cache bypass option, writes * to the register map API will only update the hardware and not the
PATCH 87/94 USB: usbfs: fix potential infoleak in devio
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <[email protected]>
commit 681fef8380eb818c0b845fca5d2ab1dcbab114ee upstream.
The stack object “ci” has a total size of 8 bytes. Its last 3 bytes are padding bytes which are not initialized and leaked to userland via “copy_to_user”.
--- drivers/usb/core/devio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/core/devio.c +5 -4
@@ -1005,10 +1005,11 @@ static int proc_getdriver(struct dev_stastatic int proc_connectinfo (struct dev_state *ps,void __user *arg) { -struct usbdevfs_connectinfo ci = { - .devnum = ps->dev->devnum, - .slow = ps->dev->speed ==USB_SPEED_LOW - }; +struct usbdevfs_connectinfo ci; + +memset (&ci,0 ,sizeof (ci)); + ci.devnum = ps->dev->devnum; + ci.slow = ps->dev->speed ==USB_SPEED_LOW ;if (copy_to_user (arg, &ci,sizeof (ci)))return -EFAULT ;
PATCH 3/94 crypto: s5p-sss - Fix missed interrupts when working with 8 kB blocks
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 79152e8d085fd64484afd473ef6830b45518acba upstream.
The tcrypt testing module on Exynos5422-based Odroid XU3/4 board failed on testing 8 kB size blocks:
$ sudo modprobe tcrypt sec=1 mode=500 testing speed of async ecb(aes) (ecb-aes-s5p) encryption test 0 (128 bit key, 16 byte blocks): 21971 operations in 1 seconds (351536 bytes) test 1 (128 bit key, 64 byte blocks): 21731 operations in 1 seconds (1390784 bytes) test 2 (128 bit key, 256 byte blocks): 21932 operations in 1 seconds (5614592 bytes) test 3 (128 bit key, 1024 byte blocks): 21685 operations in 1 seconds (22205440 bytes) test 4 (128 bit key, 8192 byte blocks):
This was caused by a race issue of missed BRDMA_DONE ("Block cipher Receiving DMA") interrupt. Device starts processing the data in DMA mode immediately after setting length of DMA block: receiving (FCBRDMAL) or transmitting (FCBTDMAL). The driver sets these lengths from interrupt handler through s5p_set_dma_indata() function (or xxx_setdata()).
However the interrupt handler was first dealing with receive buffer (dma-unmap old, dma-map new, set receive block length which starts the operation), then with transmit buffer and finally was clearing pending interrupts (FCINTPEND). Because of the time window between setting receive buffer length and clearing pending interrupts, the operation on receive buffer could end already and driver would miss new interrupt.
User manual for Exynos5422 confirms in example code that setting DMA block lengths should be the last operation.
The tcrypt hang could be also observed in following blocked-task dmesg:
INFO: task modprobe:258 blocked for more than 120 seconds.
Not tainted 4.6.0-rc4-next-20160419-00005-g9eac8b7b7753-dirty #42"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
modprobe D c06b09d8 0 258 256 0x00000000
[<c06b09d8>] (__schedule) from [<c06b0f24>] (schedule+0x40/0xac)
[<c06b0f24>] (schedule) from [<c06b49f8>] (schedule_timeout+0x124/0x178) [<c06b49f8>] (schedule_timeout) from [<c06b17fc>] (wait_for_common+0xb8/0x144) [<c06b17fc>] (wait_for_common) from [<bf0013b8>] (test_acipher_speed+0x49c/0x740 [tcrypt]) [<bf0013b8>] (test_acipher_speed [tcrypt]) from [<bf003e8c>] (do_test+0x2240/0x30ec [tcrypt]) [<bf003e8c>] (do_test [tcrypt]) from [<bf008048>] (tcrypt_mod_init+0x48/0xa4 [tcrypt]) [<bf008048>] (tcrypt_mod_init [tcrypt]) from [<c010177c>] (do_one_initcall+0x3c/0x16c) [<c010177c>] (do_one_initcall) from [<c0191ff0>] (do_init_module+0x5c/0x1ac) [<c0191ff0>] (do_init_module) from [<c0185610>] (load_module+0x1a30/0x1d08) [<c0185610>] (load_module) from [<c0185ab0>] (SyS_finit_module+0x8c/0x98) [<c0185ab0>] (SyS_finit_module) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
--- drivers/crypto/s5p-sss.c | 53 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 14 deletions(-)
drivers/crypto/s5p-sss.c +39 -14
@@ -258,39 +258,51 @@ static int s5p_set_indata(struct s5p_aesreturn err; } -static void s5p_aes_tx (struct s5p_aes_dev *dev) +/* +* Returns true if new transmitting (output) data is ready and its +* address+length have to be written to device (by calling +* s5p_set_dma_outdata()). False otherwise. +*/ +static bool s5p_aes_tx (struct s5p_aes_dev *dev) {int err =0 ; +bool ret = false;s5p_unset_outdata (dev);if (!sg_is_last (dev->sg_dst)) { err =s5p_set_outdata (dev,sg_next (dev->sg_dst)); -if (err) { +if (err)s5p_aes_complete (dev, err); -return ; - } - -s5p_set_dma_outdata (dev, dev->sg_dst); +else + ret = true; }else s5p_aes_complete (dev, err); + +return ret; } -static void s5p_aes_rx (struct s5p_aes_dev *dev) +/* +* Returns true if new receiving (input) data is ready and its +* address+length have to be written to device (by calling +* s5p_set_dma_indata()). False otherwise. +*/ +static bool s5p_aes_rx (struct s5p_aes_dev *dev) {int err; +bool ret = false;s5p_unset_indata (dev);if (!sg_is_last (dev->sg_src)) { err =s5p_set_indata (dev,sg_next (dev->sg_src)); -if (err) { +if (err)s5p_aes_complete (dev, err); -return ; - } - -s5p_set_dma_indata (dev, dev->sg_src); +else + ret = true; } + +return ret; }static irqreturn_t s5p_aes_interrupt (int irq,void *dev_id)
@@ -299,19 +311,32 @@ static irqreturn_t s5p_aes_interrupt(intstruct s5p_aes_dev *dev =platform_get_drvdata (pdev);uint32_t status;unsigned long flags; +bool set_dma_tx = false; +bool set_dma_rx = false;spin_lock_irqsave (&dev->lock, flags);if (irq == dev->irq_fc) { status =SSS_READ (dev,FCINTSTAT );if (status &SSS_FCINTSTAT_BRDMAINT ) -s5p_aes_rx (dev); + set_dma_rx =s5p_aes_rx (dev);if (status &SSS_FCINTSTAT_BTDMAINT ) -s5p_aes_tx (dev); + set_dma_tx =s5p_aes_tx (dev);SSS_WRITE (dev,FCINTPEND , status); } +/* +* Writing length of DMA block (either receiving or transmitting) +* will start the operation immediately, so this should be done +* at the end (even after clearing pending interrupts to not miss the +* interrupt). +*/ +if (set_dma_tx) +s5p_set_dma_outdata (dev, dev->sg_dst); +if (set_dma_rx) +s5p_set_dma_indata (dev, dev->sg_src); +spin_unlock_irqrestore (&dev->lock, flags);return IRQ_HANDLED ;
PATCH 37/94 Input: pwm-beeper - fix - scheduling while atomic
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Manfred Schlaegl <[email protected]>
commit f49cf3b8b4c841457244c461c66186a719e13bcc upstream.
Pwm config may sleep so defer it using a worker.
On a Freescale i.MX53 based board we ran into "BUG: scheduling while atomic" because input_inject_event locks interrupts, but imx_pwm_config_v2 sleeps.
Tested on Freescale i.MX53 SoC with 4.6.0.
--- drivers/input/misc/pwm-beeper.c | 69 ++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 21 deletions(-)
drivers/input/misc/pwm-beeper.c +48 -21
@@ -19,21 +19,40 @@#include <linux/platform_device.h> #include <linux/pwm.h> #include <linux/slab.h> +#include <linux/workqueue.h> struct pwm_beeper {struct input_dev *input;struct pwm_device *pwm; +struct work_struct work;unsigned long period; };#define HZ_TO_NANOSECONDS (x) (1000000000UL/(x)) +static void __pwm_beeper_set (struct pwm_beeper *beeper) +{ +unsigned long period = beeper->period; + +if (period) { +pwm_config (beeper->pwm, period /2 , period); +pwm_enable (beeper->pwm); + }else +pwm_disable (beeper->pwm); +} + +static void pwm_beeper_work (struct work_struct *work) +{ +struct pwm_beeper *beeper = + container_of(work, struct pwm_beeper, work); + +__pwm_beeper_set (beeper); +} +static int pwm_beeper_event (struct input_dev *input,unsigned int type,unsigned int code,int value) { -int ret =0 ;struct pwm_beeper *beeper =input_get_drvdata (input); -unsigned long period;if (type !=EV_SND || value <0 )return -EINVAL ;
@@ -48,22 +67,31 @@ static int pwm_beeper_event(struct inputreturn -EINVAL ; } -if (value ==0 ) { -pwm_disable (beeper->pwm); - }else { - period =HZ_TO_NANOSECONDS (value); - ret =pwm_config (beeper->pwm, period /2 , period); -if (ret) -return ret; - ret =pwm_enable (beeper->pwm); -if (ret) -return ret; - beeper->period = period; - } +if (value ==0 ) + beeper->period =0 ; +else + beeper->period =HZ_TO_NANOSECONDS (value); + +schedule_work (&beeper->work);return 0 ; } +static void pwm_beeper_stop (struct pwm_beeper *beeper) +{ +cancel_work_sync (&beeper->work); + +if (beeper->period) +pwm_disable (beeper->pwm); +} + +static void pwm_beeper_close (struct input_dev *input) +{ +struct pwm_beeper *beeper =input_get_drvdata (input); + +pwm_beeper_stop (beeper); +} +static int __devinit pwm_beeper_probe (struct platform_device *pdev) {unsigned long pwm_id = (unsigned long )pdev->dev.platform_data;
@@ -82,6 +110,8 @@ static int __devinit pwm_beeper_probe(st goto err_free; } +INIT_WORK (&beeper->work, pwm_beeper_work); + beeper->input =input_allocate_device ();if (!beeper->input) {dev_err (&pdev->dev,"Failed to allocate input device\n" );
@@ -101,6 +131,7 @@ static int __devinit pwm_beeper_probe(st beeper->input->sndbit[0 ] =BIT (SND_TONE ) |BIT (SND_BELL ); beeper->input->event = pwm_beeper_event; + beeper->input->close = pwm_beeper_close;input_set_drvdata (beeper->input, beeper);
@@ -131,7 +162,6 @@ static int __devexit pwm_beeper_remove(splatform_set_drvdata (pdev,NULL );input_unregister_device (beeper->input); -pwm_disable (beeper->pwm);pwm_free (beeper->pwm);kfree (beeper);
@@ -144,8 +174,7 @@ static int pwm_beeper_suspend(struct dev {struct pwm_beeper *beeper =dev_get_drvdata (dev); -if (beeper->period) -pwm_disable (beeper->pwm); +pwm_beeper_stop (beeper);return 0 ; }
@@ -154,10 +183,8 @@ static int pwm_beeper_resume(struct devi {struct pwm_beeper *beeper =dev_get_drvdata (dev); -if (beeper->period) { -pwm_config (beeper->pwm, beeper->period /2 , beeper->period); -pwm_enable (beeper->pwm); - } +if (beeper->period) +__pwm_beeper_set (beeper);return 0 ; }
PATCH 48/94 staging:iio: trigger fixes for repeat request of same trigger and allocation failure
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
commit 5dd72ecb0166498852705939163f375d693d37f3 upstream.
Both of these are decidedly silly bugs show up whilst testing completely different code paths.
--- drivers/staging/iio/industrialio-trigger.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/staging/iio/industrialio-trigger.c +11 -1
@@ -222,8 +222,16 @@ static int iio_trigger_attach_poll_func( ret =request_threaded_irq (pf->irq, pf->h, pf->thread, pf->type, pf->name, pf); -if (trig->ops && trig->ops->set_trigger_state && notinuse) +if (ret <0 ) { +module_put (pf->indio_dev->info->driver_module); +return ret; + } + +if (trig->ops && trig->ops->set_trigger_state && notinuse) { ret = trig->ops->set_trigger_state (trig, true); +if (ret <0 ) +module_put (pf->indio_dev->info->driver_module); + }return ret; }
@@ -336,6 +344,8 @@ static ssize_t iio_trigger_write_currentmutex_unlock (&indio_dev->mlock); trig =iio_trigger_find_by_name (buf, len); +if (oldtrig == trig) +return len;if (trig && indio_dev->info->validate_trigger) { ret = indio_dev->info->validate_trigger (indio_dev, trig);
PATCH 85/94 fs: limit filesystem stacking depth
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 69c433ed2ecd2d3264efd7afec4439524b319121 upstream.
Add a simple read-only counter to super_block that indicates how deep this is in the stack of filesystems. Previously ecryptfs was the only stackable filesystem and it explicitly disallowed multiple layers of itself.
Overlayfs, however, can be stacked recursively and also may be stacked on top of ecryptfs or vice versa.
To limit the kernel stack usage we must limit the depth of the filesystem stack. Initially the limit is set to 2.
[bwh: Backported to 3.2:
- Drop changes to overlayfs
- Adjust context]
--- fs/ecryptfs/main.c | 7 +++++++ include/linux/fs.h | 11 +++++++++++ 3 files changed, 27 insertions(+)
fs/ecryptfs/main.c +7 -0
@@ -576,6 +576,13 @@ static struct dentry *ecryptfs_mount(str s->s_maxbytes = path.dentry->d_sb->s_maxbytes; s->s_blocksize = path.dentry->d_sb->s_blocksize; s->s_magic =ECRYPTFS_SUPER_MAGIC ; + s->s_stack_depth = path.dentry->d_sb->s_stack_depth +1 ; + + rc = -EINVAL ; +if (s->s_stack_depth >FILESYSTEM_MAX_STACK_DEPTH ) { +pr_err ("eCryptfs: maximum fs stacking depth exceeded\n" ); + goto out_free; + } inode =ecryptfs_get_inode (path.dentry->d_inode, s); rc =PTR_ERR (inode);
include/linux/fs.h +11 -0
@@ -486,6 +486,12 @@ struct iattr {*/ #include <linux/quota.h> +/* +* Maximum number of layers of fs stack. Needs to be limited to +* prevent kernel stack overflow +*/ +#define FILESYSTEM_MAX_STACK_DEPTH 2 +/** * enum positive_aop_returns - aop return codes with specific semantics *
@@ -1497,6 +1503,11 @@ struct super_block {int cleancache_poolid;struct shrinker s_shrink;/* per-sb shrinker handle */ + +/* +* Indicates how deep in a filesystem stack this SB is +*/ +int s_stack_depth; };/* superblock cache pruning functions */
PATCH 84/94 cifs: dynamic allocation of ntlmssp blob
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Marchand <[email protected]>
commit b8da344b74c822e966c6d19d6b2321efe82c5d97 upstream.
In sess_auth_rawntlmssp_authenticate(), the ntlmssp blob is allocated statically and its size is an "empirical" 5*sizeof(struct _AUTHENTICATE_MESSAGE) (320B on x86_64). I don't know where this value comes from or if it was ever appropriate, but it is currently
insufficient: the user and domain name in UTF16 could take 1kB by themselves. Because of that, build_ntlmssp_auth_blob() might corrupt memory (out-of-bounds write). The size of ntlmssp_blob in SMB2_sess_setup() is too small too (sizeof(struct _NEGOTIATE_MESSAGE)
+ 500).
This patch allocates the blob dynamically inbuild_ntlmssp_auth_blob().
[bwh: Backported to 3.2:
- Adjust context, indentation
- build_ntlmssp_auth_blob() is static
- Drop changes to smb2pdu.c
- Use cERROR() instead of cifs_dbg(VFS, ...)
- Use MAX_USERNAME_SIZE instead of CIFS_MAX_USERNAME_LEN]
---
fs/cifs/sess.c +42 -36
@@ -444,19 +444,43 @@ static void build_ntlmssp_negotiate_blob sec_blob->DomainName.MaximumLength =0 ; } -/* We do not malloc the blob, it is passed in pbuffer, because its -maximum possible size is fixed and small, making this approach cleaner. -This function returns the length of the data in the blob */ -static int build_ntlmssp_auth_blob (unsigned char *pbuffer, +static int size_of_ntlmssp_blob (struct cifs_ses *ses) +{ +int sz =sizeof (AUTHENTICATE_MESSAGE ) + ses->auth_key.len + -CIFS_SESS_KEY_SIZE +CIFS_CPHTXT_SIZE +2 ; + +if (ses->domainName) + sz +=2 *strnlen (ses->domainName,CIFS_MAX_DOMAINNAME_LEN ); +else + sz +=2 ; + +if (ses->user_name) + sz +=2 *strnlen (ses->user_name,MAX_USERNAME_SIZE ); +else + sz +=2 ; + +return sz; +} + +static int build_ntlmssp_auth_blob (unsigned char **pbuffer,u16 *buflen,struct cifs_ses *ses,const struct nls_table *nls_cp) {int rc; -AUTHENTICATE_MESSAGE *sec_blob = (AUTHENTICATE_MESSAGE *)pbuffer; +AUTHENTICATE_MESSAGE *sec_blob;__u32 flags;unsigned char *tmp; + rc =setup_ntlmv2_rsp (ses, nls_cp); +if (rc) { +cERROR (1 ,"Error %d during NTLMSSP authentication" , rc); + *buflen =0 ; + goto setup_ntlmv2_ret; + } + *pbuffer =kmalloc (size_of_ntlmssp_blob (ses),GFP_KERNEL ); + sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer; +memcpy (sec_blob->Signature,NTLMSSP_SIGNATURE ,8 ); sec_blob->MessageType = NtLmAuthenticate;
@@ -471,7 +495,7 @@ static int build_ntlmssp_auth_blob(unsig flags |=NTLMSSP_NEGOTIATE_KEY_XCH ; } - tmp = pbuffer +sizeof (AUTHENTICATE_MESSAGE ); + tmp = *pbuffer +sizeof (AUTHENTICATE_MESSAGE ); sec_blob->NegotiateFlags =cpu_to_le32 (flags); sec_blob->LmChallengeResponse.BufferOffset =
@@ -479,13 +503,9 @@ static int build_ntlmssp_auth_blob(unsig sec_blob->LmChallengeResponse.Length =0 ; sec_blob->LmChallengeResponse.MaximumLength =0 ; - sec_blob->NtChallengeResponse.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->NtChallengeResponse.BufferOffset = +cpu_to_le32 (tmp - *pbuffer);if (ses->user_name !=NULL ) { - rc =setup_ntlmv2_rsp (ses, nls_cp); -if (rc) { -cERROR (1 ,"Error %d during NTLMSSP authentication" , rc); - goto setup_ntlmv2_ret; - }memcpy (tmp, ses->auth_key.response +CIFS_SESS_KEY_SIZE , ses->auth_key.len -CIFS_SESS_KEY_SIZE ); tmp += ses->auth_key.len -CIFS_SESS_KEY_SIZE ;
@@ -503,7 +523,7 @@ static int build_ntlmssp_auth_blob(unsig }if (ses->domainName ==NULL ) { - sec_blob->DomainName.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->DomainName.BufferOffset =cpu_to_le32 (tmp - *pbuffer); sec_blob->DomainName.Length =0 ; sec_blob->DomainName.MaximumLength =0 ; tmp +=2 ;
@@ -512,14 +532,14 @@ static int build_ntlmssp_auth_blob(unsig len =cifs_strtoUCS ((__le16 *)tmp, ses->domainName,MAX_USERNAME_SIZE , nls_cp); len *=2 ;/* unicode is 2 bytes each */ - sec_blob->DomainName.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->DomainName.BufferOffset =cpu_to_le32 (tmp - *pbuffer); sec_blob->DomainName.Length =cpu_to_le16 (len); sec_blob->DomainName.MaximumLength =cpu_to_le16 (len); tmp += len; }if (ses->user_name ==NULL ) { - sec_blob->UserName.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->UserName.BufferOffset =cpu_to_le32 (tmp - *pbuffer); sec_blob->UserName.Length =0 ; sec_blob->UserName.MaximumLength =0 ; tmp +=2 ;
@@ -528,13 +548,13 @@ static int build_ntlmssp_auth_blob(unsig len =cifs_strtoUCS ((__le16 *)tmp, ses->user_name,MAX_USERNAME_SIZE , nls_cp); len *=2 ;/* unicode is 2 bytes each */ - sec_blob->UserName.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->UserName.BufferOffset =cpu_to_le32 (tmp - *pbuffer); sec_blob->UserName.Length =cpu_to_le16 (len); sec_blob->UserName.MaximumLength =cpu_to_le16 (len); tmp += len; } - sec_blob->WorkstationName.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->WorkstationName.BufferOffset =cpu_to_le32 (tmp - *pbuffer); sec_blob->WorkstationName.Length =0 ; sec_blob->WorkstationName.MaximumLength =0 ; tmp +=2 ;
@@ -543,19 +563,19 @@ static int build_ntlmssp_auth_blob(unsig (ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC)) && !calc_seckey(ses)) {memcpy (tmp, ses->ntlmssp->ciphertext,CIFS_CPHTXT_SIZE ); - sec_blob->SessionKey.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->SessionKey.BufferOffset =cpu_to_le32 (tmp - *pbuffer); sec_blob->SessionKey.Length =cpu_to_le16 (CIFS_CPHTXT_SIZE ); sec_blob->SessionKey.MaximumLength =cpu_to_le16 (CIFS_CPHTXT_SIZE ); tmp +=CIFS_CPHTXT_SIZE ; } else { - sec_blob->SessionKey.BufferOffset =cpu_to_le32 (tmp - pbuffer); + sec_blob->SessionKey.BufferOffset =cpu_to_le32 (tmp - *pbuffer); sec_blob->SessionKey.Length =0 ; sec_blob->SessionKey.MaximumLength =0 ; } + *buflen = tmp - *pbuffer; setup_ntlmv2_ret: - *buflen = tmp - pbuffer;return rc; }
@@ -578,7 +598,7 @@ CIFS_SessSetup(unsigned int xid, structstruct key *spnego_key =NULL ;__le32 phase = NtLmNegotiate;/* NTLMSSP, if needed, is multistage */ u16 blob_len; -char *ntlmsspblob =NULL ; +unsigned char *ntlmsspblob =NULL ;if (ses ==NULL )return -EINVAL ;
@@ -832,21 +852,7 @@ ssetup_ntlmssp_authenticate:cpu_to_le16 (sizeof (NEGOTIATE_MESSAGE ));break ;case NtLmAuthenticate: -/* -* 5 is an empirical value, large enough to hold -* authenticate message plus max 10 of av paris, -* domain, user, workstation names, flags, etc. -*/ - ntlmsspblob =kzalloc ( -5 *sizeof (struct _AUTHENTICATE_MESSAGE ), -GFP_KERNEL ); -if (!ntlmsspblob) { -cERROR (1 ,"Can't allocate NTLMSSP blob" ); - rc = -ENOMEM ; - goto ssetup_exit; - } - - rc =build_ntlmssp_auth_blob (ntlmsspblob, + rc =build_ntlmssp_auth_blob (&ntlmsspblob, &blob_len, ses, nls_cp);if (rc) goto ssetup_exit;
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.82 release. There are 94 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Aug 16 00:00:00 UTC 2016. Anything received after that time might be too late.
Build results:
total: 89 pass: 89 fail: 0 Qemu test results: total: 61 pass: 61 fail: 0
Details are available at http://kerneltests.org/builders/
Guenter
PATCH 11/94 tty: vt, return error when con_startup fails
In reply to Ben Hutchings3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit 6798df4c5fe0a7e6d2065cf79649a794e5ba7114 upstream.
When csw->con_startup() fails in do_register_con_driver, we return no error (i.e. 0). This was changed back in 2006 by commit 3e795de763. Before that we used to return -ENODEV.
So fix the return value to be -ENODEV in that case again.
--- drivers/tty/vt/vt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/vt/vt.c +3 -2
@@ -3550,9 +3550,10 @@ static int do_register_con_driver(const goto err; desc = csw->con_startup (); - -if (!desc) +if (!desc) { + retval = -ENODEV ; goto err; + } retval = -EINVAL ;
Re: [PATCH 3.2 44/94] wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel
In reply to Ben HutchingsQuoted 9 lines · Ben Hutchings
3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Prasun Maiti <[email protected]>
commit
3d5fdff46c4b2b9534fa2f9fc78e90a48e0ff724upstream.
Did you just include this by accident? You had pointed out yourself that this was broken if anything but iwpoint was transferred, and since the Marvell people shouldn't be using wext anyway I reverted it already.
johannes
Re: [PATCH 3.2 44/94] wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel
Quoted 9 lines · Johannes Berg
Quoted 8 lines · Ben Hutchings
3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
Quoted 1 line
Quoted 1 line
From: Prasun Maiti <[email protected]>
Quoted 7 lines
Quoted 2 lines
commit
3d5fdff46c4b2b9534fa2f9fc78e90a48e0ff724upstream.Did you just include this by accident? You had pointed out yourself that this was broken if anything but iwpoint was transferred, and since the Marvell people shouldn't be using wext anyway I reverted it already.
Yes, this was an accident and I'll drop it.
Ben.
Signature · 2 lines
Ben Hutchings This sentence contradicts itself - no actually it doesn't.