08 Oct, 2020

1 commit

  • * tag 'v5.4.70': (3051 commits)
    Linux 5.4.70
    netfilter: ctnetlink: add a range check for l3/l4 protonum
    ep_create_wakeup_source(): dentry name can change under you...
    ...

    Conflicts:
    arch/arm/mach-imx/pm-imx6.c
    arch/arm64/boot/dts/freescale/imx8mm-evk.dts
    arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
    drivers/crypto/caam/caamalg.c
    drivers/gpu/drm/imx/dw_hdmi-imx.c
    drivers/gpu/drm/imx/imx-ldb.c
    drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
    drivers/mmc/host/sdhci-esdhc-imx.c
    drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
    drivers/net/ethernet/freescale/enetc/enetc.c
    drivers/net/ethernet/freescale/enetc/enetc_pf.c
    drivers/thermal/imx_thermal.c
    drivers/usb/cdns3/ep0.c
    drivers/xen/swiotlb-xen.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c

    Signed-off-by: Jason Liu

    Jason Liu
     

01 Oct, 2020

5 commits

  • [ Upstream commit 49826937e7c7917140515aaf10c17bedcc4acaad ]

    If the function platform_get_irq() failed, the negative value
    returned will not be detected here. So fix error handling in
    bt_bmc_config_irq(). And in the function bt_bmc_probe(),
    when get irq failed, it will print error message. So use
    platform_get_irq_optional() to simplify code. Finally in the
    function bt_bmc_remove() should make the right status check
    if get irq failed.

    Signed-off-by: Shengju Zhang
    Signed-off-by: Tang Bin
    Message-Id:
    [Also set bt_bmc->irq to a negative value if devm_request_irq() fails.]
    Signed-off-by: Corey Minyard
    Signed-off-by: Sasha Levin

    Tang Bin
     
  • [ Upstream commit 44b8fb6eaa7c3fb770bf1e37619cdb3902cca1fc ]

    After registering character device the file operation callbacks can be
    called. The open callback registers interrupt handler.
    Therefore interrupt handler can execute in parallel with rest of the init
    function. To avoid such data race initialize telclk_interrupt variable
    and struct alarm_events before registering character device.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Madhuparna Bhowmik
    Link: https://lore.kernel.org/r/20200417153451.1551-1-madhuparnabhowmik10@gmail.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Madhuparna Bhowmik
     
  • [ Upstream commit d8d74ea3c00214aee1e1826ca18e77944812b9b4 ]

    Synchronize with the results from the CRQs before continuing with
    the initialization. This avoids trying to send TPM commands while
    the rtce buffer has not been allocated, yet.

    This patch fixes an existing race condition that may occurr if the
    hypervisor does not quickly respond to the VTPM_GET_RTCE_BUFFER_SIZE
    request sent during initialization and therefore the ibmvtpm->rtce_buf
    has not been allocated at the time the first TPM command is sent.

    Fixes: 132f76294744 ("drivers/char/tpm: Add new device driver to support IBM vTPM")
    Signed-off-by: Stefan Berger
    Acked-by: Nayna Jain
    Tested-by: Nayna Jain
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Sasha Levin

    Stefan Berger
     
  • [ Upstream commit e00d996a4317aff5351c4338dd97d390225412c2 ]

    Fields in "struct timer_rand_state" could be accessed concurrently.
    Lockless plain reads and writes result in data races. Fix them by adding
    pairs of READ|WRITE_ONCE(). The data races were reported by KCSAN,

    BUG: KCSAN: data-race in add_timer_randomness / add_timer_randomness

    write to 0xffff9f320a0a01d0 of 8 bytes by interrupt on cpu 22:
    add_timer_randomness+0x100/0x190
    add_timer_randomness at drivers/char/random.c:1152
    add_disk_randomness+0x85/0x280
    scsi_end_request+0x43a/0x4a0
    scsi_io_completion+0xb7/0x7e0
    scsi_finish_command+0x1ed/0x2a0
    scsi_softirq_done+0x1c9/0x1d0
    blk_done_softirq+0x181/0x1d0
    __do_softirq+0xd9/0x57c
    irq_exit+0xa2/0xc0
    do_IRQ+0x8b/0x190
    ret_from_intr+0x0/0x42
    cpuidle_enter_state+0x15e/0x980
    cpuidle_enter+0x69/0xc0
    call_cpuidle+0x23/0x40
    do_idle+0x248/0x280
    cpu_startup_entry+0x1d/0x1f
    start_secondary+0x1b2/0x230
    secondary_startup_64+0xb6/0xc0

    no locks held by swapper/22/0.
    irq event stamp: 32871382
    _raw_spin_unlock_irqrestore+0x53/0x60
    _raw_spin_lock_irqsave+0x21/0x60
    _local_bh_enable+0x21/0x30
    irq_exit+0xa2/0xc0

    read to 0xffff9f320a0a01d0 of 8 bytes by interrupt on cpu 2:
    add_timer_randomness+0xe8/0x190
    add_disk_randomness+0x85/0x280
    scsi_end_request+0x43a/0x4a0
    scsi_io_completion+0xb7/0x7e0
    scsi_finish_command+0x1ed/0x2a0
    scsi_softirq_done+0x1c9/0x1d0
    blk_done_softirq+0x181/0x1d0
    __do_softirq+0xd9/0x57c
    irq_exit+0xa2/0xc0
    do_IRQ+0x8b/0x190
    ret_from_intr+0x0/0x42
    cpuidle_enter_state+0x15e/0x980
    cpuidle_enter+0x69/0xc0
    call_cpuidle+0x23/0x40
    do_idle+0x248/0x280
    cpu_startup_entry+0x1d/0x1f
    start_secondary+0x1b2/0x230
    secondary_startup_64+0xb6/0xc0

    no locks held by swapper/2/0.
    irq event stamp: 37846304
    _raw_spin_unlock_irqrestore+0x53/0x60
    _raw_spin_lock_irqsave+0x21/0x60
    _local_bh_enable+0x21/0x30
    irq_exit+0xa2/0xc0

    Reported by Kernel Concurrency Sanitizer on:
    Hardware name: HP ProLiant BL660c Gen9, BIOS I38 10/17/2018

    Link: https://lore.kernel.org/r/1582648024-13111-1-git-send-email-cai@lca.pw
    Signed-off-by: Qian Cai
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Sasha Levin

    Qian Cai
     
  • [ Upstream commit 3ef193822b25e9ee629974f66dc1ff65167f770c ]

    Bug link: https://bugzilla.kernel.org/show_bug.cgi?id=195657

    cmd/rsp buffers are expected to be in the same ACPI region.
    For Zen+ CPUs BIOS's might report two different regions, some of
    them also report region sizes inconsistent with values from TPM
    registers.

    Memory configuration on ASRock x470 ITX:

    db0a0000-dc59efff : Reserved
    dc57e000-dc57efff : MSFT0101:00
    dc582000-dc582fff : MSFT0101:00

    Work around the issue by storing ACPI regions declared for the
    device in a fixed array and adding an array for pointers to
    corresponding possibly allocated resources in crb_map_io function.
    This data was previously held for a single resource
    in struct crb_priv (iobase field) and local variable io_res in
    crb_map_io function. ACPI resources array is used to find index of
    corresponding region for each buffer and make the buffer size
    consistent with region's length. Array of pointers to allocated
    resources is used to map the region at most once.

    Signed-off-by: Ivan Lazeev
    Tested-by: Jerry Snitselaar
    Tested-by: Jarkko Sakkinen
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Sasha Levin

    Ivan Lazeev
     

19 Aug, 2020

2 commits

  • commit 6c4e79d99e6f42b79040f1a33cd4018f5425030b upstream.

    The size of the buffers for storing context's and sessions can vary from
    arch to arch as PAGE_SIZE can be anything between 4 kB and 256 kB (the
    maximum for PPC64). Define a fixed buffer size set to 16 kB. This should be
    enough for most use with three handles (that is how many we allow at the
    moment). Parametrize the buffer size while doing this, so that it is easier
    to revisit this later on if required.

    Cc: stable@vger.kernel.org
    Reported-by: Stefan Berger
    Fixes: 745b361e989a ("tpm: infrastructure for TPM spaces")
    Reviewed-by: Jerry Snitselaar
    Tested-by: Stefan Berger
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Jarkko Sakkinen
     
  • [ Upstream commit b975abbd382fe442713a4c233549abb90e57c22b ]

    In intel_gtt_setup_scratch_page(), pointer "page" is not released if
    pci_dma_mapping_error() return an error, leading to a memory leak on
    module initialisation failure. Simply fix this issue by freeing "page"
    before return.

    Fixes: 0e87d2b06cb46 ("intel-gtt: initialize our own scratch page")
    Signed-off-by: Qiushi Wu
    Reviewed-by: Chris Wilson
    Signed-off-by: Chris Wilson
    Link: https://patchwork.freedesktop.org/patch/msgid/20200522083451.7448-1-chris@chris-wilson.co.uk
    Signed-off-by: Sasha Levin

    Qiushi Wu
     

07 Aug, 2020

1 commit

  • commit f227e3ec3b5cad859ad15666874405e8c1bbc1d4 upstream.

    This modifies the first 32 bits out of the 128 bits of a random CPU's
    net_rand_state on interrupt or CPU activity to complicate remote
    observations that could lead to guessing the network RNG's internal
    state.

    Note that depending on some network devices' interrupt rate moderation
    or binding, this re-seeding might happen on every packet or even almost
    never.

    In addition, with NOHZ some CPUs might not even get timer interrupts,
    leaving their local state rarely updated, while they are running
    networked processes making use of the random state. For this reason, we
    also perform this update in update_process_times() in order to at least
    update the state when there is user or system activity, since it's the
    only case we care about.

    Reported-by: Amit Klein
    Suggested-by: Linus Torvalds
    Cc: Eric Dumazet
    Cc: "Jason A. Donenfeld"
    Cc: Andy Lutomirski
    Cc: Kees Cook
    Cc: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc:
    Signed-off-by: Willy Tarreau
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Willy Tarreau
     

29 Jul, 2020

1 commit

  • commit b34e7e298d7a5ed76b3aa327c240c29f1ef6dd22 upstream.

    WRITE_ONCE() isn't the correct way to publish a pointer to a data
    structure, since it doesn't include a write memory barrier. Therefore
    other tasks may see that the pointer has been set but not see that the
    pointed-to memory has finished being initialized yet. Instead a
    primitive with "release" semantics is needed.

    Use smp_store_release() for this.

    The use of READ_ONCE() on the read side is still potentially correct if
    there's no control dependency, i.e. if all memory being "published" is
    transitively reachable via the pointer itself. But this pairing is
    somewhat confusing and error-prone. So just upgrade the read side to
    smp_load_acquire() so that it clearly pairs with smp_store_release().

    Cc: Arnd Bergmann
    Cc: Ingo Molnar
    Cc: Kees Cook
    Cc: Matthew Wilcox
    Cc: Russell King
    Cc: Andrew Morton
    Fixes: 3234ac664a87 ("/dev/mem: Revoke mappings when a driver claims the region")
    Signed-off-by: Eric Biggers
    Cc: stable
    Acked-by: Dan Williams
    Link: https://lore.kernel.org/r/20200716060553.24618-1-ebiggers@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Eric Biggers
     

22 Jul, 2020

2 commits

  • commit 897c44f0bae574c5fb318c759b060bebf9dd6013 upstream.

    rproc_serial_id_table lacks an exposure to module devicetable, so
    when remoteproc firmware requests VIRTIO_ID_RPROC_SERIAL, no uevent
    is generated and no module autoloading occurs.
    Add missing MODULE_DEVICE_TABLE() annotation and move the existing
    one for VIRTIO_ID_CONSOLE right to the table itself.

    Fixes: 1b6370463e88 ("virtio_console: Add support for remoteproc serial")
    Cc: # v3.8+
    Signed-off-by: Alexander Lobakin
    Reviewed-by: Amit Shah
    Link: https://lore.kernel.org/r/x7C_CbeJtoGMy258nwAXASYz3xgFMFpyzmUvOyZzRnQrgWCREBjaqBOpAUS7ol4NnZYvSVwmTsCG0Ohyfvta-ygw6HMHcoeKK0C3QFiAO_Q=@pm.me
    Signed-off-by: Greg Kroah-Hartman

    Alexander Lobakin
     
  • [ Upstream commit ccf6fb858e17a8f8a914a1c6444d277cfedfeae6 ]

    Found by smatch:
    drivers/char/tpm/tpm_tis_core.c:1088 tpm_tis_core_init() warn:
    variable dereferenced before check 'chip->ops' (see line 979)

    'chip->ops' is assigned in the beginning of function
    in tpmm_chip_alloc->tpm_chip_alloc
    and is used before first possible goto to error path.

    Signed-off-by: Vasily Averin
    Reviewed-by: Jerry Snitselaar
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Sasha Levin

    Vasily Averin
     

09 Jul, 2020

1 commit

  • commit 7862840219058436b80029a0263fd1ef065fb1b3 upstream.

    It has been reported that some TIS based TPMs are giving unexpected
    errors when using the O_NONBLOCK path of the TPM device. The problem
    is that some TPMs don't like it when you get and then relinquish a
    locality (as the tpm_try_get_ops()/tpm_put_ops() pair does) without
    sending a command. This currently happens all the time in the
    O_NONBLOCK write path. Fix this by moving the tpm_try_get_ops()
    further down the code to after the O_NONBLOCK determination is made.
    This is safe because the priv->buffer_mutex still protects the priv
    state being modified.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206275
    Fixes: d23d12484307 ("tpm: fix invalid locking in NONBLOCKING mode")
    Reported-by: Mario Limonciello
    Tested-by: Alex Guzman
    Cc: stable@vger.kernel.org
    Reviewed-by: Jerry Snitselaar
    Signed-off-by: James Bottomley
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    James Bottomley
     

01 Jul, 2020

