4.9.29-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.9.29-stable review
This is the start of the stable review cycle for the 4.9.29 release. There are 80 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 Sat May 20 10:48:15 UTC 2017. 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.9.29-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.29-rc1
Kees Cook <[email protected]>
pstore: Shut down worker when unregistering
Ankit Kumar <[email protected]>
pstore: Fix flags to enable dumps on powerpc
Dan Williams <[email protected]>
libnvdimm, pfn: fix 'npfns' vs section alignment
Toshi Kani <[email protected]>
libnvdimm, pmem: fix a NULL pointer BUG in nd_pmem_notify
Dan Williams <[email protected]>
libnvdimm, region: fix flush hint detection crash
Joeseph Chang <[email protected]>
ipmi: Fix kernel panic at ipmi_ssif_thread()
Johan Hovold <[email protected]>
Bluetooth: hci_intel: add missing tty-device sanity check
Johan Hovold <[email protected]>
Bluetooth: hci_bcm: add missing tty-device sanity check
Szymon Janc <[email protected]>
Bluetooth: Fix user channel for 32bit userspace on 64bit kernel
Wang YanQing <[email protected]>
tty: pty: Fix ldisc flush after userspace become aware of the data already
Johan Hovold <[email protected]>
serial: omap: suspend device on probe errors
Johan Hovold <[email protected]>
serial: omap: fix runtime-pm handling on unbind
Marek Szyprowski <[email protected]>
serial: samsung: Use right device for DMA-mapping calls
Eric Biggers <[email protected]>
fscrypt: fix context consistency check when key(s) unavailable
Dan Williams <[email protected]>
device-dax: fix cdev leak
Jason A. Donenfeld <[email protected]>
padata: free correct variable
Björn Jacke <[email protected]>
CIFS: add misssing SFM mapping for doublequote
David Disseldorp <[email protected]>
cifs: fix CIFS_IOC_GET_MNT_INFO oops
Rabin Vincent <[email protected]>
CIFS: fix oplock break deadlocks
David Disseldorp <[email protected]>
cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops
David Disseldorp <[email protected]>
cifs: fix leak in FSCTL_ENUM_SNAPS response handling
Björn Jacke <[email protected]>
CIFS: fix mapping of SFM_SPACE and SFM_PERIOD
Steve French <[email protected]>
SMB3: Work around mount failure when using SMB3 dialect to Macs
Steve French <[email protected]>
Set unicode flag on cifs echo request to avoid Mac error
Sachin Prabhu <[email protected]>
Fix match_prepath()
Vlastimil Babka <[email protected]>
mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC
Andrey Ryabinin <[email protected]>
fs/block_dev: always invalidate cleancache in invalidate_bdev()
Luis Henriques <[email protected]>
ceph: fix memory leak in __ceph_setxattr()
Michal Hocko <[email protected]>
fs/xattr.c: zero out memory copied to userspace in getxattr
Martin Brandenburg <[email protected]>
orangefs: do not check possibly stale size on truncate
Martin Brandenburg <[email protected]>
orangefs: do not set getattr_time on orangefs_lookup
Martin Brandenburg <[email protected]>
orangefs: clean up oversize xattr validation
Martin Brandenburg <[email protected]>
orangefs: fix bounds check for listxattr
Eric Biggers <[email protected]>
ext4: evict inline data when writing to memory map
Adrian Hunter <[email protected]>
perf auxtrace: Fix no_size logic in addr_filter__resolve_kernel_syms()
Mike Marciniszyn <[email protected]>
IB/hfi1: Prevent kernel QP post send hard lockups
Jack Morgenstein <[email protected]>
IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level
Jack Morgenstein <[email protected]>
IB/mlx4: Fix ib device initialization error flow
Shamir Rabinovitch <[email protected]>
IB/IPoIB: ibX: failed to create mcg debug file
Michael J. Ruhl <[email protected]>
IB/core: For multicast functions, verify that LIDs are multicast LIDs
Jack Morgenstein <[email protected]>
IB/core: Fix sysfs registration error flow
Ding Tianhong <[email protected]>
iov_iter: don't revert iov buffer if csum error
Alex Williamson <[email protected]>
vfio/type1: Remove locked page accounting workqueue
Dennis Yang <[email protected]>
dm thin: fix a memory leak when passing discard bio down
Bart Van Assche <[email protected]>
dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue()
Somasundaram Krishnasamy <[email protected]>
dm era: save spacemap metadata root after the pre-commit
Gary R Hook <[email protected]>
crypto: ccp - Change ISR handler method for a v5 CCP
Gary R Hook <[email protected]>
crypto: ccp - Change ISR handler method for a v3 CCP
Gary R Hook <[email protected]>
crypto: ccp - Disable interrupts early on unload
Gary R Hook <[email protected]>
crypto: ccp - Use only the relevant interrupt bits
Stephan Mueller <[email protected]>
crypto: algif_aead - Require setkey before accept(2)
Mike Snitzer <[email protected]>
block: fix blk_integrity_register to use template's interval_exp if not 0
Marc Zyngier <[email protected]>
arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
Andrew Jones <[email protected]>
KVM: arm/arm64: fix races in kvm_psci_vcpu_on
David Hildenbrand <[email protected]>
KVM: x86: fix user triggerable warning in kvm_apic_accept_events()
Vince Weaver <[email protected]>
perf/x86: Fix Broadwell-EP DRAM RAPL events
Richard Weinberger <[email protected]>
um: Fix PTRACE_POKEUSER on x86_64
Ben Hutchings <[email protected]>
x86, pmem: Fix cache flushing for iovec write < 8 bytes
Andy Lutomirski <[email protected]>
selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug
Ashish Kalra <[email protected]>
x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup
Maksim Salau <[email protected]>
usb: misc: legousbtower: Fix buffers on stack
Guenter Roeck <[email protected]>
usb: hub: Do not attempt to autosuspend disconnected devices
Guenter Roeck <[email protected]>
usb: hub: Fix error loop seen after hub communication errors
Alexey Brodkin <[email protected]>
usb: Make sure usb/phy/of gets built-in
Romain Izard <[email protected]>
usb: gadget: legacy gadgets are optional
Gustavo A. R. Silva <[email protected]>
usb: misc: add missing continue in switch
Ian Abbott <[email protected]>
staging: comedi: jr3_pci: cope with jiffies wraparound
Ian Abbott <[email protected]>
staging: comedi: jr3_pci: fix possible null pointer dereference
Johan Hovold <[email protected]>
staging: gdm724x: gdm_mux: fix use-after-free on module unload
Malcolm Priestley <[email protected]>
staging: vt6656: use off stack for out buffer USB transfers.
Malcolm Priestley <[email protected]>
staging: vt6656: use off stack for in buffer USB transfers.
Bjørn Mork <[email protected]>
USB: Revert "cdc-wdm: fix "out-of-sync" due to missing notifications"
Ajay Kaher <[email protected]>
USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously
Marek Vasut <[email protected]>
USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
Peter Chen <[email protected]>
usb: host: xhci: print correct command ring address
Roger Quadros <[email protected]>
usb: xhci: bInterval quirk for TI TUSB73x0
Nicholas Bellinger <[email protected]>
iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement
Bart Van Assche <[email protected]>
target/fileio: Fix zero-length READ and WRITE handling
Nicholas Bellinger <[email protected]>
target: Fix compare_and_write_callback handling for non GOOD status
Juergen Gross <[email protected]>
xen: adjust early dom0 p2m handling to xen hypervisor behavior
-------------
Diffstat:
Makefile | 4 +- arch/arm/kvm/psci.c | 8 +- arch/arm64/include/asm/kvm_emulate.h | 6 + arch/arm64/kvm/sys_regs.c | 8 +- arch/powerpc/kernel/nvram_64.c | 1 + arch/x86/boot/boot.h | 2 +- arch/x86/events/intel/rapl.c | 2 +- arch/x86/include/asm/pmem.h | 2 +- arch/x86/kvm/x86.c | 12 ++ arch/x86/um/ptrace_64.c | 2 +- arch/x86/xen/mmu.c | 7 +- block/blk-integrity.c | 3 +- crypto/algif_aead.c | 157 +++++++++++++++++++++++++-- drivers/Makefile | 1 + drivers/bluetooth/hci_bcm.c | 5 +- drivers/bluetooth/hci_intel.c | 13 ++- drivers/char/ipmi/ipmi_ssif.c | 4 +- drivers/crypto/ccp/ccp-dev-v3.c | 120 +++++++++++--------- drivers/crypto/ccp/ccp-dev-v5.c | 114 +++++++++++-------- drivers/crypto/ccp/ccp-dev.h | 8 +- drivers/crypto/ccp/ccp-pci.c | 2 + drivers/dax/dax.c | 15 ++- drivers/infiniband/core/sysfs.c | 2 +- drivers/infiniband/core/verbs.c | 8 +- drivers/infiniband/hw/hfi1/ruc.c | 26 +++-- drivers/infiniband/hw/hfi1/verbs.c | 4 +- drivers/infiniband/hw/hfi1/verbs.h | 6 +- drivers/infiniband/hw/mlx4/main.c | 1 + drivers/infiniband/hw/mlx4/mcg.c | 3 +- drivers/infiniband/ulp/ipoib/ipoib_fs.c | 3 + drivers/infiniband/ulp/ipoib/ipoib_main.c | 44 +++++++- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 3 - drivers/md/dm-era-target.c | 8 +- drivers/md/dm-rq.c | 6 +- drivers/md/dm-thin.c | 1 + drivers/nvdimm/pfn_devs.c | 6 +- drivers/nvdimm/pmem.c | 37 +++++-- drivers/nvdimm/region_devs.c | 11 +- drivers/staging/comedi/drivers/jr3_pci.c | 13 ++- drivers/staging/gdm724x/gdm_mux.c | 3 +- drivers/staging/vt6656/usbpipe.c | 31 +++++- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_configfs.c | 1 + drivers/target/iscsi/iscsi_target_login.c | 1 + drivers/target/target_core_file.c | 3 +- drivers/target/target_core_sbc.c | 5 +- drivers/tty/pty.c | 7 +- drivers/tty/serial/omap-serial.c | 9 +- drivers/tty/serial/samsung.c | 9 +- drivers/usb/class/cdc-wdm.c | 103 +----------------- drivers/usb/core/driver.c | 21 ++++ drivers/usb/core/file.c | 9 +- drivers/usb/core/hub.c | 11 +- drivers/usb/gadget/Kconfig | 1 + drivers/usb/host/xhci-mem.c | 13 ++- drivers/usb/host/xhci-pci.c | 3 + drivers/usb/host/xhci.h | 1 + drivers/usb/misc/legousbtower.c | 37 +++++-- drivers/usb/misc/usbtest.c | 1 + drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 + drivers/vfio/vfio_iommu_type1.c | 102 ++++++++--------- fs/block_dev.c | 11 +- fs/ceph/xattr.c | 3 + fs/cifs/cifs_unicode.c | 6 + fs/cifs/cifs_unicode.h | 5 +- fs/cifs/cifsfs.c | 15 ++- fs/cifs/cifsglob.h | 1 + fs/cifs/cifssmb.c | 3 + fs/cifs/connect.c | 14 +-- fs/cifs/ioctl.c | 4 + fs/cifs/misc.c | 2 +- fs/cifs/smb2misc.c | 5 +- fs/cifs/smb2ops.c | 1 + fs/cifs/smb2pdu.c | 14 ++- fs/crypto/policy.c | 87 +++++++++++---- fs/ext4/inode.c | 5 + fs/orangefs/inode.c | 3 +- fs/orangefs/namei.c | 2 - fs/orangefs/xattr.c | 26 ++--- fs/pstore/platform.c | 10 +- fs/xattr.c | 2 +- kernel/padata.c | 2 +- mm/page_alloc.c | 3 +- net/bluetooth/hci_sock.c | 3 +- net/core/datagram.c | 13 ++- tools/perf/util/auxtrace.c | 4 +- tools/testing/selftests/x86/ldt_gdt.c | 46 ++++++++ 88 files changed, 893 insertions(+), 454 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/80 xen: adjust early dom0 p2m handling to xen hypervisor behavior
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit 69861e0a52f8733355ce246f0db15e1b240ad667 upstream.
When booted as pv-guest the p2m list presented by the Xen is already mapped to virtual addresses. In dom0 case the hypervisor might make use of 2M- or 1G-pages for this mapping. Unfortunately while being properly aligned in virtual and machine address space, those pages might not be aligned properly in guest physical address space.
So when trying to obtain the guest physical address of such a page pud_pfn() and pmd_pfn() must be avoided as those will mask away guest physical address bits not being zero in this special case.
--- arch/x86/xen/mmu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/xen/mmu.c +4 -3
@@ -2028,7 +2028,8 @@ static unsigned long __init xen_read_phy/* * Translate a virtual address to a physical one without relying on mapped -* page tables. +* page tables. Don't rely on big pages being aligned in (guest) physical +* space! */ static phys_addr_t __init xen_early_virt_to_phys (unsigned long vaddr) {
@@ -2049,7 +2050,7 @@ static phys_addr_t __init xen_early_virt sizeof(pud)));if (!pud_present (pud))return 0 ; - pa =pud_pfn (pud) <<PAGE_SHIFT ; + pa =pud_val (pud) &PTE_PFN_MASK ;if (pud_large (pud))return pa + (vaddr & ~PUD_MASK );
@@ -2057,7 +2058,7 @@ static phys_addr_t __init xen_early_virt sizeof(pmd)));if (!pmd_present (pmd))return 0 ; - pa =pmd_pfn (pmd) <<PAGE_SHIFT ; + pa =pmd_val (pmd) &PTE_PFN_MASK ;if (pmd_large (pmd))return pa + (vaddr & ~PMD_MASK );
Greg Kroah-Hartman
maintainerPATCH 5/80 usb: xhci: bInterval quirk for TI TUSB73x0
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit 69307ccb9ad7ccb653e332de68effdeaaab6907d upstream.
As per [1] issue #4,
"The periodic EP scheduler always tries to schedule the EPs that have large intervals (interval equal to or greater than 128 microframes) into different microframes. So it maintains an internal counter and increments for each large interval EP added. When the counter is greater than 128, the scheduler rejects the new EP. So when the hub re-enumerated 128 times, it triggers this condition."
This results in Bandwidth error when devices with periodic endpoints (ISO/INT) having bInterval > 7 are plugged and unplugged several times on a TUSB73x0 XHCI host.
Workaround this issue by limiting the bInterval to 7 (i.e. interval to 6) for High-speed or faster periodic endpoints.
[1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf
--- drivers/usb/host/xhci-mem.c | 11 +++++++++++ drivers/usb/host/xhci-pci.c | 3 +++ drivers/usb/host/xhci.h | 1 + 3 files changed, 15 insertions(+)
drivers/usb/host/xhci-mem.c +11 -0
@@ -1494,6 +1494,17 @@ int xhci_endpoint_init(struct xhci_hcd **/ max_esit_payload =xhci_get_max_esit_payload (udev, ep); interval =xhci_get_endpoint_interval (udev, ep); + +/* Periodic endpoint bInterval limit quirk */ +if (usb_endpoint_xfer_int (&ep->desc) || +usb_endpoint_xfer_isoc (&ep->desc)) { +if ((xhci->quirks &XHCI_LIMIT_ENDPOINT_INTERVAL_7 ) && + udev->speed >=USB_SPEED_HIGH && + interval >=7 ) { + interval =6 ; + } + } + mult =xhci_get_endpoint_mult (udev, ep); max_packet =GET_MAX_PACKET (usb_endpoint_maxp (&ep->desc)); max_burst =xhci_get_endpoint_max_burst (udev, ep);
drivers/usb/host/xhci-pci.c +3 -0
@@ -199,6 +199,9 @@ static void xhci_pci_quirks(struct devic pdev->device == 0x1042) xhci->quirks |=XHCI_BROKEN_STREAMS ; +if (pdev->vendor ==PCI_VENDOR_ID_TI && pdev->device ==0x8241 ) + xhci->quirks |=XHCI_LIMIT_ENDPOINT_INTERVAL_7 ; +if (xhci->quirks &XHCI_RESET_ON_RESUME )xhci_dbg_trace (xhci, trace_xhci_dbg_quirks,"QUIRK: Resetting on resume" );
drivers/usb/host/xhci.h +1 -0
@@ -1659,6 +1659,7 @@ struct xhci_hcd {#define XHCI_MISSING_CAS (1 << 24)/* For controller with a broken Port Disable implementation */ #define XHCI_BROKEN_PORT_PED (1 << 25) +#define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26)unsigned int num_active_eps;unsigned int limit_active_eps;
Greg Kroah-Hartman
maintainerPATCH 7/80 USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 31c5d1922b90ddc1da6a6ddecef7cd31f17aa32b upstream.
This development kit has an FT4232 on it with a custom USB VID/PID. The FT4232 provides four UARTs, but only two are used. The UART 0 is used by the FlashPro5 programmer and UART 2 is connected to the SmartFusion2 CortexM3 SoC UART port.
Note that the USB VID is registered to Actel according to Linux USB VID database, but that was acquired by Microsemi.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -873,6 +873,7 @@ static const struct usb_device_id id_tab {USB_DEVICE_AND_INTERFACE_INFO (MICROCHIP_VID ,MICROCHIP_USB_BOARD_PID ,USB_CLASS_VENDOR_SPEC , USB_SUBCLASS_VENDOR_SPEC, 0x00) }, + { USB_DEVICE_INTERFACE_NUMBER(ACTEL_VID, MICROSEMI_ARROW_SF2PLUS_BOARD_PID, 2) }, { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -873,6 +873,12 @@#define FIC_VID 0x1457#define FIC_NEO1973_DEBUG_PID 0x5118 +/* +* Actel / Microsemi +*/ +#define ACTEL_VID 0x1514 +#define MICROSEMI_ARROW_SF2PLUS_BOARD_PID 0x2008 +/* Olimex */ #define OLIMEX_VID 0x15BA#define OLIMEX_ARM_USB_OCD_PID 0x0003
Greg Kroah-Hartman
maintainerPATCH 8/80 USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ajay Kaher <[email protected]>
commit 2f86a96be0ccb1302b7eee7855dbee5ce4dc5dfb upstream.
There is race condition when two USB class drivers try to call init_usb_class at the same time and leads to crash. code path: probe->usb_register_dev->init_usb_class
To solve this, mutex locking has been added in init_usb_class() and destroy_usb_class().
As pointed by Alan, removed "if (usb_class)" test from destroy_usb_class() because usb_class can never be NULL there.
--- drivers/usb/core/file.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/core/file.c +7 -2
@@ -27,6 +27,7 @@#define MAX_USB_MINORS 256static const struct file_operations *usb_minors[MAX_USB_MINORS ];static DECLARE_RWSEM (minor_rwsem); +static DEFINE_MUTEX (init_usb_class_mutex);static int usb_open (struct inode *inode,struct file *file) {
@@ -109,8 +110,9 @@ static void release_usb_class(struct krestatic void destroy_usb_class (void ) { -if (usb_class) -kref_put (&usb_class->kref, release_usb_class); +mutex_lock (&init_usb_class_mutex); +kref_put (&usb_class->kref, release_usb_class); +mutex_unlock (&init_usb_class_mutex); }int usb_major_init (void )
@@ -171,7 +173,10 @@ int usb_register_dev(struct usb_interfacif (intf->minor >=0 )return -EADDRINUSE ; +mutex_lock (&init_usb_class_mutex); retval =init_usb_class (); +mutex_unlock (&init_usb_class_mutex); +if (retval)return retval;
Greg Kroah-Hartman
maintainerPATCH 13/80 staging: comedi: jr3_pci: fix possible null pointer dereference
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 45292be0b3db0b7f8286683b376e2d9f949d11f9 upstream.
For some reason, the driver does not consider allocation of the subdevice private data to be a fatal error when attaching the COMEDI device. It tests the subdevice private data pointer for validity at certain points, but omits some crucial tests. In particular, jr3_pci_auto_attach() calls jr3_pci_alloc_spriv() to allocate and initialize the subdevice private data, but the same function subsequently dereferences the pointer to access the next_time_min and next_time_max members without checking it first. The other missing test is in the timer expiry routine jr3_pci_poll_dev(), but it will crash before it gets that far.
Fix the bug by returning -ENOMEM from jr3_pci_auto_attach() as soon as one of the calls to jr3_pci_alloc_spriv() returns NULL. The COMEDI core will subsequently call jr3_pci_detach() to clean up.
--- drivers/staging/comedi/drivers/jr3_pci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/staging/comedi/drivers/jr3_pci.c +6 -5
@@ -727,11 +727,12 @@ static int jr3_pci_auto_attach(struct co s->insn_read = jr3_pci_ai_insn_read; spriv =jr3_pci_alloc_spriv (dev, s); -if (spriv) { -/* Channel specific range and maxdata */ - s->range_table_list = spriv->range_table_list; - s->maxdata_list = spriv->maxdata_list; - } +if (!spriv) +return -ENOMEM ; + +/* Channel specific range and maxdata */ + s->range_table_list = spriv->range_table_list; + s->maxdata_list = spriv->maxdata_list; }/* Reset DSP card */
Greg Kroah-Hartman
maintainerPATCH 15/80 usb: misc: add missing continue in switch
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 2c930e3d0aed1505e86e0928d323df5027817740 upstream.
Add missing continue in switch.
Addresses-Coverity-ID: 1248733
--- drivers/usb/misc/usbtest.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/usbtest.c +1 -0
@@ -159,6 +159,7 @@ get_endpoints(struct usbtest_dev *dev, scase USB_ENDPOINT_XFER_INT :if (dev->info->intr) goto try_intr; +continue ;case USB_ENDPOINT_XFER_ISOC :if (dev->info->iso) goto try_iso;
Greg Kroah-Hartman
maintainerPATCH 16/80 usb: gadget: legacy gadgets are optional
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Romain Izard <[email protected]>
commit 6e253d0fbc665b36192b8ed3cecdbb65b413a1eb upstream.
With commit bc49d1d17dcf ("usb: gadget: don't couple configfs to legacy gadgets"),it is possible to build a modular kernel with both built-in configfs support and modular legacy gadget drivers.
But when building a kernel without modules, it is also necessary to be able to build with configfs but without any legacy gadget driver. This was a possible configuration when the USB_CONFIGFS was a part of the choice options, but not anymore.
Mark the choice for legacy gadget drivers as optional restores this.
--- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/Kconfig +1 -0
@@ -460,6 +460,7 @@ config USB_CONFIGFS_F_TCM choice tristate "USB Gadget Drivers" default USB_ETH + optional help A Linux "Gadget Driver" talks to the USB Peripheral Controller driver through the abstract "gadget" API. Some other operating
Greg Kroah-Hartman
maintainerPATCH 17/80 usb: Make sure usb/phy/of gets built-in
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Brodkin <[email protected]>
commit 3d6159640da9c9175d1ca42f151fc1a14caded59 upstream.
DWC3 driver uses of_usb_get_phy_mode() which is implemented in drivers/usb/phy/of.c and in bare minimal configuration it might not be pulled in kernel binary.
In case of ARC or ARM this could be easily reproduced with "allnodefconfig" +CONFIG_USB=m +CONFIG_USB_DWC3=m.
On building all ends-up with:
---------------------->8------------------
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 5 modules
ERROR: "of_usb_get_phy_mode" [drivers/usb/dwc3/dwc3.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2 ---------------------->8------------------
--- drivers/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/Makefile +1 -0
@@ -101,6 +101,7 @@ obj-$(CONFIG_USB_PHY) += usb/ obj-$(CONFIG_USB) += usb/ obj-$(CONFIG_PCI) += usb/ obj-$(CONFIG_USB_GADGET) += usb/ +obj-$(CONFIG_OF) += usb/ obj-$(CONFIG_SERIO) += input/serio/ obj-$(CONFIG_GAMEPORT) += input/gameport/ obj-$(CONFIG_INPUT) += input/
Greg Kroah-Hartman
maintainerPATCH 19/80 usb: hub: Do not attempt to autosuspend disconnected devices
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit f5cccf49428447dfbc9edb7a04bb8fc316269781 upstream.
While running a bind/unbind stress test with the dwc3 usb driver on rk3399, the following crash was observed.
Unable to handle kernel NULL pointer dereference at virtual address 00000218 pgd = ffffffc00165f000 [00000218] *pgd=000000000174f003, *pud=000000000174f003, *pmd=0000000001750003, *pte=00e8000001751713 Internal error: Oops: 96000005 [#1] PREEMPT SMP Modules linked in: uinput uvcvideo videobuf2_vmalloc cmac
ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat rfcomm xt_mark fuse bridge stp llc zram btusb btrtl btbcm btintel bluetooth ip6table_filter mwifiex_pcie mwifiex cfg80211 cdc_ether usbnet r8152 mii joydev snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device ppp_async ppp_generic slhc tun
CPU: 1 PID: 29814 Comm: kworker/1:1 Not tainted 4.4.52 #507 Hardware name: Google Kevin (DT) Workqueue: pm pm_runtime_work task: ffffffc0ac540000 ti: ffffffc0af4d4000 task.ti: ffffffc0af4d4000 PC is at autosuspend_check+0x74/0x174 LR is at autosuspend_check+0x70/0x174 ... Call trace: [<ffffffc00080dcc0>] autosuspend_check+0x74/0x174 [<ffffffc000810500>] usb_runtime_idle+0x20/0x40 [<ffffffc000785ae0>] __rpm_callback+0x48/0x7c [<ffffffc000786af0>] rpm_idle+0x1e8/0x498 [<ffffffc000787cdc>] pm_runtime_work+0x88/0xcc [<ffffffc000249bb8>] process_one_work+0x390/0x6b8 [<ffffffc00024abcc>] worker_thread+0x480/0x610 [<ffffffc000251a80>] kthread+0x164/0x178 [<ffffffc0002045d0>] ret_from_fork+0x10/0x40
Source:
(gdb) l *0xffffffc00080dcc00xffffffc00080dcc0 is in autosuspend_check
(drivers/usb/core/driver.c:1778).
1773 /* We don't need to check interfaces that are
1774 * disabled for runtime PM. Either they are unbound
1775 * or else their drivers don't support autosuspend
1776 * and so they are permanently active.
1777 */
1778 if (intf->dev.power.disable_depth)
1779 continue;
1780 if (atomic_read(&intf->dev.power.usage_count) > 0)
1781 return -EBUSY;
1782 w |= intf->needs_remote_wakeup;
Code analysis shows that intf is set to NULL in usb_disable_device() prior to setting actconfig to NULL. At the same time, usb_runtime_idle() does not lock the usb device, and neither does any of the functions in the traceback. This means that there is no protection against a race condition where usb_disable_device() is removing dev->actconfig->interface[] pointers while those are being accessed from autosuspend_check().
To solve the problem, synchronize and validate device state between autosuspend_check() and usb_disconnect().
--- drivers/usb/core/driver.c | 3 +++ drivers/usb/core/hub.c | 6 ++++++ 2 files changed, 9 insertions(+)
drivers/usb/core/driver.c +3 -0
@@ -1778,6 +1778,9 @@ static int autosuspend_check(struct usb_int w, i;struct usb_interface *intf; +if (udev->state ==USB_STATE_NOTATTACHED ) +return -ENODEV ; +/* Fail if autosuspend is disabled, or any interfaces are in use, or * any interface drivers require remote wakeup but it isn't available. */
drivers/usb/core/hub.c +6 -0
@@ -2085,6 +2085,12 @@ void usb_disconnect(struct usb_device **dev_info (&udev->dev,"USB disconnect, device number %d\n" , udev->devnum); +/* +* Ensure that the pm runtime code knows that the USB device +* is in the process of being disconnected. +*/ +pm_runtime_barrier (&udev->dev); +usb_lock_device (udev);hub_disconnect_children (udev);
Greg Kroah-Hartman
maintainerPATCH 20/80 usb: misc: legousbtower: Fix buffers on stack
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maksim Salau <[email protected]>
commit 942a48730faf149ccbf3e12ac718aee120bb3529 upstream.
Allocate buffers on HEAP instead of STACK for local structures that are to be received using usb_control_msg().
--- drivers/usb/misc/legousbtower.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-)
drivers/usb/misc/legousbtower.c +27 -10
@@ -317,9 +317,16 @@ static int tower_open (struct inode *inoint subminor;int retval =0 ;struct usb_interface *interface; -struct tower_reset_reply reset_reply; +struct tower_reset_reply *reset_reply;int result; + reset_reply =kmalloc (sizeof (*reset_reply),GFP_KERNEL ); + +if (!reset_reply) { + retval = -ENOMEM ; + goto exit; + } +nonseekable_open (inode, file); subminor =iminor (inode);
@@ -364,8 +371,8 @@ static int tower_open (struct inode *inoUSB_TYPE_VENDOR |USB_DIR_IN |USB_RECIP_DEVICE ,0 ,0 , - &reset_reply, -sizeof (reset_reply), + reset_reply, +sizeof (*reset_reply), 1000);if (result <0 ) { dev_err(&dev->udev->dev,
@@ -406,6 +413,7 @@ unlock_exit:mutex_unlock (&dev->lock); exit: +kfree (reset_reply);return retval; }
@@ -808,7 +816,7 @@ static int tower_probe (struct usb_interstruct lego_usb_tower *dev =NULL ;struct usb_host_interface *iface_desc;struct usb_endpoint_descriptor * endpoint; -struct tower_get_version_reply get_version_reply; +struct tower_get_version_reply *get_version_reply =NULL ;int i;int retval = -ENOMEM ;int result;
@@ -886,6 +894,13 @@ static int tower_probe (struct usb_inter dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval; dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval; + get_version_reply =kmalloc (sizeof (*get_version_reply),GFP_KERNEL ); + +if (!get_version_reply) { + retval = -ENOMEM ; + goto error; + } +/* get the firmware version and log it */ result = usb_control_msg (udev, usb_rcvctrlpipe(udev, 0),
@@ -893,18 +908,19 @@ static int tower_probe (struct usb_interUSB_TYPE_VENDOR |USB_DIR_IN |USB_RECIP_DEVICE ,0 ,0 , - &get_version_reply, -sizeof (get_version_reply), + get_version_reply, +sizeof (*get_version_reply), 1000);if (result <0 ) {dev_err (idev,"LEGO USB Tower get version control request failed\n" ); retval = result; goto error; } -dev_info (&interface->dev,"LEGO USB Tower firmware version is %d.%d " -"build %d\n" , get_version_reply.major, - get_version_reply.minor, -le16_to_cpu (get_version_reply.build_no)); +dev_info (&interface->dev, +"LEGO USB Tower firmware version is %d.%d build %d\n" , + get_version_reply->major, + get_version_reply->minor, +le16_to_cpu (get_version_reply->build_no));/* we can register the device now, as it is ready */ usb_set_intfdata (interface, dev);
@@ -928,6 +944,7 @@ exit:return retval; error: +kfree (get_version_reply);tower_delete (dev);return retval; }
Greg Kroah-Hartman
maintainerPATCH 21/80 x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashish Kalra <[email protected]>
commit d594aa0277e541bb997aef0bc0a55172d8138340 upstream.
The minimum size for a new stack (512 bytes) setup for arch/x86/boot components when the bootloader does not setup/provide a stack for the early boot components is not "enough".
The setup code executing as part of early kernel startup code, uses the stack beyond 512 bytes and accidentally overwrites and corrupts part of the BSS section. This is exposed mostly in the early video setup code, where it was corrupting BSS variables like force_x, force_y, which in-turn affected kernel parameters such as screen_info (screen_info.orig_video_cols) and later caused an exception/panic in console_init().
Most recent boot loaders setup the stack for early boot components, so this stack overwriting into BSS section issue has not been exposed.
--- arch/x86/boot/boot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/boot.h +1 -1
@@ -16,7 +16,7 @@#ifndef BOOT_BOOT_H #define BOOT_BOOT_H -#define STACK_SIZE 512/* Minimum number of bytes for stack */ +#define STACK_SIZE 1024/* Minimum number of bytes for stack */ #ifndef __ASSEMBLY__
Greg Kroah-Hartman
maintainerPATCH 22/80 selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 65973dd3fd31151823f4b8c289eebbb3fb7e6bc0 upstream.
i386 glibc is buggy and calls the sigaction syscall incorrectly.
This is asymptomatic for normal programs, but it blows up on programs that do evil things with segmentation. The ldt_gdt self-test is an example of such an evil program.
This doesn't appear to be a regression -- I think I just got lucky with the uninitialized memory that glibc threw at the kernel when I wrote the test.
This hackish fix manually issues sigaction(2) syscalls to undo the damage. Without the fix, ldt_gdt_32 segfaults; with the fix, it passes for me.
See: https://sourceware.org/bugzilla/show_bug.cgi?id=21269
--- tools/testing/selftests/x86/ldt_gdt.c | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
tools/testing/selftests/x86/ldt_gdt.c +46 -0
@@ -403,6 +403,51 @@ static void *threadproc(void *ctx) } } +#ifdef __i386__ + +#ifndef SA_RESTORE +#define SA_RESTORER 0x04000000 +#endif + +/* +* The UAPI header calls this 'struct sigaction', which conflicts with +* glibc. Sigh. +*/ +struct fake_ksigaction { +void *handler;/* the real type is nasty */ +unsigned long sa_flags; +void (*sa_restorer)(void ); +unsigned char sigset[8 ]; +}; + +static void fix_sa_restorer (int sig) +{ +struct fake_ksigaction ksa; + +if (syscall (SYS_rt_sigaction, sig,NULL , &ksa,8 ) ==0 ) { +/* +* glibc has a nasty bug: it sometimes writes garbage to +* sa_restorer. This interacts quite badly with anything +* that fiddles with SS because it can trigger legacy +* stack switching. Patch it up. See: +* +* https://sourceware.org/bugzilla/show_bug.cgi?id=21269 +*/ +if (!(ksa.sa_flags &SA_RESTORER ) && ksa.sa_restorer) { + ksa.sa_restorer =NULL ; +if (syscall (SYS_rt_sigaction, sig, &ksa,NULL , +sizeof (ksa.sigset)) !=0 ) +err (1 ,"rt_sigaction" ); + } + } +} +#else +static void fix_sa_restorer (int sig) +{ +/* 64-bit glibc works fine. */ +} +#endif +static void sethandler (int sig,void (*handler)(int ,siginfo_t *,void *),int flags) {
@@ -414,6 +459,7 @@ static void sethandler(int sig, void (*hif (sigaction (sig, &sa,0 ))err (1 ,"sigaction" ); +fix_sa_restorer (sig); }static jmp_buf jmpbuf;
Greg Kroah-Hartman
maintainerPATCH 23/80 x86, pmem: Fix cache flushing for iovec write < 8 bytes
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 8376efd31d3d7c44bd05be337adde023cc531fa1 upstream.
Commit 11e63f6d920d added cache flushing for unaligned writes from an iovec, covering the first and last cache line of a >= 8 byte write and the first cache line of a < 8 byte write. But an unaligned write of 2-7 bytes can still cover two cache lines, so make sure we flush both in that case.
--- arch/x86/include/asm/pmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/pmem.h +1 -1
@@ -103,7 +103,7 @@ static inline size_t arch_copy_from_iterif (bytes <8 ) {if (!IS_ALIGNED (dest,4 ) || (bytes !=4 )) -arch_wb_cache_pmem (addr,1 ); +arch_wb_cache_pmem (addr, bytes); }else {if (!IS_ALIGNED (dest,8 )) { dest =ALIGN (dest, boot_cpu_data.x86_clflush_size);
Greg Kroah-Hartman
maintainerPATCH 24/80 um: Fix PTRACE_POKEUSER on x86_64
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 9abc74a22d85ab29cef9896a2582a530da7e79bf upstream.
This is broken since ever but sadly nobody noticed. Recent versions of GDB set DR_CONTROL unconditionally and UML dies due to a heap corruption. It turns out that the PTRACE_POKEUSER was copy&pasted from i386 and assumes that addresses are 4 bytes long.
Fix that by using 8 as address size in the calculation.
--- arch/x86/um/ptrace_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/um/ptrace_64.c +1 -1
@@ -125,7 +125,7 @@ int poke_user(struct task_struct *child, else if ((addr >= offsetof(struct user, u_debugreg[0])) && (addr <= offsetof(struct user, u_debugreg[7]))) { addr -= offsetof(struct user, u_debugreg[0]); - addr = addr >>2 ; + addr = addr >>3 ;if ((addr ==4 ) || (addr ==5 ))return -EIO ; child->thread.arch.debugregs[addr] = data;
Greg Kroah-Hartman
maintainerPATCH 25/80 perf/x86: Fix Broadwell-EP DRAM RAPL events
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vince Weaver <[email protected]>
commit 33b88e708e7dfa58dc896da2a98f5719d2eb315c upstream.
It appears as though the Broadwell-EP DRAM units share the special units quirk with Haswell-EP/KNL.
Without this patch, you get really high results (a single DRAM using 20W of power).
The powercap driver in drivers/powercap/intel_rapl.c already has this change.
--- arch/x86/events/intel/rapl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/rapl.c +1 -1
@@ -759,7 +759,7 @@ static const struct x86_cpu_id rapl_cpu_X86_RAPL_MODEL_MATCH (INTEL_FAM6_BROADWELL_CORE , hsw_rapl_init),X86_RAPL_MODEL_MATCH (INTEL_FAM6_BROADWELL_GT3E , hsw_rapl_init), -X86_RAPL_MODEL_MATCH (INTEL_FAM6_BROADWELL_X , hsw_rapl_init), +X86_RAPL_MODEL_MATCH (INTEL_FAM6_BROADWELL_X , hsx_rapl_init),X86_RAPL_MODEL_MATCH (INTEL_FAM6_BROADWELL_XEON_D , hsw_rapl_init), X86_RAPL_MODEL_MATCH(INTEL_FAM6_XEON_PHI_KNL, knl_rapl_init),
Greg Kroah-Hartman
maintainerPATCH 27/80 KVM: arm/arm64: fix races in kvm_psci_vcpu_on
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Jones <[email protected]>
commit 6c7a5dce22b3f3cc44be098e2837fa6797edb8b8 upstream.
Fix potential races in kvm_psci_vcpu_on() by taking the kvm->lock mutex. In general, it's a bad idea to allow more than one PSCI_CPU_ON to process the same target VCPU at the same time. One such problem that may arise is that one PSCI_CPU_ON could be resetting the target vcpu, which fills the entire sys_regs array with a temporary value including the MPIDR register, while another looks up the VCPU based on the MPIDR value, resulting in no target VCPU found. Resolves both races found with the kvm-unit-tests/arm/psci unit test.
--- arch/arm/kvm/psci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/kvm/psci.c +7 -1
@@ -208,9 +208,10 @@ int kvm_psci_version(struct kvm_vcpu *vcstatic int kvm_psci_0_2_call (struct kvm_vcpu *vcpu) { -int ret =1 ; +struct kvm *kvm = vcpu->kvm;unsigned long psci_fn =vcpu_get_reg (vcpu,0 ) & ~((u32 )0 );unsigned long val; +int ret =1 ;switch (psci_fn) {case PSCI_0_2_FN_PSCI_VERSION :
@@ -230,7 +231,9 @@ static int kvm_psci_0_2_call(struct kvm_break ;case PSCI_0_2_FN_CPU_ON :case PSCI_0_2_FN64_CPU_ON : +mutex_lock (&kvm->lock); val =kvm_psci_vcpu_on (vcpu); +mutex_unlock (&kvm->lock);break ;case PSCI_0_2_FN_AFFINITY_INFO :case PSCI_0_2_FN64_AFFINITY_INFO :
@@ -279,6 +282,7 @@ static int kvm_psci_0_2_call(struct kvm_static int kvm_psci_0_1_call (struct kvm_vcpu *vcpu) { +struct kvm *kvm = vcpu->kvm;unsigned long psci_fn =vcpu_get_reg (vcpu,0 ) & ~((u32 )0 );unsigned long val;
@@ -288,7 +292,9 @@ static int kvm_psci_0_1_call(struct kvm_ val =PSCI_RET_SUCCESS ;break ;case KVM_PSCI_FN_CPU_ON : +mutex_lock (&kvm->lock); val =kvm_psci_vcpu_on (vcpu); +mutex_unlock (&kvm->lock);break ;default : val =PSCI_RET_NOT_SUPPORTED ;
Greg Kroah-Hartman
maintainerPATCH 28/80 arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit c667186f1c01ca8970c785888868b7ffd74e51ee upstream.
Our 32bit CP14/15 handling inherited some of the ARMv7 code for handling the trapped system registers, completely missing the fact that the fields for Rt and Rt2 are now 5 bit wide, and not 4...
Let's fix it, and provide an accessor for the most common Rt case.
--- arch/arm64/include/asm/kvm_emulate.h | 6 ++++++ arch/arm64/kvm/sys_regs.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
arch/arm64/include/asm/kvm_emulate.h +6 -0
@@ -240,6 +240,12 @@ static inline u8 kvm_vcpu_trap_get_faultreturn kvm_vcpu_get_hsr (vcpu) & ESR_ELx_FSC_TYPE; } +static inline int kvm_vcpu_sys_get_rt (struct kvm_vcpu *vcpu) +{ +u32 esr =kvm_vcpu_get_hsr (vcpu); +return (esr & ESR_ELx_SYS64_ISS_RT_MASK) >> ESR_ELx_SYS64_ISS_RT_SHIFT; +} +static inline unsigned long kvm_vcpu_get_mpidr_aff (struct kvm_vcpu *vcpu) {return vcpu_sys_reg (vcpu,MPIDR_EL1 ) &MPIDR_HWID_BITMASK ;
arch/arm64/kvm/sys_regs.c +4 -4
@@ -1573,8 +1573,8 @@ static int kvm_handle_cp_64(struct kvm_v {struct sys_reg_params params;u32 hsr =kvm_vcpu_get_hsr (vcpu); -int Rt = (hsr >>5 ) &0xf ; -int Rt2 = (hsr >>10 ) &0xf ; +int Rt =kvm_vcpu_sys_get_rt (vcpu); +int Rt2 = (hsr >>10 ) &0x1f ; params.is_aarch32 = true; params.is_32bit = false;
@@ -1625,7 +1625,7 @@ static int kvm_handle_cp_32(struct kvm_v {struct sys_reg_params params;u32 hsr =kvm_vcpu_get_hsr (vcpu); -int Rt = (hsr >>5 ) &0xf ; +int Rt =kvm_vcpu_sys_get_rt (vcpu); params.is_aarch32 = true; params.is_32bit = true;
@@ -1740,7 +1740,7 @@ int kvm_handle_sys_reg(struct kvm_vcpu * {struct sys_reg_params params;unsigned long esr =kvm_vcpu_get_hsr (vcpu); -int Rt = (esr >>5 ) &0x1f ; +int Rt =kvm_vcpu_sys_get_rt (vcpu);int ret;trace_kvm_handle_sys_reg (esr);
Greg Kroah-Hartman
maintainerPATCH 30/80 crypto: algif_aead - Require setkey before accept(2)
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Mueller <[email protected]>
commit 2a2a251f110576b1d89efbd0662677d7e7db21a8 upstream.
Some cipher implementations will crash if you try to use them without calling setkey first. This patch adds a check so that the accept(2) call will fail with -ENOKEY if setkey hasn't been done on the socket yet.
--- crypto/algif_aead.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 8 deletions(-)
crypto/algif_aead.c +149 -8
@@ -44,6 +44,11 @@ struct aead_async_req {char iv[]; }; +struct aead_tfm { +struct crypto_aead *aead; +bool has_key; +}; +struct aead_ctx {struct aead_sg_list tsgl;struct aead_async_rsgl first_rsgl;
@@ -732,24 +737,146 @@ static struct proto_ops algif_aead_ops = .poll = aead_poll, }; +static int aead_check_key (struct socket *sock) +{ +int err =0 ; +struct sock *psk; +struct alg_sock *pask; +struct aead_tfm *tfm; +struct sock *sk = sock->sk; +struct alg_sock *ask =alg_sk (sk); + +lock_sock (sk); +if (ask->refcnt) + goto unlock_child; + + psk = ask->parent; + pask =alg_sk (ask->parent); + tfm = pask->private; + + err = -ENOKEY ; +lock_sock_nested (psk,SINGLE_DEPTH_NESTING ); +if (!tfm->has_key) + goto unlock; + +if (!pask->refcnt++) +sock_hold (psk); + + ask->refcnt =1 ; +sock_put (psk); + + err =0 ; + +unlock: +release_sock (psk); +unlock_child: +release_sock (sk); + +return err; +} + +static int aead_sendmsg_nokey (struct socket *sock,struct msghdr *msg, +size_t size) +{ +int err; + + err =aead_check_key (sock); +if (err) +return err; + +return aead_sendmsg (sock, msg, size); +} + +static ssize_t aead_sendpage_nokey (struct socket *sock,struct page *page, +int offset,size_t size,int flags) +{ +int err; + + err =aead_check_key (sock); +if (err) +return err; + +return aead_sendpage (sock, page, offset, size, flags); +} + +static int aead_recvmsg_nokey (struct socket *sock,struct msghdr *msg, +size_t ignored,int flags) +{ +int err; + + err =aead_check_key (sock); +if (err) +return err; + +return aead_recvmsg (sock, msg, ignored, flags); +} + +static struct proto_ops algif_aead_ops_nokey = { + .family =PF_ALG , + + .connect = sock_no_connect, + .socketpair = sock_no_socketpair, + .getname = sock_no_getname, + .ioctl = sock_no_ioctl, + .listen = sock_no_listen, + .shutdown = sock_no_shutdown, + .getsockopt = sock_no_getsockopt, + .mmap = sock_no_mmap, + .bind = sock_no_bind, + .accept = sock_no_accept, + .setsockopt = sock_no_setsockopt, + + .release = af_alg_release, + .sendmsg = aead_sendmsg_nokey, + .sendpage = aead_sendpage_nokey, + .recvmsg = aead_recvmsg_nokey, + .poll = aead_poll, +}; +static void *aead_bind (const char *name,u32 type,u32 mask) { -return crypto_alloc_aead (name, type, mask); +struct aead_tfm *tfm; +struct crypto_aead *aead; + + tfm =kzalloc (sizeof (*tfm),GFP_KERNEL ); +if (!tfm) +return ERR_PTR (-ENOMEM ); + + aead =crypto_alloc_aead (name, type, mask); +if (IS_ERR (aead)) { +kfree (tfm); +return ERR_CAST (aead); + } + + tfm->aead = aead; + +return tfm; }static void aead_release (void *private) { -crypto_free_aead (private); +struct aead_tfm *tfm = private; + +crypto_free_aead (tfm->aead); +kfree (tfm); }static int aead_setauthsize (void *private,unsigned int authsize) { -return crypto_aead_setauthsize (private, authsize); +struct aead_tfm *tfm = private; + +return crypto_aead_setauthsize (tfm->aead, authsize); }static int aead_setkey (void *private,const u8 *key,unsigned int keylen) { -return crypto_aead_setkey (private, key, keylen); +struct aead_tfm *tfm = private; +int err; + + err =crypto_aead_setkey (tfm->aead, key, keylen); + tfm->has_key = !err; + +return err; }static void aead_sock_destruct (struct sock *sk)
@@ -766,12 +893,14 @@ static void aead_sock_destruct(struct soaf_alg_release_parent (sk); } -static int aead_accept_parent (void *private,struct sock *sk) +static int aead_accept_parent_nokey (void *private,struct sock *sk) {struct aead_ctx *ctx;struct alg_sock *ask =alg_sk (sk); -unsigned int len =sizeof (*ctx) +crypto_aead_reqsize (private); -unsigned int ivlen =crypto_aead_ivsize (private); +struct aead_tfm *tfm = private; +struct crypto_aead *aead = tfm->aead; +unsigned int len =sizeof (*ctx) +crypto_aead_reqsize (aead); +unsigned int ivlen =crypto_aead_ivsize (aead); ctx =sock_kmalloc (sk, len,GFP_KERNEL );if (!ctx)
@@ -798,7 +927,7 @@ static int aead_accept_parent(void *priv ask->private = ctx; -aead_request_set_tfm (&ctx->aead_req, private); +aead_request_set_tfm (&ctx->aead_req, aead);aead_request_set_callback (&ctx->aead_req,CRYPTO_TFM_REQ_MAY_BACKLOG , af_alg_complete, &ctx->completion);
@@ -807,13 +936,25 @@ static int aead_accept_parent(void *privreturn 0 ; } +static int aead_accept_parent (void *private,struct sock *sk) +{ +struct aead_tfm *tfm = private; + +if (!tfm->has_key) +return -ENOKEY ; + +return aead_accept_parent_nokey (private, sk); +} +static const struct af_alg_type algif_type_aead = { .bind = aead_bind, .release = aead_release, .setkey = aead_setkey, .setauthsize = aead_setauthsize, .accept = aead_accept_parent, + .accept_nokey = aead_accept_parent_nokey, .ops = &algif_aead_ops, + .ops_nokey = &algif_aead_ops_nokey, .name ="aead" , .owner =THIS_MODULE };
Greg Kroah-Hartman
maintainerPATCH 32/80 crypto: ccp - Disable interrupts early on unload
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary R Hook <[email protected]>
commit 116591fe3eef11c6f06b662c9176385f13891183 upstream.
Ensure that we disable interrupts first when shutting down the driver.
--- drivers/crypto/ccp/ccp-dev-v5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/ccp/ccp-dev-v5.c +2 -2
@@ -884,10 +884,10 @@ static void ccp5_destroy(struct ccp_deviiowrite32 (cmd_q->qcontrol & ~CMD5_Q_RUN , cmd_q->reg_control);/* Disable the interrupts */ -iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_interrupt_status); +iowrite32 (0x00 , cmd_q->reg_int_enable);/* Clear the interrupt status */ -iowrite32 (0x00 , cmd_q->reg_int_enable); +iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_interrupt_status);ioread32 (cmd_q->reg_int_status);ioread32 (cmd_q->reg_status); }
Greg Kroah-Hartman
maintainerPATCH 33/80 crypto: ccp - Change ISR handler method for a v3 CCP
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary R Hook <[email protected]>
commit 7b537b24e76a1e8e6d7ea91483a45d5b1426809b upstream.
The CCP has the ability to perform several operations simultaneously, but only one interrupt. When implemented as a PCI device and using MSI-X/MSI interrupts, use a tasklet model to service interrupts. By disabling and enabling interrupts from the CCP, coupled with the queuing that tasklets provide, we can ensure that all events (occurring on the device) are recognized and serviced.
This change fixes a problem wherein 2 or more busy queues can cause notification bits to change state while a (CCP) interrupt is being serviced, but after the queue state has been evaluated. This results in the event being 'lost' and the queue hanging, waiting to be serviced. Since the status bits are never fully de-asserted, the CCP never generates another interrupt (all bits zero -> one or more bits one), and no further CCP operations will be executed.
--- drivers/crypto/ccp/ccp-dev-v3.c | 120 +++++++++++++++++++++++----------------- drivers/crypto/ccp/ccp-dev.h | 3 + drivers/crypto/ccp/ccp-pci.c | 2 3 files changed, 75 insertions(+), 50 deletions(-)
drivers/crypto/ccp/ccp-dev-v3.c +70 -50
@@ -315,17 +315,73 @@ static int ccp_perform_ecc(struct ccp_opreturn ccp_do_cmd (op, cr,ARRAY_SIZE (cr)); } +static void ccp_disable_queue_interrupts (struct ccp_device *ccp) +{ +iowrite32 (0x00 , ccp->io_regs +IRQ_MASK_REG ); +} + +static void ccp_enable_queue_interrupts (struct ccp_device *ccp) +{ +iowrite32 (ccp->qim, ccp->io_regs +IRQ_MASK_REG ); +} + +static void ccp_irq_bh (unsigned long data) +{ +struct ccp_device *ccp = (struct ccp_device *)data; +struct ccp_cmd_queue *cmd_q; +u32 q_int, status; +unsigned int i; + + status =ioread32 (ccp->io_regs +IRQ_STATUS_REG ); + +for (i =0 ; i < ccp->cmd_q_count; i++) { + cmd_q = &ccp->cmd_q[i]; + + q_int = status & (cmd_q->int_ok | cmd_q->int_err); +if (q_int) { + cmd_q->int_status = status; + cmd_q->q_status =ioread32 (cmd_q->reg_status); + cmd_q->q_int_status =ioread32 (cmd_q->reg_int_status); + +/* On error, only save the first error value */ +if ((q_int & cmd_q->int_err) && !cmd_q->cmd_error) + cmd_q->cmd_error =CMD_Q_ERROR (cmd_q->q_status); + + cmd_q->int_rcvd =1 ; + +/* Acknowledge the interrupt and wake the kthread */ +iowrite32 (q_int, ccp->io_regs +IRQ_STATUS_REG ); +wake_up_interruptible (&cmd_q->int_queue); + } + } +ccp_enable_queue_interrupts (ccp); +} + +static irqreturn_t ccp_irq_handler (int irq,void *data) +{ +struct device *dev = data; +struct ccp_device *ccp =dev_get_drvdata (dev); + +ccp_disable_queue_interrupts (ccp); +if (ccp->use_tasklet) +tasklet_schedule (&ccp->irq_tasklet); +else +ccp_irq_bh ((unsigned long )ccp); + +return IRQ_HANDLED ; +} +static int ccp_init (struct ccp_device *ccp) {struct device *dev = ccp->dev;struct ccp_cmd_queue *cmd_q;struct dma_pool *dma_pool;char dma_pool_name[MAX_DMAPOOL_NAME_LEN ]; -unsigned int qmr, qim, i; +unsigned int qmr, i;int ret;/* Find available queues */ - qim =0 ; + ccp->qim =0 ; qmr =ioread32 (ccp->io_regs +Q_MASK_REG );for (i =0 ; i <MAX_HW_QUEUES ; i++) {if (!(qmr & (1 << i)))
@@ -370,7 +426,7 @@ static int ccp_init(struct ccp_device *cinit_waitqueue_head (&cmd_q->int_queue);/* Build queue interrupt mask (two interrupts per queue) */ - qim |= cmd_q->int_ok | cmd_q->int_err; + ccp->qim |= cmd_q->int_ok | cmd_q->int_err;#ifdef CONFIG_ARM64 /* For arm64 set the recommended queue cache settings */
@@ -388,14 +444,14 @@ static int ccp_init(struct ccp_device *cdev_notice (dev,"%u command queues available\n" , ccp->cmd_q_count);/* Disable and clear interrupts until ready */ -iowrite32 (0x00 , ccp->io_regs +IRQ_MASK_REG ); +ccp_disable_queue_interrupts (ccp);for (i =0 ; i < ccp->cmd_q_count; i++) { cmd_q = &ccp->cmd_q[i];ioread32 (cmd_q->reg_int_status);ioread32 (cmd_q->reg_status); } -iowrite32 (qim, ccp->io_regs +IRQ_STATUS_REG ); +iowrite32 (ccp->qim, ccp->io_regs +IRQ_STATUS_REG );/* Request an irq */ ret = ccp->get_irq (ccp);
@@ -408,6 +464,11 @@ static int ccp_init(struct ccp_device *cinit_waitqueue_head (&ccp->sb_queue);init_waitqueue_head (&ccp->suspend_queue); +/* Initialize the ISR tasklet? */ +if (ccp->use_tasklet) +tasklet_init (&ccp->irq_tasklet, ccp_irq_bh, + (unsigned long )ccp); +dev_dbg (dev,"Starting threads...\n" );/* Create a kthread for each queue */ for (i =0 ; i < ccp->cmd_q_count; i++) {
@@ -430,7 +491,7 @@ static int ccp_init(struct ccp_device *cdev_dbg (dev,"Enabling interrupts...\n" );/* Enable interrupts */ -iowrite32 (qim, ccp->io_regs +IRQ_MASK_REG ); +ccp_enable_queue_interrupts (ccp);dev_dbg (dev,"Registering device...\n" );ccp_add_device (ccp);
@@ -467,7 +528,7 @@ static void ccp_destroy(struct ccp_devic {struct ccp_cmd_queue *cmd_q;struct ccp_cmd *cmd; -unsigned int qim, i; +unsigned int i;/* Unregister the DMA engine */ ccp_dmaengine_unregister (ccp);
@@ -478,22 +539,15 @@ static void ccp_destroy(struct ccp_devic/* Remove this device from the list of available units */ ccp_del_device (ccp); -/* Build queue interrupt mask (two interrupt masks per queue) */ - qim =0 ; -for (i =0 ; i < ccp->cmd_q_count; i++) { - cmd_q = &ccp->cmd_q[i]; - qim |= cmd_q->int_ok | cmd_q->int_err; - } -/* Disable and clear interrupts */ -iowrite32 (0x00 , ccp->io_regs +IRQ_MASK_REG ); +ccp_disable_queue_interrupts (ccp);for (i =0 ; i < ccp->cmd_q_count; i++) { cmd_q = &ccp->cmd_q[i];ioread32 (cmd_q->reg_int_status);ioread32 (cmd_q->reg_status); } -iowrite32 (qim, ccp->io_regs +IRQ_STATUS_REG ); +iowrite32 (ccp->qim, ccp->io_regs +IRQ_STATUS_REG );/* Stop the queue kthreads */ for (i =0 ; i < ccp->cmd_q_count; i++)
@@ -520,40 +574,6 @@ static void ccp_destroy(struct ccp_devic } } -static irqreturn_t ccp_irq_handler (int irq,void *data) -{ -struct device *dev = data; -struct ccp_device *ccp =dev_get_drvdata (dev); -struct ccp_cmd_queue *cmd_q; -u32 q_int, status; -unsigned int i; - - status =ioread32 (ccp->io_regs +IRQ_STATUS_REG ); - -for (i =0 ; i < ccp->cmd_q_count; i++) { - cmd_q = &ccp->cmd_q[i]; - - q_int = status & (cmd_q->int_ok | cmd_q->int_err); -if (q_int) { - cmd_q->int_status = status; - cmd_q->q_status =ioread32 (cmd_q->reg_status); - cmd_q->q_int_status =ioread32 (cmd_q->reg_int_status); - -/* On error, only save the first error value */ -if ((q_int & cmd_q->int_err) && !cmd_q->cmd_error) - cmd_q->cmd_error =CMD_Q_ERROR (cmd_q->q_status); - - cmd_q->int_rcvd =1 ; - -/* Acknowledge the interrupt and wake the kthread */ -iowrite32 (q_int, ccp->io_regs +IRQ_STATUS_REG ); -wake_up_interruptible (&cmd_q->int_queue); - } - } - -return IRQ_HANDLED ; -} -static const struct ccp_actions ccp3_actions = { .aes = ccp_perform_aes, .xts_aes = ccp_perform_xts_aes,
drivers/crypto/ccp/ccp-dev.h +3 -0
@@ -332,7 +332,10 @@ struct ccp_device {void *dev_specific;int (*get_irq)(struct ccp_device *ccp);void (*free_irq)(struct ccp_device *ccp); +unsigned int qim;unsigned int irq; +bool use_tasklet; +struct tasklet_struct irq_tasklet;/* I/O area used for device communication. The register mapping * starts at an offset into the mapped bar.
drivers/crypto/ccp/ccp-pci.c +2 -0
@@ -69,6 +69,7 @@ static int ccp_get_msix_irqs(struct ccp_ goto e_irq; } } + ccp->use_tasklet = true;return 0 ;
@@ -100,6 +101,7 @@ static int ccp_get_msi_irq(struct ccp_dedev_notice (dev,"unable to allocate MSI IRQ (%d)\n" , ret); goto e_msi; } + ccp->use_tasklet = true;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 34/80 crypto: ccp - Change ISR handler method for a v5 CCP
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary R Hook <[email protected]>
commit 6263b51eb3190d30351360fd168959af7e3a49a9 upstream.
The CCP has the ability to perform several operations simultaneously, but only one interrupt. When implemented as a PCI device and using MSI-X/MSI interrupts, use a tasklet model to service interrupts. By disabling and enabling interrupts from the CCP, coupled with the queuing that tasklets provide, we can ensure that all events (occurring on the device) are recognized and serviced.
This change fixes a problem wherein 2 or more busy queues can cause notification bits to change state while a (CCP) interrupt is being serviced, but after the queue state has been evaluated. This results in the event being 'lost' and the queue hanging, waiting to be serviced. Since the status bits are never fully de-asserted, the CCP never generates another interrupt (all bits zero -> one or more bits one), and no further CCP operations will be executed.
--- drivers/crypto/ccp/ccp-dev-v5.c | 111 ++++++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 44 deletions(-)
drivers/crypto/ccp/ccp-dev-v5.c +67 -44
@@ -644,6 +644,65 @@ static int ccp_assign_lsbs(struct ccp_dereturn rc; } +static void ccp5_disable_queue_interrupts (struct ccp_device *ccp) +{ +unsigned int i; + +for (i =0 ; i < ccp->cmd_q_count; i++) +iowrite32 (0x0 , ccp->cmd_q[i].reg_int_enable); +} + +static void ccp5_enable_queue_interrupts (struct ccp_device *ccp) +{ +unsigned int i; + +for (i =0 ; i < ccp->cmd_q_count; i++) +iowrite32 (SUPPORTED_INTERRUPTS , ccp->cmd_q[i].reg_int_enable); +} + +static void ccp5_irq_bh (unsigned long data) +{ +struct ccp_device *ccp = (struct ccp_device *)data; +u32 status; +unsigned int i; + +for (i =0 ; i < ccp->cmd_q_count; i++) { +struct ccp_cmd_queue *cmd_q = &ccp->cmd_q[i]; + + status =ioread32 (cmd_q->reg_interrupt_status); + +if (status) { + cmd_q->int_status = status; + cmd_q->q_status =ioread32 (cmd_q->reg_status); + cmd_q->q_int_status =ioread32 (cmd_q->reg_int_status); + +/* On error, only save the first error value */ +if ((status &INT_ERROR ) && !cmd_q->cmd_error) + cmd_q->cmd_error =CMD_Q_ERROR (cmd_q->q_status); + + cmd_q->int_rcvd =1 ; + +/* Acknowledge the interrupt and wake the kthread */ +iowrite32 (status, cmd_q->reg_interrupt_status); +wake_up_interruptible (&cmd_q->int_queue); + } + } +ccp5_enable_queue_interrupts (ccp); +} + +static irqreturn_t ccp5_irq_handler (int irq,void *data) +{ +struct device *dev = data; +struct ccp_device *ccp =dev_get_drvdata (dev); + +ccp5_disable_queue_interrupts (ccp); +if (ccp->use_tasklet) +tasklet_schedule (&ccp->irq_tasklet); +else +ccp5_irq_bh ((unsigned long )ccp); +return IRQ_HANDLED ; +} +static int ccp5_init (struct ccp_device *ccp) {struct device *dev = ccp->dev;
@@ -728,18 +787,17 @@ static int ccp5_init(struct ccp_device *dev_notice (dev,"%u command queues available\n" , ccp->cmd_q_count);/* Turn off the queues and disable interrupts until ready */ +ccp5_disable_queue_interrupts (ccp);for (i =0 ; i < ccp->cmd_q_count; i++) { cmd_q = &ccp->cmd_q[i]; cmd_q->qcontrol =0 ;/* Start with nothing */ iowrite32 (cmd_q->qcontrol, cmd_q->reg_control); -/* Disable the interrupts */ -iowrite32 (0x00 , cmd_q->reg_int_enable);ioread32 (cmd_q->reg_int_status);ioread32 (cmd_q->reg_status); -/* Clear the interrupts */ +/* Clear the interrupt status */ iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_interrupt_status); }
@@ -750,6 +808,10 @@ static int ccp5_init(struct ccp_device *dev_err (dev,"unable to allocate an IRQ\n" ); goto e_pool; } +/* Initialize the ISR tasklet */ +if (ccp->use_tasklet) +tasklet_init (&ccp->irq_tasklet, ccp5_irq_bh, + (unsigned long )ccp);/* Initialize the queue used to suspend */ init_waitqueue_head (&ccp->suspend_queue);
@@ -821,11 +883,7 @@ static int ccp5_init(struct ccp_device * }dev_dbg (dev,"Enabling interrupts...\n" ); -/* Enable interrupts */ -for (i =0 ; i < ccp->cmd_q_count; i++) { - cmd_q = &ccp->cmd_q[i]; -iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_int_enable); - } +ccp5_enable_queue_interrupts (ccp);dev_dbg (dev,"Registering device...\n" );/* Put this on the unit list to make it available */
@@ -877,15 +935,13 @@ static void ccp5_destroy(struct ccp_deviccp_del_device (ccp);/* Disable and clear interrupts */ +ccp5_disable_queue_interrupts (ccp);for (i =0 ; i < ccp->cmd_q_count; i++) { cmd_q = &ccp->cmd_q[i];/* Turn off the run bit */ iowrite32 (cmd_q->qcontrol & ~CMD5_Q_RUN , cmd_q->reg_control); -/* Disable the interrupts */ -iowrite32 (0x00 , cmd_q->reg_int_enable); -/* Clear the interrupt status */ iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_interrupt_status);ioread32 (cmd_q->reg_int_status);
@@ -920,39 +976,6 @@ static void ccp5_destroy(struct ccp_devi } } -static irqreturn_t ccp5_irq_handler (int irq,void *data) -{ -struct device *dev = data; -struct ccp_device *ccp =dev_get_drvdata (dev); -u32 status; -unsigned int i; - -for (i =0 ; i < ccp->cmd_q_count; i++) { -struct ccp_cmd_queue *cmd_q = &ccp->cmd_q[i]; - - status =ioread32 (cmd_q->reg_interrupt_status); - -if (status) { - cmd_q->int_status = status; - cmd_q->q_status =ioread32 (cmd_q->reg_status); - cmd_q->q_int_status =ioread32 (cmd_q->reg_int_status); - -/* On error, only save the first error value */ -if ((status &INT_ERROR ) && !cmd_q->cmd_error) - cmd_q->cmd_error =CMD_Q_ERROR (cmd_q->q_status); - - cmd_q->int_rcvd =1 ; - -/* Acknowledge the interrupt and wake the kthread */ -iowrite32 (SUPPORTED_INTERRUPTS , - cmd_q->reg_interrupt_status); -wake_up_interruptible (&cmd_q->int_queue); - } - } - -return IRQ_HANDLED ; -} -static void ccp5_config (struct ccp_device *ccp) {/* Public side */
Greg Kroah-Hartman
maintainerPATCH 35/80 dm era: save spacemap metadata root after the pre-commit
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Somasundaram Krishnasamy <[email protected]>
commit 117aceb030307dcd431fdcff87ce988d3016c34a upstream.
When committing era metadata to disk, it doesn't always save the latest spacemap metadata root in superblock. Due to this, metadata is getting corrupted sometimes when reopening the device. The correct order of update should be, pre-commit (shadows spacemap root), save the spacemap root (newly shadowed block) to in-core superblock and then the final commit.
--- drivers/md/dm-era-target.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-era-target.c +4 -4
@@ -961,15 +961,15 @@ static int metadata_commit(struct era_me } } - r =save_sm_root (md); + r =dm_tm_pre_commit (md->tm);if (r) { -DMERR ("%s: save_sm_root failed" , __func__); +DMERR ("%s: pre commit failed" , __func__);return r; } - r =dm_tm_pre_commit (md->tm); + r =save_sm_root (md);if (r) { -DMERR ("%s: pre commit failed" , __func__); +DMERR ("%s: save_sm_root failed" , __func__);return r; }
Greg Kroah-Hartman
maintainerPATCH 36/80 dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 23a601248958fa4142d49294352fe8d1fdf3e509 upstream.
Otherwise the request-based DM blk-mq request_queue will be put into service without being properly exported via sysfs.
--- drivers/md/dm-rq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/md/dm-rq.c +5 -1
@@ -997,10 +997,14 @@ int dm_mq_init_request_queue(struct mappdm_init_md_queue (md);/* backfill 'mq' sysfs registration normally done in blk_register_queue */ -blk_mq_register_dev (disk_to_dev (md->disk), q); + err =blk_mq_register_dev (disk_to_dev (md->disk), q); +if (err) + goto out_cleanup_queue;return 0 ; +out_cleanup_queue: +blk_cleanup_queue (q); out_tag_set:blk_mq_free_tag_set (md->tag_set); out_kfree_tag_set:
Greg Kroah-Hartman
maintainerPATCH 39/80 iov_iter: dont revert iov buffer if csum error
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ding Tianhong <[email protected]>
commit a6a5993243550b09f620941dea741b7421fdf79c upstream.
The patch 327868212381 (make skb_copy_datagram_msg() et.al. preserve ->msg_iter on error) will revert the iov buffer if copy to iter failed, but it didn't copy any datagram if the skb_checksum_complete error, so no need to revert any data at this place.
v2: Sabrina notice that return -EFAULT when checksum error is not correct
here, it would confuse the caller about the return value, so fix it.
--- net/core/datagram.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/core/datagram.c +7 -6
@@ -740,7 +740,7 @@ int skb_copy_and_csum_datagram_msg(strucif (msg_data_left (msg) < chunk) {if (__skb_checksum_complete (skb)) - goto csum_error; +return -EINVAL ;if (skb_copy_datagram_msg (skb, hlen, msg, chunk)) goto fault; }else {
@@ -748,15 +748,16 @@ int skb_copy_and_csum_datagram_msg(strucif (skb_copy_and_csum_datagram (skb, hlen, &msg->msg_iter, chunk, &csum)) goto fault; -if (csum_fold (csum)) - goto csum_error; + +if (csum_fold (csum)) { +iov_iter_revert (&msg->msg_iter, chunk); +return -EINVAL ; + } +if (unlikely (skb->ip_summed ==CHECKSUM_COMPLETE ))netdev_rx_csum_fault (skb->dev); }return 0 ; -csum_error: -iov_iter_revert (&msg->msg_iter, chunk); -return -EINVAL ; fault:return -EFAULT ; }
Greg Kroah-Hartman
maintainerPATCH 41/80 IB/core: For multicast functions, verify that LIDs are multicast LIDs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael J. Ruhl <[email protected]>
commit 8561eae60ff9417a50fa1fb2b83ae950dc5c1e21 upstream.
The Infiniband spec defines "A multicast address is defined by a MGID and a MLID" (section 10.5). Currently the MLID value is not validated.
Add check to verify that the MLID value is in the correct address range.
--- drivers/infiniband/core/verbs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/core/verbs.c +6 -2
@@ -1516,7 +1516,9 @@ int ib_attach_mcast(struct ib_qp *qp, unif (!qp->device->attach_mcast)return -ENOSYS ; -if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD ) +if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD || + lid <be16_to_cpu (IB_MULTICAST_LID_BASE ) || + lid ==be16_to_cpu (IB_LID_PERMISSIVE ))return -EINVAL ; ret = qp->device->attach_mcast (qp, gid, lid);
@@ -1532,7 +1534,9 @@ int ib_detach_mcast(struct ib_qp *qp, unif (!qp->device->detach_mcast)return -ENOSYS ; -if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD ) +if (gid->raw[0 ] !=0xff || qp->qp_type !=IB_QPT_UD || + lid <be16_to_cpu (IB_MULTICAST_LID_BASE ) || + lid ==be16_to_cpu (IB_LID_PERMISSIVE ))return -EINVAL ; ret = qp->device->detach_mcast (qp, gid, lid);
Greg Kroah-Hartman
maintainerPATCH 43/80 IB/mlx4: Fix ib device initialization error flow
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit 99e68909d5aba1861897fe7afc3306c3c81b6de0 upstream.
In mlx4_ib_add, procedure mlx4_ib_alloc_eqs is called to allocate EQs.
However, in the mlx4_ib_add error flow, procedure mlx4_ib_free_eqs is not called to free the allocated EQs.
--- drivers/infiniband/hw/mlx4/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx4/main.c +1 -0
@@ -2926,6 +2926,7 @@ err_counter:mlx4_ib_delete_counters_table (ibdev, &ibdev->counters_table[i]); err_map: +mlx4_ib_free_eqs (dev, ibdev);iounmap (ibdev->uar_map); err_uar:
Greg Kroah-Hartman
maintainerPATCH 44/80 IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit fb7a91746af18b2ebf596778b38a709cdbc488d3 upstream.
A warning message during SRIOV multicast cleanup should have actually been a debug level message. The condition generating the warning does no harm and can fill the message log.
In some cases, during testing, some tests were so intense as to swamp the message log with these warning messages, causing a stall in the console message log output task. This stall caused an NMI to be sent to all CPUs (so that they all dumped their stacks into the message log). Aside from the message flood causing an NMI, the tests all passed.
Once the message flood which caused the NMI is removed (by reducing the warning message to debug level), the NMI no longer occurs.
Sample message log (console log) output illustrating the flood and resultant NMI (snippets with comments and modified with ... instead of hex digits, to satisfy checkpatch.pl):
<mlx4_ib> _mlx4_ib_mcg_port_cleanup: ... WARNING: group refcount 1!!!... *** About 4000 almost identical lines in less than one second *** <mlx4_ib> _mlx4_ib_mcg_port_cleanup: ... WARNING: group refcount 1!!!...
INFO: rcu_sched detected stalls on CPUs/tasks: { 17} (...)
*** { 17} above indicates that CPU 17 was the one that stalled ***
sending NMI to all CPUs:
...
NMI backtrace for cpu 17
CPU: 17 PID: 45909 Comm: kworker/17:2
Hardware name: HP ProLiant DL360p Gen8, BIOS P71 09/08/2013
Workqueue: events fb_flashcursor
task: ffff880478...... ti: ffff88064e...... task.ti: ffff88064e......
RIP: 0010:[ffffffff81......] [ffffffff81......] io_serial_in+0x15/0x20
RSP: 0018:ffff88064e257cb0 EFLAGS: 00000002
RAX: 0000000000...... RBX: ffffffff81...... RCX: 0000000000......
RDX: 0000000000...... RSI: 0000000000...... RDI: ffffffff81......
RBP: ffff88064e...... R08: ffffffff81...... R09: 0000000000......
R10: 0000000000...... R11: ffff88064e...... R12: 0000000000......
R13: 0000000000...... R14: ffffffff81...... R15: 0000000000......
FS: 0000000000......(0000) GS:ffff8804af......(0000) knlGS:000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080......
CR2: 00007f2a2f...... CR3: 0000000001...... CR4: 0000000000......
DR0: 0000000000...... DR1: 0000000000...... DR2: 0000000000......
DR3: 0000000000...... DR6: 00000000ff...... DR7: 0000000000......
Stack:
ffff88064e...... ffffffff81...... ffffffff81...... 0000000000......
ffffffff81...... ffff88064e...... ffffffff81...... ffffffff81......
ffffffff81...... ffff88064e...... ffffffff81...... 0000000000......
Call Trace:
[<ffffffff813d099b>] wait_for_xmitr+0x3b/0xa0
[<ffffffff813d0b5c>] serial8250_console_putchar+0x1c/0x30
[<ffffffff813d0b40>] ? serial8250_console_write+0x140/0x140
[<ffffffff813cb5fa>] uart_console_write+0x3a/0x80
[<ffffffff813d0aae>] serial8250_console_write+0xae/0x140
[<ffffffff8107c4d1>] call_console_drivers.constprop.15+0x91/0xf0
[<ffffffff8107d6cf>] console_unlock+0x3bf/0x400
[<ffffffff813503cd>] fb_flashcursor+0x5d/0x140
[<ffffffff81355c30>] ? bit_clear+0x120/0x120
[<ffffffff8109d5fb>] process_one_work+0x17b/0x470
[<ffffffff8109e3cb>] worker_thread+0x11b/0x400
[<ffffffff8109e2b0>] ? rescuer_thread+0x400/0x400
[<ffffffff810a5aef>] kthread+0xcf/0xe0
[<ffffffff810a5a20>] ? kthread_create_on_node+0x140/0x140
[<ffffffff81645858>] ret_from_fork+0x58/0x90
[<ffffffff810a5a20>] ? kthread_create_on_node+0x140/0x140
Code: 48 89 e5 d3 e6 48 63 f6 48 03 77 10 8b 06 5d c3 66 0f 1f 44 00 00 66 66 66 6As indicated in the stack trace above, the console output task got swamped.
--- drivers/infiniband/hw/mlx4/mcg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/mcg.c +2 -1
@@ -1102,7 +1102,8 @@ static void _mlx4_ib_mcg_port_cleanup(stwhile ((p =rb_first (&ctx->mcg_table)) !=NULL ) { group = rb_entry(p, struct mcast_group, node);if (atomic_read (&group->refcount)) -mcg_warn_group (group,"group refcount %d!!! (pointer %p)\n" ,atomic_read (&group->refcount), group); +mcg_debug_group (group,"group refcount %d!!! (pointer %p)\n" , +atomic_read (&group->refcount), group);force_clean_group (group); }
Greg Kroah-Hartman
maintainerPATCH 45/80 IB/hfi1: Prevent kernel QP post send hard lockups
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <[email protected]>
commit b6eac931b9bb2bce4db7032c35b41e5e34ec22a5 upstream.
The driver progress routines can call cond_resched() when a timeslice is exhausted and irqs are enabled.
If the ULP had been holding a spin lock without disabling irqs and the post send directly called the progress routine, the cond_resched() could yield allowing another thread from the same ULP to deadlock on that same lock.
Correct by replacing the current hfi1_do_send() calldown with a unique one for post send and adding an argument to hfi1_do_send() to indicate
that the send engine is running in a thread. If the routine is not
running in a thread, avoid calling cond_resched().
--- drivers/infiniband/hw/hfi1/ruc.c | 26 ++++++++++++++++---------- drivers/infiniband/hw/hfi1/verbs.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs.h | 6 ++++-- 3 files changed, 22 insertions(+), 14 deletions(-)
drivers/infiniband/hw/hfi1/ruc.c +16 -10
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015, 2016 Intel Corporation. +* Copyright(c) 2015 - 2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -833,23 +833,29 @@ void hfi1_make_ruc_header(struct rvt_qp/* when sending, force a reschedule every one of these periods */ #define SEND_RESCHED_TIMEOUT (5 * HZ)/* 5s in jiffies */ +void hfi1_do_send_from_rvt (struct rvt_qp *qp) +{ +hfi1_do_send (qp, false); +} +void _hfi1_do_send (struct work_struct *work) { struct iowait *wait = container_of(work, struct iowait, iowork);struct rvt_qp *qp =iowait_to_qp (wait); -hfi1_do_send (qp); +hfi1_do_send (qp, true); }/** * hfi1_do_send - perform a send on a QP * @work: contains a pointer to the QP +* @in_thread: true if in a workqueue thread * * Process entries in the send work queue until credit or queue is * exhausted. Only allow one CPU to send a packet per QP. * Otherwise, two threads could send packets out of order. */ -void hfi1_do_send (struct rvt_qp *qp) +void hfi1_do_send (struct rvt_qp *qp,bool in_thread) {struct hfi1_pkt_state ps;struct hfi1_qp_priv *priv = qp->priv;
@@ -917,8 +923,10 @@ void hfi1_do_send(struct rvt_qp *qp) qp->s_hdrwords =0 ;/* allow other tasks to run */ if (unlikely (time_after (jiffies, timeout))) { -if (workqueue_congested (cpu, - ps.ppd->hfi1_wq)) { +if (!in_thread || +workqueue_congested ( + cpu, + ps.ppd->hfi1_wq)) {spin_lock_irqsave ( &qp->s_lock, ps.flags);
@@ -931,11 +939,9 @@ void hfi1_do_send(struct rvt_qp *qp) *ps.ppd->dd->send_schedule);return ; } -if (!irqs_disabled ()) { -cond_resched (); -this_cpu_inc ( - *ps.ppd->dd->send_schedule); - } +cond_resched (); +this_cpu_inc ( + *ps.ppd->dd->send_schedule); timeout = jiffies + (timeout_int) /8 ; }spin_lock_irqsave (&qp->s_lock, ps.flags);
drivers/infiniband/hw/hfi1/verbs.c +2 -2
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015, 2016 Intel Corporation. +* Copyright(c) 2015 - 2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -1697,7 +1697,7 @@ int hfi1_register_ib_device(struct hfi1_ dd->verbs_dev.rdi.driver_f.qp_priv_free = qp_priv_free; dd->verbs_dev.rdi.driver_f.free_all_qps = free_all_qps; dd->verbs_dev.rdi.driver_f.notify_qp_reset = notify_qp_reset; - dd->verbs_dev.rdi.driver_f.do_send = hfi1_do_send; + dd->verbs_dev.rdi.driver_f.do_send = hfi1_do_send_from_rvt; dd->verbs_dev.rdi.driver_f.schedule_send = hfi1_schedule_send; dd->verbs_dev.rdi.driver_f.schedule_send_no_lock = _hfi1_schedule_send; dd->verbs_dev.rdi.driver_f.get_pmtu_from_attr = get_pmtu_from_attr;
drivers/infiniband/hw/hfi1/verbs.h +4 -2
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015, 2016 Intel Corporation. +* Copyright(c) 2015 - 2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -372,7 +372,9 @@ void hfi1_make_ruc_header(struct rvt_qpvoid _hfi1_do_send (struct work_struct *work); -void hfi1_do_send (struct rvt_qp *qp); +void hfi1_do_send_from_rvt (struct rvt_qp *qp); + +void hfi1_do_send (struct rvt_qp *qp,bool in_thread);void hfi1_send_complete (struct rvt_qp *qp,struct rvt_swqe *wqe,enum ib_wc_status status);
Greg Kroah-Hartman
maintainerPATCH 47/80 ext4: evict inline data when writing to memory map
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 7b4cc9787fe35b3ee2dfb1c35e22eafc32e00c33 upstream.
Currently the case of writing via mmap to a file with inline data is not handled. This is maybe a rare case since it requires a writable memory map of a very small file, but it is trivial to trigger with on inline_data filesystem, and it causes the 'BUG_ON(ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA));' in ext4_writepages() to be hit:
mkfs.ext4 -O inline_data /dev/vdb
mount /dev/vdb /mnt
xfs_io -f /mnt/file \
-c 'pwrite 0 1' \
-c 'mmap -w 0 1m' \
-c 'mwrite 0 1' \
-c 'fsync'
kernel BUG at fs/ext4/inode.c:2723!
invalid opcode: 0000 [#1] SMP
CPU: 1 PID: 2532 Comm: xfs_io Not tainted 4.11.0-rc1-xfstests-00301-g071d9acf3d1f #633
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-20170228_101828-anatol 04/01/2014
task: ffff88003d3a8040 task.stack: ffffc90000300000
RIP: 0010:ext4_writepages+0xc89/0xf8a
RSP: 0018:ffffc90000303ca0 EFLAGS: 00010283
RAX: 0000028410000000 RBX: ffff8800383fa3b0 RCX: ffffffff812afcdc
RDX: 00000a9d00000246 RSI: ffffffff81e660e0 RDI: 0000000000000246
RBP: ffffc90000303dc0 R08: 0000000000000002 R09: 869618e8f99b4fa5
R10: 00000000852287a2 R11: 00000000a03b49f4 R12: ffff88003808e698
R13: 0000000000000000 R14: 7fffffffffffffff R15: 7fffffffffffffff
FS: 00007fd3e53094c0(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd3e4c51000 CR3: 000000003d554000 CR4: 00000000003406e0
Call Trace:
? _raw_spin_unlock+0x27/0x2a
? kvm_clock_read+0x1e/0x20
do_writepages+0x23/0x2c
? do_writepages+0x23/0x2c
__filemap_fdatawrite_range+0x80/0x87
filemap_write_and_wait_range+0x67/0x8c
ext4_sync_file+0x20e/0x472
vfs_fsync_range+0x8e/0x9f
? syscall_trace_enter+0x25b/0x2d0
vfs_fsync+0x1c/0x1e
do_fsync+0x31/0x4a
SyS_fsync+0x10/0x14
do_syscall_64+0x69/0x131
entry_SYSCALL64_slow_path+0x25/0x25We could try to be smart and keep the inline data in this case, or at least support delayed allocation when allocating the block, but these solutions would be more complicated and don't seem worthwhile given how rare this case seems to be. So just fix the bug by calling ext4_convert_inline_data() when we're asked to make a page writable, so that any inline data gets evicted, with the block allocated immediately.
--- fs/ext4/inode.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ext4/inode.c +5 -0
@@ -5686,6 +5686,11 @@ int ext4_page_mkwrite(struct vm_area_strfile_update_time (vma->vm_file);down_read (&EXT4_I (inode)->i_mmap_sem); + + ret =ext4_convert_inline_data (inode); +if (ret) + goto out_ret; +/* Delalloc case is easy... */ if (test_opt(inode->i_sb, DELALLOC) && !ext4_should_journal_data(inode) &&
Greg Kroah-Hartman
maintainerPATCH 48/80 orangefs: fix bounds check for listxattr
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Brandenburg <[email protected]>
commit a956af337b9ff25822d9ce1a59c6ed0c09fc14b9 upstream.
--- fs/orangefs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/xattr.c +1 -1
@@ -358,7 +358,7 @@ try_again: returned_count = new_op->downcall.resp.listxattr.returned_count;if (returned_count <0 || - returned_count >=ORANGEFS_MAX_XATTR_LISTLEN ) { + returned_count >ORANGEFS_MAX_XATTR_LISTLEN ) {gossip_err ("%s: impossible value for returned_count:%d:\n" , __func__, returned_count);
Greg Kroah-Hartman
maintainerPATCH 49/80 orangefs: clean up oversize xattr validation
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Brandenburg <[email protected]>
commit e675c5ec51fe2554719a7b6bcdbef0a770f2c19b upstream.
Also don't check flags as this has been validated by the VFS already.
Fix an off-by-one error in the max size checking.
Stop logging just because userspace wants to write attributes which do not fit.
This and the previous commit fix xfstests generic/020.
--- fs/orangefs/xattr.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-)
fs/orangefs/xattr.c +7 -17
@@ -76,11 +76,8 @@ ssize_t orangefs_inode_getxattr(struct iif (S_ISLNK (inode->i_mode))return -EOPNOTSUPP ; -if (strlen (name) >=ORANGEFS_MAX_XATTR_NAMELEN ) { -gossip_err ("Invalid key length (%d)\n" , - (int )strlen (name)); +if (strlen (name) >ORANGEFS_MAX_XATTR_NAMELEN )return -EINVAL ; - } fsuid =from_kuid (&init_user_ns,current_fsuid ()); fsgid =from_kgid (&init_user_ns,current_fsgid ());
@@ -172,6 +169,9 @@ static int orangefs_inode_removexattr(ststruct orangefs_kernel_op_s *new_op =NULL ;int ret = -ENOMEM ; +if (strlen (name) >ORANGEFS_MAX_XATTR_NAMELEN ) +return -EINVAL ; +down_write (&orangefs_inode->xattr_sem); new_op =op_alloc (ORANGEFS_VFS_OP_REMOVEXATTR );if (!new_op)
@@ -231,23 +231,13 @@ int orangefs_inode_setxattr(struct inode"%s: name %s, buffer_size %zd\n" , __func__, name, size); -if (size >=ORANGEFS_MAX_XATTR_VALUELEN || - flags <0 ) { -gossip_err ("orangefs_inode_setxattr: bogus values of size(%d), flags(%d)\n" , - (int )size, - flags); +if (size >ORANGEFS_MAX_XATTR_VALUELEN ) +return -EINVAL ; +if (strlen (name) >ORANGEFS_MAX_XATTR_NAMELEN )return -EINVAL ; - } internal_flag =convert_to_internal_xattr_flags (flags); -if (strlen (name) >=ORANGEFS_MAX_XATTR_NAMELEN ) { -gossip_err - ("orangefs_inode_setxattr: bogus key size (%d)\n" , - (int )(strlen (name))); -return -EINVAL ; - } -/* This is equivalent to a removexattr */ if (size ==0 && value ==NULL ) { gossip_debug(GOSSIP_XATTR_DEBUG,
Greg Kroah-Hartman
maintainerPATCH 51/80 orangefs: do not check possibly stale size on truncate
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Brandenburg <[email protected]>
commit 53950ef541675df48c219a8d665111a0e68dfc2f upstream.
Let the server figure this out because our size might be out of date or not present.
The bug was that
xfs_io -f -t -c "pread -v 0 100" /mnt/foo echo "Test" > /mnt/foo xfs_io -f -t -c "pread -v 0 100" /mnt/foo
fails because the second truncate did not happen if nothing had requested the size after the write in echo. Thus i_size was zero (not present) and the orangefs_setattr though i_size was zero and there was nothing to do.
--- fs/orangefs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/orangefs/inode.c +1 -2
@@ -223,8 +223,7 @@ int orangefs_setattr(struct dentry *dentif (ret) goto out; -if ((iattr->ia_valid &ATTR_SIZE ) && - iattr->ia_size !=i_size_read (inode)) { +if (iattr->ia_valid &ATTR_SIZE ) { ret =orangefs_setattr_size (inode, iattr);if (ret) goto out;
Greg Kroah-Hartman
maintainerPATCH 53/80 ceph: fix memory leak in __ceph_setxattr()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luis Henriques <[email protected]>
commit eeca958dce0a9231d1969f86196653eb50fcc9b3 upstream.
The ceph_inode_xattr needs to be released when removing an xattr. Easily reproducible running the 'generic/020' test from xfstests or simply by doing:
attr -s attr0 -V 0 /mnt/test && attr -r attr0 /mnt/test
While there, also fix the error path.
Here's the kmemleak splat:
unreferenced object 0xffff88001f86fbc0 (size 64):
comm "attr", pid 244, jiffies 4294904246 (age 98.464s) hex dump (first 32 bytes):
40 fa 86 1f 00 88 ff ff 80 32 38 1f 00 88 ff ff @........28.....
00 01 00 00 00 00 ad de 00 02 00 00 00 00 ad de ................
backtrace:
[<ffffffff81560199>] kmemleak_alloc+0x49/0xa0
[<ffffffff810f3e5b>] kmem_cache_alloc+0x9b/0xf0
[<ffffffff812b157e>] __ceph_setxattr+0x17e/0x820
[<ffffffff812b1c57>] ceph_set_xattr_handler+0x37/0x40
[<ffffffff8111fb4b>] __vfs_removexattr+0x4b/0x60
[<ffffffff8111fd37>] vfs_removexattr+0x77/0xd0
[<ffffffff8111fdd1>] removexattr+0x41/0x60
[<ffffffff8111fe65>] path_removexattr+0x75/0xa0
[<ffffffff81120aeb>] SyS_lremovexattr+0xb/0x10
[<ffffffff81564b20>] entry_SYSCALL_64_fastpath+0x13/0x94
[<ffffffffffffffff>] 0xffffffffffffffff--- fs/ceph/xattr.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ceph/xattr.c +3 -0
@@ -392,6 +392,7 @@ static int __set_xattr(struct ceph_inodeif (update_xattr) {int err =0 ; +if (xattr && (flags &XATTR_CREATE )) err = -EEXIST ;else if (!xattr && (flags &XATTR_REPLACE ))
@@ -399,12 +400,14 @@ static int __set_xattr(struct ceph_inodeif (err) {kfree (name);kfree (val); +kfree (*newxattr);return err; }if (update_xattr <0 ) {if (xattr)__remove_xattr (ci, xattr);kfree (name); +kfree (*newxattr);return 0 ; } }
Greg Kroah-Hartman
maintainerPATCH 58/80 SMB3: Work around mount failure when using SMB3 dialect to Macs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 7db0a6efdc3e990cdfd4b24820d010e9eb7890ad upstream.
Macs send the maximum buffer size in response on ioctl to validate negotiate security information, which causes us to fail the mount as the response buffer is larger than the expected response.
Changed ioctl response processing to allow for padding of validate negotiate ioctl response and limit the maximum response size to maximum buffer size.
--- fs/cifs/smb2pdu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/cifs/smb2pdu.c +11 -3
@@ -569,8 +569,12 @@ int smb3_validate_negotiate(const unsign }if (rsplen !=sizeof (struct validate_negotiate_info_rsp )) { -cifs_dbg (VFS ,"invalid size of protocol negotiate response\n" ); -return -EIO ; +cifs_dbg (VFS ,"invalid protocol negotiate response size: %d\n" , + rsplen); + +/* relax check since Mac returns max bufsize allowed on ioctl */ +if (rsplen > CIFSMaxBufSize) +return -EIO ; }/* check validate negotiate info response matches what we got earlier */
@@ -1670,8 +1674,12 @@ SMB2_ioctl(const unsigned int xid, struc* than one credit. Windows typically sets this smaller, but for some * ioctls it may be useful to allow server to send more. No point * limiting what the server can send as long as fits in one credit +* Unfortunately - we can not handle more than CIFS_MAX_MSG_SIZE +* (by default, note that it can be overridden to make max larger) +* in responses (except for read responses which can be bigger. +* We may want to bump this limit up */ - req->MaxOutputResponse =cpu_to_le32 (0xFF00 );/* < 64K uses 1 credit */ + req->MaxOutputResponse =cpu_to_le32 (CIFSMaxBufSize);if (is_fsctl) req->Flags =cpu_to_le32 (SMB2_0_IOCTL_IS_FSCTL );
Greg Kroah-Hartman
maintainerPATCH 60/80 cifs: fix leak in FSCTL_ENUM_SNAPS response handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Disseldorp <[email protected]>
commit 0e5c795592930d51fd30d53a2e7b73cba022a29b upstream.
The server may respond with success, and an output buffer less than sizeof(struct smb_snapshot_array) in length. Do not leak the output buffer in this case.
--- fs/cifs/smb2ops.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/smb2ops.c +1 -0
@@ -924,6 +924,7 @@ smb3_enum_snapshots(const unsigned int x }if (snapshot_in.snapshot_array_size <sizeof (struct smb_snapshot_array )) { rc = -ERANGE ; +kfree (retbuf);return rc; }
Greg Kroah-Hartman
maintainerPATCH 61/80 cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Disseldorp <[email protected]>
commit 6026685de33b0db5b2b6b0e9b41b3a1a3261033c upstream.
As with 618763958b22, an open directory may have a NULL private_data pointer prior to readdir. CIFS_ENUMERATE_SNAPSHOTS must check for this before dereference.
--- fs/cifs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/cifs/ioctl.c +2 -0
@@ -268,6 +268,8 @@ long cifs_ioctl(struct file *filep, unsi rc =smb_mnt_get_fsinfo (xid, tcon, (void __user *)arg);break ;case CIFS_ENUMERATE_SNAPSHOTS : +if (pSMBFile ==NULL ) +break ;if (arg ==0 ) { rc = -EINVAL ; goto cifs_ioc_exit;
Greg Kroah-Hartman
maintainerPATCH 63/80 cifs: fix CIFS_IOC_GET_MNT_INFO oops
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Disseldorp <[email protected]>
commit d8a6e505d6bba2250852fbc1c1c86fe68aaf9af3 upstream.
An open directory may have a NULL private_data pointer prior to readdir.
--- fs/cifs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/cifs/ioctl.c +2 -0
@@ -264,6 +264,8 @@ long cifs_ioctl(struct file *filep, unsi rc = -EOPNOTSUPP ;break ;case CIFS_IOC_GET_MNT_INFO : +if (pSMBFile ==NULL ) +break ; tcon =tlink_tcon (pSMBFile->tlink); rc =smb_mnt_get_fsinfo (xid, tcon, (void __user *)arg);break ;
Greg Kroah-Hartman
maintainerPATCH 66/80 device-dax: fix cdev leak
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit ed01e50acdd3e4a640cf9ebd28a7e810c3ceca97 upstream.
If device_add() fails, cleanup the cdev. Otherwise, we leak a kobj_map() with a stale device number.
As Jason points out, there is a small possibility that userspace has opened and mapped the device in the time between cdev_add() and the device_add() failure. We need a new kill_dax_dev() helper to invalidate any established mappings.
--- drivers/dax/dax.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/dax/dax.c +11 -4
@@ -553,13 +553,10 @@ static void dax_dev_release(struct devickfree (dax_dev); } -static void unregister_dax_dev (void *dev) +static void kill_dax_dev (struct dax_dev *dax_dev) { -struct dax_dev *dax_dev =to_dax_dev (dev);struct cdev *cdev = &dax_dev->cdev; -dev_dbg (dev,"%s\n" , __func__); -/* * Note, rcu is not protecting the liveness of dax_dev, rcu is * ensuring that any fault handlers that might have seen
@@ -571,6 +568,15 @@ static void unregister_dax_dev(void *devsynchronize_srcu (&dax_srcu);unmap_mapping_range (dax_dev->inode->i_mapping,0 ,0 ,1 );cdev_del (cdev); +} + +static void unregister_dax_dev (void *dev) +{ +struct dax_dev *dax_dev =to_dax_dev (dev); + +dev_dbg (dev,"%s\n" , __func__); + +kill_dax_dev (dax_dev);device_unregister (dev); }
@@ -647,6 +653,7 @@ struct dax_dev *devm_create_dax_dev(strudev_set_name (dev,"dax%d.%d" , dax_region->id, dax_dev->id); rc =device_add (dev);if (rc) { +kill_dax_dev (dax_dev);put_device (dev);return ERR_PTR (rc); }
Greg Kroah-Hartman
maintainerPATCH 69/80 serial: omap: fix runtime-pm handling on unbind
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 099bd73dc17ed77aa8c98323e043613b6e8f54fc upstream.
An unbalanced and misplaced synchronous put was used to suspend the device on driver unbind, something which with a likewise misplaced pm_runtime_disable leads to external aborts when an open port is being removed.
Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa024010
...
[<c046e760>] (serial_omap_set_mctrl) from [<c046a064>] (uart_update_mctrl+0x50/0x60) [<c046a064>] (uart_update_mctrl) from [<c046a400>] (uart_shutdown+0xbc/0x138) [<c046a400>] (uart_shutdown) from [<c046bd2c>] (uart_hangup+0x94/0x190) [<c046bd2c>] (uart_hangup) from [<c045b760>] (__tty_hangup+0x404/0x41c) [<c045b760>] (__tty_hangup) from [<c045b794>] (tty_vhangup+0x1c/0x20) [<c045b794>] (tty_vhangup) from [<c046ccc8>] (uart_remove_one_port+0xec/0x260) [<c046ccc8>] (uart_remove_one_port) from [<c046ef4c>] (serial_omap_remove+0x40/0x60) [<c046ef4c>] (serial_omap_remove) from [<c04845e8>] (platform_drv_remove+0x34/0x4c)
Fix this up by resuming the device before deregistering the port and by suspending and disabling runtime pm only after the port has been removed.
Also make sure to disable autosuspend before disabling runtime pm so that the usage count is balanced and device actually suspended before returning.
Note that due to a negative autosuspend delay being set in probe, the unbalanced put would actually suspend the device on first driver unbind, while rebinding and again unbinding would result in a negative power.usage_count.
--- drivers/tty/serial/omap-serial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/omap-serial.c +5 -1
@@ -1725,9 +1725,13 @@ static int serial_omap_remove(struct pla {struct uart_omap_port *up =platform_get_drvdata (dev); +pm_runtime_get_sync (up->dev); + +uart_remove_one_port (&serial_omap_reg, &up->port); + +pm_runtime_dont_use_autosuspend (up->dev);pm_runtime_put_sync (up->dev);pm_runtime_disable (up->dev); -uart_remove_one_port (&serial_omap_reg, &up->port);pm_qos_remove_request (&up->pm_qos_request);device_init_wakeup (&dev->dev, false);
Greg Kroah-Hartman
maintainerPATCH 71/80 tty: pty: Fix ldisc flush after userspace become aware of the data already
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang YanQing <[email protected]>
commit 77dae6134440420bac334581a3ccee94cee1c054 upstream.
While using emacs, cat or others' commands in konsole with recent kernels, I have met many times that CTRL-C freeze konsole. After konsole freeze I can't type anything, then I have to open a new one, it is very annoying.
See bug report:
https://bugs.kde.org/show_bug.cgi?id=175283
The platform in that bug report is Solaris, but now the pty in linux has the same problem or the same behavior as Solaris :)
It has high possibility to trigger the problem follow steps below:
Note: In my test, BigFile is a text file whose size is bigger than 1G 1:open konsole
1:cat BigFile
2:CTRL-C
After some digging, I find out the reason is that commit 1d1d14da12e7 ("pty: Fix buffer flush deadlock") changes the behavior of pty_flush_buffer.
Thread A Thread B
-------- --------
1:n_tty_poll return POLLIN
2:CTRL-C trigger pty_flush_buffer
tty_buffer_flush
n_tty_flush_buffer
3:attempt to check count of chars:
ioctl(fd, TIOCINQ, &available)
available is equal to 0
4:read(fd, buffer, avaiable)
return 0
5:konsole close fd
Yes, I know we could use the same patch included in the BUG report as a workaround for linux platform too. But I think the data in ldisc is belong to application of another side, we shouldn't clear it when we want to flush write buffer of this side in pty_flush_buffer. So I think it is better to disable ldisc flush in pty_flush_buffer, because its new hehavior bring no benefit except that it mess up the behavior between POLLIN, and TIOCINQ or FIONREAD.
Also I find no flush_buffer function in others' tty driver has the same behavior as current pty_flush_buffer.
--- drivers/tty/pty.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/tty/pty.c +1 -6
@@ -216,16 +216,11 @@ static int pty_signal(struct tty_structstatic void pty_flush_buffer (struct tty_struct *tty) {struct tty_struct *to = tty->link; -struct tty_ldisc *ld;if (!to)return ; - ld =tty_ldisc_ref (to); -tty_buffer_flush (to, ld); -if (ld) -tty_ldisc_deref (ld); - +tty_buffer_flush (to,NULL );if (to->packet) {spin_lock_irq (&tty->ctrl_lock); tty->ctrl_status |=TIOCPKT_FLUSHWRITE ;
Greg Kroah-Hartman
maintainerPATCH 72/80 Bluetooth: Fix user channel for 32bit userspace on 64bit kernel
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Szymon Janc <[email protected]>
commit ab89f0bdd63a3721f7cd3f064f39fc4ac7ca14d4 upstream.
Running 32bit userspace on 64bit kernel results in MSG_CMSG_COMPAT being defined as 0x80000000. This results in sendmsg failure if used from 32bit userspace running on 64bit kernel. Fix this by accounting for MSG_CMSG_COMPAT in flags check in hci_sock_sendmsg.
--- net/bluetooth/hci_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/hci_sock.c +2 -1
@@ -1680,7 +1680,8 @@ static int hci_sock_sendmsg(struct sockeif (msg->msg_flags &MSG_OOB )return -EOPNOTSUPP ; -if (msg->msg_flags & ~(MSG_DONTWAIT |MSG_NOSIGNAL |MSG_ERRQUEUE )) +if (msg->msg_flags & ~(MSG_DONTWAIT |MSG_NOSIGNAL |MSG_ERRQUEUE | +MSG_CMSG_COMPAT ))return -EINVAL ;if (len <4 || len >HCI_MAX_FRAME_SIZE )
Greg Kroah-Hartman
maintainerPATCH 75/80 ipmi: Fix kernel panic at ipmi_ssif_thread()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joeseph Chang <[email protected]>
commit 6de65fcfdb51835789b245203d1bfc8d14cb1e06 upstream.
msg_written_handler() may set ssif_info->multi_data to NULL when using ipmitool to write fru.
Before setting ssif_info->multi_data to NULL, add new local pointer "data_to_send" and store correct i2c data pointer to it to fix NULL pointer kernel panic and incorrect ssif_info->multi_pos.
--- drivers/char/ipmi/ipmi_ssif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_ssif.c +3 -1
@@ -892,6 +892,7 @@ static void msg_written_handler(struct s* for details on the intricacies of this. */ int left; +unsigned char *data_to_send;ssif_inc_stat (ssif_info, sent_messages_parts);
@@ -900,6 +901,7 @@ static void msg_written_handler(struct s left =32 ;/* Length byte. */ ssif_info->multi_data[ssif_info->multi_pos] = left; + data_to_send = ssif_info->multi_data + ssif_info->multi_pos; ssif_info->multi_pos += left;if (left <32 )/*
@@ -913,7 +915,7 @@ static void msg_written_handler(struct s rv =ssif_i2c_send (ssif_info, msg_written_handler,I2C_SMBUS_WRITE ,SSIF_IPMI_MULTI_PART_REQUEST_MIDDLE , - ssif_info->multi_data + ssif_info->multi_pos, + data_to_send,I2C_SMBUS_BLOCK_DATA );if (rv <0 ) {/* request failed, just return the error. */
Greg Kroah-Hartman
maintainerPATCH 78/80 libnvdimm, pfn: fix npfns vs section alignment
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit d5483feda85a8f39ee2e940e279547c686aac30c upstream.
Fix failures to create namespaces due to the vmem_altmap not advertising enough free space to store the memmap.
WARNING: CPU: 15 PID: 8022 at arch/x86/mm/init_64.c:656 arch_add_memory+0xde/0xf0 [..] Call Trace: dump_stack+0x63/0x83 __warn+0xcb/0xf0 warn_slowpath_null+0x1d/0x20 arch_add_memory+0xde/0xf0 devm_memremap_pages+0x244/0x440 pmem_attach_disk+0x37e/0x490 [nd_pmem] nd_pmem_probe+0x7e/0xa0 [nd_pmem] nvdimm_bus_probe+0x71/0x120 [libnvdimm] driver_probe_device+0x2bb/0x460 bind_store+0x114/0x160 drv_attr_store+0x25/0x30
In commit 658922e57b84 "libnvdimm, pfn: fix memmap reservation sizing" we arranged for the capacity to be allocated, but failed to also update the 'npfns' parameter. This leads to cases where there is enough capacity reserved to hold all the allocated sections, but vmemmap_populate_hugepages() still encounters -ENOMEM from altmap_alloc_block_buf().
This fix is a stop-gap until we can teach the core memory hotplug implementation to permit sub-section hotplug.
--- drivers/nvdimm/pfn_devs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/nvdimm/pfn_devs.c +4 -2
@@ -538,7 +538,8 @@ static struct vmem_altmap *__nvdimm_setu nd_pfn->npfns =le64_to_cpu (pfn_sb->npfns); altmap =NULL ; }else if (nd_pfn->mode ==PFN_MODE_PMEM ) { - nd_pfn->npfns = (resource_size (res) - offset) /PAGE_SIZE ; + nd_pfn->npfns =PFN_SECTION_ALIGN_UP ((resource_size (res) + - offset) /PAGE_SIZE );if (le64_to_cpu (nd_pfn->pfn_sb->npfns) > nd_pfn->npfns) dev_info(&nd_pfn->dev, "number of pfns truncated from %lld to %ld\n",
@@ -625,7 +626,8 @@ static int nd_pfn_init(struct nd_pfn *nd*/ start += start_pad; size =resource_size (&nsio->res); - npfns = (size - start_pad - end_trunc -SZ_8K ) /SZ_4K ; + npfns =PFN_SECTION_ALIGN_UP ((size - start_pad - end_trunc -SZ_8K ) + /PAGE_SIZE );if (nd_pfn->mode ==PFN_MODE_PMEM ) {/* * vmemmap_populate_hugepages() allocates the memmap array in
Greg Kroah-Hartman
maintainerPATCH 79/80 pstore: Fix flags to enable dumps on powerpc
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ankit Kumar <[email protected]>
commit 041939c1ec54208b42f5cd819209173d52a29d34 upstream.
After commit c950fd6f201a kernel registers pstore write based on flag set. Pstore write for powerpc is broken as flags(PSTORE_FLAGS_DMESG) is not set for powerpc architecture. On panic, kernel doesn't write message to /fs/pstore/dmesg*(Entry doesn't gets created at all).
This patch enables pstore write for powerpc architecture by setting PSTORE_FLAGS_DMESG flag.
--- arch/powerpc/kernel/nvram_64.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/nvram_64.c +1 -0
@@ -561,6 +561,7 @@ static ssize_t nvram_pstore_read(u64 *idstatic struct pstore_info nvram_pstore_info = { .owner =THIS_MODULE , .name ="nvram" , + .flags =PSTORE_FLAGS_DMESG , .open = nvram_pstore_open, .read = nvram_pstore_read, .write = nvram_pstore_write,
Greg Kroah-Hartman
maintainerPATCH 2/80 target: Fix compare_and_write_callback handling for non GOOD status
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit a71a5dc7f833943998e97ca8fa6a4c708a0ed1a9 upstream.
Following the bugfix for handling non SAM_STAT_GOOD COMPARE_AND_WRITE status during COMMIT phase in commit 9b2792c3da1, the same bug exists for the READ phase as well.
This would manifest first as a lost SCSI response, and eventual hung task during fabric driver logout or re-login, as existing shutdown logic waited for the COMPARE_AND_WRITE se_cmd->cmd_kref to reach zero.
To address this bug, compare_and_write_callback() has been changed to set post_ret = 1 and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE as necessary to signal failure status.
--- drivers/target/target_core_sbc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/target/target_core_sbc.c +4 -1
@@ -506,8 +506,11 @@ static sense_reason_t compare_and_write_* been failed with a non-zero SCSI status. */ if (cmd->scsi_status) { -pr_err ("compare_and_write_callback: non zero scsi_status:" +pr_debug ("compare_and_write_callback: non zero scsi_status:" " 0x%02x\n" , cmd->scsi_status); + *post_ret =1 ; +if (cmd->scsi_status ==SAM_STAT_CHECK_CONDITION ) + ret =TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 14/80 staging: comedi: jr3_pci: cope with jiffies wraparound
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 8ec04a491825e08068e92bed0bba7821893b6433 upstream.
The timer expiry routine jr3_pci_poll_dev() checks for expiry by checking whether the absolute value of jiffies (stored in local variable now) is greater than the expected expiry time in jiffy units. This will fail when jiffies wraps around. Also, it seems to make sense to handle the expiry one jiffy earlier than the current test. Use time_after_eq() to check for expiry.
--- drivers/staging/comedi/drivers/jr3_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/jr3_pci.c +1 -1
@@ -611,7 +611,7 @@ static void jr3_pci_poll_dev(unsigned lo s = &dev->subdevices[i]; spriv = s->private; -if (now > spriv->next_time_min) { +if (time_after_eq (now, spriv->next_time_min)) {struct jr3_pci_poll_delay sub_delay; sub_delay =jr3_pci_poll_subdevice (s);
Greg Kroah-Hartman
maintainerPATCH 11/80 staging: vt6656: use off stack for out buffer USB transfers.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 12ecd24ef93277e4e5feaf27b0b18f2d3828bc5e upstream.
Since 4.9 mandated USB buffers be heap allocated this causes the driver to fail.
Since there is a wide range of buffer sizes use kmemdup to create allocated buffer.
--- drivers/staging/vt6656/usbpipe.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/staging/vt6656/usbpipe.c +12 -2
@@ -47,15 +47,25 @@ int vnt_control_out(struct vnt_private * u16 index, u16 length, u8 *buffer) { int status = 0; +u8 *usb_buffer;if (test_bit (DEVICE_FLAGS_DISCONNECTED , &priv->flags))return STATUS_FAILURE ;mutex_lock (&priv->usb_lock); + usb_buffer =kmemdup (buffer, length,GFP_KERNEL ); +if (!usb_buffer) { +mutex_unlock (&priv->usb_lock); +return -ENOMEM ; + } + status =usb_control_msg (priv->usb, -usb_sndctrlpipe (priv->usb,0 ), request,0x40 , value, - index, buffer, length,USB_CTL_WAIT ); +usb_sndctrlpipe (priv->usb,0 ), + request,0x40 , value, + index, usb_buffer, length,USB_CTL_WAIT ); + +kfree (usb_buffer);mutex_unlock (&priv->usb_lock);
Greg Kroah-Hartman
maintainerPATCH 18/80 usb: hub: Fix error loop seen after hub communication errors
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 245b2eecee2aac6fdc77dcafaa73c33f9644c3c7 upstream.
While stress testing a usb controller using a bind/unbind looop, the following error loop was observed.
usb 7-1.2: new low-speed USB device number 3 using xhci-hcd
usb 7-1.2: hub failed to enable device, error -108
usb 7-1-port2: cannot disable (err = -22)
usb 7-1-port2: couldn't allocate usb_device
usb 7-1-port2: cannot disable (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
** 57 printk messages dropped ** hub 7-1:1.0: activate --> -22
** 82 printk messages dropped ** hub 7-1:1.0: hub_ext_port_status failed (err = -22)
This continues forever. After adding tracebacks into the code, the call sequence leading to this is found to be as follows.
[<ffffffc0007fc8e0>] hub_activate+0x368/0x7b8 [<ffffffc0007fceb4>] hub_resume+0x2c/0x3c [<ffffffc00080b3b8>] usb_resume_interface.isra.6+0x128/0x158 [<ffffffc00080b5d0>] usb_suspend_both+0x1e8/0x288 [<ffffffc00080c9c4>] usb_runtime_suspend+0x3c/0x98 [<ffffffc0007820a0>] __rpm_callback+0x48/0x7c [<ffffffc00078217c>] rpm_callback+0xa8/0xd4 [<ffffffc000786234>] rpm_suspend+0x84/0x758 [<ffffffc000786ca4>] rpm_idle+0x2c8/0x498 [<ffffffc000786ed4>] __pm_runtime_idle+0x60/0xac [<ffffffc00080eba8>] usb_autopm_put_interface+0x6c/0x7c [<ffffffc000803798>] hub_event+0x10ac/0x12ac [<ffffffc000249bb8>] process_one_work+0x390/0x6b8 [<ffffffc00024abcc>] worker_thread+0x480/0x610 [<ffffffc000251a80>] kthread+0x164/0x178 [<ffffffc0002045d0>] ret_from_fork+0x10/0x40
kick_hub_wq() is called from hub_activate() even after failures to communicate with the hub. This results in an endless sequence of hub event -> hub activate -> wq trigger -> hub event -> ...
Provide two solutions for the problem.
- Only trigger the hub event queue if communication with the hub is successful.
- After a suspend failure, only resume already suspended interfaces if the communication with the device is still possible.
Each of the changes fixes the observed problem. Use both to improve robustness.
--- drivers/usb/core/driver.c | 18 ++++++++++++++++++ drivers/usb/core/hub.c | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-)
drivers/usb/core/driver.c +18 -0
@@ -1328,6 +1328,24 @@ static int usb_suspend_both(struct usb_d*/ if (udev->parent && !PMSG_IS_AUTO (msg)) status =0 ; + +/* +* If the device is inaccessible, don't try to resume +* suspended interfaces and just return the error. +*/ +if (status && status != -EBUSY ) { +int err; +u16 devstat; + + err =usb_get_status (udev,USB_RECIP_DEVICE ,0 , + &devstat); +if (err) { +dev_err (&udev->dev, +"Failed to suspend device, error %d\n" , + status); + goto done; + } + } }/* If the suspend failed, resume interfaces that did get suspended */
drivers/usb/core/hub.c +4 -1
@@ -1064,6 +1064,9 @@ static void hub_activate(struct usb_hub portstatus = portchange =0 ; status =hub_port_status (hub, port1, &portstatus, &portchange); +if (status) + goto abort; +if (udev || (portstatus &USB_PORT_STAT_CONNECTION ))dev_dbg (&port_dev->dev,"status %04x change %04x\n" , portstatus, portchange);
@@ -1196,7 +1199,7 @@ static void hub_activate(struct usb_hub/* Scan all ports that need attention */ kick_hub_wq (hub); - + abort:if (type ==HUB_INIT2 || type ==HUB_INIT3 ) {/* Allow autosuspend if it was suppressed */ disconnected:
Greg Kroah-Hartman
maintainerPATCH 3/80 target/fileio: Fix zero-length READ and WRITE handling
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 59ac9c078141b8fd0186c0b18660a1b2c24e724e upstream.
This patch fixes zero-length READ and WRITE handling in target/FILEIO, which was broken a long time back by:
Since:
commit d81cb44726f050d7cf1be4afd9cb45d153b52066
Author: Paolo Bonzini <[email protected]>
Date: Mon Sep 17 16:36:11 2012 -0700
target: go through normal processing for all zero-length commands
which moved zero-length READ and WRITE completion out of target-core, to doing submission into backend driver code.
To address this, go ahead and invoke target_complete_cmd() for any non negative return value in fd_do_rw().
--- drivers/target/target_core_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/target/target_core_file.c +1 -2
@@ -594,8 +594,7 @@ fd_execute_rw(struct se_cmd *cmd, structif (ret <0 )return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; -if (ret) -target_complete_cmd (cmd,SAM_STAT_GOOD ); +target_complete_cmd (cmd,SAM_STAT_GOOD );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 12/80 staging: gdm724x: gdm_mux: fix use-after-free on module unload
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit b58f45c8fc301fe83ee28cad3e64686c19e78f1c upstream.
Make sure to deregister the USB driver before releasing the tty driver to avoid use-after-free in the USB disconnect callback where the tty devices are deregistered.
--- drivers/staging/gdm724x/gdm_mux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/gdm724x/gdm_mux.c +1 -2
@@ -664,9 +664,8 @@ static int __init gdm_usb_mux_init(void) static void __exit gdm_usb_mux_exit(void) { -unregister_lte_tty_driver (); -usb_deregister (&gdm_mux_driver); +unregister_lte_tty_driver (); }module_init (gdm_usb_mux_init);
Greg Kroah-Hartman
maintainerPATCH 4/80 iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 197b806ae5db60c6f609d74da04ddb62ea5e1b00 upstream.
While testing modification of per se_node_acl queue_depth forcing session reinstatement via lio_target_nacl_cmdsn_depth_store() -> core_tpg_set_initiator_node_queue_depth(), a hung task bug triggered when changing cmdsn_depth invoked session reinstatement while an iscsi login was already waiting for session reinstatement to complete.
This can happen when an outstanding se_cmd descriptor is taking a long time to complete, and session reinstatement from iscsi login or cmdsn_depth change occurs concurrently.
To address this bug, explicitly set session_fall_back_to_erl0 = 1 when forcing session reinstatement, so session reinstatement is not attempted if an active session is already being shutdown.
This patch has been tested with two scenarios. The first when iscsi login is blocked waiting for iscsi session reinstatement to complete followed by queue_depth change via configfs, and second when queue_depth change via configfs us blocked followed by a iscsi login driven session reinstatement.
Note this patch depends on commit d36ad77f702 to handle multiple sessions per se_node_acl when changing cmdsn_depth, and for pre v4.5 kernels will need to be included for stable as well.
--- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_configfs.c | 1 + drivers/target/iscsi/iscsi_target_login.c | 1 + 3 files changed, 3 insertions(+)
drivers/target/iscsi/iscsi_target.c +1 -0
@@ -4671,6 +4671,7 @@ int iscsit_release_sessions_for_tpg(strucontinue ; }atomic_set (&sess->session_reinstatement,1 ); +atomic_set (&sess->session_fall_back_to_erl0,1 );spin_unlock (&sess->conn_lock);list_move_tail (&se_sess->sess_list, &free_list);
drivers/target/iscsi/iscsi_target_configfs.c +1 -0
@@ -1530,6 +1530,7 @@ static void lio_tpg_close_session(structreturn ; }atomic_set (&sess->session_reinstatement,1 ); +atomic_set (&sess->session_fall_back_to_erl0,1 );spin_unlock (&sess->conn_lock);iscsit_stop_time2retain_timer (sess);
drivers/target/iscsi/iscsi_target_login.c +1 -0
@@ -204,6 +204,7 @@ int iscsi_check_for_session_reinstatemen initiatorname_param->value) && (sess_p->sess_ops->SessionType == sessiontype))) {atomic_set (&sess_p->session_reinstatement,1 ); +atomic_set (&sess_p->session_fall_back_to_erl0,1 );spin_unlock (&sess_p->conn_lock);iscsit_inc_session_usage_count (sess_p);iscsit_stop_time2retain_timer (sess_p);
Greg Kroah-Hartman
maintainerPATCH 31/80 crypto: ccp - Use only the relevant interrupt bits
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary R Hook <[email protected]>
commit 56467cb11cf8ae4db9003f54b3d3425b5f07a10a upstream.
Each CCP queue can product interrupts for 4 conditions:
operation complete, queue empty, error, and queue stopped. This driver only works with completion and error events.
--- drivers/crypto/ccp/ccp-dev-v5.c | 9 +++++---- drivers/crypto/ccp/ccp-dev.h | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/crypto/ccp/ccp-dev-v5.c +5 -4
@@ -740,7 +740,7 @@ static int ccp5_init(struct ccp_device *ioread32 (cmd_q->reg_status);/* Clear the interrupts */ -iowrite32 (ALL_INTERRUPTS , cmd_q->reg_interrupt_status); +iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_interrupt_status); }dev_dbg (dev,"Requesting an IRQ...\n" );
@@ -824,7 +824,7 @@ static int ccp5_init(struct ccp_device */* Enable interrupts */ for (i =0 ; i < ccp->cmd_q_count; i++) { cmd_q = &ccp->cmd_q[i]; -iowrite32 (ALL_INTERRUPTS , cmd_q->reg_int_enable); +iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_int_enable); }dev_dbg (dev,"Registering device...\n" );
@@ -884,7 +884,7 @@ static void ccp5_destroy(struct ccp_deviiowrite32 (cmd_q->qcontrol & ~CMD5_Q_RUN , cmd_q->reg_control);/* Disable the interrupts */ -iowrite32 (ALL_INTERRUPTS , cmd_q->reg_interrupt_status); +iowrite32 (SUPPORTED_INTERRUPTS , cmd_q->reg_interrupt_status);/* Clear the interrupt status */ iowrite32 (0x00 , cmd_q->reg_int_enable);
@@ -944,7 +944,8 @@ static irqreturn_t ccp5_irq_handler(int cmd_q->int_rcvd =1 ;/* Acknowledge the interrupt and wake the kthread */ -iowrite32 (ALL_INTERRUPTS , cmd_q->reg_interrupt_status); +iowrite32 (SUPPORTED_INTERRUPTS , + cmd_q->reg_interrupt_status);wake_up_interruptible (&cmd_q->int_queue); } }
drivers/crypto/ccp/ccp-dev.h +2 -3
@@ -109,9 +109,8 @@#define INT_COMPLETION 0x1#define INT_ERROR 0x2#define INT_QUEUE_STOPPED 0x4 -#define ALL_INTERRUPTS (INT_COMPLETION| \ - INT_ERROR| \ - INT_QUEUE_STOPPED) +#define INT_EMPTY_QUEUE 0x8 +#define SUPPORTED_INTERRUPTS (INT_COMPLETION | INT_ERROR)#define LSB_REGION_WIDTH 5#define MAX_LSB_CNT 8
Greg Kroah-Hartman
maintainerPATCH 29/80 block: fix blk_integrity_register to use templates interval_exp if not 0
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 2859323e35ab5fc42f351fbda23ab544eaa85945 upstream.
When registering an integrity profile: if the template's interval_exp is not 0 use it, otherwise use the ilog2() of logical block size of the provided gendisk.
This fixes a long-standing DM linear target bug where it cannot pass integrity data to the underlying device if its logical block size conflicts with the underlying device's logical block size.
--- block/blk-integrity.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-integrity.c +2 -1
@@ -412,7 +412,8 @@ void blk_integrity_register(struct gendi bi->flags =BLK_INTEGRITY_VERIFY |BLK_INTEGRITY_GENERATE | template->flags; - bi->interval_exp =ilog2 (queue_logical_block_size (disk->queue)); + bi->interval_exp = template->interval_exp ? : +ilog2 (queue_logical_block_size (disk->queue)); bi->profile = template->profile ? template->profile : &nop_profile; bi->tuple_size = template->tuple_size; bi->tag_size = template->tag_size;
Greg Kroah-Hartman
maintainerPATCH 37/80 dm thin: fix a memory leak when passing discard bio down
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dennis Yang <[email protected]>
commit 948f581a53b704b984aa20df009f0a2b4cf7f907 upstream.
dm-thin does not free the discard_parent bio after all chained sub bios finished. The following kmemleak report could be observed after pool with discard_passdown option processes discard bios in linux v4.11-rc7. To fix this, we drop the discard_parent bio reference when its endio (passdown_endio) called.
unreferenced object 0xffff8803d6b29700 (size 256):
comm "kworker/u8:0", pid 30349, jiffies 4379504020 (age 143002.776s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01 00 00 00 00 00 00 f0 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81a5efd9>] kmemleak_alloc+0x49/0xa0
[<ffffffff8114ec34>] kmem_cache_alloc+0xb4/0x100
[<ffffffff8110eec0>] mempool_alloc_slab+0x10/0x20
[<ffffffff8110efa5>] mempool_alloc+0x55/0x150
[<ffffffff81374939>] bio_alloc_bioset+0xb9/0x260
[<ffffffffa018fd20>] process_prepared_discard_passdown_pt1+0x40/0x1c0 [dm_thin_pool]
[<ffffffffa018b409>] break_up_discard_bio+0x1a9/0x200 [dm_thin_pool]
[<ffffffffa018b484>] process_discard_cell_passdown+0x24/0x40 [dm_thin_pool]
[<ffffffffa018b24d>] process_discard_bio+0xdd/0xf0 [dm_thin_pool]
[<ffffffffa018ecf6>] do_worker+0xa76/0xd50 [dm_thin_pool]
[<ffffffff81086239>] process_one_work+0x139/0x370
[<ffffffff810867b1>] worker_thread+0x61/0x450
[<ffffffff8108b316>] kthread+0xd6/0xf0
[<ffffffff81a6cd1f>] ret_from_fork+0x3f/0x70
[<ffffffffffffffff>] 0xffffffffffffffff--- drivers/md/dm-thin.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-thin.c +1 -0
@@ -1070,6 +1070,7 @@ static void passdown_endio(struct bio *b* to unmap (we ignore err). */ queue_passdown_pt2 (bio->bi_private); +bio_put (bio); }static void process_prepared_discard_passdown_pt1 (struct dm_thin_new_mapping *m)
Greg Kroah-Hartman
maintainerPATCH 38/80 vfio/type1: Remove locked page accounting workqueue
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit 0cfef2b7410b64d7a430947e0b533314c4f97153 upstream.
If the mmap_sem is contented then the vfio type1 IOMMU backend will defer locked page accounting updates to a workqueue task. This has a few problems and depending on which side the user tries to play, they might be over-penalized for unmaps that haven't yet been accounted or race the workqueue to enter more mappings than they're allowed. The original intent of this workqueue mechanism seems to be focused on reducing latency through the ioctl, but we cannot do so at the cost of correctness. Remove this workqueue mechanism and update the callers to allow for failure. We can also now recheck the limit under write lock to make sure we don't exceed it.
vfio_pin_pages_remote() also now necessarily includes an unwind path which we can jump to directly if the consecutive page pinning finds that we're exceeding the user's memory limits. This avoids the current lazy approach which does accounting and mapping up to the fault, only to return an error on the next iteration to unwind the entire vfio_dma.
--- drivers/vfio/vfio_iommu_type1.c | 100 +++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 57 deletions(-)
drivers/vfio/vfio_iommu_type1.c +43 -57
@@ -130,57 +130,36 @@ static void vfio_unlink_dma(struct vfio_rb_erase (&old->node, &iommu->dma_list); } -struct vwork { -struct mm_struct *mm; -long npage; -struct work_struct work; -}; - -/* delayed decrement/increment for locked_vm */ -static void vfio_lock_acct_bg (struct work_struct *work) +static int vfio_lock_acct (long npage,bool *lock_cap) { - struct vwork *vwork = container_of(work, struct vwork, work); -struct mm_struct *mm; +int ret; - mm = vwork->mm; -down_write (&mm->mmap_sem); - mm->locked_vm += vwork->npage; -up_write (&mm->mmap_sem); -mmput (mm); -kfree (vwork); -} +if (!npage) +return 0 ; -static void vfio_lock_acct (long npage) -{ -struct vwork *vwork; -struct mm_struct *mm; +if (!current->mm) +return -ESRCH ;/* process exited */ + + ret =down_write_killable (¤t->mm->mmap_sem); +if (!ret) { +if (npage >0 ) { +if (lock_cap ? !*lock_cap : !capable (CAP_IPC_LOCK )) { +unsigned long limit; + + limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; + +if (current->mm->locked_vm + npage > limit) + ret = -ENOMEM ; + } + } -if (!current->mm || !npage) -return ;/* process exited or nothing to do */ +if (!ret) + current->mm->locked_vm += npage; -if (down_write_trylock (¤t->mm->mmap_sem)) { - current->mm->locked_vm += npage;up_write (¤t->mm->mmap_sem); -return ; } -/* -* Couldn't get mmap_sem lock, so must setup to update -* mm->locked_vm later. If locked_vm were atomic, we -* wouldn't need this silliness -*/ - vwork =kmalloc (sizeof (struct vwork ),GFP_KERNEL ); -if (!vwork) -return ; - mm =get_task_mm (current); -if (!mm) { -kfree (vwork); -return ; - } -INIT_WORK (&vwork->work, vfio_lock_acct_bg); - vwork->mm = mm; - vwork->npage = npage; -schedule_work (&vwork->work); +return ret; }/*
@@ -262,9 +241,9 @@ static int vaddr_get_pfn(unsigned long vstatic long vfio_pin_pages (unsigned long vaddr,long npage,int prot,unsigned long *pfn_base) { -unsigned long limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; +unsigned long pfn =0 , limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ;bool lock_cap =capable (CAP_IPC_LOCK ); -long ret, i; +long ret, i =1 ;bool rsvd;if (!current->mm)
@@ -283,16 +262,11 @@ static long vfio_pin_pages(unsigned longreturn -ENOMEM ; } -if (unlikely (disable_hugepages)) { -if (!rsvd) -vfio_lock_acct (1 ); -return 1 ; - } +if (unlikely (disable_hugepages)) + goto out;/* Lock all the consecutive pages from pfn_base */ -for (i =1 , vaddr +=PAGE_SIZE ; i < npage; i++, vaddr +=PAGE_SIZE ) { -unsigned long pfn =0 ; - +for (vaddr +=PAGE_SIZE ; i < npage; i++, vaddr +=PAGE_SIZE ) { ret =vaddr_get_pfn (vaddr, prot, &pfn);if (ret)break ;
@@ -308,12 +282,24 @@ static long vfio_pin_pages(unsigned longput_pfn (pfn, prot);pr_warn ("%s: RLIMIT_MEMLOCK (%ld) exceeded\n" , __func__, limit <<PAGE_SHIFT ); -break ; + ret = -ENOMEM ; + goto unpin_out; } } +out:if (!rsvd) -vfio_lock_acct (i); + ret =vfio_lock_acct (i, &lock_cap); + +unpin_out: +if (ret) { +if (!rsvd) { +for (pfn = *pfn_base ; i ; pfn++, i--) +put_pfn (pfn, prot); + } + +return ret; + }return i; }
@@ -328,7 +314,7 @@ static long vfio_unpin_pages(unsigned lo unlocked +=put_pfn (pfn++, prot);if (do_accounting) -vfio_lock_acct (-unlocked); +vfio_lock_acct (-unlocked,NULL );return unlocked; }
@@ -390,7 +376,7 @@ static void vfio_unmap_unpin(struct vfiocond_resched (); } -vfio_lock_acct (-unlocked); +vfio_lock_acct (-unlocked,NULL ); }static void vfio_remove_dma (struct vfio_iommu *iommu,struct vfio_dma *dma)
Greg Kroah-Hartman
maintainerPATCH 40/80 IB/core: Fix sysfs registration error flow
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit b312be3d87e4c80872cbea869e569175c5eb0f9a upstream.
The kernel commit cited below restructured ib device management so that the device kobject is initialized in ib_alloc_device.
As part of the restructuring, the kobject is now initialized in procedure ib_alloc_device, and is later added to the device hierarchy in the ib_register_device call stack, in procedure ib_device_register_sysfs (which calls device_add).
However, in the ib_device_register_sysfs error flow, if an error occurs following the call to device_add, the cleanup procedure device_unregister is called. This call results in the device object being deleted -- which results in various use-after-free crashes.
The correct cleanup call is device_del -- which undoes device_add without deleting the device object.
The device object will then (correctly) be deleted in the ib_register_device caller's error cleanup flow, when the caller invokes ib_dealloc_device.
--- drivers/infiniband/core/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/sysfs.c +1 -1
@@ -1301,7 +1301,7 @@ err_put:free_port_list_attributes (device); err_unregister: -device_unregister (class_dev); +device_del (class_dev); err:return ret;
Greg Kroah-Hartman
maintainerPATCH 6/80 usb: host: xhci: print correct command ring address
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chen <[email protected]>
commit 6fc091fb0459ade939a795bfdcaf645385b951d4 upstream.
Print correct command ring address using 'val_64'.
--- drivers/usb/host/xhci-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +1 -1
@@ -2486,7 +2486,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, (xhci->cmd_ring->first_seg->dma & (u64 ) ~CMD_RING_RSVD_BITS ) | xhci->cmd_ring->cycle_state;xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"// Setting command ring address to 0x%x" , val); +"// Setting command ring address to 0x%016llx" , val_64);xhci_write_64 (xhci, val_64, &xhci->op_regs->cmd_ring);xhci_dbg_cmd_ptrs (xhci);
Greg Kroah-Hartman
maintainerPATCH 10/80 staging: vt6656: use off stack for in buffer USB transfers.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 05c0cf88bec588a7cb34de569acd871ceef26760 upstream.
Since 4.9 mandated USB buffers to be heap allocated. This causes the driver to fail.
Create buffer for USB transfers.
--- drivers/staging/vt6656/usbpipe.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/staging/vt6656/usbpipe.c +15 -2
@@ -75,15 +75,28 @@ int vnt_control_in(struct vnt_private *p u16 index, u16 length, u8 *buffer) { int status; +u8 *usb_buffer;if (test_bit (DEVICE_FLAGS_DISCONNECTED , &priv->flags))return STATUS_FAILURE ;mutex_lock (&priv->usb_lock); + usb_buffer =kmalloc (length,GFP_KERNEL ); +if (!usb_buffer) { +mutex_unlock (&priv->usb_lock); +return -ENOMEM ; + } + status =usb_control_msg (priv->usb, -usb_rcvctrlpipe (priv->usb,0 ), request,0xc0 , value, - index, buffer, length,USB_CTL_WAIT ); +usb_rcvctrlpipe (priv->usb,0 ), + request,0xc0 , value, + index, usb_buffer, length,USB_CTL_WAIT ); + +if (status == length) +memcpy (buffer, usb_buffer, length); + +kfree (usb_buffer);mutex_unlock (&priv->usb_lock);
Greg Kroah-Hartman
maintainerPATCH 42/80 IB/IPoIB: ibX: failed to create mcg debug file
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shamir Rabinovitch <[email protected]>
commit 771a52584096c45e4565e8aabb596eece9d73d61 upstream.
When udev renames the netdev devices, ipoib debugfs entries does not get renamed. As a result, if subsequent probe of ipoib device reuse the name then creating a debugfs entry for the new device would fail.
Also, moved ipoib_create_debug_files and ipoib_delete_debug_files as part of ipoib event handling in order to avoid any race condition between these.
--- drivers/infiniband/ulp/ipoib/ipoib_fs.c | 3 ++ drivers/infiniband/ulp/ipoib/ipoib_main.c | 44 ++++++++++++++++++++++++++---- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 3 -- 3 files changed, 42 insertions(+), 8 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_fs.c +3 -0
@@ -281,8 +281,11 @@ void ipoib_delete_debug_files(struct net {struct ipoib_dev_priv *priv =netdev_priv (dev); +WARN_ONCE (!priv->mcg_dentry,"null mcg debug file\n" ); +WARN_ONCE (!priv->path_dentry,"null path debug file\n" );debugfs_remove (priv->mcg_dentry);debugfs_remove (priv->path_dentry); + priv->mcg_dentry = priv->path_dentry =NULL ; }int ipoib_register_debugfs (void )
drivers/infiniband/ulp/ipoib/ipoib_main.c +39 -5
86 lines not on this page · raw message
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +0 -3
@@ -87,8 +87,6 @@ int __ipoib_vlan_add(struct ipoib_dev_pr goto register_failed; } -ipoib_create_debug_files (priv->dev); -/* RTNL childs don't need proprietary sysfs entries */ if (type ==IPOIB_LEGACY_CHILD ) {if (ipoib_cm_add_mode_attr (priv->dev))
@@ -109,7 +107,6 @@ int __ipoib_vlan_add(struct ipoib_dev_pr sysfs_failed: result = -ENOMEM ; -ipoib_delete_debug_files (priv->dev);unregister_netdevice (priv->dev); register_failed:
Greg Kroah-Hartman
maintainerPATCH 52/80 fs/xattr.c: zero out memory copied to userspace in getxattr
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit 81be3dee96346fbe08c31be5ef74f03f6b63cf68 upstream.
getxattr uses vmalloc to allocate memory if kzalloc fails. This is filled by vfs_getxattr and then copied to the userspace. vmalloc, however, doesn't zero out the memory so if the specific implementation of the xattr handler is sloppy we can theoretically expose a kernel memory. There is no real sign this is really the case but let's make sure this will not happen and use vzalloc instead.
--- fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xattr.c +1 -1
@@ -530,7 +530,7 @@ getxattr(struct dentry *d, const char __ size =XATTR_SIZE_MAX ; kvalue =kzalloc (size,GFP_KERNEL | __GFP_NOWARN);if (!kvalue) { - kvalue =vmalloc (size); + kvalue =vzalloc (size);if (!kvalue)return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 55/80 mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka <[email protected]>
commit 62be1511b1db8066220b18b7d4da2e6b9fdc69fb upstream.
Patch series "more robust PF_MEMALLOC handling"
This series aims to unify the setting and clearing of PF_MEMALLOC, which prevents recursive reclaim. There are some places that clear the flag unconditionally from current->flags, which may result in clearing a pre-existing flag. This already resulted in a bug report that Patch 1 fixes (without the new helpers, to make backporting easier). Patch 2 introduces the new helpers, modelled after existing memalloc_noio_* and memalloc_nofs_* helpers, and converts mm core to use them. Patches 3 and 4 convert non-mm code.
This patch (of 4):
__alloc_pages_direct_compact() sets PF_MEMALLOC to prevent deadlock during page migration by lock_page() (see the comment in __unmap_and_move()). Then it unconditionally clears the flag, which can clear a pre-existing PF_MEMALLOC flag and result in recursive reclaim. This was not a problem until commit a8161d1ed609 ("mm, page_alloc:
restructure direct compaction handling in slowpath"), because direct compation was called only after direct reclaim, which was skipped when PF_MEMALLOC flag was set.
Even now it's only a theoretical issue, as the new callsite of __alloc_pages_direct_compact() is reached only for costly orders and when gfp_pfmemalloc_allowed() is true, which means either __GFP_NOMEMALLOC is in gfp_flags or in_interrupt() is true. There is no such known context, but let's play it safe and make __alloc_pages_direct_compact() robust for cases where PF_MEMALLOC is already set.
--- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/page_alloc.c +2 -1
@@ -3125,6 +3125,7 @@ __alloc_pages_direct_compact(gfp_t gfp_m enum compact_priority prio, enum compact_result *compact_result) { struct page *page; +unsigned int noreclaim_flag = current->flags &PF_MEMALLOC ;if (!order)return NULL ;
@@ -3132,7 +3133,7 @@ __alloc_pages_direct_compact(gfp_t gfp_m current->flags |=PF_MEMALLOC ; *compact_result =try_to_compact_pages (gfp_mask, order, alloc_flags, ac, prio); - current->flags &= ~PF_MEMALLOC ; + current->flags = (current->flags & ~PF_MEMALLOC ) | noreclaim_flag;if (*compact_result <=COMPACT_INACTIVE )return NULL ;
Greg Kroah-Hartman
maintainerPATCH 56/80 Fix match_prepath()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Prabhu <[email protected]>
commit cd8c42968ee651b69e00f8661caff32b0086e82d upstream.
Incorrect return value for shares not using the prefix path means that we will never match superblocks for these shares.
--- fs/cifs/connect.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
fs/cifs/connect.c +6 -8
@@ -2839,16 +2839,14 @@ match_prepath(struct super_block *sb, st {struct cifs_sb_info *old =CIFS_SB (sb);struct cifs_sb_info *new = mnt_data->cifs_sb; +bool old_set = old->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH ; +bool new_set = new->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH ; -if (old->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH ) { -if (!(new->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH )) -return 0 ; -/* The prepath should be null terminated strings */ -if (strcmp (new->prepath, old->prepath)) -return 0 ; - +if (old_set && new_set && !strcmp (new->prepath, old->prepath)) +return 1 ; +else if (!old_set && !new_set)return 1 ; - } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 54/80 fs/block_dev: always invalidate cleancache in invalidate_bdev()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit a5f6a6a9c72eac38a7fadd1a038532bc8516337c upstream.
invalidate_bdev() calls cleancache_invalidate_inode() iff ->nrpages != 0 which doen't make any sense.
Make sure that invalidate_bdev() always calls cleancache_invalidate_inode() regardless of mapping->nrpages value.
--- fs/block_dev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/block_dev.c +5 -6
@@ -102,12 +102,11 @@ void invalidate_bdev(struct block_device {struct address_space *mapping = bdev->bd_inode->i_mapping; -if (mapping->nrpages ==0 ) -return ; - -invalidate_bh_lrus (); -lru_add_drain_all ();/* make sure all lru add caches are flushed */ -invalidate_mapping_pages (mapping,0 ,-1 ); +if (mapping->nrpages) { +invalidate_bh_lrus (); +lru_add_drain_all ();/* make sure all lru add caches are flushed */ +invalidate_mapping_pages (mapping,0 ,-1 ); + }/* 99% of the time, we don't need to flush the cleancache on the bdev. * But, for the strange corners, lets be cautious */
Greg Kroah-Hartman
maintainerPATCH 57/80 Set unicode flag on cifs echo request to avoid Mac error
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 26c9cb668c7fbf9830516b75d8bee70b699ed449 upstream.
Mac requires the unicode flag to be set for cifs, even for the smb echo request (which doesn't have strings).
Without this Mac rejects the periodic echo requests (when mounting with cifs) that we use to check if server is down
--- fs/cifs/cifssmb.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cifs/cifssmb.c +3 -0
@@ -717,6 +717,9 @@ CIFSSMBEcho(struct TCP_Server_Info *servif (rc)return rc; +if (server->capabilities &CAP_UNICODE ) + smb->hdr.Flags2 |=SMBFLG2_UNICODE ; +/* set up echo request */ smb->hdr.Tid =0xffff ; smb->hdr.WordCount =1 ;
Greg Kroah-Hartman
maintainerPATCH 62/80 CIFS: fix oplock break deadlocks
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rabin Vincent <[email protected]>
commit 3998e6b87d4258a70df358296d6f1c7234012bfe upstream.
When the final cifsFileInfo_put() is called from cifsiod and an oplock break work is queued, lockdep complains loudly:
=============================================
[ INFO: possible recursive locking detected ]
4.11.0+ #21 Not tainted
---------------------------------------------
kworker/0:2/78 is trying to acquire lock:
("cifsiod"){++++.+}, at: flush_work+0x215/0x350
but task is already holding lock:
("cifsiod"){++++.+}, at: process_one_work+0x255/0x8e0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock("cifsiod");
lock("cifsiod");
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by kworker/0:2/78:
#0: ("cifsiod"){++++.+}, at: process_one_work+0x255/0x8e0 #1: ((&wdata->work)){+.+...}, at: process_one_work+0x255/0x8e0
stack backtrace: CPU: 0 PID: 78 Comm: kworker/0:2 Not tainted 4.11.0+ #21 Workqueue: cifsiod cifs_writev_complete Call Trace: dump_stack+0x85/0xc2 __lock_acquire+0x17dd/0x2260 ? match_held_lock+0x20/0x2b0 ? trace_hardirqs_off_caller+0x86/0x130 ? mark_lock+0xa6/0x920 lock_acquire+0xcc/0x260 ? lock_acquire+0xcc/0x260 ? flush_work+0x215/0x350 flush_work+0x236/0x350 ? flush_work+0x215/0x350 ? destroy_worker+0x170/0x170 __cancel_work_timer+0x17d/0x210 ? ___preempt_schedule+0x16/0x18 cancel_work_sync+0x10/0x20 cifsFileInfo_put+0x338/0x7f0 cifs_writedata_release+0x2a/0x40 ? cifs_writedata_release+0x2a/0x40 cifs_writev_complete+0x29d/0x850 ? preempt_count_sub+0x18/0xd0 process_one_work+0x304/0x8e0 worker_thread+0x9b/0x6a0 kthread+0x1b2/0x200 ? process_one_work+0x8e0/0x8e0 ? kthread_create_on_node+0x40/0x40 ret_from_fork+0x31/0x40
This is a real warning. Since the oplock is queued on the same workqueue this can deadlock if there is only one worker thread active for the workqueue (which will be the case during memory pressure when the rescuer thread is handling it).
Furthermore, there is at least one other kind of hang possible due to the oplock break handling if there is only worker. (This can be reproduced without introducing memory pressure by having passing 1 for the max_active parameter of cifsiod.) cifs_oplock_break() can wait indefintely in the filemap_fdatawait() while the cifs_writev_complete() work is blocked:
sysrq: SysRq : Show Blocked State
task PC stack pid father
kworker/0:1 D 0 16 2 0x00000000
Workqueue: cifsiod cifs_oplock_break
Call Trace:
__schedule+0x562/0xf40
? mark_held_locks+0x4a/0xb0
schedule+0x57/0xe0
io_schedule+0x21/0x50
wait_on_page_bit+0x143/0x190
? add_to_page_cache_lru+0x150/0x150
__filemap_fdatawait_range+0x134/0x190
? do_writepages+0x51/0x70
filemap_fdatawait_range+0x14/0x30
filemap_fdatawait+0x3b/0x40
cifs_oplock_break+0x651/0x710
? preempt_count_sub+0x18/0xd0
process_one_work+0x304/0x8e0
worker_thread+0x9b/0x6a0
kthread+0x1b2/0x200
? process_one_work+0x8e0/0x8e0
? kthread_create_on_node+0x40/0x40
ret_from_fork+0x31/0x40
dd D 0 683 171 0x00000000
Call Trace:
__schedule+0x562/0xf40
? mark_held_locks+0x29/0xb0
schedule+0x57/0xe0
io_schedule+0x21/0x50
wait_on_page_bit+0x143/0x190
? add_to_page_cache_lru+0x150/0x150
__filemap_fdatawait_range+0x134/0x190
? do_writepages+0x51/0x70
filemap_fdatawait_range+0x14/0x30
filemap_fdatawait+0x3b/0x40
filemap_write_and_wait+0x4e/0x70
cifs_flush+0x6a/0xb0
filp_close+0x52/0xa0
__close_fd+0xdc/0x150
SyS_close+0x33/0x60
entry_SYSCALL_64_fastpath+0x1f/0xbe
Showing all locks held in the system:
2 locks held by kworker/0:1/16:
#0: ("cifsiod"){.+.+.+}, at: process_one_work+0x255/0x8e0
#1: ((&cfile->oplock_break)){+.+.+.}, at: process_one_work+0x255/0x8e0 Showing busy workqueues and worker pools:
workqueue cifsiod: flags=0xc
pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/1
in-flight: 16:cifs_oplock_break
delayed: cifs_writev_complete, cifs_echo_request
pool 0: cpus=0 node=0 flags=0x0 nice=0 hung=0s workers=3 idle: 750 3
Fix these problems by creating a a new workqueue (with a rescuer) for the oplock break work.
--- fs/cifs/cifsfs.c | 15 +++++++++++++-- fs/cifs/cifsglob.h | 1 + fs/cifs/misc.c | 2 +- fs/cifs/smb2misc.c | 5 +++-- 4 files changed, 18 insertions(+), 5 deletions(-)
fs/cifs/cifsfs.c +13 -2
@@ -87,6 +87,7 @@ extern mempool_t *cifs_req_poolp;extern mempool_t *cifs_mid_poolp;struct workqueue_struct *cifsiod_wq; +struct workqueue_struct *cifsoplockd_wq;__u32 cifs_lock_secret;/*
@@ -1283,9 +1284,16 @@ init_cifs(void) goto out_clean_proc; } + cifsoplockd_wq =alloc_workqueue ("cifsoplockd" , +WQ_FREEZABLE |WQ_MEM_RECLAIM ,0 ); +if (!cifsoplockd_wq) { + rc = -ENOMEM ; + goto out_destroy_cifsiod_wq; + } + rc =cifs_fscache_register ();if (rc) - goto out_destroy_wq; + goto out_destroy_cifsoplockd_wq; rc =cifs_init_inodecache ();if (rc)
@@ -1333,7 +1341,9 @@ out_destroy_inodecache:cifs_destroy_inodecache (); out_unreg_fscache:cifs_fscache_unregister (); -out_destroy_wq: +out_destroy_cifsoplockd_wq: +destroy_workqueue (cifsoplockd_wq); +out_destroy_cifsiod_wq:destroy_workqueue (cifsiod_wq); out_clean_proc:cifs_proc_clean ();
@@ -1356,6 +1366,7 @@ exit_cifs(void)cifs_destroy_mids ();cifs_destroy_inodecache ();cifs_fscache_unregister (); +destroy_workqueue (cifsoplockd_wq);destroy_workqueue (cifsiod_wq);cifs_proc_clean (); }
fs/cifs/cifsglob.h +1 -0
@@ -1651,6 +1651,7 @@ void cifs_oplock_break(struct work_strucextern const struct slow_work_ops cifs_oplock_break_ops;extern struct workqueue_struct *cifsiod_wq; +extern struct workqueue_struct *cifsoplockd_wq;extern __u32 cifs_lock_secret;extern mempool_t *cifs_mid_poolp;
fs/cifs/misc.c +1 -1
@@ -492,7 +492,7 @@ is_valid_oplock_break(char *buffer, struCIFS_INODE_DOWNGRADE_OPLOCK_TO_L2 , &pCifsInode->flags); -queue_work (cifsiod_wq, +queue_work (cifsoplockd_wq, &netfile->oplock_break); netfile->oplock_break_cancelled = false;
fs/cifs/smb2misc.c +3 -2
@@ -494,7 +494,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcelse cfile->oplock_break_cancelled = true; -queue_work (cifsiod_wq, &cfile->oplock_break); +queue_work (cifsoplockd_wq, &cfile->oplock_break);kfree (lw);return true; }
@@ -638,7 +638,8 @@ smb2_is_valid_oplock_break(char *buffer,CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2 , &cinode->flags);spin_unlock (&cfile->file_info_lock); -queue_work (cifsiod_wq, &cfile->oplock_break); +queue_work (cifsoplockd_wq, + &cfile->oplock_break);spin_unlock (&tcon->open_file_lock);spin_unlock (&cifs_tcp_ses_lock);
Greg Kroah-Hartman
maintainerPATCH 65/80 padata: free correct variable
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason A. Donenfeld <[email protected]>
commit 07a77929ba672d93642a56dc2255dd21e6e2290b upstream.
The author meant to free the variable that was just allocated, instead of the one that failed to be allocated, but made a simple typo. This patch rectifies that.
--- kernel/padata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/padata.c +1 -1
@@ -358,7 +358,7 @@ static int padata_setup_cpumasks(structcpumask_and (pd->cpumask.pcpu, pcpumask, cpu_online_mask);if (!alloc_cpumask_var (&pd->cpumask.cbcpu,GFP_KERNEL )) { -free_cpumask_var (pd->cpumask.cbcpu); +free_cpumask_var (pd->cpumask.pcpu);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 67/80 fscrypt: fix context consistency check when key(s) unavailable
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 272f98f6846277378e1758a49a49d7bf39343c02 upstream.
To mitigate some types of offline attacks, filesystem encryption is designed to enforce that all files in an encrypted directory tree use the same encryption policy (i.e. the same encryption context excluding the nonce). However, the fscrypt_has_permitted_context() function which enforces this relies on comparing struct fscrypt_info's, which are only available when we have the encryption keys. This can cause two incorrect behaviors:
1. If we have the parent directory's key but not the child's key, or vice versa, then fscrypt_has_permitted_context() returned false, causing applications to see EPERM or ENOKEY. This is incorrect if the encryption contexts are in fact consistent. Although we'd normally have either both keys or neither key in that case since the master_key_descriptors would be the same, this is not guaranteed because keys can be added or removed from keyrings at any time.
2. If we have neither the parent's key nor the child's key, then fscrypt_has_permitted_context() returned true, causing applications to see no error (or else an error for some other reason). This is incorrect if the encryption contexts are in fact inconsistent, since in that case we should deny access.
To fix this, retrieve and compare the fscrypt_contexts if we are unable to set up both fscrypt_infos.
While this slightly hurts performance when accessing an encrypted directory tree without the key, this isn't a case we really need to be optimizing for; access *with* the key is much more important. Furthermore, the performance hit is barely noticeable given that we are already retrieving the fscrypt_context and doing two keyring searches in fscrypt_get_encryption_info(). If we ever actually wanted to optimize this case we might start by caching the fscrypt_contexts.
--- fs/crypto/policy.c | 87 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 19 deletions(-)
fs/crypto/policy.c +68 -19
@@ -161,27 +161,61 @@ int fscrypt_get_policy(struct inode *ino }EXPORT_SYMBOL (fscrypt_get_policy); +/** +* fscrypt_has_permitted_context() - is a file's encryption policy permitted +* within its directory? +* +* @parent: inode for parent directory +* @child: inode for file being looked up, opened, or linked into @parent +* +* Filesystems must call this before permitting access to an inode in a +* situation where the parent directory is encrypted (either before allowing +* ->lookup() to succeed, or for a regular file before allowing it to be opened) +* and before any operation that involves linking an inode into an encrypted +* directory, including link, rename, and cross rename. It enforces the +* constraint that within a given encrypted directory tree, all files use the +* same encryption policy. The pre-access check is needed to detect potentially +* malicious offline violations of this constraint, while the link and rename +* checks are needed to prevent online violations of this constraint. +* +* Return: 1 if permitted, 0 if forbidden. If forbidden, the caller must fail +* the filesystem operation with EPERM. +*/ int fscrypt_has_permitted_context (struct inode *parent,struct inode *child) { -struct fscrypt_info *parent_ci, *child_ci; +const struct fscrypt_operations *cops = parent->i_sb->s_cop; +const struct fscrypt_info *parent_ci, *child_ci; +struct fscrypt_context parent_ctx, child_ctx;int res; -if ((parent ==NULL ) || (child ==NULL )) { -printk (KERN_ERR "parent %p child %p\n" , parent, child); -BUG_ON (1 ); - } -/* No restrictions on file types which are never encrypted */ if (!S_ISREG (child->i_mode) && !S_ISDIR (child->i_mode) && !S_ISLNK (child->i_mode))return 1 ; -/* no restrictions if the parent directory is not encrypted */ -if (!parent->i_sb->s_cop->is_encrypted (parent)) +/* No restrictions if the parent directory is unencrypted */ +if (!cops->is_encrypted (parent))return 1 ; -/* if the child directory is not encrypted, this is always a problem */ -if (!parent->i_sb->s_cop->is_encrypted (child)) + +/* Encrypted directories must not contain unencrypted files */ +if (!cops->is_encrypted (child))return 0 ; + +/* +* Both parent and child are encrypted, so verify they use the same +* encryption policy. Compare the fscrypt_info structs if the keys are +* available, otherwise retrieve and compare the fscrypt_contexts. +* +* Note that the fscrypt_context retrieval will be required frequently +* when accessing an encrypted directory tree without the key. +* Performance-wise this is not a big deal because we already don't +* really optimize for file access without the key (to the extent that +* such access is even possible), given that any attempted access +* already causes a fscrypt_context retrieval and keyring search. +* +* In any case, if an unexpected error occurs, fall back to "forbidden". +*/ + res =fscrypt_get_encryption_info (parent);if (res)return 0 ;
@@ -190,17 +224,32 @@ int fscrypt_has_permitted_context(structreturn 0 ; parent_ci = parent->i_crypt_info; child_ci = child->i_crypt_info; -if (!parent_ci && !child_ci) -return 1 ; -if (!parent_ci || !child_ci) + +if (parent_ci && child_ci) { +return memcmp (parent_ci->ci_master_key, child_ci->ci_master_key, +FS_KEY_DESCRIPTOR_SIZE ) ==0 && + (parent_ci->ci_data_mode == child_ci->ci_data_mode) && + (parent_ci->ci_filename_mode == + child_ci->ci_filename_mode) && + (parent_ci->ci_flags == child_ci->ci_flags); + } + + res = cops->get_context (parent, &parent_ctx,sizeof (parent_ctx)); +if (res !=sizeof (parent_ctx)) +return 0 ; + + res = cops->get_context (child, &child_ctx,sizeof (child_ctx)); +if (res !=sizeof (child_ctx))return 0 ; -return (memcmp (parent_ci->ci_master_key, - child_ci->ci_master_key, -FS_KEY_DESCRIPTOR_SIZE ) ==0 && - (parent_ci->ci_data_mode == child_ci->ci_data_mode) && - (parent_ci->ci_filename_mode == child_ci->ci_filename_mode) && - (parent_ci->ci_flags == child_ci->ci_flags)); +return memcmp (parent_ctx.master_key_descriptor, + child_ctx.master_key_descriptor, +FS_KEY_DESCRIPTOR_SIZE ) ==0 && + (parent_ctx.contents_encryption_mode == + child_ctx.contents_encryption_mode) && + (parent_ctx.filenames_encryption_mode == + child_ctx.filenames_encryption_mode) && + (parent_ctx.flags == child_ctx.flags); }EXPORT_SYMBOL (fscrypt_has_permitted_context);
Greg Kroah-Hartman
maintainerPATCH 68/80 serial: samsung: Use right device for DMA-mapping calls
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 768d64f491a530062ddad50e016fb27125f8bd7c upstream.
Driver should provide its own struct device for all DMA-mapping calls instead of extracting device pointer from DMA engine channel. Although this is harmless from the driver operation perspective on ARM architecture, it is always good to use the DMA mapping API in a proper way. This patch fixes following DMA API debug warning:
WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:1241 check_sync+0x520/0x9f4 samsung-uart 12c20000.serial: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000006df0f580] [size=64 bytes] Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc1-00137-g07ca963 #51 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c011aaa4>] (unwind_backtrace) from [<c01127c0>] (show_stack+0x20/0x24) [<c01127c0>] (show_stack) from [<c06ba5d8>] (dump_stack+0x84/0xa0) [<c06ba5d8>] (dump_stack) from [<c0139528>] (__warn+0x14c/0x180) [<c0139528>] (__warn) from [<c01395a4>] (warn_slowpath_fmt+0x48/0x50) [<c01395a4>] (warn_slowpath_fmt) from [<c0729058>] (check_sync+0x520/0x9f4) [<c0729058>] (check_sync) from [<c072967c>] (debug_dma_sync_single_for_device+0x88/0xc8) [<c072967c>] (debug_dma_sync_single_for_device) from [<c0803c10>] (s3c24xx_serial_start_tx_dma+0x100/0x2f8) [<c0803c10>] (s3c24xx_serial_start_tx_dma) from [<c0804338>] (s3c24xx_serial_tx_chars+0x198/0x33c)
--- drivers/tty/serial/samsung.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/tty/serial/samsung.c +4 -5
@@ -906,14 +906,13 @@ static int s3c24xx_serial_request_dma(streturn -ENOMEM ; } - dma->rx_addr =dma_map_single (dma->rx_chan->device->dev, dma->rx_buf, + dma->rx_addr =dma_map_single (p->port.dev, dma->rx_buf, dma->rx_size,DMA_FROM_DEVICE );spin_lock_irqsave (&p->port.lock, flags);/* TX buffer */ - dma->tx_addr =dma_map_single (dma->tx_chan->device->dev, - p->port.state->xmit.buf, + dma->tx_addr =dma_map_single (p->port.dev, p->port.state->xmit.buf,UART_XMIT_SIZE ,DMA_TO_DEVICE );spin_unlock_irqrestore (&p->port.lock, flags);
@@ -927,7 +926,7 @@ static void s3c24xx_serial_release_dma(sif (dma->rx_chan) {dmaengine_terminate_all (dma->rx_chan); -dma_unmap_single (dma->rx_chan->device->dev, dma->rx_addr, +dma_unmap_single (p->port.dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE );kfree (dma->rx_buf);dma_release_channel (dma->rx_chan);
@@ -936,7 +935,7 @@ static void s3c24xx_serial_release_dma(sif (dma->tx_chan) {dmaengine_terminate_all (dma->tx_chan); -dma_unmap_single (dma->tx_chan->device->dev, dma->tx_addr, +dma_unmap_single (p->port.dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );dma_release_channel (dma->tx_chan); dma->tx_chan =NULL ;
Greg Kroah-Hartman
maintainerPATCH 70/80 serial: omap: suspend device on probe errors
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 77e6fe7fd2b7cba0bf2f2dc8cde51d7b9a35bf74 upstream.
Make sure to actually suspend the device before returning after a failed (or deferred) probe.
Note that autosuspend must be disabled before runtime pm is disabled in order to balance the usage count due to a negative autosuspend delay as well as to make the final put suspend the device synchronously.
--- drivers/tty/serial/omap-serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/omap-serial.c +2 -1
@@ -1712,7 +1712,8 @@ static int serial_omap_probe(struct platreturn 0 ; err_add_port: -pm_runtime_put (&pdev->dev); +pm_runtime_dont_use_autosuspend (&pdev->dev); +pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_qos_remove_request (&up->pm_qos_request);device_init_wakeup (up->dev, false);
Greg Kroah-Hartman
maintainerPATCH 74/80 Bluetooth: hci_intel: add missing tty-device sanity check
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit dcb9cfaa5ea9aa0ec08aeb92582ccfe3e4c719a9 upstream.
Make sure to check the tty-device pointer before looking up the sibling platform device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty.
--- drivers/bluetooth/hci_intel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_intel.c +12 -1
@@ -307,6 +307,9 @@ static int intel_set_power(struct hci_uastruct list_head *p;int err = -ENODEV ; +if (!hu->tty->dev) +return err; +mutex_lock (&intel_device_list_lock);list_for_each (p, &intel_device_list) {
@@ -379,6 +382,9 @@ static void intel_busy_work(struct work_ struct intel_data *intel = container_of(work, struct intel_data, busy_work); +if (!intel->hu->tty->dev) +return ; +/* Link is busy, delay the suspend */ mutex_lock (&intel_device_list_lock);list_for_each (p, &intel_device_list) {
@@ -889,6 +895,8 @@ done:list_for_each (p, &intel_device_list) { struct intel_device *dev = list_entry(p, struct intel_device, list); +if (!hu->tty->dev) +break ;if (hu->tty->dev->parent == dev->pdev->dev.parent) {if (device_may_wakeup (&dev->pdev->dev)) {set_bit (STATE_LPM_ENABLED , &intel->flags);
@@ -1056,6 +1064,9 @@ static int intel_enqueue(struct hci_uartBT_DBG ("hu %p skb %p" , hu, skb); +if (!hu->tty->dev) + goto out_enqueue; +/* Be sure our controller is resumed and potential LPM transaction * completed before enqueuing any packet. */
@@ -1072,7 +1083,7 @@ static int intel_enqueue(struct hci_uart } }mutex_unlock (&intel_device_list_lock); - +out_enqueue:skb_queue_tail (&intel->txq, skb);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 73/80 Bluetooth: hci_bcm: add missing tty-device sanity check
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 95065a61e9bf25fb85295127fba893200c2bbbd8 upstream.
Make sure to check the tty-device pointer before looking up the sibling platform device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty.
--- drivers/bluetooth/hci_bcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_bcm.c +4 -1
@@ -287,6 +287,9 @@ static int bcm_open(struct hci_uart *hu) hu->priv = bcm; +if (!hu->tty->dev) + goto out; +mutex_lock (&bcm_device_lock);list_for_each (p, &bcm_device_list) { struct bcm_device *dev = list_entry(p, struct bcm_device, list);
@@ -307,7 +310,7 @@ static int bcm_open(struct hci_uart *hu) }mutex_unlock (&bcm_device_lock); - +out:return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 77/80 libnvdimm, pmem: fix a NULL pointer BUG in nd_pmem_notify
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit b2518c78ce76896f0f8f7940bf02104b227e1709 upstream.
The following BUG was observed when nd_pmem_notify() was called for a BTT device. The use of a pmem_device pointer is not valid with BTT.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000030 IP: nd_pmem_notify+0x30/0xf0 [nd_pmem] Call Trace: nd_device_notify+0x40/0x50 child_notify+0x10/0x20 device_for_each_child+0x50/0x90 nd_region_notify+0x20/0x30 nd_device_notify+0x40/0x50 nvdimm_region_notify+0x27/0x30 acpi_nfit_scrub+0x341/0x590 [nfit] process_one_work+0x197/0x450 worker_thread+0x4e/0x4a0 kthread+0x109/0x140
Fix nd_pmem_notify() by setting nd_region and badblocks pointers properly for BTT.
--- drivers/nvdimm/pmem.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-)
drivers/nvdimm/pmem.c +26 -13
@@ -383,12 +383,12 @@ static void nd_pmem_shutdown(struct devistatic void nd_pmem_notify (struct device *dev,enum nvdimm_event event) { -struct pmem_device *pmem =dev_get_drvdata (dev); -struct nd_region *nd_region =to_region (pmem); +struct nd_region *nd_region;resource_size_t offset =0 , end_trunc =0 ;struct nd_namespace_common *ndns;struct nd_namespace_io *nsio;struct resource res; +struct badblocks *bb;if (event !=NVDIMM_REVALIDATE_POISON )return ;
@@ -397,20 +397,33 @@ static void nd_pmem_notify(struct devicestruct nd_btt *nd_btt =to_nd_btt (dev); ndns = nd_btt->ndns; - }else if (is_nd_pfn (dev)) { -struct nd_pfn *nd_pfn =to_nd_pfn (dev); -struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; - - ndns = nd_pfn->ndns; - offset = pmem->data_offset +__le32_to_cpu (pfn_sb->start_pad); - end_trunc =__le32_to_cpu (pfn_sb->end_trunc); - }else - ndns =to_ndns (dev); + nd_region =to_nd_region (ndns->dev.parent); + nsio =to_nd_namespace_io (&ndns->dev); + bb = &nsio->bb; + }else { +struct pmem_device *pmem =dev_get_drvdata (dev); + + nd_region =to_region (pmem); + bb = &pmem->bb; + +if (is_nd_pfn (dev)) { +struct nd_pfn *nd_pfn =to_nd_pfn (dev); +struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; + + ndns = nd_pfn->ndns; + offset = pmem->data_offset + +__le32_to_cpu (pfn_sb->start_pad); + end_trunc =__le32_to_cpu (pfn_sb->end_trunc); + }else { + ndns =to_ndns (dev); + } + + nsio =to_nd_namespace_io (&ndns->dev); + } - nsio =to_nd_namespace_io (&ndns->dev); res.start = nsio->res.start + offset; res.end = nsio->res.end - end_trunc; -nvdimm_badblocks_populate (nd_region, &pmem->bb, &res); +nvdimm_badblocks_populate (nd_region, bb, &res); }MODULE_ALIAS ("pmem" );
Greg Kroah-Hartman
maintainerPATCH 76/80 libnvdimm, region: fix flush hint detection crash
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit bc042fdfbb92b5b13421316b4548e2d6e98eed37 upstream.
In the case where a dimm does not have any associated flush hints the ndrd->flush_wpq array may be uninitialized leading to crashes with the following signature:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 IP: region_visible+0x10f/0x160 [libnvdimm] Call Trace: internal_create_group+0xbe/0x2f0 sysfs_create_groups+0x40/0x80 device_add+0x2d8/0x650 nd_async_device_register+0x12/0x40 [libnvdimm] async_run_entry_fn+0x39/0x170 process_one_work+0x212/0x6c0 ? process_one_work+0x197/0x6c0 worker_thread+0x4e/0x4a0 kthread+0x10c/0x140 ? process_one_work+0x6c0/0x6c0 ? kthread_create_on_node+0x60/0x60 ret_from_fork+0x31/0x40
--- drivers/nvdimm/region_devs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/nvdimm/region_devs.c +7 -4
@@ -968,17 +968,20 @@ EXPORT_SYMBOL_GPL(nvdimm_flush);*/ int nvdimm_has_flush (struct nd_region *nd_region) { -struct nd_region_data *ndrd =dev_get_drvdata (&nd_region->dev);int i;/* no nvdimm == flushing capability unknown */ if (nd_region->ndr_mappings ==0 )return -ENXIO ; -for (i =0 ; i < nd_region->ndr_mappings; i++) -/* flush hints present, flushing required */ -if (ndrd_get_flush_wpq (ndrd, i,0 )) +for (i =0 ; i < nd_region->ndr_mappings; i++) { +struct nd_mapping *nd_mapping = &nd_region->mapping[i]; +struct nvdimm *nvdimm = nd_mapping->nvdimm; + +/* flush hints present / available */ +if (nvdimm->num_flush)return 1 ; + }/* * The platform defines dimm devices without hints, assume
Greg Kroah-Hartman
maintainerPATCH 46/80 perf auxtrace: Fix no_size logic in addr_filter__resolve_kernel_syms()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit c3a0bbc7ad7598dec5a204868bdf8a2b1b51df14 upstream.
Address filtering with kernel symbols incorrectly resulted in the error "Cannot determine size of symbol" because the no_size logic was the wrong way around.
--- tools/perf/util/auxtrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/auxtrace.c +2 -2
@@ -1826,7 +1826,7 @@ static int addr_filter__resolve_kernel_s filt->addr = start;if (filt->range && !filt->size && !filt->sym_to) { filt->size = size; - no_size = !!size; + no_size = !size; } }
@@ -1840,7 +1840,7 @@ static int addr_filter__resolve_kernel_sif (err)return err; filt->size = start + size - filt->addr; - no_size = !!size; + no_size = !size; }/* The very last symbol in kallsyms does not imply a particular size */
Greg Kroah-Hartman
maintainerPATCH 80/80 pstore: Shut down worker when unregistering
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 6330d5534786d5315d56d558aa6d20740f97d80a upstream.
When built as a module and running with update_ms >= 0, pstore will Oops during module unload since the work timer is still running. This makes sure the worker is stopped before unloading.
--- fs/pstore/platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/pstore/platform.c +9 -1
@@ -704,6 +704,7 @@ int pstore_register(struct pstore_info *if (psi->flags &PSTORE_FLAGS_PMSG )pstore_register_pmsg (); +/* Start watching for new records, if desired. */ if (pstore_update_ms >=0 ) { pstore_timer.expires = jiffies +msecs_to_jiffies (pstore_update_ms);
@@ -726,6 +727,11 @@ EXPORT_SYMBOL_GPL(pstore_register);void pstore_unregister (struct pstore_info *psi) { +/* Stop timer and make sure all work has finished. */ + pstore_update_ms =-1 ; +del_timer_sync (&pstore_timer); +flush_work (&pstore_work); +if (psi->flags &PSTORE_FLAGS_PMSG )pstore_unregister_pmsg ();if (psi->flags &PSTORE_FLAGS_FTRACE )
@@ -825,7 +831,9 @@ static void pstore_timefunc(unsigned lonschedule_work (&pstore_work); } -mod_timer (&pstore_timer, jiffies +msecs_to_jiffies (pstore_update_ms)); +if (pstore_update_ms >=0 ) +mod_timer (&pstore_timer, + jiffies +msecs_to_jiffies (pstore_update_ms)); }module_param (backend, charp,0444 );
Greg Kroah-Hartman
maintainerPATCH 50/80 orangefs: do not set getattr_time on orangefs_lookup
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Brandenburg <[email protected]>
commit 17930b252cd6f31163c259eaa99dd8aa630fb9ba upstream.
Since orangefs_lookup calls orangefs_iget which calls orangefs_inode_getattr, getattr_time will get set.
--- fs/orangefs/namei.c | 2 -- 1 file changed, 2 deletions(-)
fs/orangefs/namei.c +0 -2
@@ -193,8 +193,6 @@ static struct dentry *orangefs_lookup(st goto out; } -ORANGEFS_I (inode)->getattr_time = jiffies -1 ; - gossip_debug(GOSSIP_NAME_DEBUG, "%s:%s:%d " "Found good inode [%lu] with count [%d]\n",
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.29 release. There are 80 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 Sat May 20 10:48:15 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.29-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.29 release. There are 80 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 Sat May 20 10:48:15 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter