Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: first attempt to enable jh7100 #2

Closed
wants to merge 435 commits into from
Closed
This pull request is big! We’re only showing the most recent 250 commits.

Commits on May 12, 2021

  1. kvfree_rcu: Use same set of GFP flags as does single-argument

    [ Upstream commit ee6ddf5 ]
    
    Running an rcuscale stress-suite can lead to "Out of memory" of a
    system. This can happen under high memory pressure with a small amount
    of physical memory.
    
    For example, a KVM test configuration with 64 CPUs and 512 megabytes
    can result in OOM when running rcuscale with below parameters:
    
    ../kvm.sh --torture rcuscale --allcpus --duration 10 --kconfig CONFIG_NR_CPUS=64 \
    --bootargs "rcuscale.kfree_rcu_test=1 rcuscale.kfree_nthreads=16 rcuscale.holdoff=20 \
      rcuscale.kfree_loops=10000 torture.disable_onoff_at_boot" --trust-make
    
    <snip>
    [   12.054448] kworker/1:1H invoked oom-killer: gfp_mask=0x2cc0(GFP_KERNEL|__GFP_NOWARN), order=0, oom_score_adj=0
    [   12.055303] CPU: 1 PID: 377 Comm: kworker/1:1H Not tainted 5.11.0-rc3+ torvalds#510
    [   12.055416] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.12.0-1 04/01/2014
    [   12.056485] Workqueue: events_highpri fill_page_cache_func
    [   12.056485] Call Trace:
    [   12.056485]  dump_stack+0x57/0x6a
    [   12.056485]  dump_header+0x4c/0x30a
    [   12.056485]  ? del_timer_sync+0x20/0x30
    [   12.056485]  out_of_memory.cold.47+0xa/0x7e
    [   12.056485]  __alloc_pages_slowpath.constprop.123+0x82f/0xc00
    [   12.056485]  __alloc_pages_nodemask+0x289/0x2c0
    [   12.056485]  __get_free_pages+0x8/0x30
    [   12.056485]  fill_page_cache_func+0x39/0xb0
    [   12.056485]  process_one_work+0x1ed/0x3b0
    [   12.056485]  ? process_one_work+0x3b0/0x3b0
    [   12.060485]  worker_thread+0x28/0x3c0
    [   12.060485]  ? process_one_work+0x3b0/0x3b0
    [   12.060485]  kthread+0x138/0x160
    [   12.060485]  ? kthread_park+0x80/0x80
    [   12.060485]  ret_from_fork+0x22/0x30
    [   12.062156] Mem-Info:
    [   12.062350] active_anon:0 inactive_anon:0 isolated_anon:0
    [   12.062350]  active_file:0 inactive_file:0 isolated_file:0
    [   12.062350]  unevictable:0 dirty:0 writeback:0
    [   12.062350]  slab_reclaimable:2797 slab_unreclaimable:80920
    [   12.062350]  mapped:1 shmem:2 pagetables:8 bounce:0
    [   12.062350]  free:10488 free_pcp:1227 free_cma:0
    ...
    [   12.101610] Out of memory and no killable processes...
    [   12.102042] Kernel panic - not syncing: System is deadlocked on memory
    [   12.102583] CPU: 1 PID: 377 Comm: kworker/1:1H Not tainted 5.11.0-rc3+ torvalds#510
    [   12.102600] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.12.0-1 04/01/2014
    <snip>
    
    Because kvfree_rcu() has a fallback path, memory allocation failure is
    not the end of the world.  Furthermore, the added overhead of aggressive
    GFP settings must be balanced against the overhead of the fallback path,
    which is a cache miss for double-argument kvfree_rcu() and a call to
    synchronize_rcu() for single-argument kvfree_rcu().  The current choice
    of GFP_KERNEL|__GFP_NOWARN can result in longer latencies than a call
    to synchronize_rcu(), so less-tenacious GFP flags would be helpful.
    
    Here is the tradeoff that must be balanced:
        a) Minimize use of the fallback path,
        b) Avoid pushing the system into OOM,
        c) Bound allocation latency to that of synchronize_rcu(), and
        d) Leave the emergency reserves to use cases lacking fallbacks.
    
    This commit therefore changes GFP flags from GFP_KERNEL|__GFP_NOWARN to
    GFP_KERNEL|__GFP_NORETRY|__GFP_NOMEMALLOC|__GFP_NOWARN.  This combination
    leaves the emergency reserves alone and can initiate reclaim, but will
    not invoke the OOM killer.
    
    Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
    Signed-off-by: Paul E. McKenney <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    urezki authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    3f92606 View commit details
    Browse the repository at this point in the history
  2. drm/virtio: fix possible leak/unlock virtio_gpu_object_array

    [ Upstream commit 377f833 ]
    
    virtio_gpu_object array is not freed or unlocked in some
    failed cases.
    
    Signed-off-by: xndcn <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Gerd Hoffmann <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    xndcn authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1016c0f View commit details
    Browse the repository at this point in the history
  3. scsi: target: pscsi: Fix warning in pscsi_complete_cmd()

    [ Upstream commit fd48c05 ]
    
    This fixes a compilation warning in pscsi_complete_cmd():
    
         drivers/target/target_core_pscsi.c: In function ‘pscsi_complete_cmd’:
         drivers/target/target_core_pscsi.c:624:5: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
         ; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
    
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Mike Christie <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Signed-off-by: Chaitanya Kulkarni <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    ChaitanayaKulkarni authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    4f8058c View commit details
    Browse the repository at this point in the history
  4. media: ite-cir: check for receive overflow

    [ Upstream commit 28c7afb ]
    
    It's best if this condition is reported.
    
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    seanyoung authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2eeccff View commit details
    Browse the repository at this point in the history
  5. media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB

    [ Upstream commit 24df8b7 ]
    
    When STA2X11_VIP is enabled, and GPIOLIB is disabled,
    Kbuild gives the following warning:
    
    WARNING: unmet direct dependencies detected for VIDEO_ADV7180
      Depends on [n]: MEDIA_SUPPORT [=y] && GPIOLIB [=n] && VIDEO_V4L2 [=y] && I2C [=y]
      Selected by [y]:
      - STA2X11_VIP [=y] && MEDIA_SUPPORT [=y] && MEDIA_PCI_SUPPORT [=y] && MEDIA_CAMERA_SUPPORT [=y] && PCI [=y] && VIDEO_V4L2 [=y] && VIRT_TO_BUS [=y] && I2C [=y] && (STA2X11 [=n] || COMPILE_TEST [=y]) && MEDIA_SUBDRV_AUTOSELECT [=y]
    
    This is because STA2X11_VIP selects VIDEO_ADV7180
    without selecting or depending on GPIOLIB,
    despite VIDEO_ADV7180 depending on GPIOLIB.
    
    Signed-off-by: Julian Braha <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    julianbraha authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    6802047 View commit details
    Browse the repository at this point in the history
  6. media: drivers/media/usb: fix memory leak in zr364xx_probe

    [ Upstream commit 9c39be4 ]
    
    syzbot reported memory leak in zr364xx_probe()[1].
    The problem was in invalid error handling order.
    All error conditions rigth after v4l2_ctrl_handler_init()
    must call v4l2_ctrl_handler_free().
    
    Reported-by: [email protected]
    Signed-off-by: Pavel Skripkin <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    pskrgag authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    08acc77 View commit details
    Browse the repository at this point in the history
  7. media: cx23885: add more quirks for reset DMA on some AMD IOMMU

    [ Upstream commit 5f864cf ]
    
    The folowing AMD IOMMU are affected by the RiSC engine stall, requiring a
    reset to maintain continual operation. After being added to the
    broken_dev_id list the systems are functional long term.
    
    0x1481 is the PCI ID for the IOMMU found on Starship/Matisse
    
    0x1419 is the PCI ID for the IOMMU found on 15h (Models 10h-1fh) family
    
    0x5a23 is the PCI ID for the IOMMU found on RD890S/RD990
    
    Signed-off-by: Brad Love <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    b-rad-NDi authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a6b4763 View commit details
    Browse the repository at this point in the history
  8. media: imx: capture: Return -EPIPE from __capture_legacy_try_fmt()

    [ Upstream commit cc271b6 ]
    
    The correct return code to report an invalid pipeline configuration is
    -EPIPE. Return it instead of -EINVAL from __capture_legacy_try_fmt()
    when the capture format doesn't match the media bus format of the
    connected subdev.
    
    Signed-off-by: Laurent Pinchart <[email protected]>
    Reviewed-by: Rui Miguel Silva <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    pinchartl authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    115a576 View commit details
    Browse the repository at this point in the history
  9. atomisp: don't let it go past pipes array

    [ Upstream commit 1f6c45a ]
    
    In practice, IA_CSS_PIPE_ID_NUM should never be used when
    calling atomisp_q_video_buffers_to_css(), as the driver should
    discover the right pipe before calling it.
    
    Yet, if some pipe parsing issue happens, it could end using
    it.
    
    So, add a WARN_ON() to prevent such case.
    
    Reported-by: Dan Carpenter <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    mchehab authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c8baf99 View commit details
    Browse the repository at this point in the history
  10. power: supply: bq27xxx: fix power_avg for newer ICs

    [ Upstream commit c4d57c2 ]
    
    On all newer bq27xxx ICs, the AveragePower register contains a signed
    value; in addition to handling the raw value as unsigned, the driver
    code also didn't convert it to µW as expected.
    
    At least for the BQ28Z610, the reference manual incorrectly states that
    the value is in units of 1mW and not 10mW. I have no way of knowing
    whether the manuals of other supported ICs contain the same error, or if
    there are models that actually use 1mW. At least, the new code shouldn't
    be *less* correct than the old version for any device.
    
    power_avg is removed from the cache structure, se we don't have to
    extend it to store both a signed value and an error code. Always getting
    an up-to-date value may be desirable anyways, as it avoids inconsistent
    current and power readings when switching between charging and
    discharging.
    
    Signed-off-by: Matthias Schiffer <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    tq-schifferm authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    348c35a View commit details
    Browse the repository at this point in the history
  11. extcon: arizona: Fix some issues when HPDET IRQ fires after the jack …

    …has been unplugged
    
    [ Upstream commit c309a3e ]
    
    When the jack is partially inserted and then removed again it may be
    removed while the hpdet code is running. In this case the following
    may happen:
    
    1. The "JACKDET rise" or ""JACKDET fall" IRQ triggers
    2. arizona_jackdet runs and takes info->lock
    3. The "HPDET" IRQ triggers
    4. arizona_hpdet_irq runs, blocks on info->lock
    5. arizona_jackdet calls arizona_stop_mic() and clears info->hpdet_done
    6. arizona_jackdet releases info->lock
    7. arizona_hpdet_irq now can continue running and:
    7.1 Calls arizona_start_mic() (if a mic was detected)
    7.2 sets info->hpdet_done
    
    Step 7 is undesirable / a bug:
    7.1 causes the device to stay in a high power-state (with MICVDD enabled)
    7.2 causes hpdet to not run on the next jack insertion, which in turn
        causes the EXTCON_JACK_HEADPHONE state to never get set
    
    This fixes both issues by skipping these 2 steps when arizona_hpdet_irq
    runs after the jack has been unplugged.
    
    Signed-off-by: Hans de Goede <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Acked-by: Charles Keepax <[email protected]>
    Tested-by: Charles Keepax <[email protected]>
    Acked-by: Chanwoo Choi <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jwrdegoede authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    381d0d2 View commit details
    Browse the repository at this point in the history
  12. extcon: arizona: Fix various races on driver unbind

    [ Upstream commit e5b499f ]
    
    We must free/disable all interrupts and cancel all pending works
    before doing further cleanup.
    
    Before this commit arizona_extcon_remove() was doing several
    register writes to shut things down before disabling the IRQs
    and it was cancelling only 1 of the 3 different works used.
    
    Move all the register-writes shutting things down to after
    the disabling of the IRQs and add the 2 missing
    cancel_delayed_work_sync() calls.
    
    This fixes various possible races on driver unbind. One of which
    would always trigger on devices using the mic-clamp feature for
    jack detection. The ARIZONA_MICD_CLAMP_MODE_MASK update was
    done before disabling the IRQs, causing:
    1. arizona_jackdet() to run
    2. detect a jack being inserted (clamp disabled means jack inserted)
    3. call arizona_start_mic() which:
    3.1 Enables the MICVDD regulator
    3.2 takes a pm_runtime_reference
    
    And this was all happening after the ARIZONA_MICD_ENA bit clearing,
    which would undo 3.1 and 3.2 because the ARIZONA_MICD_CLAMP_MODE_MASK
    update was being done after the ARIZONA_MICD_ENA bit clearing.
    
    So this means that arizona_extcon_remove() would exit with
    1. MICVDD enabled and 2. The pm_runtime_reference being unbalanced.
    
    MICVDD still being enabled caused the following oops when the
    regulator is released by the devm framework:
    
    [ 2850.745757] ------------[ cut here ]------------
    [ 2850.745827] WARNING: CPU: 2 PID: 2098 at drivers/regulator/core.c:2123 _regulator_put.part.0+0x19f/0x1b0
    [ 2850.745835] Modules linked in: extcon_arizona ...
    ...
    [ 2850.746909] Call Trace:
    [ 2850.746932]  regulator_put+0x2d/0x40
    [ 2850.746946]  release_nodes+0x22a/0x260
    [ 2850.746984]  __device_release_driver+0x190/0x240
    [ 2850.747002]  driver_detach+0xd4/0x120
    ...
    [ 2850.747337] ---[ end trace f455dfd7abd9781f ]---
    
    Note this oops is just one of various theoretically possible races caused
    by the wrong ordering inside arizona_extcon_remove(), this fixes the
    ordering fixing all possible races, including the reported oops.
    
    Signed-off-by: Hans de Goede <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Acked-by: Charles Keepax <[email protected]>
    Tested-by: Charles Keepax <[email protected]>
    Acked-by: Chanwoo Choi <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jwrdegoede authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0e5d8d3 View commit details
    Browse the repository at this point in the history
  13. media: venus: core, venc, vdec: Fix probe dependency error

    [ Upstream commit 08b1cf4 ]
    
    Commit aaaa93e ("media] media: venus: venc: add video encoder files")
    is the last in a series of three commits to add core.c vdec.c and venc.c
    adding core, encoder and decoder.
    
    The encoder and decoder check for core drvdata as set and return -EPROBE_DEFER
    if it has not been set, however both the encoder and decoder rely on
    core.v4l2_dev as valid.
    
    core.v4l2_dev will not be valid until v4l2_device_register() has completed
    in core.c's probe().
    
    Normally this is never seen however, Dmitry reported the following
    backtrace when compiling drivers and firmware directly into a kernel image.
    
    [    5.259968] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
    [    5.269850] sd 0:0:0:3: [sdd] Optimal transfer size 524288 bytes
    [    5.275505] Workqueue: events deferred_probe_work_func
    [    5.275513] pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=--)
    [    5.441211] usb 2-1: new SuperSpeedPlus Gen 2 USB device number 2 using xhci-hcd
    [    5.442486] pc : refcount_warn_saturate+0x140/0x148
    [    5.493756] hub 2-1:1.0: USB hub found
    [    5.496266] lr : refcount_warn_saturate+0x140/0x148
    [    5.500982] hub 2-1:1.0: 4 ports detected
    [    5.503440] sp : ffff80001067b730
    [    5.503442] x29: ffff80001067b730
    [    5.592660] usb 1-1: new high-speed USB device number 2 using xhci-hcd
    [    5.598478] x28: ffff6c6bc1c379b8
    [    5.598480] x27: ffffa5c673852960 x26: ffffa5c673852000
    [    5.598484] x25: ffff6c6bc1c37800 x24: 0000000000000001
    [    5.810652] x23: 0000000000000000 x22: ffffa5c673bc7118
    [    5.813777] hub 1-1:1.0: USB hub found
    [    5.816108] x21: ffffa5c674440000 x20: 0000000000000001
    [    5.820846] hub 1-1:1.0: 4 ports detected
    [    5.825415] x19: ffffa5c6744f4000 x18: ffffffffffffffff
    [    5.825418] x17: 0000000000000000 x16: 0000000000000000
    [    5.825421] x15: 00000a4810c193ba x14: 0000000000000000
    [    5.825424] x13: 00000000000002b8 x12: 000000000000f20a
    [    5.825427] x11: 000000000000f20a x10: 0000000000000038
    [    5.845447] usb 2-1.1: new SuperSpeed Gen 1 USB device number 3 using xhci-hcd
    [    5.845904]
    [    5.845905] x9 : 0000000000000000 x8 : ffff6c6d36fae780
    [    5.871208] x7 : ffff6c6d36faf240 x6 : 0000000000000000
    [    5.876664] x5 : 0000000000000004 x4 : 0000000000000085
    [    5.882121] x3 : 0000000000000119 x2 : ffffa5c6741ef478
    [    5.887578] x1 : 3acbb3926faf5f00 x0 : 0000000000000000
    [    5.893036] Call trace:
    [    5.895551]  refcount_warn_saturate+0x140/0x148
    [    5.900202]  __video_register_device+0x64c/0xd10
    [    5.904944]  venc_probe+0xc4/0x148
    [    5.908444]  platform_probe+0x68/0xe0
    [    5.912210]  really_probe+0x118/0x3e0
    [    5.915977]  driver_probe_device+0x5c/0xc0
    [    5.920187]  __device_attach_driver+0x98/0xb8
    [    5.924661]  bus_for_each_drv+0x68/0xd0
    [    5.928604]  __device_attach+0xec/0x148
    [    5.932547]  device_initial_probe+0x14/0x20
    [    5.936845]  bus_probe_device+0x9c/0xa8
    [    5.940788]  device_add+0x3e8/0x7c8
    [    5.944376]  of_device_add+0x4c/0x60
    [    5.948056]  of_platform_device_create_pdata+0xbc/0x140
    [    5.953425]  of_platform_bus_create+0x17c/0x3c0
    [    5.958078]  of_platform_populate+0x80/0x110
    [    5.962463]  venus_probe+0x2ec/0x4d8
    [    5.966143]  platform_probe+0x68/0xe0
    [    5.969907]  really_probe+0x118/0x3e0
    [    5.973674]  driver_probe_device+0x5c/0xc0
    [    5.977882]  __device_attach_driver+0x98/0xb8
    [    5.982356]  bus_for_each_drv+0x68/0xd0
    [    5.986298]  __device_attach+0xec/0x148
    [    5.990242]  device_initial_probe+0x14/0x20
    [    5.994539]  bus_probe_device+0x9c/0xa8
    [    5.998481]  deferred_probe_work_func+0x74/0xb0
    [    6.003132]  process_one_work+0x1e8/0x360
    [    6.007254]  worker_thread+0x208/0x478
    [    6.011106]  kthread+0x150/0x158
    [    6.014431]  ret_from_fork+0x10/0x30
    [    6.018111] ---[ end trace f074246b1ecdb466 ]---
    
    This patch fixes by
    
    - Only setting drvdata after v4l2_device_register() completes
    - Moving v4l2_device_register() so that suspend/reume in core::probe()
      stays as-is
    - Changes pm_ops->core_function() to take struct venus_core not struct
      device
    - Minimal rework of v4l2_device_*register in probe/remove
    
    Reported-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Stanimir Varbanov <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    0xB0D authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    54f1727 View commit details
    Browse the repository at this point in the history
  14. s390/qdio: let driver manage the QAOB

    [ Upstream commit 396c100 ]
    
    We are spending way too much effort on qdio-internal bookkeeping for
    QAOB management & caching, and it's still not robust. Once qdio's
    TX path has detached the QAOB from a PENDING buffer, we lost all
    track of it until it shows up in a CQ notification again. So if the
    device is torn down before that notification arrives, we leak the QAOB.
    
    Just have the driver take care of it, and simply pass down a QAOB if
    they want a TX with async-completion capability. For a buffer in PENDING
    state that requires the QAOB for final completion, qeth can now also try
    to recycle the buffer's QAOB rather than unconditionally freeing it.
    
    This also eliminates the qdio_outbuf_state array, which was only needed
    to transfer the aob->user1 tag from the driver to the qdio layer.
    
    Signed-off-by: Julian Wiedmann <[email protected]>
    Acked-by: Benjamin Block <[email protected]>
    Signed-off-by: Heiko Carstens <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    julianwiedmann authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2b17e0e View commit details
    Browse the repository at this point in the history
  15. media: media/saa7164: fix saa7164_encoder_register() memory leak bugs

    [ Upstream commit c759b29 ]
    
    Add a fix for the memory leak bugs that can occur when the
    saa7164_encoder_register() function fails.
    The function allocates memory without explicitly freeing
    it when errors occur.
    Add a better error handling that deallocate the unused buffers before the
    function exits during a fail.
    
    Signed-off-by: Daniel Niv <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    DanielNiv authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b13bc77 View commit details
    Browse the repository at this point in the history
  16. media: gspca/sq905.c: fix uninitialized variable

    [ Upstream commit eaaea46 ]
    
    act_len can be uninitialized if usb_bulk_msg() returns an error.
    Set it to 0 to avoid a KMSAN error.
    
    Signed-off-by: Hans Verkuil <[email protected]>
    Reported-by: [email protected]
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Hans Verkuil authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b8d7e79 View commit details
    Browse the repository at this point in the history
  17. media: v4l2-ctrls.c: initialize flags field of p_fwht_params

    [ Upstream commit ea1611b ]
    
    The V4L2_CID_STATELESS_FWHT_PARAMS compound control was missing a
    proper initialization of the flags field, so after loading the vicodec
    module for the first time, running v4l2-compliance for the stateless
    decoder would fail on this control because the initial control value
    was considered invalid by the vicodec driver.
    
    Initializing the flags field to sane values fixes this.
    
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Hans Verkuil authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    889cb8b View commit details
    Browse the repository at this point in the history
  18. power: supply: Use IRQF_ONESHOT

    [ Upstream commit 2469b83 ]
    
    Fixes coccicheck error:
    
    drivers/power/supply/pm2301_charger.c:1089:7-27: ERROR:
    drivers/power/supply/lp8788-charger.c:502:8-28: ERROR:
    drivers/power/supply/tps65217_charger.c:239:8-33: ERROR:
    drivers/power/supply/tps65090-charger.c:303:8-33: ERROR:
    
    Threaded IRQ with no primary handler requested without IRQF_ONESHOT
    
    Signed-off-by: dongjian <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    dongjian authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    599edbf View commit details
    Browse the repository at this point in the history
  19. backlight: qcom-wled: Use sink_addr for sync toggle

    [ Upstream commit cdfd4c6 ]
    
    WLED3_SINK_REG_SYNC is, as the name implies, a sink register offset.
    Therefore, use the sink address as base instead of the ctrl address.
    
    This fixes the sync toggle on wled4, which can be observed by the fact
    that adjusting brightness now works.
    
    It has no effect on wled3 because sink and ctrl base addresses are the
    same.  This allows adjusting the brightness without having to disable
    then reenable the module.
    
    Signed-off-by: Obeida Shamoun <[email protected]>
    Signed-off-by: Konrad Dybcio <[email protected]>
    Signed-off-by: Marijn Suijten <[email protected]>
    Reviewed-by: Daniel Thompson <[email protected]>
    Acked-by: Kiran Gunda <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    oshmoun authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    219db95 View commit details
    Browse the repository at this point in the history
  20. backlight: qcom-wled: Fix FSC update issue for WLED5

    [ Upstream commit 4d6e9cd ]
    
    Currently, for WLED5, the FSC (Full scale current) setting is not
    updated properly due to driver toggling the wrong register after
    an FSC update.
    
    On WLED5 we should only toggle the MOD_SYNC bit after a brightness
    update. For an FSC update we need to toggle the SYNC bits instead.
    
    Fix it by adopting the common wled3_sync_toggle() for WLED5 and
    introducing new code to the brightness update path to compensate.
    
    Signed-off-by: Kiran Gunda <[email protected]>
    Reviewed-by: Daniel Thompson <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    I-n-o-k authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d736c4f View commit details
    Browse the repository at this point in the history
  21. drm/amdgpu: enable retry fault wptr overflow

    [ Upstream commit b672cb1 ]
    
    If xnack is on, VM retry fault interrupt send to IH ring1, and ring1
    will be full quickly. IH cannot receive other interrupts, this causes
    deadlock if migrating buffer using sdma and waiting for sdma done while
    handling retry fault.
    
    Remove VMC from IH storm client, enable ring1 write pointer overflow,
    then IH will drop retry fault interrupts and be able to receive other
    interrupts while driver is handling retry fault.
    
    IH ring1 write pointer doesn't writeback to memory by IH, and ring1
    write pointer recorded by self-irq is not updated, so always read
    the latest ring1 write pointer from register.
    
    Signed-off-by: Philip Yang <[email protected]>
    Signed-off-by: Felix Kuehling <[email protected]>
    Reviewed-by: Felix Kuehling <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    PhilipYangA authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    39ba18a View commit details
    Browse the repository at this point in the history
  22. drm/amdgpu: enable 48-bit IH timestamp counter

    [ Upstream commit 9a9c59a ]
    
    By default this timestamp is 32 bit counter. It gets
    overflowed in around 10 minutes.
    
    Signed-off-by: Alex Sierra <[email protected]>
    Reviewed-by: Felix Kuehling <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    alexsierrag authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e58dd0a View commit details
    Browse the repository at this point in the history
  23. drm/amdgpu: mask the xgmi number of hops reported from psp to kfd

    [ Upstream commit 4ac5617 ]
    
    The psp supplies the link type in the upper 2 bits of the psp xgmi node
    information num_hops field.  With a new link type, Aldebaran has these
    bits set to a non-zero value (1 = xGMI3) so the KFD topology will report
    the incorrect IO link weights without proper masking.
    The actual number of hops is located in the 3 least significant bits of
    this field so mask if off accordingly before passing it to the KFD.
    
    Signed-off-by: Jonathan Kim <[email protected]>
    Reviewed-by: Amber Lin <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jokim-amd authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    41db62b View commit details
    Browse the repository at this point in the history
  24. drm/amdkfd: Fix UBSAN shift-out-of-bounds warning

    [ Upstream commit 50e2fc3 ]
    
    If get_num_sdma_queues or get_num_xgmi_sdma_queues is 0, we end up
    doing a shift operation where the number of bits shifted equals
    number of bits in the operand. This behaviour is undefined.
    
    Set num_sdma_queues or num_xgmi_sdma_queues to ULLONG_MAX, if the
    count is >= number of bits in the operand.
    
    Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1472
    
    Reported-by: Lyude Paul <[email protected]>
    Signed-off-by: Anson Jacob <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Reviewed-by: Felix Kuehling <[email protected]>
    Tested-by: Lyude Paul <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Anson Jacob authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    9069b1b View commit details
    Browse the repository at this point in the history
  25. drm/amd/display: Align cursor cache address to 2KB

    [ Upstream commit 554ba18 ]
    
    [Why]
    The registers for the address of the cursor are aligned to 2KB, so all
    cursor surfaces also need to be aligned to 2KB. Currently, the
    provided cursor cache surface is not aligned, so we need a workaround
    until alignment is enforced by the surface provider.
    
    [How]
     - round up surface address to nearest multiple of 2048
     - current policy is to provide a much bigger cache size than
       necessary,so this operation is safe
    
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Joshua Aberback <[email protected]>
    Reviewed-by: Jun Lei <[email protected]>
    Acked-by: Eryk Brol <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Joshua Aberback authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    7a12075 View commit details
    Browse the repository at this point in the history
  26. drm/amdgpu : Fix asic reset regression issue introduce by 8f211fe

    [ Upstream commit c894155 ]
    
    This recent change introduce SDMA interrupt info printing with irq->process function.
    These functions do not require a set function to enable/disable the irq
    
    Signed-off-by: shaoyunl <[email protected]>
    Reviewed-by: Hawking Zhang <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    shaoyunl authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    02cdf70 View commit details
    Browse the repository at this point in the history
  27. drm/amd/pm: fix workload mismatch on vega10

    [ Upstream commit 0979d43 ]
    
    Workload number mapped to the correct one.
    This issue is only on vega10.
    
    Signed-off-by: Kenneth Feng <[email protected]>
    Reviewed-by: Kevin Wang <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Kenneth Feng authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    f48cd93 View commit details
    Browse the repository at this point in the history
  28. drm/amd/display: Fix UBSAN warning for not a valid value for type '_B…

    …ool'
    
    [ Upstream commit 6a30a92 ]
    
    [Why]
    dc_cursor_position do not initialise position.translate_by_source when
    crtc or plane->state->fb is NULL. UBSAN caught this error in
    dce110_set_cursor_position, as the value was garbage.
    
    [How]
    Initialise dc_cursor_position structure elements to 0 in handle_cursor_update
    before calling get_cursor_position.
    
    Tested-by: Daniel Wheeler <[email protected]>
    Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1471
    Reported-by: Lyude Paul <[email protected]>
    Signed-off-by: Anson Jacob <[email protected]>
    Reviewed-by: Aurabindo Jayamohanan Pillai <[email protected]>
    Acked-by: Solomon Chiu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Anson Jacob authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0d2d957 View commit details
    Browse the repository at this point in the history
  29. drm/amd/display: DCHUB underflow counter increasing in some scenarios

    [ Upstream commit 4710430 ]
    
    [Why]
    When unplugging a display, the underflow counter can be seen to
    increase because PSTATE switch is allowed even when some planes are not
    blanked.
    
    [How]
    Check that all planes are not active instead of all streams before
    allowing PSTATE change.
    
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Aric Cyr <[email protected]>
    Acked-by: Solomon Chiu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    AMD-aric authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    4a3fc45 View commit details
    Browse the repository at this point in the history
  30. drm/amd/display: fix dml prefetch validation

    [ Upstream commit 8ee0fea ]
    
    Incorrect variable used, missing initialization during validation.
    
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Dmytro Laktyushkin <[email protected]>
    Reviewed-by: Eric Bernstein <[email protected]>
    Acked-by: Solomon Chiu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Dmytro Laktyushkin authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    563ac62 View commit details
    Browse the repository at this point in the history
  31. drm/amd/display: Fix potential memory leak

    [ Upstream commit 51ba691 ]
    
    [Why]
    vblank_workqueue is never released.
    
    [How]
    Free it upon dm finish.
    
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Qingqing Zhuo <[email protected]>
    Reviewed-by: Nicholas Kazlauskas <[email protected]>
    Acked-by: Solomon Chiu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Qingqing Zhuo authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b454762 View commit details
    Browse the repository at this point in the history
  32. scsi: qla2xxx: Always check the return value of qla24xx_get_isp_stats()

    [ Upstream commit a2b2cc6 ]
    
    This patch fixes the following Coverity warning:
    
        CID 361199 (esmil#1 of 1): Unchecked return value (CHECKED_RETURN)
        3. check_return: Calling qla24xx_get_isp_stats without checking return
        value (as is done elsewhere 4 out of 5 times).
    
    Link: https://lore.kernel.org/r/[email protected]
    Cc: Quinn Tran <[email protected]>
    Cc: Mike Christie <[email protected]>
    Cc: Himanshu Madhani <[email protected]>
    Cc: Daniel Wagner <[email protected]>
    Cc: Lee Duncan <[email protected]>
    Reviewed-by: Daniel Wagner <[email protected]>
    Reviewed-by: Himanshu Madhani <[email protected]>
    Signed-off-by: Bart Van Assche <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    bvanassche authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    bc1434f View commit details
    Browse the repository at this point in the history
  33. drm/vkms: fix misuse of WARN_ON

    [ Upstream commit b4142fc ]
    
    vkms_vblank_simulate() uses WARN_ON for timing-dependent condition
    (timer overrun). This is a mis-use of WARN_ON, WARN_ON must be used
    to denote kernel bugs. Use pr_warn() instead.
    
    Signed-off-by: Dmitry Vyukov <[email protected]>
    Reported-by: [email protected]
    Cc: Rodrigo Siqueira <[email protected]>
    Cc: Melissa Wen <[email protected]>
    Cc: Haneen Mohammed <[email protected]>
    Cc: Daniel Vetter <[email protected]>
    Cc: David Airlie <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Acked-by: Melissa Wen <[email protected]>
    Signed-off-by: Melissa Wen <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    dvyukov authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    15966e6 View commit details
    Browse the repository at this point in the history
  34. block, bfq: fix weight-raising resume with !low_latency

    [ Upstream commit 8c54477 ]
    
    When the io_latency heuristic is off, bfq_queues must not start to be
    weight-raised. Unfortunately, by mistake, this may happen when the
    state of a previously weight-raised bfq_queue is resumed after a queue
    split. This commit fixes this error.
    
    Tested-by: Jan Kara <[email protected]>
    Signed-off-by: Paolo Valente <[email protected]>
    Tested-by: Oleksandr Natalenko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Algodev-github authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    6d1689f View commit details
    Browse the repository at this point in the history
  35. scsi: qla2xxx: Fix use after free in bsg

    [ Upstream commit 2ce35c0 ]
    
    On bsg command completion, bsg_job_done() was called while qla driver
    continued to access the bsg_job buffer. bsg_job_done() would free up
    resources that ended up being reused by other task while the driver
    continued to access the buffers. As a result, driver was reading garbage
    data.
    
    localhost kernel: BUG: KASAN: use-after-free in sg_next+0x64/0x80
    localhost kernel: Read of size 8 at addr ffff8883228a3330 by task swapper/26/0
    localhost kernel:
    localhost kernel: CPU: 26 PID: 0 Comm: swapper/26 Kdump:
    loaded Tainted: G          OE    --------- -  - 4.18.0-193.el8.x86_64+debug esmil#1
    localhost kernel: Hardware name: HP ProLiant DL360
    Gen9/ProLiant DL360 Gen9, BIOS P89 08/12/2016
    localhost kernel: Call Trace:
    localhost kernel: <IRQ>
    localhost kernel: dump_stack+0x9a/0xf0
    localhost kernel: print_address_description.cold.3+0x9/0x23b
    localhost kernel: kasan_report.cold.4+0x65/0x95
    localhost kernel: debug_dma_unmap_sg.part.12+0x10d/0x2d0
    localhost kernel: qla2x00_bsg_sp_free+0xaf6/0x1010 [qla2xxx]
    
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Himanshu Madhani <[email protected]>
    Signed-off-by: Quinn Tran <[email protected]>
    Signed-off-by: Saurav Kashyap <[email protected]>
    Signed-off-by: Nilesh Javali <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Quinn Tran authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1bb697e View commit details
    Browse the repository at this point in the history
  36. mmc: sdhci-esdhc-imx: validate pinctrl before use it

    [ Upstream commit f410ee0 ]
    
    When imx_data->pinctrl is not a valid pointer, pinctrl_lookup_state
    will trigger kernel panic.
    
    When we boot Dual OS on Jailhouse hypervisor, we let the 1st Linux to
    configure pinmux ready for the 2nd OS, so the 2nd OS not have pinctrl
    settings.
    
    Similar to this commit b62eee9 ("mmc: sdhci-esdhc-imx: no fail when no pinctrl available").
    
    Reviewed-by: Bough Chen <[email protected]>
    Reviewed-by: Alice Guo <[email protected]>
    Signed-off-by: Peng Fan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    MrVan authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fc1077b View commit details
    Browse the repository at this point in the history
  37. mmc: sdhci-pci: Add PCI IDs for Intel LKF

    [ Upstream commit ee62911 ]
    
    Add PCI IDs for Intel LKF eMMC and SD card host controllers.
    
    Signed-off-by: Adrian Hunter <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    ahunter6 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e5ffc70 View commit details
    Browse the repository at this point in the history
  38. mmc: sdhci-brcmstb: Remove CQE quirk

    [ Upstream commit f0bdf98 ]
    
    Remove the CQHCI_QUIRK_SHORT_TXFR_DESC_SZ quirk because the
    latest chips have this fixed and earlier chips have other
    CQE problems that prevent the feature from being enabled.
    
    Signed-off-by: Al Cooper <[email protected]>
    Acked-by: Florian Fainelli <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    alcooper authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e67ddeb View commit details
    Browse the repository at this point in the history
  39. ata: ahci: Disable SXS for Hisilicon Kunpeng920

    [ Upstream commit 234e6d2 ]
    
    On Hisilicon Kunpeng920, ESP is set to 1 by default for all ports of
    SATA controller. In some scenarios, some ports are not external SATA ports,
    and it cause disks connected to these ports to be identified as removable
    disks. So disable the SXS capability on the software side to prevent users
    from mistakenly considering non-removable disks as removable disks and
    performing related operations.
    
    Signed-off-by: Xingui Yang <[email protected]>
    Signed-off-by: Luo Jiaxing <[email protected]>
    Reviewed-by: John Garry <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Xingui Yang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0ec9e97 View commit details
    Browse the repository at this point in the history
  40. drm/komeda: Fix bit check to import to value of proper type

    [ Upstream commit a1c3be8 ]
    
    Another issue found by KASAN. The bit finding is buried inside the
    dp_for_each_set_bit() macro (that passes on to for_each_set_bit() that
    calls the bit stuff. These bit functions want an unsigned long pointer
    as input and just dumbly casting leads to out-of-bounds accesses.
    This fixes that.
    
    Signed-off-by: Carsten Haitzler <[email protected]>
    Reviewed-by: Steven Price <[email protected]>
    Reviewed-by: James Qian Wang <[email protected]>
    Signed-off-by: Liviu Dudau <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    carstenhaitzler authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b70e92f View commit details
    Browse the repository at this point in the history
  41. nvmet: return proper error code from discovery ctrl

    [ Upstream commit 79695dc ]
    
    Return NVME_SC_INVALID_FIELD from discovery controller like normal
    controller when executing identify or get log page command.
    
    Signed-off-by: Hou Pu <[email protected]>
    Reviewed-by: Chaitanya Kulkarni <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    puhou authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    20eac50 View commit details
    Browse the repository at this point in the history
  42. selftests/resctrl: Enable gcc checks to detect buffer overflows

    [ Upstream commit a9d26a3 ]
    
    David reported a buffer overflow error in the check_results() function of
    the cmt unit test and he suggested enabling _FORTIFY_SOURCE gcc compiler
    option to automatically detect any such errors.
    
    Feature Test Macros man page describes_FORTIFY_SOURCE as below
    
    "Defining this macro causes some lightweight checks to be performed to
    detect some buffer overflow errors when employing various string and memory
    manipulation functions (for example, memcpy, memset, stpcpy, strcpy,
    strncpy, strcat, strncat, sprintf, snprintf, vsprintf, vsnprintf, gets, and
    wide character variants thereof). For some functions, argument consistency
    is checked; for example, a check is made that open has been supplied with a
    mode argument when the specified flags include O_CREAT. Not all problems
    are detected, just some common cases.
    
    If _FORTIFY_SOURCE is set to 1, with compiler optimization level 1 (gcc
    -O1) and above, checks that shouldn't change the behavior of conforming
    programs are performed.
    
    With _FORTIFY_SOURCE set to 2, some more checking is added, but some
    conforming programs might fail.
    
    Some of the checks can be performed at compile time (via macros logic
    implemented in header files), and result in compiler warnings; other checks
    take place at run time, and result in a run-time error if the check fails.
    
    Use of this macro requires compiler support, available with gcc since
    version 4.0."
    
    Fix the buffer overflow error in the check_results() function of the cmt
    unit test and enable _FORTIFY_SOURCE gcc check to catch any future buffer
    overflow errors.
    
    Reported-by: David Binderman <[email protected]>
    Suggested-by: David Binderman <[email protected]>
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fa74403 View commit details
    Browse the repository at this point in the history
  43. selftests/resctrl: Fix compilation issues for global variables

    [ Upstream commit 8236c51 ]
    
    Reinette reported following compilation issue on Fedora 32, gcc version
    10.1.1
    
    /usr/bin/ld: cqm_test.o:<src_dir>/cqm_test.c:22: multiple definition of
    `cache_size'; cat_test.o:<src_dir>/cat_test.c:23: first defined here
    
    The same issue is reported for long_mask, cbm_mask, count_of_bits etc
    variables as well. Compiler isn't happy because these variables are
    defined globally in two .c files namely cqm_test.c and cat_test.c and
    the compiler during compilation finds that the variable is already
    defined (multiple definition error).
    
    Taking a closer look at the usage of these variables reveals that these
    variables are used only locally in functions such as cqm_resctrl_val()
    (defined in cqm_test.c) and cat_perf_miss_val() (defined in cat_test.c).
    These variables are not shared between those functions. So, there is no
    need for these variables to be global. Hence, fix this issue by making
    them static variables.
    
    Reported-by: Reinette Chatre <[email protected]>
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1afd431 View commit details
    Browse the repository at this point in the history
  44. selftests/resctrl: Fix compilation issues for other global variables

    [ Upstream commit 896016d ]
    
    Reinette reported following compilation issue on Fedora 32, gcc version
    10.1.1
    
    /usr/bin/ld: resctrl_tests.o:<src_dir>/resctrl.h:65: multiple definition
    of `bm_pid'; cache.o:<src_dir>/resctrl.h:65: first defined here
    
    Other variables are ppid, tests_run, llc_occup_path, is_amd. Compiler
    isn't happy because these variables are defined globally in two .c files
    but are not declared as extern.
    
    To fix issues for the global variables, declare them as extern.
    
    Chang Log:
    - Split this patch from v4's patch 1 (Shuah).
    
    Reported-by: Reinette Chatre <[email protected]>
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    6055a8a View commit details
    Browse the repository at this point in the history
  45. selftests/resctrl: Clean up resctrl features check

    [ Upstream commit 2428673 ]
    
    Checking resctrl features call strcmp() to compare feature strings
    (e.g. "mba", "cat" etc). The checkings are error prone and don't have
    good coding style. Define the constant strings in macros and call
    strncmp() to solve the potential issues.
    
    Suggested-by: Shuah Khan <[email protected]>
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c3b5a2c View commit details
    Browse the repository at this point in the history
  46. selftests/resctrl: Fix missing options "-n" and "-p"

    [ Upstream commit d7af3d0 ]
    
    resctrl test suite accepts command line arguments (like -b, -t, -n and -p)
    as documented in the help. But passing -n and -p throws an invalid option
    error. This happens because -n and -p are missing in the list of
    characters that getopt() recognizes as valid arguments. Hence, they are
    treated as invalid options.
    
    Fix this by adding them to the list of characters that getopt() recognizes
    as valid arguments. Please note that the main() function already has the
    logic to deal with the values passed as part of these arguments and hence
    no changes are needed there.
    
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    aa177a5 View commit details
    Browse the repository at this point in the history
  47. selftests/resctrl: Use resctrl/info for feature detection

    [ Upstream commit ee04156 ]
    
    Resctrl test suite before running any unit test (like cmt, cat, mbm and
    mba) should first check if the feature is enabled (by kernel and not just
    supported by H/W) on the platform or not.
    validate_resctrl_feature_request() is supposed to do that. This function
    intends to grep for relevant flags in /proc/cpuinfo but there are several
    issues here
    
    1. validate_resctrl_feature_request() calls fgrep() to get flags from
       /proc/cpuinfo. But, fgrep() can only return a string with maximum of 255
       characters and hence the complete cpu flags are never returned.
    2. The substring search logic is also busted. If strstr() finds requested
       resctrl feature in the cpu flags, it returns pointer to the first
       occurrence. But, the logic negates the return value of strstr() and
       hence validate_resctrl_feature_request() returns false if the feature is
       present in the cpu flags and returns true if the feature is not present.
    3. validate_resctrl_feature_request() checks if a resctrl feature is
       reported in /proc/cpuinfo flags or not. Having a cpu flag means that the
       H/W supports the feature, but it doesn't mean that the kernel enabled
       it. A user could selectively enable only a subset of resctrl features
       using kernel command line arguments. Hence, /proc/cpuinfo isn't a
       reliable source to check if a feature is enabled or not.
    
    The 3rd issue being the major one and fixing it requires changing the way
    validate_resctrl_feature_request() works. Since, /proc/cpuinfo isn't the
    right place to check if a resctrl feature is enabled or not, a more
    appropriate place is /sys/fs/resctrl/info directory. Change
    validate_resctrl_feature_request() such that,
    
    1. For cat, check if /sys/fs/resctrl/info/L3 directory is present or not
    2. For mba, check if /sys/fs/resctrl/info/MB directory is present or not
    3. For cmt, check if /sys/fs/resctrl/info/L3_MON directory is present and
       check if /sys/fs/resctrl/info/L3_MON/mon_features has llc_occupancy
    4. For mbm, check if /sys/fs/resctrl/info/L3_MON directory is present and
       check if /sys/fs/resctrl/info/L3_MON/mon_features has
       mbm_<total/local>_bytes
    
    Please note that only L3_CAT, L3_CMT, MBA and MBM are supported. CDP and L2
    variants can be added later.
    
    Reported-by: Reinette Chatre <[email protected]>
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    477c435 View commit details
    Browse the repository at this point in the history
  48. selftests/resctrl: Fix incorrect parsing of iMC counters

    [ Upstream commit d81343b ]
    
    iMC (Integrated Memory Controller) counters are usually at
    "/sys/bus/event_source/devices/" and are named as "uncore_imc_<n>".
    num_of_imcs() function tries to count number of such iMC counters so that
    it could appropriately initialize required number of perf_attr structures
    that could be used to read these iMC counters.
    
    num_of_imcs() function assumes that all the directories under this path
    that start with "uncore_imc" are iMC counters. But, on some systems there
    could be directories named as "uncore_imc_free_running" which aren't iMC
    counters. Trying to read from such directories will result in "not found
    file" errors and MBM/MBA tests will fail.
    
    Hence, fix the logic in num_of_imcs() such that it looks at the first
    character after "uncore_imc_" to check if it's a numerical digit or not. If
    it's a digit then the directory represents an iMC counter, else, skip the
    directory.
    
    Reported-by: Reinette Chatre <[email protected]>
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    bf81fc2 View commit details
    Browse the repository at this point in the history
  49. selftests/resctrl: Fix checking for < 0 for unsigned values

    [ Upstream commit 1205b68 ]
    
    Dan reported following static checker warnings
    
    tools/testing/selftests/resctrl/resctrl_val.c:545 measure_vals()
    warn: 'bw_imc' unsigned <= 0
    
    tools/testing/selftests/resctrl/resctrl_val.c:549 measure_vals()
    warn: 'bw_resc_end' unsigned <= 0
    
    These warnings are reported because
    1. measure_vals() declares 'bw_imc' and 'bw_resc_end' as unsigned long
       variables
    2. Return value of get_mem_bw_imc() and get_mem_bw_resctrl() are assigned
       to 'bw_imc' and 'bw_resc_end' respectively
    3. The returned values are checked for <= 0 to see if the calls failed
    
    Checking for < 0 for an unsigned value doesn't make any sense.
    
    Fix this issue by changing the implementation of get_mem_bw_imc() and
    get_mem_bw_resctrl() such that they now accept reference to a variable
    and set the variable appropriately upon success and return 0, else return
    < 0 on error.
    
    Reported-by: Dan Carpenter <[email protected]>
    Tested-by: Babu Moger <[email protected]>
    Signed-off-by: Fenghua Yu <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fyu1 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    3a200c6 View commit details
    Browse the repository at this point in the history
  50. power: supply: cpcap-charger: fix small mistake in current to registe…

    …r conversion
    
    [ Upstream commit 8a5a0cc ]
    
    Signed-off-by: Carl Philipp Klemm <[email protected]>
    Acked-by: Tony Lindgren <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    IMbackK authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    7d8463c View commit details
    Browse the repository at this point in the history
  51. power: supply: cpcap-charger: Add usleep to cpcap charger to avoid us…

    …b plug bounce
    
    [ Upstream commit 751faed ]
    
    Adds 80000 us sleep when the usb cable is plugged in to hopefully avoid
    bouncing contacts.
    
    Upon pluging in the usb cable vbus will bounce for some time, causing cpcap to
    dissconnect charging due to detecting an undervoltage condition. This is a
    scope of vbus on xt894 while quickly inserting the usb cable with firm force,
    probed at the far side of the usb socket and vbus loaded with approx 1k:
    http://uvos.xyz/maserati/usbplug.jpg.
    
    As can clearly be seen, vbus is all over the place for the first 15 ms or so
    with a small blip at ~40 ms this causes the cpcap to trip up and disable
    charging again.
    
    The delay helps cpcap_usb_detect avoid the worst of this. It is, however, still
    not ideal as strong vibrations can cause the issue to reapear any time during
    charging. I have however not been able to cause the device to stop charging due
    to this in practice as it is hard to vibrate the device such that the vbus pins
    start bouncing again but cpcap_usb_detect is not called again due to a detected
    disconnect/reconnect event.
    
    Signed-off-by: Carl Philipp Klemm <[email protected]>
    Tested-by: Tony Lindgren <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    IMbackK authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b494d1b View commit details
    Browse the repository at this point in the history
  52. scsi: smartpqi: Use host-wide tag space

    [ Upstream commit c6d3ee2 ]
    
    Correct SCSI midlayer sending more requests than exposed host queue depth
    causing firmware ASSERT and lockup issues by enabling host-wide tags.
    
    Note: This also results in better performance.
    
    Link: https://lore.kernel.org/r/161549369787.25025.8975999483518581619.stgit@brunhilda
    Suggested-by: Ming Lei <[email protected]>
    Suggested-by: John Garry <[email protected]>
    Reviewed-by: Scott Benesh <[email protected]>
    Reviewed-by: Scott Teel <[email protected]>
    Reviewed-by: Mike McGowen <[email protected]>
    Reviewed-by: Kevin Barnett <[email protected]>
    Signed-off-by: Don Brace <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Don Brace authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d218413 View commit details
    Browse the repository at this point in the history
  53. scsi: smartpqi: Correct request leakage during reset operations

    [ Upstream commit b622a60 ]
    
    While failing queued I/Os in TMF path, there was a request leak and hence
    stale entries in request pool with ref count being non-zero. In shutdown
    path we have a BUG_ON to catch stuck I/O either in firmware or in the
    driver. The stale requests caused a system crash. The I/O request pool
    leakage also lead to a significant performance drop.
    
    Link: https://lore.kernel.org/r/161549370379.25025.12793264112620796062.stgit@brunhilda
    Reviewed-by: Scott Teel <[email protected]>
    Reviewed-by: Scott Benesh <[email protected]>
    Reviewed-by: Kevin Barnett <[email protected]>
    Signed-off-by: Murthy Bhat <[email protected]>
    Signed-off-by: Don Brace <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Murthy Bhat authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    30a5371 View commit details
    Browse the repository at this point in the history
  54. scsi: smartpqi: Add new PCI IDs

    [ Upstream commit 75fbeac ]
    
    Add support for newer hardware.
    
    Link: https://lore.kernel.org/r/161549386882.25025.2594251735886014958.stgit@brunhilda
    Reviewed-by: Scott Benesh <[email protected]>
    Reviewed-by: Scott Teel <[email protected]>
    Acked-by: Martin Wilck <[email protected]>
    Signed-off-by: Kevin Barnett <[email protected]>
    Signed-off-by: Don Brace <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Kevin Barnett authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    ae8c6ad View commit details
    Browse the repository at this point in the history
  55. scsi: scsi_dh_alua: Remove check for ASC 24h in alua_rtpg()

    [ Upstream commit bc3f2b4 ]
    
    Some arrays return ILLEGAL_REQUEST with ASC 00h if they don't support the
    RTPG extended header so remove the check for INVALID FIELD IN CDB.
    
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Hannes Reinecke <[email protected]>
    Signed-off-by: Ewan D. Milne <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Ewan D. Milne authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    82fa26b View commit details
    Browse the repository at this point in the history
  56. media: em28xx: fix memory leak

    [ Upstream commit 0ae10a7 ]
    
    If some error occurs, URB buffers should also be freed. If they aren't
    freed with the dvb here, the em28xx_dvb_fini call doesn't frees the URB
    buffers as dvb is set to NULL. The function in which error occurs should
    do all the cleanup for the allocations it had done.
    
    Tested the patch with the reproducer provided by syzbot. This patch
    fixes the memleak.
    
    Reported-by: [email protected]
    Signed-off-by: Muhammad Usama Anjum <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    musamaanjum authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    56fd1aa View commit details
    Browse the repository at this point in the history
  57. media: vivid: update EDID

    [ Upstream commit 443ec4b ]
    
    The EDID had a few mistakes as reported by edid-decode:
    
    Block 1, CTA-861 Extension Block:
      Video Data Block: For improved preferred timing interoperability, set 'Native detailed modes' to 1.
      Video Capability Data Block: S_PT is equal to S_IT and S_CE, so should be set to 0 instead.
    
    Fixed those.
    
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Hans Verkuil authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    dd06898 View commit details
    Browse the repository at this point in the history
  58. media: uvcvideo: Fix XU id print in forward scan

    [ Upstream commit 3293448 ]
    
    An error message in the forward scan code incorrectly prints the ID of
    the source entity instead of the XU entity being scanned. Fix it.
    
    Signed-off-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    pinchartl authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    7de578c View commit details
    Browse the repository at this point in the history
  59. media: uvcvideo: Support devices that report an OT as an entity source

    [ Upstream commit 4ca052b ]
    
    Some devices reference an output terminal as the source of extension
    units. This is incorrect, as output terminals only have an input pin,
    and thus can't be connected to any entity in the forward direction. The
    resulting topology would cause issues when registering the media
    controller graph. To avoid this problem, connect the extension unit to
    the source of the output terminal instead.
    
    While at it, and while no device has been reported to be affected by
    this issue, also handle forward scans where two output terminals would
    be connected together, and skip the terminals found through such an
    invalid connection.
    
    Reported-and-tested-by: John Nealy <[email protected]>
    
    Signed-off-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    pinchartl authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    4af1652 View commit details
    Browse the repository at this point in the history
  60. drm/msm/a6xx: Fix perfcounter oob timeout

    [ Upstream commit 2fc8a92 ]
    
    We were not programing the correct bit while clearing the perfcounter oob.
    So, clear it correctly using the new 'clear' bit. This fixes the below
    error:
    
    [drm:a6xx_gmu_set_oob] *ERROR* Timeout waiting for GMU OOB set PERFCOUNTER: 0x80000000
    
    Signed-off-by: Akhil P Oommen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Clark <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Akhil P Oommen authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    6281cd9 View commit details
    Browse the repository at this point in the history
  61. drm/msm/dp: Fix incorrect NULL check kbot warnings in DP driver

    [ Upstream commit 7d649cf ]
    
    Fix an incorrect NULL check reported by kbot in the MSM DP driver
    
    smatch warnings:
    drivers/gpu/drm/msm/dp/dp_hpd.c:37 dp_hpd_connect()
    error: we previously assumed 'hpd_priv->dp_cb' could be null
    (see line 37)
    
    Reported-by: kernel test robot <[email protected]>
    Reported-by: Dan Carpenter <[email protected]>
    Signed-off-by: Abhinav Kumar <[email protected]>
    Reviewed-by: Stephen Boyd <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Clark <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Abhinav Kumar authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1cf96e5 View commit details
    Browse the repository at this point in the history
  62. clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return

    [ Upstream commit 657d4d1 ]
    
    There is an error return path that is not kfree'ing socfpga_clk leading
    to a memory leak. Fix this by adding in the missing kfree call.
    
    Addresses-Coverity: ("Resource leak")
    Signed-off-by: Colin Ian King <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Acked-by: Dinh Nguyen <[email protected]>
    Reviewed-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Stephen Boyd <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Colin Ian King authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    ce1e481 View commit details
    Browse the repository at this point in the history
  63. power: supply: generic-adc-battery: fix possible use-after-free in ga…

    …b_remove()
    
    [ Upstream commit b6cfa00 ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Yang Yingliang <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Yang Yingliang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    15efbbe View commit details
    Browse the repository at this point in the history
  64. power: supply: s3c_adc_battery: fix possible use-after-free in s3c_ad…

    …c_bat_remove()
    
    [ Upstream commit 68ae256 ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Yang Yingliang <[email protected]>
    Reviewed-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Yang Yingliang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    3a8aa84 View commit details
    Browse the repository at this point in the history
  65. media: tc358743: fix possible use-after-free in tc358743_remove()

    [ Upstream commit 6107a4f ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Yang Yingliang <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Yang Yingliang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1fcbb14 View commit details
    Browse the repository at this point in the history
  66. media: adv7604: fix possible use-after-free in adv76xx_remove()

    [ Upstream commit fa56f5f ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Yang Yingliang <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Yang Yingliang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2a52254 View commit details
    Browse the repository at this point in the history
  67. media: i2c: adv7511-v4l2: fix possible use-after-free in adv7511_remo…

    …ve()
    
    [ Upstream commit 2c95417 ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Yang Yingliang <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Yang Yingliang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    8d57011 View commit details
    Browse the repository at this point in the history
  68. media: i2c: tda1997: Fix possible use-after-free in tda1997x_remove()

    [ Upstream commit 7f820ab ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Yang Yingliang <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Yang Yingliang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    98e887f View commit details
    Browse the repository at this point in the history
  69. media: i2c: adv7842: fix possible use-after-free in adv7842_remove()

    [ Upstream commit 4a15275 ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Yang Yingliang <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Yang Yingliang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    21b50a6 View commit details
    Browse the repository at this point in the history
  70. media: platform: sti: Fix runtime PM imbalance in regs_show

    [ Upstream commit 69306a9 ]
    
    pm_runtime_get_sync() will increase the runtime PM counter
    even it returns an error. Thus a pairing decrement is needed
    to prevent refcount leak. Fix this by replacing this API with
    pm_runtime_resume_and_get(), which will not change the runtime
    PM counter on error.
    
    Signed-off-by: Dinghao Liu <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    dinghaoliu authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c9c8b61 View commit details
    Browse the repository at this point in the history
  71. media: sun8i-di: Fix runtime PM imbalance in deinterlace_start_streaming

    [ Upstream commit f1995d5 ]
    
    pm_runtime_get_sync() will increase the runtime PM counter
    even it returns an error. Thus a pairing decrement is needed
    to prevent refcount leak. Fix this by replacing this API with
    pm_runtime_resume_and_get(), which will not change the runtime
    PM counter on error.
    
    Signed-off-by: Dinghao Liu <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    dinghaoliu authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    bdc41f7 View commit details
    Browse the repository at this point in the history
  72. media: dvb-usb: fix memory leak in dvb_usb_adapter_init

    [ Upstream commit b7cd0da ]
    
    syzbot reported memory leak in dvb-usb. The problem was
    in invalid error handling in dvb_usb_adapter_init().
    
    for (n = 0; n < d->props.num_adapters; n++) {
    ....
    	if ((ret = dvb_usb_adapter_stream_init(adap)) ||
    		(ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) ||
    		(ret = dvb_usb_adapter_frontend_init(adap))) {
    		return ret;
    	}
    ...
    	d->num_adapters_initialized++;
    ...
    }
    
    In case of error in dvb_usb_adapter_dvb_init() or
    dvb_usb_adapter_dvb_init() d->num_adapters_initialized won't be
    incremented, but dvb_usb_adapter_exit() relies on it:
    
    	for (n = 0; n < d->num_adapters_initialized; n++)
    
    So, allocated objects won't be freed.
    
    Signed-off-by: Pavel Skripkin <[email protected]>
    Reported-by: [email protected]
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    pskrgag authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d72fa22 View commit details
    Browse the repository at this point in the history
  73. media: gscpa/stv06xx: fix memory leak

    [ Upstream commit 4f4e664 ]
    
    For two of the supported sensors the stv06xx driver allocates memory which
    is stored in sd->sensor_priv. This memory is freed on a disconnect, but if
    the probe() fails, then it isn't freed and so this leaks memory.
    
    Add a new probe_error() op that drivers can use to free any allocated
    memory in case there was a probe failure.
    
    Thanks to Pavel Skripkin <[email protected]> for discovering the cause
    of the memory leak.
    
    Reported-and-tested-by: [email protected]
    
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Hans Verkuil authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    36a2d6d View commit details
    Browse the repository at this point in the history
  74. sched/fair: Bring back select_idle_smt(), but differently

    [ Upstream commit c722f35 ]
    
    Mel Gorman did some nice work in 9fe1f12 ("sched/fair: Merge
    select_idle_core/cpu()"), resulting in the kernel being more efficient
    at finding an idle CPU, and in tasks spending less time waiting to be
    run, both according to the schedstats run_delay numbers, and according
    to measured application latencies. Yay.
    
    The flip side of this is that we see more task migrations (about 30%
    more), higher cache misses, higher memory bandwidth utilization, and
    higher CPU use, for the same number of requests/second.
    
    This is most pronounced on a memcache type workload, which saw a
    consistent 1-3% increase in total CPU use on the system, due to those
    increased task migrations leading to higher L2 cache miss numbers, and
    higher memory utilization. The exclusive L3 cache on Skylake does us
    no favors there.
    
    On our web serving workload, that effect is usually negligible.
    
    It appears that the increased number of CPU migrations is generally a
    good thing, since it leads to lower cpu_delay numbers, reflecting the
    fact that tasks get to run faster. However, the reduced locality and
    the corresponding increase in L2 cache misses hurts a little.
    
    The patch below appears to fix the regression, while keeping the
    benefit of the lower cpu_delay numbers, by reintroducing
    select_idle_smt with a twist: when a socket has no idle cores, check
    to see if the sibling of "prev" is idle, before searching all the
    other CPUs.
    
    This fixes both the occasional 9% regression on the web serving
    workload, and the continuous 2% CPU use regression on the memcache
    type workload.
    
    With Mel's patches and this patch together, task migrations are still
    high, but L2 cache misses, memory bandwidth, and CPU time used are
    back down to what they were before. The p95 and p99 response times for
    the memcache type application improve by about 10% over what they were
    before Mel's patches got merged.
    
    Signed-off-by: Rik van Riel <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Reviewed-by: Mel Gorman <[email protected]>
    Acked-by: Vincent Guittot <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    rikvanriel authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    91ef133 View commit details
    Browse the repository at this point in the history
  75. sched/fair: Ignore percpu threads for imbalance pulls

    [ Upstream commit 9bcb959 ]
    
    During load balance, LBF_SOME_PINNED will be set if any candidate task
    cannot be detached due to CPU affinity constraints. This can result in
    setting env->sd->parent->sgc->group_imbalance, which can lead to a group
    being classified as group_imbalanced (rather than any of the other, lower
    group_type) when balancing at a higher level.
    
    In workloads involving a single task per CPU, LBF_SOME_PINNED can often be
    set due to per-CPU kthreads being the only other runnable tasks on any
    given rq. This results in changing the group classification during
    load-balance at higher levels when in reality there is nothing that can be
    done for this affinity constraint: per-CPU kthreads, as the name implies,
    don't get to move around (modulo hotplug shenanigans).
    
    It's not as clear for userspace tasks - a task could be in an N-CPU cpuset
    with N-1 offline CPUs, making it an "accidental" per-CPU task rather than
    an intended one. KTHREAD_IS_PER_CPU gives us an indisputable signal which
    we can leverage here to not set LBF_SOME_PINNED.
    
    Note that the aforementioned classification to group_imbalance (when
    nothing can be done) is especially problematic on big.LITTLE systems, which
    have a topology the likes of:
    
      DIE [          ]
      MC  [    ][    ]
           0  1  2  3
           L  L  B  B
    
      arch_scale_cpu_capacity(L) < arch_scale_cpu_capacity(B)
    
    Here, setting LBF_SOME_PINNED due to a per-CPU kthread when balancing at MC
    level on CPUs [0-1] will subsequently prevent CPUs [2-3] from classifying
    the [0-1] group as group_misfit_task when balancing at DIE level. Thus, if
    CPUs [0-1] are running CPU-bound (misfit) tasks, ill-timed per-CPU kthreads
    can significantly delay the upgmigration of said misfit tasks. Systems
    relying on ASYM_PACKING are likely to face similar issues.
    
    Signed-off-by: Lingutla Chandrasekhar <[email protected]>
    [Use kthread_is_per_cpu() rather than p->nr_cpus_allowed]
    [Reword changelog]
    Signed-off-by: Valentin Schneider <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Reviewed-by: Dietmar Eggemann <[email protected]>
    Reviewed-by: Vincent Guittot <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Lingutla Chandrasekhar authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    ce0da00 View commit details
    Browse the repository at this point in the history
  76. drm/msm/mdp5: Configure PP_SYNC_HEIGHT to double the vtotal

    [ Upstream commit 2ad52bd ]
    
    Leaving this at a close-to-maximum register value 0xFFF0 means it takes
    very long for the MDSS to generate a software vsync interrupt when the
    hardware TE interrupt doesn't arrive.  Configuring this to double the
    vtotal (like some downstream kernels) leads to a frame to take at most
    twice before the vsync signal, until hardware TE comes up.
    
    In this case the hardware interrupt responsible for providing this
    signal - "disp-te" gpio - is not hooked up to the mdp5 vsync/pp logic at
    all.  This solves severe panel update issues observed on at least the
    Xperia Loire and Tone series, until said gpio is properly hooked up to
    an irq.
    
    Suggested-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Marijn Suijten <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Clark <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    MarijnS95 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    9d105ee View commit details
    Browse the repository at this point in the history
  77. drm/msm/mdp5: Do not multiply vclk line count by 100

    [ Upstream commit 377569f ]
    
    Neither vtotal nor drm_mode_vrefresh contain a value that is
    premultiplied by 100 making the x100 variable name incorrect and
    resulting in vclks_line to become 100 times larger than it is supposed
    to be.  The hardware counts 100 clockticks too many before tearcheck,
    leading to severe panel issues on at least the Sony Xperia lineup.
    
    This is likely an artifact from the original MDSS DSI panel driver where
    the calculation [1] corrected for a premultiplied reference framerate by
    100 [2].  It does not appear that the above values were ever
    premultiplied in the history of the DRM MDP5 driver.
    
    With this change applied the value written to the SYNC_CONFIG_VSYNC
    register is now identical to downstream kernels.
    
    [1]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c?h=LA.UM.8.6.c26-02400-89xx.0#n288
    [2]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_dsi_panel.c?h=LA.UM.8.6.c26-02400-89xx.0#n1648
    
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Marijn Suijten <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Rob Clark <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    MarijnS95 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    318e8c3 View commit details
    Browse the repository at this point in the history
  78. drm/amdgpu/ttm: Fix memory leak userptr pages

    [ Upstream commit 0f6f9dd ]
    
    If userptr pages have been pinned but not bounded,
    they remain uncleared.
    
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Daniel Gomez <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Daniel Gomez authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d272c70 View commit details
    Browse the repository at this point in the history
  79. drm/radeon/ttm: Fix memory leak userptr pages

    [ Upstream commit 5aeaa43 ]
    
    If userptr pages have been pinned but not bounded,
    they remain uncleared.
    
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Daniel Gomez <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Daniel Gomez authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fc3393e View commit details
    Browse the repository at this point in the history
  80. drm/amd/display: Fix debugfs link_settings entry

    [ Upstream commit c006a1c ]
    
    1. Catch invalid link_rate and link_count settings
    2. Call dc interface to overwrite preferred link settings, and wait
    until next stream update to apply the new settings.
    
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Fangzhi Zuo <[email protected]>
    Reviewed-by: Nicholas Kazlauskas <[email protected]>
    Acked-by: Solomon Chiu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Fangzhi Zuo authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c86e38a View commit details
    Browse the repository at this point in the history
  81. drm/amd/display: Fix UBSAN: shift-out-of-bounds warning

    [ Upstream commit 5471874 ]
    
    [Why]
    On NAVI14 CONFIG_UBSAN reported shift-out-of-bounds at
    display_rq_dlg_calc_20v2.c:304:38
    
    rq_param->misc.rq_c.blk256_height is 0 when chroma(*_c) is invalid.
    dml_log2 returns -1023 for log2(0), although log2(0) is undefined.
    
    Which ended up as:
    rq_param->dlg.rq_c.swath_height = 1 << -1023
    
    [How]
    Fix applied on all dml versions.
    1. Ensure dml_log2 is only called if the argument is greater than 0.
    2. Subtract req128_l/req128_c from log2_swath_height_l/log2_swath_height_c
       only when it is greater than 0.
    
    Tested-by: Daniel Wheeler <[email protected]>
    Signed-off-by: Anson Jacob <[email protected]>
    Reviewed-by: Dmytro Laktyushkin <[email protected]>
    Reviewed-by: Jun Lei <[email protected]>
    Acked-by: Solomon Chiu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Anson Jacob authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    15433cb View commit details
    Browse the repository at this point in the history
  82. drm/radeon: don't evict if not initialized

    [ Upstream commit 05eacc0 ]
    
    TTM_PL_VRAM may not initialized at all when calling
    radeon_bo_evict_vram(). We need to check before doing eviction.
    
    [    2.160837] BUG: kernel NULL pointer dereference, address: 0000000000000020
    [    2.161212] #PF: supervisor read access in kernel mode
    [    2.161490] #PF: error_code(0x0000) - not-present page
    [    2.161767] PGD 0 P4D 0
    [    2.163088] RIP: 0010:ttm_resource_manager_evict_all+0x70/0x1c0 [ttm]
    [    2.168506] Call Trace:
    [    2.168641]  radeon_bo_evict_vram+0x1c/0x20 [radeon]
    [    2.168936]  radeon_device_fini+0x28/0xf9 [radeon]
    [    2.169224]  radeon_driver_unload_kms+0x44/0xa0 [radeon]
    [    2.169534]  radeon_driver_load_kms+0x174/0x210 [radeon]
    [    2.169843]  drm_dev_register+0xd9/0x1c0 [drm]
    [    2.170104]  radeon_pci_probe+0x117/0x1a0 [radeon]
    
    Reviewed-by: Christian König <[email protected]>
    Suggested-by: Christian König <[email protected]>
    Signed-off-by: Tong Zhang <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    lzto authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    819dc7e View commit details
    Browse the repository at this point in the history
  83. drm/amdkfd: Fix cat debugfs hang_hws file causes system crash bug

    [ Upstream commit d736102 ]
    
    Here is the system crash log:
    [ 1272.884438] BUG: unable to handle kernel NULL pointer dereference at
    (null)
    [ 1272.884444] IP: [<          (null)>]           (null)
    [ 1272.884447] PGD 825b09067 PUD 8267c8067 PMD 0
    [ 1272.884452] Oops: 0010 [esmil#1] SMP
    [ 1272.884509] CPU: 13 PID: 3485 Comm: cat Kdump: loaded Tainted: G
    [ 1272.884515] task: ffff9a38dbd4d140 ti: ffff9a37cd3b8000 task.ti:
    ffff9a37cd3b8000
    [ 1272.884517] RIP: 0010:[<0000000000000000>]  [<          (null)>]
    (null)
    [ 1272.884520] RSP: 0018:ffff9a37cd3bbe68  EFLAGS: 00010203
    [ 1272.884522] RAX: 0000000000000000 RBX: 0000000000000000 RCX:
    0000000000014d5f
    [ 1272.884524] RDX: fffffffffffffff4 RSI: 0000000000000001 RDI:
    ffff9a38aca4d200
    [ 1272.884526] RBP: ffff9a37cd3bbed0 R08: ffff9a38dcd5f1a0 R09:
    ffff9a31ffc07300
    [ 1272.884527] R10: ffff9a31ffc07300 R11: ffffffffaddd5e9d R12:
    ffff9a38b4e0fb00
    [ 1272.884529] R13: 0000000000000001 R14: ffff9a37cd3bbf18 R15:
    ffff9a38aca4d200
    [ 1272.884532] FS:  00007feccaa67740(0000) GS:ffff9a38dcd40000(0000)
    knlGS:0000000000000000
    [ 1272.884534] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 1272.884536] CR2: 0000000000000000 CR3: 00000008267c0000 CR4:
    00000000003407e0
    [ 1272.884537] Call Trace:
    [ 1272.884544]  [<ffffffffade68940>] ? seq_read+0x130/0x440
    [ 1272.884548]  [<ffffffffade40f8f>] vfs_read+0x9f/0x170
    [ 1272.884552]  [<ffffffffade41e4f>] SyS_read+0x7f/0xf0
    [ 1272.884557]  [<ffffffffae374ddb>] system_call_fastpath+0x22/0x27
    [ 1272.884558] Code:  Bad RIP value.
    [ 1272.884562] RIP  [<          (null)>]           (null)
    [ 1272.884564]  RSP <ffff9a37cd3bbe68>
    [ 1272.884566] CR2: 0000000000000000
    
    Signed-off-by: Qu Huang <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jinsdb authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d99753e View commit details
    Browse the repository at this point in the history
  84. amdgpu: avoid incorrect %hu format string

    [ Upstream commit 7d98d41 ]
    
    clang points out that the %hu format string does not match the type
    of the variables here:
    
    drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:263:7: warning: format specifies type 'unsigned short' but the argument has type 'unsigned int' [-Wformat]
                                      version_major, version_minor);
                                      ^~~~~~~~~~~~~
    include/drm/drm_print.h:498:19: note: expanded from macro 'DRM_ERROR'
            __drm_err(fmt, ##__VA_ARGS__)
                      ~~~    ^~~~~~~~~~~
    
    Change it to a regular %u, the same way a previous patch did for
    another instance of the same warning.
    
    Reviewed-by: Christian König <[email protected]>
    Reviewed-by: Tom Rix <[email protected]>
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    arndb authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fc56fb4 View commit details
    Browse the repository at this point in the history
  85. drm/amdgpu/display: fix memory leak for dimgrey cavefish

    [ Upstream commit 42b5997 ]
    
    We need to clean up the dcn3 clk_mgr.
    
    Acked-by: Nirmoy Das <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    alexdeucher authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    89d6e69 View commit details
    Browse the repository at this point in the history
  86. drm/amd/display: Try YCbCr420 color when YCbCr444 fails

    [ Upstream commit 68eb3ae ]
    
    When encoder validation of a display mode fails, retry with less bandwidth
    heavy YCbCr420 color mode, if available. This enables some HDMI 1.4 setups
    to support 4k60Hz output, which previously failed silently.
    
    On some setups, while the monitor and the gpu support display modes with
    pixel clocks of up to 600MHz, the link encoder might not. This prevents
    YCbCr444 and RGB encoding for 4k60Hz, but YCbCr420 encoding might still be
    possible. However, which color mode is used is decided before the link
    encoder capabilities are checked. This patch fixes the problem by retrying
    to find a display mode with YCbCr420 enforced and using it, if it is
    valid.
    
    Reviewed-by: Harry Wentland <[email protected]>
    Signed-off-by: Werner Sembach <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    tuxedo-wse authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b47f594 View commit details
    Browse the repository at this point in the history
  87. drm/amdgpu: fix NULL pointer dereference

    [ Upstream commit 3c3dc65 ]
    
    ttm->sg needs to be checked before accessing its child member.
    
    Call Trace:
     amdgpu_ttm_backend_destroy+0x12/0x70 [amdgpu]
     ttm_bo_cleanup_memtype_use+0x3a/0x60 [ttm]
     ttm_bo_release+0x17d/0x300 [ttm]
     amdgpu_bo_unref+0x1a/0x30 [amdgpu]
     amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu+0x78b/0x8b0 [amdgpu]
     kfd_ioctl_alloc_memory_of_gpu+0x118/0x220 [amdgpu]
     kfd_ioctl+0x222/0x400 [amdgpu]
     ? kfd_dev_is_large_bar+0x90/0x90 [amdgpu]
     __x64_sys_ioctl+0x8e/0xd0
     ? __context_tracking_exit+0x52/0x90
     do_syscall_64+0x33/0x80
     entry_SYSCALL_64_after_hwframe+0x44/0xa9
    RIP: 0033:0x7f97f264d317
    Code: b3 66 90 48 8b 05 71 4b 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 41 4b 2d 00 f7 d8 64 89 01 48
    RSP: 002b:00007ffdb402c338 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 00007f97f3cc63a0 RCX: 00007f97f264d317
    RDX: 00007ffdb402c380 RSI: 00000000c0284b16 RDI: 0000000000000003
    RBP: 00007ffdb402c380 R08: 00007ffdb402c428 R09: 00000000c4000004
    R10: 00000000c4000004 R11: 0000000000000246 R12: 00000000c0284b16
    R13: 0000000000000003 R14: 00007f97f3cc63a0 R15: 00007f8836200000
    
    Signed-off-by: Guchun Chen <[email protected]>
    Acked-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Guchun Chen authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    7ebfbe2 View commit details
    Browse the repository at this point in the history
  88. drm/amd/display: Update DCN302 SR Exit Latency

    [ Upstream commit 79f0253 ]
    
    [Why&How]
    Update SR Exit Latency to fix screen flickering caused due to OTG
    underflow. This is the recommended value given by the hardware IP team.
    
    Signed-off-by: Joshua Aberback <[email protected]>
    Acked-by: Aurabindo Pillai <[email protected]>
    Reviewed-by: Harry Wentland <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Joshua Aberback authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1fa8aea View commit details
    Browse the repository at this point in the history
  89. scsi: mpt3sas: Fix out-of-bounds warnings in _ctl_addnl_diag_query

    [ Upstream commit 16660db ]
    
    Fix the following out-of-bounds warnings by embedding existing struct
    htb_rel_query into struct mpt3_addnl_diag_query, instead of duplicating its
    members:
    
    include/linux/fortify-string.h:20:29: warning: '__builtin_memcpy' offset [19, 32] from the object at 'karg' is out of the bounds of referenced subobject 'buffer_rel_condition' with type 'short unsigned int' at offset 16 [-Warray-bounds]
    include/linux/fortify-string.h:22:29: warning: '__builtin_memset' offset [19, 32] from the object at 'karg' is out of the bounds of referenced subobject 'buffer_rel_condition' with type 'short unsigned int' at offset 16 [-Warray-bounds]
    
    The problem is that the original code is trying to copy data into a bunch
    of struct members adjacent to each other in a single call to memcpy(). All
    those members are exactly the same contained in struct htb_rel_query, so
    instead of duplicating them into struct mpt3_addnl_diag_query, replace them
    with new member rel_query of type struct htb_rel_query. So, now that this
    new object is introduced, memcpy() doesn't overrun the length of
    &karg.buffer_rel_condition, because the address of the new struct object
    _rel_query_ is used as destination, instead. The same issue is present when
    calling memset(), and it is fixed with this same approach.
    
    Below is a comparison of struct mpt3_addnl_diag_query, before and after
    this change (the size and cachelines remain the same):
    
    $ pahole -C mpt3_addnl_diag_query drivers/scsi/mpt3sas/mpt3sas_ctl.o
    struct mpt3_addnl_diag_query {
    	struct mpt3_ioctl_header   hdr;                  /*     0    12 */
    	uint32_t                   unique_id;            /*    12     4 */
    	uint16_t                   buffer_rel_condition; /*    16     2 */
    	uint16_t                   reserved1;            /*    18     2 */
    	uint32_t                   trigger_type;         /*    20     4 */
    	uint32_t                   trigger_info_dwords[2]; /*    24     8 */
    	uint32_t                   reserved2[2];         /*    32     8 */
    
    	/* size: 40, cachelines: 1, members: 7 */
    	/* last cacheline: 40 bytes */
    };
    
    $ pahole -C mpt3_addnl_diag_query drivers/scsi/mpt3sas/mpt3sas_ctl.o
    struct mpt3_addnl_diag_query {
    	struct mpt3_ioctl_header   hdr;                  /*     0    12 */
    	uint32_t                   unique_id;            /*    12     4 */
    	struct htb_rel_query       rel_query;            /*    16    16 */
    	uint32_t                   reserved2[2];         /*    32     8 */
    
    	/* size: 40, cachelines: 1, members: 4 */
    	/* last cacheline: 40 bytes */
    };
    
    Also, this helps with the ongoing efforts to globally enable -Warray-bounds
    and get us closer to being able to tighten the FORTIFY_SOURCE routines on
    memcpy().
    
    Link: KSPP#109
    Link: https://lore.kernel.org/lkml/60659889.bJJILx2THu3hlpxW%[email protected]/
    Link: https://lore.kernel.org/r/20210401162054.GA397186@embeddedor
    Build-tested-by: kernel test robot <[email protected]>
    Reported-by: kernel test robot <[email protected]>
    Signed-off-by: Gustavo A. R. Silva <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    GustavoARSilva authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a8655bf View commit details
    Browse the repository at this point in the history
  90. scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO …

    …response
    
    [ Upstream commit fffd18e ]
    
    Fix a crash caused by a double put on the node when the driver completed an
    ACC for an unsolicted abort on the same node.  The second put was executed
    by lpfc_nlp_not_used() and is wrong because the completion routine executes
    the nlp_put when the iocbq was released.  Additionally, the driver is
    issuing a LOGO then immediately calls lpfc_nlp_set_state to put the node
    into NPR.  This call does nothing.
    
    Remove the lpfc_nlp_not_used call and additional set_state in the
    completion routine.  Remove the lpfc_nlp_set_state post issue_logo.  Isn't
    necessary.
    
    Link: https://lore.kernel.org/r/[email protected]
    Co-developed-by: Justin Tee <[email protected]>
    Signed-off-by: Justin Tee <[email protected]>
    Signed-off-by: James Smart <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jsmart-gh authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    9465bf9 View commit details
    Browse the repository at this point in the history
  91. scsi: lpfc: Fix reference counting errors in lpfc_cmpl_els_rsp()

    [ Upstream commit f866eb0 ]
    
    Call traces are being seen that result from a nodelist structure ref
    counting error. They are typically seen after transmission of an LS_RJT ELS
    response.
    
    Aged code in lpfc_cmpl_els_rsp() calls lpfc_nlp_not_used() which, if the
    ndlp reference count is exactly 1, will decrement the reference count.
    Previously lpfc_nlp_put() was within lpfc_els_free_iocb(), and the 'put'
    within the free would only be invoked if cmdiocb->context1 was not NULL.
    Since the nodelist structure reference count is decremented when exiting
    lpfc_cmpl_els_rsp() the lpfc_nlp_not_used() calls are no longer required.
    Calling them is causing the reference count issue.
    
    Fix by removing the lpfc_nlp_not_used() calls.
    
    Link: https://lore.kernel.org/r/[email protected]
    Co-developed-by: Justin Tee <[email protected]>
    Signed-off-by: Justin Tee <[email protected]>
    Signed-off-by: James Smart <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jsmart-gh authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d30a8a2 View commit details
    Browse the repository at this point in the history
  92. scsi: lpfc: Fix error handling for mailboxes completed in MBX_POLL mode

    [ Upstream commit 304ee43 ]
    
    In SLI-4, when performing a mailbox command with MBX_POLL, the driver uses
    the BMBX register to send the command rather than the MQ. A flag is set
    indicating the BMBX register is active and saves the mailbox job struct
    (mboxq) in the mbox_active element of the adapter. The routine then waits
    for completion or timeout. The mailbox job struct is not freed by the
    routine. In cases of timeout, the adapter will be reset. The
    lpfc_sli_mbox_sys_flush() routine will clean up the mbox in preparation for
    the reset. It clears the BMBX active flag and marks the job structure as
    MBX_NOT_FINISHED. But, it never frees the mboxq job structure. Expectation
    in both normal completion and timeout cases is that the issuer of the mbx
    command will free the structure.  Unfortunately, not all calling paths are
    freeing the memory in cases of error.
    
    All calling paths were looked at and updated, if missing, to free the mboxq
    memory regardless of completion status.
    
    Link: https://lore.kernel.org/r/[email protected]
    Co-developed-by: Justin Tee <[email protected]>
    Signed-off-by: Justin Tee <[email protected]>
    Signed-off-by: James Smart <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jsmart-gh authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    49bff90 View commit details
    Browse the repository at this point in the history
  93. scsi: lpfc: Remove unsupported mbox PORT_CAPABILITIES logic

    [ Upstream commit b62232b ]
    
    SLI-4 does not contain a PORT_CAPABILITIES mailbox command (only SLI-3
    does, and SLI-3 doesn't use it), yet there are SLI-4 code paths that have
    code to issue the command.  The command will always fail.
    
    Remove the code for the mailbox command and leave only the resulting
    "failure path" logic.
    
    Link: https://lore.kernel.org/r/[email protected]
    Co-developed-by: Justin Tee <[email protected]>
    Signed-off-by: Justin Tee <[email protected]>
    Signed-off-by: James Smart <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    jsmart-gh authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e2c0755 View commit details
    Browse the repository at this point in the history
  94. mfd: intel-m10-bmc: Fix the register access range

    [ Upstream commit d9b326b ]
    
    This patch fixes the max register address of MAX 10 BMC. The range
    0x20000000 ~ 0x200000fc are for control registers of the QSPI flash
    controller, which are not accessible to host.
    
    Signed-off-by: Xu Yilun <[email protected]>
    Reviewed-by: Tom Rix <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    yilunxu1984 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    f14b8da View commit details
    Browse the repository at this point in the history
  95. mfd: da9063: Support SMBus and I2C mode

    [ Upstream commit 586478b ]
    
    By default the PMIC DA9063 2-wire interface is SMBus compliant. This
    means the PMIC will automatically reset the interface when the clock
    signal ceases for more than the SMBus timeout of 35 ms.
    
    If the I2C driver / device is not capable of creating atomic I2C
    transactions, a context change can cause a ceasing of the clock signal.
    This can happen if for example a real-time thread is scheduled. Then
    the DA9063 in SMBus mode will reset the 2-wire interface. Subsequently
    a write message could end up in the wrong register. This could cause
    unpredictable system behavior.
    
    The DA9063 PMIC also supports an I2C compliant mode for the 2-wire
    interface. This mode does not reset the interface when the clock
    signal ceases. Thus the problem depicted above does not occur.
    
    This patch tests for the bus functionality "I2C_FUNC_I2C". It can
    reasonably be assumed that the bus cannot obey SMBus timings if
    this functionality is set. SMBus commands most probably are emulated
    in this case which is prone to the latency issue described above.
    
    This patch enables the I2C bus mode if I2C_FUNC_I2C is set or
    otherwise keeps the default SMBus mode.
    
    Signed-off-by: Hubert Streidl <[email protected]>
    Signed-off-by: Mark Jonas <[email protected]>
    Reviewed-by: Wolfram Sang <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Hubert Streidl authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2030567 View commit details
    Browse the repository at this point in the history
  96. mfd: arizona: Fix rumtime PM imbalance on error

    [ Upstream commit fe6df2b ]
    
    pm_runtime_get_sync() will increase the rumtime PM counter
    even it returns an error. Thus a pairing decrement is needed
    to prevent refcount leak. Fix this by replacing this API with
    pm_runtime_resume_and_get(), which will not change the runtime
    PM counter on error.
    
    Signed-off-by: Dinghao Liu <[email protected]>
    Acked-by: Charles Keepax <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    dinghaoliu authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0e0fb68 View commit details
    Browse the repository at this point in the history
  97. scsi: libfc: Fix a format specifier

    [ Upstream commit 90d6697 ]
    
    Since the 'mfs' member has been declared as 'u32' in include/scsi/libfc.h,
    use the %u format specifier instead of %hu. This patch fixes the following
    clang compiler warning:
    
    warning: format specifies type
          'unsigned short' but the argument has type 'u32' (aka 'unsigned int')
          [-Wformat]
                                 "lport->mfs:%hu\n", mfs, lport->mfs);
                                             ~~~          ^~~~~~~~~~
                                             %u
    
    Link: https://lore.kernel.org/r/[email protected]
    Cc: Hannes Reinecke <[email protected]>
    Signed-off-by: Bart Van Assche <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    bvanassche authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    76282ed View commit details
    Browse the repository at this point in the history
  98. perf: Rework perf_event_exit_event()

    [ Upstream commit ef54c1a ]
    
    Make perf_event_exit_event() more robust, such that we can use it from
    other contexts. Specifically the up and coming remove_on_exec.
    
    For this to work we need to address a few issues. Remove_on_exec will
    not destroy the entire context, so we cannot rely on TASK_TOMBSTONE to
    disable event_function_call() and we thus have to use
    perf_remove_from_context().
    
    When using perf_remove_from_context(), there's two races to consider.
    The first is against close(), where we can have concurrent tear-down
    of the event. The second is against child_list iteration, which should
    not find a half baked event.
    
    To address this, teach perf_remove_from_context() to special case
    !ctx->is_active and about DETACH_CHILD.
    
    [ [email protected]: fix racing parent/child exit in sync_child_event(). ]
    Signed-off-by: Marco Elver <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Peter Zijlstra authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    76ccefa View commit details
    Browse the repository at this point in the history
  99. sched,fair: Alternative sched_slice()

    [ Upstream commit 0c2de3f ]
    
    The current sched_slice() seems to have issues; there's two possible
    things that could be improved:
    
     - the 'nr_running' used for __sched_period() is daft when cgroups are
       considered. Using the RQ wide h_nr_running seems like a much more
       consistent number.
    
     - (esp) cgroups can slice it real fine, which makes for easy
       over-scheduling, ensure min_gran is what the name says.
    
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Tested-by: Valentin Schneider <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Peter Zijlstra authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    9d1c4c2 View commit details
    Browse the repository at this point in the history
  100. block/rnbd-srv: Prevent a deadlock generated by accessing sysfs in pa…

    …rallel
    
    [ Upstream commit b168e1d ]
    
    We got a warning message below.
    When server tries to close one session by force, it locks the sysfs
    interface and locks the srv_sess lock.
    The problem is that client can send a request to close at the same time.
    By close request, server locks the srv_sess lock and locks the sysfs
    to remove the sysfs interfaces.
    
    The simplest way to prevent that situation could be just use
    mutex_trylock.
    
    [  234.153965] ======================================================
    [  234.154093] WARNING: possible circular locking dependency detected
    [  234.154219] 5.4.84-storage esmil#5.4.84-1+feature+linux+5.4.y+dbg+20201216.1319+b6b887b~deb10 Tainted: G           O
    [  234.154381] ------------------------------------------------------
    [  234.154531] kworker/1:1H/618 is trying to acquire lock:
    [  234.154651] ffff8887a09db0a8 (kn->count#132){++++}, at: kernfs_remove_by_name_ns+0x40/0x80
    [  234.154819]
                   but task is already holding lock:
    [  234.154965] ffff8887ae5f6518 (&srv_sess->lock){+.+.}, at: rnbd_srv_rdma_ev+0x144/0x1590 [rnbd_server]
    [  234.155132]
                   which lock already depends on the new lock.
    
    [  234.155311]
                   the existing dependency chain (in reverse order) is:
    [  234.155462]
                   -> esmil#1 (&srv_sess->lock){+.+.}:
    [  234.155614]        __mutex_lock+0x134/0xcb0
    [  234.155761]        rnbd_srv_sess_dev_force_close+0x36/0x50 [rnbd_server]
    [  234.155889]        rnbd_srv_dev_session_force_close_store+0x69/0xc0 [rnbd_server]
    [  234.156042]        kernfs_fop_write+0x13f/0x240
    [  234.156162]        vfs_write+0xf3/0x280
    [  234.156278]        ksys_write+0xba/0x150
    [  234.156395]        do_syscall_64+0x62/0x270
    [  234.156513]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [  234.156632]
                   -> #0 (kn->count#132){++++}:
    [  234.156782]        __lock_acquire+0x129e/0x23a0
    [  234.156900]        lock_acquire+0xf3/0x210
    [  234.157043]        __kernfs_remove+0x42b/0x4c0
    [  234.157161]        kernfs_remove_by_name_ns+0x40/0x80
    [  234.157282]        remove_files+0x3f/0xa0
    [  234.157399]        sysfs_remove_group+0x4a/0xb0
    [  234.157519]        rnbd_srv_destroy_dev_session_sysfs+0x19/0x30 [rnbd_server]
    [  234.157648]        rnbd_srv_rdma_ev+0x14c/0x1590 [rnbd_server]
    [  234.157775]        process_io_req+0x29a/0x6a0 [rtrs_server]
    [  234.157924]        __ib_process_cq+0x8c/0x100 [ib_core]
    [  234.158709]        ib_cq_poll_work+0x31/0xb0 [ib_core]
    [  234.158834]        process_one_work+0x4e5/0xaa0
    [  234.158958]        worker_thread+0x65/0x5c0
    [  234.159078]        kthread+0x1e0/0x200
    [  234.159194]        ret_from_fork+0x24/0x30
    [  234.159309]
                   other info that might help us debug this:
    
    [  234.159513]  Possible unsafe locking scenario:
    
    [  234.159658]        CPU0                    CPU1
    [  234.159775]        ----                    ----
    [  234.159891]   lock(&srv_sess->lock);
    [  234.160005]                                lock(kn->count#132);
    [  234.160128]                                lock(&srv_sess->lock);
    [  234.160250]   lock(kn->count#132);
    [  234.160364]
                    *** DEADLOCK ***
    
    [  234.160536] 3 locks held by kworker/1:1H/618:
    [  234.160677]  #0: ffff8883ca1ed528 ((wq_completion)ib-comp-wq){+.+.}, at: process_one_work+0x40a/0xaa0
    [  234.160840]  esmil#1: ffff8883d2d5fe10 ((work_completion)(&cq->work)){+.+.}, at: process_one_work+0x40a/0xaa0
    [  234.161003]  esmil#2: ffff8887ae5f6518 (&srv_sess->lock){+.+.}, at: rnbd_srv_rdma_ev+0x144/0x1590 [rnbd_server]
    [  234.161168]
                   stack backtrace:
    [  234.161312] CPU: 1 PID: 618 Comm: kworker/1:1H Tainted: G           O      5.4.84-storage esmil#5.4.84-1+feature+linux+5.4.y+dbg+20201216.1319+b6b887b~deb10
    [  234.161490] Hardware name: Supermicro H8QG6/H8QG6, BIOS 3.00       09/04/2012
    [  234.161643] Workqueue: ib-comp-wq ib_cq_poll_work [ib_core]
    [  234.161765] Call Trace:
    [  234.161910]  dump_stack+0x96/0xe0
    [  234.162028]  check_noncircular+0x29e/0x2e0
    [  234.162148]  ? print_circular_bug+0x100/0x100
    [  234.162267]  ? register_lock_class+0x1ad/0x8a0
    [  234.162385]  ? __lock_acquire+0x68e/0x23a0
    [  234.162505]  ? trace_event_raw_event_lock+0x190/0x190
    [  234.162626]  __lock_acquire+0x129e/0x23a0
    [  234.162746]  ? register_lock_class+0x8a0/0x8a0
    [  234.162866]  lock_acquire+0xf3/0x210
    [  234.162982]  ? kernfs_remove_by_name_ns+0x40/0x80
    [  234.163127]  __kernfs_remove+0x42b/0x4c0
    [  234.163243]  ? kernfs_remove_by_name_ns+0x40/0x80
    [  234.163363]  ? kernfs_fop_readdir+0x3b0/0x3b0
    [  234.163482]  ? strlen+0x1f/0x40
    [  234.163596]  ? strcmp+0x30/0x50
    [  234.163712]  kernfs_remove_by_name_ns+0x40/0x80
    [  234.163832]  remove_files+0x3f/0xa0
    [  234.163948]  sysfs_remove_group+0x4a/0xb0
    [  234.164068]  rnbd_srv_destroy_dev_session_sysfs+0x19/0x30 [rnbd_server]
    [  234.164196]  rnbd_srv_rdma_ev+0x14c/0x1590 [rnbd_server]
    [  234.164345]  ? _raw_spin_unlock_irqrestore+0x43/0x50
    [  234.164466]  ? lockdep_hardirqs_on+0x1a8/0x290
    [  234.164597]  ? mlx4_ib_poll_cq+0x927/0x1280 [mlx4_ib]
    [  234.164732]  ? rnbd_get_sess_dev+0x270/0x270 [rnbd_server]
    [  234.164859]  process_io_req+0x29a/0x6a0 [rtrs_server]
    [  234.164982]  ? rnbd_get_sess_dev+0x270/0x270 [rnbd_server]
    [  234.165130]  __ib_process_cq+0x8c/0x100 [ib_core]
    [  234.165279]  ib_cq_poll_work+0x31/0xb0 [ib_core]
    [  234.165404]  process_one_work+0x4e5/0xaa0
    [  234.165550]  ? pwq_dec_nr_in_flight+0x160/0x160
    [  234.165675]  ? do_raw_spin_lock+0x119/0x1d0
    [  234.165796]  worker_thread+0x65/0x5c0
    [  234.165914]  ? process_one_work+0xaa0/0xaa0
    [  234.166031]  kthread+0x1e0/0x200
    [  234.166147]  ? kthread_create_worker_on_cpu+0xc0/0xc0
    [  234.166268]  ret_from_fork+0x24/0x30
    [  234.251591] rnbd_server L243: </dev/loop1@close_device_session>: Device closed
    [  234.604221] rnbd_server L264: RTRS Session close_device_session disconnected
    
    Signed-off-by: Gioh Kim <[email protected]>
    Signed-off-by: Md Haris Iqbal <[email protected]>
    Signed-off-by: Jack Wang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Gioh Kim authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fba4bf1 View commit details
    Browse the repository at this point in the history
  101. block/rnbd-clt: Fix missing a memory free when unloading the module

    [ Upstream commit 12b0653 ]
    
    When unloading the rnbd-clt module, it does not free a memory
    including the filename of the symbolic link to /sys/block/rnbdX.
    
    It is found by kmemleak as below.
    
    unreferenced object 0xffff9f1a83d3c740 (size 16):
      comm "bash", pid 736, jiffies 4295179665 (age 9841.310s)
      hex dump (first 16 bytes):
        21 64 65 76 21 6e 75 6c 6c 62 30 40 62 6c 61 00  !dev!nullb0@bla.
      backtrace:
        [<0000000039f0c55e>] 0xffffffffc0456c24
        [<000000001aab9513>] kernfs_fop_write+0xcf/0x1c0
        [<00000000db5aa4b3>] vfs_write+0xdb/0x1d0
        [<000000007a2e2207>] ksys_write+0x65/0xe0
        [<00000000055e280a>] do_syscall_64+0x50/0x1b0
        [<00000000c2b51831>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
    Signed-off-by: Gioh Kim <[email protected]>
    Signed-off-by: Jack Wang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Gioh Kim authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    87a6d38 View commit details
    Browse the repository at this point in the history
  102. io_uring: safer sq_creds putting

    [ Upstream commit 07db298 ]
    
    Put sq_creds as a part of io_ring_ctx_free(), it's easy to miss doing it
    in io_sq_thread_finish(), especially considering past mistakes related
    to ring creation failures.
    
    Signed-off-by: Pavel Begunkov <[email protected]>
    Link: https://lore.kernel.org/r/3becb1866467a1de82a97345a0a90d7fb8ff875e.1618916549.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    isilence authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    19bbb35 View commit details
    Browse the repository at this point in the history
  103. s390/archrandom: add parameter check for s390_arch_random_generate

    [ Upstream commit 2809606 ]
    
    A review of the code showed, that this function which is exposed
    within the whole kernel should do a parameter check for the
    amount of bytes requested. If this requested bytes is too high
    an unsigned int overflow could happen causing this function to
    try to memcpy a really big memory chunk.
    
    This is not a security issue as there are only two invocations
    of this function from arch/s390/include/asm/archrandom.h and both
    are not exposed to userland.
    
    Reported-by: Sven Schnelle <[email protected]>
    Signed-off-by: Harald Freudenberger <[email protected]>
    Signed-off-by: Heiko Carstens <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    hfreude authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a78c38e View commit details
    Browse the repository at this point in the history
  104. sched,psi: Handle potential task count underflow bugs more gracefully

    [ Upstream commit 9d10a13 ]
    
    psi_group_cpu->tasks, represented by the unsigned int, stores the
    number of tasks that could be stalled on a psi resource(io/mem/cpu).
    Decrementing these counters at zero leads to wrapping which further
    leads to the psi_group_cpu->state_mask is being set with the
    respective pressure state. This could result into the unnecessary time
    sampling for the pressure state thus cause the spurious psi events.
    This can further lead to wrong actions being taken at the user land
    based on these psi events.
    
    Though psi_bug is set under these conditions but that just for debug
    purpose. Fix it by decrementing the ->tasks count only when it is
    non-zero.
    
    Signed-off-by: Charan Teja Reddy <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Acked-by: Johannes Weiner <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Charan Teja Reddy authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    244022d View commit details
    Browse the repository at this point in the history
  105. nvmet: avoid queuing keep-alive timer if it is disabled

    [ Upstream commit 8f864c5 ]
    
    Issue following command:
    nvme set-feature -f 0xf -v 0 /dev/nvme1n1 # disable keep-alive timer
    nvme admin-passthru -o 0x18 /dev/nvme1n1  # send keep-alive command
    will make keep-alive timer fired and thus delete the controller like
    below:
    
    [247459.907635] nvmet: ctrl 1 keep-alive timer (0 seconds) expired!
    [247459.930294] nvmet: ctrl 1 fatal error occurred!
    
    Avoid this by not queuing delayed keep-alive if it is disabled when
    keep-alive command is received from the admin queue.
    
    Signed-off-by: Hou Pu <[email protected]>
    Tested-by: Chaitanya Kulkarni <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    puhou authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    284d899 View commit details
    Browse the repository at this point in the history
  106. power: supply: cpcap-battery: fix invalid usage of list cursor

    [ Upstream commit d0a43c1 ]
    
    Fix invalid usage of a list_for_each_entry in cpcap_battery_irq_thread().
    Empty list or fully traversed list points to list head, which is not
    NULL (and before the first element containing real data).
    
    Signed-off-by: Guangqing Zhu <[email protected]>
    Reviewed-by: Tony Lindgren <[email protected]>
    Reviewed-by: Carl Philipp Klemm <[email protected]>
    Tested-by: Carl Philipp Klemm <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    zhuguangqing authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    21f0971 View commit details
    Browse the repository at this point in the history
  107. ALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer

    commit 1c98f57 upstream.
    
    Our code analyzer reported a uaf.
    
    In snd_emu8000_create_mixer, the callee snd_ctl_add(..,emu->controls[i])
    calls snd_ctl_add_replace(.., kcontrol,..). Inside snd_ctl_add_replace(),
    if error happens, kcontrol will be freed by snd_ctl_free_one(kcontrol).
    Then emu->controls[i] points to a freed memory, and the execution comes
    to __error branch of snd_emu8000_create_mixer. The freed emu->controls[i]
    is used in snd_ctl_remove(card, emu->controls[i]).
    
    My patch set emu->controls[i] to NULL if snd_ctl_add() failed to avoid
    the uaf.
    
    Signed-off-by: Lv Yunlong <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Yunlongs authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    ad2cd2d View commit details
    Browse the repository at this point in the history
  108. ALSA: hda/conexant: Re-order CX5066 quirk table entries

    commit 2e6a731 upstream.
    
    Just re-order the cx5066_fixups[] entries for HP devices for avoiding
    the oversight of the duplicated or unapplied item in future.
    No functional changes.
    
    Also Cc-to-stable for the further patch applications.
    
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tiwai authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    51aad88 View commit details
    Browse the repository at this point in the history
  109. ALSA: sb: Fix two use after free in snd_sb_qsound_build

    commit 4fb44dd upstream.
    
    In snd_sb_qsound_build, snd_ctl_add(..,p->qsound_switch...) and
    snd_ctl_add(..,p->qsound_space..) are called. But the second
    arguments of snd_ctl_add() could be freed via snd_ctl_add_replace()
    ->snd_ctl_free_one(). After the error code is returned,
    snd_sb_qsound_destroy(p) is called in __error branch.
    
    But in snd_sb_qsound_destroy(), the freed p->qsound_switch and
    p->qsound_space are still used by snd_ctl_remove().
    
    My patch set p->qsound_switch and p->qsound_space to NULL if
    snd_ctl_add() failed to avoid the uaf bugs. But these codes need
    to further be improved with the code style.
    
    Signed-off-by: Lv Yunlong <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Yunlongs authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1699edd View commit details
    Browse the repository at this point in the history
  110. ALSA: usb-audio: Explicitly set up the clock selector

    commit d2e8f64 upstream.
    
    In the current code, we have some assumption that the audio clock
    selector has been set up implicitly and don't want to touch it unless
    it's really needed for the fallback autoclock setup.  This works for
    most devices but some seem having a problem.  Partially this was
    covered for the devices with a single connector at the initialization
    phase (commit 086b957 "ALSA: usb-audio: Skip the clock selector
    inquiry for single connections"), but also there are cases where the
    wrong clock set up is kept silently.  The latter seems to be the cause
    of the noises on Behringer devices.
    
    In this patch, we explicitly set up the audio clock selector whenever
    the appropriate node is found.
    
    Reported-by: Geraldo Nascimento <[email protected]>
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199327
    Link: https://lore.kernel.org/r/CAEsQvcvF7LnO8PxyyCxuRCx=7jNeSCvFAd-+dE0g_rd1rOxxdw@mail.gmail.com
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tiwai authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e117d32 View commit details
    Browse the repository at this point in the history
  111. ALSA: usb-audio: Add dB range mapping for Sennheiser Communications H…

    …eadset PC 8
    
    commit ab2165e upstream.
    
    The decibel volume range contains a negative maximum value resulting in
    pipewire complaining about the device and effectivly having no sound
    output. The wrong values also resulted in the headset sounding muted
    already at a mixer level of about ~25%.
    
    PipeWire BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1049
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212897
    Signed-off-by: Timo Gurr <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tgurr authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    8f89fb2 View commit details
    Browse the repository at this point in the history
  112. ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 445 G7

    commit 75b62ab upstream.
    
    The HP ProBook 445 G7 (17T32ES) uses ALC236. Like ALC236_FIXUP_HP_GPIO_LED,
    COEF index 0x34 bit 5 is used to control the playback mute LED, but the
    microphone mute LED is controlled using pin VREF instead of a COEF index.
    
    AlsaInfo: https://alsa-project.org/db/?f=0d3f4d1af39cc359f9fea9b550727ee87e5cf45a
    Signed-off-by: Jonas Witschel <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    diabonas authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    8b32a5e View commit details
    Browse the repository at this point in the history
  113. ALSA: hda/realtek: GA503 use same quirks as GA401

    commit 76fae61 upstream.
    
    The GA503 has almost exactly the same default setup as the GA401
    model with the same issues. The GA401 quirks solve all the issues
    so we will use the full quirk chain.
    
    Signed-off-by: Luke D Jones <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    flukejones authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fd2fec3 View commit details
    Browse the repository at this point in the history
  114. ALSA: hda/realtek: fix mic boost on Intel NUC 8

    commit d1ee66c upstream.
    
    Fix two bugs with the Intel HDA Realtek ALC233 sound codec
    present in Intel NUC NUC8i7BEH and probably a few other similar
    NUC models.
    
    These codecs advertise a 4-level microphone input boost amplifier on
    pin 0x19, but the highest two boost settings do not work correctly,
    and produce only low analog noise that does not seem to contain any
    discernible signal. There is an existing fixup for this exact problem
    but for a different PCI subsystem ID, so we re-use that logic.
    
    Changing the boost level also triggers a DC spike in the input signal
    that bleeds off over about a second and overwhelms any input during
    that time. Thankfully, the existing fixup has the side effect of
    making the boost control show up in userspace as a mute/unmute switch,
    and this keeps (e.g.) PulseAudio from fiddling with it during normal
    input volume adjustments.
    
    Finally, the NUC hardware has built-in inverted stereo mics. This
    patch also enables the usual fixup for this so the two channels cancel
    noise instead of the actual signal.
    
    [ Re-ordered the quirk entry point by tiwai ]
    
    Signed-off-by: Phil Calvin <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    pnc authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2c10b67 View commit details
    Browse the repository at this point in the history
  115. ALSA: hda/realtek - Headset Mic issue on HP platform

    commit 1c9d9df upstream.
    
    Boot with plugged headset, the Headset Mic will be gone.
    
    Signed-off-by: Kailang Yang <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    kailangyang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    14ad440 View commit details
    Browse the repository at this point in the history
  116. ALSA: hda/realtek: fix static noise on ALC285 Lenovo laptops

    commit 9bbb94e upstream.
    
    Remove a duplicate vendor+subvendor pin fixup entry as one is masking
    the other and making it unreachable. Consider the more specific newcomer
    as a second chance instead.
    
    The generic entry is made less strict to also match for laptops with
    slightly different 0x12 pin configuration. Tested on Lenovo Yoga 6 (AMD)
    where 0x12 is 0x40000000.
    
    Fixes: 607184c ("ALSA: hda/realtek - Add supported for more Lenovo ALC285 Headset Button")
    Signed-off-by: Sami Loone <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/YIXS+GT/dGI/LtK6@yoga
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    enool authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b821885 View commit details
    Browse the repository at this point in the history
  117. ALSA: hda/realtek: Add quirk for Intel Clevo PCx0Dx

    commit 970e301 upstream.
    
    This applies a SND_PCI_QUIRK(...) to the Clevo PCx0Dx barebones. This
    fix enables audio output over the headset jack and ensures that a
    microphone connected via the headset combo jack is correctly recognized
    when pluged in.
    
    [ Rearranged the list entries in a sorted order -- tiwai ]
    
    Signed-off-by: Eckhart Mohr <[email protected]>
    Co-developed-by: Werner Sembach <[email protected]>
    Signed-off-by: Werner Sembach <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Emohr-Tuxedo authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    19c1172 View commit details
    Browse the repository at this point in the history
  118. tools/power/turbostat: Fix turbostat for AMD Zen CPUs

    commit 301b1d3 upstream.
    
    It was reported that on Zen+ system turbostat started exiting,
    which was tracked down to the MSR_PKG_ENERGY_STAT read failing because
    offset_to_idx wasn't returning a non-negative index.
    
    This patch combined the modification from Bingsong Si and
    Bas Nieuwenhuizen and addd the MSR to the index system as alternative for
    MSR_PKG_ENERGY_STATUS.
    
    Fixes: 9972d5d ("tools/power turbostat: Enable accumulate RAPL display")
    Reported-by: youling257 <[email protected]>
    Tested-by: youling257 <[email protected]>
    Tested-by: Kurt Garloff <[email protected]>
    Tested-by: Bingsong Si <[email protected]>
    Tested-by: Artem S. Tashkinov <[email protected]>
    Co-developed-by: Bingsong Si <[email protected]>
    Co-developed-by: Terry Bowman <[email protected]>
    Signed-off-by: Bas Nieuwenhuizen <[email protected]>
    Reviewed-by: Chen Yu <[email protected]>
    Signed-off-by: Len Brown <[email protected]>
    Cc: Salvatore Bonaccorso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    BNieuwenhuizen authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    900fb32 View commit details
    Browse the repository at this point in the history
  119. btrfs: fix race when picking most recent mod log operation for an old…

    … root
    
    [ Upstream commit f9690f4 ]
    
    Commit dbcc7d5 ("btrfs: fix race when cloning extent buffer during
    rewind of an old root"), fixed a race when we need to rewind the extent
    buffer of an old root. It was caused by picking a new mod log operation
    for the extent buffer while getting a cloned extent buffer with an outdated
    number of items (off by -1), because we cloned the extent buffer without
    locking it first.
    
    However there is still another similar race, but in the opposite direction.
    The cloned extent buffer has a number of items that does not match the
    number of tree mod log operations that are going to be replayed. This is
    because right after we got the last (most recent) tree mod log operation to
    replay and before locking and cloning the extent buffer, another task adds
    a new pointer to the extent buffer, which results in adding a new tree mod
    log operation and incrementing the number of items in the extent buffer.
    So after cloning we have mismatch between the number of items in the extent
    buffer and the number of mod log operations we are going to apply to it.
    This results in hitting a BUG_ON() that produces the following stack trace:
    
       ------------[ cut here ]------------
       kernel BUG at fs/btrfs/tree-mod-log.c:675!
       invalid opcode: 0000 [esmil#1] SMP KASAN PTI
       CPU: 3 PID: 4811 Comm: crawl_1215 Tainted: G        W         5.12.0-7d1efdf501f8-misc-next+ torvalds#99
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
       RIP: 0010:tree_mod_log_rewind+0x3b1/0x3c0
       Code: 05 48 8d 74 10 (...)
       RSP: 0018:ffffc90001027090 EFLAGS: 00010293
       RAX: 0000000000000000 RBX: ffff8880a8514600 RCX: ffffffffaa9e59b6
       RDX: 0000000000000007 RSI: dffffc0000000000 RDI: ffff8880a851462c
       RBP: ffffc900010270e0 R08: 00000000000000c0 R09: ffffed1004333417
       R10: ffff88802199a0b7 R11: ffffed1004333416 R12: 000000000000000e
       R13: ffff888135af8748 R14: ffff88818766ff00 R15: ffff8880a851462c
       FS:  00007f29acf62700(0000) GS:ffff8881f2200000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00007f0e6013f718 CR3: 000000010d42e003 CR4: 0000000000170ee0
       Call Trace:
        btrfs_get_old_root+0x16a/0x5c0
        ? lock_downgrade+0x400/0x400
        btrfs_search_old_slot+0x192/0x520
        ? btrfs_search_slot+0x1090/0x1090
        ? free_extent_buffer.part.61+0xd7/0x140
        ? free_extent_buffer+0x13/0x20
        resolve_indirect_refs+0x3e9/0xfc0
        ? lock_downgrade+0x400/0x400
        ? __kasan_check_read+0x11/0x20
        ? add_prelim_ref.part.11+0x150/0x150
        ? lock_downgrade+0x400/0x400
        ? __kasan_check_read+0x11/0x20
        ? lock_acquired+0xbb/0x620
        ? __kasan_check_write+0x14/0x20
        ? do_raw_spin_unlock+0xa8/0x140
        ? rb_insert_color+0x340/0x360
        ? prelim_ref_insert+0x12d/0x430
        find_parent_nodes+0x5c3/0x1830
        ? stack_trace_save+0x87/0xb0
        ? resolve_indirect_refs+0xfc0/0xfc0
        ? fs_reclaim_acquire+0x67/0xf0
        ? __kasan_check_read+0x11/0x20
        ? lockdep_hardirqs_on_prepare+0x210/0x210
        ? fs_reclaim_acquire+0x67/0xf0
        ? __kasan_check_read+0x11/0x20
        ? ___might_sleep+0x10f/0x1e0
        ? __kasan_kmalloc+0x9d/0xd0
        ? trace_hardirqs_on+0x55/0x120
        btrfs_find_all_roots_safe+0x142/0x1e0
        ? find_parent_nodes+0x1830/0x1830
        ? trace_hardirqs_on+0x55/0x120
        ? ulist_free+0x1f/0x30
        ? btrfs_inode_flags_to_xflags+0x50/0x50
        iterate_extent_inodes+0x20e/0x580
        ? tree_backref_for_extent+0x230/0x230
        ? release_extent_buffer+0x225/0x280
        ? read_extent_buffer+0xdd/0x110
        ? lock_downgrade+0x400/0x400
        ? __kasan_check_read+0x11/0x20
        ? lock_acquired+0xbb/0x620
        ? __kasan_check_write+0x14/0x20
        ? do_raw_spin_unlock+0xa8/0x140
        ? _raw_spin_unlock+0x22/0x30
        ? release_extent_buffer+0x225/0x280
        iterate_inodes_from_logical+0x129/0x170
        ? iterate_inodes_from_logical+0x129/0x170
        ? btrfs_inode_flags_to_xflags+0x50/0x50
        ? iterate_extent_inodes+0x580/0x580
        ? __vmalloc_node+0x92/0xb0
        ? init_data_container+0x34/0xb0
        ? init_data_container+0x34/0xb0
        ? kvmalloc_node+0x60/0x80
        btrfs_ioctl_logical_to_ino+0x158/0x230
        btrfs_ioctl+0x2038/0x4360
        ? __kasan_check_write+0x14/0x20
        ? mmput+0x3b/0x220
        ? btrfs_ioctl_get_supported_features+0x30/0x30
        ? __kasan_check_read+0x11/0x20
        ? __kasan_check_read+0x11/0x20
        ? lock_release+0xc8/0x650
        ? __might_fault+0x64/0xd0
        ? __kasan_check_read+0x11/0x20
        ? lock_downgrade+0x400/0x400
        ? lockdep_hardirqs_on_prepare+0x210/0x210
        ? lockdep_hardirqs_on_prepare+0x13/0x210
        ? _raw_spin_unlock_irqrestore+0x51/0x63
        ? __kasan_check_read+0x11/0x20
        ? do_vfs_ioctl+0xfc/0x9d0
        ? ioctl_file_clone+0xe0/0xe0
        ? lock_downgrade+0x400/0x400
        ? lockdep_hardirqs_on_prepare+0x210/0x210
        ? __kasan_check_read+0x11/0x20
        ? lock_release+0xc8/0x650
        ? __task_pid_nr_ns+0xd3/0x250
        ? __kasan_check_read+0x11/0x20
        ? __fget_files+0x160/0x230
        ? __fget_light+0xf2/0x110
        __x64_sys_ioctl+0xc3/0x100
        do_syscall_64+0x37/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f29ae85b427
       Code: 00 00 90 48 8b (...)
       RSP: 002b:00007f29acf5fcf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
       RAX: ffffffffffffffda RBX: 00007f29acf5ff40 RCX: 00007f29ae85b427
       RDX: 00007f29acf5ff48 RSI: 00000000c038943b RDI: 0000000000000003
       RBP: 0000000001000000 R08: 0000000000000000 R09: 00007f29acf60120
       R10: 00005640d5fc7b00 R11: 0000000000000246 R12: 0000000000000003
       R13: 00007f29acf5ff48 R14: 00007f29acf5ff40 R15: 00007f29acf5fef8
       Modules linked in:
       ---[ end trace 85e5fce078dfbe04 ]---
    
      (gdb) l *(tree_mod_log_rewind+0x3b1)
      0xffffffff819e5b21 is in tree_mod_log_rewind (fs/btrfs/tree-mod-log.c:675).
      670                      * the modification. As we're going backwards, we do the
      671                      * opposite of each operation here.
      672                      */
      673                     switch (tm->op) {
      674                     case BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING:
      675                             BUG_ON(tm->slot < n);
      676                             fallthrough;
      677                     case BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING:
      678                     case BTRFS_MOD_LOG_KEY_REMOVE:
      679                             btrfs_set_node_key(eb, &tm->key, tm->slot);
      (gdb) quit
    
    The following steps explain in more detail how it happens:
    
    1) We have one tree mod log user (through fiemap or the logical ino ioctl),
       with a sequence number of 1, so we have fs_info->tree_mod_seq == 1.
       This is task A;
    
    2) Another task is at ctree.c:balance_level() and we have eb X currently as
       the root of the tree, and we promote its single child, eb Y, as the new
       root.
    
       Then, at ctree.c:balance_level(), we call:
    
          ret = btrfs_tree_mod_log_insert_root(root->node, child, true);
    
    3) At btrfs_tree_mod_log_insert_root() we create a tree mod log operation
       of type BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING, with a ->logical field
       pointing to ebX->start. We only have one item in eb X, so we create
       only one tree mod log operation, and store in the "tm_list" array;
    
    4) Then, still at btrfs_tree_mod_log_insert_root(), we create a tree mod
       log element of operation type BTRFS_MOD_LOG_ROOT_REPLACE, ->logical set
       to ebY->start, ->old_root.logical set to ebX->start, ->old_root.level
       set to the level of eb X and ->generation set to the generation of eb X;
    
    5) Then btrfs_tree_mod_log_insert_root() calls tree_mod_log_free_eb() with
       "tm_list" as argument. After that, tree_mod_log_free_eb() calls
       tree_mod_log_insert(). This inserts the mod log operation of type
       BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING from step 3 into the rbtree
       with a sequence number of 2 (and fs_info->tree_mod_seq set to 2);
    
    6) Then, after inserting the "tm_list" single element into the tree mod
       log rbtree, the BTRFS_MOD_LOG_ROOT_REPLACE element is inserted, which
       gets the sequence number 3 (and fs_info->tree_mod_seq set to 3);
    
    7) Back to ctree.c:balance_level(), we free eb X by calling
       btrfs_free_tree_block() on it. Because eb X was created in the current
       transaction, has no other references and writeback did not happen for
       it, we add it back to the free space cache/tree;
    
    8) Later some other task B allocates the metadata extent from eb X, since
       it is marked as free space in the space cache/tree, and uses it as a
       node for some other btree;
    
    9) The tree mod log user task calls btrfs_search_old_slot(), which calls
       btrfs_get_old_root(), and finally that calls tree_mod_log_oldest_root()
       with time_seq == 1 and eb_root == eb Y;
    
    10) The first iteration of the while loop finds the tree mod log element
        with sequence number 3, for the logical address of eb Y and of type
        BTRFS_MOD_LOG_ROOT_REPLACE;
    
    11) Because the operation type is BTRFS_MOD_LOG_ROOT_REPLACE, we don't
        break out of the loop, and set root_logical to point to
        tm->old_root.logical, which corresponds to the logical address of
        eb X;
    
    12) On the next iteration of the while loop, the call to
        tree_mod_log_search_oldest() returns the smallest tree mod log element
        for the logical address of eb X, which has a sequence number of 2, an
        operation type of BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING and
        corresponds to the old slot 0 of eb X (eb X had only 1 item in it
        before being freed at step 7);
    
    13) We then break out of the while loop and return the tree mod log
        operation of type BTRFS_MOD_LOG_ROOT_REPLACE (eb Y), and not the one
        for slot 0 of eb X, to btrfs_get_old_root();
    
    14) At btrfs_get_old_root(), we process the BTRFS_MOD_LOG_ROOT_REPLACE
        operation and set "logical" to the logical address of eb X, which was
        the old root. We then call tree_mod_log_search() passing it the logical
        address of eb X and time_seq == 1;
    
    15) But before calling tree_mod_log_search(), task B locks eb X, adds a
        key to eb X, which results in adding a tree mod log operation of type
        BTRFS_MOD_LOG_KEY_ADD, with a sequence number of 4, to the tree mod
        log, and increments the number of items in eb X from 0 to 1.
        Now fs_info->tree_mod_seq has a value of 4;
    
    16) Task A then calls tree_mod_log_search(), which returns the most recent
        tree mod log operation for eb X, which is the one just added by task B
        at the previous step, with a sequence number of 4, a type of
        BTRFS_MOD_LOG_KEY_ADD and for slot 0;
    
    17) Before task A locks and clones eb X, task A adds another key to eb X,
        which results in adding a new BTRFS_MOD_LOG_KEY_ADD mod log operation,
        with a sequence number of 5, for slot 1 of eb X, increments the
        number of items in eb X from 1 to 2, and unlocks eb X.
        Now fs_info->tree_mod_seq has a value of 5;
    
    18) Task A then locks eb X and clones it. The clone has a value of 2 for
        the number of items and the pointer "tm" points to the tree mod log
        operation with sequence number 4, not the most recent one with a
        sequence number of 5, so there is mismatch between the number of
        mod log operations that are going to be applied to the cloned version
        of eb X and the number of items in the clone;
    
    19) Task A then calls tree_mod_log_rewind() with the clone of eb X, the
        tree mod log operation with sequence number 4 and a type of
        BTRFS_MOD_LOG_KEY_ADD, and time_seq == 1;
    
    20) At tree_mod_log_rewind(), we set the local variable "n" with a value
        of 2, which is the number of items in the clone of eb X.
    
        Then in the first iteration of the while loop, we process the mod log
        operation with sequence number 4, which is targeted at slot 0 and has
        a type of BTRFS_MOD_LOG_KEY_ADD. This results in decrementing "n" from
        2 to 1.
    
        Then we pick the next tree mod log operation for eb X, which is the
        tree mod log operation with a sequence number of 2, a type of
        BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING and for slot 0, it is the one
        added in step 5 to the tree mod log tree.
    
        We go back to the top of the loop to process this mod log operation,
        and because its slot is 0 and "n" has a value of 1, we hit the BUG_ON:
    
            (...)
            switch (tm->op) {
            case BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING:
                    BUG_ON(tm->slot < n);
                    fallthrough;
    	(...)
    
    Fix this by checking for a more recent tree mod log operation after locking
    and cloning the extent buffer of the old root node, and use it as the first
    operation to apply to the cloned extent buffer when rewinding it.
    
    Stable backport notes: due to moved code and renames, in =< 5.11 the
    change should be applied to ctree.c:get_old_root.
    
    Reported-by: Zygo Blaxell <[email protected]>
    Link: https://lore.kernel.org/linux-btrfs/[email protected]/
    Fixes: 834328a ("Btrfs: tree mod log's old roots could still be part of the tree")
    CC: [email protected] # 4.4+
    Signed-off-by: Filipe Manana <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    fdmanana authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    40b87e9 View commit details
    Browse the repository at this point in the history
  120. btrfs: fix a potential hole punching failure

    [ Upstream commit 3227788 ]
    
    In commit d778154 ("btrfs: Avoid trucating page or punching hole
    in a already existed hole."), existing holes can be skipped by calling
    find_first_non_hole() to adjust start and len. However, if the given len
    is invalid and large, when an EXTENT_MAP_HOLE extent is found, len will
    not be set to zero because (em->start + em->len) is less than
    (start + len). Then the ret will be 1 but len will not be set to 0.
    The propagated non-zero ret will result in fallocate failure.
    
    In the while-loop of btrfs_replace_file_extents(), len is not updated
    every time before it calls find_first_non_hole(). That is, after
    btrfs_drop_extents() successfully drops the last non-hole file extent,
    it may fail with ENOSPC when attempting to drop a file extent item
    representing a hole. The problem can happen. After it calls
    find_first_non_hole(), the cur_offset will be adjusted to be larger
    than or equal to end. However, since the len is not set to zero, the
    break-loop condition (ret && !len) will not be met. After it leaves the
    while-loop, fallocate will return 1, which is an unexpected return
    value.
    
    We're not able to construct a reproducible way to let
    btrfs_drop_extents() fail with ENOSPC after it drops the last non-hole
    file extent but with remaining holes left. However, it's quite easy to
    fix. We just need to update and check the len every time before we call
    find_first_non_hole(). To make the while loop more readable, we also
    pull the variable updates to the bottom of loop like this:
      while (cur_offset < end) {
    	  ...
    	  // update cur_offset & len
    	  // advance cur_offset & len in hole-punching case if needed
      }
    
    Reported-by: Robbie Ko <[email protected]>
    Fixes: d778154 ("btrfs: Avoid trucating page or punching hole in a already existed hole.")
    CC: [email protected] # 4.4+
    Reviewed-by: Robbie Ko <[email protected]>
    Reviewed-by: Chung-Chiang Cheng <[email protected]>
    Reviewed-by: Filipe Manana <[email protected]>
    Signed-off-by: BingJing Chang <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    bingjingc authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    868c10b View commit details
    Browse the repository at this point in the history
  121. arm64/vdso: Discard .note.gnu.property sections in vDSO

    [ Upstream commit 3887080 ]
    
    The arm64 assembler in binutils 2.32 and above generates a program
    property note in a note section, .note.gnu.property, to encode used x86
    ISAs and features. But the kernel linker script only contains a single
    NOTE segment:
    
      PHDRS
      {
        text    PT_LOAD    FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
        dynamic PT_DYNAMIC FLAGS(4);               /* PF_R */
        note    PT_NOTE    FLAGS(4);               /* PF_R */
      }
    
    The NOTE segment generated by the vDSO linker script is aligned to 4 bytes.
    But the .note.gnu.property section must be aligned to 8 bytes on arm64.
    
      $ readelf -n vdso64.so
    
      Displaying notes found in: .note
        Owner                Data size      Description
        Linux                0x00000004     Unknown note type: (0x00000000)
         description data: 06 00 00 00
      readelf: Warning: note with invalid namesz and/or descsz found at offset 0x20
      readelf: Warning:  type: 0x78, namesize: 0x00000100, descsize: 0x756e694c, alignment: 8
    
    Since the note.gnu.property section in the vDSO is not checked by the
    dynamic linker, discard the .note.gnu.property sections in the vDSO.
    
    Similar to commit 4caffe6 ("x86/vdso: Discard .note.gnu.property
    sections in vDSO"), but for arm64.
    
    Signed-off-by: Bill Wendling <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Acked-by: Ard Biesheuvel <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    bwendling authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    48f9d3d View commit details
    Browse the repository at this point in the history
  122. Makefile: Move -Wno-unused-but-set-variable out of GCC only block

    commit 885480b upstream.
    
    Currently, -Wunused-but-set-variable is only supported by GCC so it is
    disabled unconditionally in a GCC only block (it is enabled with W=1).
    clang currently has its implementation for this warning in review so
    preemptively move this statement out of the GCC only block and wrap it
    with cc-disable-warning so that both compilers function the same.
    
    Cc: [email protected]
    Link: https://reviews.llvm.org/D100581
    Signed-off-by: Nathan Chancellor <[email protected]>
    Reviewed-by: Nick Desaulniers <[email protected]>
    Tested-by: Nick Desaulniers <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    nathanchance authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e4228d7 View commit details
    Browse the repository at this point in the history
  123. riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe

    commit b1ebaa0 upstream.
    
    The execution of sys_read end up hitting a BUG_ON() in __find_get_block
    after installing kprobe at sys_read, the BUG message like the following:
    
    [   65.708663] ------------[ cut here ]------------
    [   65.709987] kernel BUG at fs/buffer.c:1251!
    [   65.711283] Kernel BUG [esmil#1]
    [   65.712032] Modules linked in:
    [   65.712925] CPU: 0 PID: 51 Comm: sh Not tainted 5.12.0-rc4 esmil#1
    [   65.714407] Hardware name: riscv-virtio,qemu (DT)
    [   65.715696] epc : __find_get_block+0x218/0x2c8
    [   65.716835]  ra : __getblk_gfp+0x1c/0x4a
    [   65.717831] epc : ffffffe00019f11e ra : ffffffe00019f56a sp : ffffffe002437930
    [   65.719553]  gp : ffffffe000f06030 tp : ffffffe0015abc00 t0 : ffffffe00191e038
    [   65.721290]  t1 : ffffffe00191e038 t2 : 000000000000000a s0 : ffffffe002437960
    [   65.723051]  s1 : ffffffe00160ad00 a0 : ffffffe00160ad00 a1 : 000000000000012a
    [   65.724772]  a2 : 0000000000000400 a3 : 0000000000000008 a4 : 0000000000000040
    [   65.726545]  a5 : 0000000000000000 a6 : ffffffe00191e000 a7 : 0000000000000000
    [   65.728308]  s2 : 000000000000012a s3 : 0000000000000400 s4 : 0000000000000008
    [   65.730049]  s5 : 000000000000006c s6 : ffffffe00240f800 s7 : ffffffe000f080a8
    [   65.731802]  s8 : 0000000000000001 s9 : 000000000000012a s10: 0000000000000008
    [   65.733516]  s11: 0000000000000008 t3 : 00000000000003ff t4 : 000000000000000f
    [   65.734434]  t5 : 00000000000003ff t6 : 0000000000040000
    [   65.734613] status: 0000000000000100 badaddr: 0000000000000000 cause: 0000000000000003
    [   65.734901] Call Trace:
    [   65.735076] [<ffffffe00019f11e>] __find_get_block+0x218/0x2c8
    [   65.735417] [<ffffffe00020017a>] __ext4_get_inode_loc+0xb2/0x2f6
    [   65.735618] [<ffffffe000201b6c>] ext4_get_inode_loc+0x3a/0x8a
    [   65.735802] [<ffffffe000203380>] ext4_reserve_inode_write+0x2e/0x8c
    [   65.735999] [<ffffffe00020357a>] __ext4_mark_inode_dirty+0x4c/0x18e
    [   65.736208] [<ffffffe000206bb0>] ext4_dirty_inode+0x46/0x66
    [   65.736387] [<ffffffe000192914>] __mark_inode_dirty+0x12c/0x3da
    [   65.736576] [<ffffffe000180dd2>] touch_atime+0x146/0x150
    [   65.736748] [<ffffffe00010d762>] filemap_read+0x234/0x246
    [   65.736920] [<ffffffe00010d834>] generic_file_read_iter+0xc0/0x114
    [   65.737114] [<ffffffe0001f5d7a>] ext4_file_read_iter+0x42/0xea
    [   65.737310] [<ffffffe000163f2c>] new_sync_read+0xe2/0x15a
    [   65.737483] [<ffffffe000165814>] vfs_read+0xca/0xf2
    [   65.737641] [<ffffffe000165bae>] ksys_read+0x5e/0xc8
    [   65.737816] [<ffffffe000165c26>] sys_read+0xe/0x16
    [   65.737973] [<ffffffe000003972>] ret_from_syscall+0x0/0x2
    [   65.738858] ---[ end trace fe93f985456c935d ]---
    
    A simple reproducer looks like:
    	echo 'p:myprobe sys_read fd=%a0 buf=%a1 count=%a2' > /sys/kernel/debug/tracing/kprobe_events
    	echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe/enable
    	cat /sys/kernel/debug/tracing/trace
    
    Here's what happens to hit that BUG_ON():
    
    1) After installing kprobe at entry of sys_read, the first instruction
       is replaced by 'ebreak' instruction on riscv64 platform.
    
    2) Once kernel reach the 'ebreak' instruction at the entry of sys_read,
       it trap into the riscv breakpoint handler, where it do something to
       setup for coming single-step of origin instruction, including backup
       the 'sstatus' in pt_regs, followed by disable interrupt during single
       stepping via clear 'SIE' bit of 'sstatus' in pt_regs.
    
    3) Then kernel restore to the instruction slot contains two instructions,
       one is original instruction at entry of sys_read, the other is 'ebreak'.
       Here it trigger a 'Instruction page fault' exception (value at 'scause'
       is '0xc'), if PF is not filled into PageTabe for that slot yet.
    
    4) Again kernel trap into page fault exception handler, where it choose
       different policy according to the state of running kprobe. Because
       afte 2) the state is KPROBE_HIT_SS, so kernel reset the current kprobe
       and 'pc' points back to the probe address.
    
    5) Because 'epc' point back to 'ebreak' instrution at sys_read probe,
       kernel trap into breakpoint handler again, and repeat the operations
       at 2), however 'sstatus' without 'SIE' is keep at 4), it cause the
       real 'sstatus' saved at 2) is overwritten by the one withou 'SIE'.
    
    6) When kernel cross the probe the 'sstatus' CSR restore with value
       without 'SIE', and reach __find_get_block where it requires the
       interrupt must be enabled.
    
    Fix this is very trivial, just restore the value of 'sstatus' in pt_regs
    with backup one at 2) when the instruction being single stepped cause a
    page fault.
    
    Fixes: c22b0bc ("riscv: Add kprobes supported")
    Signed-off-by: Liao Chang <[email protected]>
    Cc: [email protected]
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Liao Chang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fd0f065 View commit details
    Browse the repository at this point in the history
  124. fs: fix reporting supported extra file attributes for statx()

    commit 5afa7e8 upstream.
    
    statx(2) notes that any attribute that is not indicated as supported
    by stx_attributes_mask has no usable value.  Commits 801e523
    ("fs: move generic stat response attr handling to vfs_getattr_nosec")
    and 712b269 ("fs/stat: Define DAX statx attribute") sets
    STATX_ATTR_AUTOMOUNT and STATX_ATTR_DAX, respectively, without setting
    stx_attributes_mask, which can cause xfstests generic/532 to fail.
    
    Fix this in the same way as commit 1b9598c ("xfs: fix reporting
    supported extra file attributes for statx()")
    
    Fixes: 801e523 ("fs: move generic stat response attr handling to vfs_getattr_nosec")
    Fixes: 712b269 ("fs/stat: Define DAX statx attribute")
    Cc: [email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tytso authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    f7c80e8 View commit details
    Browse the repository at this point in the history
  125. virtiofs: fix memory leak in virtio_fs_probe()

    commit c79c5e0 upstream.
    
    When accidentally passing twice the same tag to qemu, kmemleak ended up
    reporting a memory leak in virtiofs.  Also, looking at the log I saw the
    following error (that's when I realised the duplicated tag):
    
      virtiofs: probe of virtio5 failed with error -17
    
    Here's the kmemleak log for reference:
    
    unreferenced object 0xffff888103d47800 (size 1024):
      comm "systemd-udevd", pid 118, jiffies 4294893780 (age 18.340s)
      hex dump (first 32 bytes):
        00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
        ff ff ff ff ff ff ff ff 80 90 02 a0 ff ff ff ff  ................
      backtrace:
        [<000000000ebb87c1>] virtio_fs_probe+0x171/0x7ae [virtiofs]
        [<00000000f8aca419>] virtio_dev_probe+0x15f/0x210
        [<000000004d6baf3c>] really_probe+0xea/0x430
        [<00000000a6ceeac8>] device_driver_attach+0xa8/0xb0
        [<00000000196f47a7>] __driver_attach+0x98/0x140
        [<000000000b20601d>] bus_for_each_dev+0x7b/0xc0
        [<00000000399c7b7f>] bus_add_driver+0x11b/0x1f0
        [<0000000032b09ba7>] driver_register+0x8f/0xe0
        [<00000000cdd55998>] 0xffffffffa002c013
        [<000000000ea196a2>] do_one_initcall+0x64/0x2e0
        [<0000000008f727ce>] do_init_module+0x5c/0x260
        [<000000003cdedab6>] __do_sys_finit_module+0xb5/0x120
        [<00000000ad2f48c6>] do_syscall_64+0x33/0x40
        [<00000000809526b5>] entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    Cc: [email protected]
    Signed-off-by: Luis Henriques <[email protected]>
    Fixes: a62a8ef ("virtio-fs: add virtiofs filesystem")
    Reviewed-by: Stefan Hajnoczi <[email protected]>
    Reviewed-by: Vivek Goyal <[email protected]>
    Signed-off-by: Miklos Szeredi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    luis-henrix authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    5116e79 View commit details
    Browse the repository at this point in the history
  126. kcsan, debugfs: Move debugfs file creation out of early init

    commit e36299e upstream.
    
    Commit 5634856 ("debugfs: do not attempt to create a new file
    before the filesystem is initalized") forbids creating new debugfs files
    until debugfs is fully initialized.  This means that KCSAN's debugfs
    file creation, which happened at the end of __init(), no longer works.
    And was apparently never supposed to work!
    
    However, there is no reason to create KCSAN's debugfs file so early.
    This commit therefore moves its creation to a late_initcall() callback.
    
    Cc: "Rafael J. Wysocki" <[email protected]>
    Cc: stable <[email protected]>
    Fixes: 5634856 ("debugfs: do not attempt to create a new file before the filesystem is initalized")
    Reviewed-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Marco Elver <[email protected]>
    Signed-off-by: Paul E. McKenney <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    melver authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2053325 View commit details
    Browse the repository at this point in the history
  127. ubifs: Only check replay with inode type to judge if inode linked

    commit 3e90331 upstream.
    
    Conside the following case, it just write a big file into flash,
    when complete writing, delete the file, and then power off promptly.
    Next time power on, we'll get a replay list like:
    ...
    LEB 1105:211344 len 4144 deletion 0 sqnum 428783 key type 1 inode 80
    LEB 15:233544 len 160 deletion 1 sqnum 428785 key type 0 inode 80
    LEB 1105:215488 len 4144 deletion 0 sqnum 428787 key type 1 inode 80
    ...
    In the replay list, data nodes' deletion are 0, and the inode node's
    deletion is 1. In current logic, the file's dentry will be removed,
    but inode and the flash space it occupied will be reserved.
    User will see that much free space been disappeared.
    
    We only need to check the deletion value of the following inode type
    node of the replay entry.
    
    Fixes: e58725d ("ubifs: Handle re-linking of inodes correctly while recovery")
    Cc: [email protected]
    Signed-off-by: Guochun Mao <[email protected]>
    Signed-off-by: Richard Weinberger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Guochun Mao authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    325b731 View commit details
    Browse the repository at this point in the history
  128. f2fs: fix error handling in f2fs_end_enable_verity()

    commit 3c03154 upstream.
    
    f2fs didn't properly clean up if verity failed to be enabled on a file:
    
    - It left verity metadata (pages past EOF) in the page cache, which
      would be exposed to userspace if the file was later extended.
    
    - It didn't truncate the verity metadata at all (either from cache or
      from disk) if an error occurred while setting the verity bit.
    
    Fix these bugs by adding a call to truncate_inode_pages() and ensuring
    that we truncate the verity metadata (both from cache and from disk) in
    all error paths.  Also rework the code to cleanly separate the success
    path from the error paths, which makes it much easier to understand.
    
    Finally, log a message if f2fs_truncate() fails, since it might
    otherwise fail silently.
    
    Reported-by: Yunlei He <[email protected]>
    Fixes: 95ae251 ("f2fs: add fs-verity support")
    Cc: <[email protected]> # v5.4+
    Signed-off-by: Eric Biggers <[email protected]>
    Reviewed-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ebiggers authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    befeb96 View commit details
    Browse the repository at this point in the history
  129. f2fs: fix to avoid out-of-bounds memory access

    commit b862676 upstream.
    
    butt3rflyh4ck <[email protected]> reported a bug found by
    syzkaller fuzzer with custom modifications in 5.12.0-rc3+ [1]:
    
     dump_stack+0xfa/0x151 lib/dump_stack.c:120
     print_address_description.constprop.0.cold+0x82/0x32c mm/kasan/report.c:232
     __kasan_report mm/kasan/report.c:399 [inline]
     kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416
     f2fs_test_bit fs/f2fs/f2fs.h:2572 [inline]
     current_nat_addr fs/f2fs/node.h:213 [inline]
     get_next_nat_page fs/f2fs/node.c:123 [inline]
     __flush_nat_entry_set fs/f2fs/node.c:2888 [inline]
     f2fs_flush_nat_entries+0x258e/0x2960 fs/f2fs/node.c:2991
     f2fs_write_checkpoint+0x1372/0x6a70 fs/f2fs/checkpoint.c:1640
     f2fs_issue_checkpoint+0x149/0x410 fs/f2fs/checkpoint.c:1807
     f2fs_sync_fs+0x20f/0x420 fs/f2fs/super.c:1454
     __sync_filesystem fs/sync.c:39 [inline]
     sync_filesystem fs/sync.c:67 [inline]
     sync_filesystem+0x1b5/0x260 fs/sync.c:48
     generic_shutdown_super+0x70/0x370 fs/super.c:448
     kill_block_super+0x97/0xf0 fs/super.c:1394
    
    The root cause is, if nat entry in checkpoint journal area is corrupted,
    e.g. nid of journalled nat entry exceeds max nid value, during checkpoint,
    once it tries to flush nat journal to NAT area, get_next_nat_page() may
    access out-of-bounds memory on nat_bitmap due to it uses wrong nid value
    as bitmap offset.
    
    [1] https://lore.kernel.org/lkml/CAFcO6XOMWdr8pObek6eN6-fs58KG9doRFadgJj-FnF-1x43s2g@mail.gmail.com/T/#u
    
    Reported-and-tested-by: butt3rflyh4ck <[email protected]>
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    chaseyu authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0b60f23 View commit details
    Browse the repository at this point in the history
  130. mlxsw: spectrum_mr: Update egress RIF list before route's action

    commit cbaf3f6 upstream.
    
    Each multicast route that is forwarding packets (as opposed to trapping
    them) points to a list of egress router interfaces (RIFs) through which
    packets are replicated.
    
    A route's action can transition from trap to forward when a RIF is
    created for one of the route's egress virtual interfaces (eVIF). When
    this happens, the route's action is first updated and only later the
    list of egress RIFs is committed to the device.
    
    This results in the route pointing to an invalid list. In case the list
    pointer is out of range (due to uninitialized memory), the device will
    complain:
    
    mlxsw_spectrum2 0000:06:00.0: EMAD reg access failed (tid=5733bf490000905c,reg_id=300f(pefa),type=write,status=7(bad parameter))
    
    Fix this by first committing the list of egress RIFs to the device and
    only later update the route's action.
    
    Note that a fix is not needed in the reverse function (i.e.,
    mlxsw_sp_mr_route_evif_unresolve()), as there the route's action is
    first updated and only later the RIF is removed from the list.
    
    Cc: [email protected]
    Fixes: c011ec1 ("mlxsw: spectrum: Add the multicast routing offloading logic")
    Signed-off-by: Ido Schimmel <[email protected]>
    Reviewed-by: Petr Machata <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    idosch authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e0041e2 View commit details
    Browse the repository at this point in the history
  131. openvswitch: fix stack OOB read while fragmenting IPv4 packets

    commit 7c0ea59 upstream.
    
    running openvswitch on kernels built with KASAN, it's possible to see the
    following splat while testing fragmentation of IPv4 packets:
    
     BUG: KASAN: stack-out-of-bounds in ip_do_fragment+0x1b03/0x1f60
     Read of size 1 at addr ffff888112fc713c by task handler2/1367
    
     CPU: 0 PID: 1367 Comm: handler2 Not tainted 5.12.0-rc6+ torvalds#418
     Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014
     Call Trace:
      dump_stack+0x92/0xc1
      print_address_description.constprop.7+0x1a/0x150
      kasan_report.cold.13+0x7f/0x111
      ip_do_fragment+0x1b03/0x1f60
      ovs_fragment+0x5bf/0x840 [openvswitch]
      do_execute_actions+0x1bd5/0x2400 [openvswitch]
      ovs_execute_actions+0xc8/0x3d0 [openvswitch]
      ovs_packet_cmd_execute+0xa39/0x1150 [openvswitch]
      genl_family_rcv_msg_doit.isra.15+0x227/0x2d0
      genl_rcv_msg+0x287/0x490
      netlink_rcv_skb+0x120/0x380
      genl_rcv+0x24/0x40
      netlink_unicast+0x439/0x630
      netlink_sendmsg+0x719/0xbf0
      sock_sendmsg+0xe2/0x110
      ____sys_sendmsg+0x5ba/0x890
      ___sys_sendmsg+0xe9/0x160
      __sys_sendmsg+0xd3/0x170
      do_syscall_64+0x33/0x40
      entry_SYSCALL_64_after_hwframe+0x44/0xae
     RIP: 0033:0x7f957079db07
     Code: c3 66 90 41 54 41 89 d4 55 48 89 f5 53 89 fb 48 83 ec 10 e8 eb ec ff ff 44 89 e2 48 89 ee 89 df 41 89 c0 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 48 89 44 24 08 e8 24 ed ff ff 48
     RSP: 002b:00007f956ce35a50 EFLAGS: 00000293 ORIG_RAX: 000000000000002e
     RAX: ffffffffffffffda RBX: 0000000000000019 RCX: 00007f957079db07
     RDX: 0000000000000000 RSI: 00007f956ce35ae0 RDI: 0000000000000019
     RBP: 00007f956ce35ae0 R08: 0000000000000000 R09: 00007f9558006730
     R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
     R13: 00007f956ce37308 R14: 00007f956ce35f80 R15: 00007f956ce35ae0
    
     The buggy address belongs to the page:
     page:00000000af2a1d93 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x112fc7
     flags: 0x17ffffc0000000()
     raw: 0017ffffc0000000 0000000000000000 dead000000000122 0000000000000000
     raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
     page dumped because: kasan: bad access detected
    
     addr ffff888112fc713c is located in stack of task handler2/1367 at offset 180 in frame:
      ovs_fragment+0x0/0x840 [openvswitch]
    
     this frame has 2 objects:
      [32, 144) 'ovs_dst'
      [192, 424) 'ovs_rt'
    
     Memory state around the buggy address:
      ffff888112fc7000: f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ffff888112fc7080: 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00
     >ffff888112fc7100: 00 00 00 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00
                                             ^
      ffff888112fc7180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ffff888112fc7200: 00 00 00 00 00 00 f2 f2 f2 00 00 00 00 00 00 00
    
    for IPv4 packets, ovs_fragment() uses a temporary struct dst_entry. Then,
    in the following call graph:
    
      ip_do_fragment()
        ip_skb_dst_mtu()
          ip_dst_mtu_maybe_forward()
            ip_mtu_locked()
    
    the pointer to struct dst_entry is used as pointer to struct rtable: this
    turns the access to struct members like rt_mtu_locked into an OOB read in
    the stack. Fix this changing the temporary variable used for IPv4 packets
    in ovs_fragment(), similarly to what is done for IPv6 few lines below.
    
    Fixes: d52e5a7 ("ipv4: lock mtu in fnhe when received PMTU < net.ipv4.route.min_pmt")
    Cc: <[email protected]>
    Acked-by: Eelco Chaudron <[email protected]>
    Signed-off-by: Davide Caratti <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    dcaratti authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b3502b0 View commit details
    Browse the repository at this point in the history
  132. net/sched: sch_frag: fix stack OOB read while fragmenting IPv4 packets

    commit 31fe34a upstream.
    
    when 'act_mirred' tries to fragment IPv4 packets that had been previously
    re-assembled using 'act_ct', splats like the following can be observed on
    kernels built with KASAN:
    
     BUG: KASAN: stack-out-of-bounds in ip_do_fragment+0x1b03/0x1f60
     Read of size 1 at addr ffff888147009574 by task ping/947
    
     CPU: 0 PID: 947 Comm: ping Not tainted 5.12.0-rc6+ torvalds#418
     Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014
     Call Trace:
      <IRQ>
      dump_stack+0x92/0xc1
      print_address_description.constprop.7+0x1a/0x150
      kasan_report.cold.13+0x7f/0x111
      ip_do_fragment+0x1b03/0x1f60
      sch_fragment+0x4bf/0xe40
      tcf_mirred_act+0xc3d/0x11a0 [act_mirred]
      tcf_action_exec+0x104/0x3e0
      fl_classify+0x49a/0x5e0 [cls_flower]
      tcf_classify_ingress+0x18a/0x820
      __netif_receive_skb_core+0xae7/0x3340
      __netif_receive_skb_one_core+0xb6/0x1b0
      process_backlog+0x1ef/0x6c0
      __napi_poll+0xaa/0x500
      net_rx_action+0x702/0xac0
      __do_softirq+0x1e4/0x97f
      do_softirq+0x71/0x90
      </IRQ>
      __local_bh_enable_ip+0xdb/0xf0
      ip_finish_output2+0x760/0x2120
      ip_do_fragment+0x15a5/0x1f60
      __ip_finish_output+0x4c2/0xea0
      ip_output+0x1ca/0x4d0
      ip_send_skb+0x37/0xa0
      raw_sendmsg+0x1c4b/0x2d00
      sock_sendmsg+0xdb/0x110
      __sys_sendto+0x1d7/0x2b0
      __x64_sys_sendto+0xdd/0x1b0
      do_syscall_64+0x33/0x40
      entry_SYSCALL_64_after_hwframe+0x44/0xae
     RIP: 0033:0x7f82e13853eb
     Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 f3 0f 1e fa 48 8d 05 75 42 2c 00 41 89 ca 8b 00 85 c0 75 14 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 75 c3 0f 1f 40 00 41 57 4d 89 c7 41 56 41 89
     RSP: 002b:00007ffe01fad888 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
     RAX: ffffffffffffffda RBX: 00005571aac13700 RCX: 00007f82e13853eb
     RDX: 0000000000002330 RSI: 00005571aac13700 RDI: 0000000000000003
     RBP: 0000000000002330 R08: 00005571aac10500 R09: 0000000000000010
     R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe01faefb0
     R13: 00007ffe01fad890 R14: 00007ffe01fad980 R15: 00005571aac0f0a0
    
     The buggy address belongs to the page:
     page:000000001dff2e03 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x147009
     flags: 0x17ffffc0001000(reserved)
     raw: 0017ffffc0001000 ffffea00051c0248 ffffea00051c0248 0000000000000000
     raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
     page dumped because: kasan: bad access detected
    
     Memory state around the buggy address:
      ffff888147009400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ffff888147009480: f1 f1 f1 f1 04 f2 f2 f2 f2 f2 f2 f2 00 00 00 00
     >ffff888147009500: 00 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 f2 f2
                                                                  ^
      ffff888147009580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ffff888147009600: 00 00 00 00 00 00 00 00 00 00 00 00 00 f2 f2 f2
    
    for IPv4 packets, sch_fragment() uses a temporary struct dst_entry. Then,
    in the following call graph:
    
      ip_do_fragment()
        ip_skb_dst_mtu()
          ip_dst_mtu_maybe_forward()
            ip_mtu_locked()
    
    the pointer to struct dst_entry is used as pointer to struct rtable: this
    turns the access to struct members like rt_mtu_locked into an OOB read in
    the stack. Fix this changing the temporary variable used for IPv4 packets
    in sch_fragment(), similarly to what is done for IPv6 few lines below.
    
    Fixes: c129412 ("net/sched: sch_frag: add generic packet fragment support.")
    Cc: <[email protected]> # 5.11
    Reported-by: Shuang Li <[email protected]>
    Acked-by: Marcelo Ricardo Leitner <[email protected]>
    Acked-by: Cong Wang <[email protected]>
    Signed-off-by: Davide Caratti <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    dcaratti authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    8e6dfb7 View commit details
    Browse the repository at this point in the history
  133. ACPI: GTDT: Don't corrupt interrupt mappings on watchdow probe failure

    commit 1ecd5b1 upstream.
    
    When failing the driver probe because of invalid firmware properties,
    the GTDT driver unmaps the interrupt that it mapped earlier.
    
    However, it never checks whether the mapping of the interrupt actially
    succeeded. Even more, should the firmware report an illegal interrupt
    number that overlaps with the GIC SGI range, this can result in an
    IPI being unmapped, and subsequent fireworks (as reported by Dann
    Frazier).
    
    Rework the driver to have a slightly saner behaviour and actually
    check whether the interrupt has been mapped before unmapping things.
    
    Reported-by: dann frazier <[email protected]>
    Fixes: ca9ae5e ("acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver")
    Signed-off-by: Marc Zyngier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Cc: <[email protected]>
    Cc: Fu Wei <[email protected]>
    Reviewed-by: Sudeep Holla <[email protected]>
    Tested-by: dann frazier <[email protected]>
    Tested-by: Hanjun Guo <[email protected]>
    Reviewed-by: Hanjun Guo <[email protected]>
    Reviewed-by: Lorenzo Pieralisi <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Catalin Marinas <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Marc Zyngier authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    596e079 View commit details
    Browse the repository at this point in the history
  134. NFS: fs_context: validate UDP retrans to prevent shift out-of-bounds

    commit c09f11e upstream.
    
    Fix shift out-of-bounds in xprt_calc_majortimeo(). This is caused
    by a garbage timeout (retrans) mount option being passed to nfs mount,
    in this case from syzkaller.
    
    If the protocol is XPRT_TRANSPORT_UDP, then 'retrans' is a shift
    value for a 64-bit long integer, so 'retrans' cannot be >= 64.
    If it is >= 64, fail the mount and return an error.
    
    Fixes: 9954bf9 ("NFS: Move mount parameterisation bits into their own file")
    Reported-by: [email protected]
    Reported-by: [email protected]
    Signed-off-by: Randy Dunlap <[email protected]>
    Cc: Trond Myklebust <[email protected]>
    Cc: Anna Schumaker <[email protected]>
    Cc: [email protected]
    Cc: David Howells <[email protected]>
    Cc: Al Viro <[email protected]>
    Cc: [email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rddunlap authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    3d01638 View commit details
    Browse the repository at this point in the history
  135. NFS: Don't discard pNFS layout segments that are marked for return

    commit 39fd018 upstream.
    
    If the pNFS layout segment is marked with the NFS_LSEG_LAYOUTRETURN
    flag, then the assumption is that it has some reporting requirement
    to perform through a layoutreturn (e.g. flexfiles layout stats or error
    information).
    
    Fixes: e0b7d42 ("pNFS: Don't discard layout segments that are marked for return")
    Cc: [email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Trond Myklebust authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    7cf20aa View commit details
    Browse the repository at this point in the history
  136. NFSv4: Don't discard segments marked for return in _pnfs_return_layout()

    commit de144ff upstream.
    
    If the pNFS layout segment is marked with the NFS_LSEG_LAYOUTRETURN
    flag, then the assumption is that it has some reporting requirement
    to perform through a layoutreturn (e.g. flexfiles layout stats or error
    information).
    
    Fixes: 6d597e1 ("pnfs: only tear down lsegs that precede seqid in LAYOUTRETURN args")
    Cc: [email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Trond Myklebust authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    7e65ea8 View commit details
    Browse the repository at this point in the history
  137. Input: ili210x - add missing negation for touch indication on ili210x

    commit ac05a8a upstream.
    
    This adds the negation needed for proper finger detection on Ilitek
    ili2107/ili210x. This fixes polling issues (on Amazon Kindle Fire)
    caused by returning false for the cooresponding finger on the touchscreen.
    
    Signed-off-by: Hansem Ro <[email protected]>
    Fixes: e355944 ("ili210x - rework the touchscreen sample processing")
    Cc: [email protected]
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    hansemro authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    5f41065 View commit details
    Browse the repository at this point in the history
  138. jffs2: Fix kasan slab-out-of-bounds problem

    commit 960b9a8 upstream.
    
    KASAN report a slab-out-of-bounds problem. The logs are listed below.
    It is because in function jffs2_scan_dirent_node, we alloc "checkedlen+1"
    bytes for fd->name and we check crc with length rd->nsize. If checkedlen
    is less than rd->nsize, it will cause the slab-out-of-bounds problem.
    
    jffs2: Dirent at *** has zeroes in name. Truncating to %d char
    ==================================================================
    BUG: KASAN: slab-out-of-bounds in crc32_le+0x1ce/0x260 at addr ffff8800842cf2d1
    Read of size 1 by task test_JFFS2/915
    =============================================================================
    BUG kmalloc-64 (Tainted: G    B      O   ): kasan: bad access detected
    -----------------------------------------------------------------------------
    INFO: Allocated in jffs2_alloc_full_dirent+0x2a/0x40 age=0 cpu=1 pid=915
    	___slab_alloc+0x580/0x5f0
    	__slab_alloc.isra.24+0x4e/0x64
    	__kmalloc+0x170/0x300
    	jffs2_alloc_full_dirent+0x2a/0x40
    	jffs2_scan_eraseblock+0x1ca4/0x3b64
    	jffs2_scan_medium+0x285/0xfe0
    	jffs2_do_mount_fs+0x5fb/0x1bbc
    	jffs2_do_fill_super+0x245/0x6f0
    	jffs2_fill_super+0x287/0x2e0
    	mount_mtd_aux.isra.0+0x9a/0x144
    	mount_mtd+0x222/0x2f0
    	jffs2_mount+0x41/0x60
    	mount_fs+0x63/0x230
    	vfs_kern_mount.part.6+0x6c/0x1f4
    	do_mount+0xae8/0x1940
    	SyS_mount+0x105/0x1d0
    INFO: Freed in jffs2_free_full_dirent+0x22/0x40 age=27 cpu=1 pid=915
    	__slab_free+0x372/0x4e4
    	kfree+0x1d4/0x20c
    	jffs2_free_full_dirent+0x22/0x40
    	jffs2_build_remove_unlinked_inode+0x17a/0x1e4
    	jffs2_do_mount_fs+0x1646/0x1bbc
    	jffs2_do_fill_super+0x245/0x6f0
    	jffs2_fill_super+0x287/0x2e0
    	mount_mtd_aux.isra.0+0x9a/0x144
    	mount_mtd+0x222/0x2f0
    	jffs2_mount+0x41/0x60
    	mount_fs+0x63/0x230
    	vfs_kern_mount.part.6+0x6c/0x1f4
    	do_mount+0xae8/0x1940
    	SyS_mount+0x105/0x1d0
    	entry_SYSCALL_64_fastpath+0x1e/0x97
    Call Trace:
     [<ffffffff815befef>] dump_stack+0x59/0x7e
     [<ffffffff812d1d65>] print_trailer+0x125/0x1b0
     [<ffffffff812d82c8>] object_err+0x34/0x40
     [<ffffffff812dadef>] kasan_report.part.1+0x21f/0x534
     [<ffffffff81132401>] ? vprintk+0x2d/0x40
     [<ffffffff815f1ee2>] ? crc32_le+0x1ce/0x260
     [<ffffffff812db41a>] kasan_report+0x26/0x30
     [<ffffffff812d9fc1>] __asan_load1+0x3d/0x50
     [<ffffffff815f1ee2>] crc32_le+0x1ce/0x260
     [<ffffffff814764ae>] ? jffs2_alloc_full_dirent+0x2a/0x40
     [<ffffffff81485cec>] jffs2_scan_eraseblock+0x1d0c/0x3b64
     [<ffffffff81488813>] ? jffs2_scan_medium+0xccf/0xfe0
     [<ffffffff81483fe0>] ? jffs2_scan_make_ino_cache+0x14c/0x14c
     [<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
     [<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
     [<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
     [<ffffffff812d5d90>] ? kmem_cache_alloc_trace+0x10c/0x2cc
     [<ffffffff818169fb>] ? mtd_point+0xf7/0x130
     [<ffffffff81487dc9>] jffs2_scan_medium+0x285/0xfe0
     [<ffffffff81487b44>] ? jffs2_scan_eraseblock+0x3b64/0x3b64
     [<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
     [<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
     [<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
     [<ffffffff812d57df>] ? __kmalloc+0x12b/0x300
     [<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
     [<ffffffff814a2753>] ? jffs2_sum_init+0x9f/0x240
     [<ffffffff8148b2ff>] jffs2_do_mount_fs+0x5fb/0x1bbc
     [<ffffffff8148ad04>] ? jffs2_del_noinode_dirent+0x640/0x640
     [<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
     [<ffffffff81127c5b>] ? __init_rwsem+0x97/0xac
     [<ffffffff81492349>] jffs2_do_fill_super+0x245/0x6f0
     [<ffffffff81493c5b>] jffs2_fill_super+0x287/0x2e0
     [<ffffffff814939d4>] ? jffs2_parse_options+0x594/0x594
     [<ffffffff81819bea>] mount_mtd_aux.isra.0+0x9a/0x144
     [<ffffffff81819eb6>] mount_mtd+0x222/0x2f0
     [<ffffffff814939d4>] ? jffs2_parse_options+0x594/0x594
     [<ffffffff81819c94>] ? mount_mtd_aux.isra.0+0x144/0x144
     [<ffffffff81258757>] ? free_pages+0x13/0x1c
     [<ffffffff814fa0ac>] ? selinux_sb_copy_data+0x278/0x2e0
     [<ffffffff81492b35>] jffs2_mount+0x41/0x60
     [<ffffffff81302fb7>] mount_fs+0x63/0x230
     [<ffffffff8133755f>] ? alloc_vfsmnt+0x32f/0x3b0
     [<ffffffff81337f2c>] vfs_kern_mount.part.6+0x6c/0x1f4
     [<ffffffff8133ceec>] do_mount+0xae8/0x1940
     [<ffffffff811b94e0>] ? audit_filter_rules.constprop.6+0x1d10/0x1d10
     [<ffffffff8133c404>] ? copy_mount_string+0x40/0x40
     [<ffffffff812cbf78>] ? alloc_pages_current+0xa4/0x1bc
     [<ffffffff81253a89>] ? __get_free_pages+0x25/0x50
     [<ffffffff81338993>] ? copy_mount_options.part.17+0x183/0x264
     [<ffffffff8133e3a9>] SyS_mount+0x105/0x1d0
     [<ffffffff8133e2a4>] ? copy_mnt_ns+0x560/0x560
     [<ffffffff810e8391>] ? msa_space_switch_handler+0x13d/0x190
     [<ffffffff81be184a>] entry_SYSCALL_64_fastpath+0x1e/0x97
     [<ffffffff810e9274>] ? msa_space_switch+0xb0/0xe0
    Memory state around the buggy address:
     ffff8800842cf180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
     ffff8800842cf200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    >ffff8800842cf280: fc fc fc fc fc fc 00 00 00 00 01 fc fc fc fc fc
                                                     ^
     ffff8800842cf300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
     ffff8800842cf380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    ==================================================================
    
    Cc: [email protected]
    Reported-by: Kunkun Xu <[email protected]>
    Signed-off-by: lizhe <[email protected]>
    Signed-off-by: Richard Weinberger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    lizhe authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    58db0dd View commit details
    Browse the repository at this point in the history
  139. jffs2: Hook up splice_write callback

    commit 42984af upstream.
    
    overlayfs using jffs2 as the upper filesystem would fail in some cases
    since moving to v5.10. The test case used was to run 'touch' on a file
    that exists in the lower fs, causing the modification time to be
    updated. It returns EINVAL when the bug is triggered.
    
    A bisection showed this was introduced in v5.9-rc1, with commit
    36e2c74 ("fs: don't allow splice read/write without explicit ops").
    Reverting that commit restores the expected behaviour.
    
    Some digging showed that this was due to jffs2 lacking an implementation
    of splice_write. (For unknown reasons the warn_unsupported that should
    trigger was not displaying any output).
    
    Adding this patch resolved the issue and the test now passes.
    
    Cc: [email protected]
    Fixes: 36e2c74 ("fs: don't allow splice read/write without explicit ops")
    Signed-off-by: Joel Stanley <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Tested-by: Lei YU <[email protected]>
    Signed-off-by: Richard Weinberger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    shenki authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a72354b View commit details
    Browse the repository at this point in the history
  140. iommu/vt-d: Force to flush iotlb before creating superpage

    commit 38c527a upstream.
    
    The translation caches may preserve obsolete data when the
    mapping size is changed, suppose the following sequence which
    can reveal the problem with high probability.
    
    1.mmap(4GB,MAP_HUGETLB)
    2.
      while (1) {
       (a)    DMA MAP   0,0xa0000
       (b)    DMA UNMAP 0,0xa0000
       (c)    DMA MAP   0,0xc0000000
                 * DMA read IOVA 0 may failure here (Not present)
                 * if the problem occurs.
       (d)    DMA UNMAP 0,0xc0000000
      }
    
    The page table(only focus on IOVA 0) after (a) is:
     PML4: 0x19db5c1003   entry:0xffff899bdcd2f000
      PDPE: 0x1a1cacb003  entry:0xffff89b35b5c1000
       PDE: 0x1a30a72003  entry:0xffff89b39cacb000
        PTE: 0x21d200803  entry:0xffff89b3b0a72000
    
    The page table after (b) is:
     PML4: 0x19db5c1003   entry:0xffff899bdcd2f000
      PDPE: 0x1a1cacb003  entry:0xffff89b35b5c1000
       PDE: 0x1a30a72003  entry:0xffff89b39cacb000
        PTE: 0x0          entry:0xffff89b3b0a72000
    
    The page table after (c) is:
     PML4: 0x19db5c1003   entry:0xffff899bdcd2f000
      PDPE: 0x1a1cacb003  entry:0xffff89b35b5c1000
       PDE: 0x21d200883   entry:0xffff89b39cacb000 (*)
    
    Because the PDE entry after (b) is present, it won't be
    flushed even if the iommu driver flush cache when unmap,
    so the obsolete data may be preserved in cache, which
    would cause the wrong translation at end.
    
    However, we can see the PDE entry is finally switch to
    2M-superpage mapping, but it does not transform
    to 0x21d200883 directly:
    
    1. PDE: 0x1a30a72003
    2. __domain_mapping
         dma_pte_free_pagetable
           Set the PDE entry to ZERO
         Set the PDE entry to 0x21d200883
    
    So we must flush the cache after the entry switch to ZERO
    to avoid the obsolete info be preserved.
    
    Cc: David Woodhouse <[email protected]>
    Cc: Lu Baolu <[email protected]>
    Cc: Nadav Amit <[email protected]>
    Cc: Alex Williamson <[email protected]>
    Cc: Joerg Roedel <[email protected]>
    Cc: Kevin Tian <[email protected]>
    Cc: Gonglei (Arei) <[email protected]>
    
    Fixes: 6491d4d ("intel-iommu: Free old page tables before creating superpage")
    Cc: <[email protected]> # v3.0+
    Link: https://lore.kernel.org/linux-iommu/[email protected]/
    Suggested-by: Lu Baolu <[email protected]>
    Signed-off-by: Longpeng(Mike) <[email protected]>
    Acked-by: Lu Baolu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Joerg Roedel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Longpeng(Mike) authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    43aa1cf View commit details
    Browse the repository at this point in the history
  141. powerpc/vdso: Separate vvar vma from vdso

    commit 1c4bce6 upstream.
    
    Since commit 511157a ("powerpc/vdso: Move vdso datapage up front")
    VVAR page is in front of the VDSO area. In result it breaks CRIU
    (Checkpoint Restore In Userspace) [1], where CRIU expects that "[vdso]"
    from /proc/../maps points at ELF/vdso image, rather than at VVAR data page.
    Laurent made a patch to keep CRIU working (by reading aux vector).
    But I think it still makes sence to separate two mappings into different
    VMAs. It will also make ppc64 less "special" for userspace and as
    a side-bonus will make VVAR page un-writable by debugger (which previously
    would COW page and can be unexpected).
    
    I opportunistically Cc stable on it: I understand that usually such
    stuff isn't a stable material, but that will allow us in CRIU have
    one workaround less that is needed just for one release (v5.11) on
    one platform (ppc64), which we otherwise have to maintain.
    I wouldn't go as far as to say that the commit 511157a is ABI
    regression as no other userspace got broken, but I'd really appreciate
    if it gets backported to v5.11 after v5.12 is released, so as not
    to complicate already non-simple CRIU-vdso code. Thanks!
    
    [1]: checkpoint-restore/criu#1417
    
    Cc: [email protected] # v5.11
    Signed-off-by: Dmitry Safonov <[email protected]>
    Signed-off-by: Christophe Leroy <[email protected]>
    Tested-by: Christophe Leroy <[email protected]>
    Reviewed-by: Vincenzo Frascino <[email protected]> # vDSO parts.
    Acked-by: Andrei Vagin <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/f401eb1ebc0bfc4d8f0e10dc8e525fd409eb68e2.1617209142.git.christophe.leroy@csgroup.eu
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    0x7f454c46 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    f486ef7 View commit details
    Browse the repository at this point in the history
  142. powerpc/powernv: Enable HAIL (HV AIL) for ISA v3.1 processors

    commit 49c1d07 upstream.
    
    Starting with ISA v3.1, LPCR[AIL] no longer controls the interrupt
    mode for HV=1 interrupts. Instead, a new LPCR[HAIL] bit is defined
    which behaves like AIL=3 for HV interrupts when set.
    
    Set HAIL on bare metal to give us mmu-on interrupts and improve
    performance.
    
    This also fixes an scv bug: we don't implement scv real mode (AIL=0)
    vectors because they are at an inconvenient location, so we just
    disable scv support when AIL can not be set. However powernv assumes
    that LPCR[AIL] will enable AIL mode so it enables scv support despite
    HV interrupts being AIL=0, which causes scv interrupts to go off into
    the weeds.
    
    Fixes: 7fa95f9 ("powerpc/64s: system call support for scv/rfscv instructions")
    Cc: [email protected] # v5.9+
    Signed-off-by: Nicholas Piggin <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    npiggin authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a9a8818 View commit details
    Browse the repository at this point in the history
  143. powerpc/eeh: Fix EEH handling for hugepages in ioremap space.

    commit 5ae5bc1 upstream.
    
    During the EEH MMIO error checking, the current implementation fails to map
    the (virtual) MMIO address back to the pci device on radix with hugepage
    mappings for I/O. This results into failure to dispatch EEH event with no
    recovery even when EEH capability has been enabled on the device.
    
    eeh_check_failure(token)		# token = virtual MMIO address
      addr = eeh_token_to_phys(token);
      edev = eeh_addr_cache_get_dev(addr);
      if (!edev)
    	return 0;
      eeh_dev_check_failure(edev);	<= Dispatch the EEH event
    
    In case of hugepage mappings, eeh_token_to_phys() has a bug in virt -> phys
    translation that results in wrong physical address, which is then passed to
    eeh_addr_cache_get_dev() to match it against cached pci I/O address ranges
    to get to a PCI device. Hence, it fails to find a match and the EEH event
    never gets dispatched leaving the device in failed state.
    
    The commit 3343962 ("powerpc/eeh: Handle hugepages in ioremap space")
    introduced following logic to translate virt to phys for hugepage mappings:
    
    eeh_token_to_phys():
    +	pa = pte_pfn(*ptep);
    +
    +	/* On radix we can do hugepage mappings for io, so handle that */
    +       if (hugepage_shift) {
    +               pa <<= hugepage_shift;			<= This is wrong
    +               pa |= token & ((1ul << hugepage_shift) - 1);
    +       }
    
    This patch fixes the virt -> phys translation in eeh_token_to_phys()
    function.
    
      $ cat /sys/kernel/debug/powerpc/eeh_address_cache
      mem addr range [0x0000040080000000-0x00000400807fffff]: 0030:01:00.1
      mem addr range [0x0000040080800000-0x0000040080ffffff]: 0030:01:00.1
      mem addr range [0x0000040081000000-0x00000400817fffff]: 0030:01:00.0
      mem addr range [0x0000040081800000-0x0000040081ffffff]: 0030:01:00.0
      mem addr range [0x0000040082000000-0x000004008207ffff]: 0030:01:00.1
      mem addr range [0x0000040082080000-0x00000400820fffff]: 0030:01:00.0
      mem addr range [0x0000040082100000-0x000004008210ffff]: 0030:01:00.1
      mem addr range [0x0000040082110000-0x000004008211ffff]: 0030:01:00.0
    
    Above is the list of cached io address ranges of pci 0030:01:00.<fn>.
    
    Before this patch:
    
    Tracing 'arg1' of function eeh_addr_cache_get_dev() during error injection
    clearly shows that 'addr=' contains wrong physical address:
    
       kworker/u16:0-7       [001] ....   108.883775: eeh_addr_cache_get_dev:
    	   (eeh_addr_cache_get_dev+0xc/0xf0) addr=0x80103000a510
    
    dmesg shows no EEH recovery messages:
    
      [  108.563768] bnx2x: [bnx2x_timer:5801(eth2)]MFW seems hanged: drv_pulse (0x9ae) != mcp_pulse (0x7fff)
      [  108.563788] bnx2x: [bnx2x_hw_stats_update:870(eth2)]NIG timer max (4294967295)
      [  108.883788] bnx2x: [bnx2x_acquire_hw_lock:2013(eth1)]lock_status 0xffffffff  resource_bit 0x1
      [  108.884407] bnx2x 0030:01:00.0 eth1: MDC/MDIO access timeout
      [  108.884976] bnx2x 0030:01:00.0 eth1: MDC/MDIO access timeout
      <..>
    
    After this patch:
    
    eeh_addr_cache_get_dev() trace shows correct physical address:
    
      <idle>-0       [001] ..s.  1043.123828: eeh_addr_cache_get_dev:
    	  (eeh_addr_cache_get_dev+0xc/0xf0) addr=0x40080bc7cd8
    
    dmesg logs shows EEH recovery getting triggerred:
    
      [  964.323980] bnx2x: [bnx2x_timer:5801(eth2)]MFW seems hanged: drv_pulse (0x746f) != mcp_pulse (0x7fff)
      [  964.323991] EEH: Recovering PHB#30-PE#10000
      [  964.324002] EEH: PE location: N/A, PHB location: N/A
      [  964.324006] EEH: Frozen PHB#30-PE#10000 detected
      <..>
    
    Fixes: 3343962 ("powerpc/eeh: Handle hugepages in ioremap space")
    Cc: [email protected] # v5.3+
    Reported-by: Dominic DeMarco <[email protected]>
    Signed-off-by: Mahesh Salgaonkar <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/161821396263.48361.2796709239866588652.stgit@jupiter
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    maheshsal authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a43ae32 View commit details
    Browse the repository at this point in the history
  144. powerpc/kexec_file: Use current CPU info while setting up FDT

    commit 40c7539 upstream.
    
    kexec_file_load() uses initial_boot_params in setting up the device tree
    for the kernel to be loaded. Though initial_boot_params holds info about
    CPUs at the time of boot, it doesn't account for hot added CPUs.
    
    So, kexec'ing with kexec_file_load() syscall leaves the kexec'ed kernel
    with inaccurate CPU info.
    
    If kdump kernel is loaded with kexec_file_load() syscall and the system
    crashes on a hot added CPU, the capture kernel hangs failing to identify
    the boot CPU, with no output.
    
    To avoid this from happening, extract current CPU info from of_root
    device node and use it for setting up the fdt in kexec_file_load case.
    
    Fixes: 6ecd016 ("powerpc/kexec_file: Add appropriate regions for memory reserve map")
    Cc: [email protected] # v5.9+
    Signed-off-by: Sourabh Jain <[email protected]>
    Reviewed-by: Hari Bathini <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sourabhjains authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b54b85b View commit details
    Browse the repository at this point in the history
  145. powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR

    commit f566826 upstream.
    
    Commit 7c95d88 ("powerpc: Change calling convention for
    create_branch() et. al.") complexified the frame of function
    do_feature_fixups(), leading to GCC setting up a stack
    guard when CONFIG_STACKPROTECTOR is selected.
    
    The problem is that do_feature_fixups() is called very early
    while 'current' in r2 is not set up yet and the code is still
    not at the final address used at link time.
    
    So, like other instrumentation, stack protection needs to be
    deactivated for feature-fixups.c and code-patching.c
    
    Fixes: 7c95d88 ("powerpc: Change calling convention for create_branch() et. al.")
    Cc: [email protected] # v5.8+
    Reported-by: Jonathan Neuschaefer <[email protected]>
    Signed-off-by: Christophe Leroy <[email protected]>
    Tested-by: Jonathan Neuschaefer <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/b688fe82927b330349d9e44553363fa451ea4d95.1619715114.git.christophe.leroy@csgroup.eu
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    chleroy authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fe26134 View commit details
    Browse the repository at this point in the history
  146. powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h

    commit 7de21e6 upstream.
    
    A few archs like powerpc have different errno.h values for macros
    EDEADLOCK and EDEADLK. In code including both libc and linux versions of
    errno.h, this can result in multiple definitions of EDEADLOCK in the
    include chain. Definitions to the same value (e.g. seen with mips) do
    not raise warnings, but on powerpc there are redefinitions changing the
    value, which raise warnings and errors (if using "-Werror").
    
    Guard against these redefinitions to avoid build errors like the following,
    first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with
    musl 1.1.24:
    
      In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5,
                       from ../../include/linux/err.h:8,
                       from libbpf.c:29:
      ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror]
       #define EDEADLOCK EDEADLK
    
      In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
                       from libbpf.c:26:
      toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition
       #define EDEADLOCK       58
    
      cc1: all warnings being treated as errors
    
    Cc: Stable <[email protected]>
    Reported-by: Rosen Penev <[email protected]>
    Signed-off-by: Tony Ambardar <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Tony Ambardar authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    524a894 View commit details
    Browse the repository at this point in the history
  147. powerpc/kvm: Fix PR KVM with KUAP/MEM_KEYS enabled

    commit e4e8bc1 upstream.
    
    The changes to add KUAP support with the hash MMU broke booting of KVM
    PR guests. The symptom is no visible progress of the guest, or possibly
    just "SLOF" being printed to the qemu console.
    
    Host code is still executing, but breaking into xmon might show a stack
    trace such as:
    
      __might_fault+0x84/0xe0 (unreliable)
      kvm_read_guest+0x1c8/0x2f0 [kvm]
      kvmppc_ld+0x1b8/0x2d0 [kvm]
      kvmppc_load_last_inst+0x50/0xa0 [kvm]
      kvmppc_exit_pr_progint+0x178/0x220 [kvm_pr]
      kvmppc_handle_exit_pr+0x31c/0xe30 [kvm_pr]
      after_sprg3_load+0x80/0x90 [kvm_pr]
      kvmppc_vcpu_run_pr+0x104/0x260 [kvm_pr]
      kvmppc_vcpu_run+0x34/0x48 [kvm]
      kvm_arch_vcpu_ioctl_run+0x340/0x450 [kvm]
      kvm_vcpu_ioctl+0x2ac/0x8c0 [kvm]
      sys_ioctl+0x320/0x1060
      system_call_exception+0x160/0x270
      system_call_common+0xf0/0x27c
    
    Bisect points to commit b2ff33a ("powerpc/book3s64/hash/kuap:
    Enable kuap on hash"), but that's just the commit that enabled KUAP with
    hash and made the bug visible.
    
    The root cause seems to be that KVM PR is creating kernel mappings that
    don't use the correct key, since we switched to using key 3.
    
    We have a helper for adding the right key value, however it's designed
    to take a pteflags variable, which the KVM code doesn't have. But we can
    make it work by passing 0 for the pteflags, and tell it explicitly that
    it should use the kernel key.
    
    With that changed guests boot successfully.
    
    Fixes: d94b827 ("powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation")
    Cc: [email protected] # v5.11+
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mpe authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    5fa84d1 View commit details
    Browse the repository at this point in the history
  148. powerpc/kvm: Fix build error when PPC_MEM_KEYS/PPC_PSERIES=n

    commit ee1bc69 upstream.
    
    lkp reported a randconfig failure:
    
         In file included from arch/powerpc/include/asm/book3s/64/pkeys.h:6,
                        from arch/powerpc/kvm/book3s_64_mmu_host.c:15:
         arch/powerpc/include/asm/book3s/64/hash-pkey.h: In function 'hash__vmflag_to_pte_pkey_bits':
      >> arch/powerpc/include/asm/book3s/64/hash-pkey.h:10:23: error: 'VM_PKEY_BIT0' undeclared
            10 |  return (((vm_flags & VM_PKEY_BIT0) ? H_PTE_PKEY_BIT0 : 0x0UL) |
             |                       ^~~~~~~~~~~~
    
    We added the include of book3s/64/pkeys.h for pte_to_hpte_pkey_bits(),
    but that header on its own should only be included when PPC_MEM_KEYS=y.
    Instead include linux/pkeys.h, which brings in the right definitions
    when PPC_MEM_KEYS=y and also provides empty stubs when PPC_MEM_KEYS=n.
    
    Fixes: e4e8bc1 ("powerpc/kvm: Fix PR KVM with KUAP/MEM_KEYS enabled")
    Cc: [email protected] # v5.11+
    Reported-by: kernel test robot <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mpe authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    467c41f View commit details
    Browse the repository at this point in the history
  149. intel_th: pci: Add Alder Lake-M support

    commit 48cb175 upstream.
    
    This adds support for the Trace Hub in Alder Lake-M PCH.
    
    Signed-off-by: Alexander Shishkin <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Cc: [email protected] # v4.14+
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    virtuoso authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e09145e View commit details
    Browse the repository at this point in the history
  150. tpm: efi: Use local variable for calculating final log size

    commit 48cff27 upstream.
    
    When tpm_read_log_efi is called multiple times, which happens when
    one loads and unloads a TPM2 driver multiple times, then the global
    variable efi_tpm_final_log_size will at some point become a negative
    number due to the subtraction of final_events_preboot_size occurring
    each time. Use a local variable to avoid this integer underflow.
    
    The following issue is now resolved:
    
    Mar  8 15:35:12 hibinst kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
    Mar  8 15:35:12 hibinst kernel: Workqueue: tpm-vtpm vtpm_proxy_work [tpm_vtpm_proxy]
    Mar  8 15:35:12 hibinst kernel: RIP: 0010:__memcpy+0x12/0x20
    Mar  8 15:35:12 hibinst kernel: Code: 00 b8 01 00 00 00 85 d2 74 0a c7 05 44 7b ef 00 0f 00 00 00 c3 cc cc cc 66 66 90 66 90 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4
    Mar  8 15:35:12 hibinst kernel: RSP: 0018:ffff9ac4c0fcfde0 EFLAGS: 00010206
    Mar  8 15:35:12 hibinst kernel: RAX: ffff88f878cefed5 RBX: ffff88f878ce9000 RCX: 1ffffffffffffe0f
    Mar  8 15:35:12 hibinst kernel: RDX: 0000000000000003 RSI: ffff9ac4c003bff9 RDI: ffff88f878cf0e4d
    Mar  8 15:35:12 hibinst kernel: RBP: ffff9ac4c003b000 R08: 0000000000001000 R09: 000000007e9d6073
    Mar  8 15:35:12 hibinst kernel: R10: ffff9ac4c003b000 R11: ffff88f879ad3500 R12: 0000000000000ed5
    Mar  8 15:35:12 hibinst kernel: R13: ffff88f878ce9760 R14: 0000000000000002 R15: ffff88f77de7f018
    Mar  8 15:35:12 hibinst kernel: FS:  0000000000000000(0000) GS:ffff88f87bd00000(0000) knlGS:0000000000000000
    Mar  8 15:35:12 hibinst kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    Mar  8 15:35:12 hibinst kernel: CR2: ffff9ac4c003c000 CR3: 00000001785a6004 CR4: 0000000000060ee0
    Mar  8 15:35:12 hibinst kernel: Call Trace:
    Mar  8 15:35:12 hibinst kernel: tpm_read_log_efi+0x152/0x1a7
    Mar  8 15:35:12 hibinst kernel: tpm_bios_log_setup+0xc8/0x1c0
    Mar  8 15:35:12 hibinst kernel: tpm_chip_register+0x8f/0x260
    Mar  8 15:35:12 hibinst kernel: vtpm_proxy_work+0x16/0x60 [tpm_vtpm_proxy]
    Mar  8 15:35:12 hibinst kernel: process_one_work+0x1b4/0x370
    Mar  8 15:35:12 hibinst kernel: worker_thread+0x53/0x3e0
    Mar  8 15:35:12 hibinst kernel: ? process_one_work+0x370/0x370
    
    Cc: [email protected]
    Fixes: 166a280 ("tpm: Don't duplicate events from the final event log in the TCG2 log")
    Signed-off-by: Stefan Berger <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    stefanberger authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    ac07c55 View commit details
    Browse the repository at this point in the history
  151. tpm: vtpm_proxy: Avoid reading host log when using a virtual device

    commit 9716ac6 upstream.
    
    Avoid allocating memory and reading the host log when a virtual device
    is used since this log is of no use to that driver. A virtual
    device can be identified through the flag TPM_CHIP_FLAG_VIRTUAL, which
    is only set for the tpm_vtpm_proxy driver.
    
    Cc: [email protected]
    Fixes: 6f99612 ("tpm: Proxy driver for supporting multiple emulated TPMs")
    Signed-off-by: Stefan Berger <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    stefanberger authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    9afbad5 View commit details
    Browse the repository at this point in the history
  152. crypto: arm/curve25519 - Move '.fpu' after '.arch'

    commit 44200f2 upstream.
    
    Debian's clang carries a patch that makes the default FPU mode
    'vfp3-d16' instead of 'neon' for 'armv7-a' to avoid generating NEON
    instructions on hardware that does not support them:
    
    https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/raw/5a61ca6f21b4ad8c6ac4970e5ea5a7b5b4486d22/debian/patches/clang-arm-default-vfp3-on-armv7a.patch
    https://bugs.debian.org/841474
    https://bugs.debian.org/842142
    https://bugs.debian.org/914268
    
    This results in the following build error when clang's integrated
    assembler is used because the '.arch' directive overrides the '.fpu'
    directive:
    
    arch/arm/crypto/curve25519-core.S:25:2: error: instruction requires: NEON
     vmov.i32 q0, esmil#1
     ^
    arch/arm/crypto/curve25519-core.S:26:2: error: instruction requires: NEON
     vshr.u64 q1, q0, esmil#7
     ^
    arch/arm/crypto/curve25519-core.S:27:2: error: instruction requires: NEON
     vshr.u64 q0, q0, esmil#8
     ^
    arch/arm/crypto/curve25519-core.S:28:2: error: instruction requires: NEON
     vmov.i32 d4, esmil#19
     ^
    
    Shuffle the order of the '.arch' and '.fpu' directives so that the code
    builds regardless of the default FPU mode. This has been tested against
    both clang with and without Debian's patch and GCC.
    
    Cc: [email protected]
    Fixes: d8f1308 ("crypto: arm/curve25519 - wire up NEON implementation")
    Link: https://github.com/ClangBuiltLinux/continuous-integration2/issues/118
    Reported-by: Arnd Bergmann <[email protected]>
    Suggested-by: Arnd Bergmann <[email protected]>
    Suggested-by: Jessica Clarke <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Acked-by: Jason A. Donenfeld <[email protected]>
    Reviewed-by: Nick Desaulniers <[email protected]>
    Tested-by: Nick Desaulniers <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    nathanchance authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    694d9d5 View commit details
    Browse the repository at this point in the history
  153. crypto: rng - fix crypto_rng_reset() refcounting when !CRYPTO_STATS

    commit 30d0f6a upstream.
    
    crypto_stats_get() is a no-op when the kernel is compiled without
    CONFIG_CRYPTO_STATS, so pairing it with crypto_alg_put() unconditionally
    (as crypto_rng_reset() does) is wrong.
    
    Fix this by moving the call to crypto_stats_get() to just before the
    actual algorithm operation which might need it.  This makes it always
    paired with crypto_stats_rng_seed().
    
    Fixes: eed74b3 ("crypto: rng - Fix a refcounting bug in crypto_rng_reset()")
    Cc: [email protected]
    Signed-off-by: Eric Biggers <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ebiggers authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    3606420 View commit details
    Browse the repository at this point in the history
  154. md/raid1: properly indicate failure when ending a failed write request

    commit 2417b98 upstream.
    
    This patch addresses a data corruption bug in raid1 arrays using bitmaps.
    Without this fix, the bitmap bits for the failed I/O end up being cleared.
    
    Since we are in the failure leg of raid1_end_write_request, the request
    either needs to be retried (R1BIO_WriteError) or failed (R1BIO_Degraded).
    
    Fixes: eeba680 ("md/raid1: end bio when the device faulty")
    Cc: [email protected] # v5.2+
    Signed-off-by: Paul Clements <[email protected]>
    Signed-off-by: Song Liu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    clemep-sios authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    538244f View commit details
    Browse the repository at this point in the history
  155. dm raid: fix inconclusive reshape layout on fast raid4/5/6 table relo…

    …ad sequences
    
    commit f99a8e4 upstream.
    
    If fast table reloads occur during an ongoing reshape of raid4/5/6
    devices the target may race reading a superblock vs the the MD resync
    thread; causing an inconclusive reshape state to be read in its
    constructor.
    
    lvm2 test lvconvert-raid-reshape-stripes-load-reload.sh can cause
    BUG_ON() to trigger in md_run(), e.g.:
    "kernel BUG at drivers/md/raid5.c:7567!".
    
    Scenario triggering the bug:
    
    1. the MD sync thread calls end_reshape() from raid5_sync_request()
       when done reshaping. However end_reshape() _only_ updates the
       reshape position to MaxSector keeping the changed layout
       configuration though (i.e. any delta disks, chunk sector or RAID
       algorithm changes). That inconclusive configuration is stored in
       the superblock.
    
    2. dm-raid constructs a mapping, loading named inconsistent superblock
       as of step 1 before step 3 is able to finish resetting the reshape
       state completely, and calls md_run() which leads to mentioned bug
       in raid5.c.
    
    3. the MD RAID personality's finish_reshape() is called; which resets
       the reshape information on chunk sectors, delta disks, etc. This
       explains why the bug is rarely seen on multi-core machines, as MD's
       finish_reshape() superblock update races with the dm-raid
       constructor's superblock load in step 2.
    
    Fix identifies inconclusive superblock content in the dm-raid
    constructor and resets it before calling md_run(), factoring out
    identifying checks into rs_is_layout_change() to share in existing
    rs_reshape_requested() and new rs_reset_inclonclusive_reshape(). Also
    enhance a comment and remove an empty line.
    
    Cc: [email protected]
    Signed-off-by: Heinz Mauelshagen <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mauelsha authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    00fd897 View commit details
    Browse the repository at this point in the history
  156. fuse: fix write deadlock

    commit 4f06dd9 upstream.
    
    There are two modes for write(2) and friends in fuse:
    
    a) write through (update page cache, send sync WRITE request to userspace)
    
    b) buffered write (update page cache, async writeout later)
    
    The write through method kept all the page cache pages locked that were
    used for the request.  Keeping more than one page locked is deadlock prone
    and Qian Cai demonstrated this with trinity fuzzing.
    
    The reason for keeping the pages locked is that concurrent mapped reads
    shouldn't try to pull possibly stale data into the page cache.
    
    For full page writes, the easy way to fix this is to make the cached page
    be the authoritative source by marking the page PG_uptodate immediately.
    After this the page can be safely unlocked, since mapped/cached reads will
    take the written data from the cache.
    
    Concurrent mapped writes will now cause data in the original WRITE request
    to be updated; this however doesn't cause any data inconsistency and this
    scenario should be exceedingly rare anyway.
    
    If the WRITE request returns with an error in the above case, currently the
    page is not marked uptodate; this means that a concurrent read will always
    read consistent data.  After this patch the page is uptodate between
    writing to the cache and receiving the error: there's window where a cached
    read will read the wrong data.  While theoretically this could be a
    regression, it is unlikely to be one in practice, since this is normal for
    buffered writes.
    
    In case of a partial page write to an already uptodate page the locking is
    also unnecessary, with the above caveats.
    
    Partial write of a not uptodate page still needs to be handled.  One way
    would be to read the complete page before doing the write.  This is not
    possible, since it might break filesystems that don't expect any READ
    requests when the file was opened O_WRONLY.
    
    The other solution is to serialize the synchronous write with reads from
    the partial pages.  The easiest way to do this is to keep the partial pages
    locked.  The problem is that a write() may involve two such pages (one head
    and one tail).  This patch fixes it by only locking the partial tail page.
    If there's a partial head page as well, then split that off as a separate
    WRITE request.
    
    Reported-by: Qian Cai <[email protected]>
    Link: https://lore.kernel.org/linux-fsdevel/[email protected]/
    Fixes: ea9b990 ("fuse: implement perform_write")
    Cc: <[email protected]> # v2.6.26
    Signed-off-by: Vivek Goyal <[email protected]>
    Signed-off-by: Miklos Szeredi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rhvgoyal authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b945c48 View commit details
    Browse the repository at this point in the history
  157. mm: page_alloc: ignore init_on_free=1 for debug_pagealloc=1

    commit 9df65f5 upstream.
    
    On !ARCH_SUPPORTS_DEBUG_PAGEALLOC (like ia64) debug_pagealloc=1 implies
    page_poison=on:
    
        if (page_poisoning_enabled() ||
             (!IS_ENABLED(CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC) &&
              debug_pagealloc_enabled()))
                static_branch_enable(&_page_poisoning_enabled);
    
    page_poison=on needs to override init_on_free=1.
    
    Before the change it did not work as expected for the following case:
    - have PAGE_POISONING=y
    - have page_poison unset
    - have !ARCH_SUPPORTS_DEBUG_PAGEALLOC arch (like ia64)
    - have init_on_free=1
    - have debug_pagealloc=1
    
    That way we get both keys enabled:
    - static_branch_enable(&init_on_free);
    - static_branch_enable(&_page_poisoning_enabled);
    
    which leads to poisoned pages returned for __GFP_ZERO pages.
    
    After the change we execute only:
    - static_branch_enable(&_page_poisoning_enabled);
      and ignore init_on_free=1.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lkml.org/lkml/2021/3/26/443
    Fixes: 8db26a3 ("mm, page_poison: use static key more efficiently")
    Signed-off-by: Sergei Trofimovich <[email protected]>
    Acked-by: Vlastimil Babka <[email protected]>
    Reviewed-by: David Hildenbrand <[email protected]>
    Cc: Andrey Konovalov <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Sergei Trofimovich authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d04d56f View commit details
    Browse the repository at this point in the history
  158. exfat: fix erroneous discard when clear cluster bit

    commit 77edfc6 upstream.
    
    If mounted with discard option, exFAT issues discard command when clear
    cluster bit to remove file. But the input parameter of cluster-to-sector
    calculation is abnormally added by reserved cluster size which is 2,
    leading to discard unrelated sectors included in target+2 cluster.
    With fixing this, remove the wrong comments in set/clear/find bitmap
    functions.
    
    Fixes: 1e49a94 ("exfat: add bitmap operations")
    Cc: [email protected] # v5.7+
    Signed-off-by: Hyeongseok Kim <[email protected]>
    Acked-by: Sungjong Seo <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    hyeongseok-kim901 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    473ffbe View commit details
    Browse the repository at this point in the history
  159. sfc: farch: fix TX queue lookup in TX flush done handling

    commit 5b1faa9 upstream.
    
    We're starting from a TXQ instance number ('qid'), not a TXQ type, so
     efx_get_tx_queue() is inappropriate (and could return NULL, leading
     to panics).
    
    Fixes: 1280479 ("sfc: decouple TXQ type from label")
    Reported-by: Trevor Hemsley <[email protected]>
    Cc: [email protected]
    Signed-off-by: Edward Cree <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Edward Cree authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    98d9118 View commit details
    Browse the repository at this point in the history
  160. sfc: farch: fix TX queue lookup in TX event handling

    commit 83b09a1 upstream.
    
    We're starting from a TXQ label, not a TXQ type, so
     efx_channel_get_tx_queue() is inappropriate (and could return NULL,
     leading to panics).
    
    Fixes: 1280479 ("sfc: decouple TXQ type from label")
    Cc: [email protected]
    Signed-off-by: Edward Cree <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Edward Cree authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e531db1 View commit details
    Browse the repository at this point in the history
  161. sfc: adjust efx->xdp_tx_queue_count with the real number of initializ…

    …ed queues
    
    commit 99ba0ea upstream.
    
    efx->xdp_tx_queue_count is initially initialized to num_possible_cpus() and is
    later used to allocate and traverse efx->xdp_tx_queues lookup array. However,
    we may end up not initializing all the array slots with real queues during
    probing. This results, for example, in a NULL pointer dereference, when running
    "# ethtool -S <iface>", similar to below
    
    [2570283.664955][T4126959] BUG: kernel NULL pointer dereference, address: 00000000000000f8
    [2570283.681283][T4126959] #PF: supervisor read access in kernel mode
    [2570283.695678][T4126959] #PF: error_code(0x0000) - not-present page
    [2570283.710013][T4126959] PGD 0 P4D 0
    [2570283.721649][T4126959] Oops: 0000 [esmil#1] SMP PTI
    [2570283.734108][T4126959] CPU: 23 PID: 4126959 Comm: ethtool Tainted: G           O      5.10.20-cloudflare-2021.3.1 esmil#1
    [2570283.752641][T4126959] Hardware name: <redacted>
    [2570283.781408][T4126959] RIP: 0010:efx_ethtool_get_stats+0x2ca/0x330 [sfc]
    [2570283.796073][T4126959] Code: 00 85 c0 74 39 48 8b 95 a8 0f 00 00 48 85 d2 74 2d 31 c0 eb 07 48 8b 95 a8 0f 00 00 48 63 c8 49 83 c4 08 83 c0 01 48 8b 14 ca <48> 8b 92 f8 00 00 00 49 89 54 24 f8 39 85 a0 0f 00 00 77 d7 48 8b
    [2570283.831259][T4126959] RSP: 0018:ffffb79a77657ce8 EFLAGS: 00010202
    [2570283.845121][T4126959] RAX: 0000000000000019 RBX: ffffb799cd0c9280 RCX: 0000000000000018
    [2570283.860872][T4126959] RDX: 0000000000000000 RSI: ffff96dd970ce000 RDI: 0000000000000005
    [2570283.876525][T4126959] RBP: ffff96dd86f0a000 R08: ffff96dd970ce480 R09: 000000000000005f
    [2570283.892014][T4126959] R10: ffffb799cd0c9fff R11: ffffb799cd0c9000 R12: ffffb799cd0c94f8
    [2570283.907406][T4126959] R13: ffffffffc11b1090 R14: ffff96dd970ce000 R15: ffffffffc11cd66c
    [2570283.922705][T4126959] FS:  00007fa7723f8740(0000) GS:ffff96f51fac0000(0000) knlGS:0000000000000000
    [2570283.938848][T4126959] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [2570283.952524][T4126959] CR2: 00000000000000f8 CR3: 0000001a73e6e006 CR4: 00000000007706e0
    [2570283.967529][T4126959] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [2570283.982400][T4126959] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [2570283.997308][T4126959] PKRU: 55555554
    [2570284.007649][T4126959] Call Trace:
    [2570284.017598][T4126959]  dev_ethtool+0x1832/0x2830
    
    Fix this by adjusting efx->xdp_tx_queue_count after probing to reflect the true
    value of initialized slots in efx->xdp_tx_queues.
    
    Signed-off-by: Ignat Korchagin <[email protected]>
    Fixes: e26ca4b ("sfc: reduce the number of requested xdp ev queues")
    Cc: <[email protected]> # 5.12.x
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ignatk authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    ebeac95 View commit details
    Browse the repository at this point in the history
  162. rcu/nocb: Fix missed nocb_timer requeue

    commit b2fcf21 upstream.
    
    This sequence of events can lead to a failure to requeue a CPU's
    ->nocb_timer:
    
    1.	There are no callbacks queued for any CPU covered by CPU 0-2's
    	->nocb_gp_kthread.  Note that ->nocb_gp_kthread is associated
    	with CPU 0.
    
    2.	CPU 1 enqueues its first callback with interrupts disabled, and
    	thus must defer awakening its ->nocb_gp_kthread.  It therefore
    	queues its rcu_data structure's ->nocb_timer.  At this point,
    	CPU 1's rdp->nocb_defer_wakeup is RCU_NOCB_WAKE.
    
    3.	CPU 2, which shares the same ->nocb_gp_kthread, also enqueues a
    	callback, but with interrupts enabled, allowing it to directly
    	awaken the ->nocb_gp_kthread.
    
    4.	The newly awakened ->nocb_gp_kthread associates both CPU 1's
    	and CPU 2's callbacks with a future grace period and arranges
    	for that grace period to be started.
    
    5.	This ->nocb_gp_kthread goes to sleep waiting for the end of this
    	future grace period.
    
    6.	This grace period elapses before the CPU 1's timer fires.
    	This is normally improbably given that the timer is set for only
    	one jiffy, but timers can be delayed.  Besides, it is possible
    	that kernel was built with CONFIG_RCU_STRICT_GRACE_PERIOD=y.
    
    7.	The grace period ends, so rcu_gp_kthread awakens the
    	->nocb_gp_kthread, which in turn awakens both CPU 1's and
    	CPU 2's ->nocb_cb_kthread.  Then ->nocb_gb_kthread sleeps
    	waiting for more newly queued callbacks.
    
    8.	CPU 1's ->nocb_cb_kthread invokes its callback, then sleeps
    	waiting for more invocable callbacks.
    
    9.	Note that neither kthread updated any ->nocb_timer state,
    	so CPU 1's ->nocb_defer_wakeup is still set to RCU_NOCB_WAKE.
    
    10.	CPU 1 enqueues its second callback, this time with interrupts
     	enabled so it can wake directly	->nocb_gp_kthread.
    	It does so with calling wake_nocb_gp() which also cancels the
    	pending timer that got queued in step 2. But that doesn't reset
    	CPU 1's ->nocb_defer_wakeup which is still set to RCU_NOCB_WAKE.
    	So CPU 1's ->nocb_defer_wakeup and its ->nocb_timer are now
    	desynchronized.
    
    11.	->nocb_gp_kthread associates the callback queued in 10 with a new
    	grace period, arranges for that grace period to start and sleeps
    	waiting for it to complete.
    
    12.	The grace period ends, rcu_gp_kthread awakens ->nocb_gp_kthread,
    	which in turn wakes up CPU 1's ->nocb_cb_kthread which then
    	invokes the callback queued in 10.
    
    13.	CPU 1 enqueues its third callback, this time with interrupts
    	disabled so it must queue a timer for a deferred wakeup. However
    	the value of its ->nocb_defer_wakeup is RCU_NOCB_WAKE which
    	incorrectly indicates that a timer is already queued.  Instead,
    	CPU 1's ->nocb_timer was cancelled in 10.  CPU 1 therefore fails
    	to queue the ->nocb_timer.
    
    14.	CPU 1 has its pending callback and it may go unnoticed until
    	some other CPU ever wakes up ->nocb_gp_kthread or CPU 1 ever
    	calls an explicit deferred wakeup, for example, during idle entry.
    
    This commit fixes this bug by resetting rdp->nocb_defer_wakeup everytime
    we delete the ->nocb_timer.
    
    It is quite possible that there is a similar scenario involving
    ->nocb_bypass_timer and ->nocb_defer_wakeup.  However, despite some
    effort from several people, a failure scenario has not yet been located.
    However, that by no means guarantees that no such scenario exists.
    Finding a failure scenario is left as an exercise for the reader, and the
    "Fixes:" tag below relates to ->nocb_bypass_timer instead of ->nocb_timer.
    
    Fixes: d1b222c (rcu/nocb: Add bypass callback queueing)
    Cc: <[email protected]>
    Cc: Josh Triplett <[email protected]>
    Cc: Lai Jiangshan <[email protected]>
    Cc: Joel Fernandes <[email protected]>
    Cc: Boqun Feng <[email protected]>
    Reviewed-by: Neeraj Upadhyay <[email protected]>
    Signed-off-by: Frederic Weisbecker <[email protected]>
    Signed-off-by: Paul E. McKenney <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Frederic Weisbecker authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    deaaae2 View commit details
    Browse the repository at this point in the history
  163. security: commoncap: fix -Wstringop-overread warning

    commit 82e5d8c upstream.
    
    gcc-11 introdces a harmless warning for cap_inode_getsecurity:
    
    security/commoncap.c: In function ‘cap_inode_getsecurity’:
    security/commoncap.c:440:33: error: ‘memcpy’ reading 16 bytes from a region of size 0 [-Werror=stringop-overread]
      440 |                                 memcpy(&nscap->data, &cap->data, sizeof(__le32) * 2 * VFS_CAP_U32);
          |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The problem here is that tmpbuf is initialized to NULL, so gcc assumes
    it is not accessible unless it gets set by vfs_getxattr_alloc().  This is
    a legitimate warning as far as I can tell, but the code is correct since
    it correctly handles the error when that function fails.
    
    Add a separate NULL check to tell gcc about it as well.
    
    Signed-off-by: Arnd Bergmann <[email protected]>
    Acked-by: Christian Brauner <[email protected]>
    Signed-off-by: James Morris <[email protected]>
    Cc: Andrey Zhizhikin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    arndb authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    3cc63b1 View commit details
    Browse the repository at this point in the history
  164. Fix misc new gcc warnings

    commit e7c6e40 upstream.
    
    It seems like Fedora 34 ends up enabling a few new gcc warnings, notably
    "-Wstringop-overread" and "-Warray-parameter".
    
    Both of them cause what seem to be valid warnings in the kernel, where
    we have array size mismatches in function arguments (that are no longer
    just silently converted to a pointer to element, but actually checked).
    
    This fixes most of the trivial ones, by making the function declaration
    match the function definition, and in the case of intel_pm.c, removing
    the over-specified array size from the argument declaration.
    
    At least one 'stringop-overread' warning remains in the i915 driver, but
    that one doesn't have the same obvious trivial fix, and may or may not
    actually be indicative of a bug.
    
    [ It was a mistake to upgrade one of my machines to Fedora 34 while
      being busy with the merge window, but if this is the extent of the
      compiler upgrade problems, things are better than usual    - Linus ]
    
    Signed-off-by: Linus Torvalds <[email protected]>
    Cc: Andrey Zhizhikin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    torvalds authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2831dd5 View commit details
    Browse the repository at this point in the history
  165. smb3: when mounting with multichannel include it in requested capabil…

    …ities
    
    commit 679971e upstream.
    
    In the SMB3/SMB3.1.1 negotiate protocol request, we are supposed to
    advertise CAP_MULTICHANNEL capability when establishing multiple
    channels has been requested by the user doing the mount. See MS-SMB2
    sections 2.2.3 and 3.2.5.2
    
    Without setting it there is some risk that multichannel could fail
    if the server interpreted the field strictly.
    
    Reviewed-By: Tom Talpey <[email protected]>
    Reviewed-by: Shyam Prasad N <[email protected]>
    Cc: <[email protected]> # v5.8+
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Steve French authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    524fc54 View commit details
    Browse the repository at this point in the history
  166. smb3: if max_channels set to more than one channel request multichannel

    commit c1f8a39 upstream.
    
    Mounting with "multichannel" is obviously implied if user requested
    more than one channel on mount (ie mount parm max_channels>1).
    Currently both have to be specified. Fix that so that if max_channels
    is greater than 1 on mount, enable multichannel rather than silently
    falling back to non-multichannel.
    
    Signed-off-by: Steve French <[email protected]>
    Reviewed-By: Tom Talpey <[email protected]>
    Cc: <[email protected]> # v5.11+
    Reviewed-by: Shyam Prasad N <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Steve French authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0470ef3 View commit details
    Browse the repository at this point in the history
  167. smb3: do not attempt multichannel to server which does not support it

    commit 9c2dc11 upstream.
    
    We were ignoring CAP_MULTI_CHANNEL in the server response - if the
    server doesn't support multichannel we should not be attempting it.
    
    See MS-SMB2 section 3.2.5.2
    
    Reviewed-by: Shyam Prasad N <[email protected]>
    Reviewed-By: Tom Talpey <[email protected]>
    Cc: <[email protected]> # v5.8+
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Steve French authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1ca4f55 View commit details
    Browse the repository at this point in the history
  168. Revert 337f130 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")

    commit 4fbf5d6 upstream.
    
    The FUTEX_WAIT operand has historically a relative timeout which means that
    the clock id is irrelevant as relative timeouts on CLOCK_REALTIME are not
    subject to wall clock changes and therefore are mapped by the kernel to
    CLOCK_MONOTONIC for simplicity.
    
    If a caller would set FUTEX_CLOCK_REALTIME for FUTEX_WAIT the timeout is
    still treated relative vs. CLOCK_MONOTONIC and then the wait arms that
    timeout based on CLOCK_REALTIME which is broken and obviously has never
    been used or even tested.
    
    Reject any attempt to use FUTEX_CLOCK_REALTIME with FUTEX_WAIT again.
    
    The desired functionality can be achieved with FUTEX_WAIT_BITSET and a
    FUTEX_BITSET_MATCH_ANY argument.
    
    Fixes: 337f130 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")
    Signed-off-by: Thomas Gleixner <[email protected]>
    Acked-by: Peter Zijlstra (Intel) <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    KAGA-KOKO authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    600de79 View commit details
    Browse the repository at this point in the history
  169. futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI

    commit cdf78db upstream.
    
    FUTEX_LOCK_PI does not require to have the FUTEX_CLOCK_REALTIME bit set
    because it has been using CLOCK_REALTIME based absolute timeouts
    forever. Due to that, the time namespace adjustment which is applied when
    FUTEX_CLOCK_REALTIME is not set, will wrongly take place for FUTEX_LOCK_PI
    and wreckage the timeout.
    
    Exclude it from that procedure.
    
    Fixes: c2f7d08 ("futex: Adjust absolute futex timeouts with per time namespace offset")
    Signed-off-by: Thomas Gleixner <[email protected]>
    Acked-by: Peter Zijlstra (Intel) <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    KAGA-KOKO authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    13b5638 View commit details
    Browse the repository at this point in the history
  170. x86/cpu: Initialize MSR_TSC_AUX if RDTSCP *or* RDPID is supported

    commit b6b4fbd upstream.
    
    Initialize MSR_TSC_AUX with CPU node information if RDTSCP or RDPID is
    supported.  This fixes a bug where vdso_read_cpunode() will read garbage
    via RDPID if RDPID is supported but RDTSCP is not.  While no known CPU
    supports RDPID but not RDTSCP, both Intel's SDM and AMD's APM allow for
    RDPID to exist without RDTSCP, e.g. it's technically a legal CPU model
    for a virtual machine.
    
    Note, technically MSR_TSC_AUX could be initialized if and only if RDPID
    is supported since RDTSCP is currently not used to retrieve the CPU node.
    But, the cost of the superfluous WRMSR is negigible, whereas leaving
    MSR_TSC_AUX uninitialized is just asking for future breakage if someone
    decides to utilize RDTSCP.
    
    Fixes: a582c54 ("x86/vdso: Use RDPID in preference to LSL when available")
    Signed-off-by: Sean Christopherson <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sean-jc authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0fc0b09 View commit details
    Browse the repository at this point in the history
  171. kbuild: update config_data.gz only when the content of .config is cha…

    …nged
    
    commit 46b41d5 upstream.
    
    If the timestamp of the .config file is updated, config_data.gz is
    regenerated, then vmlinux is re-linked. This occurs even if the content
    of the .config has not changed at all.
    
    This issue was mitigated by commit 67424f6 ("kconfig: do not write
    .config if the content is the same"); Kconfig does not update the
    .config when it ends up with the identical configuration.
    
    The issue is remaining when the .config is created by *_defconfig with
    some config fragment(s) applied on top.
    
    This is typical for powerpc and mips, where several *_defconfig targets
    are constructed by using merge_config.sh.
    
    One workaround is to have the copy of the .config. The filechk rule
    updates the copy, kernel/config_data, by checking the content instead
    of the timestamp.
    
    With this commit, the second run with the same configuration avoids
    the needless rebuilds.
    
      $ make ARCH=mips defconfig all
       [ snip ]
      $ make ARCH=mips defconfig all
      *** Default configuration is based on target '32r2el_defconfig'
      Using ./arch/mips/configs/generic_defconfig as base
      Merging arch/mips/configs/generic/32r2.config
      Merging arch/mips/configs/generic/el.config
      Merging ./arch/mips/configs/generic/board-boston.config
      Merging ./arch/mips/configs/generic/board-ni169445.config
      Merging ./arch/mips/configs/generic/board-ocelot.config
      Merging ./arch/mips/configs/generic/board-ranchu.config
      Merging ./arch/mips/configs/generic/board-sead-3.config
      Merging ./arch/mips/configs/generic/board-xilfpga.config
      #
      # configuration written to .config
      #
        SYNC    include/config/auto.conf
        CALL    scripts/checksyscalls.sh
        CALL    scripts/atomic/check-atomics.sh
        CHK     include/generated/compile.h
        CHK     include/generated/autoksyms.h
    
    Reported-by: Elliot Berman <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    masahir0y authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    8cb6d87 View commit details
    Browse the repository at this point in the history
  172. ext4: annotate data race in start_this_handle()

    commit 3b1833e upstream.
    
    Access to journal->j_running_transaction is not protected by appropriate
    lock and thus is racy. We are well aware of that and the code handles
    the race properly. Just add a comment and data_race() annotation.
    
    Cc: [email protected]
    Reported-by: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jankara authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    cfc9b6d View commit details
    Browse the repository at this point in the history
  173. ext4: annotate data race in jbd2_journal_dirty_metadata()

    commit 83fe6b1 upstream.
    
    Assertion checks in jbd2_journal_dirty_metadata() are known to be racy
    but we don't want to be grabbing locks just for them.  We thus recheck
    them under b_state_lock only if it looks like they would fail. Annotate
    the checks with data_race().
    
    Cc: [email protected]
    Reported-by: Hao Sun <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jankara authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    222c345 View commit details
    Browse the repository at this point in the history
  174. ext4: fix check to prevent false positive report of incorrect used in…

    …odes
    
    commit a149d2a upstream.
    
    Commit <50122847007> ("ext4: fix check to prevent initializing reserved
    inodes") check the block group zero and prevent initializing reserved
    inodes. But in some special cases, the reserved inode may not all belong
    to the group zero, it may exist into the second group if we format
    filesystem below.
    
      mkfs.ext4 -b 4096 -g 8192 -N 1024 -I 4096 /dev/sda
    
    So, it will end up triggering a false positive report of a corrupted
    file system. This patch fix it by avoid check reserved inodes if no free
    inode blocks will be zeroed.
    
    Cc: [email protected]
    Fixes: 5012284 ("ext4: fix check to prevent initializing reserved inodes")
    Signed-off-by: Zhang Yi <[email protected]>
    Suggested-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    zhangyi089 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e18d76a View commit details
    Browse the repository at this point in the history
  175. ext4: do not set SB_ACTIVE in ext4_orphan_cleanup()

    commit 72ffb49 upstream.
    
    When CONFIG_QUOTA is enabled, if we failed to mount the filesystem due
    to some error happens behind ext4_orphan_cleanup(), it will end up
    triggering a after free issue of super_block. The problem is that
    ext4_orphan_cleanup() will set SB_ACTIVE flag if CONFIG_QUOTA is
    enabled, after we cleanup the truncated inodes, the last iput() will put
    them into the lru list, and these inodes' pages may probably dirty and
    will be write back by the writeback thread, so it could be raced by
    freeing super_block in the error path of mount_bdev().
    
    After check the setting of SB_ACTIVE flag in ext4_orphan_cleanup(), it
    was used to ensure updating the quota file properly, but evict inode and
    trash data immediately in the last iput does not affect the quotafile,
    so setting the SB_ACTIVE flag seems not required[1]. Fix this issue by
    just remove the SB_ACTIVE setting.
    
    [1] https://lore.kernel.org/linux-ext4/[email protected]/T/#m04990cfbc4f44592421736b504afcc346b2a7c00
    
    Cc: [email protected]
    Signed-off-by: Zhang Yi <[email protected]>
    Tested-by: Jan Kara <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    zhangyi089 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b64a3fb View commit details
    Browse the repository at this point in the history
  176. ext4: always panic when errors=panic is specified

    commit ac2f7ca upstream.
    
    Before commit 014c9ca ("ext4: make ext4_abort() use
    __ext4_error()"), the following series of commands would trigger a
    panic:
    
    1. mount /dev/sda -o ro,errors=panic test
    2. mount /dev/sda -o remount,abort test
    
    After commit 014c9ca, remounting a file system using the test
    mount option "abort" will no longer trigger a panic.  This commit will
    restore the behaviour immediately before commit 014c9ca.
    (However, note that the Linux kernel's behavior has not been
    consistent; some previous kernel versions, including 5.4 and 4.19
    similarly did not panic after using the mount option "abort".)
    
    This also makes a change to long-standing behaviour; namely, the
    following series commands will now cause a panic, when previously it
    did not:
    
    1. mount /dev/sda -o ro,errors=panic test
    2. echo test > /sys/fs/ext4/sda/trigger_fs_error
    
    However, this makes ext4's behaviour much more consistent, so this is
    a good thing.
    
    Cc: [email protected]
    Fixes: 014c9ca ("ext4: make ext4_abort() use __ext4_error()")
    Signed-off-by: Ye Bin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ye Bin authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1e9ea8f View commit details
    Browse the repository at this point in the history
  177. ext4: fix error code in ext4_commit_super

    commit f88f146 upstream.
    
    We should set the error code when ext4_commit_super check argument failed.
    Found in code review.
    Fixes: c4be0c1 ("filesystem freeze: add error handling of write_super_lockfs/unlockfs").
    
    Cc: [email protected]
    Signed-off-by: Fengnan Chang <[email protected]>
    Reviewed-by: Andreas Dilger <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Fengnan Chang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    f61f62d View commit details
    Browse the repository at this point in the history
  178. ext4: fix ext4_error_err save negative errno into superblock

    commit 6810fad upstream.
    
    Fix As write_mmp_block() so that it returns -EIO instead of 1, so that
    the correct error gets saved into the superblock.
    
    Cc: [email protected]
    Fixes: 54d3adb ("ext4: save all error info in save_error_info() and drop ext4_set_errno()")
    Reported-by: Liu Zhi Qiang <[email protected]>
    Signed-off-by: Ye Bin <[email protected]>
    Reviewed-by: Andreas Dilger <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ye Bin authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    5a611ec View commit details
    Browse the repository at this point in the history
  179. ext4: fix error return code in ext4_fc_perform_commit()

    commit e1262cd upstream.
    
    In case of if not ext4_fc_add_tlv branch, an error return code is missing.
    
    Cc: [email protected]
    Fixes: aa75f4d ("ext4: main fast-commit commit path")
    Reported-by: Hulk Robot <[email protected]>
    Signed-off-by: Xu Yihang <[email protected]>
    Reviewed-by: Harshad Shirwadkar <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Xu Yihang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c9d79b2 View commit details
    Browse the repository at this point in the history
  180. ext4: allow the dax flag to be set and cleared on inline directories

    commit 4811d99 upstream.
    
    This is needed to allow generic/607 to pass for file systems with the
    inline data_feature enabled, and it allows the use of file systems
    where the directories use inline_data, while the files are accessed
    via DAX.
    
    Cc: [email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tytso authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    16e4d10 View commit details
    Browse the repository at this point in the history
  181. ext4: Fix occasional generic/418 failure

    commit 5899593 upstream.
    
    Eric has noticed that after pagecache read rework, generic/418 is
    occasionally failing for ext4 when blocksize < pagesize. In fact, the
    pagecache rework just made hard to hit race in ext4 more likely. The
    problem is that since ext4 conversion of direct IO writes to iomap
    framework (commit 378f32b), we update inode size after direct IO
    write only after invalidating page cache. Thus if buffered read sneaks
    at unfortunate moment like:
    
    CPU1 - write at offset 1k                       CPU2 - read from offset 0
    iomap_dio_rw(..., IOMAP_DIO_FORCE_WAIT);
                                                    ext4_readpage();
    ext4_handle_inode_extension()
    
    the read will zero out tail of the page as it still sees smaller inode
    size and thus page cache becomes inconsistent with on-disk contents with
    all the consequences.
    
    Fix the problem by moving inode size update into end_io handler which
    gets called before the page cache is invalidated.
    
    Reported-and-tested-by: Eric Whitney <[email protected]>
    Fixes: 378f32b ("ext4: introduce direct I/O write using iomap infrastructure")
    CC: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Acked-by: Dave Chinner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jankara authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a1d50db View commit details
    Browse the repository at this point in the history
  182. media: dvbdev: Fix memory leak in dvb_media_device_free()

    commit bf9a40a upstream.
    
    dvb_media_device_free() is leaking memory. Free `dvbdev->adapter->conn`
    before setting it to NULL, as documented in include/media/media-device.h:
    "The media_entity instance itself must be freed explicitly by the driver
    if required."
    
    Link: https://syzkaller.appspot.com/bug?id=9bbe4b842c98f0ed05c5eed77a226e9de33bf298
    
    Link: https://lore.kernel.org/linux-media/[email protected]
    Cc: [email protected]
    Fixes: 0230d60 ("[media] dvbdev: Add RF connector if needed")
    Reported-by: [email protected]
    Signed-off-by: Peilin Ye <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    peilin-ye authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    cede24d View commit details
    Browse the repository at this point in the history
  183. media: dvb-usb: Fix use-after-free access

    commit c492067 upstream.
    
    dvb_usb_device_init() copies the properties to the own data, so that
    the callers can release the original properties later (as done in the
    commit 299c700 ("media: dw2102: Fix memleak on sequence of
    probes")).  However, it also stores dev->desc pointer that is a
    reference to the original properties data.  Since dev->desc is
    referred later, it may result in use-after-free, in the worst case,
    leading to a kernel Oops as reported.
    
    This patch addresses the problem by allocating and copying the
    properties at first, then get the desc from the copied properties.
    
    Reported-and-tested-by: Stefan Seyfried <[email protected]>
    BugLink: http://bugzilla.opensuse.org/show_bug.cgi?id=1181104
    
    Reviewed-by: Robert Foss <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tiwai authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2aabd8d View commit details
    Browse the repository at this point in the history
  184. media: dvb-usb: Fix memory leak at error in dvb_usb_device_init()

    commit 13a79f1 upstream.
    
    dvb_usb_device_init() allocates a dvb_usb_device object, but it
    doesn't release the object by itself even at errors.  The object is
    released in the callee side (dvb_usb_init()) in some error cases via
    dvb_usb_exit() call, but it also missed the object free in other error
    paths.  And, the caller (it's only dvb_usb_device_init()) doesn't seem
    caring the resource management as well, hence those memories are
    leaked.
    
    This patch assures releasing the memory at the error path in
    dvb_usb_device_init().  Now dvb_usb_init() frees the resources it
    allocated but leaves the passed dvb_usb_device object intact.  In
    turn, the dvb_usb_device object is released in dvb_usb_device_init()
    instead.
    We could use dvb_usb_exit() function for releasing everything in the
    callee (as it was used for some error cases in the original code), but
    releasing the passed object in the callee is non-intuitive and
    error-prone.  So I took this approach (which is more standard in Linus
    kernel code) although it ended with a bit more open codes.
    
    Along with the change, the patch makes sure that USB intfdata is reset
    and don't return the bogus pointer to the caller of
    dvb_usb_device_init() at the error path, too.
    
    Cc: <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sean Young <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tiwai authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e046910 View commit details
    Browse the repository at this point in the history
  185. media: staging/intel-ipu3: Fix memory leak in imu_fmt

    commit 3630901 upstream.
    
    We are losing the reference to an allocated memory if try. Change the
    order of the check to avoid that.
    
    Cc: [email protected]
    Fixes: 6d5f26f ("media: staging/intel-ipu3-v4l: reduce kernel stack usage")
    Signed-off-by: Ricardo Ribalda <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ribalda authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    74ba0ad View commit details
    Browse the repository at this point in the history
  186. media: staging/intel-ipu3: Fix set_fmt error handling

    commit ad91849 upstream.
    
    If there in an error during a set_fmt, do not overwrite the previous
    sizes with the invalid config.
    
    Without this patch, v4l2-compliance ends up allocating 4GiB of RAM and
    causing the following OOPs
    
    [   38.662975] ipu3-imgu 0000:00:05.0: swiotlb buffer is full (sz: 4096 bytes)
    [   38.662980] DMA: Out of SW-IOMMU space for 4096 bytes at device 0000:00:05.0
    [   38.663010] general protection fault: 0000 [esmil#1] PREEMPT SMP
    
    Cc: [email protected]
    Fixes: 6d5f26f ("media: staging/intel-ipu3-v4l: reduce kernel stack usage")
    Signed-off-by: Ricardo Ribalda <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ribalda authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    6fb617e View commit details
    Browse the repository at this point in the history
  187. media: staging/intel-ipu3: Fix race condition during set_fmt

    commit dccfe25 upstream.
    
    Do not modify imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, until the
    format has been correctly validated.
    
    Otherwise, even if we use a backup variable, there is a period of time
    where imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp might have an invalid
    value that can be used by other functions.
    
    Cc: [email protected]
    Fixes: ad91849 ("media: staging/intel-ipu3: Fix set_fmt error handling")
    Reviewed-by: Tomasz Figa <[email protected]>
    Signed-off-by: Ricardo Ribalda <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ribalda authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    cdaf358 View commit details
    Browse the repository at this point in the history
  188. media: v4l2-ctrls: fix reference to freed memory

    commit ac34b79 upstream.
    
    When controls are used together with the Request API, then for
    each request a v4l2_ctrl_handler struct is allocated. This contains
    the controls that can be set in a request. If a control is *not* set in
    the request, then the value used in the most recent previous request
    must be used, or the current value if it is not found in any outstanding
    requests.
    
    The framework tried to find such a previous request and it would set
    the 'req' pointer in struct v4l2_ctrl_ref to the v4l2_ctrl_ref of the
    control in such a previous request. So far, so good. However, when that
    previous request was applied to the hardware, returned to userspace, and
    then userspace would re-init or free that request, any 'ref' pointer in
    still-queued requests would suddenly point to freed memory.
    
    This was not noticed before since the drivers that use this expected
    that each request would always have the controls set, so there was
    never any need to find a control in older requests. This requirement
    was relaxed, and now this bug surfaced.
    
    It was also made worse by changeset
    2fae4d6 ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req")
    which increased the chance of this happening.
    
    The use of the 'req' pointer in v4l2_ctrl_ref was very fragile, so
    drop this entirely. Instead add a valid_p_req bool to indicate that
    p_req contains a valid value for this control. And if it is false,
    then just use the current value of the control.
    
    Note that VIDIOC_G_EXT_CTRLS will always return -EACCES when attempting
    to get a control from a request until the request is completed. And in
    that case, all controls in the request will have the control value set
    (i.e. valid_p_req is true). This means that the whole 'find the most
    recent previous request containing a control' idea is pointless, and
    the code can be simplified considerably.
    
    The v4l2_g_ext_ctrls_common() function was refactored a bit to make
    it more understandable. It also avoids updating volatile controls
    in a completed request since that was already done when the request
    was completed.
    
    Signed-off-by: Hans Verkuil <[email protected]>
    Fixes: 2fae4d6 ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req")
    Fixes: 6fa6f83 ("media: v4l2-ctrls: add core request support")
    Cc: <[email protected]>      # for v5.9 and up
    Tested-by: Alexandre Courbot <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Hans Verkuil authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    78cc3a5 View commit details
    Browse the repository at this point in the history
  189. media: coda: fix macroblocks count control usage

    commit 0b276e4 upstream.
    
    Commit b2d3bef ("media: coda: Add a V4L2 user for control error
    macroblocks count") add the control for the decoder devices. But
    during streamon() this ioctl gets called for all (encoder and decoder)
    devices and on encoder devices this causes a null pointer exception.
    
    Fix this by setting the control only if it is really accessible.
    
    Fixes: b2d3bef ("media: coda: Add a V4L2 user for control error macroblocks count")
    Signed-off-by: Marco Felsch <[email protected]>
    Cc: <[email protected]>
    Reviewed-by: Philipp Zabel <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Marco Felsch authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    259f7f0 View commit details
    Browse the repository at this point in the history
  190. media: venus: pm_helpers: Set opp clock name for v1

    commit 3215887 upstream.
    
    The rate of the core clock is set through devm_pm_opp_set_rate and
    to avoid errors from it we have to set the name of the clock via
    dev_pm_opp_set_clkname.
    
    Fixes: 9a538b8 ("media: venus: core: Add support for opp tables/perf voting")
    Cc: [email protected] # v5.10+
    Signed-off-by: Stanimir Varbanov <[email protected]>
    Tested-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stanimir Varbanov authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fc437f9 View commit details
    Browse the repository at this point in the history
  191. media: venus: venc_ctrls: Change default header mode

    commit 39a6b91 upstream.
    
    It is observed that on Venus v1 the default header-mode is producing
    a bitstream which is not playble. Change the default header-mode to
    joined with 1st frame.
    
    Fixes: 002c22b ("media: venus: venc: set inband mode property to FW.")
    Cc: [email protected] # v5.12
    Signed-off-by: Stanimir Varbanov <[email protected]>
    Tested-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stanimir Varbanov authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    63697f5 View commit details
    Browse the repository at this point in the history
  192. media: venus: hfi_cmds: Support plane-actual-info property from v1

    commit 15447d1 upstream.
    
    The property is supported from v1 and upwards. So move it to
    set_property_1x.
    
    Fixes: 01e869e ("media: venus: venc: fix handlig of S_SELECTION and G_SELECTION")
    Cc: [email protected] # v5.12
    Signed-off-by: Stanimir Varbanov <[email protected]>
    Tested-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stanimir Varbanov authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    bdb64c3 View commit details
    Browse the repository at this point in the history
  193. media: venus: hfi_parser: Don't initialize parser on v1

    commit 834124c upstream.
    
    The Venus v1 behaves differently comparing with the other Venus
    version in respect to capability parsing and when they are send
    to the driver. So we don't need to initialize hfi parser for
    multiple invocations like what we do for > v1 Venus versions.
    
    Fixes: 10865c9 ("media: venus: parser: Prepare parser for multiple invocations")
    Cc: [email protected] # v5.10+
    Signed-off-by: Stanimir Varbanov <[email protected]>
    Tested-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stanimir Varbanov authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    dbe610d View commit details
    Browse the repository at this point in the history
  194. media: venus: hfi_parser: Check for instance after hfi platform get

    commit 9b5d8fd upstream.
    
    The inst function argument is != NULL only for Venus v1 and
    we did not migrate v1 to a hfi_platform abstraction yet. So
    check for instance != NULL only after hfi_platform_get returns
    no error.
    
    Fixes: e299292 ("media: venus: Get codecs and capabilities from hfi platform")
    Cc: [email protected] # v5.12
    Signed-off-by: Stanimir Varbanov <[email protected]>
    Tested-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stanimir Varbanov authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    b60741f View commit details
    Browse the repository at this point in the history
  195. io_uring: remove extra sqpoll submission halting

    commit 3b763ba upstream.
    
    SQPOLL task won't submit requests for a context that is currently dying,
    so no need to remove ctx from sqd_list prior the main loop of
    io_ring_exit_work(). Kill it, will be removed by io_sq_thread_finish()
    and only brings confusion and lockups.
    
    Cc: [email protected]
    Signed-off-by: Pavel Begunkov <[email protected]>
    Link: https://lore.kernel.org/r/f220c2b786ba0f9499bebc9f3cd9714d29efb6a5.1618752958.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    isilence authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    949938b View commit details
    Browse the repository at this point in the history
  196. io_uring: fix shared sqpoll cancellation hangs

    commit 734551d upstream.
    
    [  736.982891] INFO: task iou-sqp-4294:4295 blocked for more than 122 seconds.
    [  736.982897] Call Trace:
    [  736.982901]  schedule+0x68/0xe0
    [  736.982903]  io_uring_cancel_sqpoll+0xdb/0x110
    [  736.982908]  io_sqpoll_cancel_cb+0x24/0x30
    [  736.982911]  io_run_task_work_head+0x28/0x50
    [  736.982913]  io_sq_thread+0x4e3/0x720
    
    We call io_uring_cancel_sqpoll() one by one for each ctx either in
    sq_thread() itself or via task works, and it's intended to cancel all
    requests of a specified context. However the function uses per-task
    counters to track the number of inflight requests, so it counts more
    requests than available via currect io_uring ctx and goes to sleep for
    them to appear (e.g. from IRQ), that will never happen.
    
    Cancel a bit more than before, i.e. all ctxs that share sqpoll
    and continue to use shared counters. Don't forget that we should not
    remove ctx from the list before running that task_work sqpoll-cancel,
    otherwise the function wouldn't be able to find the context and will
    hang.
    
    Reported-by: Joakim Hassila <[email protected]>
    Reported-by: Jens Axboe <[email protected]>
    Fixes: 37d1e2e ("io_uring: move SQPOLL thread io-wq forked worker")
    Cc: [email protected]
    Signed-off-by: Pavel Begunkov <[email protected]>
    Link: https://lore.kernel.org/r/1bded7e6c6b32e0bae25fce36be2868e46b116a0.1618752958.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    isilence authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    cb5e0b3 View commit details
    Browse the repository at this point in the history
  197. io_uring: fix work_exit sqpoll cancellations

    commit 28090c1 upstream.
    
    After closing an SQPOLL ring, io_ring_exit_work() kicks in and starts
    doing cancellations via io_uring_try_cancel_requests(). It will go
    through io_uring_try_cancel_iowq(), which uses ctx->tctx_list, but as
    SQPOLL task don't have a ctx note, its io-wq won't be reachable and so
    is left not cancelled.
    
    It will eventually cancelled when one of the tasks dies, but if a thread
    group survives for long and changes rings, it will spawn lots of
    unreclaimed resources and live locked works.
    
    Cancel SQPOLL task's io-wq separately in io_ring_exit_work().
    
    Cc: [email protected]
    Signed-off-by: Pavel Begunkov <[email protected]>
    Link: https://lore.kernel.org/r/a71a7fe345135d684025bb529d5cb1d8d6b46e10.1619389911.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    isilence authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    cabc762 View commit details
    Browse the repository at this point in the history
  198. io_uring: Check current->io_uring in io_uring_cancel_sqpoll

    commit 6d042ff upstream.
    
    syzkaller identified KASAN: null-ptr-deref Write in
    io_uring_cancel_sqpoll.
    
    io_uring_cancel_sqpoll is called by io_sq_thread before calling
    io_uring_alloc_task_context. This leads to current->io_uring being NULL.
    io_uring_cancel_sqpoll should not have to deal with threads where
    current->io_uring is NULL.
    
    In order to cast a wider safety net, perform input sanitisation directly
    in io_uring_cancel_sqpoll and return for NULL value of current->io_uring.
    This is safe since if current->io_uring isn't set, then there's no way
    for the task to have submitted any requests.
    
    Reported-by: [email protected]
    Cc: [email protected]
    Signed-off-by: Palash Oswal <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    oswalpalash authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c5bddca View commit details
    Browse the repository at this point in the history
  199. usb: gadget: dummy_hcd: fix gpf in gadget_setup

    commit 4a5d797 upstream.
    
    Fix a general protection fault reported by syzbot due to a race between
    gadget_setup() and gadget_unbind() in raw_gadget.
    
    The gadget core is supposed to guarantee that there won't be any more
    callbacks to the gadget driver once the driver's unbind routine is
    called. That guarantee is enforced in usb_gadget_remove_driver as
    follows:
    
            usb_gadget_disconnect(udc->gadget);
            if (udc->gadget->irq)
                    synchronize_irq(udc->gadget->irq);
            udc->driver->unbind(udc->gadget);
            usb_gadget_udc_stop(udc);
    
    usb_gadget_disconnect turns off the pullup resistor, telling the host
    that the gadget is no longer connected and preventing the transmission
    of any more USB packets. Any packets that have already been received
    are sure to processed by the UDC driver's interrupt handler by the time
    synchronize_irq returns.
    
    But this doesn't work with dummy_hcd, because dummy_hcd doesn't use
    interrupts; it uses a timer instead. It does have code to emulate the
    effect of synchronize_irq, but that code doesn't get invoked at the
    right time -- it currently runs in usb_gadget_udc_stop, after the unbind
    callback instead of before. Indeed, there's no way for
    usb_gadget_remove_driver to invoke this code before the unbind callback.
    
    To fix this, move the synchronize_irq() emulation code to dummy_pullup
    so that it runs before unbind. Also, add a comment explaining why it is
    necessary to have it there.
    
    Reported-by: [email protected]
    Suggested-by: Alan Stern <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Signed-off-by: Anirudh Rayabharam <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Cc: stable <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    anirudhrb authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    3c6f653 View commit details
    Browse the repository at this point in the history
  200. usb: gadget: Fix double free of device descriptor pointers

    commit 43c4cab upstream.
    
    Upon driver unbind usb_free_all_descriptors() function frees all
    speed descriptor pointers without setting them to NULL. In case
    gadget speed changes (i.e from super speed plus to super speed)
    after driver unbind only upto super speed descriptor pointers get
    populated. Super speed plus desc still holds the stale (already
    freed) pointer. Fix this issue by setting all descriptor pointers
    to NULL after freeing them in usb_free_all_descriptors().
    
    Fixes: f5c6122 ("usb: gadget: Update function for SuperSpeedPlus")
    cc: [email protected]
    Reviewed-by: Peter Chen <[email protected]>
    Signed-off-by: Hemant Kumar <[email protected]>
    Signed-off-by: Wesley Cheng <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Hemant Kumar authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d7a0965 View commit details
    Browse the repository at this point in the history
  201. usb: gadget/function/f_fs string table fix for multiple languages

    commit 55b74ce upstream.
    
    Fixes bug with the handling of more than one language in
    the string table in f_fs.c.
    str_count was not reset for subsequent language codes.
    str_count-- "rolls under" and processes u32 max strings on
    the processing of the second language entry.
    The existing bug can be reproduced by adding a second language table
    to the structure "strings" in tools/usb/ffs-test.c.
    
    Signed-off-by: Dean Anderson <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Cc: stable <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Dean Anderson authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    dfdc7ec View commit details
    Browse the repository at this point in the history
  202. usb: dwc3: gadget: Remove FS bInterval_m1 limitation

    commit 3232a3c upstream.
    
    The programming guide incorrectly stated that the DCFG.bInterval_m1 must
    be set to 0 when operating in fullspeed. There's no such limitation for
    all IPs. See DWC_usb3x programming guide section 3.2.2.1.
    
    Fixes: a1679af ("usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1")
    Cc: <[email protected]>
    Acked-by: Felipe Balbi <[email protected]>
    Signed-off-by: Thinh Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/5d4139ae89d810eb0a2d8577fb096fc88e87bfab.1618472454.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Thinh Nguyen authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    dda85fb View commit details
    Browse the repository at this point in the history
  203. usb: dwc3: gadget: Fix START_TRANSFER link state check

    commit c560e76 upstream.
    
    The START_TRANSFER command needs to be executed while in ON/U0 link
    state (with an exception during register initialization). Don't use
    dwc->link_state to check this since the driver only tracks the link
    state when the link state change interrupt is enabled. Check the link
    state from DSTS register instead.
    
    Note that often the host already brings the device out of low power
    before it sends/requests the next transfer. So, the user won't see any
    issue when the device starts transfer then. This issue is more
    noticeable in cases when the device delays starting transfer, which can
    happen during delayed control status after the host put the device in
    low power.
    
    Fixes: 799e9dc ("usb: dwc3: gadget: conditionally disable Link State change events")
    Cc: <[email protected]>
    Acked-by: Felipe Balbi <[email protected]>
    Signed-off-by: Thinh Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/bcefaa9ecbc3e1936858c0baa14de6612960e909.1618884221.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Thinh Nguyen authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d91827a View commit details
    Browse the repository at this point in the history
  204. usb: dwc3: core: Do core softreset when switch mode

    commit f88359e upstream.
    
    From: John Stultz <[email protected]>
    
    According to the programming guide, to switch mode for DRD controller,
    the driver needs to do the following.
    
    To switch from device to host:
    1. Reset controller with GCTL.CoreSoftReset
    2. Set GCTL.PrtCapDir(host mode)
    3. Reset the host with USBCMD.HCRESET
    4. Then follow up with the initializing host registers sequence
    
    To switch from host to device:
    1. Reset controller with GCTL.CoreSoftReset
    2. Set GCTL.PrtCapDir(device mode)
    3. Reset the device with DCTL.CSftRst
    4. Then follow up with the initializing registers sequence
    
    Currently we're missing step 1) to do GCTL.CoreSoftReset and step 3) of
    switching from host to device. John Stult reported a lockup issue seen
    with HiKey960 platform without these steps[1]. Similar issue is observed
    with Ferry's testing platform[2].
    
    So, apply the required steps along with some fixes to Yu Chen's and John
    Stultz's version. The main fixes to their versions are the missing wait
    for clocks synchronization before clearing GCTL.CoreSoftReset and only
    apply DCTL.CSftRst when switching from host to device.
    
    [1] https://lore.kernel.org/linux-usb/[email protected]/
    [2] https://lore.kernel.org/linux-usb/[email protected]/
    
    Fixes: 41ce145 ("usb: dwc3: core: make dwc3_set_mode() work properly")
    Cc: Andy Shevchenko <[email protected]>
    Cc: Ferry Toth <[email protected]>
    Cc: Wesley Cheng <[email protected]>
    Cc: <[email protected]>
    Tested-by: John Stultz <[email protected]>
    Tested-by: Wesley Cheng <[email protected]>
    Signed-off-by: Yu Chen <[email protected]>
    Signed-off-by: John Stultz <[email protected]>
    Signed-off-by: Thinh Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/374440f8dcd4f06c02c2caf4b1efde86774e02d9.1618521663.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    chenyu56 authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1c10fd6 View commit details
    Browse the repository at this point in the history
  205. usb: dwc2: Fix session request interrupt handler

    commit 42b32b1 upstream.
    
    According to programming guide in host mode, port
    power must be turned on in session request
    interrupt handlers.
    
    Fixes: 21795c8 ("usb: dwc2: exit hibernation on session request")
    Cc: <[email protected]>
    Acked-by: Minas Harutyunyan <[email protected]>
    Signed-off-by: Artur Petrosyan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Artur Petrosyan authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    07009d7 View commit details
    Browse the repository at this point in the history
  206. PCI: dwc: Move iATU detection earlier

    commit 8bcca26 upstream.
    
    dw_pcie_ep_init() depends on the detected iATU region numbers to allocate
    the in/outbound window management bitmap.  It fails after 281f1f9
    ("PCI: dwc: Detect number of iATU windows").
    
    Move the iATU region detection into a new function, move the detection to
    the very beginning of dw_pcie_host_init() and dw_pcie_ep_init().  Also
    remove it from the dw_pcie_setup(), since it's more like a software
    initialization step than hardware setup.
    
    Link: https://lore.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/linux-pci/[email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 281f1f9 ("PCI: dwc: Detect number of iATU windows")
    Tested-by: Kunihiko Hayashi <[email protected]>
    Tested-by: Marek Szyprowski <[email protected]>
    Tested-by: Manivannan Sadhasivam <[email protected]>
    Signed-off-by: Hou Zhiqiang <[email protected]>
    [DB: moved dw_pcie_iatu_detect to happen after host_init callback]
    Signed-off-by: Dmitry Baryshkov <[email protected]>
    Signed-off-by: Lorenzo Pieralisi <[email protected]>
    Reviewed-by: Rob Herring <[email protected]>
    Cc: [email protected]	# v5.11+
    Cc: Marek Szyprowski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Zhiqiang-Hou authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    bb2511e View commit details
    Browse the repository at this point in the history
  207. tty: fix memory leak in vc_deallocate

    commit 211b4d4 upstream.
    
    syzbot reported memory leak in tty/vt.
    The problem was in VT_DISALLOCATE ioctl cmd.
    After allocating unimap with PIO_UNIMAP it wasn't
    freed via VT_DISALLOCATE, but vc_cons[currcons].d was
    zeroed.
    
    Reported-by: [email protected]
    Signed-off-by: Pavel Skripkin <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    pskrgag authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    a46bbc1 View commit details
    Browse the repository at this point in the history
  208. rsi: Use resume_noirq for SDIO

    commit c434e5e upstream.
    
    The rsi_resume() does access the bus to enable interrupts on the RSI
    SDIO WiFi card, however when calling sdio_claim_host() in the resume
    path, it is possible the bus is already claimed and sdio_claim_host()
    spins indefinitelly. Enable the SDIO card interrupts in resume_noirq
    instead to prevent anything else from claiming the SDIO bus first.
    
    Fixes: 20db073 ("rsi: sdio suspend and resume support")
    Signed-off-by: Marek Vasut <[email protected]>
    Cc: Amitkumar Karwar <[email protected]>
    Cc: Angus Ainslie <[email protected]>
    Cc: David S. Miller <[email protected]>
    Cc: Jakub Kicinski <[email protected]>
    Cc: Kalle Valo <[email protected]>
    Cc: Karun Eagalapati <[email protected]>
    Cc: Martin Kepplinger <[email protected]>
    Cc: Sebastian Krzyszkowiak <[email protected]>
    Cc: Siva Rebbagondla <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Marek Vasut authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    0452b0b View commit details
    Browse the repository at this point in the history
  209. tools/power turbostat: Fix offset overflow issue in index converting

    commit 13a779d upstream.
    
    The idx_to_offset() function returns type int (32-bit signed), but
    MSR_PKG_ENERGY_STAT is u32 and would be interpreted as a negative number.
    The end result is that it hits the if (offset < 0) check in update_msr_sum()
    which prevents the timer callback from updating the stat in the background when
    long durations are used. The similar issue exists in offset_to_idx() and
    update_msr_sum(). Fix this issue by converting the 'int' to 'off_t' accordingly.
    
    Fixes: 9972d5d ("tools/power turbostat: Enable accumulate RAPL display")
    Signed-off-by: Calvin Walton <[email protected]>
    Signed-off-by: Len Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    kepstin authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    337b154 View commit details
    Browse the repository at this point in the history
  210. tracing: Map all PIDs to command lines

    commit 785e3c0 upstream.
    
    The default max PID is set by PID_MAX_DEFAULT, and the tracing
    infrastructure uses this number to map PIDs to the comm names of the
    tasks, such output of the trace can show names from the recorded PIDs in
    the ring buffer. This mapping is also exported to user space via the
    "saved_cmdlines" file in the tracefs directory.
    
    But currently the mapping expects the PIDs to be less than
    PID_MAX_DEFAULT, which is the default maximum and not the real maximum.
    Recently, systemd will increases the maximum value of a PID on the system,
    and when tasks are traced that have a PID higher than PID_MAX_DEFAULT, its
    comm is not recorded. This leads to the entire trace to have "<...>" as
    the comm name, which is pretty useless.
    
    Instead, keep the array mapping the size of PID_MAX_DEFAULT, but instead
    of just mapping the index to the comm, map a mask of the PID
    (PID_MAX_DEFAULT - 1) to the comm, and find the full PID from the
    map_cmdline_to_pid array (that already exists).
    
    This bug goes back to the beginning of ftrace, but hasn't been an issue
    until user space started increasing the maximum value of PIDs.
    
    Link: https://lkml.kernel.org/r/[email protected]
    
    Cc: [email protected]
    Fixes: bc0c38d ("ftrace: latency tracer infrastructure")
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rostedt authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    7bc6bc2 View commit details
    Browse the repository at this point in the history
  211. tracing: Restructure trace_clock_global() to never block

    commit aafe104 upstream.
    
    It was reported that a fix to the ring buffer recursion detection would
    cause a hung machine when performing suspend / resume testing. The
    following backtrace was extracted from debugging that case:
    
    Call Trace:
     trace_clock_global+0x91/0xa0
     __rb_reserve_next+0x237/0x460
     ring_buffer_lock_reserve+0x12a/0x3f0
     trace_buffer_lock_reserve+0x10/0x50
     __trace_graph_return+0x1f/0x80
     trace_graph_return+0xb7/0xf0
     ? trace_clock_global+0x91/0xa0
     ftrace_return_to_handler+0x8b/0xf0
     ? pv_hash+0xa0/0xa0
     return_to_handler+0x15/0x30
     ? ftrace_graph_caller+0xa0/0xa0
     ? trace_clock_global+0x91/0xa0
     ? __rb_reserve_next+0x237/0x460
     ? ring_buffer_lock_reserve+0x12a/0x3f0
     ? trace_event_buffer_lock_reserve+0x3c/0x120
     ? trace_event_buffer_reserve+0x6b/0xc0
     ? trace_event_raw_event_device_pm_callback_start+0x125/0x2d0
     ? dpm_run_callback+0x3b/0xc0
     ? pm_ops_is_empty+0x50/0x50
     ? platform_get_irq_byname_optional+0x90/0x90
     ? trace_device_pm_callback_start+0x82/0xd0
     ? dpm_run_callback+0x49/0xc0
    
    With the following RIP:
    
    RIP: 0010:native_queued_spin_lock_slowpath+0x69/0x200
    
    Since the fix to the recursion detection would allow a single recursion to
    happen while tracing, this lead to the trace_clock_global() taking a spin
    lock and then trying to take it again:
    
    ring_buffer_lock_reserve() {
      trace_clock_global() {
        arch_spin_lock() {
          queued_spin_lock_slowpath() {
            /* lock taken */
            (something else gets traced by function graph tracer)
              ring_buffer_lock_reserve() {
                trace_clock_global() {
                  arch_spin_lock() {
                    queued_spin_lock_slowpath() {
                    /* DEAD LOCK! */
    
    Tracing should *never* block, as it can lead to strange lockups like the
    above.
    
    Restructure the trace_clock_global() code to instead of simply taking a
    lock to update the recorded "prev_time" simply use it, as two events
    happening on two different CPUs that calls this at the same time, really
    doesn't matter which one goes first. Use a trylock to grab the lock for
    updating the prev_time, and if it fails, simply try again the next time.
    If it failed to be taken, that means something else is already updating
    it.
    
    Link: https://lkml.kernel.org/r/[email protected]
    
    Cc: [email protected]
    Tested-by: Konstantin Kharlamov <[email protected]>
    Tested-by: Todd Brandt <[email protected]>
    Fixes: b02414c ("ring-buffer: Fix recursion protection transitions between interrupt context") # started showing the problem
    Fixes: 14131f2 ("tracing: implement trace_clock_*() APIs") # where the bug happened
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212761
    Signed-off-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rostedt authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2a1bd74 View commit details
    Browse the repository at this point in the history
  212. dm persistent data: packed struct should have an aligned() attribute too

    commit a88b235 upstream.
    
    Otherwise most non-x86 architectures (e.g. riscv, arm) will resort to
    byte-by-byte access.
    
    Cc: [email protected]
    Signed-off-by: Joe Thornber <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jthornber authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    2f97deb View commit details
    Browse the repository at this point in the history
  213. dm space map common: fix division bug in sm_ll_find_free_block()

    commit 5208692 upstream.
    
    This division bug meant the search for free metadata space could skip
    the final allocation bitmap's worth of entries. Fix affects DM thinp,
    cache and era targets.
    
    Cc: [email protected]
    Signed-off-by: Joe Thornber <[email protected]>
    Tested-by: Ming-Hung Tsai <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jthornber authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    578f39e View commit details
    Browse the repository at this point in the history
  214. dm integrity: fix missing goto in bitmap_flush_interval error handling

    commit 17e9e13 upstream.
    
    Fixes: 468dfca ("dm integrity: add a bitmap mode")
    Cc: [email protected]
    Signed-off-by: Tian Tao <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Tian Tao authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    f2b61e8 View commit details
    Browse the repository at this point in the history
  215. dm rq: fix double free of blk_mq_tag_set in dev remove after table lo…

    …ad fails
    
    commit 8e947c8 upstream.
    
    When loading a device-mapper table for a request-based mapped device,
    and the allocation/initialization of the blk_mq_tag_set for the device
    fails, a following device remove will cause a double free.
    
    E.g. (dmesg):
      device-mapper: core: Cannot initialize queue for request-based dm-mq mapped device
      device-mapper: ioctl: unable to set up device queue for new table.
      Unable to handle kernel pointer dereference in virtual kernel address space
      Failing address: 0305e098835de000 TEID: 0305e098835de803
      Fault in home space mode while using kernel ASCE.
      AS:000000025efe0007 R3:0000000000000024
      Oops: 0038 ilc:3 [esmil#1] SMP
      Modules linked in: ... lots of modules ...
      Supported: Yes, External
      CPU: 0 PID: 7348 Comm: multipathd Kdump: loaded Tainted: G        W      X    5.3.18-53-default esmil#1 SLE15-SP3
      Hardware name: IBM 8561 T01 7I2 (LPAR)
      Krnl PSW : 0704e00180000000 000000025e368eca (kfree+0x42/0x330)
                 R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0 RI:0 EA:3
      Krnl GPRS: 000000000000004a 000000025efe5230 c1773200d779968d 0000000000000000
                 000000025e520270 000000025e8d1b40 0000000000000003 00000007aae10000
                 000000025e5202a2 0000000000000001 c1773200d779968d 0305e098835de640
                 00000007a8170000 000003ff80138650 000000025e5202a2 000003e00396faa8
      Krnl Code: 000000025e368eb8: c4180041e100       lgrl    %r1,25eba50b8
                 000000025e368ebe: ecba06b93a55       risbg   %r11,%r10,6,185,58
                #000000025e368ec4: e3b010000008       ag      %r11,0(%r1)
                >000000025e368eca: e310b0080004       lg      %r1,8(%r11)
                 000000025e368ed0: a7110001           tmll    %r1,1
                 000000025e368ed4: a7740129           brc     7,25e369126
                 000000025e368ed8: e320b0080004       lg      %r2,8(%r11)
                 000000025e368ede: b904001b           lgr     %r1,%r11
      Call Trace:
       [<000000025e368eca>] kfree+0x42/0x330
       [<000000025e5202a2>] blk_mq_free_tag_set+0x72/0xb8
       [<000003ff801316a8>] dm_mq_cleanup_mapped_device+0x38/0x50 [dm_mod]
       [<000003ff80120082>] free_dev+0x52/0xd0 [dm_mod]
       [<000003ff801233f0>] __dm_destroy+0x150/0x1d0 [dm_mod]
       [<000003ff8012bb9a>] dev_remove+0x162/0x1c0 [dm_mod]
       [<000003ff8012a988>] ctl_ioctl+0x198/0x478 [dm_mod]
       [<000003ff8012ac8a>] dm_ctl_ioctl+0x22/0x38 [dm_mod]
       [<000000025e3b11ee>] ksys_ioctl+0xbe/0xe0
       [<000000025e3b127a>] __s390x_sys_ioctl+0x2a/0x40
       [<000000025e8c15ac>] system_call+0xd8/0x2c8
      Last Breaking-Event-Address:
       [<000000025e52029c>] blk_mq_free_tag_set+0x6c/0xb8
      Kernel panic - not syncing: Fatal exception: panic_on_oops
    
    When allocation/initialization of the blk_mq_tag_set fails in
    dm_mq_init_request_queue(), it is uninitialized/freed, but the pointer
    is not reset to NULL; so when dev_remove() later gets into
    dm_mq_cleanup_mapped_device() it sees the pointer and tries to
    uninitialize and free it again.
    
    Fix this by setting the pointer to NULL in dm_mq_init_request_queue()
    error-handling. Also set it to NULL in dm_mq_cleanup_mapped_device().
    
    Cc: <[email protected]> # 4.6+
    Fixes: 1c357a1 ("dm: allocate blk_mq_tag_set rather than embed in mapped_device")
    Signed-off-by: Benjamin Block <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Benjamin-Block authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d757bf4 View commit details
    Browse the repository at this point in the history
  216. pinctrl: Ingenic: Add missing pins to the JZ4770 MAC MII group.

    commit 65afd97 upstream.
    
    The MII group of JZ4770's MAC should have 7 pins, add missing
    pins to the MII group.
    
    Fixes: 5de1a73 ("Pinctrl: Ingenic: Add missing parts for JZ4770 and JZ4780.")
    Cc: <[email protected]>
    Signed-off-by: 周琰杰 (Zhou Yanjie) <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Reviewed-by: Paul Cercueil <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    XBurst authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    dc1a515 View commit details
    Browse the repository at this point in the history
  217. pinctrl: Ingenic: Add support for read the pin configuration of X1830.

    commit 1d0bd58 upstream.
    
    Add X1830 support in "ingenic_pinconf_get()", so that it can read the
    configuration of X1830 SoC correctly.
    
    Fixes: d7da2a1 ("pinctrl: Ingenic: Add pinctrl driver for X1830.")
    Cc: <[email protected]>
    Signed-off-by: 周琰杰 (Zhou Yanjie) <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Reviewed-by: Paul Cercueil <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    XBurst authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    87bc16e View commit details
    Browse the repository at this point in the history
  218. lib/vsprintf.c: remove leftover 'f' and 'F' cases from bstr_printf()

    commit 84696cf upstream.
    
    Commit 9af7706 ("lib/vsprintf: Remove support for %pF and %pf in
    favour of %pS and %ps") removed support for %pF and %pf, and correctly
    removed the handling of those cases in vbin_printf(). However, the
    corresponding cases in bstr_printf() were left behind.
    
    In the same series, %pf was re-purposed for dealing with
    fwnodes (3bd32d6, "lib/vsprintf: Add %pfw conversion specifier
    for printing fwnode names").
    
    So should anyone use %pf with the binary printf routines,
    vbin_printf() would (correctly, as it involves dereferencing the
    pointer) do the string formatting to the u32 array, but bstr_printf()
    would not copy the string from the u32 array, but instead interpret
    the first sizeof(void*) bytes of the formatted string as a pointer -
    which generally won't end well (also, all subsequent get_args would be
    out of sync).
    
    Fixes: 9af7706 ("lib/vsprintf: Remove support for %pF and %pf in favour of %pS and %ps")
    Cc: [email protected]
    Signed-off-by: Rasmus Villemoes <[email protected]>
    Reviewed-by: Sakari Ailus <[email protected]>
    Signed-off-by: Petr Mladek <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Villemoes authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c23e941 View commit details
    Browse the repository at this point in the history
  219. thermal/drivers/cpufreq_cooling: Fix slab OOB issue

    commit 34ab17c upstream.
    
    Slab OOB issue is scanned by KASAN in cpu_power_to_freq().
    If power is limited below the power of OPP0 in EM table,
    it will cause slab out-of-bound issue with negative array
    index.
    
    Return the lowest frequency if limited power cannot found
    a suitable OPP in EM table to fix this issue.
    
    Backtrace:
    [<ffffffd02d2a37f0>] die+0x104/0x5ac
    [<ffffffd02d2a5630>] bug_handler+0x64/0xd0
    [<ffffffd02d288ce4>] brk_handler+0x160/0x258
    [<ffffffd02d281e5c>] do_debug_exception+0x248/0x3f0
    [<ffffffd02d284488>] el1_dbg+0x14/0xbc
    [<ffffffd02d75d1d4>] __kasan_report+0x1dc/0x1e0
    [<ffffffd02d75c2e0>] kasan_report+0x10/0x20
    [<ffffffd02d75def8>] __asan_report_load8_noabort+0x18/0x28
    [<ffffffd02e6fce5c>] cpufreq_power2state+0x180/0x43c
    [<ffffffd02e6ead80>] power_actor_set_power+0x114/0x1d4
    [<ffffffd02e6fac24>] allocate_power+0xaec/0xde0
    [<ffffffd02e6f9f80>] power_allocator_throttle+0x3ec/0x5a4
    [<ffffffd02e6ea888>] handle_thermal_trip+0x160/0x294
    [<ffffffd02e6edd08>] thermal_zone_device_check+0xe4/0x154
    [<ffffffd02d351cb4>] process_one_work+0x5e4/0xe28
    [<ffffffd02d352f44>] worker_thread+0xa4c/0xfac
    [<ffffffd02d360124>] kthread+0x33c/0x358
    [<ffffffd02d289940>] ret_from_fork+0xc/0x18
    
    Fixes: 371a3bc ("thermal/drivers/cpufreq_cooling: Fix wrong frequency converted from power")
    Signed-off-by: brian-sy yang <[email protected]>
    Signed-off-by: Michael Kao <[email protected]>
    Reviewed-by: Lukasz Luba <[email protected]>
    Cc: [email protected] #v5.7
    Signed-off-by: Daniel Lezcano <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    brian-sy-yang authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    6bf443a View commit details
    Browse the repository at this point in the history
  220. thermal/core/fair share: Lock the thermal zone while looping over ins…

    …tances
    
    commit fef0577 upstream.
    
    The tz->lock must be hold during the looping over the instances in that
    thermal zone. This lock was missing in the governor code since the
    beginning, so it's hard to point into a particular commit.
    
    CC: [email protected] # 4.4+
    Signed-off-by: Lukasz Luba <[email protected]>
    Signed-off-by: Daniel Lezcano <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    lukaszluba-arm authored and gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    142703b View commit details
    Browse the repository at this point in the history
  221. Linux 5.12.3

    Tested-by: Jon Hunter <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Fox Chen <[email protected]>
    Tested-by: Guenter Roeck <[email protected]>
    Tested-by: Jason Self <[email protected]>
    Tested-by: Shuah Khan <[email protected]>
    Tested-by: Justin M. Forbes <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    gregkh committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d795d7b View commit details
    Browse the repository at this point in the history
  222. gpio: starfive-vic: Add StarFive VIC GPIO driver

    Note: include Update GPIO driver[v0.9->v1.0]
          improves the module init and exit function to make sure that the
          driver can be initialized earlier than other drivers which need to
          use GPIO.
    
    Signed-off-by: Huan Feng <[email protected]>
    Signed-off-by: Emil Renner Berthing <[email protected]>
    huanfeng-sf authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    1448e7e View commit details
    Browse the repository at this point in the history
  223. Configuration menu
    Copy the full SHA
    e9ad574 View commit details
    Browse the repository at this point in the history
  224. Configuration menu
    Copy the full SHA
    6986c39 View commit details
    Browse the repository at this point in the history
  225. Configuration menu
    Copy the full SHA
    c5f47ed View commit details
    Browse the repository at this point in the history
  226. Configuration menu
    Copy the full SHA
    b1b6b2b View commit details
    Browse the repository at this point in the history
  227. sifive/sifive_l2_cache: Add Starfive support

    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    514a7d5 View commit details
    Browse the repository at this point in the history
  228. Configuration menu
    Copy the full SHA
    c8968e5 View commit details
    Browse the repository at this point in the history
  229. drivers/pwm: Add SiFive PWM PTC driver

    Chenjieqin authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    5966e90 View commit details
    Browse the repository at this point in the history
  230. drivers/pwm/pwm-sifive-ptc: Clear PWM CNTR

    Clear CNTR of PWM after setting period & duty_cycle
    yiming.li authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e88f18e View commit details
    Browse the repository at this point in the history
  231. drivers/dma: Add dw-axi-dmac-starfive driver for VIC7100

    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c42c3d9 View commit details
    Browse the repository at this point in the history
  232. drivers/i2c: Improve Synopsys DesignWare I2C adapter driver for StarF…

    …ive VIC7100
    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    8219fc8 View commit details
    Browse the repository at this point in the history
  233. drivers/i2c: Add GPIO configuration for VIC7100.

    [FIXME] why we can not do it in U-boot?
    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    39f9e38 View commit details
    Browse the repository at this point in the history
  234. net: stmmac: Add dcache flush functions for JH7100

    Note: including uSDK v0.9->v1.0 patch
    
    Warnings fixed by Matteo.
    
    Signed-off-by: Matteo Croce <[email protected]>
    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    cb765eb View commit details
    Browse the repository at this point in the history
  235. net: stmmac: Configure gtxclk based on speed

    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c485bfc View commit details
    Browse the repository at this point in the history
  236. drivers/mmc/host/dw_mmc: Add dcache flush(VIC7100 ONLY).

    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c4e2482 View commit details
    Browse the repository at this point in the history
  237. drivers/usb: Add dcache flush(VIC7100 ONLY)

    drivers/usb/cdns3/
    drivers/usb/core/
    drivers/usb/host/
    include/linux/usb.h
    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    20502a1 View commit details
    Browse the repository at this point in the history
  238. riscv/starfive: Add VIC7100 support

    Tom authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    07f543b View commit details
    Browse the repository at this point in the history
  239. drivers/video/fbdev and drivers/media/platform: starfive drivers added

    1, add ov5640&sc2235 drivers, update stf_isp
    2, add MIPI/CSI/DSI drivers for VIC7100
    jackzhustf authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    6142874 View commit details
    Browse the repository at this point in the history
  240. Configuration menu
    Copy the full SHA
    4091225 View commit details
    Browse the repository at this point in the history
  241. drivers/video/fbdev/starfive: workaround for unavailable pointer of dtb

    Fix sf_fb_map_video_memory in starfive_fb.c
    jackzhustf authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c770732 View commit details
    Browse the repository at this point in the history
  242. drivers/video/fbdev/starfive: fix compiler warnings

    Signed-off-by: Emil Renner Berthing <[email protected]>
    esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    9b19826 View commit details
    Browse the repository at this point in the history
  243. drivers/video/fbdev/starfive: improve error handling

    Signed-off-by: Emil Renner Berthing <[email protected]>
    esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    70c56a0 View commit details
    Browse the repository at this point in the history
  244. spi: cadence-quadspi: Allow compilation on RISC-V

    This IP is also used on the Starfive JH7100 riscv64 SoC and presumably
    also the upcoming JH7110 SoC.
    
    Signed-off-by: Emil Renner Berthing <[email protected]>
    esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    8c9b8b6 View commit details
    Browse the repository at this point in the history
  245. drivers/dma: Fix VIC7100 dw-axi-dmac-platform driver addition

    Descriptor management was simplified with commit:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ef6fb2d6f1abd56cc067c694253ea362159b5ac3
    
    Code added to dw-axi-dmac-platform driver due to VIC7100 Cache Coherency
    issues needed follow those changes.
    
    Signed-off-by: Michael Scott <[email protected]>
    mike-scott authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    63626bc View commit details
    Browse the repository at this point in the history
  246. [HACK] mfd: tps65086: make interrupt line optional

    The BeagleV Starlight v0.9 board doesn't have the IRQB line from the
    pmic routed to the SoC, so this hack is needed to allow the driver
    to be loaded without it. See
    beagleboard/beaglev-starlight#14
    
    Signed-off-by: Emil Renner Berthing <[email protected]>
    esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    ab290f9 View commit details
    Browse the repository at this point in the history
  247. power: reset: Add TPS65086 restart driver

    Signed-off-by: Emil Renner Berthing <[email protected]>
    esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    200b546 View commit details
    Browse the repository at this point in the history
  248. riscv: dts: Add JH7100 and BeagleV Starlight support

    This is the device tree from https://github.com/starfive-tech/u-boot/
    Rearranged, cleanups, fixes and TPS65086 added by Emil.
    Cleanups, fixes and LED added by Geert.
    
    Signed-off-by: yanhong.wang <[email protected]>
    Signed-off-by: Huan.Feng <[email protected]>
    Signed-off-by: ke.zhu <[email protected]>
    Signed-off-by: yiming.li <[email protected]>
    Signed-off-by: jack.zhu <[email protected]>
    Signed-off-by: Samin Guo <[email protected]>
    Signed-off-by: Chenjieqin <[email protected]>
    Signed-off-by: bo.li <[email protected]>
    Signed-off-by: Emil Renner Berthing <[email protected]>
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    TekkamanV authored and esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    65a406d View commit details
    Browse the repository at this point in the history
  249. [Not for upstream] Add build instructions

    For convenience this also adds a small starlight_defconfig and the
    firmware needed for the brcmfmac driver along with the signed regulatory
    database.
    
    The firmware is from the linux-firmware repo and the regulatory database
    from the wireless-regdb Fedora package.
    
    Signed-off-by: Emil Renner Berthing <[email protected]>
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    esmil committed May 12, 2021
    Configuration menu
    Copy the full SHA
    96d371a View commit details
    Browse the repository at this point in the history
  250. config: first attempt to enable jh7100

    Signed-off-by: Akira Tsukamoto <[email protected]>
    mcd500 committed May 12, 2021
    Configuration menu
    Copy the full SHA
    29f40d4 View commit details
    Browse the repository at this point in the history