1 commit

  • [ Upstream commit 95459261c99f1621d90bc628c2a48e60b7cf9a88 ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    the call returns an error code. Thus a pairing decrement is needed
    on the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Reviewed-by: Alexander Sverdlin
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Dinghao Liu
     

24 Jun, 2020

2 commits

  • [ Upstream commit 3234ac664a870e6ea69ae3a57d824cd7edbeacc5 ]

    Close the hole of holding a mapping over kernel driver takeover event of
    a given address range.

    Commit 90a545e98126 ("restrict /dev/mem to idle io memory ranges")
    introduced CONFIG_IO_STRICT_DEVMEM with the goal of protecting the
    kernel against scenarios where a /dev/mem user tramples memory that a
    kernel driver owns. However, this protection only prevents *new* read(),
    write() and mmap() requests. Established mappings prior to the driver
    calling request_mem_region() are left alone.

    Especially with persistent memory, and the core kernel metadata that is
    stored there, there are plentiful scenarios for a /dev/mem user to
    violate the expectations of the driver and cause amplified damage.

    Teach request_mem_region() to find and shoot down active /dev/mem
    mappings that it believes it has successfully claimed for the exclusive
    use of the driver. Effectively a driver call to request_mem_region()
    becomes a hole-punch on the /dev/mem device.

    The typical usage of unmap_mapping_range() is part of
    truncate_pagecache() to punch a hole in a file, but in this case the
    implementation is only doing the "first half" of a hole punch. Namely it
    is just evacuating current established mappings of the "hole", and it
    relies on the fact that /dev/mem establishes mappings in terms of
    absolute physical address offsets. Once existing mmap users are
    invalidated they can attempt to re-establish the mapping, or attempt to
    continue issuing read(2) / write(2) to the invalidated extent, but they
    will then be subject to the CONFIG_IO_STRICT_DEVMEM checking that can
    block those subsequent accesses.

    Cc: Arnd Bergmann
    Cc: Ingo Molnar
    Cc: Kees Cook
    Cc: Matthew Wilcox
    Cc: Russell King
    Cc: Andrew Morton
    Cc: Greg Kroah-Hartman
    Fixes: 90a545e98126 ("restrict /dev/mem to idle io memory ranges")
    Signed-off-by: Dan Williams
    Reviewed-by: Kees Cook
    Link: https://lore.kernel.org/r/159009507306.847224.8502634072429766747.stgit@dwillia2-desk3.amr.corp.intel.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Dan Williams
     
  • [ Upstream commit 7c47a219b95d0e06b5ef5fcc7bad807895015eac ]

    We met mulitple times of failure of staring bmc-watchdog,
    due to the runtime memory allocation failure of order 4.

    bmc-watchdog: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0-1
    CPU: 1 PID: 2571 Comm: bmc-watchdog Not tainted 5.5.0-00045-g7d6bb61d6188c #1
    Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.00.01.0015.110720180833 11/07/2018
    Call Trace:
    dump_stack+0x66/0x8b
    warn_alloc+0xfe/0x160
    __alloc_pages_slowpath+0xd3e/0xd80
    __alloc_pages_nodemask+0x2f0/0x340
    kmalloc_order+0x18/0x70
    kmalloc_order_trace+0x1d/0xb0
    ipmi_create_user+0x55/0x2c0 [ipmi_msghandler]
    ipmi_open+0x72/0x110 [ipmi_devintf]
    chrdev_open+0xcb/0x1e0
    do_dentry_open+0x1ce/0x380
    path_openat+0x305/0x14f0
    do_filp_open+0x9b/0x110
    do_sys_open+0x1bd/0x250
    do_syscall_64+0x5b/0x1f0
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Using vzalloc/vfree for creating ipmi_user heals the
    problem

    Thanks to Stephen Rothwell for finding the vmalloc.h
    inclusion issue.

    Signed-off-by: Feng Tang
    Signed-off-by: Corey Minyard
    Signed-off-by: Sasha Levin

    Feng Tang
     

19 Jun, 2020

1 commit

  • * tag 'v5.4.47': (2193 commits)
    Linux 5.4.47
    KVM: arm64: Save the host's PtrAuth keys in non-preemptible context
    KVM: arm64: Synchronize sysreg state on injecting an AArch32 exception
    ...

    Conflicts:
    arch/arm/boot/dts/imx6qdl.dtsi
    arch/arm/mach-imx/Kconfig
    arch/arm/mach-imx/common.h
    arch/arm/mach-imx/suspend-imx6.S
    arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
    arch/powerpc/include/asm/cacheflush.h
    drivers/cpufreq/imx6q-cpufreq.c
    drivers/dma/imx-sdma.c
    drivers/edac/synopsys_edac.c
    drivers/firmware/imx/imx-scu.c
    drivers/net/ethernet/freescale/fec.h
    drivers/net/ethernet/freescale/fec_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/phy_device.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/usb/cdns3/gadget.c
    drivers/usb/dwc3/gadget.c
    include/uapi/linux/dma-buf.h

    Signed-off-by: Jason Liu

    Jason Liu
     

17 Jun, 2020

1 commit

  • commit f30d3ced9fafa03e4855508929b5b6334907f45e upstream.

    After changing the timing between GTT updates and execution on the GPU,
    we started seeing sporadic failures on Ironlake. These were narrowed
    down to being an insufficiently strong enough barrier/delay after
    updating the GTT and scheduling execution on the GPU. By forcing the
    uncached read, and adding the missing barrier for the singular
    insert_page (relocation paths), the sporadic failures go away.

    Fixes: 983d308cb8f6 ("agp/intel: Serialise after GTT updates")
    Fixes: 3497971a71d8 ("agp/intel: Flush chipset writes after updating a single PTE")
    Signed-off-by: Chris Wilson
    Acked-by: Andi Shyti
    Cc: stable@vger.kernel.org # v4.0+
    Link: https://patchwork.freedesktop.org/patch/msgid/20200410083535.25464-1-chris@chris-wilson.co.uk
    Signed-off-by: Greg Kroah-Hartman

    Chris Wilson
     

29 Apr, 2020

3 commits

  • commit eba5cf3dcb844c82f54d4a857e124824e252206d upstream.

    tpm_ibmvtpm_send() can fail during PowerVM Live Partition Mobility resume
    with an H_CLOSED return from ibmvtpm_send_crq(). The PAPR says, 'The
    "partner partition suspended" transport event disables the associated CRQ
    such that any H_SEND_CRQ hcall() to the associated CRQ returns H_Closed
    until the CRQ has been explicitly enabled using the H_ENABLE_CRQ hcall.'
    This patch adds a check in tpm_ibmvtpm_send() for an H_CLOSED return from
    ibmvtpm_send_crq() and in that case calls tpm_ibmvtpm_resume() and
    retries the ibmvtpm_send_crq() once.

    Cc: stable@vger.kernel.org # 3.7.x
    Fixes: 132f76294744 ("drivers/char/tpm: Add new device driver to support IBM vTPM")
    Reported-by: Linh Pham
    Reviewed-by: Stefan Berger
    Signed-off-by: George Wilson
    Tested-by: Linh Pham
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    George Wilson
     
  • commit 29cb79795e324a8b65e7891d76f8f6ca911ba440 upstream.

    For the algorithm that does not match the bank, a positive
    value EINVAL is returned here. I think this is a typo error.
    It is necessary to return an error value.

    Cc: stable@vger.kernel.org # 5.4.x
    Fixes: 9f75c8224631 ("KEYS: trusted: correctly initialize digests and fix locking issue")
    Signed-off-by: Tianjia Zhang
    Reviewed-by: Roberto Sassu
    Reviewed-by: Jerry Snitselaar
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Tianjia Zhang
     
  • commit b160c94be5d2816b62c8ac338605668304242959 upstream.

    Call disable_interrupts() if we have to revert to polling in order not to
    unnecessarily reserve the IRQ for the life-cycle of the driver.

    Cc: stable@vger.kernel.org # 4.5.x
    Reported-by: Hans de Goede
    Fixes: e3837e74a06d ("tpm_tis: Refactor the interrupt setup")
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Jarkko Sakkinen
     

17 Apr, 2020

4 commits

  • commit 32830a0534700f86366f371b150b17f0f0d140d7 upstream.

    The wait_event() function is used to detect command completion.
    When send_guid_cmd() returns an error, smi_send() has not been
    called to send data. Therefore, wait_event() should not be used
    on the error path, otherwise it will cause the following warning:

    [ 1361.588808] systemd-udevd D 0 1501 1436 0x00000004
    [ 1361.588813] ffff883f4b1298c0 0000000000000000 ffff883f4b188000 ffff887f7e3d9f40
    [ 1361.677952] ffff887f64bd4280 ffffc90037297a68 ffffffff8173ca3b ffffc90000000010
    [ 1361.767077] 00ffc90037297ad0 ffff887f7e3d9f40 0000000000000286 ffff883f4b188000
    [ 1361.856199] Call Trace:
    [ 1361.885578] [] ? __schedule+0x23b/0x780
    [ 1361.951406] [] schedule+0x36/0x80
    [ 1362.010979] [] get_guid+0x118/0x150 [ipmi_msghandler]
    [ 1362.091281] [] ? prepare_to_wait_event+0x100/0x100
    [ 1362.168533] [] ipmi_register_smi+0x405/0x940 [ipmi_msghandler]
    [ 1362.258337] [] try_smi_init+0x529/0x950 [ipmi_si]
    [ 1362.334521] [] ? std_irq_setup+0xd0/0xd0 [ipmi_si]
    [ 1362.411701] [] init_ipmi_si+0x492/0x9e0 [ipmi_si]
    [ 1362.487917] [] ? ipmi_pci_probe+0x280/0x280 [ipmi_si]
    [ 1362.568219] [] do_one_initcall+0x50/0x180
    [ 1362.636109] [] ? kmem_cache_alloc_trace+0x142/0x190
    [ 1362.714330] [] do_init_module+0x5f/0x200
    [ 1362.781208] [] load_module+0x1898/0x1de0
    [ 1362.848069] [] ? __symbol_put+0x60/0x60
    [ 1362.913886] [] ? security_kernel_post_read_file+0x6b/0x80
    [ 1362.998514] [] SYSC_finit_module+0xe5/0x120
    [ 1363.068463] [] ? SYSC_finit_module+0xe5/0x120
    [ 1363.140513] [] SyS_finit_module+0xe/0x10
    [ 1363.207364] [] do_syscall_64+0x74/0x180

    Fixes: 50c812b2b951 ("[PATCH] ipmi: add full sysfs support")
    Signed-off-by: Wen Yang
    Cc: Corey Minyard
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: openipmi-developer@lists.sourceforge.net
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org # 2.6.17-
    Message-Id:
    Signed-off-by: Corey Minyard
    Signed-off-by: Greg Kroah-Hartman

    Wen Yang
     
  • commit f9bf8adb55cd5a357b247a16aafddf8c97b276e0 upstream.

    If .next function does not change position index,
    following .show function will repeat output related
    to current position index.

    For /sys/kernel/security/tpm0/binary_bios_measurements:
    1) read after lseek beyound end of file generates whole last line.
    2) read after lseek to middle of last line generates
    expected end of last line and unexpected whole last line once again.

    Cc: stable@vger.kernel.org # 4.19.x
    Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code ...")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
    Signed-off-by: Vasily Averin
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Vasily Averin
     
  • commit d7a47b96ed1102551eb7325f97937e276fb91045 upstream.

    If .next function does not change position index,
    following .show function will repeat output related
    to current position index.

    In case of /sys/kernel/security/tpm0/ascii_bios_measurements
    and binary_bios_measurements:
    1) read after lseek beyound end of file generates whole last line.
    2) read after lseek to middle of last line generates
    expected end of last line and unexpected whole last line once again.

    Cc: stable@vger.kernel.org # 4.19.x
    Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code ...")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
    Signed-off-by: Vasily Averin
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Vasily Averin
     
  • commit 805fa88e0780b7ce1cc9b649dd91a0a7164c6eb4 upstream.

    If a TPM is in disabled state, it's reasonable for it to have an empty
    log. Bailing out of probe in this case means that the PPI interface
    isn't available, so there's no way to then enable the TPM from the OS.
    In general it seems reasonable to ignore log errors - they shouldn't
    interfere with any other TPM functionality.

    Signed-off-by: Matthew Garrett
    Cc: stable@vger.kernel.org # 4.19.x
    Reviewed-by: Jerry Snitselaar
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Matthew Garrett
     

