4.4.4-stable review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 4.4.4-stable review
This is the start of the stable review cycle for the 4.4.4 release. There are 342 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Mar 3 23:44:48 UTC 2016. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.4-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.4-rc1
Luca Coelho <[email protected]>
iwlwifi: mvm: don't allow sched scans without matches to be started
Oren Givon <[email protected]>
iwlwifi: update and fix 7265 series PCI IDs
Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: properly configure the debug buffer size for 8000
Emmanuel Grumbach <[email protected]>
iwlwifi: dvm: fix WoWLAN
Jann Horn <[email protected]>
security: let security modules use PTRACE_MODE_* with bitmasks
Matan Barak <[email protected]>
IB/cma: Fix RDMA port validation for iWarp
Thomas Gleixner <[email protected]>
x86/irq: Plug vector cleanup race
Thomas Gleixner <[email protected]>
x86/irq: Call irq_force_move_complete with irq descriptor
Thomas Gleixner <[email protected]>
x86/irq: Remove outgoing CPU from vector cleanup mask
Thomas Gleixner <[email protected]>
x86/irq: Remove the cpumask allocation from send_cleanup_vector()
Thomas Gleixner <[email protected]>
x86/irq: Clear move_in_progress before sending cleanup IPI
Thomas Gleixner <[email protected]>
x86/irq: Remove offline cpus from vector cleanup
Thomas Gleixner <[email protected]>
x86/irq: Get rid of code duplication
Thomas Gleixner <[email protected]>
x86/irq: Copy vectormask instead of an AND operation
Thomas Gleixner <[email protected]>
x86/irq: Check vector allocation early
Thomas Gleixner <[email protected]>
x86/irq: Reorganize the search in assign_irq_vector
Thomas Gleixner <[email protected]>
x86/irq: Reorganize the return path in assign_irq_vector
Jiang Liu <[email protected]>
x86/irq: Do not use apic_chip_data.old_domain as temporary buffer
Thomas Gleixner <[email protected]>
x86/irq: Validate that irq descriptor is still active
Jiang Liu <[email protected]>
x86/irq: Fix a race in x86_vector_free_irqs()
Thomas Gleixner <[email protected]>
x86/irq: Call chip->irq_set_affinity in proper context
Andy Lutomirski <[email protected]>
x86/entry/compat: Add missing CLAC to entry_INT80_32
Colin Ian King <[email protected]>
x86/mpx: Fix off-by-one comparison with nr_registers
Mikulas Patocka <[email protected]>
hpfs: don't truncate the file when delete fails
Al Viro <[email protected]>
do_last(): ELOOP failure exit should be done after leaving RCU mode
Al Viro <[email protected]>
should_follow_link(): validate ->d_seq after having decided to follow
Konrad Rzeszutek Wilk <[email protected]>
xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
Konrad Rzeszutek Wilk <[email protected]>
xen/pciback: Save the number of MSI-X entries to be copied later.
Konrad Rzeszutek Wilk <[email protected]>
xen/pciback: Check PF instead of VF for PCI_COMMAND_MEMORY
Juergen Gross <[email protected]>
xen/scsiback: correct frontend counting
Ian Campbell <[email protected]>
xen/arm: correctly handle DMA mapping of compound pages
Ludovic Desroches <[email protected]>
ARM: at91/dt: fix typo in sama5d2 pinmux descriptions
Ivaylo Dimitrov <[email protected]>
ARM: OMAP2+: Fix onenand initialization to avoid filesystem corruption
Al Viro <[email protected]>
do_last(): don't let a bogus return value from ->open() et.al. to confuse us
Simon Guinot <[email protected]>
kernel/resource.c: fix muxed resource handling in __request_region()
Stefan Hajnoczi <[email protected]>
sunrpc/cache: fix off-by-one in qword_get()
Steven Rostedt (Red Hat) <[email protected]>
tracing: Fix showing function event in available_events
Gavin Shan <[email protected]>
powerpc/eeh: Fix partial hotplug criterion
Mike Krinkin <[email protected]>
KVM: x86: MMU: fix ubsan index-out-of-range warning
Paolo Bonzini <[email protected]>
KVM: x86: fix conversion of addresses to linear in 32-bit protected mode
Paolo Bonzini <[email protected]>
KVM: x86: fix missed hardware breakpoints
Mark Rutland <[email protected]>
KVM: arm/arm64: vgic: Ensure bitmaps are long enough
Christian Borntraeger <[email protected]>
KVM: async_pf: do not warn on page allocation failures
Robin Murphy <[email protected]>
of/irq: Fix msi-map calculation for nonzero rid-base
Benjamin Coddington <[email protected]>
NFSv4: Fix a dentry leak on alias use
Christoph Hellwig <[email protected]>
nfs: fix nfs_size_to_loff_t
Mike Krinkin <[email protected]>
block: fix use-after-free in dio_bio_complete
Hannes Reinecke <[email protected]>
bio: return EINTR if copying to user space got interrupted
Alexandra Yates <[email protected]>
i2c: i801: Adding Intel Lewisburg support for iTCO
Shawn Lin <[email protected]>
phy: core: fix wrong err handle for phy_power_on
Tejun Heo <[email protected]>
writeback: keep superblock pinned during cgroup writeback association switches
Tejun Heo <[email protected]>
cgroup: make sure a parent css isn't offlined before its children
Tejun Heo <[email protected]>
cpuset: make mm migration asynchronous
Sebastian Andrzej Siewior <[email protected]>
PCI/AER: Flush workqueue on device remove to avoid use-after-free
Vineet Gupta <[email protected]>
ARCv2: SMP: Emulate IPI to self using software triggered interrupt
Vineet Gupta <[email protected]>
ARCv2: STAR 9000950267: Handle return from intr to Delay Slot #2
Tejun Heo <[email protected]>
libata: fix sff host state machine locking while polling
Quinn Tran <[email protected]>
qla2xxx: Fix stale pointer access.
Cyrille Pitchen <[email protected]>
spi: atmel: fix gpio chip-select in case of non-DT platform
Nicholas Bellinger <[email protected]>
target: Fix race with SCF_SEND_DELAYED_TAS handling
Nicholas Bellinger <[email protected]>
target: Fix remote-port TMR ABORT + se_cmd fabric stop
Nicholas Bellinger <[email protected]>
target: Fix TAS handling for multi-session se_node_acls
Nicholas Bellinger <[email protected]>
target: Fix LUN_RESET active TMR descriptor handling
Nicholas Bellinger <[email protected]>
target: Fix LUN_RESET active I/O handling for ACK_KREF
Kai-Heng Feng <[email protected]>
ALSA: hda - Fixing background noise on Dell Inspiron 3162
Takashi Iwai <[email protected]>
ALSA: hda - Apply clock gate workaround to Skylake, too
Tejun Heo <[email protected]>
Revert "workqueue: make sure delayed work run in local cpu"
Tejun Heo <[email protected]>
workqueue: handle NUMA_NO_NODE for unbound pool_workqueue lookup
Sachin Kulkarni <[email protected]>
mac80211: Requeue work after scan complete for all VIF types.
Johannes Berg <[email protected]>
rfkill: fix rfkill_fop_read wait_event usage
Wanpeng Li <[email protected]>
tick/nohz: Set the correct expiry when switching to nohz/lowres mode
Jiri Olsa <[email protected]>
perf stat: Do not clean event's private stats
Oliver Neukum <[email protected]>
cdc-acm:exclude Samsung phone 04e8:685d
Sudip Mukherjee <[email protected]>
Revert "Staging: panel: usleep_range is preferred over udelay"
Samuel Thibault <[email protected]>
Staging: speakup: Fix getting port information
Martin K. Petersen <[email protected]>
sd: Optimal I/O size is in bytes, not sectors
Ilya Dryomov <[email protected]>
libceph: don't spam dmesg with stray reply warnings
Ilya Dryomov <[email protected]>
libceph: use the right footer size when skipping a message
Ilya Dryomov <[email protected]>
libceph: don't bail early from try_read() when skipping a message
Ilya Dryomov <[email protected]>
libceph: fix ceph_msg_revoke()
Jann Horn <[email protected]>
seccomp: always propagate NO_NEW_PRIVS on tsync
Viresh Kumar <[email protected]>
cpufreq: Fix NULL reference crash while accessing policy->governor_data
Arnd Bergmann <[email protected]>
cpufreq: pxa2xx: fix pxa_cpufreq_change_voltage prototype
Peter Rosin <[email protected]>
hwmon: (ads1015) Handle negative conversion values correctly
Nishanth Menon <[email protected]>
hwmon: (gpio-fan) Remove un-necessary speed_index lookup for thermal hook
Thorsten Leemhuis <[email protected]>
hwmon: (dell-smm) Blacklist Dell Studio XPS 8000
Chen Yu <[email protected]>
Thermal: do thermal zone update after a cooling device registered
Zhang Rui <[email protected]>
Thermal: handle thermal zone device properly during system sleep
Zhang Rui <[email protected]>
Thermal: initialize thermal zone device correctly
Leon Romanovsky <[email protected]>
IB/mlx5: Expose correct maximum number of CQE capacity
Vinit Agnihotri <[email protected]>
IB/qib: Support creating qps with GFP_NOIO flag
Mike Marciniszyn <[email protected]>
IB/qib: fix mcast detach when qp not attached
Bart Van Assche <[email protected]>
IB/cm: Fix a recently introduced deadlock
Andy Shevchenko <[email protected]>
dmaengine: dw: disable BLOCK IRQs for non-cyclic xfer
Songjun Wu <[email protected]>
dmaengine: at_xdmac: fix resume for cyclic transfers
Mans Rullgard <[email protected]>
dmaengine: dw: fix cyclic transfer callbacks
Mans Rullgard <[email protected]>
dmaengine: dw: fix cyclic transfer setup
Dan Williams <[email protected]>
nfit: fix multi-interface dimm handling, acpi6.1 compatibility
Insu Yun <[email protected]>
ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
Hans de Goede <[email protected]>
ACPI: Revert "ACPI / video: Add Dell Inspiron 5737 to the blacklist"
Hans de Goede <[email protected]>
ACPI / video: Add disable_backlight_sysfs_if quirk for the Toshiba Satellite R830
Hans de Goede <[email protected]>
ACPI / video: Add disable_backlight_sysfs_if quirk for the Toshiba Portege R700
Arnd Bergmann <[email protected]>
lib: sw842: select crc32
Mike Frysinger <[email protected]>
uapi: update install list after nvme.h rename
Josh Boyer <[email protected]>
ideapad-laptop: Add Lenovo Yoga 700 to no_hw_rfkill dmi list
Josh Boyer <[email protected]>
ideapad-laptop: Add Lenovo ideapad Y700-17ISK to no_hw_rfkill dmi list
Azael Avalos <[email protected]>
toshiba_acpi: Fix blank screen at boot if transflective backlight is supported
Al Viro <[email protected]>
make sure that freeing shmem fast symlinks is RCU-delayed
Alex Deucher <[email protected]>
drm/radeon/pm: adjust display configuration after powerstate
Mario Kleiner <[email protected]>
drm/radeon: Don't hang in radeon_flip_work_func on disabled crtc. (v2)
Mario Kleiner <[email protected]>
drm: Fix treatment of drm_vblank_offdelay in drm_vblank_on() (v2)
Mario Kleiner <[email protected]>
drm: Fix drm_vblank_pre/post_modeset regression from Linux 4.4
Mario Kleiner <[email protected]>
drm: Prevent vblank counter bumps > 1 with active vblank clients. (v2)
Mario Kleiner <[email protected]>
drm: No-Op redundant calls to drm_vblank_off() (v2)
Rasmus Villemoes <[email protected]>
drm/radeon: use post-decrement in error handling
Gerd Hoffmann <[email protected]>
drm/qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command
Rasmus Villemoes <[email protected]>
drm/i915: fix error path in intel_setup_gmbus()
Jani Nikula <[email protected]>
drm/i915/dsi: don't pass arbitrary data to sideband
Jani Nikula <[email protected]>
drm/i915/dsi: defend gpio table against out of bounds access
Lyude <[email protected]>
drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select()
Ville Syrjälä <[email protected]>
drm/i915: Don't reject primary plane windowing with color keying enabled on SKL+
Jani Nikula <[email protected]>
drm/i915/dp: fall back to 18 bpp when sink capability is unknown
Francisco Jerez <[email protected]>
drm/i915: Make sure DC writes are coherent on flush.
Daniel Vetter <[email protected]>
drm/i915: Init power domains early in driver load
Lyude <[email protected]>
drm/i915: intel_hpd_init(): Fix suspend/resume reprobing
Chris Wilson <[email protected]>
drm/i915: Restore inhibiting the load of the default context
Insu Yun <[email protected]>
drm: fix missing reference counting decrease
Nicolai Hähnle <[email protected]>
drm/radeon: hold reference to fences in radeon_sa_bo_new
Oded Gabbay <[email protected]>
drm/radeon: mask out WC from BO on unsupported arches
Dave Airlie <[email protected]>
drm: add helper to check for wc memory support
Slava Grigorev <[email protected]>
drm/radeon: fix DP audio support for APU with DCE4.1 display engine
Slava Grigorev <[email protected]>
drm/radeon: Add a common function for DFS handling
Slava Grigorev <[email protected]>
drm/radeon: cleaned up VCO output settings for DP audio
Alex Deucher <[email protected]>
drm/radeon: properly byte swap vce firmware setup
Alex Deucher <[email protected]>
drm/radeon: clean up fujitsu quirks
Slava Grigorev <[email protected]>
drm/radeon: Fix "slow" audio over DP on DCE8+
Alex Deucher <[email protected]>
drm/radeon: call hpd_irq_event on resume
Felix Kuehling <[email protected]>
drm/radeon: Fix off-by-one errors in radeon_vm_bo_set_addr
Mykola Lysenko <[email protected]>
drm/dp/mst: deallocate payload on port destruction
Andrey Grodzovsky <[email protected]>
drm/dp/mst: Reverse order of MST enable and clearing VC payload table.
Hersen Wu <[email protected]>
drm/dp/mst: move GUID storage from mgr, port to only mst branch
Harry Wentland <[email protected]>
drm/dp/mst: Calculate MST PBN with 31.32 fixed point
Harry Wentland <[email protected]>
drm: Add drm_fixp_from_fraction and drm_fixp2int_ceil
Mykola Lysenko <[email protected]>
drm/dp/mst: fix in RAD element access
Mykola Lysenko <[email protected]>
drm/dp/mst: fix in MSTB RAD initialization
Mykola Lysenko <[email protected]>
drm/dp/mst: always send reply for UP request
Mykola Lysenko <[email protected]>
drm/dp/mst: process broadcast messages correctly
Thierry Reding <[email protected]>
drm/nouveau: platform: Fix deferred probe
Ben Skeggs <[email protected]>
drm/nouveau/disp/dp: ensure sink is powered up before attempting link training
Mario Kleiner <[email protected]>
drm/nouveau/display: Enable vblank irqs after display engine is on again.
Ben Skeggs <[email protected]>
drm/nouveau/kms: take mode_config mutex in connector hotplug path
Alex Deucher <[email protected]>
drm/amdgpu/pm: adjust display configuration after powerstate
Mario Kleiner <[email protected]>
drm/amdgpu: Don't hang in amdgpu_flip_work_func on disabled crtc.
Rasmus Villemoes <[email protected]>
drm/amdgpu: use post-decrement in error handling
Christian König <[email protected]>
drm/amdgpu: fix issue with overlapping userptrs
Nicolai Hähnle <[email protected]>
drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)
Nicolai Hähnle <[email protected]>
drm/amdgpu: remove unnecessary forward declaration
Flora Cui <[email protected]>
drm/amdgpu: fix s4 resume
Alex Deucher <[email protected]>
drm/amdgpu: remove exp hardware support from iceland
Alex Deucher <[email protected]>
drm/amdgpu: don't load MEC2 on topaz
Alex Deucher <[email protected]>
drm/amdgpu: drop topaz support from gmc8 module
Alex Deucher <[email protected]>
drm/amdgpu: pull topaz gmc bits into gmc_v7
Ken Wang <[email protected]>
drm/amdgpu: The VI specific EXE bit should only apply to GMC v8.0 above
Ken Wang <[email protected]>
drm/amdgpu: iceland use CI based MC IP
Alex Deucher <[email protected]>
drm/amdgpu: move gmc7 support out of CIK dependency
Alex Deucher <[email protected]>
drm/amdgpu: no need to load MC firmware on fiji
Christian König <[email protected]>
drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2
Alex Deucher <[email protected]>
drm/amdgpu: fix tonga smu resume
Chunming Zhou <[email protected]>
drm/amdgpu: fix lost sync_to if scheduler is enabled.
Alex Deucher <[email protected]>
drm/amdgpu: call hpd_irq_event on resume
Felix Kuehling <[email protected]>
drm/amdgpu: Fix off-by-one errors in amdgpu_vm_bo_map
Rob Clark <[email protected]>
drm/vmwgfx: respect 'nomodeset'
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix an incorrect lock check
Michael S. Tsirkin <[email protected]>
virtio_pci: fix use after free on release
Minchan Kim <[email protected]>
virtio_balloon: fix race between migration and ballooning
Minchan Kim <[email protected]>
virtio_balloon: fix race by fill and leak
Henry Chen <[email protected]>
regulator: mt6311: MT6311_REGULATOR needs to select REGMAP_I2C
Chen-Yu Tsai <[email protected]>
regulator: axp20x: Fix GPIO LDO enable value for AXP22x
Marek Szyprowski <[email protected]>
clk: exynos: use irqsave version of spin_lock to avoid deadlock with irqs
Andrew Donnellan <[email protected]>
cxl: use correct operator when writing pcie config space values
Dmitry V. Levin <[email protected]>
sparc64: fix incorrect sign extension in sys_sparc64_personality
Borislav Petkov <[email protected]>
EDAC, mc_sysfs: Fix freeing bus' name
Borislav Petkov <[email protected]>
EDAC: Robustify workqueues destruction
James Hogan <[email protected]>
MIPS: Fix buffer overflow in syscall_get_arguments()
Huacai Chen <[email protected]>
MIPS: Fix some missing CONFIG_CPU_MIPSR6 #ifdefs
Huacai Chen <[email protected]>
MIPS: hpet: Choose a safe value for the ETIME check
Huacai Chen <[email protected]>
MIPS: Loongson-3: Fix SMP_ASK_C0COUNT IPI handler
Dan Williams <[email protected]>
Revert "MIPS: Fix PAGE_MASK definition"
zengtao <[email protected]>
cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
David Gibson <[email protected]>
time: Avoid signed overflow in timekeeping_get_ns()
Lukasz Duda <[email protected]>
Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets
Glenn Ruben Bakke <[email protected]>
Bluetooth: 6lowpan: Fix kernel NULL pointer dereferences
Johan Hedberg <[email protected]>
Bluetooth: Fix incorrect removing of IRKs
Dmitry Tunin <[email protected]>
Bluetooth: Add support of Toshiba Broadcom based devices
Johan Hedberg <[email protected]>
Bluetooth: Use continuous scanning when creating LE connections
K. Y. Srinivasan <[email protected]>
Drivers: hv: vmbus: Fix a Host signaling bug
Dexuan Cui <[email protected]>
tools: hv: vss: fix the write()'s argument: error -> vss_msg
Adrian Hunter <[email protected]>
mmc: sdhci: Allow override of get_cd() called from sdhci_request()
Adrian Hunter <[email protected]>
mmc: sdhci: Allow override of mmc host operations
Adrian Hunter <[email protected]>
mmc: sdhci-pci: Fix card detect race for Intel BXT/APL
Robert Jarzmik <[email protected]>
mmc: pxamci: fix again read-only gpio detection polarity
Adrian Hunter <[email protected]>
mmc: sdhci-acpi: Fix card detect race for Intel BXT/APL
Linus Walleij <[email protected]>
mmc: mmci: fix an ages old detection error
Carlo Caione <[email protected]>
mmc: core: Enable tuning according to the actual timing
Adrian Hunter <[email protected]>
mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off()
Wenkai Du <[email protected]>
mmc: mmc: Fix incorrect use of driver strength switching HS200 and HS400
Adrian Hunter <[email protected]>
mmc: sdio: Fix invalid vdd in voltage switch power cycle
Adrian Hunter <[email protected]>
mmc: sdhci: Fix DMA descriptor with zero data length
Adrian Hunter <[email protected]>
mmc: sdhci-pci: Do not default to 33 Ohm driver strength for Intel SPT
Rabin Vincent <[email protected]>
mmc: usdhi6rol0: handle NULL data in timeout
Alexandre Belloni <[email protected]>
clockevents/tcb_clksrc: Prevent disabling an already disabled clock
Richard Cochran <[email protected]>
posix-clock: Fix return code on the poll method's error path
Ashok Kumar <[email protected]>
irqchip/gic-v3-its: Fix double ICC_EOIR write for LPI in EOImode==1
Milo Kim <[email protected]>
irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
Oleksij Rempel <[email protected]>
irqchip/mxs: Add missing set_handle_irq()
Sekhar Nori <[email protected]>
irqchip/omap-intc: Add support for spurious irq handling
Mathieu Poirier <[email protected]>
coresight: checking for NULL string in coresight_name_match()
Mike Snitzer <[email protected]>
dm: fix dm_rq_target_io leak on faults with .request_fn DM w/ blk-mq paths
Mikulas Patocka <[email protected]>
dm snapshot: fix hung bios when copy error occurs
Mike Snitzer <[email protected]>
dm space map metadata: remove unused variable in brb_pop()
Mauro Carvalho Chehab <[email protected]>
tda1004x: only update the frontend properties if locked
Hans Verkuil <[email protected]>
vb2: fix a regression in poll() behavior for output,streams
Antonio Ospite <[email protected]>
gspca: ov534/topro: prevent a division by 0
Laura Abbott <[email protected]>
si2157: return -EINVAL if firmware blob is too big
Malcolm Priestley <[email protected]>
media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode
Chen-Yu Tsai <[email protected]>
rc: sunxi-cir: Initialize the spinlock properly
Al Viro <[email protected]>
namei: ->d_inode of a pinned dentry is stable only for positives
Alexander Usyskin <[email protected]>
mei: validate request value in client notify request ioctl
Tomas Winkler <[email protected]>
mei: fix fasync return value on error
Larry Finger <[email protected]>
rtlwifi: rtl8723be: Fix module parameter initialization
Larry Finger <[email protected]>
rtlwifi: rtl8188ee: Fix module parameter initialization
Larry Finger <[email protected]>
rtlwifi: rtl8192se: Fix module parameter initialization
Larry Finger <[email protected]>
rtlwifi: rtl8723ae: Fix initialization of module parameters
Larry Finger <[email protected]>
rtlwifi: rtl8192de: Fix incorrect module parameter descriptions
Larry Finger <[email protected]>
rtlwifi: rtl8192ce: Fix handling of module parameters
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Add missing parameter setup
Larry Finger <[email protected]>
rtlwifi: rtl_pci: Fix kernel panic
Jeff Layton <[email protected]>
locks: fix unlock when fcntl_setlk races with a close
Vegard Nossum <[email protected]>
um: link with -lpthread
Vegard Nossum <[email protected]>
uml: fix hostfs mknod()
Vegard Nossum <[email protected]>
uml: flush stdout before forking
Martin Schwidefsky <[email protected]>
s390/fpu: signals vs. floating point control register
Martin Schwidefsky <[email protected]>
s390/compat: correct restore of high gprs on signal return
Stefan Haberland <[email protected]>
s390/dasd: fix performance drop
Stefan Haberland <[email protected]>
s390/dasd: fix refcount for PAV reassignment
Stefan Haberland <[email protected]>
s390/dasd: prevent incorrect length error under z/VM after PAV changes
Ard Biesheuvel <[email protected]>
s390: fix normalization bug in exception table sorting
Sebastian Andrzej Siewior <[email protected]>
btrfs: initialize the seq counter in struct btrfs_device
Chandan Rajendra <[email protected]>
Btrfs: Initialize btrfs_root->highest_objectid when loading tree root and subvolume roots
Filipe Manana <[email protected]>
Btrfs: fix transaction handle leak on failure to create hard link
Filipe Manana <[email protected]>
Btrfs: fix number of transaction units required to create symlink
Filipe Manana <[email protected]>
Btrfs: send, don't BUG_ON() when an empty symlink is found
David Sterba <[email protected]>
btrfs: statfs: report zero available if metadata are exhausted
Josef Bacik <[email protected]>
Btrfs: igrab inode in writepage
Anand Jain <[email protected]>
Btrfs: add missing brelse when superblock checksum fails
David Hildenbrand <[email protected]>
KVM: s390: fix memory overwrites when vx is disabled
Martin Schwidefsky <[email protected]>
s390/kvm: remove dependency on struct save_area definition
Roman Volkov <[email protected]>
clocksource/drivers/vt8500: Increase the minimum delta
Thomas Gleixner <[email protected]>
genirq: Validate action before dereferencing it in handle_irq_event_percpu()
Mel Gorman <[email protected]>
mm: numa: quickly fail allocations for NUMA balancing on full nodes
Andrea Arcangeli <[email protected]>
mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED
Guozhonghua <[email protected]>
ocfs2: unlock inode if deleting inode from orphan fails
Daniel Vetter <[email protected]>
drm/i915: shut up gen8+ SDE irq dmesg noise
Hariprasad S <[email protected]>
iw_cxgb3: Fix incorrectly returning error on success
Michael Welling <[email protected]>
spi: omap2-mcspi: Prevent duplicate gpio_request
Lisa Du <[email protected]>
drivers: android: correct the size of struct binder_uintptr_t for BC_DEAD_BINDER_DONE
Bjørn Mork <[email protected]>
USB: option: add "4G LTE usb-modem U901"
Andrey Skvortsov <[email protected]>
USB: option: add support for SIM7100E
Ken Lin <[email protected]>
USB: cp210x: add IDs for GE B650V3 and B850V3 boards
John Youn <[email protected]>
usb: dwc3: Fix assignment of EP transfer resources
Gerhard Uttenthaler <[email protected]>
can: ems_usb: Fix possible tx overflow
Nikolay Borisov <[email protected]>
dm thin: fix race condition when destroying thin pool workqueue
Kent Overstreet <[email protected]>
bcache: Change refill_dirty() to always scan entire disk if necessary
Stefan Bader <[email protected]>
bcache: prevent crash on changing writeback_running
Gabriel de Perthuis <[email protected]>
bcache: allows use of register in udev to avoid "device_busy" error.
Zheng Liu <[email protected]>
bcache: unregister reboot notifier if bcache fails to unregister device
Al Viro <[email protected]>
bcache: fix a leak in bch_cached_dev_run()
Zheng Liu <[email protected]>
bcache: clear BCACHE_DEV_UNLINK_DONE flag when attaching a backing device
Kent Overstreet <[email protected]>
bcache: Add a cond_resched() call to gc
Zheng Liu <[email protected]>
bcache: fix a livelock when we cause a huge number of cache misses
Jason Andryuk <[email protected]>
lib/ucs2_string: Correct ucs2 -> utf8 conversion
Matt Fleming <[email protected]>
efi: Add pstore variables to the deletion whitelist
Peter Jones <[email protected]>
efi: Make efivarfs entries immutable by default
Peter Jones <[email protected]>
efi: Make our variable validation list include the guid
Peter Jones <[email protected]>
efi: Do variable name validation tests in utf8
Peter Jones <[email protected]>
efi: Use ucs2_as_utf8 in efivarfs instead of open coding a bad version
Peter Jones <[email protected]>
lib/ucs2_string: Add ucs2 -> utf8 helper functions
Arnd Bergmann <[email protected]>
ARM: 8457/1: psci-smp is built only for SMP
Daniel Vetter <[email protected]>
drm/gma500: Use correct unref in the gem bo create function
Toshi Kani <[email protected]>
devm_memremap: Fix error value when memremap failed
David Hildenbrand <[email protected]>
KVM: s390: fix guest fprs memory leak
dann frazier <[email protected]>
arm64: errata: Add -mpc-relative-literal-loads to build flags
Arnd Bergmann <[email protected]>
ARM: debug-ll: fix BCM63xx entry for multiplatform
Jan Kara <[email protected]>
ext4: fix bh->b_state corruption
Neil Horman <[email protected]>
sctp: Fix port hash table size computation
Dmitry V. Levin <[email protected]>
unix_diag: fix incorrect sign extension in unix_lookup_by_ino
Insu Yun <[email protected]>
tipc: unlock in error path
Anton Protopopov <[email protected]>
rtnl: RTM_GETNETCONF: fix wrong return value
Phil Sutter <[email protected]>
IFF_NO_QUEUE: Fix for drivers not calling ether_setup()
Eric Dumazet <[email protected]>
tcp/dccp: fix another race at listener dismantle
Xin Long <[email protected]>
route: check and remove route cache when we get route
Jamal Hadi Salim <[email protected]>
net_sched fix: reclassification needs to consider ether protocol changes
Guillaume Nault <[email protected]>
pppoe: fix reference counting in PPPoE proxy
Mark Tomlinson <[email protected]>
l2tp: Fix error creating L2TP tunnels
Eugenia Emantayev <[email protected]>
net/mlx4_en: Avoid changing dev->features directly in run-time
Eugenia Emantayev <[email protected]>
net/mlx4_en: Choose time-stamping shift value according to HW frequency
Amir Vadai <[email protected]>
net/mlx4_en: Count HW buffer overrun only once
Bjørn Mork <[email protected]>
qmi_wwan: add "4G LTE usb-modem U901"
Eric Dumazet <[email protected]>
tcp: md5: release request socket instead of listener
Jon Paul Maloy <[email protected]>
tipc: fix premature addition of node to lookup table
Rainer Weikusat <[email protected]>
af_unix: Guard against other == sk in unix_dgram_sendmsg
Rainer Weikusat <[email protected]>
af_unix: Don't set err in unix_stream_read_generic unless there was an error
Eric Dumazet <[email protected]>
ipv4: fix memory leaks in ip_cmsg_send() callers
Jay Vosburgh <[email protected]>
bonding: Fix ARP monitor validation
Daniel Borkmann <[email protected]>
bpf: fix branch offset adjustment on backjumps after patching ctx expansion
Alexander Duyck <[email protected]>
flow_dissector: Fix unaligned access in __skb_flow_dissector when used by eth_get_headlen
Alexander Duyck <[email protected]>
net: Copy inner L3 and L4 headers as unaligned on GRE TEB
Xin Long <[email protected]>
sctp: translate network order to host order when users get a hmacid
Sandeep Pillai <[email protected]>
enic: increment devcmd2 result ring in case of timeout
Siva Reddy Kallam <[email protected]>
tg3: Fix for tg3 transmit queue 0 timed out when too many gso_segs
Hans Westgaard Ry <[email protected]>
net:Add sysctl_max_skb_frags
Eric Dumazet <[email protected]>
tcp: do not drop syn_recv on all icmp reports
Hannes Frederic Sowa <[email protected]>
unix: correctly track in-flight fds in sending process user_struct
Eric Dumazet <[email protected]>
ipv6: fix a lockdep splat
[email protected] <[email protected]>
ipv6: addrconf: Fix recursive spin lock call
Paolo Abeni <[email protected]>
ipv6/udp: use sticky pktinfo egress ifindex on connect()
Paolo Abeni <[email protected]>
ipv6: enforce flowi6_oif usage in ip6_dst_lookup_tail()
Eric Dumazet <[email protected]>
tcp: beware of alignments in tcp_get_info()
Ido Schimmel <[email protected]>
switchdev: Require RTNL mutex to be held when sending FDB notifications
Joe Stringer <[email protected]>
inet: frag: Always orphan skbs inside ip_defrag()
Parthasarathy Bhuvaragan <[email protected]>
tipc: fix connection abort during subscription cancel
Russell King <[email protected]>
net: dsa: fix mv88e6xxx switches
Marcelo Ricardo Leitner <[email protected]>
sctp: allow setting SCTP_SACK_IMMEDIATELY by the application
Hannes Frederic Sowa <[email protected]>
pptp: fix illegal memory access caused by multiple bind()s
Eric Dumazet <[email protected]>
af_unix: fix struct pid memory leak
Eric Dumazet <[email protected]>
tcp: fix NULL deref in tcp_v4_send_ack()
Paolo Abeni <[email protected]>
lwt: fix rx checksum setting for lwt devices tunneling over ipv6
Jesse Gross <[email protected]>
tunnels: Allow IPv6 UDP checksums to be correctly controlled.
Manfred Rudigier <[email protected]>
net: dp83640: Fix tx timestamp overflow handling.
Jesse Gross <[email protected]>
gro: Make GRO aware of lightweight tunnels.
Ursula Braun <[email protected]>
af_iucv: Validate socket address length in iucv_sock_bind()
-------------
Diffstat:
Documentation/filesystems/efivarfs.txt | 7 + Makefile | 4 +- arch/arc/include/asm/irqflags-arcv2.h | 11 + arch/arc/kernel/entry-arcv2.S | 30 +- arch/arc/kernel/mcip.c | 15 + arch/arm/Kconfig.debug | 17 +- arch/arm/boot/dts/sama5d2-pinfunc.h | 2 +- arch/arm/include/asm/psci.h | 2 +- arch/arm/include/asm/xen/page-coherent.h | 21 +- arch/arm/mach-omap2/gpmc-onenand.c | 6 +- arch/arm64/Makefile | 1 + arch/mips/include/asm/page.h | 2 +- arch/mips/include/asm/pgtable.h | 4 +- arch/mips/include/asm/syscall.h | 4 +- arch/mips/loongson64/loongson-3/hpet.c | 10 +- arch/mips/loongson64/loongson-3/smp.c | 20 +- arch/mips/mm/tlbex.c | 2 +- arch/powerpc/kernel/eeh_driver.c | 3 +- arch/s390/include/asm/fpu/internal.h | 2 + arch/s390/include/asm/kvm_host.h | 1 - arch/s390/kernel/asm-offsets.c | 1 + arch/s390/kernel/compat_signal.c | 2 +- arch/s390/kvm/kvm-s390.c | 149 ++++----- arch/s390/mm/extable.c | 8 +- arch/sparc/kernel/sys_sparc_64.c | 2 +- arch/um/os-Linux/start_up.c | 2 + arch/x86/entry/entry_64_compat.S | 1 + arch/x86/include/asm/irq.h | 5 +- arch/x86/kernel/apic/io_apic.c | 6 +- arch/x86/kernel/apic/vector.c | 221 ++++++++----- arch/x86/kernel/irq.c | 11 +- arch/x86/kvm/emulate.c | 4 +- arch/x86/kvm/paging_tmpl.h | 2 +- arch/x86/kvm/x86.c | 1 + arch/x86/mm/mpx.c | 2 +- block/bio.c | 7 +- drivers/acpi/acpi_video.c | 18 + drivers/acpi/nfit.c | 71 ++-- drivers/acpi/video_detect.c | 8 - drivers/android/binder.c | 2 +- drivers/ata/libata-sff.c | 32 +- drivers/bluetooth/btusb.c | 4 + drivers/clk/samsung/clk-cpu.c | 10 +- drivers/clocksource/tcb_clksrc.c | 3 +- drivers/clocksource/vt8500_timer.c | 6 +- drivers/cpufreq/cpufreq_governor.c | 11 +- drivers/cpufreq/pxa2xx-cpufreq.c | 2 +- drivers/dma/at_xdmac.c | 3 + drivers/dma/dw/core.c | 49 ++- drivers/edac/edac_device.c | 11 +- drivers/edac/edac_mc.c | 14 +- drivers/edac/edac_mc_sysfs.c | 21 +- drivers/edac/edac_pci.c | 9 +- drivers/firmware/efi/efivars.c | 35 +- drivers/firmware/efi/vars.c | 144 +++++--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 18 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 23 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 43 ++- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 30 +- drivers/gpu/drm/amd/amdgpu/iceland_smc.c | 12 +- drivers/gpu/drm/amd/amdgpu/tonga_dpm.c | 17 +- drivers/gpu/drm/amd/amdgpu/vi.c | 7 +- drivers/gpu/drm/drm_dp_mst_topology.c | 362 ++++++++++++++------- drivers/gpu/drm/drm_irq.c | 73 ++++- drivers/gpu/drm/gma500/gem.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 6 +- drivers/gpu/drm/i915/i915_gem_context.c | 6 +- drivers/gpu/drm/i915/i915_irq.c | 10 +- drivers/gpu/drm/i915/intel_ddi.c | 3 +- drivers/gpu/drm/i915/intel_display.c | 33 +- drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 8 +- drivers/gpu/drm/i915/intel_hotplug.c | 9 +- drivers/gpu/drm/i915/intel_i2c.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 1 + drivers/gpu/drm/i915/intel_ringbuffer.c | 2 + drivers/gpu/drm/nouveau/nouveau_connector.c | 3 + drivers/gpu/drm/nouveau/nouveau_display.c | 8 +- drivers/gpu/drm/nouveau/nouveau_platform.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 40 ++- drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.c | 10 + drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.h | 6 + drivers/gpu/drm/qxl/qxl_ioctl.c | 3 +- drivers/gpu/drm/radeon/dce6_afmt.c | 8 + drivers/gpu/drm/radeon/evergreen_hdmi.c | 10 + drivers/gpu/drm/radeon/evergreend.h | 5 + drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_atombios.c | 58 +++- drivers/gpu/drm/radeon/radeon_audio.c | 20 +- drivers/gpu/drm/radeon/radeon_audio.h | 1 + drivers/gpu/drm/radeon/radeon_device.c | 1 + drivers/gpu/drm/radeon/radeon_display.c | 17 +- drivers/gpu/drm/radeon/radeon_object.c | 7 + drivers/gpu/drm/radeon/radeon_pm.c | 5 +- drivers/gpu/drm/radeon/radeon_sa.c | 5 + drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_vm.c | 12 +- drivers/gpu/drm/radeon/sid.h | 5 + drivers/gpu/drm/radeon/vce_v1_0.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +- drivers/hv/channel.c | 18 + drivers/hwmon/ads1015.c | 2 +- drivers/hwmon/dell-smm-hwmon.c | 11 + drivers/hwmon/gpio-fan.c | 7 +- drivers/hwtracing/coresight/coresight.c | 2 +- drivers/i2c/busses/i2c-i801.c | 2 + drivers/infiniband/core/cm.c | 4 +- drivers/infiniband/core/cma.c | 2 +- drivers/infiniband/hw/cxgb3/iwch_cm.c | 4 +- drivers/infiniband/hw/mlx5/main.c | 2 +- drivers/infiniband/hw/qib/qib_qp.c | 46 ++- drivers/infiniband/hw/qib/qib_verbs_mcast.c | 35 +- drivers/irqchip/irq-atmel-aic-common.c | 2 +- drivers/irqchip/irq-gic-v3-its.c | 7 +- drivers/irqchip/irq-mxs.c | 1 + drivers/irqchip/irq-omap-intc.c | 27 +- drivers/md/bcache/btree.c | 5 +- drivers/md/bcache/super.c | 16 +- drivers/md/bcache/writeback.c | 37 ++- drivers/md/bcache/writeback.h | 3 +- drivers/md/dm-exception-store.h | 2 +- drivers/md/dm-snap-persistent.c | 5 +- drivers/md/dm-snap-transient.c | 4 +- drivers/md/dm-snap.c | 20 +- drivers/md/dm-thin.c | 4 +- drivers/md/dm.c | 2 + drivers/md/persistent-data/dm-space-map-metadata.c | 3 - drivers/media/dvb-core/dvb_frontend.c | 6 +- drivers/media/dvb-frontends/tda1004x.c | 9 + drivers/media/rc/sunxi-cir.c | 2 + drivers/media/tuners/si2157.c | 1 + drivers/media/usb/gspca/ov534.c | 9 +- drivers/media/usb/gspca/topro.c | 6 +- drivers/media/v4l2-core/videobuf2-v4l2.c | 6 +- drivers/misc/cxl/vphb.c | 2 +- drivers/misc/mei/main.c | 12 +- drivers/mmc/core/mmc.c | 6 +- drivers/mmc/core/sd.c | 8 +- drivers/mmc/core/sdio.c | 6 +- drivers/mmc/host/mmci.c | 2 +- drivers/mmc/host/pxamci.c | 2 +- drivers/mmc/host/sdhci-acpi.c | 30 ++ drivers/mmc/host/sdhci-pci-core.c | 33 +- drivers/mmc/host/sdhci.c | 18 +- drivers/mmc/host/sdhci.h | 1 + drivers/mmc/host/usdhi6rol0.c | 3 +- drivers/net/bonding/bond_main.c | 39 ++- drivers/net/can/usb/ems_usb.c | 14 +- drivers/net/dsa/mv88e6xxx.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 25 +- drivers/net/ethernet/cisco/enic/enic.h | 2 +- drivers/net/ethernet/cisco/enic/vnic_dev.c | 19 +- drivers/net/ethernet/mellanox/mlx4/en_clock.c | 25 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 9 +- drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 +- .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 + drivers/net/ethernet/rocker/rocker.c | 2 + drivers/net/phy/dp83640.c | 17 + drivers/net/ppp/pppoe.c | 2 + drivers/net/ppp/pptp.c | 34 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/vxlan.c | 23 +- drivers/net/wireless/iwlwifi/dvm/lib.c | 3 + drivers/net/wireless/iwlwifi/mvm/scan.c | 4 + drivers/net/wireless/iwlwifi/pcie/drv.c | 5 +- drivers/net/wireless/iwlwifi/pcie/trans.c | 15 +- drivers/net/wireless/realtek/rtlwifi/pci.c | 11 +- .../net/wireless/realtek/rtlwifi/rtl8188ee/sw.c | 7 +- .../net/wireless/realtek/rtlwifi/rtl8192ce/sw.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8192de/sw.c | 4 +- .../net/wireless/realtek/rtlwifi/rtl8192se/sw.c | 6 +- .../net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 9 + .../net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 8 +- drivers/of/irq.c | 9 +- drivers/pci/hotplug/acpiphp_glue.c | 4 +- drivers/pci/pcie/aer/aerdrv.c | 4 +- drivers/pci/pcie/aer/aerdrv.h | 1 - drivers/pci/pcie/aer/aerdrv_core.c | 2 - drivers/pci/xen-pcifront.c | 10 +- drivers/phy/phy-core.c | 16 +- drivers/platform/x86/ideapad-laptop.c | 14 + drivers/platform/x86/toshiba_acpi.c | 8 + drivers/regulator/Kconfig | 1 + drivers/regulator/axp20x-regulator.c | 4 +- drivers/s390/block/dasd.c | 1 + drivers/s390/block/dasd_alias.c | 23 +- drivers/scsi/qla2xxx/qla_init.c | 10 +- drivers/scsi/qla2xxx/qla_isr.c | 4 +- drivers/scsi/qla2xxx/qla_mid.c | 4 +- drivers/scsi/qla2xxx/qla_os.c | 6 + drivers/scsi/qla2xxx/qla_tmpl.c | 16 + drivers/scsi/sd.c | 2 +- drivers/spi/spi-atmel.c | 1 + drivers/spi/spi-omap2-mcspi.c | 19 +- drivers/staging/panel/panel.c | 34 +- drivers/staging/speakup/serialio.c | 13 +- drivers/target/target_core_tmr.c | 139 ++++++-- drivers/target/target_core_transport.c | 278 +++++++++++----- drivers/thermal/step_wise.c | 17 +- drivers/thermal/thermal_core.c | 75 ++++- drivers/thermal/thermal_core.h | 1 + drivers/usb/class/cdc-acm.c | 5 + drivers/usb/dwc3/core.h | 1 - drivers/usb/dwc3/ep0.c | 5 - drivers/usb/dwc3/gadget.c | 70 +++- drivers/usb/serial/cp210x.c | 2 + drivers/usb/serial/option.c | 9 + drivers/virtio/virtio_balloon.c | 2 +- drivers/virtio/virtio_pci_common.c | 2 + drivers/xen/xen-pciback/pciback_ops.c | 9 +- drivers/xen/xen-scsiback.c | 10 +- fs/btrfs/disk-io.c | 28 ++ fs/btrfs/inode-map.c | 9 +- fs/btrfs/inode-map.h | 1 + fs/btrfs/inode.c | 27 +- fs/btrfs/ioctl.c | 4 + fs/btrfs/send.c | 16 +- fs/btrfs/super.c | 24 ++ fs/btrfs/volumes.c | 1 + fs/direct-io.c | 2 +- fs/efivarfs/file.c | 70 ++++ fs/efivarfs/inode.c | 30 +- fs/efivarfs/internal.h | 3 +- fs/efivarfs/super.c | 16 +- fs/ext4/inode.c | 32 +- fs/fs-writeback.c | 15 +- fs/hostfs/hostfs_kern.c | 4 +- fs/hpfs/namei.c | 31 +- fs/locks.c | 51 +-- fs/namei.c | 22 +- fs/nfs/nfs4proc.c | 4 +- fs/ocfs2/aops.c | 1 + include/asm-generic/cputime_nsecs.h | 5 +- include/drm/drm_cache.h | 9 + include/drm/drm_dp_mst_helper.h | 27 +- include/drm/drm_fixed.h | 53 ++- include/linux/ceph/messenger.h | 2 +- include/linux/cgroup-defs.h | 6 + include/linux/cpuset.h | 6 + include/linux/efi.h | 5 +- include/linux/hyperv.h | 18 + include/linux/nfs_fs.h | 4 +- include/linux/shmem_fs.h | 5 +- include/linux/skbuff.h | 1 + include/linux/thermal.h | 5 + include/linux/ucs2_string.h | 4 + include/net/af_unix.h | 4 +- include/net/dst_metadata.h | 18 + include/net/inet_connection_sock.h | 5 +- include/net/ip6_route.h | 12 +- include/net/ip_fib.h | 1 + include/net/scm.h | 1 + include/net/tcp.h | 2 +- include/target/target_core_base.h | 3 + include/uapi/linux/Kbuild | 2 +- kernel/bpf/verifier.c | 2 +- kernel/cgroup.c | 25 +- kernel/cpuset.c | 71 ++-- kernel/irq/handle.c | 5 +- kernel/memremap.c | 4 +- kernel/resource.c | 5 +- kernel/seccomp.c | 22 +- kernel/time/posix-clock.c | 4 +- kernel/time/tick-sched.c | 4 +- kernel/time/timekeeping.c | 3 +- kernel/trace/trace_events.c | 3 +- kernel/workqueue.c | 18 +- lib/Kconfig | 2 + lib/ucs2_string.c | 62 ++++ mm/balloon_compaction.c | 4 +- mm/memory.c | 14 +- mm/migrate.c | 2 +- mm/shmem.c | 9 +- net/bluetooth/6lowpan.c | 7 +- net/bluetooth/hci_conn.c | 6 +- net/bluetooth/hci_request.c | 28 +- net/bluetooth/smp.c | 16 - net/bridge/br.c | 3 +- net/ceph/messenger.c | 91 ++++-- net/ceph/osd_client.c | 4 +- net/core/dev.c | 11 +- net/core/flow_dissector.c | 16 +- net/core/scm.c | 7 + net/core/skbuff.c | 2 + net/core/sysctl_net_core.c | 10 + net/dccp/ipv4.c | 14 +- net/dccp/ipv6.c | 14 +- net/ipv4/devinet.c | 2 +- net/ipv4/inet_connection_sock.c | 14 +- net/ipv4/ip_fragment.c | 1 + net/ipv4/ip_sockglue.c | 2 + net/ipv4/netfilter/nf_defrag_ipv4.c | 2 - net/ipv4/ping.c | 4 +- net/ipv4/raw.c | 4 +- net/ipv4/route.c | 77 ++++- net/ipv4/tcp.c | 16 +- net/ipv4/tcp_ipv4.c | 44 ++- net/ipv4/udp.c | 4 +- net/ipv6/addrconf.c | 7 +- net/ipv6/datagram.c | 3 + net/ipv6/ip6_flowlabel.c | 5 +- net/ipv6/ip6_output.c | 6 +- net/ipv6/route.c | 7 +- net/ipv6/tcp_ipv6.c | 19 +- net/iucv/af_iucv.c | 3 + net/l2tp/l2tp_netlink.c | 18 +- net/mac80211/ibss.c | 1 - net/mac80211/mesh.c | 11 - net/mac80211/mesh.h | 4 - net/mac80211/mlme.c | 2 - net/mac80211/scan.c | 12 +- net/openvswitch/vport-vxlan.c | 2 +- net/rfkill/core.c | 16 +- net/sched/sch_api.c | 1 + net/sctp/protocol.c | 43 ++- net/sctp/socket.c | 11 +- net/sunrpc/cache.c | 2 +- net/switchdev/switchdev.c | 15 +- net/tipc/bcast.c | 4 +- net/tipc/node.c | 12 +- net/tipc/subscr.c | 11 +- net/unix/af_unix.c | 28 +- net/unix/diag.c | 2 +- net/unix/garbage.c | 8 +- scripts/link-vmlinux.sh | 2 +- security/smack/smack_lsm.c | 8 +- security/yama/yama_lsm.c | 4 +- sound/pci/hda/hda_intel.c | 16 +- sound/pci/hda/patch_realtek.c | 8 + tools/hv/hv_vss_daemon.c | 2 +- tools/perf/util/stat.c | 1 - tools/testing/selftests/efivarfs/efivarfs.sh | 19 +- tools/testing/selftests/efivarfs/open-unlink.c | 72 +++- virt/kvm/arm/vgic.c | 4 +- virt/kvm/async_pf.c | 2 +- 348 files changed, 3636 insertions(+), 1595 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/342 af_iucv: Validate socket address length in iucv_sock_bind()
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ursula Braun <[email protected]>
[ Upstream commit 52a82e23b9f2a9e1d429c5207f8575784290d008 ]
--- net/iucv/af_iucv.c | 3 +++ 1 file changed, 3 insertions(+)
net/iucv/af_iucv.c +3 -0
@@ -708,6 +708,9 @@ static int iucv_sock_bind(struct socketif (!addr || addr->sa_family !=AF_IUCV )return -EINVAL ; +if (addr_len <sizeof (struct sockaddr_iucv )) +return -EINVAL ; +lock_sock (sk);if (sk->sk_state !=IUCV_OPEN ) { err = -EBADFD ;
Greg Kroah-Hartman
maintainerPATCH 2/342 gro: Make GRO aware of lightweight tunnels.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Gross <[email protected]>
[ Upstream commit ce87fc6ce3f9f4488546187e3757cf666d9d4a2a ]
GRO is currently not aware of tunnel metadata generated by lightweight tunnels and stored in the dst. This leads to two possible problems:
* Incorrectly merging two frames that have different metadata.
* Leaking of allocated metadata from merged frames.
This avoids those problems by comparing the tunnel information before merging, similar to how we handle other metadata (such as vlan tags), and releasing any state when we are done.
--- include/net/dst_metadata.h | 18 ++++++++++++++++++ net/core/dev.c | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-)
include/net/dst_metadata.h +18 -0
@@ -44,6 +44,24 @@ static inline bool skb_valid_dst(const sreturn dst && !(dst->flags &DST_METADATA ); } +static inline int skb_metadata_dst_cmp (const struct sk_buff *skb_a, +const struct sk_buff *skb_b) +{ +const struct metadata_dst *a, *b; + +if (!(skb_a->_skb_refdst | skb_b->_skb_refdst)) +return 0 ; + + a = (const struct metadata_dst *)skb_dst (skb_a); + b = (const struct metadata_dst *)skb_dst (skb_b); + +if (!a != !b || a->u.tun_info.options_len != b->u.tun_info.options_len) +return 1 ; + +return memcmp (&a->u.tun_info, &b->u.tun_info, +sizeof (a->u.tun_info) + a->u.tun_info.options_len); +} +struct metadata_dst *metadata_dst_alloc (u8 optslen,gfp_t flags);struct metadata_dst __percpu *metadata_dst_alloc_percpu (u8 optslen,gfp_t flags);
net/core/dev.c +5 -2
@@ -4145,6 +4145,7 @@ static void gro_list_prepare(struct napi diffs = (unsigned long )p->dev ^ (unsigned long )skb->dev; diffs |= p->vlan_tci ^ skb->vlan_tci; + diffs |=skb_metadata_dst_cmp (p, skb);if (maclen ==ETH_HLEN ) diffs |=compare_ether_header (skb_mac_header (p),skb_mac_header (skb));
@@ -4342,10 +4343,12 @@ static gro_result_t napi_skb_finish(gro_break ;case GRO_MERGED_FREE : -if (NAPI_GRO_CB (skb)->free ==NAPI_GRO_FREE_STOLEN_HEAD ) +if (NAPI_GRO_CB (skb)->free ==NAPI_GRO_FREE_STOLEN_HEAD ) { +skb_dst_drop (skb);kmem_cache_free (skbuff_head_cache, skb); -else + }else {__kfree_skb (skb); + }break ;case GRO_HELD :
Greg Kroah-Hartman
maintainerPATCH 3/342 net: dp83640: Fix tx timestamp overflow handling.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manfred Rudigier <[email protected]>
[ Upstream commit 81e8f2e930fe76b9814c71b9d87c30760b5eb705 ]
PHY status frames are not reliable, the PHY may not be able to send them during heavy receive traffic. This overflow condition is signaled by the PHY in the next status frame, but the driver did not make use of it. Instead it always reported wrong tx timestamps to user space after an overflow happened because it assigned newly received tx timestamps to old packets in the queue.
This commit fixes this issue by clearing the tx timestamp queue every time an overflow happens, so that no timestamps are delivered for overflow packets. This way time stamping will continue correctly after an overflow.
--- drivers/net/phy/dp83640.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/phy/dp83640.c +17 -0
@@ -845,6 +845,11 @@ static void decode_rxts(struct dp83640_pstruct skb_shared_hwtstamps *shhwtstamps =NULL ;struct sk_buff *skb;unsigned long flags; +u8 overflow; + + overflow = (phy_rxts->ns_hi >>14 ) &0x3 ; +if (overflow) +pr_debug ("rx timestamp queue overflow, count %d\n" , overflow);spin_lock_irqsave (&dp83640->rx_lock, flags);
@@ -887,6 +892,7 @@ static void decode_txts(struct dp83640_pstruct skb_shared_hwtstamps shhwtstamps;struct sk_buff *skb;u64 ns; +u8 overflow;/* We must already have the skb that triggered this. */
@@ -896,6 +902,17 @@ static void decode_txts(struct dp83640_ppr_debug ("have timestamp but tx_queue empty\n" );return ; } + + overflow = (phy_txts->ns_hi >>14 ) &0x3 ; +if (overflow) { +pr_debug ("tx timestamp queue overflow, count %d\n" , overflow); +while (skb) { +skb_complete_tx_timestamp (skb,NULL ); + skb =skb_dequeue (&dp83640->tx_queue); + } +return ; + } + ns =phy2txts (phy_txts);memset (&shhwtstamps,0 ,sizeof (shhwtstamps)); shhwtstamps.hwtstamp =ns_to_ktime (ns);
Greg Kroah-Hartman
maintainerPATCH 4/342 tunnels: Allow IPv6 UDP checksums to be correctly controlled.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Gross <[email protected]>
[ Upstream commit 35e2d1152b22eae99c961affbe85374bef05a775 ]
When configuring checksums on UDP tunnels, the flags are different for IPv4 vs. IPv6 (and reversed). However, when lightweight tunnels are enabled the flags used are always the IPv4 versions, which are ignored in the IPv6 code paths. This uses the correct IPv6 flags, so checksums can be controlled appropriately.
--- drivers/net/vxlan.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/net/vxlan.c +16 -7
@@ -1984,11 +1984,6 @@ static void vxlan_xmit_one(struct sk_buf vxlan->cfg.port_max, true);if (info) { -if (info->key.tun_flags &TUNNEL_CSUM ) - flags |=VXLAN_F_UDP_CSUM ; -else - flags &= ~VXLAN_F_UDP_CSUM ; - ttl = info->key.ttl; tos = info->key.tos;
@@ -2003,8 +1998,15 @@ static void vxlan_xmit_one(struct sk_buf goto drop; sk = vxlan->vn4_sock->sock->sk; -if (info && (info->key.tun_flags &TUNNEL_DONT_FRAGMENT )) - df =htons (IP_DF ); +if (info) { +if (info->key.tun_flags &TUNNEL_DONT_FRAGMENT ) + df =htons (IP_DF ); + +if (info->key.tun_flags &TUNNEL_CSUM ) + flags |=VXLAN_F_UDP_CSUM ; +else + flags &= ~VXLAN_F_UDP_CSUM ; + }memset (&fl4,0 ,sizeof (fl4)); fl4.flowi4_oif = rdst ? rdst->remote_ifindex :0 ;
@@ -2102,6 +2104,13 @@ static void vxlan_xmit_one(struct sk_bufreturn ; } +if (info) { +if (info->key.tun_flags &TUNNEL_CSUM ) + flags &= ~VXLAN_F_UDP_ZERO_CSUM6_TX ; +else + flags |=VXLAN_F_UDP_ZERO_CSUM6_TX ; + } + ttl = ttl ? :ip6_dst_hoplimit (ndst); err = vxlan6_xmit_skb(ndst, sk, skb, dev, &saddr, &dst->sin6.sin6_addr, 0, ttl, src_port, dst_port, htonl(vni << 8), md,
Greg Kroah-Hartman
maintainerPATCH 5/342 lwt: fix rx checksum setting for lwt devices tunneling over ipv6
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit c868ee7063bdb53f3ef9eac7bcec84960980b471 ]
the commit 35e2d1152b22 ("tunnels: Allow IPv6 UDP checksums to be correctly controlled.") changed the default xmit checksum setting for lwt vxlan/geneve ipv6 tunnels, so that now the checksum is not set into external UDP header.
This commit changes the rx checksum setting for both lwt vxlan/geneve devices created by openvswitch accordingly, so that lwt over ipv6 tunnel pairs are again able to communicate with default values.
--- net/openvswitch/vport-vxlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/vport-vxlan.c +1 -1
@@ -90,7 +90,7 @@ static struct vport *vxlan_tnl_create(coint err;struct vxlan_config conf = { .no_share = true, - .flags =VXLAN_F_COLLECT_METADATA , + .flags =VXLAN_F_COLLECT_METADATA |VXLAN_F_UDP_ZERO_CSUM6_RX , };if (!options) {
Greg Kroah-Hartman
maintainerPATCH 6/342 tcp: fix NULL deref in tcp_v4_send_ack()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e62a123b8ef7c5dc4db2c16383d506860ad21b47 ]
Neal reported crashes with this stack trace :
RIP: 0010:[<ffffffff8c57231b>] tcp_v4_send_ack+0x41/0x20f ... CR2: 0000000000000018 CR3: 000000044005c000 CR4: 00000000001427e0 ... [<ffffffff8c57258e>] tcp_v4_reqsk_send_ack+0xa5/0xb4 [<ffffffff8c1a7caa>] tcp_check_req+0x2ea/0x3e0 [<ffffffff8c19e420>] tcp_rcv_state_process+0x850/0x2500 [<ffffffff8c1a6d21>] tcp_v4_do_rcv+0x141/0x330 [<ffffffff8c56cdb2>] sk_backlog_rcv+0x21/0x30 [<ffffffff8c098bbd>] tcp_recvmsg+0x75d/0xf90 [<ffffffff8c0a8700>] inet_recvmsg+0x80/0xa0 [<ffffffff8c17623e>] sock_aio_read+0xee/0x110 [<ffffffff8c066fcf>] do_sync_read+0x6f/0xa0 [<ffffffff8c0673a1>] SyS_read+0x1e1/0x290 [<ffffffff8c5ca262>] system_call_fastpath+0x16/0x1b
The problem here is the skb we provide to tcp_v4_send_ack() had to be parked in the backlog of a new TCP fastopen child because this child was owned by the user at the time an out of window packet arrived.
Before queuing a packet, TCP has to set skb->dev to NULL as the device could disappear before packet is removed from the queue.
Fix this issue by using the net pointer provided by the socket (being a timewait or a request socket).
IPv6 is immune to the bug : tcp_v6_send_response() already gets the net pointer from the socket if provided.
--- net/ipv4/tcp_ipv4.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/ipv4/tcp_ipv4.c +8 -5
@@ -705,7 +705,8 @@ release_sk1:outside socket context is ugly, certainly. What can I do? */ -static void tcp_v4_send_ack (struct sk_buff *skb,u32 seq,u32 ack, +static void tcp_v4_send_ack (struct net *net, +struct sk_buff *skb,u32 seq,u32 ack,u32 win,u32 tsval,u32 tsecr,int oif,struct tcp_md5sig_key *key,int reply_flags,u8 tos)
@@ -720,7 +721,6 @@ static void tcp_v4_send_ack(struct sk_bu ]; } rep;struct ip_reply_arg arg; -struct net *net =dev_net (skb_dst (skb)->dev);memset (&rep.th,0 ,sizeof (struct tcphdr ));memset (&arg,0 ,sizeof (arg));
@@ -782,7 +782,8 @@ static void tcp_v4_timewait_ack(struct sstruct inet_timewait_sock *tw =inet_twsk (sk);struct tcp_timewait_sock *tcptw =tcp_twsk (sk); - tcp_v4_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, + tcp_v4_send_ack(sock_net(sk), skb, + tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, tcp_time_stamp + tcptw->tw_ts_offset, tcptw->tw_ts_recent,
@@ -801,8 +802,10 @@ static void tcp_v4_reqsk_send_ack(const/* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV * sk->sk_state == TCP_SYN_RECV -> for Fast Open. */ - tcp_v4_send_ack(skb, (sk->sk_state == TCP_LISTEN) ? - tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, +u32 seq = (sk->sk_state ==TCP_LISTEN ) ?tcp_rsk (req)->snt_isn +1 : +tcp_sk (sk)->snd_nxt; + + tcp_v4_send_ack(sock_net(sk), skb, seq, tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, tcp_time_stamp, req->ts_recent,
Greg Kroah-Hartman
maintainerPATCH 7/342 af_unix: fix struct pid memory leak
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit fa0dc04df259ba2df3ce1920e9690c7842f8fa4b ]
Dmitry reported a struct pid leak detected by a syzkaller program.
Bug happens in unix_stream_recvmsg() when we break the loop when a signal is pending, without properly releasing scm.
--- net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+)
net/unix/af_unix.c +1 -0
@@ -2332,6 +2332,7 @@ again:if (signal_pending (current)) { err =sock_intr_errno (timeo); +scm_destroy (&scm); goto out; }
Greg Kroah-Hartman
maintainerPATCH 8/342 pptp: fix illegal memory access caused by multiple bind()s
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <[email protected]>
[ Upstream commit 9a368aff9cb370298fa02feeffa861f2db497c18 ]
Several times already this has been reported as kasan reports caused by syzkaller and trinity and people always looked at RCU races, but it is much more simple. :)
In case we bind a pptp socket multiple times, we simply add it to the callid_sock list but don't remove the old binding. Thus the old socket stays in the bucket with unused call_id indexes and doesn't get cleaned up. This causes various forms of kasan reports which were hard to pinpoint.
Simply don't allow multiple binds and correct error handling in pptp_bind. Also keep sk_state bits in place in pptp_connect.
--- drivers/net/ppp/pptp.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-)
drivers/net/ppp/pptp.c +24 -10
@@ -129,24 +129,27 @@ static int lookup_chan_dst(u16 call_id,return i <MAX_CALLID ; } -static int add_chan (struct pppox_sock *sock) +static int add_chan (struct pppox_sock *sock, +struct pptp_addr *sa) {static int call_id;spin_lock (&chan_lock); -if (!sock->proto.pptp.src_addr.call_id) { +if (!sa->call_id) { call_id =find_next_zero_bit (callid_bitmap,MAX_CALLID , call_id +1 );if (call_id ==MAX_CALLID ) { call_id =find_next_zero_bit (callid_bitmap,MAX_CALLID ,1 );if (call_id ==MAX_CALLID ) goto out_err; } - sock->proto.pptp.src_addr.call_id = call_id; - }else if (test_bit (sock->proto.pptp.src_addr.call_id, callid_bitmap)) + sa->call_id = call_id; + }else if (test_bit (sa->call_id, callid_bitmap)) { goto out_err; + } -set_bit (sock->proto.pptp.src_addr.call_id, callid_bitmap); -rcu_assign_pointer (callid_sock[sock->proto.pptp.src_addr.call_id], sock); + sock->proto.pptp.src_addr = *sa; +set_bit (sa->call_id, callid_bitmap); +rcu_assign_pointer (callid_sock[sa->call_id], sock);spin_unlock (&chan_lock);return 0 ;
@@ -416,7 +419,6 @@ static int pptp_bind(struct socket *sockstruct sock *sk = sock->sk;struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr;struct pppox_sock *po =pppox_sk (sk); -struct pptp_opt *opt = &po->proto.pptp;int error =0 ;if (sockaddr_len <sizeof (struct sockaddr_pppox ))
@@ -424,10 +426,22 @@ static int pptp_bind(struct socket *socklock_sock (sk); - opt->src_addr = sp->sa_addr.pptp; -if (add_chan (po)) +if (sk->sk_state &PPPOX_DEAD ) { + error = -EALREADY ; + goto out; + } + +if (sk->sk_state &PPPOX_BOUND ) { error = -EBUSY ; + goto out; + } + +if (add_chan (po, &sp->sa_addr.pptp)) + error = -EBUSY ; +else + sk->sk_state |=PPPOX_BOUND ; +out:release_sock (sk);return error; }
@@ -498,7 +512,7 @@ static int pptp_connect(struct socket *s } opt->dst_addr = sp->sa_addr.pptp; - sk->sk_state =PPPOX_CONNECTED ; + sk->sk_state |=PPPOX_CONNECTED ; end:release_sock (sk);
Greg Kroah-Hartman
maintainerPATCH 9/342 sctp: allow setting SCTP_SACK_IMMEDIATELY by the application
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit 27f7ed2b11d42ab6d796e96533c2076ec220affc ]
This patch extends commit b93d6471748d ("sctp: implement the sender side for SACK-IMMEDIATELY extension") as it didn't white list SCTP_SACK_IMMEDIATELY on sctp_msghdr_parse(), causing it to be understood as an invalid flag and returning -EINVAL to the application.
Note that the actual handling of the flag is already there in sctp_datamsg_from_user().
https://tools.ietf.org/html/rfc7053#section-7
--- net/sctp/socket.c | 2 ++ 1 file changed, 2 insertions(+)
net/sctp/socket.c +2 -0
@@ -6640,6 +6640,7 @@ static int sctp_msghdr_parse(const strucif (cmsgs->srinfo->sinfo_flags & ~(SCTP_UNORDERED |SCTP_ADDR_OVER | +SCTP_SACK_IMMEDIATELY |SCTP_ABORT |SCTP_EOF ))return -EINVAL ;break ;
@@ -6663,6 +6664,7 @@ static int sctp_msghdr_parse(const strucif (cmsgs->sinfo->snd_flags & ~(SCTP_UNORDERED |SCTP_ADDR_OVER | +SCTP_SACK_IMMEDIATELY |SCTP_ABORT |SCTP_EOF ))return -EINVAL ;break ;
Greg Kroah-Hartman
maintainerPATCH 10/342 net: dsa: fix mv88e6xxx switches
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
[ Upstream commit db0e51afa481088e6396f11e02018d64113a6578 ]
Since commit 76e398a62712 ("net: dsa: use switchdev obj for VLAN add/del ops"), the Marvell 88E6xxx switch has been unable to pass traffic between ports - any received traffic is discarded by the switch. Taking a port out of bridge mode and configuring a vlan on it also the port to start passing traffic.
With the debugfs files re-instated to allow debug of this issue by comparing the register settings between the working and non-working case, the reason becomes clear:
GLOBAL GLOBAL2 SERDES 0 1 2 3 4 5 6
- 7: 1111 707f 2001 2 2 2 2 2 0 2 + 7: 1111 707f 2001 1 1 1 1 1 0 1
Register 7 for the ports is the default vlan tag register, and in the non-working setup, it has been set to 2, despite vlan 2 not being configured. This causes the switch to drop all packets coming in to these ports. The working setup has the default vlan tag register set to 1, which is the default vlan when none is configured.
Inspection of the code reveals why. The code prior to this commit was:
- for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) {
...
- if (!err && vlan->flags & BRIDGE_VLAN_INFO_PVID)
- err = ds->drv->port_pvid_set(ds, p->port, vid);
but the new code is:
+ for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) {
...
+ }
...
+ if (pvid)
+ err = _mv88e6xxx_port_pvid_set(ds, port, vid);
This causes the new code to always set the default vlan to one higher than the old code.
Fix this.
--- drivers/net/dsa/mv88e6xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx.c +1 -1
@@ -1519,7 +1519,7 @@ int mv88e6xxx_port_vlan_add(struct dsa_s/* no PVID with ranges, otherwise it's a bug */ if (pvid) - err =_mv88e6xxx_port_pvid_set (ds, port, vid); + err =_mv88e6xxx_port_pvid_set (ds, port, vlan->vid_end); unlock:mutex_unlock (&ps->smi_mutex);
Greg Kroah-Hartman
maintainerPATCH 11/342 tipc: fix connection abort during subscription cancel
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parthasarathy Bhuvaragan <[email protected]>
[ Upstream commit 4d5cfcba2f6ec494d8810b9e3c0a7b06255c8067 ]
In 'commit 7fe8097cef5f ("tipc: fix nullpointer bug when subscribing to events")', we terminate the connection if the subscription creation fails.
In the same commit, the subscription creation result was based on the value of the subscription pointer (set in the function) instead of the return code.
Unfortunately, the same function tipc_subscrp_create() handles subscription cancel request. For a subscription cancellation request, the subscription pointer cannot be set. Thus if a subscriber has several subscriptions and cancels any of them, the connection is terminated.
In this commit, we terminate the connection based on the return value of tipc_subscrp_create().
--- net/tipc/subscr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/tipc/subscr.c +5 -6
@@ -289,15 +289,14 @@ static void tipc_subscrb_rcv_cb(struct n struct sockaddr_tipc *addr, void *usr_data, void *buf, size_t len) { - struct tipc_subscriber *subscriber = usr_data; + struct tipc_subscriber *subscrb = usr_data;struct tipc_subscription *sub =NULL ;struct tipc_net *tn =net_generic (net, tipc_net_id); -tipc_subscrp_create (net, (struct tipc_subscr *)buf, subscriber, &sub); -if (sub) -tipc_nametbl_subscribe (sub); -else -tipc_conn_terminate (tn->topsrv, subscriber->conid); +if (tipc_subscrp_create (net, (struct tipc_subscr *)buf, subscrb, &sub)) +return tipc_conn_terminate (tn->topsrv, subscrb->conid); + +tipc_nametbl_subscribe (sub); }/* Handle one request to establish a new subscriber */
Greg Kroah-Hartman
maintainerPATCH 12/342 inet: frag: Always orphan skbs inside ip_defrag()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Stringer <[email protected]>
[ Upstream commit 8282f27449bf15548cb82c77b6e04ee0ab827bdc ]
Later parts of the stack (including fragmentation) expect that there is never a socket attached to frag in a frag_list, however this invariant was not enforced on all defrag paths. This could lead to the BUG_ON(skb->sk) during ip_do_fragment(), as per the call stack at the end of this commit message.
While the call could be added to openvswitch to fix this particular error, the head and tail of the frags list are already orphaned indirectly inside ip_defrag(), so it seems like the remaining fragments should all be orphaned in all circumstances.
kernel BUG at net/ipv4/ip_output.c:586!
[...]
Call Trace: <IRQ> [<ffffffffa0205270>] ? do_output.isra.29+0x1b0/0x1b0 [openvswitch] [<ffffffffa02167a7>] ovs_fragment+0xcc/0x214 [openvswitch] [<ffffffff81667830>] ? dst_discard_out+0x20/0x20 [<ffffffff81667810>] ? dst_ifdown+0x80/0x80 [<ffffffffa0212072>] ? find_bucket.isra.2+0x62/0x70 [openvswitch] [<ffffffff810e0ba5>] ? mod_timer_pending+0x65/0x210 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffffa03205a2>] ? nf_conntrack_in+0x252/0x500 [nf_conntrack] [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffffa02051a3>] do_output.isra.29+0xe3/0x1b0 [openvswitch] [<ffffffffa0206411>] do_execute_actions+0xe11/0x11f0 [openvswitch] [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffffa0206822>] ovs_execute_actions+0x32/0xd0 [openvswitch] [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch] [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffffa02068a2>] ovs_execute_actions+0xb2/0xd0 [openvswitch] [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch] [<ffffffffa0215019>] ? ovs_ct_get_labels+0x49/0x80 [openvswitch] [<ffffffffa0213a1d>] ovs_vport_receive+0x5d/0xa0 [openvswitch] [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch] [<ffffffffa02148fc>] internal_dev_xmit+0x6c/0x140 [openvswitch] [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch] [<ffffffff81660299>] dev_hard_start_xmit+0x2b9/0x5e0 [<ffffffff8165fc21>] ? netif_skb_features+0xd1/0x1f0 [<ffffffff81660f20>] __dev_queue_xmit+0x800/0x930 [<ffffffff81660770>] ? __dev_queue_xmit+0x50/0x930 [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90 [<ffffffff81669876>] ? neigh_resolve_output+0x106/0x220 [<ffffffff81661060>] dev_queue_xmit+0x10/0x20 [<ffffffff816698e8>] neigh_resolve_output+0x178/0x220 [<ffffffff816a8e6f>] ? ip_finish_output2+0x1ff/0x590 [<ffffffff816a8e6f>] ip_finish_output2+0x1ff/0x590 [<ffffffff816a8cee>] ? ip_finish_output2+0x7e/0x590 [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0 [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0 [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80 [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340 [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190 [<ffffffff816ab4c0>] ip_output+0x70/0x110 [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80 [<ffffffff816aa9f9>] ip_local_out+0x39/0x70 [<ffffffff816abf89>] ip_send_skb+0x19/0x40 [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40 [<ffffffff816df21a>] icmp_push_reply+0xea/0x120 [<ffffffff816df93d>] icmp_reply.constprop.23+0x1ed/0x230 [<ffffffff816df9ce>] icmp_echo.part.21+0x4e/0x50 [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffff810d5f9e>] ? rcu_read_lock_held+0x5e/0x70 [<ffffffff816dfa06>] icmp_echo+0x36/0x70 [<ffffffff816e0d11>] icmp_rcv+0x271/0x450 [<ffffffff816a4ca7>] ip_local_deliver_finish+0x127/0x3a0 [<ffffffff816a4bc1>] ? ip_local_deliver_finish+0x41/0x3a0 [<ffffffff816a5160>] ip_local_deliver+0x60/0xd0 [<ffffffff816a4b80>] ? ip_rcv_finish+0x560/0x560 [<ffffffff816a46fd>] ip_rcv_finish+0xdd/0x560 [<ffffffff816a5453>] ip_rcv+0x283/0x3e0 [<ffffffff810b6302>] ? match_held_lock+0x192/0x200 [<ffffffff816a4620>] ? inet_del_offload+0x40/0x40 [<ffffffff8165d062>] __netif_receive_skb_core+0x392/0xae0 [<ffffffff8165e68e>] ? process_backlog+0x8e/0x230 [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90 [<ffffffff8165d7c8>] __netif_receive_skb+0x18/0x60 [<ffffffff8165e678>] process_backlog+0x78/0x230 [<ffffffff8165e6dd>] ? process_backlog+0xdd/0x230 [<ffffffff8165e355>] net_rx_action+0x155/0x400 [<ffffffff8106b48c>] __do_softirq+0xcc/0x420 [<ffffffff816a8e87>] ? ip_finish_output2+0x217/0x590 [<ffffffff8178e78c>] do_softirq_own_stack+0x1c/0x30 <EOI> [<ffffffff8106b88e>] do_softirq+0x4e/0x60 [<ffffffff8106b948>] __local_bh_enable_ip+0xa8/0xb0 [<ffffffff816a8eb0>] ip_finish_output2+0x240/0x590 [<ffffffff816a9a31>] ? ip_do_fragment+0x831/0x8a0 [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0 [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0 [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80 [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340 [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190 [<ffffffff816ab4c0>] ip_output+0x70/0x110 [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80 [<ffffffff816aa9f9>] ip_local_out+0x39/0x70 [<ffffffff816abf89>] ip_send_skb+0x19/0x40 [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40 [<ffffffff816d55d3>] raw_sendmsg+0x7d3/0xc30 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffff816e7557>] ? inet_sendmsg+0xc7/0x1d0 [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffff816e759a>] inet_sendmsg+0x10a/0x1d0 [<ffffffff816e7495>] ? inet_sendmsg+0x5/0x1d0 [<ffffffff8163e398>] sock_sendmsg+0x38/0x50 [<ffffffff8163ec5f>] ___sys_sendmsg+0x25f/0x270 [<ffffffff811aadad>] ? handle_mm_fault+0x8dd/0x1320 [<ffffffff8178c147>] ? _raw_spin_unlock+0x27/0x40 [<ffffffff810529b2>] ? __do_page_fault+0x1e2/0x460 [<ffffffff81204886>] ? __fget_light+0x66/0x90 [<ffffffff8163f8e2>] __sys_sendmsg+0x42/0x80 [<ffffffff8163f932>] SyS_sendmsg+0x12/0x20 [<ffffffff8178cb17>] entry_SYSCALL_64_fastpath+0x12/0x6f Code: 00 00 44 89 e0 e9 7c fb ff ff 4c 89 ff e8 e7 e7 ff ff 41 8b 9d 80 00 00 00 2b 5d d4 89 d8 c1 f8 03 0f b7 c0 e9 33 ff ff f 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48 RIP [<ffffffff816a9a92>] ip_do_fragment+0x892/0x8a0 RSP <ffff88006d603170>
--- net/ipv4/ip_fragment.c | 1 + net/ipv4/netfilter/nf_defrag_ipv4.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
net/ipv4/ip_fragment.c +1 -0
@@ -661,6 +661,7 @@ int ip_defrag(struct net *net, struct skstruct ipq *qp;IP_INC_STATS_BH (net,IPSTATS_MIB_REASMREQDS ); +skb_orphan (skb);/* Lookup (or create) queue header */ qp =ip_find (net,ip_hdr (skb), user, vif);
net/ipv4/netfilter/nf_defrag_ipv4.c +0 -2
@@ -27,8 +27,6 @@ static int nf_ct_ipv4_gather_frags(struc {int err; -skb_orphan (skb); -local_bh_disable (); err =ip_defrag (net, skb, user);local_bh_enable ();
Greg Kroah-Hartman
maintainerPATCH 13/342 switchdev: Require RTNL mutex to be held when sending FDB notifications
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 4f2c6ae5c64c353fb1b0425e4747e5603feadba1 ]
When switchdev drivers process FDB notifications from the underlying device they resolve the netdev to which the entry points to and notify the bridge using the switchdev notifier.
However, since the RTNL mutex is not held there is nothing preventing the netdev from disappearing in the middle, which will cause br_switchdev_event() to dereference a non-existing netdev.
Make switchdev drivers hold the lock at the beginning of the notification processing session and release it once it ends, after notifying the bridge.
Also, remove switchdev_mutex and fdb_lock, as they are no longer needed when RTNL mutex is held.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 +++ drivers/net/ethernet/rocker/rocker.c | 2 ++ net/bridge/br.c | 3 +-- net/switchdev/switchdev.c | 15 ++++++++------- 4 files changed, 14 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +3 -0
@@ -45,6 +45,7 @@#include <linux/if_bridge.h> #include <linux/workqueue.h> #include <linux/jiffies.h> +#include <linux/rtnetlink.h> #include <net/switchdev.h> #include "spectrum.h"
@@ -812,6 +813,7 @@ static void mlxsw_sp_fdb_notify_work(str mlxsw_sp = container_of(work, struct mlxsw_sp, fdb_notify.dw.work); +rtnl_lock (); do { mlxsw_reg_sfn_pack(sfn_pl); err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(sfn), sfn_pl);
@@ -824,6 +826,7 @@ static void mlxsw_sp_fdb_notify_work(strmlxsw_sp_fdb_notify_rec_process (mlxsw_sp, sfn_pl, i); }while (num_rec); +rtnl_unlock ();kfree (sfn_pl);mlxsw_sp_fdb_notify_work_schedule (mlxsw_sp);
drivers/net/ethernet/rocker/rocker.c +2 -0
@@ -3531,12 +3531,14 @@ static void rocker_port_fdb_learn_work(s info.addr = lw->addr; info.vid = lw->vid; +rtnl_lock ();if (learned && removing)call_switchdev_notifiers (SWITCHDEV_FDB_DEL , lw->rocker_port->dev, &info.info);else if (learned && !removing)call_switchdev_notifiers (SWITCHDEV_FDB_ADD , lw->rocker_port->dev, &info.info); +rtnl_unlock ();rocker_port_kfree (lw->trans, work); }
net/bridge/br.c +1 -2
@@ -121,6 +121,7 @@ static struct notifier_block br_device_n .notifier_call = br_device_event }; +/* called with RTNL */ static int br_switchdev_event (struct notifier_block *unused,unsigned long event,void *ptr) {
@@ -130,7 +131,6 @@ static int br_switchdev_event(struct notstruct switchdev_notifier_fdb_info *fdb_info;int err =NOTIFY_DONE ; -rtnl_lock (); p =br_port_get_rtnl (dev);if (!p) goto out;
@@ -155,7 +155,6 @@ static int br_switchdev_event(struct not } out: -rtnl_unlock ();return err; }
net/switchdev/switchdev.c +8 -7
@@ -20,6 +20,7 @@#include <linux/list.h> #include <linux/workqueue.h> #include <linux/if_vlan.h> +#include <linux/rtnetlink.h> #include <net/ip_fib.h> #include <net/switchdev.h>
@@ -565,7 +566,6 @@ int switchdev_port_obj_dump(struct net_d }EXPORT_SYMBOL_GPL (switchdev_port_obj_dump); -static DEFINE_MUTEX (switchdev_mutex);static RAW_NOTIFIER_HEAD (switchdev_notif_chain);/**
@@ -580,9 +580,9 @@ int register_switchdev_notifier(struct n {int err; -mutex_lock (&switchdev_mutex); +rtnl_lock (); err =raw_notifier_chain_register (&switchdev_notif_chain, nb); -mutex_unlock (&switchdev_mutex); +rtnl_unlock ();return err; }EXPORT_SYMBOL_GPL (register_switchdev_notifier);
@@ -598,9 +598,9 @@ int unregister_switchdev_notifier(struct {int err; -mutex_lock (&switchdev_mutex); +rtnl_lock (); err =raw_notifier_chain_unregister (&switchdev_notif_chain, nb); -mutex_unlock (&switchdev_mutex); +rtnl_unlock ();return err; }EXPORT_SYMBOL_GPL (unregister_switchdev_notifier);
@@ -614,16 +614,17 @@ EXPORT_SYMBOL_GPL(unregister_switchdev_n* Call all network notifier blocks. This should be called by driver * when it needs to propagate hardware event. * Return values are same as for atomic_notifier_call_chain(). +* rtnl_lock must be held. */ int call_switchdev_notifiers (unsigned long val,struct net_device *dev,struct switchdev_notifier_info *info) {int err; +ASSERT_RTNL (); + info->dev = dev; -mutex_lock (&switchdev_mutex); err =raw_notifier_call_chain (&switchdev_notif_chain, val, info); -mutex_unlock (&switchdev_mutex);return err; }EXPORT_SYMBOL_GPL (call_switchdev_notifiers);
Greg Kroah-Hartman
maintainerPATCH 14/342 tcp: beware of alignments in tcp_get_info()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ff5d749772018602c47509bdc0093ff72acd82ec ]
With some combinations of user provided flags in netlink command, it is possible to call tcp_get_info() with a buffer that is not 8-bytes aligned.
It does matter on some arches, so we need to use put_unaligned() to store the u64 fields.
Current iproute2 package does not trigger this particular issue.
--- net/ipv4/tcp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +8 -4
@@ -279,6 +279,7 @@#include <asm/uaccess.h> #include <asm/ioctls.h> +#include <asm/unaligned.h> #include <net/busy_poll.h> int sysctl_tcp_fin_timeout__read_mostly =TCP_FIN_TIMEOUT ;
@@ -2637,6 +2638,7 @@ void tcp_get_info(struct sock *sk, strucconst struct inet_connection_sock *icsk =inet_csk (sk);u32 now = tcp_time_stamp;unsigned int start; +u64 rate64;u32 rate;memset (info,0 ,sizeof (*info));
@@ -2702,15 +2704,17 @@ void tcp_get_info(struct sock *sk, struc info->tcpi_total_retrans = tp->total_retrans; rate =READ_ONCE (sk->sk_pacing_rate); - info->tcpi_pacing_rate = rate != ~0U ? rate : ~0ULL ; + rate64 = rate != ~0U ? rate : ~0ULL ; +put_unaligned (rate64, &info->tcpi_pacing_rate); rate =READ_ONCE (sk->sk_max_pacing_rate); - info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL ; + rate64 = rate != ~0U ? rate : ~0ULL ; +put_unaligned (rate64, &info->tcpi_max_pacing_rate);do { start =u64_stats_fetch_begin_irq (&tp->syncp); - info->tcpi_bytes_acked = tp->bytes_acked; - info->tcpi_bytes_received = tp->bytes_received; +put_unaligned (tp->bytes_acked, &info->tcpi_bytes_acked); +put_unaligned (tp->bytes_received, &info->tcpi_bytes_received); }while (u64_stats_fetch_retry_irq (&tp->syncp, start)); info->tcpi_segs_out = tp->segs_out; info->tcpi_segs_in = tp->segs_in;
Greg Kroah-Hartman
maintainerPATCH 15/342 ipv6: enforce flowi6_oif usage in ip6_dst_lookup_tail()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 6f21c96a78b835259546d8f3fb4edff0f651d478 ]
The current implementation of ip6_dst_lookup_tail basically ignore the egress ifindex match: if the saddr is set, ip6_route_output() purposefully ignores flowi6_oif, due to the commit d46a9d678e4c ("net: ipv6: Dont add RT6_LOOKUP_F_IFACE flag if saddr set"), if the saddr is 'any' the first route lookup in ip6_dst_lookup_tail fails, but upon failure a second lookup will be performed with saddr set, thus ignoring the ifindex constraint.
This commit adds an output route lookup function variant, which allows the caller to specify lookup flags, and modify ip6_dst_lookup_tail() to enforce the ifindex match on the second lookup via said helper.
ip6_route_output() becames now a static inline function build on top of ip6_route_output_flags(); as a side effect, out-of-tree modules need now a GPL license to access the output route lookup functionality.
--- include/net/ip6_route.h | 12 ++++++++++-- net/ipv6/ip6_output.c | 6 +++++- net/ipv6/route.c | 7 +++---- 3 files changed, 18 insertions(+), 7 deletions(-)
include/net/ip6_route.h +10 -2
@@ -64,8 +64,16 @@ static inline bool rt6_need_strict(constvoid ip6_route_input (struct sk_buff *skb); -struct dst_entry *ip6_route_output (struct net *net,const struct sock *sk, -struct flowi6 *fl6); +struct dst_entry *ip6_route_output_flags (struct net *net,const struct sock *sk, +struct flowi6 *fl6,int flags); + +static inline struct dst_entry *ip6_route_output (struct net *net, +const struct sock *sk, +struct flowi6 *fl6) +{ +return ip6_route_output_flags (net, sk, fl6,0 ); +} +struct dst_entry *ip6_route_lookup (struct net *net,struct flowi6 *fl6,int flags);
net/ipv6/ip6_output.c +5 -1
@@ -909,6 +909,7 @@ static int ip6_dst_lookup_tail(struct nestruct rt6_info *rt;#endif int err; +int flags =0 ;/* The correct way to handle this would be to do * ip6_route_get_saddr, and then ip6_route_output; however,
@@ -940,10 +941,13 @@ static int ip6_dst_lookup_tail(struct nedst_release (*dst); *dst =NULL ; } + +if (fl6->flowi6_oif) + flags |=RT6_LOOKUP_F_IFACE ; }if (!*dst) - *dst =ip6_route_output (net, sk, fl6); + *dst =ip6_route_output_flags (net, sk, fl6, flags); err = (*dst)->error;if (err)
net/ipv6/route.c +3 -4
@@ -1174,11 +1174,10 @@ static struct rt6_info *ip6_pol_route_oureturn ip6_pol_route (net, table, fl6->flowi6_oif, fl6, flags); } -struct dst_entry *ip6_route_output (struct net *net,const struct sock *sk, -struct flowi6 *fl6) +struct dst_entry *ip6_route_output_flags (struct net *net,const struct sock *sk, +struct flowi6 *fl6,int flags) {struct dst_entry *dst; -int flags =0 ;bool any_src; dst =l3mdev_rt6_dst_by_oif (net, fl6);
@@ -1199,7 +1198,7 @@ struct dst_entry *ip6_route_output(strucreturn fib6_rule_lookup (net, fl6, flags, ip6_pol_route_output); } -EXPORT_SYMBOL (ip6_route_output); +EXPORT_SYMBOL_GPL (ip6_route_output_flags);struct dst_entry *ip6_blackhole_route (struct net *net,struct dst_entry *dst_orig) {
Greg Kroah-Hartman
maintainerPATCH 16/342 ipv6/udp: use sticky pktinfo egress ifindex on connect()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 1cdda91871470f15e79375991bd2eddc6e86ddb1 ]
Currently, the egress interface index specified via IPV6_PKTINFO is ignored by __ip6_datagram_connect(), so that RFC 3542 section 6.7 can be subverted when the user space application calls connect() before sendmsg().
Fix it by initializing properly flowi6_oif in connect() before performing the route lookup.
--- net/ipv6/datagram.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/datagram.c +3 -0
@@ -162,6 +162,9 @@ ipv4_connected: fl6.fl6_dport = inet->inet_dport; fl6.fl6_sport = inet->inet_sport; +if (!fl6.flowi6_oif) + fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; +if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST )) fl6.flowi6_oif = np->mcast_oif;
Greg Kroah-Hartman
maintainerPATCH 17/342 ipv6: addrconf: Fix recursive spin lock call
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit 16186a82de1fdd868255448274e64ae2616e2640 ]
A rcu stall with the following backtrace was seen on a system with forwarding, optimistic_dad and use_optimistic set. To reproduce, set these flags and allow ipv6 autoconf.
This occurs because the device write_lock is acquired while already holding the read_lock. Back trace below -
INFO: rcu_preempt self-detected stall on CPU { 1} (t=2100 jiffies
g=3992 c=3991 q=4471)<6> Task dump for CPU 1:
<2> kworker/1:0 R running task 12168 15 2 0x00000002
<2> Workqueue: ipv6_addrconf addrconf_dad_work <6> Call trace:
<2> [<ffffffc000084da8>] el1_irq+0x68/0xdc
<2> [<ffffffc000cc4e0c>] _raw_write_lock_bh+0x20/0x30 <2> [<ffffffc000bc5dd8>] __ipv6_dev_ac_inc+0x64/0x1b4 <2> [<ffffffc000bcbd2c>] addrconf_join_anycast+0x9c/0xc4 <2> [<ffffffc000bcf9f0>] __ipv6_ifa_notify+0x160/0x29c <2> [<ffffffc000bcfb7c>] ipv6_ifa_notify+0x50/0x70 <2> [<ffffffc000bd035c>] addrconf_dad_work+0x314/0x334 <2> [<ffffffc0000b64c8>] process_one_work+0x244/0x3fc <2> [<ffffffc0000b7324>] worker_thread+0x2f8/0x418 <2> [<ffffffc0000bb40c>] kthread+0xe0/0xec
v2: do addrconf_dad_kick inside read lock and then acquire write lock for ipv6_ifa_notify as suggested by Eric
addresses useful candidates")
--- net/ipv6/addrconf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +4 -1
@@ -3506,6 +3506,7 @@ static void addrconf_dad_begin(struct in {struct inet6_dev *idev = ifp->idev;struct net_device *dev = idev->dev; +bool notify = false;addrconf_join_solict (dev, &ifp->addr);
@@ -3551,7 +3552,7 @@ static void addrconf_dad_begin(struct in/* Because optimistic nodes can use this address, * notify listeners. If DAD fails, RTM_DELADDR is sent. */ -ipv6_ifa_notify (RTM_NEWADDR , ifp); + notify = true; } }
@@ -3559,6 +3560,8 @@ static void addrconf_dad_begin(struct in out:spin_unlock (&ifp->lock);read_unlock_bh (&idev->lock); +if (notify) +ipv6_ifa_notify (RTM_NEWADDR , ifp); }static void addrconf_dad_start (struct inet6_ifaddr *ifp)
Greg Kroah-Hartman
maintainerPATCH 18/342 ipv6: fix a lockdep splat
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 44c3d0c1c0a880354e9de5d94175742e2c7c9683 ]
Silence lockdep false positive about rcu_dereference() being used in the wrong context.
First one should use rcu_dereference_protected() as we own the spinlock.
Second one should be a normal assignation, as no barrier is needed.
--- net/ipv6/ip6_flowlabel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv6/ip6_flowlabel.c +3 -2
@@ -540,12 +540,13 @@ int ipv6_flowlabel_opt(struct sock *sk, }spin_lock_bh (&ip6_sk_fl_lock);for (sflp = &np->ipv6_fl_list; - (sfl =rcu_dereference (*sflp)) !=NULL ; + (sfl =rcu_dereference_protected (*sflp, +lockdep_is_held (&ip6_sk_fl_lock))) !=NULL ; sflp = &sfl->next) {if (sfl->fl->label == freq.flr_label) {if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK )) np->flow_label &= ~IPV6_FLOWLABEL_MASK ; - *sflp =rcu_dereference (sfl->next); + *sflp = sfl->next;spin_unlock_bh (&ip6_sk_fl_lock);fl_release (sfl->fl);kfree_rcu (sfl, rcu);
Greg Kroah-Hartman
maintainerPATCH 19/342 unix: correctly track in-flight fds in sending process user_struct
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <[email protected]>
[ Upstream commit 415e3d3e90ce9e18727e8843ae343eda5a58fad6 ]
The commit referenced in the Fixes tag incorrectly accounted the number of in-flight fds over a unix domain socket to the original opener of the file-descriptor. This allows another process to arbitrary deplete the original file-openers resource limit for the maximum of open files. Instead the sending processes and its struct cred should be credited.
To do so, we add a reference counted struct user_struct pointer to the scm_fp_list and use it to account for the number of inflight unix fds.
--- include/net/af_unix.h | 4 ++-- include/net/scm.h | 1 + net/core/scm.c | 7 +++++++ net/unix/af_unix.c | 4 ++-- net/unix/garbage.c | 8 ++++---- 5 files changed, 16 insertions(+), 8 deletions(-)
include/net/af_unix.h +2 -2
@@ -6,8 +6,8 @@#include <linux/mutex.h> #include <net/sock.h> -void unix_inflight (struct file *fp); -void unix_notinflight (struct file *fp); +void unix_inflight (struct user_struct *user,struct file *fp); +void unix_notinflight (struct user_struct *user,struct file *fp);void unix_gc (void );void wait_for_unix_gc (void );struct sock *unix_get_socket (struct file *filp);
include/net/scm.h +1 -0
@@ -21,6 +21,7 @@ struct scm_creds {struct scm_fp_list {short count;short max; +struct user_struct *user;struct file *fp[SCM_MAX_FD ]; };
net/core/scm.c +7 -0
@@ -87,6 +87,7 @@ static int scm_fp_copy(struct cmsghdr *c *fplp = fpl; fpl->count =0 ; fpl->max =SCM_MAX_FD ; + fpl->user =NULL ; } fpp = &fpl->fp[fpl->count];
@@ -107,6 +108,10 @@ static int scm_fp_copy(struct cmsghdr *c *fpp++ = file; fpl->count++; } + +if (!fpl->user) + fpl->user =get_uid (current_user ()); +return num; }
@@ -119,6 +124,7 @@ void __scm_destroy(struct scm_cookie *sc scm->fp =NULL ;for (i=fpl->count-1 ; i>=0 ; i--)fput (fpl->fp[i]); +free_uid (fpl->user);kfree (fpl); } }
@@ -336,6 +342,7 @@ struct scm_fp_list *scm_fp_dup(struct scfor (i =0 ; i < fpl->count; i++)get_file (fpl->fp[i]); new_fpl->max = new_fpl->count; + new_fpl->user =get_uid (fpl->user); }return new_fpl; }
net/unix/af_unix.c +2 -2
@@ -1496,7 +1496,7 @@ static void unix_detach_fds(struct scm_cUNIXCB (skb).fp =NULL ;for (i = scm->fp->count-1 ; i >=0 ; i--) -unix_notinflight (scm->fp->fp[i]); +unix_notinflight (scm->fp->user, scm->fp->fp[i]); }static void unix_destruct_scm (struct sk_buff *skb)
@@ -1561,7 +1561,7 @@ static int unix_attach_fds(struct scm_coreturn -ENOMEM ;for (i = scm->fp->count -1 ; i >=0 ; i--) -unix_inflight (scm->fp->fp[i]); +unix_inflight (scm->fp->user, scm->fp->fp[i]);return max_level; }
net/unix/garbage.c +4 -4
@@ -116,7 +116,7 @@ struct sock *unix_get_socket(struct file* descriptor if it is for an AF_UNIX socket. */ -void unix_inflight (struct file *fp) +void unix_inflight (struct user_struct *user,struct file *fp) {struct sock *s =unix_get_socket (fp);
@@ -133,11 +133,11 @@ void unix_inflight(struct file *fp) } unix_tot_inflight++; } - fp->f_cred->user->unix_inflight++; + user->unix_inflight++;spin_unlock (&unix_gc_lock); } -void unix_notinflight (struct file *fp) +void unix_notinflight (struct user_struct *user,struct file *fp) {struct sock *s =unix_get_socket (fp);
@@ -152,7 +152,7 @@ void unix_notinflight(struct file *fp)list_del_init (&u->link); unix_tot_inflight--; } - fp->f_cred->user->unix_inflight--; + user->unix_inflight--;spin_unlock (&unix_gc_lock); }
Greg Kroah-Hartman
maintainerPATCH 20/342 tcp: do not drop syn_recv on all icmp reports
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9cf7490360bf2c46a16b7525f899e4970c5fc144 ]
Petr Novopashenniy reported that ICMP redirects on SYN_RECV sockets were leading to RST.
This is of course incorrect.
A specific list of ICMP messages should be able to drop a SYN_RECV.
For instance, a REDIRECT on SYN_RECV shall be ignored, as we do not hold a dst per SYN_RECV pseudo request.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111751
--- include/net/tcp.h | 2 +- net/ipv4/tcp_ipv4.c | 11 ++++++++--- net/ipv6/tcp_ipv6.c | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-)
include/net/tcp.h +1 -1
@@ -449,7 +449,7 @@ const u8 *tcp_parse_md5sig_option(constvoid tcp_v4_send_check (struct sock *sk,struct sk_buff *skb);void tcp_v4_mtu_reduced (struct sock *sk); -void tcp_req_err (struct sock *sk,u32 seq); +void tcp_req_err (struct sock *sk,u32 seq,bool abort);int tcp_v4_conn_request (struct sock *sk,struct sk_buff *skb); struct sock *tcp_create_openreq_child(const struct sock *sk, struct request_sock *req,
net/ipv4/tcp_ipv4.c +8 -3
@@ -312,7 +312,7 @@ static void do_redirect(struct sk_buff */* handle ICMP messages on TCP_NEW_SYN_RECV request sockets */ -void tcp_req_err (struct sock *sk,u32 seq) +void tcp_req_err (struct sock *sk,u32 seq,bool abort) {struct request_sock *req =inet_reqsk (sk);struct net *net =sock_net (sk);
@@ -324,7 +324,7 @@ void tcp_req_err(struct sock *sk, u32 seif (seq !=tcp_rsk (req)->snt_isn) {NET_INC_STATS_BH (net,LINUX_MIB_OUTOFWINDOWICMPS ); - }else { + }else if (abort) {/* * Still in SYN_RECV, just remove it silently. * There is no good way to pass the error to the newly
@@ -384,7 +384,12 @@ void tcp_v4_err(struct sk_buff *icmp_skb } seq =ntohl (th->seq);if (sk->sk_state ==TCP_NEW_SYN_RECV ) -return tcp_req_err (sk, seq); +return tcp_req_err (sk, seq, + type ==ICMP_PARAMETERPROB || + type ==ICMP_TIME_EXCEEDED || + (type ==ICMP_DEST_UNREACH && + (code ==ICMP_NET_UNREACH || + code ==ICMP_HOST_UNREACH )));bh_lock_sock (sk);/* If too many ICMPs get dropped on busy
net/ipv6/tcp_ipv6.c +3 -2
@@ -328,6 +328,7 @@ static void tcp_v6_err(struct sk_buff *sstruct tcp_sock *tp;__u32 seq, snd_una;struct sock *sk; +bool fatal;int err; sk = __inet6_lookup_established(net, &tcp_hashinfo,
@@ -346,8 +347,9 @@ static void tcp_v6_err(struct sk_buff *sreturn ; } seq =ntohl (th->seq); + fatal =icmpv6_err_convert (type, code, &err);if (sk->sk_state ==TCP_NEW_SYN_RECV ) -return tcp_req_err (sk, seq); +return tcp_req_err (sk, seq, fatal);bh_lock_sock (sk);if (sock_owned_by_user (sk) && type !=ICMPV6_PKT_TOOBIG )
@@ -401,7 +403,6 @@ static void tcp_v6_err(struct sk_buff *s goto out; } -icmpv6_err_convert (type, code, &err);/* Might be for an request_sock */ switch (sk->sk_state) {
Greg Kroah-Hartman
maintainerPATCH 21/342 net:Add sysctl_max_skb_frags
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Westgaard Ry <[email protected]>
[ Upstream commit 5f74f82ea34c0da80ea0b49192bb5ea06e063593 ]
Devices may have limits on the number of fragments in an skb they support. Current codebase uses a constant as maximum for number of fragments one skb can hold and use.
When enabling scatter/gather and running traffic with many small messages the codebase uses the maximum number of fragments and may thereby violate the max for certain devices.
The patch introduces a global variable as max number of fragments.
--- include/linux/skbuff.h | 1 + net/core/skbuff.c | 2 ++ net/core/sysctl_net_core.c | 10 ++++++++++ net/ipv4/tcp.c | 4 ++-- 4 files changed, 15 insertions(+), 2 deletions(-)
include/linux/skbuff.h +1 -0
@@ -219,6 +219,7 @@ struct sk_buff;#else #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)#endif +extern int sysctl_max_skb_frags;typedef struct skb_frag_struct skb_frag_t ;
net/core/skbuff.c +2 -0
@@ -79,6 +79,8 @@struct kmem_cache *skbuff_head_cache__read_mostly ;static struct kmem_cache *skbuff_fclone_cache__read_mostly ; +int sysctl_max_skb_frags__read_mostly =MAX_SKB_FRAGS ; +EXPORT_SYMBOL (sysctl_max_skb_frags);/** * skb_panic - private function for out-of-line support
net/core/sysctl_net_core.c +10 -0
@@ -26,6 +26,7 @@ static int zero = 0;static int one =1 ;static int min_sndbuf =SOCK_MIN_SNDBUF ;static int min_rcvbuf =SOCK_MIN_RCVBUF ; +static int max_skb_frags =MAX_SKB_FRAGS ;static int net_msg_warn;/* Unused, but still a sysctl */
@@ -392,6 +393,15 @@ static struct ctl_table net_core_table[] .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "max_skb_frags", + .data = &sysctl_max_skb_frags, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, + .extra2 = &max_skb_frags, + }, { } };
net/ipv4/tcp.c +2 -2
@@ -939,7 +939,7 @@ new_segment: i =skb_shinfo (skb)->nr_frags; can_coalesce =skb_can_coalesce (skb, i, page, offset); -if (!can_coalesce && i >=MAX_SKB_FRAGS ) { +if (!can_coalesce && i >= sysctl_max_skb_frags) {tcp_mark_push (tp, skb); goto new_segment; }
@@ -1212,7 +1212,7 @@ new_segment:if (!skb_can_coalesce (skb, i, pfrag->page, pfrag->offset)) { -if (i ==MAX_SKB_FRAGS || !sg) { +if (i == sysctl_max_skb_frags || !sg) {tcp_mark_push (tp, skb); goto new_segment; }
Greg Kroah-Hartman
maintainerPATCH 22/342 tg3: Fix for tg3 transmit queue 0 timed out when too many gso_segs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siva Reddy Kallam <[email protected]>
[ Upstream commit b7d987295c74500b733a0ba07f9a9bcc4074fa83 ]
tg3_tso_bug() can hit a condition where the entire tx ring is not big enough to segment the GSO packet. For example, if MSS is very small, gso_segs can exceed the tx ring size. When we hit the condition, it will cause tx timeout.
tg3_tso_bug() is called to handle TSO and DMA hardware bugs. For TSO bugs, if tg3_tso_bug() cannot succeed, we have to drop the packet. For DMA bugs, we can still fall back to linearize the SKB and let the hardware transmit the TSO packet.
This patch adds a function tg3_tso_bug_gso_check() to check if there are enough tx descriptors for GSO before calling tg3_tso_bug(). The caller will then handle the error appropriately - drop or lineraize the SKB.
v2: Corrected patch description to avoid confusion.
--- drivers/net/ethernet/broadcom/tg3.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +19 -6
@@ -7833,6 +7833,14 @@ static int tigon3_dma_hwbug_workaround(sreturn ret; } +static bool tg3_tso_bug_gso_check (struct tg3_napi *tnapi,struct sk_buff *skb) +{ +/* Check if we will never have enough descriptors, +* as gso_segs can be more than current ring size +*/ +return skb_shinfo (skb)->gso_segs < tnapi->tx_pending /3 ; +} +static netdev_tx_t tg3_start_xmit (struct sk_buff *,struct net_device *);/* Use GSO to workaround all TSO packets that meet HW bug conditions
@@ -7936,14 +7944,19 @@ static netdev_tx_t tg3_start_xmit(struct* vlan encapsulated. */ if (skb->protocol ==htons (ETH_P_8021Q ) || - skb->protocol ==htons (ETH_P_8021AD )) -return tg3_tso_bug (tp, tnapi, txq, skb); + skb->protocol ==htons (ETH_P_8021AD )) { +if (tg3_tso_bug_gso_check (tnapi, skb)) +return tg3_tso_bug (tp, tnapi, txq, skb); + goto drop; + }if (!skb_is_gso_v6 (skb)) {if (unlikely ((ETH_HLEN + hdr_len) >80 ) && -tg3_flag (tp,TSO_BUG )) -return tg3_tso_bug (tp, tnapi, txq, skb); - +tg3_flag (tp,TSO_BUG )) { +if (tg3_tso_bug_gso_check (tnapi, skb)) +return tg3_tso_bug (tp, tnapi, txq, skb); + goto drop; + } ip_csum = iph->check; ip_tot_len = iph->tot_len; iph->check =0 ;
@@ -8075,7 +8088,7 @@ static netdev_tx_t tg3_start_xmit(structif (would_hit_hwbug) {tg3_tx_skb_unmap (tnapi, tnapi->tx_prod, i); -if (mss) { +if (mss &&tg3_tso_bug_gso_check (tnapi, skb)) {/* If it's a TSO packet, do GSO instead of * allocating and copying to a large linear SKB */
Greg Kroah-Hartman
maintainerPATCH 23/342 enic: increment devcmd2 result ring in case of timeout
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandeep Pillai <[email protected]>
[ Upstream commit ca7f41a4957b872577807169bd7464b36aae9b9c ]
Firmware posts the devcmd result in result ring. In case of timeout, driver does not increment the current result pointer and firmware could post the result after timeout has occurred. During next devcmd, driver would be reading the result of previous devcmd.
Fix this by incrementing result even in case of timeout.
--- drivers/net/ethernet/cisco/enic/enic.h | 2 +- drivers/net/ethernet/cisco/enic/vnic_dev.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +1 -1
@@ -33,7 +33,7 @@#define DRV_NAME "enic"#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" -#define DRV_VERSION "2.3.0.12" +#define DRV_VERSION "2.3.0.20"#define DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc"#define ENIC_BARS_MAX 6
drivers/net/ethernet/cisco/enic/vnic_dev.c +12 -7
@@ -298,7 +298,8 @@ static int _vnic_dev_cmd2(struct vnic_de int wait) {struct devcmd2_controller *dc2c = vdev->devcmd2; -struct devcmd2_result *result = dc2c->result + dc2c->next_result; +struct devcmd2_result *result; +u8 color;unsigned int i;int delay, err;u32 fetch_index, new_posted;
@@ -336,13 +337,17 @@ static int _vnic_dev_cmd2(struct vnic_deif (dc2c->cmd_ring[posted].flags &DEVCMD2_FNORESULT )return 0 ; + result = dc2c->result + dc2c->next_result; + color = dc2c->color; + + dc2c->next_result++; +if (dc2c->next_result == dc2c->result_size) { + dc2c->next_result =0 ; + dc2c->color = dc2c->color ?0 :1 ; + } +for (delay =0 ; delay < wait; delay++) { -if (result->color == dc2c->color) { - dc2c->next_result++; -if (dc2c->next_result == dc2c->result_size) { - dc2c->next_result =0 ; - dc2c->color = dc2c->color ?0 :1 ; - } +if (result->color == color) {if (result->error) { err = result->error; if (err != ERR_ECMDUNKNOWN ||
Greg Kroah-Hartman
maintainerPATCH 24/342 sctp: translate network order to host order when users get a hmacid
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 7a84bd46647ff181eb2659fdc99590e6f16e501d ]
Commit ed5a377d87dc ("sctp: translate host order to network order when setting a hmacid") corrected the hmacid byte-order when setting a hmacid. but the same issue also exists on getting a hmacid.
We fix it by changing hmacids to host order when users get them with getsockopt.
--- net/sctp/socket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/sctp/socket.c +7 -2
@@ -5542,6 +5542,7 @@ static int sctp_getsockopt_hmac_ident(ststruct sctp_hmac_algo_param *hmacs;__u16 data_len =0 ;u32 num_idents; +int i;if (!ep->auth_enable)return -EACCES ;
@@ -5559,8 +5560,12 @@ static int sctp_getsockopt_hmac_ident(streturn -EFAULT ;if (put_user (num_idents, &p->shmac_num_idents))return -EFAULT ; -if (copy_to_user (p->shmac_idents, hmacs->hmac_ids, data_len)) -return -EFAULT ; +for (i =0 ; i < num_idents; i++) { +__u16 hmacid =ntohs (hmacs->hmac_ids[i]); + +if (copy_to_user (&p->shmac_idents[i], &hmacid,sizeof (__u16))) +return -EFAULT ; + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 25/342 net: Copy inner L3 and L4 headers as unaligned on GRE TEB
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <[email protected]>
[ Upstream commit 78565208d73ca9b654fb9a6b142214d52eeedfd1 ]
This patch corrects the unaligned accesses seen on GRE TEB tunnels when generating hash keys. Specifically what this patch does is make it so that we force the use of skb_copy_bits when the GRE inner headers will be unaligned due to NET_IP_ALIGNED being a non-zero value.
--- net/core/flow_dissector.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/core/flow_dissector.c +7 -0
@@ -396,6 +396,13 @@ ip_proto_again: goto out_bad; proto = eth->h_proto; nhoff +=sizeof (*eth); + +/* Cap headers that we access via pointers at the +* end of the Ethernet header as our maximum alignment +* at that point is only 2 bytes. +*/ +if (NET_IP_ALIGN ) + hlen = nhoff; } key_control->flags |=FLOW_DIS_ENCAPSULATION ;
Greg Kroah-Hartman
maintainerPATCH 26/342 flow_dissector: Fix unaligned access in __skb_flow_dissector when used by eth_get_headlen
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <[email protected]>
[ Upstream commit 461547f3158978c180d74484d58e82be9b8e7357 ]
This patch fixes an issue with unaligned accesses when using eth_get_headlen on a page that was DMA aligned instead of being IP aligned. The fact is when trying to check the length we don't need to be looking at the flow label so we can reorder the checks to first check if we are supposed to gather the flow label and then make the call to actually get it.
v2: Updated path so that either STOP_AT_FLOW_LABEL or KEY_FLOW_LABEL can
cause us to check for the flow label.
--- net/core/flow_dissector.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/core/flow_dissector.c +6 -3
@@ -208,7 +208,6 @@ ip:case htons (ETH_P_IPV6 ): {const struct ipv6hdr *iph;struct ipv6hdr _iph; -__be32 flow_label; ipv6: iph =__skb_header_pointer (skb, nhoff,sizeof (_iph), data, hlen, &_iph);
@@ -230,8 +229,12 @@ ipv6: key_control->addr_type =FLOW_DISSECTOR_KEY_IPV6_ADDRS ; } - flow_label =ip6_flowlabel (iph); -if (flow_label) { +if ((dissector_uses_key (flow_dissector, +FLOW_DISSECTOR_KEY_FLOW_LABEL ) || + (flags &FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL )) && +ip6_flowlabel (iph)) { +__be32 flow_label =ip6_flowlabel (iph); +if (dissector_uses_key (flow_dissector,FLOW_DISSECTOR_KEY_FLOW_LABEL )) { key_tags = skb_flow_dissector_target(flow_dissector,
Greg Kroah-Hartman
maintainerPATCH 27/342 bpf: fix branch offset adjustment on backjumps after patching ctx expansion
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit a1b14d27ed0965838350f1377ff97c93ee383492 ]
When ctx access is used, the kernel often needs to expand/rewrite instructions, so after that patching, branch offsets have to be adjusted for both forward and backward jumps in the new eBPF program, but for backward jumps it fails to account the delta. Meaning, for example, if the expansion happens exactly on the insn that sits at the jump target, it doesn't fix up the back jump offset.
Analysis on what the check in adjust_branches() is currently doing:
/* adjust offset of jmps if necessary */
if (i < pos && i + insn->off + 1 > pos)
insn->off += delta;
else if (i > pos && i + insn->off + 1 < pos)
insn->off -= delta;First condition (forward jumps):
Before: After:
insns[0] insns[0]
insns[1] <--- i/insn insns[1] <--- i/insn
insns[2] <--- pos insns[P] <--- pos
insns[3] insns[P] `------| delta
insns[4] <--- target_X insns[P] `-----|
insns[5] insns[3]
insns[4] <--- target_X
insns[5]First case is if we cross pos-boundary and the jump instruction was before pos. This is handeled correctly. I.e. if i == pos, then this would mean our jump that we currently check was the patchlet itself that we just injected. Since such patchlets are self-contained and have no awareness of any insns before or after the patched one, the delta is correctly not adjusted. Also, for the second condition in case of i + insn->off + 1 == pos, means we jump to that newly patched instruction, so no offset adjustment are needed. That part is correct.
Second condition (backward jumps):
Before: After:
insns[0] insns[0]
insns[1] <--- target_X insns[1] <--- target_X
insns[2] <--- pos <-- target_Y insns[P] <--- pos <-- target_Y
insns[3] insns[P] `------| delta
insns[4] <--- i/insn insns[P] `-----|
insns[5] insns[3]
insns[4] <--- i/insn
insns[5]Second interesting case is where we cross pos-boundary and the jump instruction was after pos. Backward jump with i == pos would be impossible and pose a bug somewhere in the patchlet, so the first condition checking i > pos is okay only by itself. However, i + insn->off + 1 < pos does not always work as intended to trigger the adjustment. It works when jump targets would be far off where the delta wouldn't matter. But, for example, where the fixed insn->off before pointed to pos (target_Y), it now points to pos + delta, so that additional room needs to be taken into account for the check. This means that i) both tests here need to be adjusted into pos + delta, and ii) for the second condition, the test needs to be <= as pos itself can be a target in the backjump, too.
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -2082,7 +2082,7 @@ static void adjust_branches(struct bpf_p/* adjust offset of jmps if necessary */ if (i < pos && i + insn->off +1 > pos) insn->off += delta; -else if (i > pos && i + insn->off +1 < pos) +else if (i > pos + delta && i + insn->off +1 <= pos + delta) insn->off -= delta; } }
Greg Kroah-Hartman
maintainerPATCH 28/342 bonding: Fix ARP monitor validation
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vosburgh <[email protected]>
[ Upstream commit 21a75f0915dde8674708b39abfcda113911c49b1 ]
The current logic in bond_arp_rcv will accept an incoming ARP for validation if (a) the receiving slave is either "active" (which includes the currently active slave, or the current ARP slave) or, (b) there is a currently active slave, and it has received an ARP since it became active. For case (b), the receiving slave isn't the currently active slave, and is receiving the original broadcast ARP request, not an ARP reply from the target.
This logic can fail if there is no currently active slave. In
this situation, the ARP probe logic cycles through all slaves, assigning each in turn as the "current_arp_slave" for one arp_interval, then setting that one as "active," and sending an ARP probe from that slave. The current logic expects the ARP reply to arrive on the sending current_arp_slave, however, due to switch FDB updating delays, the reply may be directed to another slave.
This can arise if the bonding slaves and switch are working, but
the ARP target is not responding. When the ARP target recovers, a condition may result wherein the ARP target host replies faster than the switch can update its forwarding table, causing each ARP reply to be sent to the previous current_arp_slave. This will never pass the logic in bond_arp_rcv, as neither of the above conditions (a) or (b) are met.
Some experimentation on a LAN shows ARP reply round trips in the
200 usec range, but my available switches never update their FDB in less than 4000 usec.
This patch changes the logic in bond_arp_rcv to additionally
accept an ARP reply for validation on any slave if there is a current ARP slave and it sent an ARP probe during the previous arp_interval.
--- drivers/net/bonding/bond_main.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-)
drivers/net/bonding/bond_main.c +28 -11
@@ -214,6 +214,8 @@ static void bond_uninit(struct net_devicstatic struct rtnl_link_stats64 *bond_get_stats (struct net_device *bond_dev,struct rtnl_link_stats64 *stats);static void bond_slave_arr_handler (struct work_struct *work); +static bool bond_time_in_interval (struct bonding *bond,unsigned long last_act, +int mod);/*---------------------------- General routines -----------------------------*/
@@ -2418,7 +2420,7 @@ int bond_arp_rcv(const struct sk_buff *s struct slave *slave) {struct arphdr *arp = (struct arphdr *)skb->data; -struct slave *curr_active_slave; +struct slave *curr_active_slave, *curr_arp_slave;unsigned char *arp_ptr;__be32 sip, tip;int alen, is_arp = skb->protocol ==__cpu_to_be16 (ETH_P_ARP );
@@ -2465,26 +2467,41 @@ int bond_arp_rcv(const struct sk_buff *s &sip, &tip); curr_active_slave =rcu_dereference (bond->curr_active_slave); + curr_arp_slave =rcu_dereference (bond->current_arp_slave); -/* Backup slaves won't see the ARP reply, but do come through -* here for each ARP probe (so we swap the sip/tip to validate -* the probe). In a "redundant switch, common router" type of -* configuration, the ARP probe will (hopefully) travel from -* the active, through one switch, the router, then the other -* switch before reaching the backup. +/* We 'trust' the received ARP enough to validate it if: * -* We 'trust' the arp requests if there is an active slave and -* it received valid arp reply(s) after it became active. This -* is done to avoid endless looping when we can't reach the +* (a) the slave receiving the ARP is active (which includes the +* current ARP slave, if any), or +* +* (b) the receiving slave isn't active, but there is a currently +* active slave and it received valid arp reply(s) after it became +* the currently active slave, or +* +* (c) there is an ARP slave that sent an ARP during the prior ARP +* interval, and we receive an ARP reply on any slave. We accept +* these because switch FDB update delays may deliver the ARP +* reply to a slave other than the sender of the ARP request. +* +* Note: for (b), backup slaves are receiving the broadcast ARP +* request, not a reply. This request passes from the sending +* slave through the L2 switch(es) to the receiving slave. Since +* this is checking the request, sip/tip are swapped for +* validation. +* +* This is done to avoid endless looping when we can't reach the * arp_ip_target and fool ourselves with our own arp requests. */ -if (bond_is_active_slave (slave))bond_validate_arp (bond, slave, sip, tip);else if (curr_active_slave &&time_after (slave_last_rx (bond, curr_active_slave), curr_active_slave->last_link_up))bond_validate_arp (bond, slave, tip, sip); +else if (curr_arp_slave && (arp->ar_op ==htons (ARPOP_REPLY )) && +bond_time_in_interval (bond, +dev_trans_start (curr_arp_slave->dev),1 )) +bond_validate_arp (bond, slave, sip, tip); out_unlock:if (arp != (struct arphdr *)skb->data)
Greg Kroah-Hartman
maintainerPATCH 29/342 ipv4: fix memory leaks in ip_cmsg_send() callers
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 919483096bfe75dda338e98d56da91a263746a0a ]
Dmitry reported memory leaks of IP options allocated in ip_cmsg_send() when/if this function returns an error.
Callers are responsible for the freeing.
Many thanks to Dmitry for the report and diagnostic.
--- net/ipv4/ip_sockglue.c | 2 ++ net/ipv4/ping.c | 4 +++- net/ipv4/raw.c | 4 +++- net/ipv4/udp.c | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-)
net/ipv4/ip_sockglue.c +2 -0
@@ -249,6 +249,8 @@ int ip_cmsg_send(struct net *net, structswitch (cmsg->cmsg_type) {case IP_RETOPTS : err = cmsg->cmsg_len -CMSG_ALIGN (sizeof (struct cmsghdr )); + +/* Our caller is responsible for freeing ipc->opt */ err =ip_options_get (net, &ipc->opt,CMSG_DATA (cmsg), err <40 ? err :40 );if (err)
net/ipv4/ping.c +3 -1
@@ -746,8 +746,10 @@ static int ping_v4_sendmsg(struct sock *if (msg->msg_controllen) { err =ip_cmsg_send (sock_net (sk), msg, &ipc, false); -if (err) +if (unlikely (err)) { +kfree (ipc.opt);return err; + }if (ipc.opt) free =1 ; }
net/ipv4/raw.c +3 -1
@@ -547,8 +547,10 @@ static int raw_sendmsg(struct sock *sk,if (msg->msg_controllen) { err =ip_cmsg_send (net, msg, &ipc, false); -if (err) +if (unlikely (err)) { +kfree (ipc.opt); goto out; + }if (ipc.opt) free =1 ; }
net/ipv4/udp.c +3 -1
@@ -966,8 +966,10 @@ int udp_sendmsg(struct sock *sk, structif (msg->msg_controllen) { err =ip_cmsg_send (sock_net (sk), msg, &ipc, sk->sk_family ==AF_INET6 ); -if (err) +if (unlikely (err)) { +kfree (ipc.opt);return err; + }if (ipc.opt) free =1 ; connected =0 ;
Greg Kroah-Hartman
maintainerPATCH 30/342 af_unix: Dont set err in unix_stream_read_generic unless there was an error
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rainer Weikusat <[email protected]>
[ Upstream commit 1b92ee3d03af6643df395300ba7748f19ecdb0c5 ]
The present unix_stream_read_generic contains various code sequences of the form
err = -EDISASTER;
if (<test>)
goto out;
This has the unfortunate side effect of possibly causing the error code to bleed through to the final
out:
return copied ? : err;
and then to be wrongly returned if no data was copied because the caller didn't supply a data buffer, as demonstrated by the program available at
Change it such that err is only set if an error condition was detected.
--- net/unix/af_unix.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/unix/af_unix.c +10 -6
@@ -2270,13 +2270,15 @@ static int unix_stream_read_generic(strusize_t size = state->size;unsigned int last_len; - err = -EINVAL ; -if (sk->sk_state !=TCP_ESTABLISHED ) +if (unlikely (sk->sk_state !=TCP_ESTABLISHED )) { + err = -EINVAL ; goto out; + } - err = -EOPNOTSUPP ; -if (flags &MSG_OOB ) +if (unlikely (flags &MSG_OOB )) { + err = -EOPNOTSUPP ; goto out; + } target =sock_rcvlowat (sk, flags &MSG_WAITALL , size); timeo =sock_rcvtimeo (sk, noblock);
@@ -2322,9 +2324,11 @@ again: goto unlock;unix_state_unlock (sk); - err = -EAGAIN ; -if (!timeo) +if (!timeo) { + err = -EAGAIN ;break ; + } +mutex_unlock (&u->readlock); timeo = unix_stream_data_wait(sk, timeo, last,
Greg Kroah-Hartman
maintainerPATCH 31/342 af_unix: Guard against other == sk in unix_dgram_sendmsg
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rainer Weikusat <[email protected]>
[ Upstream commit a5527dda344fff0514b7989ef7a755729769daa1 ]
The unix_dgram_sendmsg routine use the following test
if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {
to determine if sk and other are in an n:1 association (either established via connect or by using sendto to send messages to an unrelated socket identified by address). This isn't correct as the specified address could have been bound to the sending socket itself or because this socket could have been connected to itself by the time of the unix_peer_get but disconnected before the unix_state_lock(other). In both cases, the if-block would be entered despite other == sk which might either block the sender unintentionally or lead to trying to unlock the same spin lock twice for a non-blocking send. Add a other != sk check to guard against this.
--- net/unix/af_unix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/unix/af_unix.c +6 -1
@@ -1781,7 +1781,12 @@ restart_locked: goto out_unlock; } -if (unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) { +/* other == sk && unix_peer(other) != sk if +* - unix_peer(sk) == NULL, destination address bound to sk +* - unix_peer(sk) == sk by time of get but disconnected before lock +*/ +if (other != sk && +unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) {if (timeo) { timeo =unix_wait_for_peer (other, timeo);
Greg Kroah-Hartman
maintainerPATCH 32/342 tipc: fix premature addition of node to lookup table
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Paul Maloy <[email protected]>
[ Upstream commit d5c91fb72f1652ea3026925240a0998a42ddb16b ]
In commit 5266698661401a ("tipc: let broadcast packet reception use new link receive function") we introduced a new per-node broadcast reception link instance. This link is created at the moment the node itself is created. Unfortunately, the allocation is done after the node instance has already been added to the node lookup hash table. This creates a potential race condition, where arriving broadcast packets are able to find and access the node before it has been fully initialized, and before the above mentioned link has been created. The result is occasional crashes in the function tipc_bcast_rcv(), which is trying to access the not-yet existing link.
We fix this by deferring the addition of the node instance until after it has been fully initialized in the function tipc_node_create().
--- net/tipc/node.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/tipc/node.c +6 -6
@@ -168,12 +168,6 @@ struct tipc_node *tipc_node_create(strucskb_queue_head_init (&n_ptr->bc_entry.inputq1);__skb_queue_head_init (&n_ptr->bc_entry.arrvq);skb_queue_head_init (&n_ptr->bc_entry.inputq2); -hlist_add_head_rcu (&n_ptr->hash, &tn->node_htable[tipc_hashfn (addr)]); -list_for_each_entry_rcu (temp_node, &tn->node_list, list) { -if (n_ptr->addr < temp_node->addr) -break ; - } -list_add_tail_rcu (&n_ptr->list, &temp_node->list); n_ptr->state =SELF_DOWN_PEER_LEAVING ; n_ptr->signature =INVALID_NODE_SIG ; n_ptr->active_links[0 ] =INVALID_BEARER_ID ;
@@ -193,6 +187,12 @@ struct tipc_node *tipc_node_create(structipc_node_get (n_ptr);setup_timer (&n_ptr->timer, tipc_node_timeout, (unsigned long )n_ptr); n_ptr->keepalive_intv =U32_MAX ; +hlist_add_head_rcu (&n_ptr->hash, &tn->node_htable[tipc_hashfn (addr)]); +list_for_each_entry_rcu (temp_node, &tn->node_list, list) { +if (n_ptr->addr < temp_node->addr) +break ; + } +list_add_tail_rcu (&n_ptr->list, &temp_node->list); exit:spin_unlock_bh (&tn->node_list_lock);return n_ptr;
Greg Kroah-Hartman
maintainerPATCH 33/342 tcp: md5: release request socket instead of listener
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 729235554d805c63e5e274fcc6a98e71015dd847 ]
If tcp_v4_inbound_md5_hash() returns an error, we must release the refcount on the request socket, not on the listener.
The bug was added for IPv4 only.
--- net/ipv4/tcp_ipv4.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv4/tcp_ipv4.c +4 -2
@@ -1597,8 +1597,10 @@ process:struct sock *nsk =NULL ; sk = req->rsk_listener; -if (tcp_v4_inbound_md5_hash (sk, skb)) - goto discard_and_relse; +if (unlikely (tcp_v4_inbound_md5_hash (sk, skb))) { +reqsk_put (req); + goto discard_it; + }if (likely (sk->sk_state ==TCP_LISTEN )) { nsk =tcp_check_req (sk, skb, req, false); }else {
Greg Kroah-Hartman
maintainerPATCH 34/342 qmi_wwan: add "4G LTE usb-modem U901"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <[email protected]>
[ Upstream commit aac8d3c282e024c344c5b86dc1eab7af88bb9716 ]
Thomas reports:
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=05c6 ProdID=6001 Rev=00.00 S: Manufacturer=USB Modem S: Product=USB Modem S: SerialNumber=1234567890ABCDEF C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -492,6 +492,7 @@ static const struct usb_device_id produc/* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ + {QMI_FIXED_INTF(0x05c6, 0x6001, 3)}, /* 4G LTE usb-modem U901 */ {QMI_FIXED_INTF(0x05c6, 0x7000, 0)}, {QMI_FIXED_INTF(0x05c6, 0x7001, 1)}, {QMI_FIXED_INTF(0x05c6, 0x7002, 1)},
Greg Kroah-Hartman
maintainerPATCH 35/342 net/mlx4_en: Count HW buffer overrun only once
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Vadai <[email protected]>
[ Upstream commit 281e8b2fdf8e4ef366b899453cae50e09b577ada ]
RdropOvflw counts overrun of HW buffer, therefore should be used for rx_fifo_errors only.
Currently RdropOvflw counter is mistakenly also set into rx_missed_errors and rx_over_errors too, which makes the device total dropped packets accounting to show wrong results.
Fix that. Use it for rx_fifo_errors only.
--- drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_port.c +2 -2
@@ -238,11 +238,11 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_e stats->collisions =0 ; stats->rx_dropped =be32_to_cpu (mlx4_en_stats->RDROP); stats->rx_length_errors =be32_to_cpu (mlx4_en_stats->RdropLength); - stats->rx_over_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_over_errors =0 ; stats->rx_crc_errors =be32_to_cpu (mlx4_en_stats->RCRC); stats->rx_frame_errors =0 ; stats->rx_fifo_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); - stats->rx_missed_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_missed_errors =0 ; stats->tx_aborted_errors =0 ; stats->tx_carrier_errors =0 ; stats->tx_fifo_errors =0 ;
Greg Kroah-Hartman
maintainerPATCH 36/342 net/mlx4_en: Choose time-stamping shift value according to HW frequency
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugenia Emantayev <[email protected]>
[ Upstream commit 31c128b66e5b28f468076e4f3ca3025c35342041 ]
Previously, the shift value used for time-stamping was constant and didn't depend on the HW chip frequency. Change that to take the frequency into account and calculate the maximal value in cycles per wraparound of ten seconds. This time slot was chosen since it gives a good accuracy in time synchronization.
Algorithm for shift value calculation:
* Round up the maximal value in cycles to nearest power of two
* Calculate maximal multiplier by division of all 64 bits set to above result
* Then, invert the function clocksource_khz2mult() to get the shift from maximal mult value
--- drivers/net/ethernet/mellanox/mlx4/en_clock.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_clock.c +19 -6
@@ -236,6 +236,24 @@ static const struct ptp_clock_info mlx4_ .enable = mlx4_en_phc_enable, }; +#define MLX4_EN_WRAP_AROUND_SEC 10ULL + +/* This function calculates the max shift that enables the user range +* of MLX4_EN_WRAP_AROUND_SEC values in the cycles register. +*/ +static u32 freq_to_shift (u16 freq) +{ +u32 freq_khz = freq *1000 ; +u64 max_val_cycles = freq_khz *1000 *MLX4_EN_WRAP_AROUND_SEC ; +u64 max_val_cycles_rounded =is_power_of_2 (max_val_cycles +1 ) ? + max_val_cycles :roundup_pow_of_two (max_val_cycles) -1 ; +/* calculate max possible multiplier in order to fit in 64bit */ +u64 max_mul =div_u64 (0xffffffffffffffffULL , max_val_cycles_rounded); + +/* This comes from the reverse of clocksource_khz2mult */ +return ilog2 (div_u64 (max_mul * freq_khz,1000000 )); +} +void mlx4_en_init_timestamp (struct mlx4_en_dev *mdev) {struct mlx4_dev *dev = mdev->dev;
@@ -254,12 +272,7 @@ void mlx4_en_init_timestamp(struct mlx4_memset (&mdev->cycles,0 ,sizeof (mdev->cycles)); mdev->cycles.read = mlx4_en_read_clock; mdev->cycles.mask =CLOCKSOURCE_MASK (48 ); -/* Using shift to make calculation more accurate. Since current HW -* clock frequency is 427 MHz, and cycles are given using a 48 bits -* register, the biggest shift when calculating using u64, is 14 -* (max_cycles * multiplier < 2^64) -*/ - mdev->cycles.shift =14 ; + mdev->cycles.shift =freq_to_shift (dev->caps.hca_core_clock); mdev->cycles.mult =clocksource_khz2mult (1000 * dev->caps.hca_core_clock, mdev->cycles.shift); mdev->nominal_c_mult = mdev->cycles.mult;
Greg Kroah-Hartman
maintainerPATCH 37/342 net/mlx4_en: Avoid changing dev->features directly in run-time
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugenia Emantayev <[email protected]>
[ Upstream commit 925ab1aa9394bbaeac47ee5b65d3fdf0fb8135cf ]
It's forbidden to manually change dev->features in run-time. Currently, this is done in the driver to make sure that GSO_UDP_TUNNEL is advertized only when VXLAN tunnel is set. However, since the stack actually does features intersection with hw_enc_features, we can safely revert to advertizing features early when registering the netdevice.
--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +5 -4
@@ -2381,8 +2381,6 @@ out:/* set offloads */ priv->dev->hw_enc_features |=NETIF_F_IP_CSUM |NETIF_F_RXCSUM |NETIF_F_TSO |NETIF_F_GSO_UDP_TUNNEL ; - priv->dev->hw_features |=NETIF_F_GSO_UDP_TUNNEL ; - priv->dev->features |=NETIF_F_GSO_UDP_TUNNEL ; }static void mlx4_en_del_vxlan_offloads (struct work_struct *work)
@@ -2393,8 +2391,6 @@ static void mlx4_en_del_vxlan_offloads(s/* unset offloads */ priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM |NETIF_F_RXCSUM |NETIF_F_TSO |NETIF_F_GSO_UDP_TUNNEL ); - priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL ; - priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL ; ret =mlx4_SET_PORT_VXLAN (priv->mdev->dev, priv->port,VXLAN_STEER_BY_OUTER_MAC ,0 );
@@ -3020,6 +3016,11 @@ int mlx4_en_init_netdev(struct mlx4_en_d priv->rss_hash_fn =ETH_RSS_HASH_TOP ; } +if (mdev->dev->caps.tunnel_offload_mode ==MLX4_TUNNEL_OFFLOAD_MODE_VXLAN ) { + dev->hw_features |=NETIF_F_GSO_UDP_TUNNEL ; + dev->features |=NETIF_F_GSO_UDP_TUNNEL ; + } + mdev->pndev[port] = dev; mdev->upper[port] =NULL ;
Greg Kroah-Hartman
maintainerPATCH 38/342 l2tp: Fix error creating L2TP tunnels
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Tomlinson <[email protected]>
[ Upstream commit 853effc55b0f975abd6d318cca486a9c1b67e10f ]
A previous commit (33f72e6) added notification via netlink for tunnels when created/modified/deleted. If the notification returned an error, this error was returned from the tunnel function. If there were no listeners, the error code ESRCH was returned, even though having no listeners is not an error. Other calls to this and other similar notification functions either ignore the error code, or filter ESRCH. This patch checks for ESRCH and does not flag this as an error.
--- net/l2tp/l2tp_netlink.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/l2tp/l2tp_netlink.c +14 -4
@@ -124,8 +124,13 @@ static int l2tp_tunnel_notify(struct gen ret =l2tp_nl_tunnel_send (msg, info->snd_portid, info->snd_seq,NLM_F_ACK , tunnel, cmd); -if (ret >=0 ) -return genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +if (ret >=0 ) { + ret =genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +/* We don't care if no one is listening */ +if (ret == -ESRCH ) + ret =0 ; +return ret; + }nlmsg_free (msg);
@@ -147,8 +152,13 @@ static int l2tp_session_notify(struct ge ret =l2tp_nl_session_send (msg, info->snd_portid, info->snd_seq,NLM_F_ACK , session, cmd); -if (ret >=0 ) -return genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +if (ret >=0 ) { + ret =genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +/* We don't care if no one is listening */ +if (ret == -ESRCH ) + ret =0 ; +return ret; + }nlmsg_free (msg);
Greg Kroah-Hartman
maintainerPATCH 39/342 pppoe: fix reference counting in PPPoE proxy
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit 29e73269aa4d36f92b35610c25f8b01c789b0dc8 ]
Drop reference on the relay_po socket when __pppoe_xmit() succeeds. This is already handled correctly in the error path.
--- drivers/net/ppp/pppoe.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ppp/pppoe.c +2 -0
@@ -395,6 +395,8 @@ static int pppoe_rcv_core(struct sock *sif (!__pppoe_xmit (sk_pppox (relay_po), skb)) goto abort_put; + +sock_put (sk_pppox (relay_po)); }else {if (sock_queue_rcv_skb (sk, skb)) goto abort_kfree;
Greg Kroah-Hartman
maintainerPATCH 40/342 net_sched fix: reclassification needs to consider ether protocol changes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 619fe32640b4b01f370574d50344ae0f62689816 ]
actions could change the etherproto in particular with ethernet tunnelled data. Typically such actions, after peeling the outer header, will ask for the packet to be reclassified. We then need to restart the classification with the new proto header.
Example setup used to catch this:
sudo tc qdisc add dev $ETH ingress
sudo $TC filter add dev $ETH parent ffff: pref 1 protocol 802.1Q \
u32 match u32 0 0 flowid 1:1 \
action vlan pop reclassify
--- net/sched/sch_api.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_api.c +1 -0
@@ -1852,6 +1852,7 @@ reset: } tp = old_tp; + protocol =tc_skb_protocol (skb); goto reclassify;#endif }
Greg Kroah-Hartman
maintainerPATCH 41/342 route: check and remove route cache when we get route
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit deed49df7390d5239024199e249190328f1651e7 ]
Since the gc of ipv4 route was removed, the route cached would has no chance to be removed, and even it has been timeout, it still could be used, cause no code to check it's expires.
Fix this issue by checking and removing route cache when we get route.
--- include/net/ip_fib.h | 1 net/ipv4/route.c | 77 +++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 64 insertions(+), 14 deletions(-)
include/net/ip_fib.h +1 -0
@@ -61,6 +61,7 @@ struct fib_nh_exception {struct rtable __rcu *fnhe_rth_input;struct rtable __rcu *fnhe_rth_output;unsigned long fnhe_stamp; +struct rcu_head rcu; };struct fnhe_hash_bucket {
net/ipv4/route.c +63 -14
119 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 42/342 tcp/dccp: fix another race at listener dismantle
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7716682cc58e305e22207d5bb315f26af6b1e243 ]
Ilya reported following lockdep splat:
kernel: =========================
kernel: [ BUG: held lock freed! ]
kernel: 4.5.0-rc1-ceph-00026-g5e0a311 #1 Not tainted
kernel: -------------------------
kernel: swapper/5/0 is freeing memory ffff880035c9d200-ffff880035c9dbff, with a lock still held there!
kernel: (&(&queue->rskq_lock)->rlock){+.-...}, at:
[<ffffffff816f6a88>] inet_csk_reqsk_queue_add+0x28/0xa0 kernel: 4 locks held by swapper/5/0:
kernel: #0: (rcu_read_lock){......}, at: [<ffffffff8169ef6b>] netif_receive_skb_internal+0x4b/0x1f0
kernel: #1: (rcu_read_lock){......}, at: [<ffffffff816e977f>] ip_local_deliver_finish+0x3f/0x380
kernel: #2: (slock-AF_INET){+.-...}, at: [<ffffffff81685ffb>] sk_clone_lock+0x19b/0x440
kernel: #3: (&(&queue->rskq_lock)->rlock){+.-...}, at:
[<ffffffff816f6a88>] inet_csk_reqsk_queue_add+0x28/0xa0
To properly fix this issue, inet_csk_reqsk_queue_add() needs to return to its callers if the child as been queued into accept queue.
We also need to make sure listener is still there before calling sk->sk_data_ready(), by holding a reference on it, since the reference carried by the child can disappear as soon as the child is put on accept queue.
--- include/net/inet_connection_sock.h | 5 +++-- net/dccp/ipv4.c | 14 +++++++------- net/dccp/ipv6.c | 14 +++++++------- net/ipv4/inet_connection_sock.c | 14 +++++++------- net/ipv4/tcp_ipv4.c | 14 +++++++------- net/ipv6/tcp_ipv6.c | 14 +++++++------- 6 files changed, 38 insertions(+), 37 deletions(-)
include/net/inet_connection_sock.h +3 -2
@@ -270,8 +270,9 @@ struct dst_entry *inet_csk_route_child_sstruct sock *newsk, const struct request_sock *req); -void inet_csk_reqsk_queue_add (struct sock *sk,struct request_sock *req, -struct sock *child); +struct sock *inet_csk_reqsk_queue_add (struct sock *sk, +struct request_sock *req, +struct sock *child);void inet_csk_reqsk_queue_hash_add (struct sock *sk,struct request_sock *req,unsigned long timeout); struct sock *inet_csk_complete_hashdance(struct sock *sk, struct sock *child,
net/dccp/ipv4.c +7 -7
@@ -824,26 +824,26 @@ lookup:if (sk->sk_state ==DCCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener; -if (likely (sk->sk_state ==DCCP_LISTEN )) { - nsk =dccp_check_req (sk, skb, req); - }else { +if (unlikely (sk->sk_state !=DCCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =dccp_check_req (sk, skb, req);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req); }else if (dccp_child_process (sk, nsk, skb)) {dccp_v4_ctl_send_reset (sk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
net/dccp/ipv6.c +7 -7
@@ -691,26 +691,26 @@ lookup:if (sk->sk_state ==DCCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener; -if (likely (sk->sk_state ==DCCP_LISTEN )) { - nsk =dccp_check_req (sk, skb, req); - }else { +if (unlikely (sk->sk_state !=DCCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =dccp_check_req (sk, skb, req);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req); }else if (dccp_child_process (sk, nsk, skb)) {dccp_v6_ctl_send_reset (sk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
net/ipv4/inet_connection_sock.c +7 -7
@@ -789,14 +789,16 @@ static void inet_child_forget(struct socreqsk_put (req); } -void inet_csk_reqsk_queue_add (struct sock *sk,struct request_sock *req, -struct sock *child) +struct sock *inet_csk_reqsk_queue_add (struct sock *sk, +struct request_sock *req, +struct sock *child) {struct request_sock_queue *queue = &inet_csk (sk)->icsk_accept_queue;spin_lock (&queue->rskq_lock);if (unlikely (sk->sk_state !=TCP_LISTEN )) {inet_child_forget (sk, req, child); + child =NULL ; }else { req->sk = child; req->dl_next =NULL ;
@@ -808,6 +810,7 @@ void inet_csk_reqsk_queue_add(struct socsk_acceptq_added (sk); }spin_unlock (&queue->rskq_lock); +return child; }EXPORT_SYMBOL (inet_csk_reqsk_queue_add);
@@ -817,11 +820,8 @@ struct sock *inet_csk_complete_hashdanceif (own_req) {inet_csk_reqsk_queue_drop (sk, req);reqsk_queue_removed (&inet_csk (sk)->icsk_accept_queue, req); -inet_csk_reqsk_queue_add (sk, req, child); -/* Warning: caller must not call reqsk_put(req); -* child stole last reference on it. -*/ -return child; +if (inet_csk_reqsk_queue_add (sk, req, child)) +return child; }/* Too bad, another child took ownership of the request, undo. */ bh_unlock_sock (child);
net/ipv4/tcp_ipv4.c +7 -7
@@ -1594,30 +1594,30 @@ process:if (sk->sk_state ==TCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener;if (unlikely (tcp_v4_inbound_md5_hash (sk, skb))) {reqsk_put (req); goto discard_it; } -if (likely (sk->sk_state ==TCP_LISTEN )) { - nsk =tcp_check_req (sk, skb, req, false); - }else { +if (unlikely (sk->sk_state !=TCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =tcp_check_req (sk, skb, req, false);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req); }else if (tcp_child_process (sk, nsk, skb)) {tcp_v4_send_reset (nsk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
net/ipv6/tcp_ipv6.c +7 -7
@@ -1388,7 +1388,7 @@ process:if (sk->sk_state ==TCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener;tcp_v6_fill_cb (skb, hdr, th);
@@ -1396,24 +1396,24 @@ process:reqsk_put (req); goto discard_it; } -if (likely (sk->sk_state ==TCP_LISTEN )) { - nsk =tcp_check_req (sk, skb, req, false); - }else { +if (unlikely (sk->sk_state !=TCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =tcp_check_req (sk, skb, req, false);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req);tcp_v6_restore_cb (skb); }else if (tcp_child_process (sk, nsk, skb)) {tcp_v6_send_reset (nsk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
Greg Kroah-Hartman
maintainerPATCH 43/342 IFF_NO_QUEUE: Fix for drivers not calling ether_setup()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit a813104d923339144078939175faf4e66aca19b4 ]
My implementation around IFF_NO_QUEUE driver flag assumed that leaving tx_queue_len untouched (specifically: not setting it to zero) by drivers would make it possible to assign a regular qdisc to them without having to worry about setting tx_queue_len to a useful value. This was only partially true: I overlooked that some drivers don't call ether_setup() and therefore not initialize tx_queue_len to the default value of 1000. Consequently, removing the workarounds in place for that case in qdisc implementations which cared about it (namely, pfifo, bfifo, gred, htb, plug and sfb) leads to problems with these specific interface types and qdiscs.
Luckily, there's already a sanitization point for drivers setting tx_queue_len to zero, which can be reused to assign the fallback value most qdisc implementations used, which is 1.
--- net/core/dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/dev.c +3 -1
@@ -7128,8 +7128,10 @@ struct net_device *alloc_netdev_mqs(int dev->priv_flags =IFF_XMIT_DST_RELEASE |IFF_XMIT_DST_RELEASE_PERM ;setup (dev); -if (!dev->tx_queue_len) +if (!dev->tx_queue_len) { dev->priv_flags |=IFF_NO_QUEUE ; + dev->tx_queue_len =1 ; + } dev->num_tx_queues = txqs; dev->real_num_tx_queues = txqs;
Greg Kroah-Hartman
maintainerPATCH 44/342 rtnl: RTM_GETNETCONF: fix wrong return value
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Protopopov <[email protected]>
[ Upstream commit a97eb33ff225f34a8124774b3373fd244f0e83ce ]
An error response from a RTM_GETNETCONF request can return the positive error value EINVAL in the struct nlmsgerr that can mislead userspace.
--- net/ipv4/devinet.c | 2 +- net/ipv6/addrconf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/devinet.c +1 -1
@@ -1847,7 +1847,7 @@ static int inet_netconf_get_devconf(struif (err <0 ) goto errout; - err =EINVAL ; + err = -EINVAL ;if (!tb[NETCONFA_IFINDEX ]) goto errout;
net/ipv6/addrconf.c +1 -1
@@ -583,7 +583,7 @@ static int inet6_netconf_get_devconf(strif (err <0 ) goto errout; - err =EINVAL ; + err = -EINVAL ;if (!tb[NETCONFA_IFINDEX ]) goto errout;
Greg Kroah-Hartman
maintainerPATCH 45/342 tipc: unlock in error path
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Insu Yun <[email protected]>
[ Upstream commit b53ce3e7d407aa4196877a48b8601181162ab158 ]
tipc_bcast_unlock need to be unlocked in error path.
--- net/tipc/bcast.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/bcast.c +3 -1
@@ -399,8 +399,10 @@ int tipc_nl_add_bc_link(struct net *net, hdr =genlmsg_put (msg->skb, msg->portid, msg->seq, &tipc_genl_family,NLM_F_MULTI ,TIPC_NL_LINK_GET ); -if (!hdr) +if (!hdr) { +tipc_bcast_unlock (net);return -EMSGSIZE ; + } attrs =nla_nest_start (msg->skb,TIPC_NLA_LINK );if (!attrs)
Greg Kroah-Hartman
maintainerPATCH 46/342 unix_diag: fix incorrect sign extension in unix_lookup_by_ino
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Dmitry V. Levin" <[email protected]>
[ Upstream commit b5f0549231ffb025337be5a625b0ff9f52b016f0 ]
The value passed by unix_diag_get_exact to unix_lookup_by_ino has type __u32, but unix_lookup_by_ino's argument ino has type int, which is not a problem yet.
However, when ino is compared with sock_i_ino return value of type unsigned long, ino is sign extended to signed long, and this results to incorrect comparison on 64-bit architectures for inode numbers greater than INT_MAX.
This bug was found by strace test suite.
--- net/unix/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/diag.c +1 -1
@@ -220,7 +220,7 @@ done:return skb->len; } -static struct sock *unix_lookup_by_ino (int ino) +static struct sock *unix_lookup_by_ino (unsigned int ino) {int i;struct sock *sk;
Greg Kroah-Hartman
maintainerPATCH 47/342 sctp: Fix port hash table size computation
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
[ Upstream commit d9749fb5942f51555dc9ce1ac0dbb1806960a975 ]
Dmitry Vyukov noted recently that the sctp_port_hashtable had an error in its size computation, observing that the current method never guaranteed that the hashsize (measured in number of entries) would be a power of two, which the input hash function for that table requires. The root cause of the problem is that two values need to be computed (one, the allocation order of the storage requries, as passed to __get_free_pages, and two the number of entries for the hash table). Both need to be ^2, but for different reasons, and the existing code is simply computing one order value, and using it as the basis for both, which is wrong (i.e. it assumes that ((1<<order)*PAGE_SIZE)/sizeof(bucket) is still ^2 when its not).
To fix this, we change the logic slightly. We start by computing a goal allocation order (which is limited by the maximum size hash table we want to support. Then we attempt to allocate that size table, decreasing the order until a successful allocation is made. Then, with the resultant successful order we compute the number of buckets that hash table supports, which we then round down to the nearest power of two, giving us the number of entries the table actually supports.
I've tested this locally here, using non-debug and spinlock-debug kernels, and the number of entries in the hashtable consistently work out to be powers of two in all cases.
--- net/sctp/protocol.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
net/sctp/protocol.c +36 -7
@@ -60,6 +60,8 @@#include <net/inet_common.h> #include <net/inet_ecn.h> +#define MAX_SCTP_PORT_HASH_ENTRIES (64 * 1024) +/* Global data structures. */ struct sctp_globals sctp_globals__read_mostly ;
@@ -1352,6 +1354,8 @@ static __init int sctp_init(void)unsigned long limit;int max_share;int order; +int num_entries; +int max_entry_order;sock_skb_cb_check_size (sizeof (struct sctp_ulpevent ));
@@ -1404,14 +1408,24 @@ static __init int sctp_init(void)/* Size and allocate the association hash table. * The methodology is similar to that of the tcp hash tables. +* Though not identical. Start by getting a goal size */ if (totalram_pages >= (128 *1024 )) goal = totalram_pages >> (22 -PAGE_SHIFT );else goal = totalram_pages >> (24 -PAGE_SHIFT ); -for (order =0 ; (1UL << order) < goal; order++) - ; +/* Then compute the page order for said goal */ + order =get_order (goal); + +/* Now compute the required page order for the maximum sized table we +* want to create +*/ + max_entry_order =get_order (MAX_SCTP_PORT_HASH_ENTRIES * +sizeof (struct sctp_bind_hashbucket )); + +/* Limit the page order by that maximum hash table size */ + order =min (order, max_entry_order); do { sctp_assoc_hashsize = (1UL << order) * PAGE_SIZE /
@@ -1445,20 +1459,35 @@ static __init int sctp_init(void)INIT_HLIST_HEAD (&sctp_ep_hashtable[i].chain); } -/* Allocate and initialize the SCTP port hash table. */ +/* Allocate and initialize the SCTP port hash table. +* Note that order is initalized to start at the max sized +* table we want to support. If we can't get that many pages +* reduce the order and try again +*/ do { - sctp_port_hashsize = (1UL << order) *PAGE_SIZE / -sizeof (struct sctp_bind_hashbucket ); -if ((sctp_port_hashsize > (64 *1024 )) && order >0 ) -continue ; sctp_port_hashtable = (struct sctp_bind_hashbucket *)__get_free_pages (GFP_ATOMIC |__GFP_NOWARN, order); }while (!sctp_port_hashtable && --order >0 ); +if (!sctp_port_hashtable) {pr_err ("Failed bind hash alloc\n" ); status = -ENOMEM ; goto err_bhash_alloc; } + +/* Now compute the number of entries that will fit in the +* port hash space we allocated +*/ + num_entries = (1UL << order) *PAGE_SIZE / +sizeof (struct sctp_bind_hashbucket ); + +/* And finish by rounding it down to the nearest power of two +* this wastes some memory of course, but its needed because +* the hash function operates based on the assumption that +* that the number of entries is a power of two +*/ + sctp_port_hashsize =rounddown_pow_of_two (num_entries); +for (i =0 ; i < sctp_port_hashsize; i++) {spin_lock_init (&sctp_port_hashtable[i].lock);INIT_HLIST_HEAD (&sctp_port_hashtable[i].chain);
Greg Kroah-Hartman
maintainerPATCH 48/342 ext4: fix bh->b_state corruption
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit ed8ad83808f009ade97ebbf6519bc3a97fefbc0c upstream.
ext4 can update bh->b_state non-atomically in _ext4_get_block() and ext4_da_get_block_prep(). Usually this is fine since bh is just a temporary storage for mapping information on stack but in some cases it can be fully living bh attached to a page. In such case non-atomic update of bh->b_state can race with an atomic update which then gets lost. Usually when we are mapping bh and thus updating bh->b_state non-atomically, nobody else touches the bh and so things work out fine but there is one case to especially worry about: ext4_finish_bio() uses BH_Uptodate_Lock on the first bh in the page to synchronize handling of PageWriteback state. So when blocksize < pagesize, we can be atomically modifying bh->b_state of a buffer that actually isn't under IO and thus can race e.g. with delalloc trying to map that buffer. The result is that we can mistakenly set / clear BH_Uptodate_Lock bit resulting in the corruption of PageWriteback state or missed unlock of BH_Uptodate_Lock.
Fix the problem by always updating bh->b_state bits atomically.
--- fs/ext4/inode.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
fs/ext4/inode.c +30 -2
@@ -657,6 +657,34 @@ has_zeroout:return retval; } +/* +* Update EXT4_MAP_FLAGS in bh->b_state. For buffer heads attached to pages +* we have to be careful as someone else may be manipulating b_state as well. +*/ +static void ext4_update_bh_state (struct buffer_head *bh,unsigned long flags) +{ +unsigned long old_state; +unsigned long new_state; + + flags &=EXT4_MAP_FLAGS ; + +/* Dummy buffer_head? Set non-atomically. */ +if (!bh->b_page) { + bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | flags; +return ; + } +/* +* Someone else may be modifying b_state. Be careful! This is ugly but +* once we get rid of using bh as a container for mapping information +* to pass to / from get_block functions, this can go away. +*/ +do { + old_state =READ_ONCE (bh->b_state); + new_state = (old_state & ~EXT4_MAP_FLAGS ) | flags; + }while (unlikely ( +cmpxchg (&bh->b_state, old_state, new_state) != old_state)); +} +/* Maximum number of blocks we map for direct IO at once. */ #define DIO_MAX_BLOCKS 4096
@@ -693,7 +721,7 @@ static int _ext4_get_block(struct inodeext4_io_end_t *io_end =ext4_inode_aio (inode);map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags);if (IS_DAX (inode) &&buffer_unwritten (bh)) {/* * dgc: I suspect unwritten conversion on ext4+DAX is
@@ -1669,7 +1697,7 @@ int ext4_da_get_block_prep(struct inodereturn ret;map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags);if (buffer_unwritten (bh)) {/* A delayed write to unwritten bh should be marked
Greg Kroah-Hartman
maintainerPATCH 49/342 ARM: debug-ll: fix BCM63xx entry for multiplatform
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 6c54809977de3c9e2ef9e9934a2c6625f7e161e7 upstream.
During my randconfig build testing, I found that a kernel with DEBUG_AT91_UART and ARCH_BCM_63XX fails to build:
arch/arm/include/debug/at91.S:18:0: error: "CONFIG_DEBUG_UART_VIRT" redefined [-Werror]
It turns out that the DEBUG_UART_BCM63XX option is enabled whenever the ARCH_BCM_63XX is, and that breaks multiplatform kernels because we then end up using the UART address from BCM63XX rather than the one we actually configured (if any).
This changes the BCM63XX options to only have one Kconfig option, and only enable that if the user explicitly turns it on.
--- arch/arm/Kconfig.debug | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
arch/arm/Kconfig.debug +6 -11
@@ -162,10 +162,9 @@ choice mobile SoCs in the Kona family of chips (e.g. bcm28155, bcm11351, etc...) - config DEBUG_BCM63XX + config DEBUG_BCM63XX_UART bool "Kernel low-level debugging on BCM63XX UART" depends on ARCH_BCM_63XX - select DEBUG_UART_BCM63XX config DEBUG_BERLIN_UART bool "Marvell Berlin SoC Debug UART"
@@ -1348,7 +1347,7 @@ config DEBUG_LL_INCLUDE default "debug/vf.S" if DEBUG_VF_UART default "debug/vt8500.S" if DEBUG_VT8500_UART0 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1 - default "debug/bcm63xx.S" if DEBUG_UART_BCM63XX + default "debug/bcm63xx.S" if DEBUG_BCM63XX_UART default "debug/digicolor.S" if DEBUG_DIGICOLOR_UA0 default "mach/debug-macro.S"
@@ -1364,10 +1363,6 @@ config DEBUG_UART_8250 ARCH_IOP33X || ARCH_IXP4XX || \ ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC -# Compatibility options for BCM63xx -config DEBUG_UART_BCM63XX - def_bool ARCH_BCM_63XX - config DEBUG_UART_PHYS hex "Physical base address of debug UART" default 0x00100a00 if DEBUG_NETX_UART
@@ -1462,7 +1457,7 @@ config DEBUG_UART_PHYS default 0xfffb0000 if DEBUG_OMAP1UART1 || DEBUG_OMAP7XXUART1 default 0xfffb0800 if DEBUG_OMAP1UART2 || DEBUG_OMAP7XXUART2 default 0xfffb9800 if DEBUG_OMAP1UART3 || DEBUG_OMAP7XXUART3 - default 0xfffe8600 if DEBUG_UART_BCM63XX + default 0xfffe8600 if DEBUG_BCM63XX_UART default 0xfffff700 if ARCH_IOP33X depends on ARCH_EP93XX || \ DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
@@ -1474,7 +1469,7 @@ config DEBUG_UART_PHYS DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \ DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \ DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART || \ + DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \ DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 || \ DEBUG_AT91_UART
@@ -1515,7 +1510,7 @@ config DEBUG_UART_VIRT default 0xfb10c000 if DEBUG_REALVIEW_PB1176_PORT default 0xfc40ab00 if DEBUG_BRCMSTB_UART default 0xfc705000 if DEBUG_ZTE_ZX - default 0xfcfe8600 if DEBUG_UART_BCM63XX + default 0xfcfe8600 if DEBUG_BCM63XX_UART default 0xfd000000 if ARCH_SPEAR3XX || ARCH_SPEAR6XX default 0xfd000000 if ARCH_SPEAR13XX default 0xfd012000 if ARCH_MV78XX0
@@ -1566,7 +1561,7 @@ config DEBUG_UART_VIRT DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ DEBUG_NETX_UART || \ DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ - DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART || \ + DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \ DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 config DEBUG_UART_8250_SHIFT
Greg Kroah-Hartman
maintainerPATCH 50/342 arm64: errata: Add -mpc-relative-literal-loads to build flags
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: dann frazier <[email protected]>
commit 67dfa1751ce71e629aad7c438e1678ad41054677 upstream.
GCC6 (and Linaro's 2015.12 snapshot of GCC5) has a new default that uses adrp/ldr or adrp/add to address literal pools. When CONFIG_ARM64_ERRATUM_843419 is enabled, modules built with this toolchain fail to load:
module libahci: unsupported RELA relocation: 275
This patch fixes the problem by passing '-mpc-relative-literal-loads' to the compiler.
--- arch/arm64/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Makefile +1 -0
@@ -27,6 +27,7 @@ $(warning LSE atomics not supported by b endif KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) +KBUILD_CFLAGS += $(call cc-option, -mpc-relative-literal-loads) KBUILD_AFLAGS += $(lseinstr) ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
Greg Kroah-Hartman
maintainerPATCH 51/342 KVM: s390: fix guest fprs memory leak
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 9c7ebb613bffea2feef4ec562ba1dbcaa810942b upstream.
fprs is never freed, therefore resulting in a memory leak if kvm_vcpu_init() fails or the vcpu is destroyed.
--- arch/s390/kvm/kvm-s390.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +4 -1
@@ -1202,6 +1202,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vcif (vcpu->kvm->arch.use_cmma)kvm_s390_vcpu_unsetup_cmma (vcpu); +kfree (vcpu->arch.guest_fpregs.fprs);free_page ((unsigned long )(vcpu->arch.sie_block));kvm_vcpu_uninit (vcpu);
@@ -1516,12 +1517,14 @@ struct kvm_vcpu *kvm_arch_vcpu_create(st rc =kvm_vcpu_init (vcpu, kvm, id);if (rc) - goto out_free_sie_block; + goto out_free_fprs;VM_EVENT (kvm,3 ,"create cpu %d at %p, sie block at %p" , id, vcpu, vcpu->arch.sie_block);trace_kvm_s390_create_vcpu (id, vcpu, vcpu->arch.sie_block);return vcpu; +out_free_fprs: +kfree (vcpu->arch.guest_fpregs.fprs); out_free_sie_block:free_page ((unsigned long )(vcpu->arch.sie_block)); out_free_cpu:
Greg Kroah-Hartman
maintainerPATCH 52/342 devm_memremap: Fix error value when memremap failed
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit 93f834df9c2d4e362dfdc4b05daa0a4e18814836 upstream.
devm_memremap() returns an ERR_PTR() value in case of error. However, it returns NULL when memremap() failed. This causes the caller, such as the pmem driver, to proceed and oops later.
Change devm_memremap() to return ERR_PTR(-ENXIO) when memremap() failed.
--- kernel/memremap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/memremap.c +3 -1
@@ -133,8 +133,10 @@ void *devm_memremap(struct device *dev,if (addr) { *ptr = addr;devres_add (dev, ptr); - }else + }else {devres_free (ptr); +return ERR_PTR (-ENXIO ); + }return addr; }
Greg Kroah-Hartman
maintainerPATCH 53/342 drm/gma500: Use correct unref in the gem bo create function
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit d3e376f52d095103ca51dbda4d6ff8aaf488f98f upstream.
This is called without dev->struct_mutex held, we need to use the _unlocked variant.
Never caught in the wild since you'd need an evil userspace which races a gem_close ioctl call with the in-progress open.
--- drivers/gpu/drm/gma500/gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/gem.c +1 -1
@@ -130,7 +130,7 @@ int psb_gem_create(struct drm_file *filereturn ret; }/* We have the initial and handle reference but need only one now */ -drm_gem_object_unreference (&r->gem); +drm_gem_object_unreference_unlocked (&r->gem); *handlep = handle;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 54/342 ARM: 8457/1: psci-smp is built only for SMP
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit be95485a0b8288a93402705730d3ea32f9f812b9 upstream.
The PSCI SMP implementation is built only when both CONFIG_SMP and CONFIG_ARM_PSCI are set, so a configuration that has the latter but not the former can get a link error when it tries to call psci_smp_available().
arch/arm/mach-tegra/built-in.o: In function `tegra114_cpuidle_init':
cpuidle-tegra114.c:(.init.text+0x52a): undefined reference to `psci_smp_available'
This corrects the #ifdef in the psci.h header file to match the Makefile conditional we have for building that function.
--- arch/arm/include/asm/psci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/psci.h +1 -1
@@ -16,7 +16,7 @@extern struct smp_operations psci_smp_ops; -#ifdef CONFIG_ARM_PSCI +#if defined(CONFIG_SMP ) && defined(CONFIG_ARM_PSCI )bool psci_smp_available (void );#else static inline bool psci_smp_available (void ) {return false; }
Greg Kroah-Hartman
maintainerPATCH 55/342 lib/ucs2_string: Add ucs2 -> utf8 helper functions
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit 73500267c930baadadb0d02284909731baf151f7 upstream.
This adds ucs2_utf8size(), which tells us how big our ucs2 string is in bytes, and ucs2_as_utf8, which translates from ucs2 to utf8..
--- include/linux/ucs2_string.h | 4 ++ lib/ucs2_string.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+)
include/linux/ucs2_string.h +4 -0
@@ -11,4 +11,8 @@ unsigned long ucs2_strlen(const ucs2_chaunsigned long ucs2_strsize (const ucs2_char_t *data,unsigned long maxlength);int ucs2_strncmp (const ucs2_char_t *a,const ucs2_char_t *b,size_t len); +unsigned long ucs2_utf8size (const ucs2_char_t *src); +unsigned long ucs2_as_utf8 (u8 *dest,const ucs2_char_t *src, +unsigned long maxlength); +#endif /* _LINUX_UCS2_STRING_H_ */
lib/ucs2_string.c +62 -0
65 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 56/342 efi: Use ucs2_as_utf8 in efivarfs instead of open coding a bad version
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit e0d64e6a880e64545ad7d55786aa84ab76bac475 upstream.
Translate EFI's UCS-2 variable names to UTF-8 instead of just assuming all variable names fit in ASCII.
--- drivers/firmware/efi/efivars.c | 30 +++++++++++------------------- fs/efivarfs/super.c | 7 +++---- 2 files changed, 14 insertions(+), 23 deletions(-)
drivers/firmware/efi/efivars.c +11 -19
@@ -540,38 +540,30 @@ static ssize_t efivar_delete(struct filestatic int efivar_create_sysfs_entry (struct efivar_entry *new_var) { -int i, short_name_size; +int short_name_size;char *short_name; -unsigned long variable_name_size; -efi_char16_t *variable_name; +unsigned long utf8_name_size; +efi_char16_t *variable_name = new_var->var.VariableName;int ret; - variable_name = new_var->var.VariableName; - variable_name_size =ucs2_strlen (variable_name) *sizeof (efi_char16_t); -/* -* Length of the variable bytes in ASCII, plus the '-' separator, +* Length of the variable bytes in UTF8, plus the '-' separator, * plus the GUID, plus trailing NUL */ - short_name_size = variable_name_size /sizeof (efi_char16_t) - +1 +EFI_VARIABLE_GUID_LEN +1 ; - - short_name =kzalloc (short_name_size,GFP_KERNEL ); + utf8_name_size =ucs2_utf8size (variable_name); + short_name_size = utf8_name_size +1 +EFI_VARIABLE_GUID_LEN +1 ; + short_name =kmalloc (short_name_size,GFP_KERNEL );if (!short_name)return -ENOMEM ; -/* Convert Unicode to normal chars (assume top bits are 0), -ala UTF-8 */ -for (i=0 ; i < (int )(variable_name_size /sizeof (efi_char16_t)); i++) { - short_name[i] = variable_name[i] &0xFF ; - } +ucs2_as_utf8 (short_name, variable_name, short_name_size); +/* This is ugly, but necessary to separate one vendor's private variables from another's. */ - - *(short_name +strlen (short_name)) ='-' ; + short_name[utf8_name_size] ='-' ;efi_guid_to_str (&new_var->var.VendorGuid, - short_name +strlen (short_name)); + short_name + utf8_name_size +1 ); new_var->kobj.kset = efivars_kset;
fs/efivarfs/super.c +3 -4
@@ -118,7 +118,7 @@ static int efivarfs_callback(efi_char16_struct dentry *dentry, *root = sb->s_root;unsigned long size =0 ;char *name; -int len, i; +int len;int err = -ENOMEM ; entry =kzalloc (sizeof (*entry),GFP_KERNEL );
@@ -128,15 +128,14 @@ static int efivarfs_callback(efi_char16_memcpy (entry->var.VariableName, name16, name_size);memcpy (&(entry->var.VendorGuid), &vendor,sizeof (efi_guid_t)); - len =ucs2_strlen (entry->var.VariableName); + len =ucs2_utf8size (entry->var.VariableName);/* name, plus '-', plus GUID, plus NUL*/ name =kmalloc (len +1 +EFI_VARIABLE_GUID_LEN +1 ,GFP_KERNEL );if (!name) goto fail; -for (i =0 ; i < len; i++) - name[i] = entry->var.VariableName[i] &0xFF ; +ucs2_as_utf8 (name, entry->var.VariableName, len); name[len] ='-' ;
Greg Kroah-Hartman
maintainerPATCH 57/342 efi: Do variable name validation tests in utf8
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit 3dcb1f55dfc7631695e69df4a0d589ce5274bd07 upstream.
Actually translate from ucs2 to utf8 before doing the test, and then test against our other utf8 data, instead of fudging it.
--- drivers/firmware/efi/vars.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/firmware/efi/vars.c +21 -11
@@ -189,10 +189,19 @@ static const struct variable_validate va };bool -efivar_validate (efi_char16_t *var_name,u8 *data,unsigned long len) +efivar_validate (efi_char16_t *var_name,u8 *data,unsigned long data_size) {int i; -u16 *unicode_name = var_name; +unsigned long utf8_size; +u8 *utf8_name; + + utf8_size =ucs2_utf8size (var_name); + utf8_name =kmalloc (utf8_size +1 ,GFP_KERNEL ); +if (!utf8_name) +return false; + +ucs2_as_utf8 (utf8_name, var_name, utf8_size); + utf8_name[utf8_size] ='\0' ;for (i =0 ; variable_validate[i].validate !=NULL ; i++) {const char *name = variable_validate[i].name;
@@ -200,28 +209,29 @@ efivar_validate(efi_char16_t *var_name,for (match =0 ; ; match++) {char c = name[match]; -u16 u = unicode_name[match]; - -/* All special variables are plain ascii */ -if (u >127 ) -return true; +char u = utf8_name[match];/* Wildcard in the matching name means we've matched */ -if (c =='*' ) +if (c =='*' ) { +kfree (utf8_name);return variable_validate[i].validate (var_name, - match, data, len); + match, data, data_size); + }/* Case sensitive match */ if (c != u)break ;/* Reached the end of the string while matching */ -if (!c) +if (!c) { +kfree (utf8_name);return variable_validate[i].validate (var_name, - match, data, len); + match, data, data_size); + } } } +kfree (utf8_name);return true; }EXPORT_SYMBOL_GPL (efivar_validate);
Greg Kroah-Hartman
maintainerPATCH 58/342 efi: Make our variable validation list include the guid
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit 8282f5d9c17fe15a9e658c06e3f343efae1a2a2f upstream.
All the variables in this list so far are defined to be in the global namespace in the UEFI spec, so this just further ensures we're validating the variables we think we are.
Including the guid for entries will become more important in future patches when we decide whether or not to allow deletion of variables based on presence in this list.
--- drivers/firmware/efi/efivars.c | 5 ++- drivers/firmware/efi/vars.c | 52 ++++++++++++++++++++++++++--------------- include/linux/efi.h | 3 +- 3 files changed, 38 insertions(+), 22 deletions(-)
drivers/firmware/efi/efivars.c +3 -2
@@ -221,7 +221,7 @@ sanity_check(struct efi_variable *var, e }if ((attributes & ~EFI_VARIABLE_MASK ) !=0 || -efivar_validate (name, data, size) == false) { +efivar_validate (vendor, name, data, size) == false) {printk (KERN_ERR "efivars: Malformed variable content\n" );return -EINVAL ; }
@@ -447,7 +447,8 @@ static ssize_t efivar_create(struct file }if ((attributes & ~EFI_VARIABLE_MASK ) !=0 || -efivar_validate (name, data, size) == false) { +efivar_validate (new_var->VendorGuid, name, data, + size) == false) {printk (KERN_ERR "efivars: Malformed variable content\n" );return -EINVAL ; }
drivers/firmware/efi/vars.c +33 -19
80 lines not on this page · raw message
include/linux/efi.h +2 -1
@@ -1199,7 +1199,8 @@ int efivar_entry_iter(int (*func)(structstruct efivar_entry *efivar_entry_find (efi_char16_t *name,efi_guid_t guid,struct list_head *head,bool remove); -bool efivar_validate (efi_char16_t *var_name,u8 *data,unsigned long len); +bool efivar_validate (efi_guid_t vendor,efi_char16_t *var_name,u8 *data, +unsigned long data_size);extern struct work_struct efivar_work;void efivar_run_worker (void );
Greg Kroah-Hartman
maintainerPATCH 59/342 efi: Make efivarfs entries immutable by default
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit ed8b0de5a33d2a2557dce7f9429dca8cb5bc5879 upstream.
"rm -rf" is bricking some peoples' laptops because of variables being used to store non-reinitializable firmware driver data that's required to POST the hardware.
These are 100% bugs, and they need to be fixed, but in the mean time it shouldn't be easy to *accidentally* brick machines.
We have to have delete working, and picking which variables do and don't work for deletion is quite intractable, so instead make everything immutable by default (except for a whitelist), and make tools that aren't quite so broad-spectrum unset the immutable flag.
--- Documentation/filesystems/efivarfs.txt | 7 ++ drivers/firmware/efi/vars.c | 87 ++++++++++++++++++------- fs/efivarfs/file.c | 70 ++++++++++++++++++++ fs/efivarfs/inode.c | 30 +++++--- fs/efivarfs/internal.h | 3 fs/efivarfs/super.c | 9 ++ include/linux/efi.h | 2 tools/testing/selftests/efivarfs/efivarfs.sh | 19 ++++- tools/testing/selftests/efivarfs/open-unlink.c | 72 ++++++++++++++++++++ 9 files changed, 258 insertions(+), 41 deletions(-)
Documentation/filesystems/efivarfs.txt +7 -0
@@ -14,3 +14,10 @@ filesystem. efivarfs is typically mounted like this, mount -t efivarfs none /sys/firmware/efi/efivars + +Due to the presence of numerous firmware bugs where removing non-standard +UEFI variables causes the system firmware to fail to POST, efivarfs +files that are not well-known standardized variables are created +as immutable files. This doesn't prevent removal - "chattr -i" will work - +but it does prevent this kind of failure from being accomplished +accidentally.
drivers/firmware/efi/vars.c +64 -23
120 lines not on this page · raw message
fs/efivarfs/file.c +70 -0
85 lines not on this page · raw message
fs/efivarfs/inode.c +19 -11
@@ -15,7 +15,8 @@#include "internal.h" struct inode *efivarfs_get_inode (struct super_block *sb, -const struct inode *dir,int mode,dev_t dev) +const struct inode *dir,int mode, +dev_t dev,bool is_removable) {struct inode *inode =new_inode (sb);
@@ -23,6 +24,7 @@ struct inode *efivarfs_get_inode(struct inode->i_ino =get_next_ino (); inode->i_mode = mode; inode->i_atime = inode->i_mtime = inode->i_ctime =CURRENT_TIME ; + inode->i_flags = is_removable ?0 :S_IMMUTABLE ;switch (mode &S_IFMT ) {case S_IFREG : inode->i_fop = &efivarfs_file_operations;
@@ -102,22 +104,17 @@ static void efivarfs_hex_to_guid(const cstatic int efivarfs_create (struct inode *dir,struct dentry *dentry,umode_t mode,bool excl) { -struct inode *inode; +struct inode *inode =NULL ;struct efivar_entry *var;int namelen, i =0 , err =0 ; +bool is_removable = false;if (!efivarfs_valid_name (dentry->d_name.name, dentry->d_name.len))return -EINVAL ; - inode =efivarfs_get_inode (dir->i_sb, dir, mode,0 ); -if (!inode) -return -ENOMEM ; - var =kzalloc (sizeof (struct efivar_entry ),GFP_KERNEL ); -if (!var) { - err = -ENOMEM ; - goto out; - } +if (!var) +return -ENOMEM ;/* length of the variable name itself: remove GUID and separator */ namelen = dentry->d_name.len -EFI_VARIABLE_GUID_LEN -1 ;
@@ -125,6 +122,16 @@ static int efivarfs_create(struct inodeefivarfs_hex_to_guid (dentry->d_name.name + namelen +1 , &var->var.VendorGuid); +if (efivar_variable_is_removable (var->var.VendorGuid, + dentry->d_name.name, namelen)) + is_removable = true; + + inode =efivarfs_get_inode (dir->i_sb, dir, mode,0 , is_removable); +if (!inode) { + err = -ENOMEM ; + goto out; + } +for (i =0 ; i < namelen; i++) var->var.VariableName[i] = dentry->d_name.name[i];
@@ -138,7 +145,8 @@ static int efivarfs_create(struct inode out:if (err) {kfree (var); -iput (inode); +if (inode) +iput (inode); }return err; }
fs/efivarfs/internal.h +2 -1
@@ -15,7 +15,8 @@ extern const struct file_operations efivextern const struct inode_operations efivarfs_dir_inode_operations;extern bool efivarfs_valid_name (const char *str,int len);extern struct inode *efivarfs_get_inode (struct super_block *sb, -const struct inode *dir,int mode,dev_t dev); +const struct inode *dir,int mode,dev_t dev, +bool is_removable);extern struct list_head efivarfs_list;
fs/efivarfs/super.c +7 -2
@@ -120,6 +120,7 @@ static int efivarfs_callback(efi_char16_char *name;int len;int err = -ENOMEM ; +bool is_removable = false; entry =kzalloc (sizeof (*entry),GFP_KERNEL );if (!entry)
@@ -137,13 +138,17 @@ static int efivarfs_callback(efi_char16_ucs2_as_utf8 (name, entry->var.VariableName, len); +if (efivar_variable_is_removable (entry->var.VendorGuid, name, len)) + is_removable = true; + name[len] ='-' ;efi_guid_to_str (&entry->var.VendorGuid, name + len +1 ); name[len +EFI_VARIABLE_GUID_LEN +1 ] ='\0' ; - inode =efivarfs_get_inode (sb,d_inode (root),S_IFREG |0644 ,0 ); + inode =efivarfs_get_inode (sb,d_inode (root),S_IFREG |0644 ,0 , + is_removable);if (!inode) goto fail_name;
@@ -199,7 +204,7 @@ static int efivarfs_fill_super(struct su sb->s_d_op = &efivarfs_d_ops; sb->s_time_gran =1 ; - inode =efivarfs_get_inode (sb,NULL ,S_IFDIR |0755 ,0 ); + inode =efivarfs_get_inode (sb,NULL ,S_IFDIR |0755 ,0 , true);if (!inode)return -ENOMEM ; inode->i_op = &efivarfs_dir_inode_operations;
include/linux/efi.h +2 -0
@@ -1201,6 +1201,8 @@ struct efivar_entry *efivar_entry_find(ebool efivar_validate (efi_guid_t vendor,efi_char16_t *var_name,u8 *data,unsigned long data_size); +bool efivar_variable_is_removable (efi_guid_t vendor,const char *name, +size_t len);extern struct work_struct efivar_work;void efivar_run_worker (void );
tools/testing/selftests/efivarfs/efivarfs.sh +16 -3
@@ -88,7 +88,11 @@ test_delete() exit 1 fi - rm $file + rm $file 2>/dev/null + if [ $? -ne 0 ]; then + chattr -i $file + rm $file + fi if [ -e $file ]; then echo "$file couldn't be deleted" >&2
@@ -111,6 +115,7 @@ test_zero_size_delete() exit 1 fi + chattr -i $file printf "$attrs" > $file if [ -e $file ]; then
@@ -141,7 +146,11 @@ test_valid_filenames() echo "$file could not be created" >&2 ret=1 else - rm $file + rm $file 2>/dev/null + if [ $? -ne 0 ]; then + chattr -i $file + rm $file + fi fi done
@@ -174,7 +183,11 @@ test_invalid_filenames() if [ -e $file ]; then echo "Creating $file should have failed" >&2 - rm $file + rm $file 2>/dev/null + if [ $? -ne 0 ]; then + chattr -i $file + rm $file + fi ret=1 fi done
tools/testing/selftests/efivarfs/open-unlink.c +71 -1
94 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 60/342 efi: Add pstore variables to the deletion whitelist
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit e246eb568bc4cbbdd8a30a3c11151ff9b7ca7312 upstream.
Laszlo explains why this is a good idea,
'This is because the pstore filesystem can be backed by UEFI variables,
and (for example) a crash might dump the last kilobytes of the dmesg into a number of pstore entries, each entry backed by a separate UEFI variable in the above GUID namespace, and with a variable name according to the above pattern.
Please see "drivers/firmware/efi/efi-pstore.c".
While this patch series will not prevent the user from deleting those UEFI variables via the pstore filesystem (i.e., deleting a pstore fs entry will continue to delete the backing UEFI variable), I think it would be nice to preserve the possibility for the sysadmin to delete Linux-created UEFI variables that carry portions of the crash log, *without* having to mount the pstore filesystem.'
There's also no chance of causing machines to become bricked by deleting these variables, which is the whole purpose of excluding things from the whitelist.
Use the LINUX_EFI_CRASH_GUID guid and a wildcard '*' for the match so that we don't have to update the string in the future if new variable name formats are created for crash dump variables.
--- drivers/firmware/efi/vars.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/efi/vars.c +1 -0
@@ -198,6 +198,7 @@ static const struct variable_validate va { EFI_GLOBAL_VARIABLE_GUID, "OsIndications", NULL }, { EFI_GLOBAL_VARIABLE_GUID, "PlatformLang", validate_ascii_string }, { EFI_GLOBAL_VARIABLE_GUID, "Timeout", validate_uint16 }, + { LINUX_EFI_CRASH_GUID, "*", NULL }, { NULL_GUID, "", NULL }, };
Greg Kroah-Hartman
maintainerPATCH 61/342 lib/ucs2_string: Correct ucs2 -> utf8 conversion
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Andryuk <[email protected]>
commit a68075908a37850918ad96b056acc9ac4ce1bd90 upstream.
The comparisons should be >= since 0x800 and 0x80 require an additional bit to store.
For the 3 byte case, the existing shift would drop off 2 more bits than intended.
For the 2 byte case, there should be 5 bits bits in byte 1, and 6 bits in byte 2.
--- lib/ucs2_string.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
lib/ucs2_string.c +7 -7
@@ -59,9 +59,9 @@ ucs2_utf8size(const ucs2_char_t *src)for (i =0 ; i <ucs2_strlen (src); i++) {u16 c = src[i]; -if (c >0x800 ) +if (c >=0x800 ) j +=3 ; -else if (c >0x80 ) +else if (c >=0x80 ) j +=2 ;else j +=1 ;
@@ -88,19 +88,19 @@ ucs2_as_utf8(u8 *dest, const ucs2_char_tfor (i =0 ; maxlength && i < limit; i++) {u16 c = src[i]; -if (c >0x800 ) { +if (c >=0x800 ) {if (maxlength <3 )break ; maxlength -=3 ; dest[j++] =0xe0 | (c &0xf000 ) >>12 ; - dest[j++] =0x80 | (c &0x0fc0 ) >>8 ; + dest[j++] =0x80 | (c &0x0fc0 ) >>6 ; dest[j++] =0x80 | (c &0x003f ); - }else if (c >0x80 ) { + }else if (c >=0x80 ) {if (maxlength <2 )break ; maxlength -=2 ; - dest[j++] =0xc0 | (c &0xfe0 ) >>5 ; - dest[j++] =0x80 | (c &0x01f ); + dest[j++] =0xc0 | (c &0x7c0 ) >>6 ; + dest[j++] =0x80 | (c &0x03f ); }else { maxlength -=1 ; dest[j++] = c &0x7f ;
Greg Kroah-Hartman
maintainerPATCH 62/342 bcache: fix a livelock when we cause a huge number of cache misses
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Liu <[email protected]>
commit 2ef9ccbfcb90cf84bdba320a571b18b05c41101b upstream.
Subject : [PATCH v2] bcache: fix a livelock in btree lock
Date : Wed, 25 Feb 2015 20:32:09 +0800 (02/25/2015 04:32:09 AM)
This commit tries to fix a livelock in bcache. This livelock might happen when we causes a huge number of cache misses simultaneously.
When we get a cache miss, bcache will execute the following path.
->cached_dev_make_request()
->cached_dev_read()
->cached_lookup()
->bch->btree_map_keys()
->btree_root() <------------------------
->bch_btree_map_keys_recurse() |
->cache_lookup_fn() |
->cached_dev_cache_miss() |
->bch_btree_insert_check_key() -|
[If btree->seq is not equal to seq + 1, we should return
EINTR and traverse btree again.]In bch_btree_insert_check_key() function we first need to check upgrade flag (op->lock == -1), and when this flag is true we need to release read btree->lock and try to take write btree->lock. During taking and releasing this write lock, btree->seq will be monotone increased in order to prevent other threads modify this in cache miss (see btree.h:74). But if there are some cache misses caused by some requested, we could meet a livelock because btree->seq is always changed by others. Thus no one can make progress.
This commit will try to take write btree->lock if it encounters a race when we traverse btree. Although it sacrifice the scalability but we can ensure that only one can modify the btree.
--- drivers/md/bcache/btree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/btree.c +3 -1
@@ -2162,8 +2162,10 @@ int bch_btree_insert_check_key(struct btrw_lock (true, b, b->level);if (b->key.ptr[0 ] != btree_ptr || - b->seq != seq +1 ) + b->seq != seq +1 ) { + op->lock = b->level; goto out; + } }SET_KEY_PTRS (check_key,1 );
Greg Kroah-Hartman
maintainerPATCH 63/342 bcache: Add a cond_resched() call to gc
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <[email protected]>
commit c5f1e5adf956e3ba82d204c7c141a75da9fa449a upstream.
--- drivers/md/bcache/btree.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/bcache/btree.c +1 -0
@@ -1741,6 +1741,7 @@ static void bch_btree_gc(struct cache_se do { ret = btree_root(gc_root, c, &op, &writes, &stats); closure_sync(&writes); + cond_resched(); if (ret && ret != -EAGAIN) pr_warn("gc failed!");
Greg Kroah-Hartman
maintainerPATCH 64/342 bcache: clear BCACHE_DEV_UNLINK_DONE flag when attaching a backing device
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Liu <[email protected]>
commit fecaee6f20ee122ad75402c53d8278f9bb142ddc upstream.
This bug can be reproduced by the following script:
#!/bin/bash
bcache_sysfs="/sys/fs/bcache"
function clear_cache()
{
if [ ! -e $bcache_sysfs ]; then
echo "no bcache sysfs"
exit
fi
cset_uuid=$(ls -l $bcache_sysfs|head -n 2|tail -n 1|awk '{print $9}')
sudo sh -c "echo $cset_uuid > /sys/block/sdb/sdb1/bcache/detach"
sleep 5
sudo sh -c "echo $cset_uuid > /sys/block/sdb/sdb1/bcache/attach"
} for ((i=0;i<10;i++)); do
clear_cache
done
The warning messages look like below:
[ 275.948611] ------------[ cut here ]------------ [ 275.963840] WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xb8/0xd0() (Tainted: P W --------------- ) [ 275.979253] Hardware name: Tecal RH2285 [ 275.994106] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:09.0/0000:08:00.0/host4/target4:2:1/4:2:1:0/block/sdb/sdb1/bcache/cache' [ 276.024105] Modules linked in: bcache tcp_diag inet_diag ipmi_devintf ipmi_si ipmi_msghandler bonding 8021q garp stp llc ipv6 ext3 jbd loop sg iomemory_vsl(P) bnx2 microcode serio_raw i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support i7core_edac edac_core shpchp ext4 jbd2 mbcache megaraid_sas pata_acpi ata_generic ata_piix dm_mod [last unloaded: scsi_wait_scan] [ 276.072643] Pid: 2765, comm: sh Tainted: P W --------------- 2.6.32 #1 [ 276.089315] Call Trace: [ 276.105801] [<ffffffff81070fe7>] ? warn_slowpath_common+0x87/0xc0 [ 276.122650] [<ffffffff810710d6>] ? warn_slowpath_fmt+0x46/0x50 [ 276.139361] [<ffffffff81205c08>] ? sysfs_add_one+0xb8/0xd0 [ 276.156012] [<ffffffff8120609b>] ? sysfs_do_create_link+0x12b/0x170 [ 276.172682] [<ffffffff81206113>] ? sysfs_create_link+0x13/0x20 [ 276.189282] [<ffffffffa03bda21>] ? bcache_device_link+0xc1/0x110 [bcache] [ 276.205993] [<ffffffffa03bfa08>] ? bch_cached_dev_attach+0x478/0x4f0 [bcache] [ 276.222794] [<ffffffffa03c4a17>] ? bch_cached_dev_store+0x627/0x780 [bcache] [ 276.239680] [<ffffffff8116783a>] ? alloc_pages_current+0xaa/0x110 [ 276.256594] [<ffffffff81203b15>] ? sysfs_write_file+0xe5/0x170 [ 276.273364] [<ffffffff811887b8>] ? vfs_write+0xb8/0x1a0 [ 276.290133] [<ffffffff811890b1>] ? sys_write+0x51/0x90 [ 276.306368] [<ffffffff8100c072>] ? system_call_fastpath+0x16/0x1b [ 276.322301] ---[ end trace 9f5d4fcdd0c3edfb ]--- [ 276.338241] ------------[ cut here ]------------ [ 276.354109] WARNING: at /home/wenqing.lz/bcache/bcache/super.c:720 bcache_device_link+0xdf/0x110 [bcache]() (Tainted: P W --------------- ) [ 276.386017] Hardware name: Tecal RH2285 [ 276.401430] Couldn't create device <-> cache set symlinks [ 276.401759] Modules linked in: bcache tcp_diag inet_diag ipmi_devintf ipmi_si ipmi_msghandler bonding 8021q garp stp llc ipv6 ext3 jbd loop sg iomemory_vsl(P) bnx2 microcode serio_raw i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support i7core_edac edac_core shpchp ext4 jbd2 mbcache megaraid_sas pata_acpi ata_generic ata_piix dm_mod [last unloaded: scsi_wait_scan] [ 276.465477] Pid: 2765, comm: sh Tainted: P W --------------- 2.6.32 #1 [ 276.482169] Call Trace: [ 276.498610] [<ffffffff81070fe7>] ? warn_slowpath_common+0x87/0xc0 [ 276.515405] [<ffffffff810710d6>] ? warn_slowpath_fmt+0x46/0x50 [ 276.532059] [<ffffffffa03bda3f>] ? bcache_device_link+0xdf/0x110 [bcache] [ 276.548808] [<ffffffffa03bfa08>] ? bch_cached_dev_attach+0x478/0x4f0 [bcache] [ 276.565569] [<ffffffffa03c4a17>] ? bch_cached_dev_store+0x627/0x780 [bcache] [ 276.582418] [<ffffffff8116783a>] ? alloc_pages_current+0xaa/0x110 [ 276.599341] [<ffffffff81203b15>] ? sysfs_write_file+0xe5/0x170 [ 276.616142] [<ffffffff811887b8>] ? vfs_write+0xb8/0x1a0 [ 276.632607] [<ffffffff811890b1>] ? sys_write+0x51/0x90 [ 276.648671] [<ffffffff8100c072>] ? system_call_fastpath+0x16/0x1b [ 276.664756] ---[ end trace 9f5d4fcdd0c3edfc ]---
We forget to clear BCACHE_DEV_UNLINK_DONE flag in bcache_device_attach() function when we attach a backing device first time. After detaching this backing device, this flag will be true and sysfs_remove_link() isn't called in bcache_device_unlink(). Then when we attach this backing device again, sysfs_create_link() will return EEXIST error in bcache_device_link().
So the fix is trival and we clear this flag in bcache_device_link().
--- drivers/md/bcache/super.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/bcache/super.c +2 -0
@@ -685,6 +685,8 @@ static void bcache_device_link(struct bcWARN (sysfs_create_link (&d->kobj, &c->kobj,"cache" ) ||sysfs_create_link (&c->kobj, &d->kobj, d->name),"Couldn't create device <-> cache set symlinks" ); + +clear_bit (BCACHE_DEV_UNLINK_DONE , &d->flags); }static void bcache_device_detach (struct bcache_device *d)
Greg Kroah-Hartman
maintainerPATCH 65/342 bcache: fix a leak in bch_cached_dev_run()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 4d4d8573a8451acc9f01cbea24b7e55f04a252fe upstream.
--- drivers/md/bcache/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +4 -1
@@ -849,8 +849,11 @@ void bch_cached_dev_run(struct cached_de buf[SB_LABEL_SIZE ] ='\0' ; env[2 ] =kasprintf (GFP_KERNEL ,"CACHED_LABEL=%s" , buf); -if (atomic_xchg (&dc->running,1 )) +if (atomic_xchg (&dc->running,1 )) { +kfree (env[1 ]); +kfree (env[2 ]);return ; + }if (!d->c &&BDEV_STATE (&dc->sb) !=BDEV_STATE_NONE ) {
Greg Kroah-Hartman
maintainerPATCH 66/342 bcache: unregister reboot notifier if bcache fails to unregister device
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Liu <[email protected]>
commit 2ecf0cdb2b437402110ab57546e02abfa68a716b upstream.
In bcache_init() function it forgot to unregister reboot notifier if bcache fails to unregister a block device. This commit fixes this.
--- drivers/md/bcache/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +3 -1
@@ -2071,8 +2071,10 @@ static int __init bcache_init(void)closure_debug_init (); bcache_major =register_blkdev (0 ,"bcache" ); -if (bcache_major <0 ) +if (bcache_major <0 ) { +unregister_reboot_notifier (&reboot);return bcache_major; + } if (!(bcache_wq = create_workqueue("bcache")) || !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
Greg Kroah-Hartman
maintainerPATCH 67/342 bcache: allows use of register in udev to avoid "device_busy" error.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel de Perthuis <[email protected]>
commit d7076f21629f8f329bca4a44dc408d94670f49e2 upstream.
Allows to use register, not register_quiet in udev to avoid "device_busy" error. The initial patch proposed at https://lkml.org/lkml/2013/8/26/549 by Gabriel de Perthuis <[email protected]> does not unlock the mutex and hangs the kernel.
See http://thread.gmane.org/gmane.linux.kernel.bcache.devel/2594 for the discussion.
--- drivers/md/bcache/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/bcache/super.c +3 -2
@@ -1938,6 +1938,8 @@ static ssize_t register_bcache(struct koelse err ="device busy" ;mutex_unlock (&bch_register_lock); +if (attr == &ksysfs_register_quiet) + goto out; } goto err; }
@@ -1976,8 +1978,7 @@ out: err_close:blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL ); err: -if (attr != &ksysfs_register_quiet) -pr_info ("error opening %s: %s" , path, err); +pr_info ("error opening %s: %s" , path, err); ret = -EINVAL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 68/342 bcache: prevent crash on changing writeback_running
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Bader <[email protected]>
commit 8d16ce540c94c9d366eb36fc91b7154d92d6397b upstream.
Added a safeguard in the shutdown case. At least while not being attached it is also possible to trigger a kernel bug by writing into writeback_running. This change adds the same check before trying to wake up the thread for that case.
--- drivers/md/bcache/writeback.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/writeback.h +2 -1
@@ -63,7 +63,8 @@ static inline bool should_writeback(strustatic inline void bch_writeback_queue (struct cached_dev *dc) { -wake_up_process (dc->writeback_thread); +if (!IS_ERR_OR_NULL (dc->writeback_thread)) +wake_up_process (dc->writeback_thread); }static inline void bch_writeback_add (struct cached_dev *dc)
Greg Kroah-Hartman
maintainerPATCH 69/342 bcache: Change refill_dirty() to always scan entire disk if necessary
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <[email protected]>
commit 627ccd20b4ad3ba836472468208e2ac4dfadbf03 upstream.
Previously, it would only scan the entire disk if it was starting from the very start of the disk - i.e. if the previous scan got to the end.
This was broken by refill_full_stripes(), which updates last_scanned so that refill_dirty was never triggering the searched_from_start path.
But if we change refill_dirty() to always scan the entire disk if necessary, regardless of what last_scanned was, the code gets cleaner and we fix that bug too.
--- drivers/md/bcache/writeback.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
drivers/md/bcache/writeback.c +30 -7
@@ -323,6 +323,10 @@ void bcache_dev_sectors_dirty_add(structstatic bool dirty_pred (struct keybuf *buf,struct bkey *k) { + struct cached_dev *dc = container_of(buf, struct cached_dev, writeback_keys); + +BUG_ON (KEY_INODE (k) != dc->disk.id); +return KEY_DIRTY (k); }
@@ -372,11 +376,24 @@ next: } } +/* +* Returns true if we scanned the entire disk +*/ static bool refill_dirty (struct cached_dev *dc) {struct keybuf *buf = &dc->writeback_keys; +struct bkey start =KEY (dc->disk.id,0 ,0 );struct bkey end =KEY (dc->disk.id,MAX_KEY_OFFSET ,0 ); -bool searched_from_start = false; +struct bkey start_pos; + +/* +* make sure keybuf pos is inside the range for this disk - at bringup +* we might not be attached yet so this disk's inode nr isn't +* initialized then +*/ +if (bkey_cmp (&buf->last_scanned, &start) <0 || +bkey_cmp (&buf->last_scanned, &end) >0 ) + buf->last_scanned = start;if (dc->partial_stripes_expensive) {refill_full_stripes (dc);
@@ -384,14 +401,20 @@ static bool refill_dirty(struct cached_dreturn false; } -if (bkey_cmp (&buf->last_scanned, &end) >=0 ) { - buf->last_scanned =KEY (dc->disk.id,0 ,0 ); - searched_from_start = true; - } - + start_pos = buf->last_scanned;bch_refill_keybuf (dc->disk.c, buf, &end, dirty_pred); -return bkey_cmp (&buf->last_scanned, &end) >=0 && searched_from_start; +if (bkey_cmp (&buf->last_scanned, &end) <0 ) +return false; + +/* +* If we get to the end start scanning again from the beginning, and +* only scan up to where we initially started scanning from: +*/ + buf->last_scanned = start; +bch_refill_keybuf (dc->disk.c, buf, &start_pos, dirty_pred); + +return bkey_cmp (&buf->last_scanned, &start_pos) >=0 ; }static int bch_writeback_thread (void *arg)
Greg Kroah-Hartman
maintainerPATCH 70/342 dm thin: fix race condition when destroying thin pool workqueue
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit 18d03e8c25f173f4107a40d0b8c24defb6ed69f3 upstream.
When a thin pool is being destroyed delayed work items are cancelled using cancel_delayed_work(), which doesn't guarantee that on return the delayed item isn't running. This can cause the work item to requeue itself on an already destroyed workqueue. Fix this by using cancel_delayed_work_sync() which guarantees that on return the work item is not running anymore.
--- drivers/md/dm-thin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-thin.c +2 -2
@@ -3453,8 +3453,8 @@ static void pool_postsuspend(struct dm_tstruct pool_c *pt = ti->private;struct pool *pool = pt->pool; -cancel_delayed_work (&pool->waker); -cancel_delayed_work (&pool->no_space_timeout); +cancel_delayed_work_sync (&pool->waker); +cancel_delayed_work_sync (&pool->no_space_timeout);flush_workqueue (pool->wq); (void )commit (pool); }
Greg Kroah-Hartman
maintainerPATCH 71/342 can: ems_usb: Fix possible tx overflow
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerhard Uttenthaler <[email protected]>
commit 90cfde46586d2286488d8ed636929e936c0c9ab2 upstream.
This patch fixes the problem that more CAN messages could be sent to the interface as could be send on the CAN bus. This was more likely for slow baud rates. The sleeping _start_xmit was woken up in the _write_bulk_callback. Under heavy TX load this produced another bulk transfer without checking the free_slots variable and hence caused the overflow in the interface.
--- drivers/net/can/usb/ems_usb.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/can/usb/ems_usb.c +10 -4
@@ -117,6 +117,9 @@ MODULE_LICENSE("GPL v2");*/ #define EMS_USB_ARM7_CLOCK 8000000 +#define CPC_TX_QUEUE_TRIGGER_LOW 25 +#define CPC_TX_QUEUE_TRIGGER_HIGH 35 +/* * CAN-Message representation in a CPC_MSG. Message object type is * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
@@ -278,6 +281,11 @@ static void ems_usb_read_interrupt_callbswitch (urb->status) {case 0 : dev->free_slots = dev->intr_in_buffer[1 ]; +if (dev->free_slots >CPC_TX_QUEUE_TRIGGER_HIGH ){ +if (netif_queue_stopped (netdev)){ +netif_wake_queue (netdev); + } + }break ;case -ECONNRESET :/* unlink */
@@ -526,8 +534,6 @@ static void ems_usb_write_bulk_callback(/* Release context */ context->echo_index =MAX_TX_URBS ; -if (netif_queue_stopped (netdev)) -netif_wake_queue (netdev); }/*
@@ -587,7 +593,7 @@ static int ems_usb_start(struct ems_usbint err, i; dev->intr_in_buffer[0 ] =0 ; - dev->free_slots =15 ;/* initial size */ + dev->free_slots =50 ;/* initial size */ for (i =0 ; i <MAX_RX_URBS ; i++) {struct urb *urb =NULL ;
@@ -835,7 +841,7 @@ static netdev_tx_t ems_usb_start_xmit(st/* Slow down tx path */ if (atomic_read (&dev->active_tx_urbs) >=MAX_TX_URBS || - dev->free_slots <5 ) { + dev->free_slots <CPC_TX_QUEUE_TRIGGER_LOW ) {netif_stop_queue (netdev); } }
Greg Kroah-Hartman
maintainerPATCH 72/342 usb: dwc3: Fix assignment of EP transfer resources
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit c450960187f45d4260db87c7dd4fc0bceb5565d8 upstream.
The assignement of EP transfer resources was not handled properly in the dwc3 driver. Commit aebda6187181 ("usb: dwc3: Reset the transfer resource index on SET_INTERFACE") previously fixed one aspect of this where resources may be exhausted with multiple calls to SET_INTERFACE. However, it introduced an issue where composite devices with multiple interfaces can be assigned the same transfer resources for different endpoints. This patch solves both issues.
The assignment of transfer resources cannot perfectly follow the data book due to the fact that the controller driver does not have all knowledge of the configuration in advance. It is given this information piecemeal by the composite gadget framework after every SET_CONFIGURATION and SET_INTERFACE. Trying to follow the databook programming model in this scenario can cause errors. For two reasons:
1) The databook says to do DEPSTARTCFG for every SET_CONFIGURATION and SET_INTERFACE (8.1.5). This is incorrect in the scenario of multiple interfaces.
2) The databook does not mention doing more DEPXFERCFG for new endpoint on alt setting (8.1.6).
The following simplified method is used instead:
All hardware endpoints can be assigned a transfer resource and this setting will stay persistent until either a core reset or hibernation. So whenever we do a DEPSTARTCFG(0) we can go ahead and do DEPXFERCFG for every hardware endpoint as well. We are guaranteed that there are as many transfer resources as endpoints.
This patch triggers off of the calling dwc3_gadget_start_config() for EP0-out, which always happens first, and which should only happen in one of the above conditions.
--- drivers/usb/dwc3/core.h | 1 drivers/usb/dwc3/ep0.c | 5 --- drivers/usb/dwc3/gadget.c | 70 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 52 insertions(+), 24 deletions(-)
drivers/usb/dwc3/core.h +0 -1
@@ -853,7 +853,6 @@ struct dwc3 { unsigned pullups_connected:1; unsigned resize_fifos:1; unsigned setup_packet_pending:1; - unsigned start_config_issued:1; unsigned three_stage_setup:1; unsigned usb3_lpm_capable:1;
drivers/usb/dwc3/ep0.c +0 -5
@@ -555,7 +555,6 @@ static int dwc3_ep0_set_config(struct dwint ret;u32 reg; - dwc->start_config_issued = false; cfg =le16_to_cpu (ctrl->wValue);switch (state) {
@@ -737,10 +736,6 @@ static int dwc3_ep0_std_request(struct ddwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_ISOCH_DELAY" ); ret =dwc3_ep0_set_isoch_delay (dwc, ctrl);break ; -case USB_REQ_SET_INTERFACE : -dwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_INTERFACE" ); - dwc->start_config_issued = false; -/* Fall through */ default :dwc3_trace (trace_dwc3_ep0,"Forwarding to gadget driver" ); ret =dwc3_ep0_delegate_req (dwc, ctrl);
drivers/usb/dwc3/gadget.c +52 -18
108 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 73/342 USB: cp210x: add IDs for GE B650V3 and B850V3 boards
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ken Lin <[email protected]>
commit 6627ae19385283b89356a199d7f03c75ba35fb29 upstream.
Add USB ID for cp2104/5 devices on GE B650v3 and B850v3 boards.
--- drivers/usb/serial/cp210x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/cp210x.c +2 -0
@@ -162,6 +162,8 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ + { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ + { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */
Greg Kroah-Hartman
maintainerPATCH 74/342 USB: option: add support for SIM7100E
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Skvortsov <[email protected]>
commit 3158a8d416f4e1b79dcc867d67cb50013140772c upstream.
$ lsusb: Bus 001 Device 101: ID 1e0e:9001 Qualcomm / Option
$ usb-devices: T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=101 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 2 P: Vendor=1e0e ProdID=9001 Rev= 2.32 S: Manufacturer=SimTech, Incorporated S: Product=SimTech, Incorporated S: SerialNumber=0123456789ABCDEF C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
The last interface (6) is used for Android Composite ADB interface.
Serial port layout:
0: QCDM/DIAG
1: NMEA
2: AT
3: AT/PPP
4: audio
--- drivers/usb/serial/option.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/serial/option.c +7 -0
@@ -315,6 +315,7 @@ static void option_instat_callback(struc#define TOSHIBA_PRODUCT_G450 0x0d45#define ALINK_VENDOR_ID 0x1e0e +#define SIMCOM_PRODUCT_SIM7100E 0x9001/* Yes, ALINK_VENDOR_ID */ #define ALINK_PRODUCT_PH300 0x9100#define ALINK_PRODUCT_3GU 0x9200
@@ -607,6 +608,10 @@ static const struct option_blacklist_inf .reserved = BIT(3) | BIT(4), }; +static const struct option_blacklist_info simcom_sim7100e_blacklist = { + .reserved =BIT (5 ) |BIT (6 ), +}; +static const struct option_blacklist_info telit_le910_blacklist = { .sendsetup =BIT (0 ), .reserved =BIT (1 ) |BIT (2 ),
@@ -1645,6 +1650,8 @@ static const struct usb_device_id option { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) }, { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, + { USB_DEVICE(ALINK_VENDOR_ID, SIMCOM_PRODUCT_SIM7100E), + .driver_info = (kernel_ulong_t)&simcom_sim7100e_blacklist }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist },
Greg Kroah-Hartman
maintainerPATCH 75/342 USB: option: add "4G LTE usb-modem U901"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit d061c1caa31d4d9792cfe48a2c6b309a0e01ef46 upstream.
Thomas reports:
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=05c6 ProdID=6001 Rev=00.00 S: Manufacturer=USB Modem S: Product=USB Modem S: SerialNumber=1234567890ABCDEF C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -1127,6 +1127,8 @@ static const struct usb_device_id option { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ + { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, 0x6001, 0xff, 0xff, 0xff), /* 4G LTE usb-modem U901 */ + .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
Greg Kroah-Hartman
maintainerPATCH 76/342 drivers: android: correct the size of struct binder_uintptr_t for BC_DEAD_BINDER_DONE
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lisa Du <[email protected]>
commit 7a64cd887fdb97f074c3fda03bee0bfb9faceac3 upstream.
There's one point was missed in the patch commit da49889deb34 ("staging:
binder: Support concurrent 32 bit and 64 bit processes."). When configure BINDER_IPC_32BIT, the size of binder_uintptr_t was 32bits, but size of void * is 64bit on 64bit system. Correct it here.
--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -1
@@ -2074,7 +2074,7 @@ static int binder_thread_write(struct biif (get_user (cookie, (binder_uintptr_t __user *)ptr))return -EFAULT ; - ptr +=sizeof (void *); + ptr +=sizeof (cookie);list_for_each_entry (w, &proc->delivered_death, entry) { struct binder_ref_death *tmp_death = container_of(w, struct binder_ref_death, work);
Greg Kroah-Hartman
maintainerPATCH 77/342 spi: omap2-mcspi: Prevent duplicate gpio_request
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Welling <[email protected]>
commit 2f538c017e1a8620d19553931199c6d6a6d31bb2 upstream.
Occasionally the setup function will be called multiple times. Only request the gpio the first time otherwise -EBUSY will occur on subsequent calls to setup.
--- drivers/spi/spi-omap2-mcspi.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/spi/spi-omap2-mcspi.c +10 -9
@@ -1024,6 +1024,16 @@ static int omap2_mcspi_setup(struct spi_ spi->controller_state = cs;/* Link this to context save list */ list_add_tail (&cs->node, &ctx->cs); + +if (gpio_is_valid (spi->cs_gpio)) { + ret =gpio_request (spi->cs_gpio,dev_name (&spi->dev)); +if (ret) { +dev_err (&spi->dev,"failed to request gpio\n" ); +return ret; + } +gpio_direction_output (spi->cs_gpio, + !(spi->mode &SPI_CS_HIGH )); + } }if (!mcspi_dma->dma_rx || !mcspi_dma->dma_tx) {
@@ -1032,15 +1042,6 @@ static int omap2_mcspi_setup(struct spi_return ret; } -if (gpio_is_valid (spi->cs_gpio)) { - ret =gpio_request (spi->cs_gpio,dev_name (&spi->dev)); -if (ret) { -dev_err (&spi->dev,"failed to request gpio\n" ); -return ret; - } -gpio_direction_output (spi->cs_gpio, !(spi->mode &SPI_CS_HIGH )); - } - ret =pm_runtime_get_sync (mcspi->dev);if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 78/342 iw_cxgb3: Fix incorrectly returning error on success
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hariprasad S <[email protected]>
commit 67f1aee6f45059fd6b0f5b0ecb2c97ad0451f6b3 upstream.
The cxgb3_*_send() functions return NET_XMIT_ values, which are positive integers values. So don't treat positive return values as an error.
--- drivers/infiniband/hw/cxgb3/iwch_cm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_cm.c +2 -2
@@ -149,7 +149,7 @@ static int iwch_l2t_send(struct t3cdev * error =l2t_send (tdev, skb, l2e);if (error <0 )kfree_skb (skb); -return error; +return error <0 ? error :0 ; }int iwch_cxgb3_ofld_send (struct t3cdev *tdev,struct sk_buff *skb)
@@ -165,7 +165,7 @@ int iwch_cxgb3_ofld_send(struct t3cdev * error =cxgb3_ofld_send (tdev, skb);if (error <0 )kfree_skb (skb); -return error; +return error <0 ? error :0 ; }static void release_tid (struct t3cdev *tdev,u32 hwtid,struct sk_buff *skb)
Greg Kroah-Hartman
maintainerPATCH 79/342 drm/i915: shut up gen8+ SDE irq dmesg noise
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 97e5ed1111dcc5300a0f59a55248cd243937a8ab upstream.
We get tons of cases where the master interrupt handler apparently set a bit, with the SDEIIR disagreeing. No idea what's going on there, but it's consistent on gen8+, no one seems to care about it and it's making CI results flaky.
Shut it up.
No idea what's going on here, but we've had fun with PCH interrupts before:
commit 44498aea293b37af1d463acd9658cdce1ecdf427
Author: Paulo Zanoni <[email protected]> Date: Fri Feb 22 17:05:28 2013 -0300
drm/i915: also disable south interrupts when handling them
Note that there's a regression report in Bugzilla, and other regression reports on the mailing lists keep croping up. But no ill effects have ever been reported. But for paranoia still keep the message at a debug level as a breadcrumb, just in case.
This message was introduced in
commit 38cc46d73ed99dd7002f1406002e52d7975d16cc
Author: Oscar Mateo <[email protected]> Date: Mon Jun 16 16:10:59 2014 +0100
drm/i915/bdw: Ack interrupts before handling them (GEN8)
v2: Improve commit message a bit.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92084
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80896
--- drivers/gpu/drm/i915/i915_irq.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +7 -3
@@ -2354,9 +2354,13 @@ static irqreturn_t gen8_irq_handler(intspt_irq_handler (dev, pch_iir); elsecpt_irq_handler (dev ,pch_iir ); - }else -DRM_ERROR ("The master control interrupt lied (SDE)!\n" ); - + }else { +/* +* Like on previous PCH there seems to be something +* fishy going on with forwarding PCH interrupts. +*/ +DRM_DEBUG_DRIVER ("The master control interrupt lied (SDE)!\n" ); + } }I915_WRITE_FW (GEN8_MASTER_IRQ ,GEN8_MASTER_IRQ_CONTROL );
Greg Kroah-Hartman
maintainerPATCH 80/342 ocfs2: unlock inode if deleting inode from orphan fails
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guozhonghua <[email protected]>
commit a4a8481ff68a8a324a878e281bc37f18665224f7 upstream.
When doing append direct io cleanup, if deleting inode fails, it goes out without unlocking inode, which will cause the inode deadlock.
This issue was introduced by commit cf1776a9e834 ("ocfs2: fix a tiny race when truncate dio orohaned entry").
--- fs/ocfs2/aops.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/aops.c +1 -0
@@ -956,6 +956,7 @@ clean_orphan: tmp_ret =ocfs2_del_inode_from_orphan (osb, inode, di_bh, update_isize, end);if (tmp_ret <0 ) { +ocfs2_inode_unlock (inode,1 ); ret = tmp_ret;mlog_errno (ret);brelse (di_bh);
Greg Kroah-Hartman
maintainerPATCH 81/342 mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit ad33bb04b2a6cee6c1f99fabb15cddbf93ff0433 upstream.
pmd_trans_unstable()/pmd_none_or_trans_huge_or_clear_bad() were introduced to locklessy (but atomically) detect when a pmd is a regular (stable) pmd or when the pmd is unstable and can infinitely transition from pmd_none() and pmd_trans_huge() from under us, while only holding the mmap_sem for reading (for writing not).
While holding the mmap_sem only for reading, MADV_DONTNEED can run from under us and so before we can assume the pmd to be a regular stable pmd we need to compare it against pmd_none() and pmd_trans_huge() in an atomic way, with pmd_trans_unstable(). The old pmd_trans_huge() left a tiny window for a race.
Useful applications are unlikely to notice the difference as doing MADV_DONTNEED concurrently with a page fault would lead to undefined behavior.
--- mm/memory.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
mm/memory.c +12 -2
@@ -3399,8 +3399,18 @@ static int __handle_mm_fault(struct mm_sif (unlikely (pmd_none (*pmd)) &&unlikely (__pte_alloc (mm, vma, pmd, address)))return VM_FAULT_OOM ; -/* if an huge pmd materialized from under us just retry later */ -if (unlikely (pmd_trans_huge (*pmd))) +/* +* If a huge pmd materialized under us just retry later. Use +* pmd_trans_unstable() instead of pmd_trans_huge() to ensure the pmd +* didn't become pmd_trans_huge under us and then back to pmd_none, as +* a result of MADV_DONTNEED running immediately after a huge pmd fault +* in a different thread of this mm, in turn leading to a misleading +* pmd_trans_huge() retval. All we have to ensure is that it is a +* regular pmd that we can walk with pte_offset_map() and we can do that +* through an atomic read in C, which is what pmd_trans_unstable() +* provides. +*/ +if (unlikely (pmd_trans_unstable (pmd)))return 0 ;/* * A regular pmd is established and it can't morph into a huge pmd
Greg Kroah-Hartman
maintainerPATCH 82/342 mm: numa: quickly fail allocations for NUMA balancing on full nodes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
commit 8479eba7781fa9ffb28268840de6facfc12c35a7 upstream.
Commit 4167e9b2cf10 ("mm: remove GFP_THISNODE") removed the GFP_THISNODE flag combination due to confusing semantics. It noted that alloc_misplaced_dst_page() was one such user after changes made by commit e97ca8e5b864 ("mm: fix GFP_THISNODE callers and clarify").
Unfortunately when GFP_THISNODE was removed, users of alloc_misplaced_dst_page() started waking kswapd and entering direct reclaim because the wrong GFP flags are cleared. The consequence is that workloads that used to fit into memory now get reclaimed which is addressed by this patch.
The problem can be demonstrated with "mutilate" that exercises memcached which is software dedicated to memory object caching. The configuration uses 80% of memory and is run 3 times for varying numbers of clients. The results on a 4-socket NUMA box are
mutilate
4.4.0 4.4.0
vanilla numaswap-v1
Hmean 1 8394.71 ( 0.00%) 8395.32 ( 0.01%)
Hmean 4 30024.62 ( 0.00%) 34513.54 ( 14.95%)
Hmean 7 32821.08 ( 0.00%) 70542.96 (114.93%)
Hmean 12 55229.67 ( 0.00%) 93866.34 ( 69.96%)
Hmean 21 39438.96 ( 0.00%) 85749.21 (117.42%)
Hmean 30 37796.10 ( 0.00%) 50231.49 ( 32.90%)
Hmean 47 18070.91 ( 0.00%) 38530.13 (113.22%)The metric is queries/second with the more the better. The results are way outside of the noise and the reason for the improvement is obvious from some of the vmstats
4.4.0 4.4.0
vanillanumaswap-v1r1
Minor Faults 1929399272 2146148218
Major Faults 19746529 3567
Swap Ins 57307366 9913
Swap Outs 50623229 17094Allocation stalls 35909 443
DMA allocs 0 0
DMA32 allocs 72976349 170567396
Normal allocs 5306640898 5310651252
Movable allocs 0 0
Direct pages scanned 404130893 799577
Kswapd pages scanned 160230174 0
Kswapd pages reclaimed 55928786 0
Direct pages reclaimed 1843936 41921
Page writes file 2391 0
Page writes anon 50623229 17094
The vanilla kernel is swapping like crazy with large amounts of direct reclaim and kswapd activity. The figures are aggregate but it's known that the bad activity is throughout the entire test.
Note that simple streaming anon/file memory consumers also see this problem but it's not as obvious. In those cases, kswapd is awake when it should not be.
As there are at least two reclaim-related bugs out there, it's worth spelling out the user-visible impact. This patch only addresses bugs related to excessive reclaim on NUMA hardware when the working set is larger than a NUMA node. There is a bug related to high kswapd CPU usage but the reports are against laptops and other UMA hardware and is not addressed by this patch.
--- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/migrate.c +1 -1
@@ -1578,7 +1578,7 @@ static struct page *alloc_misplaced_dst_ (GFP_HIGHUSER_MOVABLE | __GFP_THISNODE | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) & - ~(__GFP_IO | __GFP_FS), 0); + ~__GFP_RECLAIM, 0);return newpage; }
Greg Kroah-Hartman
maintainerPATCH 83/342 genirq: Validate action before dereferencing it in handle_irq_event_percpu()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 570540d50710ed192e98e2f7f74578c9486b6b05 upstream.
commit 71f64340fc0e changed the handling of irq_desc->action from
CPU 0 CPU 1
free_irq() lock(desc)
lock(desc) handle_edge_irq()
if (desc->action) {
handle_irq_event()
action = desc->action
unlock(desc)
desc->action = NULL handle_irq_event_percpu(desc, action)
action->xxxto
CPU 0 CPU 1
free_irq() lock(desc)
lock(desc) handle_edge_irq()
if (desc->action) {
handle_irq_event()
unlock(desc)
desc->action = NULL handle_irq_event_percpu(desc, action)
action = desc->action
action->xxxSo if free_irq manages to set the action to NULL between the unlock and before the readout, we happily dereference a null pointer.
We could simply revert 71f64340fc0e, but we want to preserve the better code generation. A simple solution is to change the action loop from a do {} while to a while {} loop.
This is safe because we either see a valid desc->action or NULL. If the action is about to be removed it is still valid as free_irq() is blocked on synchronize_irq().
CPU 0 CPU 1
free_irq() lock(desc)
lock(desc) handle_edge_irq()
handle_irq_event(desc)
set(INPROGRESS)
unlock(desc)
handle_irq_event_percpu(desc)
action = desc->action
desc->action = NULL while (action) {
action->xxx
...
action = action->next; sychronize_irq()
while(INPROGRESS); lock(desc)
clr(INPROGRESS)
free(action)
That's basically the same mechanism as we have for shared interrupts. action->next can become NULL while handle_irq_event_percpu() runs. Either it sees the action or NULL. It does not matter, because action itself cannot go away before the interrupt in progress flag has been cleared.
--- kernel/irq/handle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/irq/handle.c +3 -2
@@ -138,7 +138,8 @@ irqreturn_t handle_irq_event_percpu(struunsigned int flags =0 , irq = desc->irq_data.irq;struct irqaction *action = desc->action; - do { +/* action might have become NULL since we dropped the lock */ +while (action) {irqreturn_t res;trace_irq_handler_entry (irq, action);
@@ -173,7 +174,7 @@ irqreturn_t handle_irq_event_percpu(stru retval |= res; action = action->next; - }while (action); + }add_interrupt_randomness (irq, flags);
Greg Kroah-Hartman
maintainerPATCH 84/342 clocksource/drivers/vt8500: Increase the minimum delta
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Volkov <[email protected]>
commit f9eccf24615672896dc13251410c3f2f33a14f95 upstream.
The vt8500 clocksource driver declares itself as capable to handle the minimum delay of 4 cycles by passing the value into clockevents_config_and_register(). The vt8500_timer_set_next_event() requires the passed cycles value to be at least 16. The impact is that userspace hangs in nanosleep() calls with small delay intervals.
This problem is reproducible in Linux 4.2 starting from:c6eb3f70d448 ('hrtimer: Get rid of hrtimer softirq')
Quoted 1 line
Quoted 1 line
From Russell King, more detailed explanation:
"It's a speciality of the StrongARM/PXA hardware. It takes a certain number of OSCR cycles for the value written to hit the compare registers. So, if a very small delta is written (eg, the compare register is written with a value of OSCR + 1), the OSCR will have incremented past this value before it hits the underlying hardware. The result is, that you end up waiting a very long time for the OSCR to wrap before the event fires.
So, we introduce a check in set_next_event() to detect this and return -ETIME if the calculated delta is too small, which causes the generic clockevents code to retry after adding the min_delta specified in clockevents_config_and_register() to the current time value.
min_delta must be sufficient that we don't re-trip the -ETIME check - if we do, we will return -ETIME, forward the next event time, try to set it, return -ETIME again, and basically lock the system up. So, min_delta must be larger than the check inside set_next_event(). A factor of two was chosen to ensure that this situation would never occur.
The PXA code worked on PXA systems for years, and I'd suggest no one changes this mechanism without access to a wide range of PXA systems, otherwise they're risking breakage."
--- drivers/clocksource/vt8500_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clocksource/vt8500_timer.c +4 -2
@@ -50,6 +50,8 @@#define msecs_to_loops (t) (loops_per_jiffy / 1000 * HZ * t) +#define MIN_OSCR_DELTA 16 +static void __iomem *regbase;static cycle_t vt8500_timer_read (struct clocksource *cs)
@@ -80,7 +82,7 @@ static int vt8500_timer_set_next_event(ucpu_relax ();writel ((unsigned long )alarm, regbase +TIMER_MATCH_VAL ); -if ((signed )(alarm - clocksource.read (&clocksource)) <=16 ) +if ((signed )(alarm - clocksource.read (&clocksource)) <=MIN_OSCR_DELTA )return -ETIME ;writel (1 , regbase +TIMER_IER_VAL );
@@ -151,7 +153,7 @@ static void __init vt8500_timer_init(strpr_err ("%s: setup_irq failed for %s\n" , __func__, clockevent.name);clockevents_config_and_register (&clockevent,VT8500_TIMER_HZ , -4 ,0xf0000000 ); +MIN_OSCR_DELTA *2 ,0xf0000000 ); }CLOCKSOURCE_OF_DECLARE (vt8500,"via,vt8500-timer" , vt8500_timer_init);
Greg Kroah-Hartman
maintainerPATCH 85/342 s390/kvm: remove dependency on struct save_area definition
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit d9a3a09af54d01ab8b0c320580f4f95328d4a7ac upstream.
Replace the offsets based on the struct area_area with the offset constants from asm-offsets.c based on the struct _lowcore.
--- arch/s390/kernel/asm-offsets.c | 1 + arch/s390/kvm/kvm-s390.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-)
arch/s390/kernel/asm-offsets.c +1 -0
@@ -181,6 +181,7 @@ int main(void)OFFSET (__LC_PSW_SAVE_AREA, _lowcore, psw_save_area);OFFSET (__LC_PREFIX_SAVE_AREA, _lowcore, prefixreg_save_area);OFFSET (__LC_FP_CREG_SAVE_AREA, _lowcore, fpt_creg_save_area); +OFFSET (__LC_TOD_PROGREG_SAVE_AREA, _lowcore, tod_progreg_save_area);OFFSET (__LC_CPU_TIMER_SAVE_AREA, _lowcore, cpu_timer_save_area);OFFSET (__LC_CLOCK_COMP_SAVE_AREA, _lowcore, clock_comp_save_area);OFFSET (__LC_AREGS_SAVE_AREA, _lowcore, access_regs_save_area);
arch/s390/kvm/kvm-s390.c +15 -15
@@ -2273,37 +2273,37 @@ int kvm_s390_store_status_unloaded(strucu64 clkcomp;int rc; + px =kvm_s390_get_prefix (vcpu);if (gpa ==KVM_S390_STORE_STATUS_NOADDR ) {if (write_guest_abs (vcpu,163 , &archmode,1 ))return -EFAULT ; - gpa =SAVE_AREA_BASE ; + gpa =0 ; }else if (gpa ==KVM_S390_STORE_STATUS_PREFIXED ) {if (write_guest_real (vcpu,163 , &archmode,1 ))return -EFAULT ; - gpa =kvm_s390_real_to_abs (vcpu,SAVE_AREA_BASE ); - } - rc =write_guest_abs (vcpu, gpa + offsetof(struct save_area , fp_regs), + gpa = px; + }else + gpa -= __LC_FPREGS_SAVE_AREA; + rc =write_guest_abs (vcpu, gpa + __LC_FPREGS_SAVE_AREA, vcpu->arch.guest_fpregs.fprs,128 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , gp_regs), + rc |=write_guest_abs (vcpu, gpa + __LC_GPREGS_SAVE_AREA, vcpu->run->s.regs.gprs,128 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , psw), + rc |=write_guest_abs (vcpu, gpa + __LC_PSW_SAVE_AREA, &vcpu->arch.sie_block->gpsw,16 ); - px =kvm_s390_get_prefix (vcpu); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , pref_reg), + rc |=write_guest_abs (vcpu, gpa + __LC_PREFIX_SAVE_AREA, &px,4 ); - rc |=write_guest_abs (vcpu, - gpa + offsetof(struct save_area , fp_ctrl_reg), + rc |=write_guest_abs (vcpu, gpa + __LC_FP_CREG_SAVE_AREA, &vcpu->arch.guest_fpregs.fpc,4 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , tod_reg), + rc |=write_guest_abs (vcpu, gpa + __LC_TOD_PROGREG_SAVE_AREA, &vcpu->arch.sie_block->todpr,4 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , timer), + rc |=write_guest_abs (vcpu, gpa + __LC_CPU_TIMER_SAVE_AREA, &vcpu->arch.sie_block->cputm,8 ); clkcomp = vcpu->arch.sie_block->ckc >>8 ; - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , clk_cmp), + rc |=write_guest_abs (vcpu, gpa + __LC_CLOCK_COMP_SAVE_AREA, &clkcomp,8 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , acc_regs), + rc |=write_guest_abs (vcpu, gpa + __LC_AREGS_SAVE_AREA, &vcpu->run->s.regs.acrs,64 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , ctrl_regs), + rc |=write_guest_abs (vcpu, gpa + __LC_CREGS_SAVE_AREA, &vcpu->arch.sie_block->gcr,128 );return rc ? -EFAULT :0 ; }
Greg Kroah-Hartman
maintainerPATCH 86/342 KVM: s390: fix memory overwrites when vx is disabled
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 9abc2a08a7d665b02bdde974fd6c44aae86e923e upstream.
The kernel now always uses vector registers when available, however KVM has special logic if support is really enabled for a guest. If support is disabled, guest_fpregs.fregs will only contain memory for the fpu. The kernel, however, will store vector registers into that area, resulting in crazy memory overwrites.
Simply extending that area is not enough, because the format of the registers also changes. We would have to do additional conversions, making the code even more complex. Therefore let's directly use one place for the vector/fpu registers + fpc (in kvm_run). We just have to convert the data properly when accessing it. This makes current code much easier.
Please note that vector/fpu registers are now always stored to vcpu->run->s.regs.vrs. Although this data is visible to QEMU and used for migration, we only guarantee valid values to user space when KVM_SYNC_VRS is set. As that is only the case when we have vector register support, we are on the safe side.
--- arch/s390/include/asm/kvm_host.h | 1 arch/s390/kvm/kvm-s390.c | 128 +++++++++++++-------------------------- 2 files changed, 43 insertions(+), 86 deletions(-)
arch/s390/include/asm/kvm_host.h +0 -1
@@ -506,7 +506,6 @@ struct kvm_vcpu_arch {struct kvm_s390_sie_block *sie_block;unsigned int host_acrs[NUM_ACRS ];struct fpu host_fpregs; -struct fpu guest_fpregs;struct kvm_s390_local_interrupt local_int;struct hrtimer ckc_timer;struct kvm_s390_pgm_info pgm;
arch/s390/kvm/kvm-s390.c +43 -85
209 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 87/342 Btrfs: add missing brelse when superblock checksum fails
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anand Jain <[email protected]>
commit b2acdddfad13c38a1e8b927d83c3cf321f63601a upstream.
Looks like oversight, call brelse() when checksum fails. Further down the code, in the non error path, we do call brelse() and so we don't see brelse() in the goto error paths.
--- fs/btrfs/disk-io.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/disk-io.c +1 -0
@@ -2667,6 +2667,7 @@ int open_ctree(struct super_block *sb,if (btrfs_check_super_csum (bh->b_data)) {printk (KERN_ERR "BTRFS: superblock checksum mismatch\n" ); err = -EINVAL ; +brelse (bh); goto fail_alloc; }
Greg Kroah-Hartman
maintainerPATCH 88/342 Btrfs: igrab inode in writepage
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit be7bd730841e69fe8f70120098596f648cd1f3ff upstream.
We hit this panic on a few of our boxes this week where we have an ordered_extent with an NULL inode. We do an igrab() of the inode in writepages, but weren't doing it in writepage which can be called directly from the VM on dirty pages. If the inode has been unlinked then we could have I_FREEING set which means igrab() would return NULL and we get this panic. Fix this by trying to igrab in btrfs_writepage, and if it returns NULL then just redirty the page and return AOP_WRITEPAGE_ACTIVATE; so the VM knows it wasn't successful. Thanks,
--- fs/btrfs/inode.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +15 -2
@@ -8548,15 +8548,28 @@ int btrfs_readpage(struct file *file, ststatic int btrfs_writepage (struct page *page,struct writeback_control *wbc) {struct extent_io_tree *tree; - +struct inode *inode = page->mapping->host; +int ret;if (current->flags &PF_MEMALLOC ) {redirty_page_for_writepage (wbc, page);unlock_page (page);return 0 ; } + +/* +* If we are under memory pressure we will call this directly from the +* VM, we need to make sure we have the inode referenced for the ordered +* extent. If not just return like we didn't do anything. +*/ +if (!igrab (inode)) { +redirty_page_for_writepage (wbc, page); +return AOP_WRITEPAGE_ACTIVATE ; + } tree = &BTRFS_I (page->mapping->host)->io_tree; -return extent_write_full_page (tree, page, btrfs_get_extent, wbc); + ret =extent_write_full_page (tree, page, btrfs_get_extent, wbc); +btrfs_add_delayed_iput (inode); +return ret; } static int btrfs_writepages(struct address_space *mapping,
Greg Kroah-Hartman
maintainerPATCH 89/342 btrfs: statfs: report zero available if metadata are exhausted
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit ca8a51b3a979d57b082b14eda38602b7f52d81d1 upstream.
There is one ENOSPC case that's very confusing. There's Available greater than zero but no file operation succeds (besides removing files). This happens when the metadata are exhausted and there's no possibility to allocate another chunk.
In this scenario it's normal that there's still some space in the data chunk and the calculation in df reflects that in the Avail value.
To at least give some clue about the ENOSPC situation, let statfs report zero value in Avail, even if there's still data space available.
Current:
/dev/sdb1 4.0G 3.3G 719M 83% /mnt/test
New:
/dev/sdb1 4.0G 3.3G 0 100% /mnt/test
We calculate the remaining metadata space minus global reserve. If this is (supposedly) smaller than zero, there's no space. But this does not hold in practice, the exhausted state happens where's still some positive delta. So we apply some guesswork and compare the delta to a 4M threshold. (Practically observed delta was 2M.)
We probably cannot calculate the exact threshold value because this depends on the internal reservations requested by various operations, so some operations that consume a few metadata will succeed even if the Avail is zero. But this is better than the other way around.
--- fs/btrfs/super.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/btrfs/super.c +24 -0
@@ -1956,6 +1956,8 @@ static int btrfs_calc_avail_data_space(s* there are other factors that may change the result (like a new metadata * chunk). * +* If metadata is exhausted, f_bavail will be 0. +* * FIXME: not accurate for mixed block groups, total and free/used are ok, * available appears slightly larger. */
@@ -1967,11 +1969,13 @@ static int btrfs_statfs(struct dentry *dstruct btrfs_space_info *found;u64 total_used =0 ;u64 total_free_data =0 ; +u64 total_free_meta =0 ;int bits = dentry->d_sb->s_blocksize_bits;__be32 *fsid = (__be32 *)fs_info->fsid;unsigned factor =1 ;struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv;int ret; +u64 thresh =0 ;/* * holding chunk_muext to avoid allocating new chunks, holding
@@ -1997,6 +2001,8 @@ static int btrfs_statfs(struct dentry *d } } } +if (found->flags &BTRFS_BLOCK_GROUP_METADATA ) + total_free_meta += found->disk_total - found->disk_used; total_used += found->disk_used; }
@@ -2019,6 +2025,24 @@ static int btrfs_statfs(struct dentry *d buf->f_bavail +=div_u64 (total_free_data, factor); buf->f_bavail = buf->f_bavail >> bits; +/* +* We calculate the remaining metadata space minus global reserve. If +* this is (supposedly) smaller than zero, there's no space. But this +* does not hold in practice, the exhausted state happens where's still +* some positive delta. So we apply some guesswork and compare the +* delta to a 4M threshold. (Practically observed delta was ~2M.) +* +* We probably cannot calculate the exact threshold value because this +* depends on the internal reservations requested by various +* operations, so some operations that consume a few metadata will +* succeed even if the Avail is zero. But this is better than the other +* way around. +*/ + thresh =4 *1024 *1024 ; + +if (total_free_meta - thresh < block_rsv->size) + buf->f_bavail =0 ; + buf->f_type =BTRFS_SUPER_MAGIC ; buf->f_bsize = dentry->d_sb->s_blocksize; buf->f_namelen =BTRFS_NAME_LEN ;
Greg Kroah-Hartman
maintainerPATCH 90/342 Btrfs: send, dont BUG_ON() when an empty symlink is found
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit a879719b8c90e15c9e7fa7266d5e3c0ca962f9df upstream.
When a symlink is successfully created it always has an inline extent containing the source path. However if an error happens when creating the symlink, we can leave in the subvolume's tree a symlink inode without any such inline extent item - this happens if after btrfs_symlink() calls btrfs_end_transaction() and before it calls the inode eviction handler (through the final iput() call), the transaction gets committed and a crash happens before the eviction handler gets called, or if a snapshot of the subvolume is made before the eviction handler gets called. Sadly we can't just avoid this by making btrfs_symlink() call btrfs_end_transaction() after it calls the eviction handler, because the later can commit the current transaction before it removes any items from the subvolume tree (if it encounters ENOSPC errors while reserving space for removing all the items).
So make send fail more gracefully, with an -EIO error, and print a message to dmesg/syslog informing that there's an empty symlink inode, so that the user can delete the empty symlink or do something else about it.
--- fs/btrfs/send.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
fs/btrfs/send.c +15 -1
@@ -1469,7 +1469,21 @@ static int read_symlink(struct btrfs_roo ret =btrfs_search_slot (NULL , root, &key, path,0 ,0 );if (ret <0 ) goto out; -BUG_ON (ret); +if (ret) { +/* +* An empty symlink inode. Can happen in rare error paths when +* creating a symlink (transaction committed before the inode +* eviction handler removed the symlink inode items and a crash +* happened in between or the subvol was snapshoted in between). +* Print an informative message to dmesg/syslog so that the user +* can delete the symlink. +*/ +btrfs_err (root->fs_info, +"Found empty symlink inode %llu at root %llu" , + ino, root->root_key.objectid); + ret = -EIO ; + goto out; + } ei =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], struct btrfs_file_extent_item);
Greg Kroah-Hartman
maintainerPATCH 91/342 Btrfs: fix number of transaction units required to create symlink
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 9269d12b2d57d9e3d13036bb750762d1110d425c upstream.
We weren't accounting for the insertion of an inline extent item for the symlink inode nor that we need to update the parent inode item (through the call to btrfs_add_nondir()). So fix this by including two more transaction units.
--- fs/btrfs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +3 -1
@@ -9663,9 +9663,11 @@ static int btrfs_symlink(struct inode *d/* * 2 items for inode item and ref * 2 items for dir items +* 1 item for updating parent inode item +* 1 item for the inline extent item * 1 item for xattr if selinux is on */ - trans =btrfs_start_transaction (root,5 ); + trans =btrfs_start_transaction (root,7 );if (IS_ERR (trans))return PTR_ERR (trans);
Greg Kroah-Hartman
maintainerPATCH 92/342 Btrfs: fix transaction handle leak on failure to create hard link
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 271dba4521aed0c37c063548f876b49f5cd64b2e upstream.
If we failed to create a hard link we were not always releasing the the transaction handle we got before, resulting in a memory leak and preventing any other tasks from being able to commit the current transaction.
Fix this by always releasing our transaction handle.
--- fs/btrfs/inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +4 -2
@@ -6493,7 +6493,7 @@ out_unlock_inode:static int btrfs_link (struct dentry *old_dentry,struct inode *dir,struct dentry *dentry) { -struct btrfs_trans_handle *trans; +struct btrfs_trans_handle *trans =NULL ;struct btrfs_root *root =BTRFS_I (dir)->root;struct inode *inode =d_inode (old_dentry);u64 index;
@@ -6519,6 +6519,7 @@ static int btrfs_link(struct dentry *old trans =btrfs_start_transaction (root,5 );if (IS_ERR (trans)) { err =PTR_ERR (trans); + trans =NULL ; goto fail; }
@@ -6552,9 +6553,10 @@ static int btrfs_link(struct dentry *oldbtrfs_log_new_name (trans, inode,NULL , parent); } -btrfs_end_transaction (trans, root);btrfs_balance_delayed_items (root); fail: +if (trans) +btrfs_end_transaction (trans, root);if (drop_inode) {inode_dec_link_count (inode);iput (inode);
Greg Kroah-Hartman
maintainerPATCH 93/342 Btrfs: Initialize btrfs_root->highest_objectid when loading tree root and subvolume roots
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chandan Rajendra <[email protected]>
commit f32e48e925964c4f8ab917850788a87e1cef3bad upstream.
The following call trace is seen when btrfs/031 test is executed in a loop,
[ 158.661848] ------------[ cut here ]------------ [ 158.662634] WARNING: CPU: 2 PID: 890 at /home/chandan/repos/linux/fs/btrfs/ioctl.c:558 create_subvol+0x3d1/0x6ea() [ 158.664102] BTRFS: Transaction aborted (error -2) [ 158.664774] Modules linked in: [ 158.665266] CPU: 2 PID: 890 Comm: btrfs Not tainted 4.4.0-rc6-g511711a #2 [ 158.666251] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 158.667392] ffffffff81c0a6b0 ffff8806c7c4f8e8 ffffffff81431fc8 ffff8806c7c4f930 [ 158.668515] ffff8806c7c4f920 ffffffff81051aa1 ffff880c85aff000 ffff8800bb44d000 [ 158.669647] ffff8808863b5c98 0000000000000000 00000000fffffffe ffff8806c7c4f980 [ 158.670769] Call Trace: [ 158.671153] [<ffffffff81431fc8>] dump_stack+0x44/0x5c [ 158.671884] [<ffffffff81051aa1>] warn_slowpath_common+0x81/0xc0 [ 158.672769] [<ffffffff81051b27>] warn_slowpath_fmt+0x47/0x50 [ 158.673620] [<ffffffff813bc98d>] create_subvol+0x3d1/0x6ea [ 158.674440] [<ffffffff813777c9>] btrfs_mksubvol.isra.30+0x369/0x520 [ 158.675376] [<ffffffff8108a4aa>] ? percpu_down_read+0x1a/0x50 [ 158.676235] [<ffffffff81377a81>] btrfs_ioctl_snap_create_transid+0x101/0x180 [ 158.677268] [<ffffffff81377b52>] btrfs_ioctl_snap_create+0x52/0x70 [ 158.678183] [<ffffffff8137afb4>] btrfs_ioctl+0x474/0x2f90 [ 158.678975] [<ffffffff81144b8e>] ? vma_merge+0xee/0x300 [ 158.679751] [<ffffffff8115be31>] ? alloc_pages_vma+0x91/0x170 [ 158.680599] [<ffffffff81123f62>] ? lru_cache_add_active_or_unevictable+0x22/0x70 [ 158.681686] [<ffffffff813d99cf>] ? selinux_file_ioctl+0xff/0x1d0 [ 158.682581] [<ffffffff8117b791>] do_vfs_ioctl+0x2c1/0x490 [ 158.683399] [<ffffffff813d3cde>] ? security_file_ioctl+0x3e/0x60 [ 158.684297] [<ffffffff8117b9d4>] SyS_ioctl+0x74/0x80 [ 158.685051] [<ffffffff819b2bd7>] entry_SYSCALL_64_fastpath+0x12/0x6a [ 158.685958] ---[ end trace 4b63312de5a2cb76 ]--- [ 158.686647] BTRFS: error (device loop0) in create_subvol:558: errno=-2 No such entry [ 158.709508] BTRFS info (device loop0): forced readonly [ 158.737113] BTRFS info (device loop0): disk space caching is enabled [ 158.738096] BTRFS error (device loop0): Remounting read-write after error is not allowed [ 158.851303] BTRFS error (device loop0): cleaner transaction attach returned -30
This occurs because,
Mount filesystem
Create subvol with ID 257
Unmount filesystem
Mount filesystem
Delete subvol with ID 257
btrfs_drop_snapshot()
Add root corresponding to subvol 257 into
btrfs_transaction->dropped_roots list
Create new subvol (i.e. create_subvol())
257 is returned as the next free objectid
btrfs_read_fs_root_no_name()
Finds the btrfs_root instance corresponding to the old subvol with ID 257
in btrfs_fs_info->fs_roots_radix.
Returns error since btrfs_root_item->refs has the value of 0.To fix the issue the commit initializes tree root's and subvolume root's highest_objectid when loading the roots from disk.
--- fs/btrfs/disk-io.c | 27 +++++++++++++++++++++++++++ fs/btrfs/inode-map.c | 9 +-------- fs/btrfs/inode-map.h | 1 + fs/btrfs/ioctl.c | 4 ++++ 4 files changed, 33 insertions(+), 8 deletions(-)
fs/btrfs/disk-io.c +27 -0
@@ -1582,8 +1582,23 @@ int btrfs_init_fs_root(struct btrfs_root ret =get_anon_bdev (&root->anon_dev);if (ret) goto free_writers; + +mutex_lock (&root->objectid_mutex); + ret =btrfs_find_highest_objectid (root, + &root->highest_objectid); +if (ret) { +mutex_unlock (&root->objectid_mutex); + goto free_root_dev; + } + +ASSERT (root->highest_objectid <=BTRFS_LAST_FREE_OBJECTID ); + +mutex_unlock (&root->objectid_mutex); +return 0 ; +free_root_dev: +free_anon_bdev (root->anon_dev); free_writers:btrfs_free_subvolume_writers (root->subv_writers); fail:
@@ -2900,6 +2915,18 @@ retry_root_backup: tree_root->commit_root =btrfs_root_node (tree_root);btrfs_set_root_refs (&tree_root->root_item,1 ); +mutex_lock (&tree_root->objectid_mutex); + ret =btrfs_find_highest_objectid (tree_root, + &tree_root->highest_objectid); +if (ret) { +mutex_unlock (&tree_root->objectid_mutex); + goto recovery_tree_root; + } + +ASSERT (tree_root->highest_objectid <=BTRFS_LAST_FREE_OBJECTID ); + +mutex_unlock (&tree_root->objectid_mutex); + ret =btrfs_read_roots (fs_info, tree_root);if (ret) goto recovery_tree_root;
fs/btrfs/inode-map.c +1 -8
@@ -515,7 +515,7 @@ out:return ret; } -static int btrfs_find_highest_objectid (struct btrfs_root *root,u64 *objectid) +int btrfs_find_highest_objectid (struct btrfs_root *root,u64 *objectid) {struct btrfs_path *path;int ret;
@@ -555,13 +555,6 @@ int btrfs_find_free_objectid(struct btrfint ret;mutex_lock (&root->objectid_mutex); -if (unlikely (root->highest_objectid <BTRFS_FIRST_FREE_OBJECTID )) { - ret =btrfs_find_highest_objectid (root, - &root->highest_objectid); -if (ret) - goto out; - } -if (unlikely (root->highest_objectid >=BTRFS_LAST_FREE_OBJECTID )) { ret = -ENOSPC ; goto out;
fs/btrfs/inode-map.h +1 -0
@@ -9,5 +9,6 @@ int btrfs_save_ino_cache(struct btrfs_ro struct btrfs_trans_handle *trans);int btrfs_find_free_objectid (struct btrfs_root *root,u64 *objectid); +int btrfs_find_highest_objectid (struct btrfs_root *root,u64 *objectid);#endif
fs/btrfs/ioctl.c +4 -0
@@ -568,6 +568,10 @@ static noinline int create_subvol(struct goto fail; } +mutex_lock (&new_root->objectid_mutex); + new_root->highest_objectid = new_dirid; +mutex_unlock (&new_root->objectid_mutex); +/* * insert the directory item */
Greg Kroah-Hartman
maintainerPATCH 94/342 btrfs: initialize the seq counter in struct btrfs_device
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit 546bed631203344611f42b2af1d224d2eedb4e6b upstream.
I managed to trigger this:
| INFO: trying to register non-static key. | the code is fine but needs lockdep annotation. | turning off the locking correctness validator. | CPU: 1 PID: 781 Comm: systemd-gpt-aut Not tainted 4.4.0-rt2+ #14 | Hardware name: ARM-Versatile Express | [<80307cec>] (dump_stack) | [<80070e98>] (__lock_acquire) | [<8007184c>] (lock_acquire) | [<80287800>] (btrfs_ioctl) | [<8012a8d4>] (do_vfs_ioctl) | [<8012ac14>] (SyS_ioctl)
so I think that btrfs_device_data_ordered_init() is not invoked behind a macro somewhere.
--- fs/btrfs/volumes.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/volumes.c +1 -0
@@ -232,6 +232,7 @@ static struct btrfs_device *__alloc_devispin_lock_init (&dev->reada_lock);atomic_set (&dev->reada_in_flight,0 );atomic_set (&dev->dev_stats_ccnt,0 ); +btrfs_device_data_ordered_init (dev);INIT_RADIX_TREE (&dev->reada_zones,GFP_NOFS & ~__GFP_DIRECT_RECLAIM);INIT_RADIX_TREE (&dev->reada_extents,GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
Greg Kroah-Hartman
maintainerPATCH 95/342 s390: fix normalization bug in exception table sorting
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit bcb7825a77f41c7dd91da6f7ac10b928156a322e upstream.
The normalization pass in the sorting routine of the relative exception table serves two purposes:
- it ensures that the address fields of the exception table entries are fully ordered, so that no ambiguities arise between entries with identical instruction offsets (i.e., when two instructions that are exactly 8 bytes apart each have an exception table entry associated with them)
- it ensures that the offsets of both the instruction and the fixup fields of each entry are relative to their final location after sorting.
Commit eb608fb366de ("s390/exceptions: switch to relative exception table entries") ported the relative exception table format from x86, but modified the sorting routine to only normalize the instruction offset field and not the fixup offset field. The result is that the fixup offset of each entry will be relative to the original location of the entry before sorting, likely leading to crashes when those entries are dereferenced.
--- arch/s390/mm/extable.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/s390/mm/extable.c +6 -2
@@ -52,12 +52,16 @@ void sort_extable(struct exception_tableint i;/* Normalize entries to being relative to the start of the section */ -for (p = start, i =0 ; p < finish; p++, i +=8 ) +for (p = start, i =0 ; p < finish; p++, i +=8 ) { p->insn += i; + p->fixup += i +4 ; + }sort (start, finish - start,sizeof (*start), cmp_ex,NULL );/* Denormalize all entries */ -for (p = start, i =0 ; p < finish; p++, i +=8 ) +for (p = start, i =0 ; p < finish; p++, i +=8 ) { p->insn -= i; + p->fixup -= i +4 ; + } }#ifdef CONFIG_MODULES
Greg Kroah-Hartman
maintainerPATCH 96/342 s390/dasd: prevent incorrect length error under z/VM after PAV changes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
commit 020bf042e5b397479c1174081b935d0ff15d1a64 upstream.
The channel checks the specified length and the provided amount of data for CCWs and provides an incorrect length error if the size does not match. Under z/VM with simulation activated the length may get changed. Having the suppress length indication bit set is stated as good CCW coding practice and avoids errors under z/VM.
--- drivers/s390/block/dasd_alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/block/dasd_alias.c +1 -1
@@ -723,7 +723,7 @@ static int reset_summary_unit_check(struASCEBC ((char *) &cqr->magic,4 ); ccw = cqr->cpaddr; ccw->cmd_code =DASD_ECKD_CCW_RSCK ; - ccw->flags =0 ; + ccw->flags =CCW_FLAG_SLI ; ccw->count =16 ; ccw->cda = (__u32 )(addr_t ) cqr->data; ((char *)cqr->data)[0 ] = reason;
Greg Kroah-Hartman
maintainerPATCH 97/342 s390/dasd: fix refcount for PAV reassignment
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
commit 9d862ababb609439c5d6987f6d3ddd09e703aa0b upstream.
Add refcount to the DASD device when a summary unit check worker is scheduled. This prevents that the device is set offline with worker in place.
--- drivers/s390/block/dasd_alias.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/s390/block/dasd_alias.c +16 -5
@@ -264,8 +264,10 @@ void dasd_alias_disconnect_device_from_lspin_unlock_irqrestore (&lcu->lock, flags);cancel_work_sync (&lcu->suc_data.worker);spin_lock_irqsave (&lcu->lock, flags); -if (device == lcu->suc_data.device) +if (device == lcu->suc_data.device) { +dasd_put_device (device); lcu->suc_data.device =NULL ; + } } was_pending =0 ;if (device == lcu->ruac_data.device) {
@@ -273,8 +275,10 @@ void dasd_alias_disconnect_device_from_l was_pending =1 ;cancel_delayed_work_sync (&lcu->ruac_data.dwork);spin_lock_irqsave (&lcu->lock, flags); -if (device == lcu->ruac_data.device) +if (device == lcu->ruac_data.device) { +dasd_put_device (device); lcu->ruac_data.device =NULL ; + } } private->lcu =NULL ;spin_unlock_irqrestore (&lcu->lock, flags);
@@ -549,8 +553,10 @@ static void lcu_update_work(struct work_if ((rc && (rc != -EOPNOTSUPP )) || (lcu->flags &NEED_UAC_UPDATE )) {DBF_DEV_EVENT (DBF_WARNING , device,"could not update" " alias data in lcu (rc = %d), retry later" , rc); -schedule_delayed_work (&lcu->ruac_data.dwork,30 *HZ ); +if (!schedule_delayed_work (&lcu->ruac_data.dwork,30 *HZ )) +dasd_put_device (device); }else { +dasd_put_device (device); lcu->ruac_data.device =NULL ; lcu->flags &= ~UPDATE_PENDING ; }
@@ -593,8 +599,10 @@ static int _schedule_lcu_update(struct a*/ if (!usedev)return -EINVAL ; +dasd_get_device (usedev); lcu->ruac_data.device = usedev; -schedule_delayed_work (&lcu->ruac_data.dwork,0 ); +if (!schedule_delayed_work (&lcu->ruac_data.dwork,0 )) +dasd_put_device (usedev);return 0 ; }
@@ -930,6 +938,7 @@ static void summary_unit_check_handling_/* 3. read new alias configuration */ _schedule_lcu_update (lcu, device); lcu->suc_data.device =NULL ; +dasd_put_device (device);spin_unlock_irqrestore (&lcu->lock, flags); }
@@ -989,6 +998,8 @@ void dasd_alias_handle_summary_unit_chec } lcu->suc_data.reason = reason; lcu->suc_data.device = device; +dasd_get_device (device);spin_unlock (&lcu->lock); -schedule_work (&lcu->suc_data.worker); +if (!schedule_work (&lcu->suc_data.worker)) +dasd_put_device (device); };
Greg Kroah-Hartman
maintainerPATCH 98/342 s390/dasd: fix performance drop
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
commit 12d319b920fa673a4d5e7c1785c5dc82dcd15257 upstream.
Commit ca369d51b ("sd: Fix device-imposed transfer length limits") introduced a new queue limit max_dev_sectors which limits the maximum sectors for requests. The default value leads to small dasd requests and therefor to a performance drop.
Set the max_dev_sectors value to the same value as the max_hw_sectors to use the maximum available request size for DASD devices.
--- drivers/s390/block/dasd.c | 1 + 1 file changed, 1 insertion(+)
drivers/s390/block/dasd.c +1 -0
@@ -3031,6 +3031,7 @@ static void dasd_setup_queue(struct dasd max = block->base->discipline->max_blocks << block->s2b_shift; }queue_flag_set_unlocked (QUEUE_FLAG_NONROT , block->request_queue); + block->request_queue->limits.max_dev_sectors = max;blk_queue_logical_block_size (block->request_queue, block->bp_block);blk_queue_max_hw_sectors (block->request_queue, max);
Greg Kroah-Hartman
maintainerPATCH 99/342 s390/compat: correct restore of high gprs on signal return
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 342300cc9cd3428bc6bfe5809bfcc1b9a0f06702 upstream.
git commit 8070361799ae1e3f4ef347bd10f0a508ac10acfb "s390: add support for vector extension"
broke 31-bit compat processes in regard to signal handling.
The restore_sigregs_ext32() function is used to restore the additional elements from the user space signal frame. Among the additional elements are the upper registers halves for 64-bit register support for 31-bit processes. The copy_from_user that is used to retrieve the high-gprs array from the user stack uses an incorrect length, 8 bytes instead of 64 bytes. This causes incorrect upper register halves to get loaded.
--- arch/s390/kernel/compat_signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/compat_signal.c +1 -1
@@ -271,7 +271,7 @@ static int restore_sigregs_ext32(struct/* Restore high gprs from signal stack */ if (__copy_from_user (&gprs_high, &sregs_ext->gprs_high, -sizeof (&sregs_ext->gprs_high))) +sizeof (sregs_ext->gprs_high)))return -EFAULT ;for (i =0 ; i <NUM_GPRS ; i++) *(__u32 *)®s->gprs[i] = gprs_high[i];
Greg Kroah-Hartman
maintainerPATCH 100/342 s390/fpu: signals vs. floating point control register
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 1b17cb796f5d40ffa239c6926385abd83a77a49b upstream.
git commit 904818e2f229f3d94ec95f6932a6358c81e73d78 "s390/kernel: introduce fpu-internal.h with fpu helper functions" introduced the fpregs_store / fp_regs_load helper. These function fail to save and restore the floating pointer control registers.
The effect is that the FPC is not correctly handled on signal delivery and signal return.
--- arch/s390/include/asm/fpu/internal.h | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/include/asm/fpu/internal.h +2 -0
@@ -48,6 +48,7 @@ static inline void convert_fp_to_vx(__vestatic inline void fpregs_store (_s390_fp_regs *fpregs,struct fpu *fpu) { fpregs->pad =0 ; + fpregs->fpc = fpu->fpc;if (MACHINE_HAS_VX )convert_vx_to_fp ((freg_t *)&fpregs->fprs, fpu->vxrs);else
@@ -57,6 +58,7 @@ static inline void fpregs_store(_s390_fpstatic inline void fpregs_load (_s390_fp_regs *fpregs,struct fpu *fpu) { + fpu->fpc = fpregs->fpc;if (MACHINE_HAS_VX )convert_fp_to_vx (fpu->vxrs, (freg_t *)&fpregs->fprs);else
Greg Kroah-Hartman
maintainerPATCH 101/342 uml: flush stdout before forking
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vegard Nossum <[email protected]>
commit 0754fb298f2f2719f0393491d010d46cfb25d043 upstream.
I was seeing some really weird behaviour where piping UML's output somewhere would cause output to get duplicated:
$ ./vmlinux | head -n 40
Checking that ptrace can change system call numbers...Core dump limits :
soft - 0
hard - NONE
OK
Checking syscall emulation patch for ptrace...Core dump limits :
soft - 0
hard - NONE
OK
Checking advanced syscall emulation patch for ptrace...Core dump limits :
soft - 0
hard - NONE
OK
Core dump limits :
soft - 0
hard - NONEThis is because these tests do a fork() which duplicates the non-empty stdout buffer, then glibc flushes the duplicated buffer as each child exits.
A simple workaround is to flush before forking.
--- arch/um/os-Linux/start_up.c | 2 ++ 1 file changed, 2 insertions(+)
arch/um/os-Linux/start_up.c +2 -0
@@ -94,6 +94,8 @@ static int start_ptraced_child(void) {int pid, n, status; +fflush (stdout); + pid =fork ();if (pid ==0 )ptrace_child ();
Greg Kroah-Hartman
maintainerPATCH 102/342 uml: fix hostfs mknod()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vegard Nossum <[email protected]>
commit 9f2dfda2f2f1c6181c3732c16b85c59ab2d195e0 upstream.
An inverted return value check in hostfs_mknod() caused the function to return success after handling it as an error (and cleaning up).
It resulted in the following segfault when trying to bind() a named unix socket:
Pid: 198, comm: a.out Not tainted 4.4.0-rc4
RIP: 0033:[<0000000061077df6>] RSP: 00000000daae5d60 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 000000006092a460 RCX: 00000000dfc54208 RDX: 0000000061073ef1 RSI: 0000000000000070 RDI: 00000000e027d600 RBP: 00000000daae5de0 R08: 00000000da980ac0 R09: 0000000000000000 R10: 0000000000000003 R11: 00007fb1ae08f72a R12: 0000000000000000 R13: 000000006092a460 R14: 00000000daaa97c0 R15: 00000000daaa9a88 Kernel panic - not syncing: Kernel mode fault at addr 0x40, ip 0x61077df6 CPU: 0 PID: 198 Comm: a.out Not tainted 4.4.0-rc4 #1 Stack: e027d620 dfc54208 0000006f da981398 61bee000 0000c1ed daae5de0 0000006e e027d620 dfcd4208 00000005 6092a460 Call Trace: [<60dedc67>] SyS_bind+0xf7/0x110 [<600587be>] handle_syscall+0x7e/0x80 [<60066ad7>] userspace+0x3e7/0x4e0 [<6006321f>] ? save_registers+0x1f/0x40 [<6006c88e>] ? arch_prctl+0x1be/0x1f0 [<60054985>] fork_handler+0x85/0x90
Let's also get rid of the "cosmic ray protection" while we're at it.
--- fs/hostfs/hostfs_kern.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/hostfs/hostfs_kern.c +1 -3
@@ -730,15 +730,13 @@ static int hostfs_mknod(struct inode *diinit_special_inode (inode, mode, dev); err =do_mknod (name, mode,MAJOR (dev),MINOR (dev)); -if (!err) +if (err) goto out_free; err =read_name (inode, name);__putname (name);if (err) goto out_put; -if (err) - goto out_put;d_instantiate (dentry, inode);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 103/342 um: link with -lpthread
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vegard Nossum <[email protected]>
commit a7df4716d19594b7b3f106f0bc0ca1c548e508e6 upstream.
Similarly to commit fb1770aa78a43530940d0c2dd161e77bc705bdac, with gcc 5 on Ubuntu and CONFIG_STATIC_LINK=y I was seeing these linker errors:
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new':
(.text+0xcd): undefined reference to pthread_once' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function __timer_create_new':
(.text+0x126): undefined reference to pthread_attr_init' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function __timer_create_new':
(.text+0x168): undefined reference to `pthread_attr_setdetachstate'
[...]
Obviously we also need -lpthread for librt.a.
--- scripts/link-vmlinux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/link-vmlinux.sh +1 -1
@@ -62,7 +62,7 @@ vmlinux_link() -Wl,--start-group \ ${KBUILD_VMLINUX_MAIN} \ -Wl,--end-group \ - -lutil -lrt ${1} + -lutil -lrt -lpthread ${1} rm -f linux fi }
Greg Kroah-Hartman
maintainerPATCH 104/342 locks: fix unlock when fcntl_setlk races with a close
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 7f3697e24dc3820b10f445a4a7d914fc356012d1 upstream.
Dmitry reported that he was able to reproduce the WARN_ON_ONCE that fires in locks_free_lock_context when the flc_posix list isn't empty.
The problem turns out to be that we're basically rebuilding the file_lock from scratch in fcntl_setlk when we discover that the setlk has raced with a close. If the l_whence field is SEEK_CUR or SEEK_END, then we may end up with fl_start and fl_end values that differ from when the lock was initially set, if the file position or length of the file has changed in the interim.
Fix this by just reusing the same lock request structure, and simply override fl_type value with F_UNLCK as appropriate. That ensures that we really are unlocking the lock that was initially set.
While we're there, make sure that we do pop a WARN_ON_ONCE if the removal ever fails. Also return -EBADF in this event, since that's what we would have returned if the close had happened earlier.
--- fs/locks.c | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-)
fs/locks.c +30 -21
@@ -2182,7 +2182,6 @@ int fcntl_setlk(unsigned int fd, struct goto out; } -again: error =flock_to_posix_lock (filp, file_lock, &flock);if (error) goto out;
@@ -2224,19 +2223,22 @@ again:* Attempt to detect a close/fcntl race and recover by * releasing the lock that was just acquired. */ -/* -* we need that spin_lock here - it prevents reordering between -* update of i_flctx->flc_posix and check for it done in close(). -* rcu_read_lock() wouldn't do. -*/ -spin_lock (¤t->files->file_lock); - f =fcheck (fd); -spin_unlock (¤t->files->file_lock); -if (!error && f != filp && flock.l_type !=F_UNLCK ) { - flock.l_type =F_UNLCK ; - goto again; +if (!error && file_lock->fl_type !=F_UNLCK ) { +/* +* We need that spin_lock here - it prevents reordering between +* update of i_flctx->flc_posix and check for it done in +* close(). rcu_read_lock() wouldn't do. +*/ +spin_lock (¤t->files->file_lock); + f =fcheck (fd); +spin_unlock (¤t->files->file_lock); +if (f != filp) { + file_lock->fl_type =F_UNLCK ; + error =do_lock_file_wait (filp, cmd, file_lock); +WARN_ON_ONCE (error); + error = -EBADF ; + } } - out:locks_free_lock (file_lock);return error;
@@ -2322,7 +2324,6 @@ int fcntl_setlk64(unsigned int fd, struc goto out; } -again: error =flock64_to_posix_lock (filp, file_lock, &flock);if (error) goto out;
@@ -2364,14 +2365,22 @@ again:* Attempt to detect a close/fcntl race and recover by * releasing the lock that was just acquired. */ -spin_lock (¤t->files->file_lock); - f =fcheck (fd); -spin_unlock (¤t->files->file_lock); -if (!error && f != filp && flock.l_type !=F_UNLCK ) { - flock.l_type =F_UNLCK ; - goto again; +if (!error && file_lock->fl_type !=F_UNLCK ) { +/* +* We need that spin_lock here - it prevents reordering between +* update of i_flctx->flc_posix and check for it done in +* close(). rcu_read_lock() wouldn't do. +*/ +spin_lock (¤t->files->file_lock); + f =fcheck (fd); +spin_unlock (¤t->files->file_lock); +if (f != filp) { + file_lock->fl_type =F_UNLCK ; + error =do_lock_file_wait (filp, cmd, file_lock); +WARN_ON_ONCE (error); + error = -EBADF ; + } } - out:locks_free_lock (file_lock);return error;
Greg Kroah-Hartman
maintainerPATCH 105/342 rtlwifi: rtl_pci: Fix kernel panic
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit f99551a2d39dc26ea03dc6761be11ac913eb2d57 upstream.
In commit 38506ecefab9 (rtlwifi: rtl_pci: Start modification for new drivers), a bug was introduced that causes a NULL pointer dereference. As this bug only affects the infrequently used RTL8192EE and only under low-memory conditions, it has taken a long time for the bug to show up.
The bug was reported on the linux-wireless mailing list and also at
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/ as bug #1527603 (kernel crashes due to rtl8192ee driver on ubuntu 15.10).
--- drivers/net/wireless/realtek/rtlwifi/pci.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/wireless/realtek/rtlwifi/pci.c +3 -8
@@ -801,7 +801,9 @@ static void _rtl_pci_rx_interrupt(struct hw_queue);if (rx_remained_cnt ==0 )return ; - + buffer_desc = &rtlpci->rx_ring[rxring_idx].buffer_desc[ + rtlpci->rx_ring[rxring_idx].idx]; + pdesc = (struct rtl_rx_desc *)skb->data; }else {/* rx descriptor */ pdesc = &rtlpci->rx_ring[rxring_idx].desc[ rtlpci->rx_ring[rxring_idx].idx];
@@ -824,13 +826,6 @@ static void _rtl_pci_rx_interrupt(struct new_skb =dev_alloc_skb (rtlpci->rxbuffersize);if (unlikely (!new_skb)) goto no_new; -if (rtlpriv->use_new_trx_flow) { - buffer_desc = - &rtlpci->rx_ring[rxring_idx].buffer_desc - [rtlpci->rx_ring[rxring_idx].idx]; -/*means rx wifi info*/ - pdesc = (struct rtl_rx_desc *)skb->data; - }memset (&rx_status ,0 ,sizeof (rx_status)); rtlpriv->cfg->ops->query_rx_desc (hw, &stats, &rx_status, (u8 *)pdesc, skb);
Greg Kroah-Hartman
maintainerPATCH 106/342 rtlwifi: rtl8192cu: Add missing parameter setup
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit b68d0ae7e58624c33f2eddab471fee55db27dbf9 upstream.
This driver fails to copy the module parameter for software encryption to the locations used by the main code.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c +2 -0
@@ -65,6 +65,8 @@ static int rtl92cu_init_sw_vars(struct i rtlpriv->dm.disable_framebursting = false; rtlpriv->dm.thermalvalue =0 ; rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto;/* for firmware buf */ rtlpriv->rtlhal.pfirmware =vzalloc (0x4000 );
Greg Kroah-Hartman
maintainerPATCH 107/342 rtlwifi: rtl8192ce: Fix handling of module parameters
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit b24f19f16b9e43f54218c07609b783ea8625406a upstream.
The module parameter for software encryption was never transferred to the location used by the driver.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c +2 -0
@@ -139,6 +139,8 @@ int rtl92c_init_sw_vars(struct ieee80211 rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto;if (!rtlpriv->psc.inactiveps)pr_info ("rtl8192ce: Power Save off (module option)\n" );if (!rtlpriv->psc.fwctrl_lps)
Greg Kroah-Hartman
maintainerPATCH 108/342 rtlwifi: rtl8192de: Fix incorrect module parameter descriptions
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit d4d60b4caaa5926e1b243070770968f05656107a upstream.
Two of the module parameters are listed with incorrect default values.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c +2 -2
@@ -376,8 +376,8 @@ module_param_named(swlps, rtl92de_mod_pamodule_param_named (fwlps, rtl92de_mod_params.fwctrl_lps, bool,0444 );MODULE_PARM_DESC (swenc,"Set to 1 for software crypto (default 0)\n" );MODULE_PARM_DESC (ips,"Set to 0 to not use link power save (default 1)\n" ); -MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" ); -MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 1)\n" ); +MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 0)\n" );MODULE_PARM_DESC (debug,"Set debug level (0-5) (default 0)" ); static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
Greg Kroah-Hartman
maintainerPATCH 109/342 rtlwifi: rtl8723ae: Fix initialization of module parameters
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 793b09994211fbe0b5cd5f7b6dd8cc9b6256c3c6 upstream.
This driver has some errors in the handling of module parameters. These include missing initialization for parameters msi_support and disable_watchdog. In addition, neither of these parameters nor sw_crypto are transferred into the locations used by the driver. A final fix is adding parameter msi to the module named and description macros.
--- drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c +9 -0
@@ -150,6 +150,11 @@ int rtl8723e_init_sw_vars(struct ieee802 rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; + rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto; + rtlpriv->cfg->mod_params->disable_watchdog = + rtlpriv->cfg->mod_params->disable_watchdog;if (rtlpriv->cfg->mod_params->disable_watchdog)pr_info ("watchdog disabled\n" ); rtlpriv->psc.reg_fwctrl_lps =3 ;
@@ -267,6 +272,8 @@ static struct rtl_mod_params rtl8723e_mo .swctrl_lps = false, .fwctrl_lps = true, .debug = DBG_EMERG, + .msi_support = false, + .disable_watchdog = false, };static struct rtl_hal_cfg rtl8723e_hal_cfg = {
@@ -383,12 +390,14 @@ module_param_named(debug, rtl8723e_mod_pmodule_param_named (ips, rtl8723e_mod_params.inactiveps, bool,0444 );module_param_named (swlps, rtl8723e_mod_params.swctrl_lps, bool,0444 );module_param_named (fwlps, rtl8723e_mod_params.fwctrl_lps, bool,0444 ); +module_param_named (msi, rtl8723e_mod_params.msi_support, bool,0444 );module_param_named (disable_watchdog, rtl8723e_mod_params.disable_watchdog, bool,0444 );MODULE_PARM_DESC (swenc,"Set to 1 for software crypto (default 0)\n" );MODULE_PARM_DESC (ips,"Set to 0 to not use link power save (default 1)\n" );MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" );MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +MODULE_PARM_DESC (msi,"Set to 1 to use MSI interrupts mode (default 0)\n" );MODULE_PARM_DESC (debug,"Set debug level (0-5) (default 0)" );MODULE_PARM_DESC (disable_watchdog,"Set to 1 to disable the watchdog (default 0)\n" );
Greg Kroah-Hartman
maintainerPATCH 110/342 rtlwifi: rtl8192se: Fix module parameter initialization
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 7503efbd82c15c4070adffff1344e5169d3634b4 upstream.
Two of the module parameter descriptions show incorrect default values. In addition the value for software encryption is not transferred to the locations used by the driver.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c +4 -2
@@ -187,6 +187,8 @@ static int rtl92s_init_sw_vars(struct ie rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto;if (!rtlpriv->psc.inactiveps)pr_info ("Power Save off (module option)\n" );if (!rtlpriv->psc.fwctrl_lps)
@@ -425,8 +427,8 @@ module_param_named(swlps, rtl92se_mod_pamodule_param_named (fwlps, rtl92se_mod_params.fwctrl_lps, bool,0444 );MODULE_PARM_DESC (swenc,"Set to 1 for software crypto (default 0)\n" );MODULE_PARM_DESC (ips,"Set to 0 to not use link power save (default 1)\n" ); -MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" ); -MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 1)\n" ); +MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 0)\n" );MODULE_PARM_DESC (debug,"Set debug level (0-5) (default 0)" ); static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
Greg Kroah-Hartman
maintainerPATCH 111/342 rtlwifi: rtl8188ee: Fix module parameter initialization
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 06f34572c6110e2e2d5e653a957f1d74db9e3f2b upstream.
In this driver, parameters disable_watchdog and sw_crypto are never copied into the locations used in the main code. While modifying the parameter handling, the copying of parameter msi_support is moved to be with the rest.
--- drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c +5 -2
@@ -88,8 +88,6 @@ int rtl88e_init_sw_vars(struct ieee80211u8 tid;rtl8188ee_bt_reg_init (hw); - rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; - rtlpriv->dm.dm_initialgain_enable =1 ; rtlpriv->dm.dm_flag =0 ; rtlpriv->dm.disable_framebursting =0 ;
@@ -138,6 +136,11 @@ int rtl88e_init_sw_vars(struct ieee80211 rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; + rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto; + rtlpriv->cfg->mod_params->disable_watchdog = + rtlpriv->cfg->mod_params->disable_watchdog;if (rtlpriv->cfg->mod_params->disable_watchdog)pr_info ("watchdog disabled\n" );if (!rtlpriv->psc.inactiveps)
Greg Kroah-Hartman
maintainerPATCH 112/342 rtlwifi: rtl8723be: Fix module parameter initialization
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 7079604ddb83f428359feace3aeaf8a9f435be4a upstream.
This driver has a number of errors in the module initialization. These include the following:
Parameter msi_support is stored in two places - one is removed. Paramters sw_crypto and disable_watchdog were never stored in the final locations, nor were they initialized properly.
--- drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +7 -1
@@ -93,7 +93,6 @@ int rtl8723be_init_sw_vars(struct ieee80struct rtl_mac *mac =rtl_mac (rtl_priv (hw));rtl8723be_bt_reg_init (hw); - rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; rtlpriv->btcoexist.btc_ops =rtl_btc_get_ops_pointer (); rtlpriv->dm.dm_initialgain_enable =1 ;
@@ -151,6 +150,10 @@ int rtl8723be_init_sw_vars(struct ieee80 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto; + rtlpriv->cfg->mod_params->disable_watchdog = + rtlpriv->cfg->mod_params->disable_watchdog;if (rtlpriv->cfg->mod_params->disable_watchdog)pr_info ("watchdog disabled\n" ); rtlpriv->psc.reg_fwctrl_lps =3 ;
@@ -267,6 +270,9 @@ static struct rtl_mod_params rtl8723be_m .inactiveps = true, .swctrl_lps = false, .fwctrl_lps = true, + .msi_support = false, + .disable_watchdog = false, + .debug = DBG_EMERG, };static struct rtl_hal_cfg rtl8723be_hal_cfg = {
Greg Kroah-Hartman
maintainerPATCH 113/342 mei: fix fasync return value on error
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Winkler <[email protected]>
commit ed6dc538e5a36a331b6256d54f435c80f6715460 upstream.
fasync should return a negative value on error and not poll mask POLLERR.
--- drivers/misc/mei/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/misc/mei/main.c +4 -2
@@ -657,7 +657,9 @@ out:* @file: pointer to file structure * @band: band bitmap * -* Return: poll mask +* Return: negative on error, +* 0 if it did no changes, +* and positive a process was added or deleted */ static int mei_fasync (int fd,struct file *file,int band) {
@@ -665,7 +667,7 @@ static int mei_fasync(int fd, struct filstruct mei_cl *cl = file->private_data;if (!mei_cl_is_connected (cl)) -return POLLERR ; +return -ENODEV ;return fasync_helper (fd, file, band, &cl->ev_async); }
Greg Kroah-Hartman
maintainerPATCH 114/342 mei: validate request value in client notify request ioctl
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Usyskin <[email protected]>
commit 7326fffb712f09a315bc73cc1ee63843f59b8bd4 upstream.
This patch address a possible security issue:
The request field in client notify request ioctl comes from user space as u32 and is downcasted to u8 with out validation.
Check request field to have approved values MEI_HBM_NOTIFICATION_STAR/STOP
--- drivers/misc/mei/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/misc/mei/main.c +5 -1
@@ -458,7 +458,11 @@ static int mei_ioctl_client_notify_reque {struct mei_cl *cl = file->private_data; -return mei_cl_notify_request (cl, file, request); +if (request !=MEI_HBM_NOTIFICATION_START && + request !=MEI_HBM_NOTIFICATION_STOP ) +return -EINVAL ; + +return mei_cl_notify_request (cl, file, (u8 )request); }/**
Greg Kroah-Hartman
maintainerPATCH 115/342 namei: ->d_inode of a pinned dentry is stable only for positives
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit d4565649b6d6923369112758212b851adc407f0c upstream.
both do_last() and walk_component() risk picking a NULL inode out of dentry about to become positive, *then* checking its flags and seeing that it's not negative anymore and using (already stale by then) value they'd fetched earlier. Usually ends up oopsing soon after that...
--- fs/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/namei.c +2 -2
@@ -1742,11 +1742,11 @@ static int walk_component(struct nameidaif (err <0 )return err; - inode =d_backing_inode (path.dentry); seq =0 ;/* we are already out of RCU mode */ err = -ENOENT ;if (d_is_negative (path.dentry)) goto out_path_put; + inode =d_backing_inode (path.dentry); }if (flags &WALK_PUT )
@@ -3130,12 +3130,12 @@ retry_lookup:return error;BUG_ON (nd->flags &LOOKUP_RCU ); - inode =d_backing_inode (path.dentry); seq =0 ;/* out of RCU mode, so the value doesn't matter */ if (unlikely (d_is_negative (path.dentry))) {path_to_nameidata (&path, nd);return -ENOENT ; } + inode =d_backing_inode (path.dentry); finish_lookup:if (nd->depth)put_link (nd);
Greg Kroah-Hartman
maintainerPATCH 116/342 rc: sunxi-cir: Initialize the spinlock properly
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 768acf46e1320d6c41ed1b7c4952bab41c1cde79 upstream.
The driver allocates the spinlock but fails to initialize it correctly. The kernel reports a BUG indicating bad spinlock magic when spinlock debugging is enabled.
Call spin_lock_init() on it to initialize it correctly.
--- drivers/media/rc/sunxi-cir.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/rc/sunxi-cir.c +2 -0
@@ -153,6 +153,8 @@ static int sunxi_ir_probe(struct platforif (!ir)return -ENOMEM ; +spin_lock_init (&ir->ir_lock); +if (of_device_is_compatible (dn,"allwinner,sun5i-a13-ir" )) ir->fifo_size =64 ;else
Greg Kroah-Hartman
maintainerPATCH 117/342 media: dvb-core: Dont force CAN_INVERSION_AUTO in oneshot mode
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit c9d57de6103e343f2d4e04ea8d9e417e10a24da7 upstream.
When in FE_TUNE_MODE_ONESHOT the frontend must report the actual capabilities so user can take appropriate action.
With frontends that can't do auto inversion this is done by dvb-core automatically so CAN_INVERSION_AUTO is valid.
However, when in FE_TUNE_MODE_ONESHOT this is not true.
So only set FE_CAN_INVERSION_AUTO in modes other than FE_TUNE_MODE_ONESHOT
--- drivers/media/dvb-core/dvb_frontend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +3 -3
@@ -2313,9 +2313,9 @@ static int dvb_frontend_ioctl_legacy(strdev_dbg (fe->dvb->device,"%s: current delivery system on cache: %d, V3 type: %d\n" , __func__, c->delivery_system, fe->ops.info.type); -/* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't -* do it, it is done for it. */ - info->caps |=FE_CAN_INVERSION_AUTO ; +/* Set CAN_INVERSION_AUTO bit on in other than oneshot mode */ +if (!(fepriv->tune_mode_flags &FE_TUNE_MODE_ONESHOT )) + info->caps |=FE_CAN_INVERSION_AUTO ; err =0 ;break ; }
Greg Kroah-Hartman
maintainerPATCH 118/342 si2157: return -EINVAL if firmware blob is too big
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <[email protected]>
commit d2cc2f0b35465951eaaf0387fd55e29835ed7ea6 upstream.
A previous patch added a check if the firmware is too big, but it didn't set the return error code with the right value.
[[email protected]: I ended by applying a v1 of Laura's patch, without
the proper return code. This patch contains the difference between v2 and v1 of the Laura's "si2157: Bounds check firmware" patch]
--- drivers/media/tuners/si2157.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/tuners/si2157.c +1 -0
@@ -168,6 +168,7 @@ static int si2157_init(struct dvb_fronte len = fw->data[fw->size - remaining];if (len >SI2157_ARGLEN ) {dev_err (&client->dev,"Bad firmware length\n" ); + ret = -EINVAL ; goto err_release_firmware; }memcpy (cmd.args, &fw->data[(fw->size - remaining) +1 ], len);
Greg Kroah-Hartman
maintainerPATCH 119/342 gspca: ov534/topro: prevent a division by 0
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Ospite <[email protected]>
commit dcc7fdbec53a960588f2c40232db2c6466c09917 upstream.
v4l2-compliance sends a zeroed struct v4l2_streamparm in v4l2-test-formats.cpp::testParmType(), and this results in a division by 0 in some gspca subdrivers:
divide error: 0000 [#1] SMP
Modules linked in: gspca_ov534 gspca_main ...
CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
RIP: 0010:[<ffffffffa079bd62>] [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
RSP: 0018:ffff880095c4fce8 EFLAGS: 00010296
RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
FS: 00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
Stack:
ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
Call Trace:
[<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
[<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
[<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
[<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
[<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
[<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
[<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
[<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
[<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
[<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
[<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
[<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
RIP [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
RSP <ffff880095c4fce8>
---[ end trace 279710c2c6c72080 ]---Following what the doc says about a zeroed timeperframe (see
http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):
...
To reset manually applications can just set this field to zero.
fix the issue by resetting the frame rate to a default value in case of an unusable timeperframe.
The fix is done in the subdrivers instead of gspca.c because only the subdrivers have notion of a default frame rate to reset the camera to.
--- drivers/media/usb/gspca/ov534.c | 9 +++++++-- drivers/media/usb/gspca/topro.c | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/media/usb/gspca/ov534.c +7 -2
@@ -1491,8 +1491,13 @@ static void sd_set_streamparm(struct gspstruct v4l2_fract *tpf = &cp->timeperframe;struct sd *sd = (struct sd *) gspca_dev; -/* Set requested framerate */ - sd->frame_rate = tpf->denominator / tpf->numerator; +if (tpf->numerator ==0 || tpf->denominator ==0 ) +/* Set default framerate */ + sd->frame_rate =30 ; +else +/* Set requested framerate */ + sd->frame_rate = tpf->denominator / tpf->numerator; +if (gspca_dev->streaming)set_frame_rate (gspca_dev);
drivers/media/usb/gspca/topro.c +5 -1
@@ -4802,7 +4802,11 @@ static void sd_set_streamparm(struct gspstruct v4l2_fract *tpf = &cp->timeperframe;int fr, i; - sd->framerate = tpf->denominator / tpf->numerator; +if (tpf->numerator ==0 || tpf->denominator ==0 ) + sd->framerate =30 ; +else + sd->framerate = tpf->denominator / tpf->numerator; +if (gspca_dev->streaming)setframerate (gspca_dev,v4l2_ctrl_g_ctrl (gspca_dev->exposure));
Greg Kroah-Hartman
maintainerPATCH 120/342 vb2: fix a regression in poll() behavior for output,streams
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 4623e5967448444a4ea1e77beb58898c4af48693 upstream.
In the 3.17 kernel the poll() behavior changed for output streams:
as long as not all buffers were queued up poll() would return that userspace can write. This is fine for the write() call, but when using stream I/O this changed the behavior since the expectation was that it would wait for buffers to become available for dequeuing.
This patch only enables the check whether you can queue buffers for file I/O only, and skips it for stream I/O.
--- drivers/media/v4l2-core/videobuf2-v4l2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/videobuf2-v4l2.c +3 -3
@@ -822,10 +822,10 @@ unsigned int vb2_poll(struct vb2_queue *return res |POLLERR ;/* -* For output streams you can write as long as there are fewer buffers -* queued than there are buffers available. +* For output streams you can call write() as long as there are fewer +* buffers queued than there are buffers available. */ -if (q->is_output && q->queued_count < q->num_buffers) +if (q->is_output && q->fileio && q->queued_count < q->num_buffers)return res |POLLOUT |POLLWRNORM ;if (list_empty (&q->done_list)) {
Greg Kroah-Hartman
maintainerPATCH 121/342 tda1004x: only update the frontend properties if locked
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit e8beb02343e7582980c6705816cd957cf4f74c7a upstream.
The tda1004x was updating the properties cache before locking. If the device is not locked, the data at the registers are just random values with no real meaning.
This caused the driver to fail with libdvbv5, as such library calls GET_PROPERTY from time to time, in order to return the DVB stats.
Tested with a saa7134 card 78:
ASUSTeK P7131 Dual, vendor PCI ID: 1043:4862
--- drivers/media/dvb-frontends/tda1004x.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/dvb-frontends/tda1004x.c +9 -0
@@ -903,9 +903,18 @@ static int tda1004x_get_fe(struct dvb_fr {struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache;struct tda1004x_state * state = fe->demodulator_priv; +int status;dprintk ("%s\n" , __func__); + status =tda1004x_read_byte (state,TDA1004X_STATUS_CD ); +if (status ==-1 ) +return -EIO ; + +/* Only update the properties cache if device is locked */ +if (!(status &8 )) +return 0 ; +// inversion status fe_params->inversion =INVERSION_OFF ;if (tda1004x_read_byte (state,TDA1004X_CONFC1 ) &0x20 )
Greg Kroah-Hartman
maintainerPATCH 122/342 dm space map metadata: remove unused variable in brb_pop()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 512167788a6fe9481a33a3cce5f80b684631a1bb upstream.
Remove the unused struct block_op pointer that was inadvertantly introduced, via cut-and-paste of previous brb_op() code, as part of commit 50dd842ad.
(Cc'ing stable@ because commit 50dd842ad did)
--- drivers/md/persistent-data/dm-space-map-metadata.c | 3 --- 1 file changed, 3 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +0 -3
@@ -152,12 +152,9 @@ static int brb_peek(struct bop_ring_buffstatic int brb_pop (struct bop_ring_buffer *brb) { -struct block_op *bop; -if (brb_empty (brb))return -ENODATA ; - bop = brb->bops + brb->begin; brb->begin =brb_next (brb, brb->begin);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 123/342 dm snapshot: fix hung bios when copy error occurs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 385277bfb57faac44e92497104ba542cdd82d5fe upstream.
When there is an error copying a chunk dm-snapshot can incorrectly hold associated bios indefinitely, resulting in hung IO.
The function copy_callback sets pe->error if there was error copying the chunk, and then calls complete_exception. complete_exception calls pending_complete on error, otherwise it calls commit_exception with commit_callback (and commit_callback calls complete_exception).
The persistent exception store (dm-snap-persistent.c) assumes that calls to prepare_exception and commit_exception are paired. persistent_prepare_exception increases ps->pending_count and persistent_commit_exception decreases it.
If there is a copy error, persistent_prepare_exception is called but persistent_commit_exception is not. This results in the variable ps->pending_count never returning to zero and that causes some pending exceptions (and their associated bios) to be held forever.
Fix this by unconditionally calling commit_exception regardless of whether the copy was successful. A new "valid" parameter is added to commit_exception -- when the copy fails this parameter is set to zero so that the chunk that failed to copy (and all following chunks) is not recorded in the snapshot store. Also, remove commit_callback now that it is merely a wrapper around pending_complete.
--- drivers/md/dm-exception-store.h | 2 +- drivers/md/dm-snap-persistent.c | 5 ++++- drivers/md/dm-snap-transient.c | 4 ++-- drivers/md/dm-snap.c | 20 +++++--------------- 4 files changed, 12 insertions(+), 19 deletions(-)
drivers/md/dm-exception-store.h +1 -1
@@ -69,7 +69,7 @@ struct dm_exception_store_type {* Update the metadata with this exception. */ void (*commit_exception) (struct dm_exception_store *store, -struct dm_exception *e, +struct dm_exception *e,int valid,void (*callback) (void *,int success),void *callback_context);
drivers/md/dm-snap-persistent.c +4 -1
@@ -695,7 +695,7 @@ static int persistent_prepare_exception( }static void persistent_commit_exception (struct dm_exception_store *store, -struct dm_exception *e, +struct dm_exception *e,int valid,void (*callback) (void *,int success),void *callback_context) {
@@ -704,6 +704,9 @@ static void persistent_commit_exception(struct core_exception ce;struct commit_callback *cb; +if (!valid) + ps->valid =0 ; + ce.old_chunk = e->old_chunk; ce.new_chunk = e->new_chunk;write_exception (ps, ps->current_committed++, &ce);
drivers/md/dm-snap-transient.c +2 -2
@@ -52,12 +52,12 @@ static int transient_prepare_exception(s }static void transient_commit_exception (struct dm_exception_store *store, -struct dm_exception *e, +struct dm_exception *e,int valid,void (*callback) (void *,int success),void *callback_context) {/* Just succeed */ -callback (callback_context,1 ); +callback (callback_context, valid); } static void transient_usage(struct dm_exception_store *store,
drivers/md/dm-snap.c +5 -15
@@ -1438,8 +1438,9 @@ static void __invalidate_snapshot(structdm_table_event (s->ti->table); } -static void pending_complete (struct dm_snap_pending_exception *pe,int success) +static void pending_complete (void *context,int success) { +struct dm_snap_pending_exception *pe = context;struct dm_exception *e;struct dm_snapshot *s = pe->snap;struct bio *origin_bios =NULL ;
@@ -1509,24 +1510,13 @@ out:free_pending_exception (pe); } -static void commit_callback (void *context,int success) -{ -struct dm_snap_pending_exception *pe = context; - -pending_complete (pe, success); -} -static void complete_exception (struct dm_snap_pending_exception *pe) {struct dm_snapshot *s = pe->snap; -if (unlikely (pe->copy_error)) -pending_complete (pe,0 ); - -else -/* Update the metadata if we are persistent */ - s->store->type->commit_exception (s->store, &pe->e, - commit_callback, pe); +/* Update the metadata if we are persistent */ + s->store->type->commit_exception (s->store, &pe->e, !pe->copy_error, + pending_complete, pe); }/*
Greg Kroah-Hartman
maintainerPATCH 124/342 dm: fix dm_rq_target_io leak on faults with .request_fn DM w/ blk-mq paths
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 4328daa2e79ed904a42ce00a9f38b9c36b44b21a upstream.
Using request-based DM mpath configured with the following stacking (.request_fn DM mpath ontop of scsi-mq paths):
echo Y > /sys/module/scsi_mod/parameters/use_blk_mq echo N > /sys/module/dm_mod/parameters/use_blk_mq
'struct dm_rq_target_io' would leak if a request is requeued before a blk-mq clone is allocated (or fails to allocate). free_rq_tio() wasn't being called.
kmemleak reported:
unreferenced object 0xffff8800b90b98c0 (size 112):
comm "kworker/7:1H", pid 5692, jiffies 4295056109 (age 78.589s) hex dump (first 32 bytes):
00 d0 5c 2c 03 88 ff ff 40 00 bf 01 00 c9 ff ff ..\,....@.......
e0 d9 b1 34 00 88 ff ff 00 00 00 00 00 00 00 00 ...4............
backtrace:
[<ffffffff81672b6e>] kmemleak_alloc+0x4e/0xb0
[<ffffffff811dbb63>] kmem_cache_alloc+0xc3/0x1e0
[<ffffffff8117eae5>] mempool_alloc_slab+0x15/0x20
[<ffffffff8117ec1e>] mempool_alloc+0x6e/0x170
[<ffffffffa00029ac>] dm_old_prep_fn+0x3c/0x180 [dm_mod]
[<ffffffff812fbd78>] blk_peek_request+0x168/0x290
[<ffffffffa0003e62>] dm_request_fn+0xb2/0x1b0 [dm_mod]
[<ffffffff812f66e3>] __blk_run_queue+0x33/0x40
[<ffffffff812f9585>] blk_delay_work+0x25/0x40
[<ffffffff81096fff>] process_one_work+0x14f/0x3d0
[<ffffffff81097715>] worker_thread+0x125/0x4b0
[<ffffffff8109ce88>] kthread+0xd8/0xf0
[<ffffffff8167cb8f>] ret_from_fork+0x3f/0x70
[<ffffffffffffffff>] 0xffffffffffffffffcrash> struct -o dm_rq_target_io
struct dm_rq_target_io {
...
}SIZE: 112
--- drivers/md/dm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/dm.c +2 -0
@@ -1191,6 +1191,8 @@ static void dm_unprep_request(struct reqif (clone)free_rq_clone (clone); +else if (!tio->md->queue->mq_ops) +free_rq_tio (tio); }/*
Greg Kroah-Hartman
maintainerPATCH 125/342 coresight: checking for NULL string in coresight_name_match()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Poirier <[email protected]>
commit fadf3a44e974b030e7145218ad1ab25e3ef91738 upstream.
Connection child names associated to ports can sometimes be NULL, which is the case when booting a system on QEMU or when the Coresight power domain isn't switched on.
This patch is adding a check to make sure a NULL string isn't fed to strcmp(), something that avoid crashing the system.
--- drivers/hwtracing/coresight/coresight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight.c +1 -1
@@ -548,7 +548,7 @@ static int coresight_name_match(struct d to_match = data; i_csdev =to_coresight_device (dev); -if (!strcmp (to_match,dev_name (&i_csdev->dev))) +if (to_match && !strcmp (to_match,dev_name (&i_csdev->dev)))return 1 ;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 126/342 irqchip/omap-intc: Add support for spurious irq handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
commit d3b421cd07e4c0d4d6c0bbd55ca169c054fc081d upstream.
Under some conditions, irq sorting procedure used by INTC can go wrong resulting in a spurious irq getting reported.
If this condition is not handled, it results in endless stream of:
unexpected IRQ trap at vector 00
messages from ack_bad_irq()
Handle the spurious interrupt condition in omap-intc driver to prevent this.
Measurements using kernel function profiler on AM335x EVM running at 720MHz show that after this patch omap_intc_handle_irq() takes about 37.4us against 34us before this patch.
--- drivers/irqchip/irq-omap-intc.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/irqchip/irq-omap-intc.c +26 -1
@@ -47,6 +47,7 @@#define INTC_ILR0 0x0100#define ACTIVEIRQ_MASK 0x7f/* omap2/3 active interrupt bits */ +#define SPURIOUSIRQ_MASK (0x1ffffff << 7)#define INTCPS_NR_ILR_REGS 128#define INTCPS_NR_MIR_REGS 4
@@ -330,11 +331,35 @@ static int __init omap_init_irq(u32 base static asmlinkage void __exception_irq_entryomap_intc_handle_irq (struct pt_regs *regs) { +extern unsigned long irq_err_count;u32 irqnr; irqnr =intc_readl (INTC_SIR ); + +/* +* A spurious IRQ can result if interrupt that triggered the +* sorting is no longer active during the sorting (10 INTC +* functional clock cycles after interrupt assertion). Or a +* change in interrupt mask affected the result during sorting +* time. There is no special handling required except ignoring +* the SIR register value just read and retrying. +* See section 6.2.5 of AM335x TRM Literature Number: SPRUH73K +* +* Many a times, a spurious interrupt situation has been fixed +* by adding a flush for the posted write acking the IRQ in +* the device driver. Typically, this is going be the device +* driver whose interrupt was handled just before the spurious +* IRQ occurred. Pay attention to those device drivers if you +* run into hitting the spurious IRQ condition below. +*/ +if (unlikely ((irqnr &SPURIOUSIRQ_MASK ) ==SPURIOUSIRQ_MASK )) { +pr_err_once ("%s: spurious irq!\n" , __func__); + irq_err_count++; +omap_ack_irq (NULL ); +return ; + } + irqnr &=ACTIVEIRQ_MASK ; -WARN_ONCE (!irqnr,"Spurious IRQ ?\n" );handle_domain_irq (domain, irqnr, regs); }
Greg Kroah-Hartman
maintainerPATCH 127/342 irqchip/mxs: Add missing set_handle_irq()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
commit c5b635203032462603c503ecce91a7021c1ad44a upstream.
The rework of the driver missed to move the call to set_handle_irq() into asm9260_of_init(). As a consequence no interrupt entry point is installed and no interrupts are delivered
Solution is simple: Install the interrupt entry handler.
--- drivers/irqchip/irq-mxs.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-mxs.c +1 -0
@@ -241,6 +241,7 @@ static int __init asm9260_of_init(structwritel (0 , icoll_priv.intr + i);icoll_add_domain (np,ASM9260_NUM_IRQS ); +set_handle_irq (icoll_handle_irq);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 128/342 irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milo Kim <[email protected]>
commit 49f34134aea74f19ca016f055d25ee55ec359dee upstream.
Atmel AIC has common structure for SMR (Source Mode Register).
bit[6:5] Interrupt source type
bit[2:0] Priority level
Other bits are unused.
To update new priority value, bit[2:0] should be cleared first and then new priority level can be written. However, aic_common_set_priority() helper clears source type bits instead of priority bits. This patch fixes wrong mask bit operation.
--- drivers/irqchip/irq-atmel-aic-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -1
@@ -86,7 +86,7 @@ int aic_common_set_priority(int priority priority > AT91_AIC_IRQ_MAX_PRIORITY)return -EINVAL ; - *val &=AT91_AIC_PRIOR ; + *val &= ~AT91_AIC_PRIOR ; *val |= priority;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 129/342 irqchip/gic-v3-its: Fix double ICC_EOIR write for LPI in EOImode==1
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashok Kumar <[email protected]>
commit 004fa08d7aba2a13974446bf212a48c0b3b0d9fd upstream.
When the GIC is using EOImode==1, the EOI is done immediately, leaving the deactivation to be performed when the EOI was previously done.
Unfortunately, the ITS is not aware of the EOImode at all, and blindly EOIs the interrupt again. On most systems, this is ignored (despite being a programming error), but some others do raise a SError exception as there is no priority drop to perform for this interrupt.
The fix is to stop trying to be clever, and always call into the underlying GIC to perform the right access, irrespective of the more we're in.
[Marc: Reworked commit message]
--- drivers/irqchip/irq-gic-v3-its.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +1 -6
@@ -597,11 +597,6 @@ static void its_unmask_irq(struct irq_dalpi_set_config (d, true); } -static void its_eoi_irq (struct irq_data *d) -{ -gic_write_eoir (d->hwirq); -} -static int its_set_affinity (struct irq_data *d,const struct cpumask *mask_val,bool force) {
@@ -638,7 +633,7 @@ static struct irq_chip its_irq_chip = { .name = "ITS", .irq_mask = its_mask_irq, .irq_unmask = its_unmask_irq, - .irq_eoi = its_eoi_irq, + .irq_eoi = irq_chip_eoi_parent, .irq_set_affinity = its_set_affinity, .irq_compose_msi_msg = its_irq_compose_msi_msg, };
Greg Kroah-Hartman
maintainerPATCH 130/342 posix-clock: Fix return code on the poll methods error path
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Cochran <[email protected]>
commit 1b9f23727abb92c5e58f139e7d180befcaa06fe0 upstream.
The posix_clock_poll function is supposed to return a bit mask of POLLxxx values. However, in case the hardware has disappeared (due to hot plugging for example) this code returns -ENODEV in a futile attempt to throw an error at the file descriptor level. The kernel's file_operations interface does not accept such error codes from the poll method. Instead, this function aught to return POLLERR.
The value -ENODEV does, in fact, contain the POLLERR bit (and almost all the other POLLxxx bits as well), but only by chance. This patch fixes code to return a proper bit mask.
Credit goes to Markus Elfring for pointing out the suspicious signed/unsigned mismatch.
--- kernel/time/posix-clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/posix-clock.c +2 -2
@@ -69,10 +69,10 @@ static ssize_t posix_clock_read(struct fstatic unsigned int posix_clock_poll (struct file *fp,poll_table *wait) {struct posix_clock *clk =get_posix_clock (fp); -int result =0 ; +unsigned int result =0 ;if (!clk) -return -ENODEV ; +return POLLERR ;if (clk->ops.poll) result = clk->ops.poll (clk, fp, wait);
Greg Kroah-Hartman
maintainerPATCH 131/342 clockevents/tcb_clksrc: Prevent disabling an already disabled clock
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Belloni <[email protected]>
commit f02b4b72d12cbae7020a959e2ed0410a464b4cc4 upstream.
clockevents_exchange_device is calling clockevents_shutdown() on the new clockenvents device but it may have never been enabled in the first place. This results in the tcb clock being disabled without being enabled first:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:680 clk_disable+0x28/0x34() Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.4.0+ #6 Hardware name: Atmel AT91SAM9 [<c000f2b8>] (unwind_backtrace) from [<c000d01c>] (show_stack+0x10/0x14) [<c000d01c>] (show_stack) from [<c00172f0>] (warn_slowpath_common+0x78/0xa0) [<c00172f0>] (warn_slowpath_common) from [<c00173a8>] (warn_slowpath_null+0x18/0x20) [<c00173a8>] (warn_slowpath_null) from [<c0361528>] (clk_disable+0x28/0x34) [<c0361528>] (clk_disable) from [<c034d560>] (tc_shutdown+0x38/0x4c) [<c034d560>] (tc_shutdown) from [<c0059ad4>] (clockevents_switch_state+0x38/0x6c) [<c0059ad4>] (clockevents_switch_state) from [<c0059b18>] (clockevents_shutdown+0x10/0x24) [<c0059b18>] (clockevents_shutdown) from [<c005a458>] (tick_check_new_device+0x84/0xac) [<c005a458>] (tick_check_new_device) from [<c0059660>] (clockevents_register_device+0x7c/0x108) [<c0059660>] (clockevents_register_device) from [<c06b5a68>] (tcb_clksrc_init+0x390/0x3e8) [<c06b5a68>] (tcb_clksrc_init) from [<c00097cc>] (do_one_initcall+0x114/0x1d4) [<c00097cc>] (do_one_initcall) from [<c069bd54>] (kernel_init_freeable+0xfc/0x1b8) [<c069bd54>] (kernel_init_freeable) from [<c04c3818>] (kernel_init+0x8/0xe0) [<c04c3818>] (kernel_init) from [<c000a410>] (ret_from_fork+0x14/0x24) ---[ end trace 0000000000000001 ]---
Check what state we were in before trying to disable the clock.
--- drivers/clocksource/tcb_clksrc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clocksource/tcb_clksrc.c +2 -1
@@ -98,7 +98,8 @@ static int tc_shutdown(struct clock_even__raw_writel (0xff , regs +ATMEL_TC_REG (2 ,IDR ));__raw_writel (ATMEL_TC_CLKDIS , regs +ATMEL_TC_REG (2 ,CCR )); -clk_disable (tcd->clk); +if (!clockevent_state_detached (d)) +clk_disable (tcd->clk);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 132/342 mmc: usdhi6rol0: handle NULL data in timeout
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rabin Vincent <[email protected]>
commit 05caee939f8d58d81e962071da85761e1e3a4c73 upstream.
Commit bb08a7d489bd ("mmc: usdhi6rol0: fix NULL pointer deref in debug print") fixed one NULL pointer dereference but unfortunately introduced another. "data" may be NULL if this is a command timeout for a command without any data, so we should only use it if we're actually waiting for data.
--- drivers/mmc/host/usdhi6rol0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/usdhi6rol0.c +2 -1
@@ -1634,7 +1634,7 @@ static void usdhi6_timeout_work(struct w struct usdhi6_host *host = container_of(d, struct usdhi6_host, timeout_work);struct mmc_request *mrq = host->mrq;struct mmc_data *data = mrq ? mrq->data :NULL ; -struct scatterlist *sg = host->sg ?: data->sg; +struct scatterlist *sg; dev_warn(mmc_dev(host->mmc), "%s timeout wait %u CMD%d: IRQ 0x%08x:0x%08x, last IRQ 0x%08x\n",
@@ -1666,6 +1666,7 @@ static void usdhi6_timeout_work(struct wcase USDHI6_WAIT_FOR_MWRITE :case USDHI6_WAIT_FOR_READ :case USDHI6_WAIT_FOR_WRITE : + sg = host->sg ?: data->sg; dev_dbg(mmc_dev(host->mmc), "%c: page #%u @ +0x%zx %ux%u in SG%u. Current SG %u bytes @ %u\n", data->flags & MMC_DATA_READ ? 'R' : 'W', host->page_idx,
Greg Kroah-Hartman
maintainerPATCH 133/342 mmc: sdhci-pci: Do not default to 33 Ohm driver strength for Intel SPT
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 1ca896856281d3f1ad4f6f7d4e32e2943452de23 upstream.
In some cases, the stronger 33 Ohm driver strength must not be used so it is not a suitable default. Change it to the standard default 50 Ohm value.
The patch applies to v4.2+ except the file name changed. It is drivers/mmc/host/sdhci-pci.c prior to v.4.4.
--- drivers/mmc/host/sdhci-pci-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +1 -1
@@ -277,7 +277,7 @@ static int spt_select_drive_strength(strif (sdhci_pci_spt_drive_strength >0 ) drive_strength = sdhci_pci_spt_drive_strength &0xf ;else - drive_strength =1 ;/* 33-ohm */ + drive_strength =0 ;/* Default 50-ohm */ if ((mmc_driver_type_mask (drive_strength) & card_drv) ==0 ) drive_strength =0 ;/* Default 50-ohm */
Greg Kroah-Hartman
maintainerPATCH 134/342 mmc: sdhci: Fix DMA descriptor with zero data length
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 347ea32dc118326c4f2636928239a29d192cc9b8 upstream.
SDHCI has built-in DMA called ADMA2. ADMA2 uses a descriptor table to define DMA scatter-gather. Each desciptor can specify a data length up to 65536 bytes, however the length field is only 16-bits so zero means 65536. Consequently, putting zero when the size is zero must not be allowed. This patch fixes one case where zero data length could be set inadvertently.
The problem happens because unaligned data gets split and the code did not consider that the remaining aligned portion might be zero length. That case really only happens for SDIO because SD and eMMC cards transfer blocks that are invariably sector- aligned. For SDIO, access to function registers is done by data transfer (CMD53) when the register is bigger than 1 byte. Generally registers are 4 bytes but 2-byte registers are possible. So DMA of 4 bytes or less can happen. When 32-bit DMA is used, the data alignment must be 4, so 4-byte transfers won't casue a problem, but a 2-byte transfer could. However with the introduction of 64-bit DMA, the data alignment for 64-bit DMA was made 8 bytes, so all 4-byte transfers not on 8-byte boundaries get "split" into a 4-byte chunk and a 0-byte chunk, thereby hitting the bug.
In fact, a closer look at the SDHCI specs indicates that only the descriptor table requires 8-byte alignment for 64-bit DMA. That will be dealt with in a separate patch, but the potential for a 2-byte access remains, so this fix is needed anyway.
--- drivers/mmc/host/sdhci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +6 -3
@@ -540,9 +540,12 @@ static int sdhci_adma_table_pre(struct sBUG_ON (len >65536 ); -/* tran, valid */ -sdhci_adma_write_desc (host, desc, addr, len,ADMA2_TRAN_VALID ); - desc += host->desc_sz; +if (len) { +/* tran, valid */ +sdhci_adma_write_desc (host, desc, addr, len, +ADMA2_TRAN_VALID ); + desc += host->desc_sz; + }/* * If this triggers then we have a calculation bug
Greg Kroah-Hartman
maintainerPATCH 135/342 mmc: sdio: Fix invalid vdd in voltage switch power cycle
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit d9bfbb95ed598a09cf336adb0f190ee0ff802f0d upstream.
The 'ocr' parameter passed to mmc_set_signal_voltage() defines the power-on voltage used when power cycling after a failure to set the voltage. However, in the case of mmc_sdio_init_card(), the value passed has the R4_18V_PRESENT flag set which is not valid for power-on and results in an invalid vdd. Fix by passing the card's ocr value which does not have the flag.
--- drivers/mmc/core/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/sdio.c +1 -1
@@ -630,7 +630,7 @@ try_again:*/ if (!powered_resume && (rocr & ocr &R4_18V_PRESENT )) { err =mmc_set_signal_voltage (host,MMC_SIGNAL_VOLTAGE_180 , - ocr); + ocr_card);if (err == -EAGAIN ) {sdio_reset (host);mmc_go_idle (host);
Greg Kroah-Hartman
maintainerPATCH 136/342 mmc: mmc: Fix incorrect use of driver strength switching HS200 and HS400
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenkai Du <[email protected]>
commit adb24d42a516bca8b9741ed21206509daaab5b13 upstream.
Commit cc4f414c885c ("mmc: mmc: Add driver strength selection") added driver strength selection for eMMC HS200 and HS400 modes. That patch also set the driver stength when transitioning through High Speed mode to HS200/HS400, but driver strength is not defined for High Speed mode. While the JEDEC specification is not clear on this point it has been observed to cause problems for some eMMC, and removing the driver strength setting in this case makes it consistent with the normal use of High Speed mode.
--- drivers/mmc/core/mmc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/core/mmc.c +2 -4
@@ -1076,8 +1076,7 @@ static int mmc_select_hs400(struct mmc_cmmc_set_clock (host, max_dtr);/* Switch card to HS mode */ - val =EXT_CSD_TIMING_HS | - card->drive_strength <<EXT_CSD_DRV_STR_SHIFT ; + val =EXT_CSD_TIMING_HS ; err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, val, card->ext_csd.generic_cmd6_time,
@@ -1160,8 +1159,7 @@ int mmc_hs400_to_hs200(struct mmc_card *mmc_set_clock (host, max_dtr);/* Switch HS400 to HS DDR */ - val =EXT_CSD_TIMING_HS | - card->drive_strength <<EXT_CSD_DRV_STR_SHIFT ; + val =EXT_CSD_TIMING_HS ; err =__mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_HS_TIMING , val, card->ext_csd.generic_cmd6_time, true, send_status, true);
Greg Kroah-Hartman
maintainerPATCH 137/342 mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 5c671c410c8704800f4f1673b6f572137e7e6ddd upstream.
sdhci has a legacy facility to prevent runtime suspend if the bus power is on. This is needed in cases where the power to the card is dependent on the bus power. It is controlled by a pair of functions: sdhci_runtime_pm_bus_on() and sdhci_runtime_pm_bus_off(). These functions use a boolean variable 'bus_on' to ensure changes are always paired. There is an additional check for 'runtime_suspended' which is the problem. In fact, its use is ill-conceived as the only requirement for the logic is that 'on' and 'off' are paired, which is actually broken by the check, for example if the bus power is turned on during runtime resume. So remove the check.
--- drivers/mmc/host/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +2 -2
@@ -2763,7 +2763,7 @@ static int sdhci_runtime_pm_put(struct sstatic void sdhci_runtime_pm_bus_on (struct sdhci_host *host) { -if (host->runtime_suspended || host->bus_on) +if (host->bus_on)return ; host->bus_on = true;pm_runtime_get_noresume (host->mmc->parent);
@@ -2771,7 +2771,7 @@ static void sdhci_runtime_pm_bus_on(strustatic void sdhci_runtime_pm_bus_off (struct sdhci_host *host) { -if (host->runtime_suspended || !host->bus_on) +if (!host->bus_on)return ; host->bus_on = false;pm_runtime_put_noidle (host->mmc->parent);
Greg Kroah-Hartman
maintainerPATCH 138/342 mmc: core: Enable tuning according to the actual timing
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlo Caione <[email protected]>
commit e10c321977091f163eceedec0650e0ef4b3cf4bb upstream.
While in sdhci_execute_tuning() the choice whether or not to enable the tuning is done on the actual timing, in the mmc_sdio_init_uhs_card() the check is done on the capability of the card.
This difference is causing some issues with some SDIO cards in DDR50 mode where the CDM19 is wrongly issued.
With this patch we modify the check in both mmc_(sd|sdio)_init_uhs_card() functions to take the proper decision only according to the actual timing specification.
--- drivers/mmc/core/sd.c | 8 ++++---- drivers/mmc/core/sdio.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/mmc/core/sd.c +4 -4
@@ -626,9 +626,9 @@ static int mmc_sd_init_uhs_card(struct m* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104. */ if (!mmc_host_is_spi (card->host) && - (card->sd_bus_speed ==UHS_SDR50_BUS_SPEED || - card->sd_bus_speed ==UHS_DDR50_BUS_SPEED || - card->sd_bus_speed ==UHS_SDR104_BUS_SPEED )) { + (card->host->ios.timing ==MMC_TIMING_UHS_SDR50 || + card->host->ios.timing ==MMC_TIMING_UHS_DDR50 || + card->host->ios.timing ==MMC_TIMING_UHS_SDR104 )) { err =mmc_execute_tuning (card);/*
@@ -638,7 +638,7 @@ static int mmc_sd_init_uhs_card(struct m* difference between v3.00 and 3.01 spec means that CMD19 * tuning is also available for DDR50 mode. */ -if (err && card->sd_bus_speed ==UHS_DDR50_BUS_SPEED ) { +if (err && card->host->ios.timing ==MMC_TIMING_UHS_DDR50 ) {pr_warn ("%s: ddr50 tuning failed\n" ,mmc_hostname (card->host)); err =0 ;
drivers/mmc/core/sdio.c +2 -2
@@ -535,8 +535,8 @@ static int mmc_sdio_init_uhs_card(struct* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104. */ if (!mmc_host_is_spi (card->host) && - ((card->sw_caps.sd3_bus_mode &SD_MODE_UHS_SDR50 ) || - (card->sw_caps.sd3_bus_mode &SD_MODE_UHS_SDR104 ))) + ((card->host->ios.timing ==MMC_TIMING_UHS_SDR50 ) || + (card->host->ios.timing ==MMC_TIMING_UHS_SDR104 ))) err =mmc_execute_tuning (card); out:return err;
Greg Kroah-Hartman
maintainerPATCH 139/342 mmc: mmci: fix an ages old detection error
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit 0bcb7efdff63564e80fe84dd36a9fbdfbf6697a4 upstream.
commit 4956e10903fd ("ARM: 6244/1: mmci: add variant data and default MCICLOCK support") added variant data for ARM, U300 and Ux500 variants. The Nomadik NHK8815/8820 variant was erroneously labeled as a U300 variant, and when the proper Nomadik variant was later introduced in commit 34fd421349ff ("ARM: 7378/1: mmci: add support for the Nomadik MMCI variant") this was not fixes. Let's say this fixes the latter commit as there was no proper Nomadik support until then.
--- drivers/mmc/host/mmci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mmci.c +1 -1
@@ -1886,7 +1886,7 @@ static struct amba_id mmci_ids[] = { { .id = 0x00280180, .mask = 0x00ffffff, - .data = &variant_u300, + .data = &variant_nomadik, }, { .id = 0x00480180,
Greg Kroah-Hartman
maintainerPATCH 140/342 mmc: sdhci-acpi: Fix card detect race for Intel BXT/APL
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 6a645dd87a5a506779810d7d9935c25fc2ef4687 upstream.
Intel BXT/APL use a card detect GPIO however the host controller will not enable bus power unless it's card detect also reflects the presence of a card. Unfortunately those 2 things race which can result in commands not starting, after which the controller does nothing and there is a 10 second wait for the driver's 10-second timer to timeout.
That is fixed by having the driver look also at the present state register to determine if the card is present. Consequently, provide a 'get_cd' mmc host operation for BXT/APL that does that.
--- drivers/mmc/host/sdhci-acpi.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/mmc/host/sdhci-acpi.c +30 -0
@@ -146,6 +146,33 @@ static const struct sdhci_acpi_chip sdhc .ops = &sdhci_acpi_ops_int, }; +static int bxt_get_cd (struct mmc_host *mmc) +{ +int gpio_cd =mmc_gpio_get_cd (mmc); +struct sdhci_host *host =mmc_priv (mmc); +unsigned long flags; +int ret =0 ; + +if (!gpio_cd) +return 0 ; + +pm_runtime_get_sync (mmc->parent); + +spin_lock_irqsave (&host->lock, flags); + +if (host->flags &SDHCI_DEVICE_DEAD ) + goto out; + + ret = !!(sdhci_readl (host,SDHCI_PRESENT_STATE ) &SDHCI_CARD_PRESENT ); +out: +spin_unlock_irqrestore (&host->lock, flags); + +pm_runtime_mark_last_busy (mmc->parent); +pm_runtime_put_autosuspend (mmc->parent); + +return ret; +} +static int sdhci_acpi_emmc_probe_slot (struct platform_device *pdev,const char *hid,const char *uid) {
@@ -196,6 +223,9 @@ static int sdhci_acpi_sd_probe_slot(stru/* Platform specific code during sd probe slot goes here */ +if (hid && !strcmp (hid,"80865ACA" )) + host->mmc_host_ops.get_cd = bxt_get_cd; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 141/342 mmc: pxamci: fix again read-only gpio detection polarity
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Jarzmik <[email protected]>
commit 41c89159a6ae5472d39ed8bded5b3b4e07a37944 upstream.
The commit fixing the conversion of pxamci to slot-gpio API fixed the inverted the logic of the read-only gpio. Unfortunately, the commit was tested on a non-inverted gpio, and not on the inverted one. And the fix did work partially, by luck.
This is the remaining missing part of the fix, trivial but still necessary.
--- drivers/mmc/host/pxamci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/pxamci.c +1 -1
@@ -804,7 +804,7 @@ static int pxamci_probe(struct platform_dev_err (&pdev->dev,"Failed requesting gpio_ro %d\n" , gpio_ro); goto out; }else { - mmc->caps |= host->pdata->gpio_card_ro_invert ? + mmc->caps2 |= host->pdata->gpio_card_ro_invert ?0 :MMC_CAP2_RO_ACTIVE_HIGH ; }
Greg Kroah-Hartman
maintainerPATCH 142/342 mmc: sdhci-pci: Fix card detect race for Intel BXT/APL
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 163cbe31e5163459908a41a2b4e0d33a28fd557a upstream.
Intel BXT/APL use a card detect GPIO however the host controller will not enable bus power unless it's card detect also reflects the presence of a card. Unfortunately those 2 things race which can result in commands not starting, after which the controller does nothing and there is a 10 second wait for the driver's 10-second timer to timeout.
That is fixed by having the driver look also at the present state register to determine if the card is present. Consequently, provide a 'get_cd' mmc host operation for BXT/APL that does that.
--- drivers/mmc/host/sdhci-pci-core.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +31 -0
@@ -330,6 +330,33 @@ static void spt_read_drive_strength(stru sdhci_pci_spt_drive_strength =0x10 | ((val >>12 ) &0xf ); } +static int bxt_get_cd (struct mmc_host *mmc) +{ +int gpio_cd =mmc_gpio_get_cd (mmc); +struct sdhci_host *host =mmc_priv (mmc); +unsigned long flags; +int ret =0 ; + +if (!gpio_cd) +return 0 ; + +pm_runtime_get_sync (mmc->parent); + +spin_lock_irqsave (&host->lock, flags); + +if (host->flags &SDHCI_DEVICE_DEAD ) + goto out; + + ret = !!(sdhci_readl (host,SDHCI_PRESENT_STATE ) &SDHCI_CARD_PRESENT ); +out: +spin_unlock_irqrestore (&host->lock, flags); + +pm_runtime_mark_last_busy (mmc->parent); +pm_runtime_put_autosuspend (mmc->parent); + +return ret; +} +static int byt_emmc_probe_slot (struct sdhci_pci_slot *slot) { slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
@@ -362,6 +389,10 @@ static int byt_sd_probe_slot(struct sdhc slot->cd_con_id =NULL ; slot->cd_idx =0 ; slot->cd_override_level = true; +if (slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_BXT_SD || + slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_APL_SD ) + slot->host->mmc_host_ops.get_cd = bxt_get_cd; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 143/342 mmc: sdhci: Allow override of mmc host operations
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit bf60e592a1af4d6f65dd54593250183f14360eed upstream.
In the past, fixes for specific hardware devices were implemented in sdhci using quirks. That approach is no longer accepted because the growing number of quirks was starting to make the code difficult to understand and maintain.
One alternative to quirks, is to allow drivers to override the default mmc host operations. This patch makes it easy to do that, and it is needed for a subsequent bug fix, for which separate patches are provided.
--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
@@ -2864,6 +2864,8 @@ struct sdhci_host *sdhci_alloc_host(stru host =mmc_priv (mmc); host->mmc = mmc; + host->mmc_host_ops = sdhci_ops; + mmc->ops = &host->mmc_host_ops;return host; }
@@ -3060,7 +3062,6 @@ int sdhci_add_host(struct sdhci_host *ho/* * Set host parameters. */ - mmc->ops = &sdhci_ops; max_clk = host->max_clk;if (host->ops->get_min_clock)
drivers/mmc/host/sdhci.h +1 -0
@@ -425,6 +425,7 @@ struct sdhci_host {/* Internal data */ struct mmc_host *mmc;/* MMC structure */ +struct mmc_host_ops mmc_host_ops;/* MMC host ops */ u64 dma_mask;/* custom DMA mask */ #if defined(CONFIG_LEDS_CLASS ) || defined(CONFIG_LEDS_CLASS_MODULE )
Greg Kroah-Hartman
maintainerPATCH 144/342 mmc: sdhci: Allow override of get_cd() called from sdhci_request()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 8d28b7a72fe18bcdcdb047243ba8fec36b149955 upstream.
Drivers may need to provide their own get_cd() mmc host op, but currently the internals of the current op (sdhci_get_cd()) are provided by sdhci_do_get_cd() which is also called from sdhci_request().
To allow override of the get_cd functionality, change sdhci_request() to call ->get_cd() instead of sdhci_do_get_cd().
Note, in the future the call to ->get_cd() will likely be removed from sdhci_request() since most drivers don't need actually it. However this change is being done now to facilitate a subsequent bug fix.
--- drivers/mmc/host/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
@@ -1367,7 +1367,7 @@ static void sdhci_request(struct mmc_hossdhci_runtime_pm_get (host);/* Firstly check card presence */ - present =sdhci_do_get_cd (host); + present = mmc->ops->get_cd (mmc);spin_lock_irqsave (&host->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 145/342 tools: hv: vss: fix the write()s argument: error -> vss_msg
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dexuan Cui <[email protected]>
commit a689d2510f188e75391dbebacbddfd74d42f2a7e upstream.
Fix the write()'s argument in the daemon code.
--- tools/hv/hv_vss_daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hv/hv_vss_daemon.c +1 -1
@@ -254,7 +254,7 @@ int main(int argc, char *argv[])syslog (LOG_ERR ,"Illegal op:%d\n" , op); } vss_msg->error = error; - len =write (vss_fd, &error,sizeof (struct hv_vss_msg )); + len =write (vss_fd, vss_msg,sizeof (struct hv_vss_msg ));if (len !=sizeof (struct hv_vss_msg )) {syslog (LOG_ERR ,"write failed; error: %d %s" , errno,strerror (errno));
Greg Kroah-Hartman
maintainerPATCH 146/342 Drivers: hv: vmbus: Fix a Host signaling bug
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: K. Y. Srinivasan <[email protected]>
commit 8599846d73997cdbccf63f23394d871cfad1e5e6 upstream.
Currently we have two policies for deciding when to signal the host:
One based on the ring buffer state and the other based on what the VMBUS client driver wants to do. Consider the case when the client wants to explicitly control when to signal the host. In this case, if the client were to defer signaling, we will not be able to signal the host subsequently when the client does want to signal since the ring buffer state will prevent the signaling. Implement logic to have only one signaling policy in force for a given channel.
--- drivers/hv/channel.c | 18 ++++++++++++++++++ include/linux/hyperv.h | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+)
drivers/hv/channel.c +18 -0
@@ -630,10 +630,19 @@ int vmbus_sendpacket_ctl(struct vmbus_ch* on the ring. We will not signal if more data is * to be placed. * +* Based on the channel signal state, we will decide +* which signaling policy will be applied. +* * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + +if (channel->signal_policy) + signal = true; +else + kick_q = true; +if (((ret ==0 ) && kick_q && signal) || (ret))vmbus_setevent (channel);
@@ -733,10 +742,19 @@ int vmbus_sendpacket_pagebuffer_ctl(stru* on the ring. We will not signal if more data is * to be placed. * +* Based on the channel signal state, we will decide +* which signaling policy will be applied. +* * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + +if (channel->signal_policy) + signal = true; +else + kick_q = true; +if (((ret ==0 ) && kick_q && signal) || (ret))vmbus_setevent (channel);
include/linux/hyperv.h +18 -0
@@ -630,6 +630,11 @@ struct hv_input_signal_event_buffer {struct hv_input_signal_event event; }; +enum hv_signal_policy { +HV_SIGNAL_POLICY_DEFAULT =0 , +HV_SIGNAL_POLICY_EXPLICIT , +}; +struct vmbus_channel {/* Unique channel id */ int id;
@@ -757,8 +762,21 @@ struct vmbus_channel {* link up channels based on their CPU affinity. */ struct list_head percpu_list; +/* +* Host signaling policy: The default policy will be +* based on the ring buffer state. We will also support +* a policy where the client driver can have explicit +* signaling control. +*/ +enum hv_signal_policy signal_policy; }; +static inline void set_channel_signal_state (struct vmbus_channel *c, +enum hv_signal_policy policy) +{ + c->signal_policy = policy; +} +static inline void set_channel_read_state (struct vmbus_channel *c,bool state) { c->batched_reading = state;
Greg Kroah-Hartman
maintainerPATCH 147/342 Bluetooth: Use continuous scanning when creating LE connections
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hedberg <[email protected]>
commit 2f99536a5b34d5b0f54723067d68f6cef3f0fdc6 upstream.
All LE connections are now triggered through a preceding passive scan and waiting for a connectable advertising report. This means we've got the best possible guarantee that the device is within range and should be able to request the controller to perform continuous scanning. This way we minimize the risk that we miss out on any advertising packets.
--- net/bluetooth/hci_conn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/bluetooth/hci_conn.c +5 -1
@@ -722,8 +722,12 @@ static void hci_req_add_le_create_conn(sif (hci_update_random_address (req, false, &own_addr_type))return ; +/* Set window to be the same value as the interval to enable +* continuous scanning. +*/ cp.scan_interval =cpu_to_le16 (hdev->le_scan_interval); - cp.scan_window =cpu_to_le16 (hdev->le_scan_window); + cp.scan_window = cp.scan_interval; +bacpy (&cp.peer_addr, &conn->dst); cp.peer_addr_type = conn->dst_type; cp.own_address_type = own_addr_type;
Greg Kroah-Hartman
maintainerPATCH 148/342 Bluetooth: Add support of Toshiba Broadcom based devices
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit 1623d0bf847d3b38d8cf24367b3689ba0e3fe2aa upstream.
T: Bus=03 Lev=02 Prnt=02 Port=05 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0930 ProdID=0225 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM43142A0
S: SerialNumber=4CBB58034671
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)--- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bluetooth/btusb.c +4 -0
@@ -153,6 +153,10 @@ static const struct usb_device_id btusb_ { USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01), .driver_info = BTUSB_BCM_PATCHRAM }, + /* Toshiba Corp - Broadcom based */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0930, 0xff, 0x01, 0x01), + .driver_info = BTUSB_BCM_PATCHRAM }, + /* Intel Bluetooth USB Bootloader (RAM module) */ { USB_DEVICE(0x8087, 0x0a5a), .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },
Greg Kroah-Hartman
maintainerPATCH 149/342 Bluetooth: Fix incorrect removing of IRKs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hedberg <[email protected]>
commit cff10ce7b4f02718ffd25e3914e60559f5ef6ca0 upstream.
The commit cad20c278085d893ebd616cd20c0747a8e9d53c7 was supposed to fix handling of devices first using public addresses and then switching to RPAs after pairing. Unfortunately it missed a couple of key places in the code.
1. When evaluating which devices should be removed from the existing white list we also need to consider whether we have an IRK for them or not, i.e. a call to hci_find_irk_by_addr() is needed.
2. In smp_notify_keys() we should not be requiring the knowledge of the RPA, but should simply keep the IRK around if the other conditions require it.
--- net/bluetooth/hci_request.c | 28 ++++++++++++++++++---------- net/bluetooth/smp.c | 16 ---------------- 2 files changed, 18 insertions(+), 26 deletions(-)
net/bluetooth/hci_request.c +18 -10
@@ -175,21 +175,29 @@ static u8 update_white_list(struct hci_r* command to remove it from the controller. */ list_for_each_entry (b, &hdev->le_white_list, list) { -struct hci_cp_le_del_from_white_list cp; +/* If the device is neither in pend_le_conns nor +* pend_le_reports then remove it from the whitelist. +*/ +if (!hci_pend_le_action_lookup (&hdev->pend_le_conns, + &b->bdaddr, b->bdaddr_type) && + !hci_pend_le_action_lookup (&hdev->pend_le_reports, + &b->bdaddr, b->bdaddr_type)) { +struct hci_cp_le_del_from_white_list cp; -if (hci_pend_le_action_lookup (&hdev->pend_le_conns, - &b->bdaddr, b->bdaddr_type) || -hci_pend_le_action_lookup (&hdev->pend_le_reports, - &b->bdaddr, b->bdaddr_type)) { - white_list_entries++; + cp.bdaddr_type = b->bdaddr_type; +bacpy (&cp.bdaddr, &b->bdaddr); + +hci_req_add (req,HCI_OP_LE_DEL_FROM_WHITE_LIST , +sizeof (cp), &cp);continue ; } - cp.bdaddr_type = b->bdaddr_type; -bacpy (&cp.bdaddr, &b->bdaddr); +if (hci_find_irk_by_addr (hdev, &b->bdaddr, b->bdaddr_type)) { +/* White list can not be used with RPAs */ +return 0x00 ; + } -hci_req_add (req,HCI_OP_LE_DEL_FROM_WHITE_LIST , -sizeof (cp), &cp); + white_list_entries++; }/* Since all no longer valid white list entries have been
net/bluetooth/smp.c +0 -16
@@ -1072,22 +1072,6 @@ static void smp_notify_keys(struct l2cap hcon->dst_type = smp->remote_irk->addr_type;queue_work (hdev->workqueue, &conn->id_addr_update_work); } - -/* When receiving an indentity resolving key for -* a remote device that does not use a resolvable -* private address, just remove the key so that -* it is possible to use the controller white -* list for scanning. -* -* Userspace will have been told to not store -* this key at this point. So it is safe to -* just remove it. -*/ -if (!bacmp (&smp->remote_irk->rpa,BDADDR_ANY )) { -list_del_rcu (&smp->remote_irk->list); -kfree_rcu (smp->remote_irk, rcu); - smp->remote_irk =NULL ; - } }if (smp->csrk) {
Greg Kroah-Hartman
maintainerPATCH 150/342 Bluetooth: 6lowpan: Fix kernel NULL pointer dereferences
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Glenn Ruben Bakke <[email protected]>
commit 4c58f3282e3de43d34f8955f8eca676294380bf9 upstream.
The fixes provided in this patch assigns a valid net_device structure to skb before dispatching it for further processing.
Scenario #1:
============
Bluetooth 6lowpan receives an uncompressed IPv6 header, and dispatches it to netif. The following error occurs:
Null pointer dereference error #1 crash log:
[ 845.854013] BUG: unable to handle kernel NULL pointer dereference at
0000000000000048
[ 845.855785] IP: [<ffffffff816e3d36>] enqueue_to_backlog+0x56/0x240
...
[ 845.909459] Call Trace:
[ 845.911678] [<ffffffff816e3f64>] netif_rx_internal+0x44/0xf0The first modification fixes the NULL pointer dereference error by assigning dev to the local_skb in order to set a valid net_device before processing the skb by netif_rx_ni().
Scenario #2:
============
Bluetooth 6lowpan receives an UDP compressed message which needs further decompression by nhc_udp. The following error occurs:
Null pointer dereference error #2 crash log:
[ 63.295149] BUG: unable to handle kernel NULL pointer dereference at
0000000000000840
[ 63.295931] IP: [<ffffffffc0559540>] udp_uncompress+0x320/0x626
[nhc_udp]The second modification fixes the NULL pointer dereference error by assigning dev to the local_skb in the case of a udp compressed packet. The 6lowpan udp_uncompress function expects that the net_device is set in the skb when checking lltype.
--- net/bluetooth/6lowpan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/6lowpan.c +3 -1
@@ -317,6 +317,7 @@ static int recv_pkt(struct sk_buff *skb, local_skb->protocol =htons (ETH_P_IPV6 ); local_skb->pkt_type =PACKET_HOST ; + local_skb->dev = dev;skb_set_transport_header (local_skb,sizeof (struct ipv6hdr ));
@@ -335,6 +336,8 @@ static int recv_pkt(struct sk_buff *skb,if (!local_skb) goto drop; + local_skb->dev = dev; + ret =iphc_decompress (local_skb, dev, chan);if (ret <0 ) {kfree_skb (local_skb);
@@ -343,7 +346,6 @@ static int recv_pkt(struct sk_buff *skb, local_skb->protocol =htons (ETH_P_IPV6 ); local_skb->pkt_type =PACKET_HOST ; - local_skb->dev = dev;if (give_skb_to_upper (local_skb, dev) !=NET_RX_SUCCESS ) {
Greg Kroah-Hartman
maintainerPATCH 151/342 Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Duda <[email protected]>
commit 87f5fedb3bebbbb566f847dd0c567fcea49a36a6 upstream.
This patch fixes incorrect handling of the 6lowpan packets that contain uncompressed IPv6 header.
RFC4944 specifies a special dispatch for 6lowpan to carry uncompressed IPv6 header. This dispatch (1 byte long) has to be removed during reception and skb data pointer has to be moved. To correctly point in the beginning of the IPv6 header the dispatch byte has to be pulled off before packet can be processed by netif_rx_in().
Test scenario: IPv6 packets are not correctly interpreted by the network layer when IPv6 header is not compressed (e.g. ICMPv6 Echo Reply is not propagated correctly to the ICMPv6 layer because the extra byte will make the header look corrupted).
Similar approach is done for IEEE 802.15.4.
--- net/bluetooth/6lowpan.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/6lowpan.c +3 -0
@@ -307,6 +307,9 @@ static int recv_pkt(struct sk_buff *skb,/* check that it's our buffer */ if (lowpan_is_ipv6 (*skb_network_header (skb))) { +/* Pull off the 1-byte of 6lowpan header. */ +skb_pull (skb,1 ); +/* Copy the packet so that the IPv6 header is * properly aligned. */
Greg Kroah-Hartman
maintainerPATCH 152/342 time: Avoid signed overflow in timekeeping_get_ns()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gibson <[email protected]>
commit 35a4933a895927990772ae96fdcfd2f806929ee2 upstream.
1e75fa8 "time: Condense timekeeper.xtime into xtime_sec" replaced a call to clocksource_cyc2ns() from timekeeping_get_ns() with an open-coded version of the same logic to avoid keeping a semi-redundant struct timespec in struct timekeeper.
However, the commit also introduced a subtle semantic change - where clocksource_cyc2ns() uses purely unsigned math, the new version introduces a signed temporary, meaning that if (delta * tk->mult) has a 63-bit overflow the following shift will still give a negative result. The choice of 'maxsec' in __clocksource_updatefreq_scale() means this will generally happen if there's a ~10 minute pause in examining the clocksource.
This can be triggered on a powerpc KVM guest by stopping it from qemu for a bit over 10 minutes. After resuming time has jumped backwards several minutes causing numerous problems (jiffies does not advance, msleep()s can be extended by minutes..). It doesn't happen on x86 KVM guests, because the guest TSC is effectively frozen while the guest is stopped, which is not the case for the powerpc timebase.
Obviously an unsigned (64 bit) overflow will only take twice as long as a signed, 63-bit overflow. I don't know the time code well enough to know if that will still cause incorrect calculations, or if a 64-bit overflow is avoided elsewhere.
Still, an incorrect forwards clock adjustment will cause less trouble than time going backwards. So, this patch removes the potential for intermediate signed overflow.
--- kernel/time/timekeeping.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/time/timekeeping.c +1 -2
@@ -305,8 +305,7 @@ static inline s64 timekeeping_get_ns(str delta =timekeeping_get_delta (tkr); - nsec = delta * tkr->mult + tkr->xtime_nsec; - nsec >>= tkr->shift; + nsec = (delta * tkr->mult + tkr->xtime_nsec) >> tkr->shift;/* If arch requires, add in get_arch_timeoffset() */ return nsec +arch_gettimeoffset ();
Greg Kroah-Hartman
maintainerPATCH 153/342 cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: zengtao <[email protected]>
commit 0f26922fe5dc5724b1adbbd54b21bad03590b4f3 upstream.
The datatype __kernel_time_t is u32 on 32bit platform, so its subject to overflows in the timeval/timespec to cputime conversion.
Currently the following functions are affected:
1. setitimer()
2. timer_create/timer_settime()
3. sys_clock_nanosleep
This can happen on MIPS32 and ARM32 with "Full dynticks CPU time accounting" enabled, which is required for CONFIG_NO_HZ_FULL.
Enforce u64 conversion to prevent the overflow.
--- include/asm-generic/cputime_nsecs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/asm-generic/cputime_nsecs.h +3 -2
@@ -75,7 +75,7 @@ typedef u64 __nocast cputime64_t;*/ static inline cputime_t timespec_to_cputime (const struct timespec *val) { -u64 ret = val->tv_sec *NSEC_PER_SEC + val->tv_nsec; +u64 ret = (u64 )val->tv_sec *NSEC_PER_SEC + val->tv_nsec;return (__force cputime_t ) ret; }static inline void cputime_to_timespec (const cputime_t ct,struct timespec *val)
@@ -91,7 +91,8 @@ static inline void cputime_to_timespec(c*/ static inline cputime_t timeval_to_cputime (const struct timeval *val) { -u64 ret = val->tv_sec *NSEC_PER_SEC + val->tv_usec *NSEC_PER_USEC ; +u64 ret = (u64 )val->tv_sec *NSEC_PER_SEC + + val->tv_usec *NSEC_PER_USEC ;return (__force cputime_t ) ret; }static inline void cputime_to_timeval (const cputime_t ct,struct timeval *val)
Greg Kroah-Hartman
maintainerPATCH 154/342 Revert "MIPS: Fix PAGE_MASK definition"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 800dc4f49cc002879e1e5e6b79926f86b60528e6 upstream.
This reverts commit 22b14523994588279ae9c5ccfe64073c1e5b3c00.
It was originally sent in an earlier revision of the pfn_t patchset. Besides being broken, the warning is also fixed by PFN_FLAGS_MASK casting the PAGE_MASK to an unsigned long.
Patchwork: https://patchwork.linux-mips.org/patch/12182/
--- arch/mips/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/page.h +1 -1
@@ -33,7 +33,7 @@#define PAGE_SHIFT 16#endif #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))/* * This is used for calculating the real page sizes
Greg Kroah-Hartman
maintainerPATCH 155/342 MIPS: Loongson-3: Fix SMP_ASK_C0COUNT IPI handler
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 5754843225f78ac7cbe142a6899890a9733a5a5d upstream.
When Core-0 handle SMP_ASK_C0COUNT IPI, we should make other cores to see the result as soon as possible (especially when Store-Fill-Buffer is enabled). Otherwise, C0_Count syncronization makes no sense.
BTW, array is more suitable than per-cpu variable for syncronization, and there is a corner case should be avoid: C0_Count of Core-0 can be really 0.
Patchwork: https://patchwork.linux-mips.org/patch/12160/
--- arch/mips/loongson64/loongson-3/smp.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
arch/mips/loongson64/loongson-3/smp.c +13 -7
@@ -30,13 +30,13 @@#include "smp.h" DEFINE_PER_CPU (int, cpu_state); -DEFINE_PER_CPU (uint32_t, core0_c0count);static void *ipi_set0_regs[16 ];static void *ipi_clear0_regs[16 ];static void *ipi_status0_regs[16 ];static void *ipi_en0_regs[16 ];static void *ipi_mailbox_buf[16 ]; +static uint32_t core0_c0count[NR_CPUS ];/* read a 32bit value from ipi register */ #define loongson3_ipi_read32 (addr) readl(addr)
@@ -275,12 +275,14 @@ void loongson3_ipi_interrupt(struct pt_rif (action &SMP_ASK_C0COUNT ) {BUG_ON (cpu !=0 ); c0count =read_c0_count (); -for (i =1 ; i <num_possible_cpus (); i++) -per_cpu (core0_c0count, i) = c0count; + c0count = c0count ? c0count :1 ; +for (i =1 ; i < nr_cpu_ids; i++) + core0_c0count[i] = c0count; +__wbflush ();/* Let others see the result ASAP */ } } -#define MAX_LOOPS 1111 +#define MAX_LOOPS 800/* * SMP init and finish on secondary CPUs */
@@ -305,16 +307,20 @@ static void loongson3_init_secondary(voicpu_logical_map (cpu) / loongson_sysconf.cores_per_package; i =0 ; -__this_cpu_write (core0_c0count,0 ); + core0_c0count[cpu] =0 ;loongson3_send_ipi_single (0 ,SMP_ASK_C0COUNT ); -while (!__this_cpu_read (core0_c0count)) { +while (!core0_c0count[cpu]) { i++;cpu_relax (); }if (i >MAX_LOOPS ) i =MAX_LOOPS ; - initcount =__this_cpu_read (core0_c0count) + i; +if (cpu_data[cpu].package) + initcount = core0_c0count[cpu] + i; +else /* Local access is faster for loops */ + initcount = core0_c0count[cpu] + i/2 ; +write_c0_count (initcount); }
Greg Kroah-Hartman
maintainerPATCH 156/342 MIPS: hpet: Choose a safe value for the ETIME check
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 5610b1254e3689b6ef8ebe2db260709a74da06c8 upstream.
This patch is borrowed from x86 hpet driver and explaind below:
Due to the overly intelligent design of HPETs, we need to workaround the problem that the compare value which we write is already behind the actual counter value at the point where the value hits the real compare register. This happens for two reasons:
1) We read out the counter, add the delta and write the result to the compare register. When a NMI hits between the read out and the write then the counter can be ahead of the event already.
2) The write to the compare register is delayed by up to two HPET cycles in AMD chipsets.
We can work around this by reading back the compare register to make sure that the written value has hit the hardware. But that is bad performance wise for the normal case where the event is far enough in the future.
As we already know that the write can be delayed by up to two cycles we can avoid the read back of the compare register completely if we make the decision whether the delta has elapsed already or not based on the following calculation:
cmp = event - actual_count;
If cmp is less than 64 HPET clock cycles, then we decide that the event has happened already and return -ETIME. That covers the above #1 and #2 problems which would cause a wait for HPET wraparound (~306 seconds).
Patchwork: https://patchwork.linux-mips.org/patch/12162/
--- arch/mips/loongson64/loongson-3/hpet.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/mips/loongson64/loongson-3/hpet.c +7 -3
@@ -13,6 +13,9 @@#define SMBUS_PCI_REG64 0x64#define SMBUS_PCI_REGB4 0xb4 +#define HPET_MIN_CYCLES 64 +#define HPET_MIN_PROG_DELTA (HPET_MIN_CYCLES + (HPET_MIN_CYCLES >> 1)) +static DEFINE_SPINLOCK (hpet_lock); DEFINE_PER_CPU(struct clock_event_device, hpet_clockevent_device);
@@ -161,8 +164,9 @@ static int hpet_next_event(unsigned long cnt += delta;hpet_write (HPET_T0_CMP , cnt); - res = ((int )(hpet_read (HPET_COUNTER ) - cnt) >0 ) ? -ETIME :0 ; -return res; + res = (int )(cnt -hpet_read (HPET_COUNTER )); + +return res <HPET_MIN_CYCLES ? -ETIME :0 ; }static irqreturn_t hpet_irq_handler (int irq,void *data)
@@ -237,7 +241,7 @@ void __init setup_hpet_timer(void) cd->cpumask =cpumask_of (cpu);clockevent_set_clock (cd,HPET_FREQ ); cd->max_delta_ns =clockevent_delta2ns (0x7fffffff , cd); - cd->min_delta_ns =5000 ; + cd->min_delta_ns =clockevent_delta2ns (HPET_MIN_PROG_DELTA , cd);clockevents_register_device (cd);setup_irq (HPET_T0_IRQ , &hpet_irq);
Greg Kroah-Hartman
maintainerPATCH 157/342 MIPS: Fix some missing CONFIG_CPU_MIPSR6 #ifdefs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 4f33f6c522948fffc345261896042b58dea23754 upstream.
Commit be0c37c985eddc4 (MIPS: Rearrange PTE bits into fixed positions.) defines fixed PTE bits for MIPS R2. Then, commit d7b631419b3d230a4d383 (MIPS: pgtable-bits: Fix XPA damage to R6 definitions.) adds the MIPS R6 definitions in the same way as MIPS R2. But some R6 #ifdefs in the later commit are missing, so in this patch I fix that.
Patchwork: https://patchwork.linux-mips.org/patch/12164/
--- arch/mips/include/asm/pgtable.h | 4 ++-- arch/mips/mm/tlbex.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/include/asm/pgtable.h +2 -2
@@ -353,7 +353,7 @@ static inline pte_t pte_mkdirty(pte_t ptstatic inline pte_t pte_mkyoung (pte_t pte) {pte_val (pte) |= _PAGE_ACCESSED; -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (!(pte_val (pte) & _PAGE_NO_READ))pte_val (pte) |= _PAGE_SILENT_READ;else
@@ -560,7 +560,7 @@ static inline pmd_t pmd_mkyoung(pmd_t pm {pmd_val (pmd) |= _PAGE_ACCESSED; -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (!(pmd_val (pmd) & _PAGE_NO_READ))pmd_val (pmd) |= _PAGE_SILENT_READ;else
arch/mips/mm/tlbex.c +1 -1
@@ -242,7 +242,7 @@ static void output_pgtable_bits_defines(pr_define ("_PAGE_HUGE_SHIFT %d\n" , _PAGE_HUGE_SHIFT);pr_define ("_PAGE_SPLITTING_SHIFT %d\n" , _PAGE_SPLITTING_SHIFT);#endif -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (cpu_has_rixi) {#ifdef _PAGE_NO_EXEC_SHIFTpr_define ("_PAGE_NO_EXEC_SHIFT %d\n" , _PAGE_NO_EXEC_SHIFT);
Greg Kroah-Hartman
maintainerPATCH 158/342 MIPS: Fix buffer overflow in syscall_get_arguments()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit f4dce1ffd2e30fa31756876ef502ce6d2324be35 upstream.
Since commit 4c21b8fd8f14 ("MIPS: seccomp: Handle indirect system calls (o32)"), syscall_get_arguments() attempts to handle o32 indirect syscall arguments by incrementing both the start argument number and the number of arguments to fetch. However only the start argument number needs to be incremented. The number of arguments does not change, they're just shifted up by one, and in fact the output array is provided by the caller and is likely only n entries long, so reading more arguments overflows the output buffer.
In the case of seccomp, this results in it fetching 7 arguments starting at the 2nd one, which overflows the unsigned long args[6] in populate_seccomp_data(). This clobbers the $s0 register from syscall_trace_enter() which __seccomp_phase1_filter() saved onto the stack, into which syscall_trace_enter() had placed its syscall number argument. This caused Chromium to crash.
Credit goes to Milko for tracking it down as far as $s0 being clobbered.
Patchwork: https://patchwork.linux-mips.org/patch/12213/
--- arch/mips/include/asm/syscall.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/mips/include/asm/syscall.h +1 -3
@@ -101,10 +101,8 @@ static inline void syscall_get_arguments/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */ if ((config_enabled (CONFIG_32BIT ) ||test_tsk_thread_flag (task,TIF_32BIT_REGS )) && - (regs->regs[2 ] == __NR_syscall)) { + (regs->regs[2 ] == __NR_syscall)) i++; - n++; - }while (n--) ret |=mips_get_syscall_arg (args++, task, regs, i++);
Greg Kroah-Hartman
maintainerPATCH 159/342 EDAC: Robustify workqueues destruction
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit fcd5c4dd8201595d4c598c9cca5e54760277d687 upstream.
EDAC workqueue destruction is really fragile. We cancel delayed work but if it is still running and requeues itself, we still go ahead and destroy the workqueue and the queued work explodes when workqueue core attempts to run it.
Make the destruction more robust by switching op_state to offline so that requeuing stops. Cancel any pending work *synchronously* too.
EDAC i7core: Driver loaded.
general protection fault: 0000 [#1] SMP CPU 12 Modules linked in: Supported: Yes Pid: 0, comm: kworker/0:1 Tainted: G IE 3.0.101-0-default #1 HP ProLiant DL380 G7 RIP: 0010:[<ffffffff8107dcd7>] [<ffffffff8107dcd7>] __queue_work+0x17/0x3f0 < ... regs ...> Process kworker/0:1 (pid: 0, threadinfo ffff88019def6000, task ffff88019def4600) Stack: ... Call Trace: call_timer_fn run_timer_softirq __do_softirq call_softirq do_softirq irq_exit smp_apic_timer_interrupt apic_timer_interrupt intel_idle cpuidle_idle_call cpu_idle Code: ... RIP __queue_work RSP <...>
--- drivers/edac/edac_device.c | 11 ++++------- drivers/edac/edac_mc.c | 14 +++----------- drivers/edac/edac_pci.c | 9 ++++----- 3 files changed, 11 insertions(+), 23 deletions(-)
drivers/edac/edac_device.c +4 -7
@@ -435,16 +435,13 @@ void edac_device_workq_setup(struct edac*/ void edac_device_workq_teardown (struct edac_device_ctl_info *edac_dev) { -int status; -if (!edac_dev->edac_check)return ; - status =cancel_delayed_work (&edac_dev->work); -if (status ==0 ) { -/* workq instance might be running, wait for it */ -flush_workqueue (edac_workqueue); - } + edac_dev->op_state =OP_OFFLINE ; + +cancel_delayed_work_sync (&edac_dev->work); +flush_workqueue (edac_workqueue); }/*
drivers/edac/edac_mc.c +3 -11
@@ -586,18 +586,10 @@ static void edac_mc_workq_setup(struct m*/ static void edac_mc_workq_teardown (struct mem_ctl_info *mci) { -int status; + mci->op_state =OP_OFFLINE ; -if (mci->op_state !=OP_RUNNING_POLL ) -return ; - - status =cancel_delayed_work (&mci->work); -if (status ==0 ) { -edac_dbg (0 ,"not canceled, flush the queue\n" ); - -/* workq instance might be running, wait for it */ -flush_workqueue (edac_workqueue); - } +cancel_delayed_work_sync (&mci->work); +flush_workqueue (edac_workqueue); }/*
drivers/edac/edac_pci.c +4 -5
@@ -274,13 +274,12 @@ static void edac_pci_workq_setup(struct*/ static void edac_pci_workq_teardown (struct edac_pci_ctl_info *pci) { -int status; -edac_dbg (0 ,"\n" ); - status =cancel_delayed_work (&pci->work); -if (status ==0 ) -flush_workqueue (edac_workqueue); + pci->op_state =OP_OFFLINE ; + +cancel_delayed_work_sync (&pci->work); +flush_workqueue (edac_workqueue); }/*
Greg Kroah-Hartman
maintainerPATCH 160/342 EDAC, mc_sysfs: Fix freeing bus name
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit 12e26969b32c79018165d52caff3762135614aa1 upstream.
I get the splat below when modprobing/rmmoding EDAC drivers. It happens because bus->name is invalid after bus_unregister() has run. The Code: section below corresponds to:
.loc 1 1108 0
movq 672(%rbx), %rax # mci_1(D)->bus, mci_1(D)->bus
.loc 1 1109 0
popq %rbx #
.loc 1 1108 0
movq (%rax), %rdi # _7->name,
jmp kfree #
and %rax has some funky stuff 2030203020312030 which looks a lot like something walked over it.
Fix that by saving the name ptr before doing stuff to string it points to.
general protection fault: 0000 [#1] SMP
Modules linked in: ...
CPU: 4 PID: 10318 Comm: modprobe Tainted: G I EN 3.12.51-11-default+ #48
Hardware name: HP ProLiant DL380 G7, BIOS P67 05/05/2011
task: ffff880311320280 ti: ffff88030da3e000 task.ti: ffff88030da3e000
RIP: 0010:[<ffffffffa019da92>] [<ffffffffa019da92>] edac_unregister_sysfs+0x22/0x30 [edac_core]
RSP: 0018:ffff88030da3fe28 EFLAGS: 00010292
RAX: 2030203020312030 RBX: ffff880311b4e000 RCX: 000000000000095c
RDX: 0000000000000001 RSI: ffff880327bb9600 RDI: 0000000000000286
RBP: ffff880311b4e750 R08: 0000000000000000 R09: ffffffff81296110
R10: 0000000000000400 R11: 0000000000000000 R12: ffff88030ba1ac68
R13: 0000000000000001 R14: 00000000011b02f0 R15: 0000000000000000
FS: 00007fc9bf8f5700(0000) GS:ffff8801a7c40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000403c90 CR3: 000000019ebdf000 CR4: 00000000000007e0
Stack:
Call Trace:
i7core_unregister_mci.isra.9
i7core_remove
pci_device_remove
__device_release_driver
driver_detach
bus_remove_driver
pci_unregister_driver
i7core_exit
SyS_delete_module
system_call_fastpath
0x7fc9bf426536
Code: 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 53 48 89 fb e8 52 2a 1f e1 48 8b bb a0 02 00 00 e8 46 59 1f e1 48 8b 83 a0 02 00 00 5b <48> 8b 38 e9 26 9a fe e0 66 0f 1f 44 00 00 66 66 66 66 90 48 8b
RIP [<ffffffffa019da92>] edac_unregister_sysfs+0x22/0x30 [edac_core]
RSP <ffff88030da3fe28>--- drivers/edac/edac_mc_sysfs.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/edac/edac_mc_sysfs.c +14 -7
@@ -880,21 +880,26 @@ static struct device_type mci_attr_typeint edac_create_sysfs_mci_device (struct mem_ctl_info *mci,const struct attribute_group **groups) { +char *name;int i, err;/* * The memory controller needs its own bus, in order to avoid * namespace conflicts at /sys/bus/edac. */ - mci->bus->name =kasprintf (GFP_KERNEL ,"mc%d" , mci->mc_idx); -if (!mci->bus->name) + name =kasprintf (GFP_KERNEL ,"mc%d" , mci->mc_idx); +if (!name)return -ENOMEM ; + mci->bus->name = name; +edac_dbg (0 ,"creating bus %s\n" , mci->bus->name); err =bus_register (mci->bus); -if (err <0 ) - goto fail_free_name; +if (err <0 ) { +kfree (name); +return err; + }/* get the /sys/devices/system/edac subsys reference */ mci->dev.type = &mci_attr_type;
@@ -961,8 +966,8 @@ fail_unregister_dimm:device_unregister (&mci->dev); fail_unregister_bus:bus_unregister (mci->bus); -fail_free_name: -kfree (mci->bus->name); +kfree (name); +return err; }
@@ -993,10 +998,12 @@ void edac_remove_sysfs_mci_device(structvoid edac_unregister_sysfs (struct mem_ctl_info *mci) { +const char *name = mci->bus->name; +edac_dbg (1 ,"Unregistering device %s\n" ,dev_name (&mci->dev));device_unregister (&mci->dev);bus_unregister (mci->bus); -kfree (mci->bus->name); +kfree (name); }static void mc_attr_release (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 161/342 sparc64: fix incorrect sign extension in sys_sparc64_personality
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry V. Levin <[email protected]>
commit 525fd5a94e1be0776fa652df5c687697db508c91 upstream.
The value returned by sys_personality has type "long int". It is saved to a variable of type "int", which is not a problem yet because the type of task_struct->pesonality is "unsigned int". The problem is the sign extension from "int" to "long int" that happens on return from sys_sparc64_personality.
For example, a userspace call personality((unsigned) -EINVAL) will result to any subsequent personality call, including absolutely harmless read-only personality(0xffffffff) call, failing with errno set to EINVAL.
--- arch/sparc/kernel/sys_sparc_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/sys_sparc_64.c +1 -1
@@ -413,7 +413,7 @@ out: SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality) { -int ret; +long ret;if (personality (current->personality) ==PER_LINUX32 &&personality (personality) ==PER_LINUX )
Greg Kroah-Hartman
maintainerPATCH 162/342 cxl: use correct operator when writing pcie config space values
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Donnellan <[email protected]>
commit 48f0f6b717e314a30be121b67e1d044f6d311d66 upstream.
When writing a value to config space, cxl_pcie_write_config() calls cxl_pcie_config_info() to obtain a mask and shift value, shifts the new value accordingly, then uses the mask to combine the shifted value with the existing value at the address as part of a read-modify-write pattern.
Currently, we use a logical OR operator rather than a bitwise OR operator, which means any use of this function results in an incorrect value being written. Replace the logical OR operator with a bitwise OR operator so the value is written correctly.
--- drivers/misc/cxl/vphb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/vphb.c +1 -1
@@ -203,7 +203,7 @@ static int cxl_pcie_write_config(struct mask <<= shift; val <<= shift; - v = (in_le32 (ioaddr) & ~mask) || (val & mask); + v = (in_le32 (ioaddr) & ~mask) | (val & mask);out_le32 (ioaddr, v);return PCIBIOS_SUCCESSFUL ;