13 Apr, 2020

2 commits

  • commit 47a1f8e8b3637ff5f7806587883d7d94068d9ee8 upstream.

    Make sure that the rngc interrupt is masked if the rngc self test fails.
    Self test failure means that probe fails as well. Interrupts should be
    masked in this case, regardless of the error.

    Cc: stable@vger.kernel.org
    Fixes: 1d5449445bd0 ("hwrng: mx-rngc - add a driver for Freescale RNGC")
    Reviewed-by: PrasannaKumar Muralidharan
    Signed-off-by: Martin Kaiser
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Martin Kaiser
     
  • commit 69efea712f5b0489e67d07565aad5c94e09a3e52 upstream.

    It turns out that RDRAND is pretty slow. Comparing these two
    constructions:

    for (i = 0; i < CHACHA_BLOCK_SIZE; i += sizeof(ret))
    arch_get_random_long(&ret);

    and

    long buf[CHACHA_BLOCK_SIZE / sizeof(long)];
    extract_crng((u8 *)buf);

    it amortizes out to 352 cycles per long for the top one and 107 cycles
    per long for the bottom one, on Coffee Lake Refresh, Intel Core i9-9880H.

    And importantly, the top one has the drawback of not benefiting from the
    real rng, whereas the bottom one has all the nice benefits of using our
    own chacha rng. As get_random_u{32,64} gets used in more places (perhaps
    beyond what it was originally intended for when it was introduced as
    get_random_{int,long} back in the md5 monstrosity era), it seems like it
    might be a good thing to strengthen its posture a tiny bit. Doing this
    should only be stronger and not any weaker because that pool is already
    initialized with a bunch of rdrand data (when available). This way, we
    get the benefits of the hardware rng as well as our own rng.

    Another benefit of this is that we no longer hit pitfalls of the recent
    stream of AMD bugs in RDRAND. One often used code pattern for various
    things is:

    do {
    val = get_random_u32();
    } while (hash_table_contains_key(val));

    That recent AMD bug rendered that pattern useless, whereas we're really
    very certain that chacha20 output will give pretty distributed numbers,
    no matter what.

    So, this simplification seems better both from a security perspective
    and from a performance perspective.

    Signed-off-by: Jason A. Donenfeld
    Reviewed-by: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20200221201037.30231-1-Jason@zx2c4.com
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     

18 Mar, 2020

1 commit

  • commit 443d372d6a96cd94ad119e5c14bb4d63a536a7f6 upstream.

    Although the IRQ assignment in ipmi_si driver is optional,
    platform_get_irq() spews error messages unnecessarily:
    ipmi_si dmi-ipmi-si.0: IRQ index 0 not found

    Fix this by switching to platform_get_irq_optional().

    Cc: stable@vger.kernel.org # 5.4.x
    Cc: John Donnelly
    Fixes: 7723f4c5ecdb ("driver core: platform: Add an error message to platform_get_irq*()")
    Reported-and-tested-by: Patrick Vo
    Signed-off-by: Takashi Iwai
    Message-Id:
    Signed-off-by: Corey Minyard
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

05 Mar, 2020

1 commit

  • [ Upstream commit 6b8526d3abc02c08a2f888e8c20b7ac9e5776dfe ]

    In error cases a NULL can be passed to memcpy. The length will always
    be zero, so it doesn't really matter, but go ahead and check for NULL,
    anyway, to be more precise and avoid static analysis errors.

    Reported-by: kbuild test robot
    Signed-off-by: Corey Minyard
    Signed-off-by: Sasha Levin

    Corey Minyard
     

29 Feb, 2020

1 commit

  • commit dc10e4181c05a2315ddc375e963b7c763b5ee0df upstream.

    chip->allocated_banks, an array of tpm_bank_info structures, contains the
    list of TPM algorithm IDs of allocated PCR banks. It also contains the
    corresponding ID of the crypto subsystem, so that users of the TPM driver
    can calculate a digest for a PCR extend operation.

    However, if there is no mapping between TPM algorithm ID and crypto ID, the
    crypto_id field of tpm_bank_info remains set to zero (the array is
    allocated and initialized with kcalloc() in tpm2_get_pcr_allocation()).
    Zero should not be used as value for unknown mappings, as it is a valid
    crypto ID (HASH_ALGO_MD4).

    Thus, initialize crypto_id to HASH_ALGO__LAST.

    Cc: stable@vger.kernel.org # 5.1.x
    Fixes: 879b589210a9 ("tpm: retrieve digest size of unknown algorithms with PCR read")
    Signed-off-by: Roberto Sassu
    Reviewed-by: Petr Vorel
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Roberto Sassu
     

26 Feb, 2020

1 commit

  • Currently, there is only spin lock added in imx_sema4_mutex_lock(),but
    sema4 driver assume any mutex should be handled one by one and complain
    when mutex locked once again before unlocked. Hence, if another lock happens
    indeed after the last imx_sema4_mutex_lock(),the complains "imx_sema4_
    mutex_lock 135 already locked" would come out over again and again as below.
    So delay lock released into imx_sema4_mutex_unlock() to elimate such race
    contition.

    Thread1: Thread2:
    .... ....
    ------------------------------------------
    imx_sema4_mutex_lock ---->grabbed->|imx_sema4_mutex_lock |
    |"imx_sema4_mutex_lock 135 already locked"|
    ------------------------------------------
    imx_sema4_mutex_unlock imx_sema4_mutex_unlock
    .... .....

    Signed-off-by: Robin Gong
    Reviewed-by: Anson Huang
    Signed-off-by: Dong Aisheng
    (cherry picked from commit 362fdbb91f1c2e386adc6147c07f714be6134907)

    Robin Gong
     

24 Feb, 2020

2 commits

  • [ Upstream commit 98c49f1746ac44ccc164e914b9a44183fad09f51 ]

    Currently, there is an out-of-bounds read on array hpetp->hp_dev
    in the following for loop:

    870 for (i = 0; i < hdp->hd_nirqs; i++)
    871 hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];

    This is due to the recent change from one-element array to
    flexible-array member in struct hpets:

    104 struct hpets {
    ...
    113 struct hpet_dev hp_dev[];
    114 };

    This change affected the total size of the dynamic memory
    allocation, decreasing it by one time the size of struct hpet_dev.

    Fix this by adjusting the allocation size when calling
    struct_size().

    Fixes: 987f028b8637c ("char: hpet: Use flexible-array member")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Tetsuo Handa
    Acked-by: Eric Biggers
    Link: https://lore.kernel.org/r/20200129022613.GA24281@embeddedor.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Gustavo A. R. Silva
     
  • [ Upstream commit 1b710b1b10eff9d46666064ea25f079f70bc67a8 ]

    Sergey didn't like the locking order,

    uart_port->lock -> tty_port->lock

    uart_write (uart_port->lock)
    __uart_start
    pl011_start_tx
    pl011_tx_chars
    uart_write_wakeup
    tty_port_tty_wakeup
    tty_port_default
    tty_port_tty_get (tty_port->lock)

    but those code is so old, and I have no clue how to de-couple it after
    checking other locks in the splat. There is an onging effort to make all
    printk() as deferred, so until that happens, workaround it for now as a
    short-term fix.

    LTP: starting iogen01 (export LTPROOT; rwtest -N iogen01 -i 120s -s
    read,write -Da -Dv -n 2 500b:$TMPDIR/doio.f1.$$
    1000b:$TMPDIR/doio.f2.$$)
    WARNING: possible circular locking dependency detected
    ------------------------------------------------------
    doio/49441 is trying to acquire lock:
    ffff008b7cff7290 (&(&zone->lock)->rlock){..-.}, at: rmqueue+0x138/0x2050

    but task is already holding lock:
    60ff000822352818 (&pool->lock/1){-.-.}, at: start_flush_work+0xd8/0x3f0

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #4 (&pool->lock/1){-.-.}:
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    __queue_work+0x4b4/0xa10
    queue_work_on+0xac/0x11c
    tty_schedule_flip+0x84/0xbc
    tty_flip_buffer_push+0x1c/0x28
    pty_write+0x98/0xd0
    n_tty_write+0x450/0x60c
    tty_write+0x338/0x474
    __vfs_write+0x88/0x214
    vfs_write+0x12c/0x1a4
    redirected_tty_write+0x90/0xdc
    do_loop_readv_writev+0x140/0x180
    do_iter_write+0xe0/0x10c
    vfs_writev+0x134/0x1cc
    do_writev+0xbc/0x130
    __arm64_sys_writev+0x58/0x8c
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    -> #3 (&(&port->lock)->rlock){-.-.}:
    lock_acquire+0x320/0x360
    _raw_spin_lock_irqsave+0x7c/0x9c
    tty_port_tty_get+0x24/0x60
    tty_port_default_wakeup+0x1c/0x3c
    tty_port_tty_wakeup+0x34/0x40
    uart_write_wakeup+0x28/0x44
    pl011_tx_chars+0x1b8/0x270
    pl011_start_tx+0x24/0x70
    __uart_start+0x5c/0x68
    uart_write+0x164/0x1c8
    do_output_char+0x33c/0x348
    n_tty_write+0x4bc/0x60c
    tty_write+0x338/0x474
    redirected_tty_write+0xc0/0xdc
    do_loop_readv_writev+0x140/0x180
    do_iter_write+0xe0/0x10c
    vfs_writev+0x134/0x1cc
    do_writev+0xbc/0x130
    __arm64_sys_writev+0x58/0x8c
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    -> #2 (&port_lock_key){-.-.}:
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    pl011_console_write+0xec/0x2cc
    console_unlock+0x794/0x96c
    vprintk_emit+0x260/0x31c
    vprintk_default+0x54/0x7c
    vprintk_func+0x218/0x254
    printk+0x7c/0xa4
    register_console+0x734/0x7b0
    uart_add_one_port+0x734/0x834
    pl011_register_port+0x6c/0xac
    sbsa_uart_probe+0x234/0x2ec
    platform_drv_probe+0xd4/0x124
    really_probe+0x250/0x71c
    driver_probe_device+0xb4/0x200
    __device_attach_driver+0xd8/0x188
    bus_for_each_drv+0xbc/0x110
    __device_attach+0x120/0x220
    device_initial_probe+0x20/0x2c
    bus_probe_device+0x54/0x100
    device_add+0xae8/0xc2c
    platform_device_add+0x278/0x3b8
    platform_device_register_full+0x238/0x2ac
    acpi_create_platform_device+0x2dc/0x3a8
    acpi_bus_attach+0x390/0x3cc
    acpi_bus_attach+0x108/0x3cc
    acpi_bus_attach+0x108/0x3cc
    acpi_bus_attach+0x108/0x3cc
    acpi_bus_scan+0x7c/0xb0
    acpi_scan_init+0xe4/0x304
    acpi_init+0x100/0x114
    do_one_initcall+0x348/0x6a0
    do_initcall_level+0x190/0x1fc
    do_basic_setup+0x34/0x4c
    kernel_init_freeable+0x19c/0x260
    kernel_init+0x18/0x338
    ret_from_fork+0x10/0x18

    -> #1 (console_owner){-...}:
    lock_acquire+0x320/0x360
    console_lock_spinning_enable+0x6c/0x7c
    console_unlock+0x4f8/0x96c
    vprintk_emit+0x260/0x31c
    vprintk_default+0x54/0x7c
    vprintk_func+0x218/0x254
    printk+0x7c/0xa4
    get_random_u64+0x1c4/0x1dc
    shuffle_pick_tail+0x40/0xac
    __free_one_page+0x424/0x710
    free_one_page+0x70/0x120
    __free_pages_ok+0x61c/0xa94
    __free_pages_core+0x1bc/0x294
    memblock_free_pages+0x38/0x48
    __free_pages_memory+0xcc/0xfc
    __free_memory_core+0x70/0x78
    free_low_memory_core_early+0x148/0x18c
    memblock_free_all+0x18/0x54
    mem_init+0xb4/0x17c
    mm_init+0x14/0x38
    start_kernel+0x19c/0x530

    -> #0 (&(&zone->lock)->rlock){..-.}:
    validate_chain+0xf6c/0x2e2c
    __lock_acquire+0x868/0xc2c
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    rmqueue+0x138/0x2050
    get_page_from_freelist+0x474/0x688
    __alloc_pages_nodemask+0x3b4/0x18dc
    alloc_pages_current+0xd0/0xe0
    alloc_slab_page+0x2b4/0x5e0
    new_slab+0xc8/0x6bc
    ___slab_alloc+0x3b8/0x640
    kmem_cache_alloc+0x4b4/0x588
    __debug_object_init+0x778/0x8b4
    debug_object_init_on_stack+0x40/0x50
    start_flush_work+0x16c/0x3f0
    __flush_work+0xb8/0x124
    flush_work+0x20/0x30
    xlog_cil_force_lsn+0x88/0x204 [xfs]
    xfs_log_force_lsn+0x128/0x1b8 [xfs]
    xfs_file_fsync+0x3c4/0x488 [xfs]
    vfs_fsync_range+0xb0/0xd0
    generic_write_sync+0x80/0xa0 [xfs]
    xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
    xfs_file_write_iter+0x1a0/0x218 [xfs]
    __vfs_write+0x1cc/0x214
    vfs_write+0x12c/0x1a4
    ksys_write+0xb0/0x120
    __arm64_sys_write+0x54/0x88
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    other info that might help us debug this:

    Chain exists of:
    &(&zone->lock)->rlock --> &(&port->lock)->rlock --> &pool->lock/1

    Possible unsafe locking scenario:

    CPU0 CPU1
    ---- ----
    lock(&pool->lock/1);
    lock(&(&port->lock)->rlock);
    lock(&pool->lock/1);
    lock(&(&zone->lock)->rlock);

    *** DEADLOCK ***

    4 locks held by doio/49441:
    #0: a0ff00886fc27408 (sb_writers#8){.+.+}, at: vfs_write+0x118/0x1a4
    #1: 8fff00080810dfe0 (&xfs_nondir_ilock_class){++++}, at:
    xfs_ilock+0x2a8/0x300 [xfs]
    #2: ffff9000129f2390 (rcu_read_lock){....}, at:
    rcu_lock_acquire+0x8/0x38
    #3: 60ff000822352818 (&pool->lock/1){-.-.}, at:
    start_flush_work+0xd8/0x3f0

    stack backtrace:
    CPU: 48 PID: 49441 Comm: doio Tainted: G W
    Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS
    L50_5.13_1.11 06/18/2019
    Call trace:
    dump_backtrace+0x0/0x248
    show_stack+0x20/0x2c
    dump_stack+0xe8/0x150
    print_circular_bug+0x368/0x380
    check_noncircular+0x28c/0x294
    validate_chain+0xf6c/0x2e2c
    __lock_acquire+0x868/0xc2c
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    rmqueue+0x138/0x2050
    get_page_from_freelist+0x474/0x688
    __alloc_pages_nodemask+0x3b4/0x18dc
    alloc_pages_current+0xd0/0xe0
    alloc_slab_page+0x2b4/0x5e0
    new_slab+0xc8/0x6bc
    ___slab_alloc+0x3b8/0x640
    kmem_cache_alloc+0x4b4/0x588
    __debug_object_init+0x778/0x8b4
    debug_object_init_on_stack+0x40/0x50
    start_flush_work+0x16c/0x3f0
    __flush_work+0xb8/0x124
    flush_work+0x20/0x30
    xlog_cil_force_lsn+0x88/0x204 [xfs]
    xfs_log_force_lsn+0x128/0x1b8 [xfs]
    xfs_file_fsync+0x3c4/0x488 [xfs]
    vfs_fsync_range+0xb0/0xd0
    generic_write_sync+0x80/0xa0 [xfs]
    xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
    xfs_file_write_iter+0x1a0/0x218 [xfs]
    __vfs_write+0x1cc/0x214
    vfs_write+0x12c/0x1a4
    ksys_write+0xb0/0x120
    __arm64_sys_write+0x54/0x88
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Qian Cai
    Link: https://lore.kernel.org/r/1573679785-21068-1-git-send-email-cai@lca.pw
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Sasha Levin

    Sergey Senozhatsky
     

20 Feb, 2020

1 commit

  • commit e0354d147e5889b5faa12e64fa38187aed39aad4 upstream.

    The end of buffer check is off-by-one since the check is against
    an index that is pre-incremented before a store to buf[]. Fix this
    adjusting the bounds check appropriately.

    Addresses-Coverity: ("Out-of-bounds write")
    Fixes: 51bd6f291583 ("Add support for IPMB driver")
    Signed-off-by: Colin Ian King
    Message-Id:
    Reviewed-by: Asmaa Mnebhi
    Signed-off-by: Corey Minyard
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

06 Feb, 2020

1 commit

  • commit 9a655c77ff8fc65699a3f98e237db563b37c439b upstream.

    tpk_write()/tpk_close() could be interrupted when holding a mutex, then
    in timer handler tpk_write() may be called again trying to acquire same
    mutex, lead to deadlock.

    Google syzbot reported this issue with CONFIG_DEBUG_ATOMIC_SLEEP
    enabled:

    BUG: sleeping function called from invalid context at
    kernel/locking/mutex.c:938
    in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
    1 lock held by swapper/1/0:
    ...
    Call Trace:

    dump_stack+0x197/0x210
    ___might_sleep.cold+0x1fb/0x23e
    __might_sleep+0x95/0x190
    __mutex_lock+0xc5/0x13c0
    mutex_lock_nested+0x16/0x20
    tpk_write+0x5d/0x340
    resync_tnc+0x1b6/0x320
    call_timer_fn+0x1ac/0x780
    run_timer_softirq+0x6c3/0x1790
    __do_softirq+0x262/0x98c
    irq_exit+0x19b/0x1e0
    smp_apic_timer_interrupt+0x1a3/0x610
    apic_timer_interrupt+0xf/0x20

    See link https://syzkaller.appspot.com/bug?extid=2eeef62ee31f9460ad65 for
    more details.

    Fix it by using spinlock in process context instead of mutex and having
    interrupt disabled in critical section.

    Reported-by: syzbot+2eeef62ee31f9460ad65@syzkaller.appspotmail.com
    Signed-off-by: Zhenzhong Duan
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20200113034842.435-1-zhenzhong.duan@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Zhenzhong Duan
     

26 Jan, 2020

2 commits

  • [ Upstream commit 0c0ef9ea6f3f0d5979dc7b094b0a184c1a94716b ]

    Commit 0ed266d7ae5e ("clk: ti: omap3: cleanup unnecessary clock aliases")
    removed old omap3 clock framework aliases but caused omap3-rom-rng to
    stop working with clock not found error.

    Based on discussions on the mailing list it was requested by Tero Kristo
    that it would be best to fix this issue by probing omap3-rom-rng using
    device tree to provide a proper clk property. The other option would be
    to add back the missing clock alias, but that does not help moving things
    forward with removing old legacy platform_data.

    Let's also add a proper device tree binding and keep it together with
    the fix.

    Cc: devicetree@vger.kernel.org
    Cc: Aaro Koskinen
    Cc: Adam Ford
    Cc: Pali Rohár
    Cc: Rob Herring
    Cc: Sebastian Reichel
    Cc: Tero Kristo
    Fixes: 0ed266d7ae5e ("clk: ti: omap3: cleanup unnecessary clock aliases")
    Reported-by: Aaro Koskinen
    Signed-off-by: Tony Lindgren
    Acked-by: Rob Herring
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Tony Lindgren
     
  • commit 4aa7afb0ee20a97fbf0c5bab3df028d5fb85fdab upstream.

    In the impelementation of __ipmi_bmc_register() the allocated memory for
    bmc should be released in case ida_simple_get() fails.

    Fixes: 68e7e50f195f ("ipmi: Don't use BMC product/dev ids in the BMC name")
    Signed-off-by: Navid Emamdoost
    Message-Id:
    Signed-off-by: Corey Minyard
    Signed-off-by: Greg Kroah-Hartman

    Navid Emamdoost
     

15 Jan, 2020

2 commits

  • commit a430e67d9a2c62a8c7b315b99e74de02018d0a96 upstream.

    The priv->response_length can hold the size of an response or an negative
    error code, and the tpm_common_read() needs to handle both cases correctly.
    Changed the type of response_length to signed and accounted for negative
    value in tpm_common_read().

    Cc: stable@vger.kernel.org
    Fixes: d23d12484307 ("tpm: fix invalid locking in NONBLOCKING mode")
    Reported-by: Laura Abbott
    Signed-off-by: Tadeusz Struk
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Tadeusz Struk
     
  • commit aa4a63dd981682b1742baa01237036e48bc11923 upstream.

    There has been a bunch of reports (one from kernel bugzilla linked)
    reporting that when this commit is applied it causes on some machines
    boot freezes.

    Unfortunately hardware where this commit causes a failure is not widely
    available (only one I'm aware is Lenovo T490), which means we cannot
    predict yet how long it will take to properly fix tpm_tis interrupt
    probing.

    Thus, the least worst short term action is to revert the code to the
    state before this commit. In long term we need fix the tpm_tis probing
    code to work on machines that Stefan's fix was supposed to fix.

    Fixes: 21df4a8b6018 ("tpm_tis: reserve chip for duration of tpm_tis_core_init")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
    Cc: stable@vger.kernel.org
    Cc: Jerry Snitselaar
    Cc: Dan Williams
    Tested-by: Dan Williams
    Tested-by: Xiaoping Zhou
    Signed-off-by: Stefan Berger
    Reported-by: Jerry Snitselaar
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Stefan Berger