óÐÉÓÏË ÉÚÍÅÎÅÎÉÊ × Linux 5.10.183

 
ACPI: thermal: drop an always true check [+ + +]
Author: Adam Borowski <kilobyte@angband.pl>
Date:   Mon Nov 15 18:32:08 2021 +0100

    ACPI: thermal: drop an always true check
    
    commit e5b5d25444e9ee3ae439720e62769517d331fa39 upstream.
    
    Address of a field inside a struct can't possibly be null; gcc-12 warns
    about this.
    
    Signed-off-by: Adam Borowski <kilobyte@angband.pl>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
af_packet: do not use READ_ONCE() in packet_bind() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri May 26 15:43:42 2023 +0000

    af_packet: do not use READ_ONCE() in packet_bind()
    
    [ Upstream commit 6ffc57ea004234d9373c57b204fd10370a69f392 ]
    
    A recent patch added READ_ONCE() in packet_bind() and packet_bind_spkt()
    
    This is better handled by reading pkt_sk(sk)->num later
    in packet_do_bind() while appropriate lock is held.
    
    READ_ONCE() in writers are often an evidence of something being wrong.
    
    Fixes: 822b5a1c17df ("af_packet: Fix data-races of pkt_sk(sk)->num.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20230526154342.2533026-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

af_packet: Fix data-races of pkt_sk(sk)->num. [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Wed May 24 16:29:34 2023 -0700

    af_packet: Fix data-races of pkt_sk(sk)->num.
    
    [ Upstream commit 822b5a1c17df7e338b9f05d1cfe5764e37c7f74f ]
    
    syzkaller found a data race of pkt_sk(sk)->num.
    
    The value is changed under lock_sock() and po->bind_lock, so we
    need READ_ONCE() to access pkt_sk(sk)->num without these locks in
    packet_bind_spkt(), packet_bind(), and sk_diag_fill().
    
    Note that WRITE_ONCE() is already added by commit c7d2ef5dd4b0
    ("net/packet: annotate accesses to po->bind").
    
    BUG: KCSAN: data-race in packet_bind / packet_do_bind
    
    write (marked) to 0xffff88802ffd1cee of 2 bytes by task 7322 on cpu 0:
     packet_do_bind+0x446/0x640 net/packet/af_packet.c:3236
     packet_bind+0x99/0xe0 net/packet/af_packet.c:3321
     __sys_bind+0x19b/0x1e0 net/socket.c:1803
     __do_sys_bind net/socket.c:1814 [inline]
     __se_sys_bind net/socket.c:1812 [inline]
     __x64_sys_bind+0x40/0x50 net/socket.c:1812
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    read to 0xffff88802ffd1cee of 2 bytes by task 7318 on cpu 1:
     packet_bind+0xbf/0xe0 net/packet/af_packet.c:3322
     __sys_bind+0x19b/0x1e0 net/socket.c:1803
     __do_sys_bind net/socket.c:1814 [inline]
     __se_sys_bind net/socket.c:1812 [inline]
     __x64_sys_bind+0x40/0x50 net/socket.c:1812
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    value changed: 0x0300 -> 0x0000
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 1 PID: 7318 Comm: syz-executor.4 Not tainted 6.3.0-13380-g7fddb5b5300c #4
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    
    Fixes: 96ec6327144e ("packet: Diag core and basic socket info dumping")
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzkaller <syzkaller@googlegroups.com>
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://lore.kernel.org/r/20230524232934.50950-1-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs. [+ + +]
Author: jasontao <jasontao@glenfly.com>
Date:   Wed Apr 26 09:30:59 2023 +0800

    ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs.
    
    [ Upstream commit c51e431052e2eacfb23fbf6b39bc6c8770d9827a ]
    
    Add a set of HD Audio PCI IDS, and the HDMI codec vendor IDs for
    Glenfly Gpus.
    
    - In default_bdl_pos_adj, set bdl to 128 as Glenfly Gpus have hardware
    limitation, need to increase hdac interrupt interval.
    - In azx_first_init, enable polling mode for Glenfly Gpu. When the codec
    complete the command, it sends interrupt and writes response entries to
    memory, howerver, the write requests sometimes are not actually
    synchronized to memory when driver handle hdac interrupt on Glenfly Gpus.
    If the RIRB status is not updated in the interrupt handler,
    azx_rirb_get_response keeps trying to recevie a response from rirb until
    1s timeout. Enabling polling mode for Glenfly Gpu can fix the issue.
    - In patch_gf_hdmi, set Glenlfy Gpu Codec's no_sticky_stream as it need
    driver to do actual clean-ups for the linked codec when switch from one
    codec to another.
    
    Signed-off-by: jasontao <jasontao@glenfly.com>
    Signed-off-by: Reaper Li <reaperlioc@glenfly.com>
    Link: https://lore.kernel.org/r/20230426013059.4329-1-reaperlioc@glenfly.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: oss: avoid missing-prototype warnings [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 16 21:50:42 2023 +0200

    ALSA: oss: avoid missing-prototype warnings
    
    [ Upstream commit 040b5a046a9e18098580d3ccd029e2318fca7859 ]
    
    Two functions are defined and used in pcm_oss.c but also optionally
    used from io.c, with an optional prototype. If CONFIG_SND_PCM_OSS_PLUGINS
    is disabled, this causes a warning as the functions are not static
    and have no prototype:
    
    sound/core/oss/pcm_oss.c:1235:19: error: no previous prototype for 'snd_pcm_oss_write3' [-Werror=missing-prototypes]
    sound/core/oss/pcm_oss.c:1266:19: error: no previous prototype for 'snd_pcm_oss_read3' [-Werror=missing-prototypes]
    
    Avoid this by making the prototypes unconditional.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20230516195046.550584-2-arnd@kernel.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
amd-xgbe: fix the false linkup in xgbe_phy_status [+ + +]
Author: Raju Rangoju <Raju.Rangoju@amd.com>
Date:   Thu May 25 23:56:12 2023 +0530

    amd-xgbe: fix the false linkup in xgbe_phy_status
    
    [ Upstream commit dc362e20cd6ab7a93d1b09669730c406f0910c35 ]
    
    In the event of a change in XGBE mode, the current auto-negotiation
    needs to be reset and the AN cycle needs to be re-triggerred. However,
    the current code ignores the return value of xgbe_set_mode(), leading to
    false information as the link is declared without checking the status
    register.
    
    Fix this by propagating the mode switch status information to
    xgbe_phy_status().
    
    Fixes: e57f7a3feaef ("amd-xgbe: Prepare for working with more than one type of phy")
    Co-developed-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
    Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64/mm: mark private VM_FAULT_X defines as vm_fault_t [+ + +]
Author: Min-Hua Chen <minhuadotchen@gmail.com>
Date:   Tue May 2 23:19:06 2023 +0800

    arm64/mm: mark private VM_FAULT_X defines as vm_fault_t
    
    [ Upstream commit d91d580878064b880f3574ac35b98d8b70ee8620 ]
    
    This patch fixes several sparse warnings for fault.c:
    
    arch/arm64/mm/fault.c:493:24: sparse: warning: incorrect type in return expression (different base types)
    arch/arm64/mm/fault.c:493:24: sparse:    expected restricted vm_fault_t
    arch/arm64/mm/fault.c:493:24: sparse:    got int
    arch/arm64/mm/fault.c:501:32: sparse: warning: incorrect type in return expression (different base types)
    arch/arm64/mm/fault.c:501:32: sparse:    expected restricted vm_fault_t
    arch/arm64/mm/fault.c:501:32: sparse:    got int
    arch/arm64/mm/fault.c:503:32: sparse: warning: incorrect type in return expression (different base types)
    arch/arm64/mm/fault.c:503:32: sparse:    expected restricted vm_fault_t
    arch/arm64/mm/fault.c:503:32: sparse:    got int
    arch/arm64/mm/fault.c:511:24: sparse: warning: incorrect type in return expression (different base types)
    arch/arm64/mm/fault.c:511:24: sparse:    expected restricted vm_fault_t
    arch/arm64/mm/fault.c:511:24: sparse:    got int
    arch/arm64/mm/fault.c:670:13: sparse: warning: restricted vm_fault_t degrades to integer
    arch/arm64/mm/fault.c:670:13: sparse: warning: restricted vm_fault_t degrades to integer
    arch/arm64/mm/fault.c:713:39: sparse: warning: restricted vm_fault_t degrades to integer
    
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
    Link: https://lore.kernel.org/r/20230502151909.128810-1-minhuadotchen@gmail.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ARM: 9295/1: unwind:fix unwind abort for uleb128 case [+ + +]
Author: Haibo Li <haibo.li@mediatek.com>
Date:   Mon Apr 17 10:17:07 2023 +0100

    ARM: 9295/1: unwind:fix unwind abort for uleb128 case
    
    [ Upstream commit fa3eeb638de0c1a9d2d860e5b48259facdd65176 ]
    
    When unwind instruction is 0xb2,the subsequent instructions
    are uleb128 bytes.
    For now,it uses only the first uleb128 byte in code.
    
    For vsp increments of 0x204~0x400,use one uleb128 byte like below:
    0xc06a00e4 <unwind_test_work>: 0x80b27fac
      Compact model index: 0
      0xb2 0x7f vsp = vsp + 1024
      0xac      pop {r4, r5, r6, r7, r8, r14}
    
    For vsp increments larger than 0x400,use two uleb128 bytes like below:
    0xc06a00e4 <unwind_test_work>: @0xc0cc9e0c
      Compact model index: 1
      0xb2 0x81 0x01 vsp = vsp + 1032
      0xac      pop {r4, r5, r6, r7, r8, r14}
    The unwind works well since the decoded uleb128 byte is also 0x81.
    
    For vsp increments larger than 0x600,use two uleb128 bytes like below:
    0xc06a00e4 <unwind_test_work>: @0xc0cc9e0c
      Compact model index: 1
      0xb2 0x81 0x02 vsp = vsp + 1544
      0xac      pop {r4, r5, r6, r7, r8, r14}
    In this case,the decoded uleb128 result is 0x101(vsp=0x204+(0x101<<2)).
    While the uleb128 used in code is 0x81(vsp=0x204+(0x81<<2)).
    The unwind aborts at this frame since it gets incorrect vsp.
    
    To fix this,add uleb128 decode to cover all the above case.
    
    Signed-off-by: Haibo Li <haibo.li@mediatek.com>
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: defconfig: drop CONFIG_DRM_RCAR_LVDS [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Thu Aug 11 16:27:13 2022 +0200

    ARM: defconfig: drop CONFIG_DRM_RCAR_LVDS
    
    commit 1441a15dd49616bd9dd4c25a018b0508cdada576 upstream.
    
    This is now a hidden symbol, so just drop the defconfig line.
    
    Fixes: 42d95d1b3a9c ("drm/rcar: stop using 'imply' for dependencies")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ARM: dts: stm32: add pin map for CAN controller on stm32f7 [+ + +]
Author: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Date:   Thu Apr 27 22:45:38 2023 +0200

    ARM: dts: stm32: add pin map for CAN controller on stm32f7
    
    [ Upstream commit 011644249686f2675e142519cd59e81e04cfc231 ]
    
    Add pin configurations for using CAN controller on stm32f7.
    
    Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
    Link: https://lore.kernel.org/all/20230427204540.3126234-4-dario.binacchi@amarulasolutions.com
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: dt-bindings: Adjust #sound-dai-cells on TI's single-DAI codecs [+ + +]
Author: Martin Povišer <povik+lin@cutebit.org>
Date:   Tue May 9 17:34:12 2023 +0200

    ASoC: dt-bindings: Adjust #sound-dai-cells on TI's single-DAI codecs
    
    [ Upstream commit efb2bfd7b3d210c479b9361c176d7426e5eb8663 ]
    
    A bunch of TI's codecs have binding schemas which force #sound-dai-cells
    to one despite those codecs only having a single DAI. Allow for bindings
    with zero DAI cells and deprecate the former non-zero value.
    
    Signed-off-by: Martin Povišer <povik+lin@cutebit.org
    Link: https://lore.kernel.org/r/20230509153412.62847-1-povik+lin@cutebit.org
    Signed-off-by: Mark Brown <broonie@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: dwc: limit the number of overrun messages [+ + +]
Author: Maxim Kochetkov <fido_max@inbox.ru>
Date:   Fri May 5 09:28:20 2023 +0300

    ASoC: dwc: limit the number of overrun messages
    
    [ Upstream commit ab6ecfbf40fccf74b6ec2ba7ed6dd2fc024c3af2 ]
    
    On slow CPU (FPGA/QEMU emulated) printing overrun messages from
    interrupt handler to uart console may leads to more overrun errors.
    So use dev_err_ratelimited to limit the number of error messages.
    
    Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru
    Link: https://lore.kernel.org/r/20230505062820.21840-1-fido_max@inbox.ru
    Signed-off-by: Mark Brown <broonie@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: ssm2602: Add workaround for playback distortions [+ + +]
Author: Paweł Anikiel <pan@semihalf.com>
Date:   Mon May 8 13:30:37 2023 +0200

    ASoC: ssm2602: Add workaround for playback distortions
    
    [ Upstream commit f63550e2b165208a2f382afcaf5551df9569e1d4 ]
    
    Apply a workaround for what appears to be a hardware quirk.
    
    The problem seems to happen when enabling "whole chip power" (bit D7
    register R6) for the very first time after the chip receives power. If
    either "output" (D4) or "DAC" (D3) aren't powered on at that time,
    playback becomes very distorted later on.
    
    This happens on the Google Chameleon v3, as well as on a ZYBO Z7-10:
    https://ez.analog.com/audio/f/q-a/543726/solved-ssm2603-right-output-offset-issue/480229
    I suspect this happens only when using an external MCLK signal (which
    is the case for both of these boards).
    
    Here are some experiments run on a Google Chameleon v3. These were run
    in userspace using a wrapper around the i2cset utility:
    ssmset() {
            i2cset -y 0 0x1a $(($1*2)) $2
    }
    
    For each of the following sequences, we apply power to the ssm2603
    chip, set the configuration registers R0-R5 and R7-R8, run the selected
    sequence, and check for distortions on playback.
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # chip, out, dac
      OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x87 # out, dac
      ssmset 0x06 0x07 # chip
      OK
    
      (disable MCLK)
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x1f # chip
      ssmset 0x06 0x07 # out, dac
      (enable MCLK)
      OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x1f # chip
      ssmset 0x06 0x07 # out, dac
      NOT OK
    
      ssmset 0x06 0x1f # chip
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # out, dac
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x0f # chip, out
      ssmset 0x06 0x07 # dac
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x17 # chip, dac
      ssmset 0x06 0x07 # out
      NOT OK
    
    For each of the following sequences, we apply power to the ssm2603
    chip, run the selected sequence, issue a reset with R15, configure
    R0-R5 and R7-R8, run one of the NOT OK sequences from above, and check
    for distortions.
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # chip, out, dac
      OK
    
      (disable MCLK)
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x07 # chip, out, dac
      (enable MCLK after reset)
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x17 # chip, dac
      NOT OK
    
      ssmset 0x09 0x01 # core
      ssmset 0x06 0x0f # chip, out
      NOT OK
    
      ssmset 0x06 0x07 # chip, out, dac
      NOT OK
    
    Signed-off-by: Paweł Anikiel <pan@semihalf.com
    Link: https://lore.kernel.org/r/20230508113037.137627-8-pan@semihalf.com
    Signed-off-by: Mark Brown <broonie@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ata: libata-scsi: Use correct device no in ata_find_dev() [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Mon May 22 20:09:57 2023 +0900

    ata: libata-scsi: Use correct device no in ata_find_dev()
    
    commit 7f875850f20a42f488840c9df7af91ef7db2d576 upstream.
    
    For devices not attached to a port multiplier and managed directly by
    libata, the device number passed to ata_find_dev() must always be lower
    than the maximum number of devices returned by ata_link_max_devices().
    That is 1 for SATA devices or 2 for an IDE link with master+slave
    devices. This device number is the SCSI device ID which matches these
    constraints as the IDs are generated per port and so never exceed the
    maximum number of devices for the link being used.
    
    However, for libsas managed devices, SCSI device IDs are assigned per
    struct scsi_host, leading to device IDs for SATA devices that can be
    well in excess of libata per-link maximum number of devices. This
    results in ata_find_dev() to always return NULL for libsas managed
    devices except for the first device of the target scsi_host with ID
    (device number) equal to 0. This issue is visible by executing the
    hdparm utility, which fails. E.g.:
    
    hdparm -i /dev/sdX
    /dev/sdX:
      HDIO_GET_IDENTITY failed: No message of desired type
    
    Fix this by rewriting ata_find_dev() to ignore the device number for
    non-PMP attached devices with a link with at most 1 device, that is SATA
    devices. For these, the device number 0 is always used to
    return the correct pointer to the struct ata_device of the port link.
    This change excludes IDE master/slave setups (maximum number of devices
    per link is 2) and port-multiplier attached devices. Also, to be
    consistant with the fact that SCSI device IDs and channel numbers used
    as device numbers are both unsigned int, change the devno argument of
    ata_find_dev() to unsigned int.
    
    Reported-by: Xingui Yang <yangxingui@huawei.com>
    Fixes: 41bda9c98035 ("libata-link: update hotplug to handle PMP links")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Jason Yan <yanaijie@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ath6kl: Use struct_group() to avoid size-mismatched casting [+ + +]
Author: Kees Cook <keescook@chromium.org>
Date:   Wed Dec 8 10:44:00 2021 +0200

    ath6kl: Use struct_group() to avoid size-mismatched casting
    
    commit e3128a9d482cff9cc2a826adec5e1f7acb922b8f upstream.
    
    In builds with -Warray-bounds, casts from smaller objects to larger
    objects will produce warnings. These can be overly conservative, but since
    -Warray-bounds has been finding legitimate bugs, it is desirable to turn
    it on globally. Instead of casting a u32 to a larger object, redefine
    the u32 portion of the header to a separate struct that can be used for
    both u32 operations and the distinct header fields. Silences this warning:
    
    drivers/net/wireless/ath/ath6kl/htc_mbox.c: In function 'htc_wait_for_ctrl_msg':
    drivers/net/wireless/ath/ath6kl/htc_mbox.c:2275:20: error: array subscript 'struct htc_frame_hdr[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'} [-Werror=array-bounds]
     2275 |         if (htc_hdr->eid != ENDPOINT_0)
          |                    ^~
    drivers/net/wireless/ath/ath6kl/htc_mbox.c:2264:13: note: while referencing 'look_ahead'
     2264 |         u32 look_ahead;
          |             ^~~~~~~~~~
    
    This change results in no executable instruction differences.
    
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20211207063538.2767954-1-keescook@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
atm: hide unused procfs functions [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 16 21:45:34 2023 +0200

    atm: hide unused procfs functions
    
    [ Upstream commit fb1b7be9b16c1f4626969ba4e95a97da2a452b41 ]
    
    When CONFIG_PROC_FS is disabled, the function declarations for some
    procfs functions are hidden, but the definitions are still build,
    as shown by this compiler warning:
    
    net/atm/resources.c:403:7: error: no previous prototype for 'atm_dev_seq_start' [-Werror=missing-prototypes]
    net/atm/resources.c:409:6: error: no previous prototype for 'atm_dev_seq_stop' [-Werror=missing-prototypes]
    net/atm/resources.c:414:7: error: no previous prototype for 'atm_dev_seq_next' [-Werror=missing-prototypes]
    
    Add another #ifdef to leave these out of the build.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20230516194625.549249-2-arnd@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
block/rnbd: replace REQ_OP_FLUSH with REQ_OP_WRITE [+ + +]
Author: Guoqing Jiang <guoqing.jiang@linux.dev>
Date:   Fri May 12 11:46:31 2023 +0800

    block/rnbd: replace REQ_OP_FLUSH with REQ_OP_WRITE
    
    [ Upstream commit 5e6e08087a4acb4ee3574cea32dbff0f63c7f608 ]
    
    Since flush bios are implemented as writes with no data and
    the preflush flag per Christoph's comment [1].
    
    And we need to change it in rnbd accordingly. Otherwise, I
    got splatting when create fs from rnbd client.
    
    [  464.028545] ------------[ cut here ]------------
    [  464.028553] WARNING: CPU: 0 PID: 65 at block/blk-core.c:751 submit_bio_noacct+0x32c/0x5d0
    [ ... ]
    [  464.028668] CPU: 0 PID: 65 Comm: kworker/0:1H Tainted: G           OE      6.4.0-rc1 #9
    [  464.028671] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
    [  464.028673] Workqueue: ib-comp-wq ib_cq_poll_work [ib_core]
    [  464.028717] RIP: 0010:submit_bio_noacct+0x32c/0x5d0
    [  464.028720] Code: 03 0f 85 51 fe ff ff 48 8b 43 18 8b 88 04 03 00 00 85 c9 0f 85 3f fe ff ff e9 be fd ff ff 0f b6 d0 3c 0d 74 26 83 fa 01 74 21 <0f> 0b b8 0a 00 00 00 e9 56 fd ff ff 4c 89 e7 e8 70 a1 03 00 84 c0
    [  464.028722] RSP: 0018:ffffaf3680b57c68 EFLAGS: 00010202
    [  464.028724] RAX: 0000000000060802 RBX: ffffa09dcc18bf00 RCX: 0000000000000000
    [  464.028726] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffffa09dde081d00
    [  464.028727] RBP: ffffaf3680b57c98 R08: ffffa09dde081d00 R09: ffffa09e38327200
    [  464.028729] R10: 0000000000000000 R11: 0000000000000000 R12: ffffa09dde081d00
    [  464.028730] R13: ffffa09dcb06e1e8 R14: 0000000000000000 R15: 0000000000200000
    [  464.028733] FS:  0000000000000000(0000) GS:ffffa09e3bc00000(0000) knlGS:0000000000000000
    [  464.028735] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  464.028736] CR2: 000055a4e8206c40 CR3: 0000000119f06000 CR4: 00000000003506f0
    [  464.028738] Call Trace:
    [  464.028740]  <TASK>
    [  464.028746]  submit_bio+0x1b/0x80
    [  464.028748]  rnbd_srv_rdma_ev+0x50d/0x10c0 [rnbd_server]
    [  464.028754]  ? percpu_ref_get_many.constprop.0+0x55/0x140 [rtrs_server]
    [  464.028760]  ? __this_cpu_preempt_check+0x13/0x20
    [  464.028769]  process_io_req+0x1dc/0x450 [rtrs_server]
    [  464.028775]  rtrs_srv_inv_rkey_done+0x67/0xb0 [rtrs_server]
    [  464.028780]  __ib_process_cq+0xbc/0x1f0 [ib_core]
    [  464.028793]  ib_cq_poll_work+0x2b/0xa0 [ib_core]
    [  464.028804]  process_one_work+0x2a9/0x580
    
    [1]. https://lore.kernel.org/all/ZFHgefWofVt24tRl@infradead.org/
    
    Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Link: https://lore.kernel.org/r/20230512034631.28686-1-guoqing.jiang@linux.dev
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
btrfs: abort transaction when sibling keys check fails for leaves [+ + +]
Author: Filipe Manana <fdmanana@suse.com>
Date:   Wed Apr 26 11:51:35 2023 +0100

    btrfs: abort transaction when sibling keys check fails for leaves
    
    [ Upstream commit 9ae5afd02a03d4e22a17a9609b19400b77c36273 ]
    
    If the sibling keys check fails before we move keys from one sibling
    leaf to another, we are not aborting the transaction - we leave that to
    some higher level caller of btrfs_search_slot() (or anything else that
    uses it to insert items into a b+tree).
    
    This means that the transaction abort will provide a stack trace that
    omits the b+tree modification call chain. So change this to immediately
    abort the transaction and therefore get a more useful stack trace that
    shows us the call chain in the bt+tree modification code.
    
    It's also important to immediately abort the transaction just in case
    some higher level caller is not doing it, as this indicates a very
    serious corruption and we should stop the possibility of doing further
    damage.
    
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: fix csum_tree_block page iteration to avoid tripping on -Werror=array-bounds [+ + +]
Author: pengfuyuan <pengfuyuan@kylinos.cn>
Date:   Tue May 23 15:09:55 2023 +0800

    btrfs: fix csum_tree_block page iteration to avoid tripping on -Werror=array-bounds
    
    commit 5ad9b4719fc9bc4715c7e19875a962095b0577e7 upstream.
    
    When compiling on a MIPS 64-bit machine we get these warnings:
    
        In file included from ./arch/mips/include/asm/cacheflush.h:13,
                         from ./include/linux/cacheflush.h:5,
                         from ./include/linux/highmem.h:8,
                         from ./include/linux/bvec.h:10,
                         from ./include/linux/blk_types.h:10,
                         from ./include/linux/blkdev.h:9,
                         from fs/btrfs/disk-io.c:7:
        fs/btrfs/disk-io.c: In function ‘csum_tree_block’:
        fs/btrfs/disk-io.c:100:34: error: array subscript 1 is above array bounds of ‘struct page *[1]’ [-Werror=array-bounds]
          100 |   kaddr = page_address(buf->pages[i]);
              |                        ~~~~~~~~~~^~~
        ./include/linux/mm.h:2135:48: note: in definition of macro ‘page_address’
         2135 | #define page_address(page) lowmem_page_address(page)
              |                                                ^~~~
        cc1: all warnings being treated as errors
    
    We can check if i overflows to solve the problem. However, this doesn't make
    much sense, since i == 1 and num_pages == 1 doesn't execute the body of the loop.
    In addition, i < num_pages can also ensure that buf->pages[i] will not cross
    the boundary. Unfortunately, this doesn't help with the problem observed here:
    gcc still complains.
    
    To fix this add a compile-time condition for the extent buffer page
    array size limit, which would eventually lead to eliminating the whole
    for loop.
    
    CC: stable@vger.kernel.org # 5.10+
    Signed-off-by: pengfuyuan <pengfuyuan@kylinos.cn>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
crypto: ccp: Play nice with vmalloc'd memory for SEV command structs [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Tue Apr 6 15:49:48 2021 -0700

    crypto: ccp: Play nice with vmalloc'd memory for SEV command structs
    
    commit 8347b99473a313be6549a5b940bc3c56a71be81c upstream.
    
    Copy the incoming @data comman to an internal buffer so that callers can
    put SEV command buffers on the stack without running afoul of
    CONFIG_VMAP_STACK=y, i.e. without bombing on vmalloc'd pointers.  As of
    today, the largest supported command takes a 68 byte buffer, i.e. pretty
    much every command can be put on the stack.  Because sev_cmd_mutex is
    held for the entirety of a transaction, only a single bounce buffer is
    required.
    
    Use the internal buffer unconditionally, as the majority of in-kernel
    users will soon switch to using the stack.  At that point, checking
    virt_addr_valid() becomes (negligible) overhead in most cases, and
    supporting both paths slightly increases complexity.  Since the commands
    are all quite small, the cost of the copies is insignificant compared to
    the latency of communicating with the PSP.
    
    Allocate a full page for the buffer as opportunistic preparation for
    SEV-SNP, which requires the command buffer to be in firmware state for
    commands that trigger memory writes from the PSP firmware.  Using a full
    page now will allow SEV-SNP support to simply transition the page as
    needed.
    
    Cc: Brijesh Singh <brijesh.singh@amd.com>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Tom Lendacky <thomas.lendacky@amd.com>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-Id: <20210406224952.4177376-5-seanjc@google.com>
    Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
    Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Ben Hutchings <benh@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: ccp: Reject SEV commands with mismatching command buffer [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Tue Apr 6 15:49:47 2021 -0700

    crypto: ccp: Reject SEV commands with mismatching command buffer
    
    commit d5760dee127bf6f390b05e747369d7c37ae1a7b8 upstream.
    
    WARN on and reject SEV commands that provide a valid data pointer, but do
    not have a known, non-zero length.  And conversely, reject commands that
    take a command buffer but none is provided (data is null).
    
    Aside from sanity checking input, disallowing a non-null pointer without
    a non-zero size will allow a future patch to cleanly handle vmalloc'd
    data by copying the data to an internal __pa() friendly buffer.
    
    Note, this also effectively prevents callers from using commands that
    have a non-zero length and are not known to the kernel.  This is not an
    explicit goal, but arguably the side effect is a good thing from the
    kernel's perspective.
    
    Cc: Brijesh Singh <brijesh.singh@amd.com>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-Id: <20210406224952.4177376-4-seanjc@google.com>
    Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
    Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Ben Hutchings <benh@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dmaengine: at_xdmac: Fix concurrency over chan's completed_cookie [+ + +]
Author: Tudor Ambarus <tudor.ambarus@linaro.org>
Date:   Wed Dec 15 13:01:07 2021 +0200

    dmaengine: at_xdmac: Fix concurrency over chan's completed_cookie
    
    [ Upstream commit 506875c30fc5bf92246060bc3b4c38799646266b ]
    
    Caller of dma_cookie_complete is expected to hold a lock to prevent
    concurrency over the channel's completed cookie marker. Call
    dma_cookie_complete() with the lock held.
    
    Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver")
    Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
    Link: https://lore.kernel.org/r/20211215110115.191749-5-tudor.ambarus@microchip.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Stable-dep-of: 4d43acb145c3 ("dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Mon May 15 13:32:10 2023 +0300

    dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()
    
    [ Upstream commit 4d43acb145c363626d76f49febb4240c488cd1cf ]
    
    There are two place if the at_xdmac_interleaved_queue_desc() fails which
    could lead to a NULL dereference where "first" is NULL and we call
    list_add_tail(&first->desc_node, ...).  In the first caller, the return
    is not checked so add a check for that.  In the next caller, the return
    is checked but if it fails on the first iteration through the loop then
    it will lead to a NULL pointer dereference.
    
    Fixes: 4e5385784e69 ("dmaengine: at_xdmac: handle numf > 1")
    Fixes: 62b5cb757f1d ("dmaengine: at_xdmac: fix memory leak in interleaved mode")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Link: https://lore.kernel.org/r/21282b66-9860-410a-83df-39c17fcf2f1b@kili.mountain
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: at_xdmac: Fix race for the tx desc callback [+ + +]
Author: Tudor Ambarus <tudor.ambarus@linaro.org>
Date:   Wed Dec 15 13:01:08 2021 +0200

    dmaengine: at_xdmac: Fix race for the tx desc callback
    
    [ Upstream commit b63e5cb94ad6947ab5fe38b5a9417dcfd0bc6122 ]
    
    The transfer descriptors were wrongly moved to the free descriptors list
    before calling the tx desc callback. As the DMA engine drivers drop any
    locks before calling the callback function, txd could be taken again,
    resulting in its callback called prematurely. Fix the race for the tx desc
    callback by moving the xfer desc into the free desc list after the
    callback is invoked.
    
    Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver")
    Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
    Link: https://lore.kernel.org/r/20211215110115.191749-6-tudor.ambarus@microchip.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Stable-dep-of: 4d43acb145c3 ("dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: at_xdmac: Move the free desc to the tail of the desc list [+ + +]
Author: Tudor Ambarus <tudor.ambarus@linaro.org>
Date:   Wed Dec 15 13:01:09 2021 +0200

    dmaengine: at_xdmac: Move the free desc to the tail of the desc list
    
    [ Upstream commit 801db90bf294f647b967e8d99b9ae121bea63d0d ]
    
    Move the free desc to the tail of the list, so that the sequence of
    descriptors is more track-able in case of debug. One would know which
    descriptor should come next and could easier catch concurrency over
    descriptors for example. virt-dma uses list_splice_tail_init() as well,
    follow the core driver.
    
    Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
    Link: https://lore.kernel.org/r/20211215110115.191749-7-tudor.ambarus@microchip.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Stable-dep-of: 4d43acb145c3 ("dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: pl330: rename _start to prevent build error [+ + +]
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Tue May 23 21:53:10 2023 -0700

    dmaengine: pl330: rename _start to prevent build error
    
    [ Upstream commit a1a5f2c887252dec161c1e12e04303ca9ba56fa9 ]
    
    "_start" is used in several arches and proably should be reserved
    for ARCH usage. Using it in a driver for a private symbol can cause
    a build error when it conflicts with ARCH usage of the same symbol.
    
    Therefore rename pl330's "_start" to "pl330_start_thread" so that there
    is no conflict and no build error.
    
    drivers/dma/pl330.c:1053:13: error: '_start' redeclared as different kind of symbol
     1053 | static bool _start(struct pl330_thread *thrd)
          |             ^~~~~~
    In file included from ../include/linux/interrupt.h:21,
                     from ../drivers/dma/pl330.c:18:
    arch/riscv/include/asm/sections.h:11:13: note: previous declaration of '_start' with type 'char[]'
       11 | extern char _start[];
          |             ^~~~~~
    
    Fixes: b7d861d93945 ("DMA: PL330: Merge PL330 driver into drivers/dma/")
    Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Cc: Jaswinder Singh <jassisinghbrar@gmail.com>
    Cc: Boojin Kim <boojin.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzk@kernel.org>
    Cc: Russell King <rmk+kernel@arm.linux.org.uk>
    Cc: Vinod Koul <vkoul@kernel.org>
    Cc: dmaengine@vger.kernel.org
    Cc: linux-riscv@lists.infradead.org
    Link: https://lore.kernel.org/r/20230524045310.27923-1-rdunlap@infradead.org
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/msm: Be more shouty if per-process pgtables aren't working [+ + +]
Author: Rob Clark <robdclark@chromium.org>
Date:   Tue May 16 15:20:37 2023 -0700

    drm/msm: Be more shouty if per-process pgtables aren't working
    
    [ Upstream commit 5c054db54c43a5fcb5cc81012361f5e3fac37637 ]
    
    Otherwise it is not always obvious if a dt or iommu change is causing us
    to fall back to global pgtable.
    
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Patchwork: https://patchwork.freedesktop.org/patch/537359/
    Link: https://lore.kernel.org/r/20230516222039.907690-2-robdclark@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/rcar: stop using 'imply' for dependencies [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Mon Sep 27 16:26:23 2021 +0200

    drm/rcar: stop using 'imply' for dependencies
    
    commit 42d95d1b3a9c649bf5ee881fee5938e00126479a upstream.
    
    The meaning of the 'imply' keyword has changed recently, and neither the
    old meaning (select the symbol if its dependencies are met) nor the new
    meaning (enable it by default, but let the user set any other setting)
    is what we want here.
    
    Work around this by adding two more Kconfig options that lead to
    the correct behavior: if DRM_RCAR_USE_CMM and DRM_RCAR_USE_LVDS
    are enabled, that portion of the driver becomes usable, and no
    configuration results in a link error.
    
    This avoids a link failure:
    
    arm-linux-gnueabi-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_crtc_atomic_begin':
    rcar_du_crtc.c:(.text+0x1444): undefined reference to `rcar_cmm_setup'
    arm-linux-gnueabi-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_crtc_atomic_enable':
    rcar_du_crtc.c:(.text+0x14d4): undefined reference to `rcar_cmm_enable'
    arm-linux-gnueabi-ld: rcar_du_crtc.c:(.text+0x1548): undefined reference to `rcar_cmm_setup'
    arm-linux-gnueabi-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_crtc_atomic_disable':
    rcar_du_crtc.c:(.text+0x18b8): undefined reference to `rcar_cmm_disable'
    arm-linux-gnueabi-ld: drivers/gpu/drm/rcar-du/rcar_du_kms.o: in function `rcar_du_modeset_init':
    
    Link: https://lore.kernel.org/all/20200417155553.675905-5-arnd@arndb.de/
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Cc: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
eth: sun: cassini: remove dead code [+ + +]
Author: Martin Liška <mliska@suse.cz>
Date:   Wed May 18 09:18:53 2022 +0200

    eth: sun: cassini: remove dead code
    
    commit 32329216ca1d6ee29c41215f18b3053bb6158541 upstream.
    
    Fixes the following GCC warning:
    
    drivers/net/ethernet/sun/cassini.c:1316:29: error: comparison between two arrays [-Werror=array-compare]
    drivers/net/ethernet/sun/cassini.c:3783:34: error: comparison between two arrays [-Werror=array-compare]
    
    Note that 2 arrays should be compared by comparing of their addresses:
    note: use ‘&cas_prog_workaroundtab[0] == &cas_prog_null[0]’ to compare the addresses
    
    Signed-off-by: Martin Liska <mliska@suse.cz>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ext4: add EA_INODE checking to ext4_iget() [+ + +]
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Tue May 23 23:49:48 2023 -0400

    ext4: add EA_INODE checking to ext4_iget()
    
    commit b3e6bcb94590dea45396b9481e47b809b1be4afa upstream.
    
    Add a new flag, EXT4_IGET_EA_INODE which indicates whether the inode
    is expected to have the EA_INODE flag or not.  If the flag is not
    set/clear as expected, then fail the iget() operation and mark the
    file system as corrupted.
    
    This commit also makes the ext4_iget() always perform the
    is_bad_inode() check even when the inode is already inode cache.  This
    allows us to remove the is_bad_inode() check from the callers of
    ext4_iget() in the ea_inode code.
    
    Reported-by: syzbot+cbb68193bdb95af4340a@syzkaller.appspotmail.com
    Reported-by: syzbot+62120febbd1ee3c3c860@syzkaller.appspotmail.com
    Reported-by: syzbot+edce54daffee36421b4c@syzkaller.appspotmail.com
    Cc: stable@kernel.org
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230524034951.779531-2-tytso@mit.edu
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: add lockdep annotations for i_data_sem for ea_inode's [+ + +]
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Tue May 23 23:49:51 2023 -0400

    ext4: add lockdep annotations for i_data_sem for ea_inode's
    
    commit aff3bea95388299eec63440389b4545c8041b357 upstream.
    
    Treat i_data_sem for ea_inodes as being in their own lockdep class to
    avoid lockdep complaints about ext4_setattr's use of inode_lock() on
    normal inodes potentially causing lock ordering with i_data_sem on
    ea_inodes in ext4_xattr_inode_write().  However, ea_inodes will be
    operated on by ext4_setattr(), so this isn't a problem.
    
    Cc: stable@kernel.org
    Link: https://syzkaller.appspot.com/bug?extid=298c5d8fb4a128bc27b0
    Reported-by: syzbot+298c5d8fb4a128bc27b0@syzkaller.appspotmail.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230524034951.779531-5-tytso@mit.edu
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: disallow ea_inodes with extended attributes [+ + +]
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Tue May 23 23:49:50 2023 -0400

    ext4: disallow ea_inodes with extended attributes
    
    commit 2bc7e7c1a3bc9bd0cbf0f71006f6fe7ef24a00c2 upstream.
    
    An ea_inode stores the value of an extended attribute; it can not have
    extended attributes itself, or this will cause recursive nightmares.
    Add a check in ext4_iget() to make sure this is the case.
    
    Cc: stable@kernel.org
    Reported-by: syzbot+e44749b6ba4d0434cd47@syzkaller.appspotmail.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230524034951.779531-4-tytso@mit.edu
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: enable the lazy init thread when remounting read/write [+ + +]
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Fri May 26 23:57:29 2023 -0400

    ext4: enable the lazy init thread when remounting read/write
    
    commit eb1f822c76beeaa76ab8b6737ab9dc9f9798408c upstream.
    
    In commit a44be64bbecb ("ext4: don't clear SB_RDONLY when remounting
    r/w until quota is re-enabled") we defer clearing tyhe SB_RDONLY flag
    in struct super.  However, we didn't defer when we checked sb_rdonly()
    to determine the lazy itable init thread should be enabled, with the
    next result that the lazy inode table initialization would not be
    properly started.  This can cause generic/231 to fail in ext4's
    nojournal mode.
    
    Fix this by moving when we decide to start or stop the lazy itable
    init thread to after we clear the SB_RDONLY flag when we are
    remounting the file system read/write.
    
    Fixes a44be64bbecb ("ext4: don't clear SB_RDONLY when remounting r/w until...")
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230527035729.1001605-1-tytso@mit.edu
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ext4: set lockdep subclass for the ea_inode in ext4_xattr_inode_cache_find() [+ + +]
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Tue May 23 23:49:49 2023 -0400

    ext4: set lockdep subclass for the ea_inode in ext4_xattr_inode_cache_find()
    
    commit b928dfdcb27d8fa59917b794cfba53052a2f050f upstream.
    
    If the ea_inode has been pushed out of the inode cache while there is
    still a reference in the mb_cache, the lockdep subclass will not be
    set on the inode, which can lead to some lockdep false positives.
    
    Fixes: 33d201e0277b ("ext4: fix lockdep warning about recursive inode locking")
    Cc: stable@kernel.org
    Reported-by: syzbot+d4b971e744b1f5439336@syzkaller.appspotmail.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230524034951.779531-3-tytso@mit.edu
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fbcon: Fix null-ptr-deref in soft_cursor [+ + +]
Author: Helge Deller <deller@gmx.de>
Date:   Sat May 27 08:41:09 2023 +0200

    fbcon: Fix null-ptr-deref in soft_cursor
    
    commit d78bd6cc68276bd57f766f7cb98bfe32c23ab327 upstream.
    
    syzbot repored this bug in the softcursor code:
    
    BUG: KASAN: null-ptr-deref in soft_cursor+0x384/0x6b4 drivers/video/fbdev/core/softcursor.c:70
    Read of size 16 at addr 0000000000000200 by task kworker/u4:1/12
    
    CPU: 0 PID: 12 Comm: kworker/u4:1 Not tainted 6.4.0-rc3-syzkaller-geb0f1697d729 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
    Workqueue: events_power_efficient fb_flashcursor
    Call trace:
     dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233
     show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
     print_report+0xe4/0x514 mm/kasan/report.c:465
     kasan_report+0xd4/0x130 mm/kasan/report.c:572
     kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:187
     __asan_memcpy+0x3c/0x84 mm/kasan/shadow.c:105
     soft_cursor+0x384/0x6b4 drivers/video/fbdev/core/softcursor.c:70
     bit_cursor+0x113c/0x1a64 drivers/video/fbdev/core/bitblit.c:377
     fb_flashcursor+0x35c/0x54c drivers/video/fbdev/core/fbcon.c:380
     process_one_work+0x788/0x12d4 kernel/workqueue.c:2405
     worker_thread+0x8e0/0xfe8 kernel/workqueue.c:2552
     kthread+0x288/0x310 kernel/kthread.c:379
     ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:853
    
    This fix let bit_cursor() bail out early when a font bitmap
    isn't available yet.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Reported-by: syzbot+d910bd780e6efac35869@syzkaller.appspotmail.com
    Acked-by: Sam Ravnborg <sam@ravnborg.org>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fbdev: modedb: Add 1920x1080 at 60 Hz video mode [+ + +]
Author: Helge Deller <deller@gmx.de>
Date:   Sat Apr 22 23:24:26 2023 +0200

    fbdev: modedb: Add 1920x1080 at 60 Hz video mode
    
    [ Upstream commit c8902258b2b8ecaa1b8d88c312853c5b14c2553d ]
    
    Add typical resolution for Full-HD monitors.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

fbdev: stifb: Fix info entry in sti_struct on error path [+ + +]
Author: Helge Deller <deller@gmx.de>
Date:   Fri May 12 11:50:33 2023 +0200

    fbdev: stifb: Fix info entry in sti_struct on error path
    
    [ Upstream commit 0bdf1ad8d10bd4e50a8b1a2c53d15984165f7fea ]
    
    Minor fix to reset the info field to NULL in case of error.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gcc-12: disable '-Wdangling-pointer' warning for now [+ + +]
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Jun 9 09:41:42 2022 -0700

    gcc-12: disable '-Wdangling-pointer' warning for now
    
    commit f7d63b50898172b9eb061b9e2daad61b428792d0 upstream.
    
    [ Upstream commit 49beadbd47c270a00754c107a837b4f29df4c822 ]
    
    While the concept of checking for dangling pointers to local variables
    at function exit is really interesting, the gcc-12 implementation is not
    compatible with reality, and results in false positives.
    
    For example, gcc sees us putting things on a local list head allocated
    on the stack, which involves exactly those kinds of pointers to the
    local stack entry:
    
      In function ‘__list_add’,
          inlined from ‘list_add_tail’ at include/linux/list.h:102:2,
          inlined from ‘rebuild_snap_realms’ at fs/ceph/snap.c:434:2:
      include/linux/list.h:74:19: warning: storing the address of local variable ‘realm_queue’ in ‘*&realm_27(D)->rebuild_item.prev’ [-Wdangling-pointer=]
         74 |         new->prev = prev;
            |         ~~~~~~~~~~^~~~~~
    
    But then gcc - understandably - doesn't really understand the big
    picture how the doubly linked list works, so doesn't see how we then end
    up emptying said list head in a loop and the pointer we added has been
    removed.
    
    Gcc also complains about us (intentionally) using this as a way to store
    a kind of fake stack trace, eg
    
      drivers/acpi/acpica/utdebug.c:40:38: warning: storing the address of local variable ‘current_sp’ in ‘acpi_gbl_entry_stack_pointer’ [-Wdangling-pointer=]
         40 |         acpi_gbl_entry_stack_pointer = ¤t_sp;
            |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
    
    which is entirely reasonable from a compiler standpoint, and we may want
    to change those kinds of patterns, but not not.
    
    So this is one of those "it would be lovely if the compiler were to
    complain about us leaving dangling pointers to the stack", but not this
    way.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gfs2: Don't deref jdesc in evict [+ + +]
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Fri Apr 28 12:07:46 2023 -0400

    gfs2: Don't deref jdesc in evict
    
    [ Upstream commit 504a10d9e46bc37b23d0a1ae2f28973c8516e636 ]
    
    On corrupt gfs2 file systems the evict code can try to reference the
    journal descriptor structure, jdesc, after it has been freed and set to
    NULL. The sequence of events is:
    
    init_journal()
    ...
    fail_jindex:
       gfs2_jindex_free(sdp); <------frees journals, sets jdesc = NULL
          if (gfs2_holder_initialized(&ji_gh))
             gfs2_glock_dq_uninit(&ji_gh);
    fail:
       iput(sdp->sd_jindex); <--references jdesc in evict_linked_inode
          evict()
             gfs2_evict_inode()
                evict_linked_inode()
                   ret = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks);
    <------references the now freed/zeroed sd_jdesc pointer.
    
    The call to gfs2_trans_begin is done because the truncate_inode_pages
    call can cause gfs2 events that require a transaction, such as removing
    journaled data (jdata) blocks from the journal.
    
    This patch fixes the problem by adding a check for sdp->sd_jdesc to
    function gfs2_evict_inode. In theory, this should only happen to corrupt
    gfs2 file systems, when gfs2 detects the problem, reports it, then tries
    to evict all the system inodes it has read in up to that point.
    
    Reported-by: Yang Lan <lanyang0908@gmail.com>
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
HID: google: add jewel USB id [+ + +]
Author: Sung-Chi Li <lschyi@chromium.org>
Date:   Mon Apr 24 10:37:36 2023 +0800

    HID: google: add jewel USB id
    
    commit ed84c4517a5bc536e8572a01dfa11bc22a280d06 upstream.
    
    Add 1 additional hammer-like device.
    
    Signed-off-by: Sung-Chi Li <lschyi@chromium.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: wacom: avoid integer overflow in wacom_intuos_inout() [+ + +]
Author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Date:   Mon Apr 17 09:01:48 2023 -0700

    HID: wacom: avoid integer overflow in wacom_intuos_inout()
    
    commit bd249b91977b768ea02bf84d04625d2690ad2b98 upstream.
    
    If high bit is set to 1 in ((data[3] & 0x0f << 28), after all arithmetic
    operations and integer promotions are done, high bits in
    wacom->serial[idx] will be filled with 1s as well.
    Avoid this, albeit unlikely, issue by specifying left operand's __u64
    type for the right operand.
    
    Found by Linux Verification Center (linuxtesting.org) with static
    analysis tool SVACE.
    
    Fixes: 3bea733ab212 ("USB: wacom tablet driver reorganization")
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
    Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iio: adc: ad7192: Change "shorted" channels to differential [+ + +]
Author: Paul Cercueil <paul@crapouillou.net>
Date:   Thu Mar 30 12:21:00 2023 +0200

    iio: adc: ad7192: Change "shorted" channels to differential
    
    commit e55245d115bb9054cb72cdd5dda5660f4484873a upstream.
    
    The AD7192 provides a specific channel configuration where both negative
    and positive inputs are connected to AIN2. This was represented in the
    ad7192 driver as a IIO channel with .channel = 2 and .extended_name set
    to "shorted".
    
    The problem with this approach, is that the driver provided two IIO
    channels with the identifier .channel = 2; one "shorted" and the other
    not. This goes against the IIO ABI, as a channel identifier should be
    unique.
    
    Address this issue by changing "shorted" channels to being differential
    instead, with channel 2 vs. itself, as we're actually measuring AIN2 vs.
    itself.
    
    Note that the fix tag is for the commit that moved the driver out of
    staging. The bug existed before that, but backporting would become very
    complex further down and unlikely to happen.
    
    Fixes: b581f748cce0 ("staging: iio: adc: ad7192: move out of staging")
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    Co-developed-by: Alisa Roman <alisa.roman@analog.com>
    Signed-off-by: Alisa Roman <alisa.roman@analog.com>
    Reviewed-by: Nuno Sa <nuno.sa@analog.com>
    Link: https://lore.kernel.org/r/20230330102100.17590-1-paul@crapouillou.net
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: mxs-lradc: fix the order of two cleanup operations [+ + +]
Author: Jiakai Luo <jkluo@hust.edu.cn>
Date:   Sat Apr 22 06:34:06 2023 -0700

    iio: adc: mxs-lradc: fix the order of two cleanup operations
    
    commit 27b2ed5b6d53cd62fc61c3f259ae52f5cac23b66 upstream.
    
    Smatch reports:
    drivers/iio/adc/mxs-lradc-adc.c:766 mxs_lradc_adc_probe() warn:
    missing unwind goto?
    
    the order of three init operation:
    1.mxs_lradc_adc_trigger_init
    2.iio_triggered_buffer_setup
    3.mxs_lradc_adc_hw_init
    
    thus, the order of three cleanup operation should be:
    1.mxs_lradc_adc_hw_stop
    2.iio_triggered_buffer_cleanup
    3.mxs_lradc_adc_trigger_remove
    
    we exchange the order of two cleanup operations,
    introducing the following differences:
    1.if mxs_lradc_adc_trigger_init fails, returns directly;
    2.if trigger_init succeeds but iio_triggered_buffer_setup fails,
    goto err_trig and remove the trigger.
    
    In addition, we also reorder the unwind that goes on in the
    remove() callback to match the new ordering.
    
    Fixes: 6dd112b9f85e ("iio: adc: mxs-lradc: Add support for ADC driver")
    Signed-off-by: Jiakai Luo <jkluo@hust.edu.cn>
    Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
    Link: https://lore.kernel.org/r/20230422133407.72908-1-jkluo@hust.edu.cn
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: build ad5758 driver when AD5758 is selected [+ + +]
Author: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Date:   Mon May 8 06:02:08 2023 +0200

    iio: dac: build ad5758 driver when AD5758 is selected
    
    commit a146eccb68be161ae9eab5f3f68bb0ed7c0fbaa8 upstream.
    
    Commit 28d1a7ac2a0d ("iio: dac: Add AD5758 support") adds the config AD5758
    and the corresponding driver ad5758.c. In the Makefile, the ad5758 driver
    is however included when AD5755 is selected, not when AD5758 is selected.
    
    Probably, this was simply a mistake that happened by copy-and-paste and
    forgetting to adjust the actual line. Surprisingly, no one has ever noticed
    that this driver is actually only included when AD5755 is selected and that
    the config AD5758 has actually no effect on the build.
    
    Fixes: 28d1a7ac2a0d ("iio: dac: Add AD5758 support")
    Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
    Link: https://lore.kernel.org/r/20230508040208.12033-1-lukas.bulwahn@gmail.com
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: mcp4725: Fix i2c_master_send() return value handling [+ + +]
Author: Marek Vasut <marex@denx.de>
Date:   Thu May 11 02:43:30 2023 +0200

    iio: dac: mcp4725: Fix i2c_master_send() return value handling
    
    commit 09d3bec7009186bdba77039df01e5834788b3f95 upstream.
    
    The i2c_master_send() returns number of sent bytes on success,
    or negative on error. The suspend/resume callbacks expect zero
    on success and non-zero on error. Adapt the return value of the
    i2c_master_send() to the expectation of the suspend and resume
    callbacks, including proper validation of the return value.
    
    Fixes: cf35ad61aca2 ("iio: add mcp4725 I2C DAC driver")
    Signed-off-by: Marek Vasut <marex@denx.de>
    Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/20230511004330.206942-1-marex@denx.de
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: inv_icm42600: fix timestamp reset [+ + +]
Author: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Date:   Tue May 9 15:22:02 2023 +0000

    iio: imu: inv_icm42600: fix timestamp reset
    
    commit bbaae0c79ebd49f61ad942a8bf9e12bfc7f821bb upstream.
    
    Timestamp reset is not done in the correct place. It must be done
    before enabling buffer. The reason is that interrupt timestamping
    is always happening when the chip is on, even if the
    corresponding sensor is off. When the sensor restarts, timestamp
    is wrong if you don't do a reset first.
    
    Fixes: ec74ae9fd37c ("iio: imu: inv_icm42600: add accurate timestamping")
    Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20230509152202.245444-1-inv.git-commit@tdk.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: vcnl4035: fixed chip ID check [+ + +]
Author: Frank Li <Frank.Li@nxp.com>
Date:   Mon May 1 10:36:04 2023 -0400

    iio: light: vcnl4035: fixed chip ID check
    
    commit a551c26e8e568fad42120843521529241b9bceec upstream.
    
    VCNL4035 register(0xE) ID_L and ID_M define as:
    
     ID_L: 0x80
     ID_H: 7:6 (0:0)
           5:4 (0:0) slave address = 0x60 (7-bit)
               (0:1) slave address = 0x51 (7-bit)
               (1:0) slave address = 0x40 (7-bit)
               (1:0) slave address = 0x41 (7-bit)
           3:0 Version code default (0:0:0:0)
    
    So just check ID_L.
    
    Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20230501143605.1615549-1-Frank.Li@nxp.com
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/amd: Don't block updates to GATag if guest mode is on [+ + +]
Author: Joao Martins <joao.m.martins@oracle.com>
Date:   Wed Apr 19 21:11:53 2023 +0100

    iommu/amd: Don't block updates to GATag if guest mode is on
    
    [ Upstream commit ed8a2f4ddef2eaaf864ab1efbbca9788187036ab ]
    
    On KVM GSI routing table updates, specially those where they have vIOMMUs
    with interrupt remapping enabled (to boot >255vcpus setups without relying
    on KVM_FEATURE_MSI_EXT_DEST_ID), a VMM may update the backing VF MSIs
    with a new VCPU affinity.
    
    On AMD with AVIC enabled, the new vcpu affinity info is updated via:
            avic_pi_update_irte()
                    irq_set_vcpu_affinity()
                            amd_ir_set_vcpu_affinity()
                                    amd_iommu_{de}activate_guest_mode()
    
    Where the IRTE[GATag] is updated with the new vcpu affinity. The GATag
    contains VM ID and VCPU ID, and is used by IOMMU hardware to signal KVM
    (via GALog) when interrupt cannot be delivered due to vCPU is in
    blocking state.
    
    The issue is that amd_iommu_activate_guest_mode() will essentially
    only change IRTE fields on transitions from non-guest-mode to guest-mode
    and otherwise returns *with no changes to IRTE* on already configured
    guest-mode interrupts. To the guest this means that the VF interrupts
    remain affined to the first vCPU they were first configured, and guest
    will be unable to issue VF interrupts and receive messages like this
    from spurious interrupts (e.g. from waking the wrong vCPU in GALog):
    
    [  167.759472] __common_interrupt: 3.34 No irq handler for vector
    [  230.680927] mlx5_core 0000:00:02.0: mlx5_cmd_eq_recover:247:(pid
    3122): Recovered 1 EQEs on cmd_eq
    [  230.681799] mlx5_core 0000:00:02.0:
    wait_func_handle_exec_timeout:1113:(pid 3122): cmd[0]: CREATE_CQ(0x400)
    recovered after timeout
    [  230.683266] __common_interrupt: 3.34 No irq handler for vector
    
    Given the fact that amd_ir_set_vcpu_affinity() uses
    amd_iommu_activate_guest_mode() underneath it essentially means that VCPU
    affinity changes of IRTEs are nops. Fix it by dropping the check for
    guest-mode at amd_iommu_activate_guest_mode(). Same thing is applicable to
    amd_iommu_deactivate_guest_mode() although, even if the IRTE doesn't change
    underlying DestID on the host, the VFIO IRQ handler will still be able to
    poke at the right guest-vCPU.
    
    Fixes: b9c6ff94e43a ("iommu/amd: Re-factor guest virtual APIC (de-)activation code")
    Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
    Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
    Link: https://lore.kernel.org/r/20230419201154.83880-2-joao.m.martins@oracle.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/rockchip: Fix unwind goto issue [+ + +]
Author: Chao Wang <D202280639@hust.edu.cn>
Date:   Mon Apr 17 03:04:21 2023 +0000

    iommu/rockchip: Fix unwind goto issue
    
    [ Upstream commit ec014683c564fb74fc68e8f5e84691d3b3839d24 ]
    
    Smatch complains that
    drivers/iommu/rockchip-iommu.c:1306 rk_iommu_probe() warn: missing unwind goto?
    
    The rk_iommu_probe function, after obtaining the irq value through
    platform_get_irq, directly returns an error if the returned value
    is negative, without releasing any resources.
    
    Fix this by adding a new error handling label "err_pm_disable" and
    use a goto statement to redirect to the error handling process. In
    order to preserve the original semantics, set err to the value of irq.
    
    Fixes: 1aa55ca9b14a ("iommu/rockchip: Move irq request past pm_runtime_enable")
    Signed-off-by: Chao Wang <D202280639@hust.edu.cn>
    Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
    Reviewed-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://lore.kernel.org/r/20230417030421.2777-1-D202280639@hust.edu.cn
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
KEYS: asymmetric: Copy sig and digest in public_key_verify_signature() [+ + +]
Author: Roberto Sassu <roberto.sassu@huawei.com>
Date:   Thu Dec 8 10:56:46 2022 +0100

    KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()
    
    commit c3d03e8e35e005e1a614e51bb59053eeb5857f76 upstream.
    
    Commit ac4e97abce9b8 ("scatterlist: sg_set_buf() argument must be in linear
    mapping") checks that both the signature and the digest reside in the
    linear mapping area.
    
    However, more recently commit ba14a194a434c ("fork: Add generic vmalloced
    stack support") made it possible to move the stack in the vmalloc area,
    which is not contiguous, and thus not suitable for sg_set_buf() which needs
    adjacent pages.
    
    Always make a copy of the signature and digest in the same buffer used to
    store the key and its parameters, and pass them to sg_init_one(). Prefer it
    to conditionally doing the copy if necessary, to keep the code simple. The
    buffer allocated with kmalloc() is in the linear mapping area.
    
    Cc: stable@vger.kernel.org # 4.9.x
    Fixes: ba14a194a434 ("fork: Add generic vmalloced stack support")
    Link: https://lore.kernel.org/linux-integrity/Y4pIpxbjBdajymBJ@sol.localdomain/
    Suggested-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
    Reviewed-by: Eric Biggers <ebiggers@google.com>
    Tested-by: Stefan Berger <stefanb@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: x86: Account fastpath-only VM-Exits in vCPU stats [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Jun 1 18:19:19 2023 -0700

    KVM: x86: Account fastpath-only VM-Exits in vCPU stats
    
    commit 8b703a49c9df5e74870381ad7ba9c85d8a74ed2c upstream.
    
    Increment vcpu->stat.exits when handling a fastpath VM-Exit without
    going through any part of the "slow" path.  Not bumping the exits stat
    can result in wildly misleading exit counts, e.g. if the primary reason
    the guest is exiting is to program the TSC deadline timer.
    
    Fixes: 404d5d7bff0d ("KVM: X86: Introduce more exit_fastpath_completion enum values")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230602011920.787844-2-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 5.10.183 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Jun 9 10:30:19 2023 +0200

    Linux 5.10.183
    
    Link: https://lore.kernel.org/r/20230607200900.915613242@linuxfoundation.org
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Chris Paterson (CIP) <chris.paterson2@renesas.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mailbox: mailbox-test: fix a locking issue in mbox_test_message_write() [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Fri May 5 12:22:09 2023 +0300

    mailbox: mailbox-test: fix a locking issue in mbox_test_message_write()
    
    [ Upstream commit 8fe72b76db79d694858e872370df49676bc3be8c ]
    
    There was a bug where this code forgot to unlock the tdev->mutex if the
    kzalloc() failed.  Fix this issue, by moving the allocation outside the
    lock.
    
    Fixes: 2d1e952a2b8e ("mailbox: mailbox-test: Fix potential double-free in mbox_test_message_write()")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mailbox: mailbox-test: Fix potential double-free in mbox_test_message_write() [+ + +]
Author: Lee Jones <lee@kernel.org>
Date:   Thu Apr 20 08:27:18 2023 +0100

    mailbox: mailbox-test: Fix potential double-free in mbox_test_message_write()
    
    [ Upstream commit 2d1e952a2b8e5e92d8d55ac88a7cf7ca5ea591ad ]
    
    If a user can make copy_from_user() fail, there is a potential for
    UAF/DF due to a lack of locking around the allocation, use and freeing
    of the data buffers.
    
    This issue is not theoretical.  I managed to author a POC for it:
    
        BUG: KASAN: double-free in kfree+0x5c/0xac
        Free of addr ffff29280be5de00 by task poc/356
        CPU: 1 PID: 356 Comm: poc Not tainted 6.1.0-00001-g961aa6552c04-dirty #20
        Hardware name: linux,dummy-virt (DT)
        Call trace:
         dump_backtrace.part.0+0xe0/0xf0
         show_stack+0x18/0x40
         dump_stack_lvl+0x64/0x80
         print_report+0x188/0x48c
         kasan_report_invalid_free+0xa0/0xc0
         ____kasan_slab_free+0x174/0x1b0
         __kasan_slab_free+0x18/0x24
         __kmem_cache_free+0x130/0x2e0
         kfree+0x5c/0xac
         mbox_test_message_write+0x208/0x29c
         full_proxy_write+0x90/0xf0
         vfs_write+0x154/0x440
         ksys_write+0xcc/0x180
         __arm64_sys_write+0x44/0x60
         invoke_syscall+0x60/0x190
         el0_svc_common.constprop.0+0x7c/0x160
         do_el0_svc+0x40/0xf0
         el0_svc+0x2c/0x6c
         el0t_64_sync_handler+0xf4/0x120
         el0t_64_sync+0x18c/0x190
    
        Allocated by task 356:
         kasan_save_stack+0x3c/0x70
         kasan_set_track+0x2c/0x40
         kasan_save_alloc_info+0x24/0x34
         __kasan_kmalloc+0xb8/0xc0
         kmalloc_trace+0x58/0x70
         mbox_test_message_write+0x6c/0x29c
         full_proxy_write+0x90/0xf0
         vfs_write+0x154/0x440
         ksys_write+0xcc/0x180
         __arm64_sys_write+0x44/0x60
         invoke_syscall+0x60/0x190
         el0_svc_common.constprop.0+0x7c/0x160
         do_el0_svc+0x40/0xf0
         el0_svc+0x2c/0x6c
         el0t_64_sync_handler+0xf4/0x120
         el0t_64_sync+0x18c/0x190
    
        Freed by task 357:
         kasan_save_stack+0x3c/0x70
         kasan_set_track+0x2c/0x40
         kasan_save_free_info+0x38/0x5c
         ____kasan_slab_free+0x13c/0x1b0
         __kasan_slab_free+0x18/0x24
         __kmem_cache_free+0x130/0x2e0
         kfree+0x5c/0xac
         mbox_test_message_write+0x208/0x29c
         full_proxy_write+0x90/0xf0
         vfs_write+0x154/0x440
         ksys_write+0xcc/0x180
         __arm64_sys_write+0x44/0x60
         invoke_syscall+0x60/0x190
         el0_svc_common.constprop.0+0x7c/0x160
         do_el0_svc+0x40/0xf0
         el0_svc+0x2c/0x6c
         el0t_64_sync_handler+0xf4/0x120
         el0t_64_sync+0x18c/0x190
    
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
media: dvb-core: Fix kernel WARNING for blocking operation in wait_event*() [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri May 12 16:18:00 2023 +0100

    media: dvb-core: Fix kernel WARNING for blocking operation in wait_event*()
    
    [ Upstream commit b8c75e4a1b325ea0a9433fa8834be97b5836b946 ]
    
    Using a semaphore in the wait_event*() condition is no good idea.
    It hits a kernel WARN_ON() at prepare_to_wait_event() like:
      do not call blocking ops when !TASK_RUNNING; state=1 set at
      prepare_to_wait_event+0x6d/0x690
    
    For avoiding the potential deadlock, rewrite to an open-coded loop
    instead.  Unlike the loop in wait_event*(), this uses wait_woken()
    after the condition check, hence the task state stays consistent.
    
    CVE-2023-31084 was assigned to this bug.
    
    Link: https://lore.kernel.org/r/CA+UBctCu7fXn4q41O_3=id1+OdyQ85tZY1x+TkT-6OVBL6KAUw@mail.gmail.com/
    
    Link: https://lore.kernel.org/linux-media/20230512151800.1874-1-tiwai@suse.de
    Reported-by: Yu Hao <yhao016@ucr.edu>
    Closes: https://nvd.nist.gov/vuln/detail/CVE-2023-31084
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-core: Fix use-after-free due on race condition at dvb_net [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Thu Nov 17 04:59:23 2022 +0000

    media: dvb-core: Fix use-after-free due on race condition at dvb_net
    
    [ Upstream commit 4172385b0c9ac366dcab78eda48c26814b87ed1a ]
    
    A race condition may occur between the .disconnect function, which
    is called when the device is disconnected, and the dvb_device_open()
    function, which is called when the device node is open()ed.
    This results in several types of UAFs.
    
    The root cause of this is that you use the dvb_device_open() function,
    which does not implement a conditional statement
    that checks 'dvbnet->exit'.
    
    So, add 'remove_mutex` to protect 'dvbnet->exit' and use
    locked_dvb_net_open() function to check 'dvbnet->exit'.
    
    [mchehab: fix a checkpatch warning]
    
    Link: https://lore.kernel.org/linux-media/20221117045925.14297-3-imv4bel@gmail.com
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-core: Fix use-after-free due to race condition at dvb_ca_en50221 [+ + +]
Author: Hyunwoo Kim <v4bel@theori.io>
Date:   Mon Nov 21 06:33:08 2022 +0000

    media: dvb-core: Fix use-after-free due to race condition at dvb_ca_en50221
    
    [ Upstream commit 280a8ab81733da8bc442253c700a52c4c0886ffd ]
    
    If the device node of dvb_ca_en50221 is open() and the
    device is disconnected, a UAF may occur when calling
    close() on the device node.
    
    The root cause is that wake_up() and wait_event() for
    dvbdev->wait_queue are not implemented.
    
    So implement wait_event() function in dvb_ca_en50221_release()
    and add 'remove_mutex' which prevents race condition
    for 'ca->exit'.
    
    [mchehab: fix a checkpatch warning]
    
    Link: https://lore.kernel.org/linux-media/20221121063308.GA33821@ubuntu
    Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-usb-v2: ce6230: fix null-ptr-deref in ce6230_i2c_master_xfer() [+ + +]
Author: Wei Chen <harperchen1110@gmail.com>
Date:   Mon Mar 13 09:27:51 2023 +0000

    media: dvb-usb-v2: ce6230: fix null-ptr-deref in ce6230_i2c_master_xfer()
    
    [ Upstream commit dff919090155fb22679869e8469168f270dcd97f ]
    
    In ce6230_i2c_master_xfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach ce6230_i2c_master_xfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen. We add
    check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Link: https://lore.kernel.org/linux-media/20230313092751.209496-1-harperchen1110@gmail.com
    Signed-off-by: Wei Chen <harperchen1110@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-usb-v2: ec168: fix null-ptr-deref in ec168_i2c_xfer() [+ + +]
Author: Wei Chen <harperchen1110@gmail.com>
Date:   Mon Mar 13 08:58:53 2023 +0000

    media: dvb-usb-v2: ec168: fix null-ptr-deref in ec168_i2c_xfer()
    
    [ Upstream commit a6dcefcc08eca1bf4e3d213c97c3cfb75f377935 ]
    
    In ec168_i2c_xfer, msg is controlled by user. When msg[i].buf is null
    and msg[i].len is zero, former checks on msg[i].buf would be passed.
    If accessing msg[i].buf[0] without sanity check, null pointer deref
    would happen. We add check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Link: https://lore.kernel.org/linux-media/20230313085853.3252349-1-harperchen1110@gmail.com
    Signed-off-by: Wei Chen <harperchen1110@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-usb-v2: rtl28xxu: fix null-ptr-deref in rtl28xxu_i2c_xfer [+ + +]
Author: Zhang Shurong <zhang_shurong@foxmail.com>
Date:   Sun May 7 15:52:47 2023 +0100

    media: dvb-usb-v2: rtl28xxu: fix null-ptr-deref in rtl28xxu_i2c_xfer
    
    [ Upstream commit aa4a447b81b84f69c1a89ad899df157f386d7636 ]
    
    In rtl28xxu_i2c_xfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach rtl28xxu_i2c_xfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen.
    We add check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a
    ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Link: https://lore.kernel.org/linux-media/tencent_3623572106754AC2F266B316798B0F6CCA05@qq.com
    Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-usb: az6027: fix three null-ptr-deref in az6027_i2c_xfer() [+ + +]
Author: Wei Chen <harperchen1110@gmail.com>
Date:   Fri Mar 10 16:56:04 2023 +0000

    media: dvb-usb: az6027: fix three null-ptr-deref in az6027_i2c_xfer()
    
    [ Upstream commit 858e97d7956d17a2cb56a9413468704a4d5abfe1 ]
    
    In az6027_i2c_xfer, msg is controlled by user. When msg[i].buf is null,
    commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in
    az6027_i2c_xfer()") fix the null-ptr-deref bug when msg[i].addr is 0x99.
    However, null-ptr-deref also happens when msg[i].addr is 0xd0 and 0xc0.
    We add check on msg[i].len to prevent null-ptr-deref.
    
    Link: https://lore.kernel.org/linux-media/20230310165604.3093483-1-harperchen1110@gmail.com
    Signed-off-by: Wei Chen <harperchen1110@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-usb: digitv: fix null-ptr-deref in digitv_i2c_xfer() [+ + +]
Author: Wei Chen <harperchen1110@gmail.com>
Date:   Mon Mar 13 09:50:08 2023 +0000

    media: dvb-usb: digitv: fix null-ptr-deref in digitv_i2c_xfer()
    
    [ Upstream commit 9ded5bd2a49ce3015b7c936743eec0a0e6e11f0c ]
    
    In digitv_i2c_xfer, msg is controlled by user. When msg[i].buf
    is null and msg[i].len is zero, former checks on msg[i].buf would be
    passed. Malicious data finally reach digitv_i2c_xfer. If accessing
    msg[i].buf[0] without sanity check, null ptr deref would happen. We add
    check on msg[i].len to prevent crash.
    
    Similar commit:
    commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
    
    Link: https://lore.kernel.org/linux-media/20230313095008.1039689-1-harperchen1110@gmail.com
    Signed-off-by: Wei Chen <harperchen1110@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb-usb: dw2102: fix uninit-value in su3000_read_mac_address [+ + +]
Author: Wei Chen <harperchen1110@gmail.com>
Date:   Tue Mar 28 13:44:16 2023 +0100

    media: dvb-usb: dw2102: fix uninit-value in su3000_read_mac_address
    
    [ Upstream commit a3fd1ef27aa686d871cefe207bd6168c4b0cd29e ]
    
    In su3000_read_mac_address, if i2c_transfer fails to execute two
    messages, array mac address will not be initialized. Without handling
    such error, later in function dvb_usb_adapter_dvb_init, proposed_mac
    is accessed before initialization.
    
    Fix this error by returning a negative value if message execution fails.
    
    Link: https://lore.kernel.org/linux-media/20230328124416.560889-1-harperchen1110@gmail.com
    Signed-off-by: Wei Chen <harperchen1110@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb_ca_en50221: fix a size write bug [+ + +]
Author: YongSu Yoo <yongsuyoo0215@gmail.com>
Date:   Thu Aug 18 13:50:27 2022 +0100

    media: dvb_ca_en50221: fix a size write bug
    
    [ Upstream commit a4315e5be7020aac9b24a8151caf4bb85224cd0e ]
    
    The function of "dvb_ca_en50221_write_data" at source/drivers/media
    /dvb-core/dvb_ca_en50221.c is used for two cases.
    The first case is for writing APDU data in the function of
    "dvb_ca_en50221_io_write" at source/drivers/media/dvb-core/
    dvb_ca_en50221.c.
    The second case is for writing the host link buf size on the
    Command Register in the function of "dvb_ca_en50221_link_init"
    at source/drivers/media/dvb-core/dvb_ca_en50221.c.
    In the second case, there exists a bug like following.
    In the function of the "dvb_ca_en50221_link_init",
    after a TV host calculates the host link buf_size,
    the TV host writes the calculated host link buf_size on the
    Size Register.
    Accroding to the en50221 Spec (the page 60 of
    https://dvb.org/wp-content/uploads/2020/02/En50221.V1.pdf),
    before this writing operation, the "SW(CMDREG_SW)" flag in the
    Command Register should be set. We can see this setting operation
    in the function of the "dvb_ca_en50221_link_init" like below.
    ...
            if ((ret = ca->pub->write_cam_control(ca->pub, slot,
    CTRLIF_COMMAND, IRQEN | CMDREG_SW)) != 0)
                    return ret;
    ...
    But, after that, the real writing operation is implemented using
    the function of the "dvb_ca_en50221_write_data" in the function of
    "dvb_ca_en50221_link_init", and the "dvb_ca_en50221_write_data"
    includes the function of "ca->pub->write_cam_control",
    and the function of the "ca->pub->write_cam_control" in the
    function of the "dvb_ca_en50221_wrte_data" does not include
    "CMDREG_SW" flag like below.
    ...
            if ((status = ca->pub->write_cam_control(ca->pub, slot,
    CTRLIF_COMMAND, IRQEN | CMDREG_HC)) != 0)
    ...
    In the above source code, we can see only the "IRQEN | CMDREG_HC",
    but we cannot see the "CMDREG_SW".
    The "CMDREG_SW" flag which was set in the function of the
    "dvb_ca_en50221_link_init" was rollbacked by the follwoing function
    of the "dvb_ca_en50221_write_data".
    This is a bug. and this bug causes that the calculated host link buf_size
    is not properly written in the CI module.
    Through this patch, we fix this bug.
    
    Link: https://lore.kernel.org/linux-media/20220818125027.1131-1-yongsuyoo0215@gmail.com
    Signed-off-by: YongSu Yoo <yongsuyoo0215@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: dvb_demux: fix a bug for the continuity counter [+ + +]
Author: YongSu Yoo <yongsuyoo0215@gmail.com>
Date:   Sun Mar 5 21:25:19 2023 +0000

    media: dvb_demux: fix a bug for the continuity counter
    
    [ Upstream commit 7efb10d8dc70ea3000cc70dca53407c52488acd1 ]
    
    In dvb_demux.c, some logics exist which compare the expected
    continuity counter and the real continuity counter. If they
    are not matched each other, both of the expected continuity
    counter and the real continuity counter should be printed.
    But there exists a bug that the expected continuity counter
    is not correctly printed. The expected continuity counter is
    replaced with the real countinuity counter + 1 so that
    the epected continuity counter is not correclty printed.
    This is wrong. This bug is fixed.
    
    Link: https://lore.kernel.org/linux-media/20230305212519.499-1-yongsuyoo0215@gmail.com
    
    Signed-off-by: YongSu Yoo <yongsuyoo0215@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: mn88443x: fix !CONFIG_OF error by drop of_match_ptr from ID table [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Sun Mar 12 13:13:18 2023 +0000

    media: mn88443x: fix !CONFIG_OF error by drop of_match_ptr from ID table
    
    [ Upstream commit ae11c0efaec32fb45130ee9886689f467232eebc ]
    
    The driver will match mostly by DT table (even thought there is regular
    ID table) so there is little benefit in of_match_ptr (this also allows
    ACPI matching via PRP0001, even though it might not be relevant here).
    This also fixes !CONFIG_OF error:
    
      drivers/media/dvb-frontends/mn88443x.c:782:34: error: ‘mn88443x_of_match’ defined but not used [-Werror=unused-const-variable=]
    
    Link: https://lore.kernel.org/linux-media/20230312131318.351173-28-krzysztof.kozlowski@linaro.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: netup_unidvb: fix irq init by register it at the end of probe [+ + +]
Author: Wei Chen <harperchen1110@gmail.com>
Date:   Wed Mar 15 13:45:18 2023 +0000

    media: netup_unidvb: fix irq init by register it at the end of probe
    
    [ Upstream commit e6ad6233592593079db5c8fa592c298e51bc1356 ]
    
    IRQ handler netup_spi_interrupt() takes spinlock spi->lock. The lock
    is initialized in netup_spi_init(). However, irq handler is registered
    before initializing the lock.
    
    Spinlock dma->lock and i2c->lock suffer from the same problem.
    
    Fix this by registering the irq at the end of probe.
    
    Link: https://lore.kernel.org/linux-media/20230315134518.1074497-1-harperchen1110@gmail.com
    Signed-off-by: Wei Chen <harperchen1110@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: rcar-vin: Select correct interrupt mode for V4L2_FIELD_ALTERNATE [+ + +]
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Date:   Sat Feb 11 21:55:34 2023 +0100

    media: rcar-vin: Select correct interrupt mode for V4L2_FIELD_ALTERNATE
    
    [ Upstream commit e10707d5865c90d3dfe4ef589ce02ff4287fef85 ]
    
    When adding proper support for V4L2_FIELD_ALTERNATE it was missed that
    this field format should trigger an interrupt for each field, not just
    for the whole frame. Fix this by marking it as progressive in the
    capture setup, which will then select the correct interrupt mode.
    
    Tested on both Gen2 and Gen3 with the result of a doubling of the frame
    rate for V4L2_FIELD_ALTERNATE. From a PAL video source the frame rate is
    now 50, which is expected for alternate field capture.
    
    Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: ti-vpe: cal: avoid FIELD_GET assertion [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Dec 4 00:07:30 2020 +0100

    media: ti-vpe: cal: avoid FIELD_GET assertion
    
    commit d7a7d721064c548042b019cd0d4d62e0bb878d71 upstream.
    
    FIELD_GET() must only be used with a mask that is a compile-time
    constant:
    
    drivers/media/platform/ti-vpe/cal.h: In function 'cal_read_field':
    include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_247' declared with attribute error: FIELD_GET: mask is not constant
    include/linux/bitfield.h:46:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
       46 |   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),  \
          |   ^~~~~~~~~~~~~~~~
    drivers/media/platform/ti-vpe/cal.h:220:9: note: in expansion of macro 'FIELD_GET'
      220 |  return FIELD_GET(mask, cal_read(cal, offset));
          |         ^~~~~~~~~
    
    The problem here is that the function is not always inlined. Mark it
    __always_inline to avoid the problem.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Cc: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: ttusb-dec: fix memory leak in ttusb_dec_exit_dvb() [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Thu Nov 17 04:59:25 2022 +0000

    media: ttusb-dec: fix memory leak in ttusb_dec_exit_dvb()
    
    [ Upstream commit 517a281338322ff8293f988771c98aaa7205e457 ]
    
    Since dvb_frontend_detach() is not called in ttusb_dec_exit_dvb(),
    which is called when the device is disconnected, dvb_frontend_free()
    is not finally called.
    
    This causes a memory leak just by repeatedly plugging and
    unplugging the device.
    
    Fix this issue by adding dvb_frontend_detach() to ttusb_dec_exit_dvb().
    
    Link: https://lore.kernel.org/linux-media/20221117045925.14297-5-imv4bel@gmail.com
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
misc: fastrpc: reject new invocations during device removal [+ + +]
Author: Richard Acayan <mailingradian@gmail.com>
Date:   Tue May 23 16:25:50 2023 +0100

    misc: fastrpc: reject new invocations during device removal
    
    commit 46248400d81e2aa0b65cd659d6f40188192a58b6 upstream.
    
    The channel's rpmsg object allows new invocations to be made. After old
    invocations are already interrupted, the driver shouldn't try to invoke
    anymore. Invalidating the rpmsg at the end of the driver removal
    function makes it easy to cause a race condition in userspace. Even
    closing a file descriptor before the driver finishes its cleanup can
    cause an invocation via fastrpc_release_current_dsp_process() and
    subsequent timeout.
    
    Invalidate the channel before the invocations are interrupted to make
    sure that no invocations can be created to hang after the device closes.
    
    Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Richard Acayan <mailingradian@gmail.com>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20230523152550.438363-5-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

misc: fastrpc: return -EPIPE to invocations on device removal [+ + +]
Author: Richard Acayan <mailingradian@gmail.com>
Date:   Tue May 23 16:25:49 2023 +0100

    misc: fastrpc: return -EPIPE to invocations on device removal
    
    commit b6a062853ddf6b4f653af2d8b75ba45bb9a036ad upstream.
    
    The return value is initialized as -1, or -EPERM. The completion of an
    invocation implies that the return value is set appropriately, but
    "Permission denied" does not accurately describe the outcome of the
    invocation. Set the invocation's return value to a more appropriate
    "Broken pipe", as the cleanup breaks the driver's connection with rpmsg.
    
    Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Richard Acayan <mailingradian@gmail.com>
    Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20230523152550.438363-4-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mmc: vub300: fix invalid response handling [+ + +]
Author: Deren Wu <deren.wu@mediatek.com>
Date:   Sat May 13 22:48:15 2023 +0800

    mmc: vub300: fix invalid response handling
    
    commit a99d21cefd351c8aaa20b83a3c942340e5789d45 upstream.
    
    We may get an empty response with zero length at the beginning of
    the driver start and get following UBSAN error. Since there is no
    content(SDRT_NONE) for the response, just return and skip the response
    handling to avoid this problem.
    
    Test pass : SDIO wifi throughput test with this patch
    
    [  126.980684] UBSAN: array-index-out-of-bounds in drivers/mmc/host/vub300.c:1719:12
    [  126.980709] index -1 is out of range for type 'u32 [4]'
    [  126.980729] CPU: 4 PID: 9 Comm: kworker/u16:0 Tainted: G            E      6.3.0-rc4-mtk-local-202304272142 #1
    [  126.980754] Hardware name: Intel(R) Client Systems NUC8i7BEH/NUC8BEB, BIOS BECFL357.86A.0081.2020.0504.1834 05/04/2020
    [  126.980770] Workqueue: kvub300c vub300_cmndwork_thread [vub300]
    [  126.980833] Call Trace:
    [  126.980845]  <TASK>
    [  126.980860]  dump_stack_lvl+0x48/0x70
    [  126.980895]  dump_stack+0x10/0x20
    [  126.980916]  ubsan_epilogue+0x9/0x40
    [  126.980944]  __ubsan_handle_out_of_bounds+0x70/0x90
    [  126.980979]  vub300_cmndwork_thread+0x58e7/0x5e10 [vub300]
    [  126.981018]  ? _raw_spin_unlock+0x18/0x40
    [  126.981042]  ? finish_task_switch+0x175/0x6f0
    [  126.981070]  ? __switch_to+0x42e/0xda0
    [  126.981089]  ? __switch_to_asm+0x3a/0x80
    [  126.981129]  ? __pfx_vub300_cmndwork_thread+0x10/0x10 [vub300]
    [  126.981174]  ? __kasan_check_read+0x11/0x20
    [  126.981204]  process_one_work+0x7ee/0x13d0
    [  126.981246]  worker_thread+0x53c/0x1240
    [  126.981291]  kthread+0x2b8/0x370
    [  126.981312]  ? __pfx_worker_thread+0x10/0x10
    [  126.981336]  ? __pfx_kthread+0x10/0x10
    [  126.981359]  ret_from_fork+0x29/0x50
    [  126.981400]  </TASK>
    
    Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver")
    Signed-off-by: Deren Wu <deren.wu@mediatek.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/048cd6972c50c33c2e8f81d5228fed928519918b.1683987673.git.deren.wu@mediatek.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mtd: rawnand: ingenic: fix empty stub helper definitions [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 16 22:21:24 2023 +0200

    mtd: rawnand: ingenic: fix empty stub helper definitions
    
    [ Upstream commit 650a8884a364ff2568b51cde9009cfd43cdae6ad ]
    
    A few functions provide an empty interface definition when
    CONFIG_MTD_NAND_INGENIC_ECC is disabled, but they are accidentally
    defined as global functions in the header:
    
    drivers/mtd/nand/raw/ingenic/ingenic_ecc.h:39:5: error: no previous prototype for 'ingenic_ecc_calculate'
    drivers/mtd/nand/raw/ingenic/ingenic_ecc.h:46:5: error: no previous prototype for 'ingenic_ecc_correct'
    drivers/mtd/nand/raw/ingenic/ingenic_ecc.h:53:6: error: no previous prototype for 'ingenic_ecc_release'
    drivers/mtd/nand/raw/ingenic/ingenic_ecc.h:57:21: error: no previous prototype for 'of_ingenic_ecc_get'
    
    Turn them into 'static inline' definitions instead.
    
    Fixes: 15de8c6efd0e ("mtd: rawnand: ingenic: Separate top-level and SoC specific code")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Paul Cercueil <paul@crapouillou.net>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20230516202133.559488-1-arnd@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mtd: rawnand: marvell: don't set the NAND frequency select [+ + +]
Author: Chris Packham <chris.packham@alliedtelesis.co.nz>
Date:   Thu May 25 12:31:53 2023 +1200

    mtd: rawnand: marvell: don't set the NAND frequency select
    
    [ Upstream commit c4d28e30a8d0b979e4029465ab8f312ab6ce2644 ]
    
    marvell_nfc_setup_interface() uses the frequency retrieved from the
    clock associated with the nand interface to determine the timings that
    will be used. By changing the NAND frequency select without reflecting
    this in the clock configuration this means that the timings calculated
    don't correctly meet the requirements of the NAND chip. This hasn't been
    an issue up to now because of a different bug that was stopping the
    timings being updated after they were initially set.
    
    Fixes: b25251414f6e ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
    Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20230525003154.2303012-2-chris.packham@alliedtelesis.co.nz
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mtd: rawnand: marvell: ensure timing values are written [+ + +]
Author: Chris Packham <chris.packham@alliedtelesis.co.nz>
Date:   Thu May 25 12:31:52 2023 +1200

    mtd: rawnand: marvell: ensure timing values are written
    
    [ Upstream commit 8a6f4d346f3bad9c68b4a87701eb3f7978542d57 ]
    
    When new timing values are calculated in marvell_nfc_setup_interface()
    ensure that they will be applied in marvell_nfc_select_target() by
    clearing the selected_chip pointer.
    
    Fixes: b25251414f6e ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
    Suggested-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20230525003154.2303012-1-chris.packham@alliedtelesis.co.nz
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nbd: Fix debugfs_create_dir error checking [+ + +]
Author: Ivan Orlov <ivan.orlov0322@gmail.com>
Date:   Fri May 12 17:05:32 2023 +0400

    nbd: Fix debugfs_create_dir error checking
    
    [ Upstream commit 4913cfcf014c95f0437db2df1734472fd3e15098 ]
    
    The debugfs_create_dir function returns ERR_PTR in case of error, and the
    only correct way to check if an error occurred is 'IS_ERR' inline function.
    This patch will replace the null-comparison with IS_ERR.
    
    Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
    Link: https://lore.kernel.org/r/20230512130533.98709-1-ivan.orlov0322@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx5: fw_tracer, Fix event handling [+ + +]
Author: Shay Drory <shayd@nvidia.com>
Date:   Sat Apr 29 20:41:41 2023 +0300

    net/mlx5: fw_tracer, Fix event handling
    
    [ Upstream commit 341a80de2468f481b1f771683709b5649cbfe513 ]
    
    mlx5 driver needs to parse traces with event_id inside the range of
    first_string_trace and num_string_trace. However, mlx5 is parsing all
    events with event_id >= first_string_trace.
    
    Fix it by checking for the correct range.
    
    Fixes: c71ad41ccb0c ("net/mlx5: FW tracer, events handling")
    Signed-off-by: Shay Drory <shayd@nvidia.com>
    Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/mlx5: Read embedded cpu after init bit cleared [+ + +]
Author: Moshe Shemesh <moshe@nvidia.com>
Date:   Fri Apr 28 13:48:13 2023 +0300

    net/mlx5: Read embedded cpu after init bit cleared
    
    [ Upstream commit bbfa4b58997e3d38ba629c9f6fc0bd1c163aaf43 ]
    
    During driver load it reads embedded_cpu bit from initialization
    segment, but the initialization segment is readable only after
    initialization bit is cleared.
    
    Move the call to mlx5_read_embedded_cpu() right after initialization bit
    cleared.
    
    Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
    Fixes: 591905ba9679 ("net/mlx5: Introduce Mellanox SmartNIC and modify page management logic")
    Reviewed-by: Shay Drory <shayd@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report [+ + +]
Author: Pedro Tammela <pctammela@mojatatu.com>
Date:   Mon May 29 12:33:35 2023 -0300

    net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report
    
    [ Upstream commit f4e4534850a9d18c250a93f8d7fbb51310828110 ]
    
    The current code for the length calculation wrongly truncates the reported
    length of the groups array, causing an under report of the subscribed
    groups. To fix this, use 'BITS_TO_BYTES()' which rounds up the
    division by 8.
    
    Fixes: b42be38b2778 ("netlink: add API to retrieve all group memberships")
    Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Link: https://lore.kernel.org/r/20230529153335.389815-1-pctammela@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/sched: flower: fix possible OOB write in fl_set_geneve_opt() [+ + +]
Author: Hangyu Hua <hbh25y@gmail.com>
Date:   Wed May 31 18:28:04 2023 +0800

    net/sched: flower: fix possible OOB write in fl_set_geneve_opt()
    
    [ Upstream commit 4d56304e5827c8cc8cc18c75343d283af7c4825c ]
    
    If we send two TCA_FLOWER_KEY_ENC_OPTS_GENEVE packets and their total
    size is 252 bytes(key->enc_opts.len = 252) then
    key->enc_opts.len = opt->length = data_len / 4 = 0 when the third
    TCA_FLOWER_KEY_ENC_OPTS_GENEVE packet enters fl_set_geneve_opt. This
    bypasses the next bounds check and results in an out-of-bounds.
    
    Fixes: 0a6e77784f49 ("net/sched: allow flower to match tunnel options")
    Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
    Link: https://lore.kernel.org/r/20230531102805.27090-1-hbh25y@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: Prohibit regrafting ingress or clsact Qdiscs [+ + +]
Author: Peilin Ye <peilin.ye@bytedance.com>
Date:   Mon May 29 12:54:26 2023 -0700

    net/sched: Prohibit regrafting ingress or clsact Qdiscs
    
    [ Upstream commit 9de95df5d15baa956c2b70b9e794842e790a8a13 ]
    
    Currently, after creating an ingress (or clsact) Qdisc and grafting it
    under TC_H_INGRESS (TC_H_CLSACT), it is possible to graft it again under
    e.g. a TBF Qdisc:
    
      $ ip link add ifb0 type ifb
      $ tc qdisc add dev ifb0 handle 1: root tbf rate 20kbit buffer 1600 limit 3000
      $ tc qdisc add dev ifb0 clsact
      $ tc qdisc link dev ifb0 handle ffff: parent 1:1
      $ tc qdisc show dev ifb0
      qdisc tbf 1: root refcnt 2 rate 20Kbit burst 1600b lat 560.0ms
      qdisc clsact ffff: parent ffff:fff1 refcnt 2
                                          ^^^^^^^^
    
    clsact's refcount has increased: it is now grafted under both
    TC_H_CLSACT and 1:1.
    
    ingress and clsact Qdiscs should only be used under TC_H_INGRESS
    (TC_H_CLSACT).  Prohibit regrafting them.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Fixes: 1f211a1b929c ("net, sched: add clsact qdisc")
    Tested-by: Pedro Tammela <pctammela@mojatatu.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
    Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: Reserve TC_H_INGRESS (TC_H_CLSACT) for ingress (clsact) Qdiscs [+ + +]
Author: Peilin Ye <peilin.ye@bytedance.com>
Date:   Mon May 29 12:54:03 2023 -0700

    net/sched: Reserve TC_H_INGRESS (TC_H_CLSACT) for ingress (clsact) Qdiscs
    
    [ Upstream commit f85fa45d4a9408d98c46c8fa45ba2e3b2f4bf219 ]
    
    Currently it is possible to add e.g. an HTB Qdisc under ffff:fff1
    (TC_H_INGRESS, TC_H_CLSACT):
    
      $ ip link add name ifb0 type ifb
      $ tc qdisc add dev ifb0 parent ffff:fff1 htb
      $ tc qdisc add dev ifb0 clsact
      Error: Exclusivity flag on, cannot modify.
      $ drgn
      ...
      >>> ifb0 = netdev_get_by_name(prog, "ifb0")
      >>> qdisc = ifb0.ingress_queue.qdisc_sleeping
      >>> print(qdisc.ops.id.string_().decode())
      htb
      >>> qdisc.flags.value_() # TCQ_F_INGRESS
      2
    
    Only allow ingress and clsact Qdiscs under ffff:fff1.  Return -EINVAL
    for everything else.  Make TCQ_F_INGRESS a static flag of ingress and
    clsact Qdiscs.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Fixes: 1f211a1b929c ("net, sched: add clsact qdisc")
    Tested-by: Pedro Tammela <pctammela@mojatatu.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
    Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: sch_clsact: Only create under TC_H_CLSACT [+ + +]
Author: Peilin Ye <peilin.ye@bytedance.com>
Date:   Mon May 29 12:53:21 2023 -0700

    net/sched: sch_clsact: Only create under TC_H_CLSACT
    
    [ Upstream commit 5eeebfe6c493192b10d516abfd72742900f2a162 ]
    
    clsact Qdiscs are only supposed to be created under TC_H_CLSACT (which
    equals TC_H_INGRESS).  Return -EOPNOTSUPP if 'parent' is not
    TC_H_CLSACT.
    
    Fixes: 1f211a1b929c ("net, sched: add clsact qdisc")
    Tested-by: Pedro Tammela <pctammela@mojatatu.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
    Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: sch_ingress: Only create under TC_H_INGRESS [+ + +]
Author: Peilin Ye <peilin.ye@bytedance.com>
Date:   Mon May 29 12:52:55 2023 -0700

    net/sched: sch_ingress: Only create under TC_H_INGRESS
    
    [ Upstream commit c7cfbd115001f94de9e4053657946a383147e803 ]
    
    ingress Qdiscs are only supposed to be created under TC_H_INGRESS.
    Return -EOPNOTSUPP if 'parent' is not TC_H_INGRESS, similar to
    mq_init().
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+b53a9c0d1ea4ad62da8b@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/r/0000000000006cf87705f79acf1a@google.com/
    Tested-by: Pedro Tammela <pctammela@mojatatu.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
    Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: dsa: mv88e6xxx: Increase wait after reset deactivation [+ + +]
Author: Andreas Svensson <andreas.svensson@axis.com>
Date:   Tue May 30 16:52:23 2023 +0200

    net: dsa: mv88e6xxx: Increase wait after reset deactivation
    
    [ Upstream commit 3c27f3d53d588618d81d30d6712459a3cc9489b8 ]
    
    A switch held in reset by default needs to wait longer until we can
    reliably detect it.
    
    An issue was observed when testing on the Marvell 88E6393X (Link Street).
    The driver failed to detect the switch on some upstarts. Increasing the
    wait time after reset deactivation solves this issue.
    
    The updated wait time is now also the same as the wait time in the
    mv88e6xxx_hardware_reset function.
    
    Fixes: 7b75e49de424 ("net: dsa: mv88e6xxx: wait after reset deactivation")
    Signed-off-by: Andreas Svensson <andreas.svensson@axis.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20230530145223.1223993-1-andreas.svensson@axis.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: sched: fix NULL pointer dereference in mq_attach [+ + +]
Author: Zhengchao Shao <shaozhengchao@huawei.com>
Date:   Sat May 27 17:37:47 2023 +0800

    net: sched: fix NULL pointer dereference in mq_attach
    
    [ Upstream commit 36eec020fab668719b541f34d97f44e232ffa165 ]
    
    When use the following command to test:
    1)ip link add bond0 type bond
    2)ip link set bond0 up
    3)tc qdisc add dev bond0 root handle ffff: mq
    4)tc qdisc replace dev bond0 parent ffff:fff1 handle ffff: mq
    
    The kernel reports NULL pointer dereference issue. The stack information
    is as follows:
    Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    Internal error: Oops: 0000000096000006 [#1] SMP
    Modules linked in:
    pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : mq_attach+0x44/0xa0
    lr : qdisc_graft+0x20c/0x5cc
    sp : ffff80000e2236a0
    x29: ffff80000e2236a0 x28: ffff0000c0e59d80 x27: ffff0000c0be19c0
    x26: ffff0000cae3e800 x25: 0000000000000010 x24: 00000000fffffff1
    x23: 0000000000000000 x22: ffff0000cae3e800 x21: ffff0000c9df4000
    x20: ffff0000c9df4000 x19: 0000000000000000 x18: ffff80000a934000
    x17: ffff8000f5b56000 x16: ffff80000bb08000 x15: 0000000000000000
    x14: 0000000000000000 x13: 6b6b6b6b6b6b6b6b x12: 6b6b6b6b00000001
    x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
    x8 : ffff0000c0be0730 x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000008
    x5 : ffff0000cae3e864 x4 : 0000000000000000 x3 : 0000000000000001
    x2 : 0000000000000001 x1 : ffff8000090bc23c x0 : 0000000000000000
    Call trace:
    mq_attach+0x44/0xa0
    qdisc_graft+0x20c/0x5cc
    tc_modify_qdisc+0x1c4/0x664
    rtnetlink_rcv_msg+0x354/0x440
    netlink_rcv_skb+0x64/0x144
    rtnetlink_rcv+0x28/0x34
    netlink_unicast+0x1e8/0x2a4
    netlink_sendmsg+0x308/0x4a0
    sock_sendmsg+0x64/0xac
    ____sys_sendmsg+0x29c/0x358
    ___sys_sendmsg+0x90/0xd0
    __sys_sendmsg+0x7c/0xd0
    __arm64_sys_sendmsg+0x2c/0x38
    invoke_syscall+0x54/0x114
    el0_svc_common.constprop.1+0x90/0x174
    do_el0_svc+0x3c/0xb0
    el0_svc+0x24/0xec
    el0t_64_sync_handler+0x90/0xb4
    el0t_64_sync+0x174/0x178
    
    This is because when mq is added for the first time, qdiscs in mq is set
    to NULL in mq_attach(). Therefore, when replacing mq after adding mq, we
    need to initialize qdiscs in the mq before continuing to graft. Otherwise,
    it will couse NULL pointer dereference issue in mq_attach(). And the same
    issue will occur in the attach functions of mqprio, taprio and htb.
    ffff:fff1 means that the repalce qdisc is ingress. Ingress does not allow
    any qdisc to be attached. Therefore, ffff:fff1 is incorrectly used, and
    the command should be dropped.
    
    Fixes: 6ec1c69a8f64 ("net_sched: add classful multiqueue dummy scheduler")
    Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
    Tested-by: Peilin Ye <peilin.ye@bytedance.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://lore.kernel.org/r/20230527093747.3583502-1-shaozhengchao@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: usb: qmi_wwan: Set DTR quirk for BroadMobi BM818 [+ + +]
Author: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
Date:   Fri May 26 16:38:11 2023 +0200

    net: usb: qmi_wwan: Set DTR quirk for BroadMobi BM818
    
    commit 36936a56e1814f6c526fe71fbf980beab4f5577a upstream.
    
    BM818 is based on Qualcomm MDM9607 chipset.
    
    Fixes: 9a07406b00cd ("net: usb: qmi_wwan: Add the BroadMobi BM818 card")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
    Acked-by: Bjørn Mork <bjorn@mork.no>
    Link: https://lore.kernel.org/r/20230526-bm818-dtr-v1-1-64bbfa6ba8af@puri.sm
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netfilter: conntrack: define variables exp_nat_nla_policy and any_addr with CONFIG_NF_NAT [+ + +]
Author: Tom Rix <trix@redhat.com>
Date:   Sun May 14 10:00:10 2023 -0400

    netfilter: conntrack: define variables exp_nat_nla_policy and any_addr with CONFIG_NF_NAT
    
    [ Upstream commit 224a876e37543eee111bf9b6aa4935080e619335 ]
    
    gcc with W=1 and ! CONFIG_NF_NAT
    net/netfilter/nf_conntrack_netlink.c:3463:32: error:
      ‘exp_nat_nla_policy’ defined but not used [-Werror=unused-const-variable=]
     3463 | static const struct nla_policy exp_nat_nla_policy[CTA_EXPECT_NAT_MAX+1] = {
          |                                ^~~~~~~~~~~~~~~~~~
    net/netfilter/nf_conntrack_netlink.c:2979:33: error:
      ‘any_addr’ defined but not used [-Werror=unused-const-variable=]
     2979 | static const union nf_inet_addr any_addr;
          |                                 ^~~~~~~~
    
    These variables use is controlled by CONFIG_NF_NAT, so should their definitions.
    
    Signed-off-by: Tom Rix <trix@redhat.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netrom: fix info-leak in nr_write_internal() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed May 24 14:14:56 2023 +0000

    netrom: fix info-leak in nr_write_internal()
    
    [ Upstream commit 31642e7089df8fd3f54ca7843f7ee2952978cad1 ]
    
    Simon Kapadia reported the following issue:
    
    <quote>
    
    The Online Amateur Radio Community (OARC) has recently been experimenting
    with building a nationwide packet network in the UK.
    As part of our experimentation, we have been testing out packet on 300bps HF,
    and playing with net/rom.  For HF packet at this baud rate you really need
    to make sure that your MTU is relatively low; AX.25 suggests a PACLEN of 60,
    and a net/rom PACLEN of 40 to go with that.
    However the Linux net/rom support didn't work with a low PACLEN;
    the mkiss module would truncate packets if you set the PACLEN below about 200 or so, e.g.:
    
    Apr 19 14:00:51 radio kernel: [12985.747310] mkiss: ax1: truncating oversized transmit packet!
    
    This didn't make any sense to me (if the packets are smaller why would they
    be truncated?) so I started investigating.
    I looked at the packets using ethereal, and found that many were just huge
    compared to what I would expect.
    A simple net/rom connection request packet had the request and then a bunch
    of what appeared to be random data following it:
    
    </quote>
    
    Simon provided a patch that I slightly revised:
    Not only we must not use skb_tailroom(), we also do
    not want to count NR_NETWORK_LEN twice.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Co-Developed-by: Simon Kapadia <szymon@kapadia.pl>
    Signed-off-by: Simon Kapadia <szymon@kapadia.pl>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Tested-by: Simon Kapadia <szymon@kapadia.pl>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Link: https://lore.kernel.org/r/20230524141456.1045467-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/bnxt_re: Code refactor while populating user MRs [+ + +]
Author: Selvin Xavier <selvin.xavier@broadcom.com>
Date:   Thu Jan 7 01:43:27 2021 -0800

    RDMA/bnxt_re: Code refactor while populating user MRs
    
    [ Upstream commit f6919d56388c95dba2e630670a77c380e4616c50 ]
    
    Refactor code that populates MR page buffer list. Instead of allocating a
    pbl_tbl to hold the buffer list, pass the struct ib_umem directly to
    bnxt_qplib_alloc_init_hwq() as done for other user space memories.  Fix
    the PBL level to handle the above mentioned change.
    
    Also, remove an unwanted flag from the input to bnxt_qplib_reg_mr()
    function.
    
    Link: https://lore.kernel.org/r/1610012608-14528-2-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Stable-dep-of: 08c7f09356e4 ("RDMA/bnxt_re: Fix the page_size used during the MR creation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
RDMA/bnxt_re: Fix a possible memory leak [+ + +]
Author: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Date:   Thu May 18 01:10:59 2023 -0700

    RDMA/bnxt_re: Fix a possible memory leak
    
    [ Upstream commit 349e3c0cf239cc01d58a1e6c749e171de014cd6a ]
    
    Inside bnxt_qplib_create_cq(), when the check for NULL DPI fails, driver
    returns directly without freeing the memory allocated inside
    bnxt_qplib_alloc_init_hwq() routine.
    
    Fixed this by moving the check for NULL DPI before invoking
    bnxt_qplib_alloc_init_hwq().
    
    Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
    Link: https://lore.kernel.org/r/1684397461-23082-2-git-send-email-selvin.xavier@broadcom.com
    Reviewed-by: Kashyap Desai <kashyap.desai@broadcom.com>
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Fix return value of bnxt_re_process_raw_qp_pkt_rx [+ + +]
Author: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Date:   Thu May 18 01:11:00 2023 -0700

    RDMA/bnxt_re: Fix return value of bnxt_re_process_raw_qp_pkt_rx
    
    [ Upstream commit 0fa0d520e2a878cb4c94c4dc84395905d3f14f54 ]
    
    bnxt_re_process_raw_qp_pkt_rx() always return 0 and ignores the return
    value of bnxt_re_post_send_shadow_qp().
    
    Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
    Link: https://lore.kernel.org/r/1684397461-23082-3-git-send-email-selvin.xavier@broadcom.com
    Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com>
    Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Fix the page_size used during the MR creation [+ + +]
Author: Selvin Xavier <selvin.xavier@broadcom.com>
Date:   Sun May 7 11:29:29 2023 -0700

    RDMA/bnxt_re: Fix the page_size used during the MR creation
    
    [ Upstream commit 08c7f09356e45d093d1867c7a3c6ac6526e2f98b ]
    
    Driver populates the list of pages used for Memory region wrongly when
    page size is more than system page size. This is causing a failure when
    some of the applications that creates MR with page size as 2M.  Since HW
    can support multiple page sizes, pass the correct page size while creating
    the MR.
    
    Also, driver need not adjust the number of pages when HW Queues are
    created with user memory. It should work with the number of dma blocks
    returned by ib_umem_num_dma_blocks. Fix this calculation also.
    
    Fixes: 0c4dcd602817 ("RDMA/bnxt_re: Refactor hardware queue memory allocation")
    Fixes: f6919d56388c ("RDMA/bnxt_re: Code refactor while populating user MRs")
    Link: https://lore.kernel.org/r/1683484169-9539-1-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/efa: Fix unsupported page sizes in device [+ + +]
Author: Yonatan Nachum <ynachum@amazon.com>
Date:   Thu May 11 11:51:03 2023 +0000

    RDMA/efa: Fix unsupported page sizes in device
    
    [ Upstream commit 866422cdddcdf59d8c68e9472d49ba1be29b5fcf ]
    
    Device uses 4KB size blocks for user pages indirect list while the
    driver creates those blocks with the size of PAGE_SIZE of the kernel. On
    kernels with PAGE_SIZE different than 4KB (ARM RHEL), this leads to a
    failure on register MR with indirect list because of the miss
    communication between driver and device.
    
    Fixes: 40909f664d27 ("RDMA/efa: Add EFA verbs implementation")
    Link: https://lore.kernel.org/r/20230511115103.13876-1-ynachum@amazon.com
    Reviewed-by: Firas Jahjah <firasj@amazon.com>
    Reviewed-by: Michael Margolin <mrgolin@amazon.com>
    Signed-off-by: Yonatan Nachum <ynachum@amazon.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
regmap: Account for register length when chunking [+ + +]
Author: Jim Wylder <jwylder@google.com>
Date:   Wed May 17 10:20:11 2023 -0500

    regmap: Account for register length when chunking
    
    commit 3981514180c987a79ea98f0ae06a7cbf58a9ac0f upstream.
    
    Currently, when regmap_raw_write() splits the data, it uses the
    max_raw_write value defined for the bus.  For any bus that includes
    the target register address in the max_raw_write value, the chunked
    transmission will always exceed the maximum transmission length.
    To avoid this problem, subtract the length of the register and the
    padding from the maximum transmission.
    
    Signed-off-by: Jim Wylder <jwylder@google.com
    Link: https://lore.kernel.org/r/20230517152444.3690870-2-jwylder@google.com
    Signed-off-by: Mark Brown <broonie@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/pkey: zeroize key blobs [+ + +]
Author: Holger Dengler <dengler@linux.ibm.com>
Date:   Thu Apr 20 14:34:10 2023 +0200

    s390/pkey: zeroize key blobs
    
    [ Upstream commit 844cf829e5f33e00b279230470c8c93b58b8c16f ]
    
    Key blobs for the IOCTLs PKEY_KBLOB2PROTK[23] may contain clear key
    material. Zeroize the copies of these keys in kernel memory after
    creating the protected key.
    
    Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
scsi: core: Decrease scsi_device's iorequest_cnt if dispatch failed [+ + +]
Author: Wenchao Hao <haowenchao2@huawei.com>
Date:   Mon May 15 15:01:56 2023 +0800

    scsi: core: Decrease scsi_device's iorequest_cnt if dispatch failed
    
    [ Upstream commit 09e797c8641f6ad435c33ae24c223351197ea29a ]
    
    If scsi_dispatch_cmd() failed, the SCSI command was not sent to the target,
    scsi_queue_rq() would return BLK_STS_RESOURCE and the related request would
    be requeued. The timeout of this request would not fire, no one would
    increase iodone_cnt.
    
    The above flow would result the iodone_cnt smaller than iorequest_cnt.  So
    decrease the iorequest_cnt if dispatch failed to workaround the issue.
    
    Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
    Reported-by: Ming Lei <ming.lei@redhat.com>
    Closes: https://lore.kernel.org/r/ZF+zB+bB7iqe0wGd@ovpn-8-17.pek2.redhat.com
    Link: https://lore.kernel.org/r/20230515070156.1790181-3-haowenchao2@huawei.com
    Reviewed-by: Ming Lei <ming.lei@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: dpt_i2o: Do not process completions with invalid addresses [+ + +]
Author: Ben Hutchings <benh@debian.org>
Date:   Sat May 27 15:52:48 2023 +0200

    scsi: dpt_i2o: Do not process completions with invalid addresses
    
    adpt_isr() reads reply addresses from a hardware register, which
    should always be within the DMA address range of the device's pool of
    reply address buffers.  In case the address is out of range, it tries
    to muddle on, converting to a virtual address using bus_to_virt().
    
    bus_to_virt() does not take DMA addresses, and it doesn't make sense
    to try to handle the completion in this case.  Ignore it and continue
    looping to service the interrupt.  If a completion has been lost then
    the SCSI core should eventually time-out and trigger a reset.
    
    There is no corresponding upstream commit, because this driver was
    removed upstream.
    
    Fixes: 67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt ...")
    Signed-off-by: Ben Hutchings <benh@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: dpt_i2o: Remove broken pass-through ioctl (I2OUSERCMD) [+ + +]
Author: Ben Hutchings <benh@debian.org>
Date:   Sat May 27 15:34:30 2023 +0200

    scsi: dpt_i2o: Remove broken pass-through ioctl (I2OUSERCMD)
    
    adpt_i2o_passthru() takes a user-provided message and passes it
    through to the hardware with appropriate translation of addresses
    and message IDs.  It has a number of bugs:
    
    - When a message requires scatter/gather, it doesn't verify that the
      offset to the scatter/gather list is less than the message size.
    - When a message requires scatter/gather, it overwrites the DMA
      addresses with the user-space virtual addresses before unmapping the
      DMA buffers.
    - It reads the message from user memory multiple times.  This allows
      user-space to change the message and bypass validation.
    - It assumes that the message is at least 4 words long, but doesn't
      check that.
    
    I tried fixing these, but even the maintainer of the corresponding
    user-space in Debian doesn't have the hardware any more.
    
    Instead, remove the pass-through ioctl (I2OUSRCMD) and supporting
    code.
    
    There is no corresponding upstream commit, because this driver was
    removed upstream.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Fixes: 67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt ...")
    Signed-off-by: Ben Hutchings <benh@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: stex: Fix gcc 13 warnings [+ + +]
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Mon May 29 12:50:34 2023 -0700

    scsi: stex: Fix gcc 13 warnings
    
    commit 6d074ce231772c66e648a61f6bd2245e7129d1f5 upstream.
    
    gcc 13 may assign another type to enumeration constants than gcc 12. Split
    the large enum at the top of source file stex.c such that the type of the
    constants used in time expressions is changed back to the same type chosen
    by gcc 12. This patch suppresses compiler warnings like this one:
    
    In file included from ./include/linux/bitops.h:7,
                     from ./include/linux/kernel.h:22,
                     from drivers/scsi/stex.c:13:
    drivers/scsi/stex.c: In function ‘stex_common_handshake’:
    ./include/linux/typecheck.h:12:25: error: comparison of distinct pointer types lacks a cast [-Werror]
       12 |         (void)(&__dummy == &__dummy2); \
          |                         ^~
    ./include/linux/jiffies.h:106:10: note: in expansion of macro ‘typecheck’
      106 |          typecheck(unsigned long, b) && \
          |          ^~~~~~~~~
    drivers/scsi/stex.c:1035:29: note: in expansion of macro ‘time_after’
     1035 |                         if (time_after(jiffies, before + MU_MAX_DELAY * HZ)) {
          |                             ^~~~~~~~~~
    
    See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107405.
    
    Cc: stable@vger.kernel.org
    Acked-by: Randy Dunlap <rdunlap@infradead.org>
    Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://lore.kernel.org/r/20230529195034.3077-1-bvanassche@acm.org
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests: mptcp: connect: skip if MPTCP is not supported [+ + +]
Author: Matthieu Baerts <matthieu.baerts@tessares.net>
Date:   Sun May 28 19:35:27 2023 +0200

    selftests: mptcp: connect: skip if MPTCP is not supported
    
    commit d83013bdf90a7994a474b0e650a7fc94b0d4ded6 upstream.
    
    Selftests are supposed to run on any kernels, including the old ones not
    supporting MPTCP.
    
    A new check is then added to make sure MPTCP is supported. If not, the
    test stops and is marked as "skipped". Note that this check can also
    mark the test as failed if 'SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES' env
    var is set to 1: by doing that, we can make sure a test is not being
    skipped by mistake.
    
    A new shared file is added here to be able to re-used the same check in
    the different selftests we have.
    
    Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
    Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
    Cc: stable@vger.kernel.org
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests: mptcp: diag: skip if MPTCP is not supported [+ + +]
Author: Matthieu Baerts <matthieu.baerts@tessares.net>
Date:   Sun May 28 19:35:30 2023 +0200

    selftests: mptcp: diag: skip if MPTCP is not supported
    
    commit 46565acdd29facbf418a11e4a3791b3c8967308d upstream.
    
    Selftests are supposed to run on any kernels, including the old ones not
    supporting MPTCP.
    
    A new check is then added to make sure MPTCP is supported. If not, the
    test stops and is marked as "skipped".
    
    Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
    Fixes: df62f2ec3df6 ("selftests/mptcp: add diag interface tests")
    Cc: stable@vger.kernel.org
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests: mptcp: join: skip if MPTCP is not supported [+ + +]
Author: Matthieu Baerts <matthieu.baerts@tessares.net>
Date:   Sun May 28 19:35:29 2023 +0200

    selftests: mptcp: join: skip if MPTCP is not supported
    
    commit 715c78a82e00f848f99ef76e6f6b89216ccba268 upstream.
    
    Selftests are supposed to run on any kernels, including the old ones not
    supporting MPTCP.
    
    A new check is then added to make sure MPTCP is supported. If not, the
    test stops and is marked as "skipped".
    
    Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
    Fixes: b08fbf241064 ("selftests: add test-cases for MPTCP MP_JOIN")
    Cc: stable@vger.kernel.org
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests: mptcp: pm nl: skip if MPTCP is not supported [+ + +]
Author: Matthieu Baerts <matthieu.baerts@tessares.net>
Date:   Sun May 28 19:35:28 2023 +0200

    selftests: mptcp: pm nl: skip if MPTCP is not supported
    
    commit 0f4955a40dafe18a1122e3714d8173e4b018e869 upstream.
    
    Selftests are supposed to run on any kernels, including the old ones not
    supporting MPTCP.
    
    A new check is then added to make sure MPTCP is supported. If not, the
    test stops and is marked as "skipped".
    
    Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
    Fixes: eedbc685321b ("selftests: add PM netlink functional tests")
    Cc: stable@vger.kernel.org
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests: mptcp: simult flows: skip if MPTCP is not supported [+ + +]
Author: Matthieu Baerts <matthieu.baerts@tessares.net>
Date:   Sun May 28 19:35:31 2023 +0200

    selftests: mptcp: simult flows: skip if MPTCP is not supported
    
    commit 9161f21c74a1a0e7bb39eb84ea0c86b23c92fc87 upstream.
    
    Selftests are supposed to run on any kernels, including the old ones not
    supporting MPTCP.
    
    A new check is then added to make sure MPTCP is supported. If not, the
    test stops and is marked as "skipped".
    
    Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
    Fixes: 1a418cb8e888 ("mptcp: simult flow self-tests")
    Cc: stable@vger.kernel.org
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selinux: don't use make's grouped targets feature yet [+ + +]
Author: Paul Moore <paul@paul-moore.com>
Date:   Thu Jun 1 10:21:21 2023 -0400

    selinux: don't use make's grouped targets feature yet
    
    commit 42c4e97e06a839b07d834f640a10911ad84ec8b3 upstream.
    
    The Linux Kernel currently only requires make v3.82 while the grouped
    target functionality requires make v4.3.  Removed the grouped target
    introduced in 4ce1f694eb5d ("selinux: ensure av_permissions.h is
    built when needed") as well as the multiple header file targets in
    the make rule.  This effectively reverts the problem commit.
    
    We will revisit this change when make >= 4.3 is required by the rest
    of the kernel.
    
    Cc: stable@vger.kernel.org
    Fixes: 4ce1f694eb5d ("selinux: ensure av_permissions.h is built when needed")
    Reported-by: Erwan Velu <e.velu@criteo.com>
    Reported-by: Luiz Capitulino <luizcap@amazon.com>
    Tested-by: Luiz Capitulino <luizcap@amazon.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
serial: 8250_tegra: Fix an error handling path in tegra_uart_probe() [+ + +]
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sun May 14 13:25:42 2023 +0200

    serial: 8250_tegra: Fix an error handling path in tegra_uart_probe()
    
    commit 134f49dec0b6aca3259cd8259de4c572048bd207 upstream.
    
    If an error occurs after reset_control_deassert(), it must be re-asserted,
    as already done in the .remove() function.
    
    Fixes: c6825c6395b7 ("serial: 8250_tegra: Create Tegra specific 8250 driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/r/f8130f35339cc80edc6b9aac4bb2a60b60a226bf.1684063511.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tcp: deny tcp_disconnect() when threads are waiting [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri May 26 16:34:58 2023 +0000

    tcp: deny tcp_disconnect() when threads are waiting
    
    [ Upstream commit 4faeee0cf8a5d88d63cdbc3bab124fb0e6aed08c ]
    
    Historically connect(AF_UNSPEC) has been abused by syzkaller
    and other fuzzers to trigger various bugs.
    
    A recent one triggers a divide-by-zero [1], and Paolo Abeni
    was able to diagnose the issue.
    
    tcp_recvmsg_locked() has tests about sk_state being not TCP_LISTEN
    and TCP REPAIR mode being not used.
    
    Then later if socket lock is released in sk_wait_data(),
    another thread can call connect(AF_UNSPEC), then make this
    socket a TCP listener.
    
    When recvmsg() is resumed, it can eventually call tcp_cleanup_rbuf()
    and attempt a divide by 0 in tcp_rcv_space_adjust() [1]
    
    This patch adds a new socket field, counting number of threads
    blocked in sk_wait_event() and inet_wait_for_connect().
    
    If this counter is not zero, tcp_disconnect() returns an error.
    
    This patch adds code in blocking socket system calls, thus should
    not hurt performance of non blocking ones.
    
    Note that we probably could revert commit 499350a5a6e7 ("tcp:
    initialize rcv_mss to TCP_MIN_MSS instead of 0") to restore
    original tcpi_rcv_mss meaning (was 0 if no payload was ever
    received on a socket)
    
    [1]
    divide error: 0000 [#1] PREEMPT SMP KASAN
    CPU: 0 PID: 13832 Comm: syz-executor.5 Not tainted 6.3.0-rc4-syzkaller-00224-g00c7b5f4ddc5 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
    RIP: 0010:tcp_rcv_space_adjust+0x36e/0x9d0 net/ipv4/tcp_input.c:740
    Code: 00 00 00 00 fc ff df 4c 89 64 24 48 8b 44 24 04 44 89 f9 41 81 c7 80 03 00 00 c1 e1 04 44 29 f0 48 63 c9 48 01 e9 48 0f af c1 <49> f7 f6 48 8d 04 41 48 89 44 24 40 48 8b 44 24 30 48 c1 e8 03 48
    RSP: 0018:ffffc900033af660 EFLAGS: 00010206
    RAX: 4a66b76cbade2c48 RBX: ffff888076640cc0 RCX: 00000000c334e4ac
    RDX: 0000000000000000 RSI: dffffc0000000000 RDI: 0000000000000001
    RBP: 00000000c324e86c R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880766417f8
    R13: ffff888028fbb980 R14: 0000000000000000 R15: 0000000000010344
    FS: 00007f5bffbfe700(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000001b32f25000 CR3: 000000007ced0000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <TASK>
    tcp_recvmsg_locked+0x100e/0x22e0 net/ipv4/tcp.c:2616
    tcp_recvmsg+0x117/0x620 net/ipv4/tcp.c:2681
    inet6_recvmsg+0x114/0x640 net/ipv6/af_inet6.c:670
    sock_recvmsg_nosec net/socket.c:1017 [inline]
    sock_recvmsg+0xe2/0x160 net/socket.c:1038
    ____sys_recvmsg+0x210/0x5a0 net/socket.c:2720
    ___sys_recvmsg+0xf2/0x180 net/socket.c:2762
    do_recvmmsg+0x25e/0x6e0 net/socket.c:2856
    __sys_recvmmsg net/socket.c:2935 [inline]
    __do_sys_recvmmsg net/socket.c:2958 [inline]
    __se_sys_recvmmsg net/socket.c:2951 [inline]
    __x64_sys_recvmmsg+0x20f/0x260 net/socket.c:2951
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    RIP: 0033:0x7f5c0108c0f9
    Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007f5bffbfe168 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
    RAX: ffffffffffffffda RBX: 00007f5c011ac050 RCX: 00007f5c0108c0f9
    RDX: 0000000000000001 RSI: 0000000020000bc0 RDI: 0000000000000003
    RBP: 00007f5c010e7b39 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000122 R11: 0000000000000246 R12: 0000000000000000
    R13: 00007f5c012cfb1f R14: 00007f5bffbfe300 R15: 0000000000022000
    </TASK>
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Reported-by: Paolo Abeni <pabeni@redhat.com>
    Diagnosed-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Tested-by: Paolo Abeni <pabeni@redhat.com>
    Link: https://lore.kernel.org/r/20230526163458.2880232-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tcp: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state if user_mss set [+ + +]
Author: Cambda Zhu <cambda@linux.alibaba.com>
Date:   Sat May 27 12:03:17 2023 +0800

    tcp: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state if user_mss set
    
    [ Upstream commit 34dfde4ad87b84d21278a7e19d92b5b2c68e6c4d ]
    
    This patch replaces the tp->mss_cache check in getting TCP_MAXSEG
    with tp->rx_opt.user_mss check for CLOSE/LISTEN sock. Since
    tp->mss_cache is initialized with TCP_MSS_DEFAULT, checking if
    it's zero is probably a bug.
    
    With this change, getting TCP_MAXSEG before connecting will return
    default MSS normally, and return user_mss if user_mss is set.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Jack Yang <mingliang@linux.alibaba.com>
    Suggested-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/netdev/CANn89i+3kL9pYtkxkwxwNMzvC_w3LNUum_2=3u+UyLBmGmifHA@mail.gmail.com/#t
    Signed-off-by: Cambda Zhu <cambda@linux.alibaba.com>
    Link: https://lore.kernel.org/netdev/14D45862-36EA-4076-974C-EA67513C92F6@linux.alibaba.com/
    Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20230527040317.68247-1-cambda@linux.alibaba.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
test_firmware: fix the memory leak of the allocated firmware buffer [+ + +]
Author: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Date:   Tue May 9 10:47:49 2023 +0200

    test_firmware: fix the memory leak of the allocated firmware buffer
    
    commit 48e156023059e57a8fc68b498439832f7600ffff upstream.
    
    The following kernel memory leak was noticed after running
    tools/testing/selftests/firmware/fw_run_tests.sh:
    
    [root@pc-mtodorov firmware]# cat /sys/kernel/debug/kmemleak
    .
    .
    .
    unreferenced object 0xffff955389bc3400 (size 1024):
      comm "test_firmware-0", pid 5451, jiffies 4294944822 (age 65.652s)
      hex dump (first 32 bytes):
        47 48 34 35 36 37 0a 00 00 00 00 00 00 00 00 00  GH4567..........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffffffff962f5dec>] slab_post_alloc_hook+0x8c/0x3c0
        [<ffffffff962fcca4>] __kmem_cache_alloc_node+0x184/0x240
        [<ffffffff962704de>] kmalloc_trace+0x2e/0xc0
        [<ffffffff9665b42d>] test_fw_run_batch_request+0x9d/0x180
        [<ffffffff95fd813b>] kthread+0x10b/0x140
        [<ffffffff95e033e9>] ret_from_fork+0x29/0x50
    unreferenced object 0xffff9553c334b400 (size 1024):
      comm "test_firmware-1", pid 5452, jiffies 4294944822 (age 65.652s)
      hex dump (first 32 bytes):
        47 48 34 35 36 37 0a 00 00 00 00 00 00 00 00 00  GH4567..........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffffffff962f5dec>] slab_post_alloc_hook+0x8c/0x3c0
        [<ffffffff962fcca4>] __kmem_cache_alloc_node+0x184/0x240
        [<ffffffff962704de>] kmalloc_trace+0x2e/0xc0
        [<ffffffff9665b42d>] test_fw_run_batch_request+0x9d/0x180
        [<ffffffff95fd813b>] kthread+0x10b/0x140
        [<ffffffff95e033e9>] ret_from_fork+0x29/0x50
    unreferenced object 0xffff9553c334f000 (size 1024):
      comm "test_firmware-2", pid 5453, jiffies 4294944822 (age 65.652s)
      hex dump (first 32 bytes):
        47 48 34 35 36 37 0a 00 00 00 00 00 00 00 00 00  GH4567..........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffffffff962f5dec>] slab_post_alloc_hook+0x8c/0x3c0
        [<ffffffff962fcca4>] __kmem_cache_alloc_node+0x184/0x240
        [<ffffffff962704de>] kmalloc_trace+0x2e/0xc0
        [<ffffffff9665b42d>] test_fw_run_batch_request+0x9d/0x180
        [<ffffffff95fd813b>] kthread+0x10b/0x140
        [<ffffffff95e033e9>] ret_from_fork+0x29/0x50
    unreferenced object 0xffff9553c3348400 (size 1024):
      comm "test_firmware-3", pid 5454, jiffies 4294944822 (age 65.652s)
      hex dump (first 32 bytes):
        47 48 34 35 36 37 0a 00 00 00 00 00 00 00 00 00  GH4567..........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffffffff962f5dec>] slab_post_alloc_hook+0x8c/0x3c0
        [<ffffffff962fcca4>] __kmem_cache_alloc_node+0x184/0x240
        [<ffffffff962704de>] kmalloc_trace+0x2e/0xc0
        [<ffffffff9665b42d>] test_fw_run_batch_request+0x9d/0x180
        [<ffffffff95fd813b>] kthread+0x10b/0x140
        [<ffffffff95e033e9>] ret_from_fork+0x29/0x50
    [root@pc-mtodorov firmware]#
    
    Note that the size 1024 corresponds to the size of the test firmware
    buffer. The actual number of the buffers leaked is around 70-110,
    depending on the test run.
    
    The cause of the leak is the following:
    
    request_partial_firmware_into_buf() and request_firmware_into_buf()
    provided firmware buffer isn't released on release_firmware(), we
    have allocated it and we are responsible for deallocating it manually.
    This is introduced in a number of context where previously only
    release_firmware() was called, which was insufficient.
    
    Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
    Fixes: 7feebfa487b92 ("test_firmware: add support for request_firmware_into_buf")
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Dan Carpenter <error27@gmail.com>
    Cc: Takashi Iwai <tiwai@suse.de>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Russ Weight <russell.h.weight@intel.com>
    Cc: Tianfei zhang <tianfei.zhang@intel.com>
    Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Cc: Zhengchao Shao <shaozhengchao@huawei.com>
    Cc: Colin Ian King <colin.i.king@gmail.com>
    Cc: linux-kernel@vger.kernel.org
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Scott Branden <sbranden@broadcom.com>
    Cc: Luis R. Rodriguez <mcgrof@kernel.org>
    Cc: linux-kselftest@vger.kernel.org
    Cc: stable@vger.kernel.org # v5.4
    Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
    Link: https://lore.kernel.org/r/20230509084746.48259-3-mirsad.todorovac@alu.unizg.hr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tpm, tpm_tis: Request threaded interrupt handler [+ + +]
Author: Lino Sanfilippo <l.sanfilippo@kunbus.com>
Date:   Thu Nov 24 14:55:34 2022 +0100

    tpm, tpm_tis: Request threaded interrupt handler
    
    commit 0c7e66e5fd69bf21034c9a9b081d7de7c3eb2cea upstream.
    
    The TIS interrupt handler at least has to read and write the interrupt
    status register. In case of SPI both operations result in a call to
    tpm_tis_spi_transfer() which uses the bus_lock_mutex of the spi device
    and thus must only be called from a sleepable context.
    
    To ensure this request a threaded interrupt handler.
    
    Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
    Tested-by: Michael Niewöhner <linux@mniewoehner.de>
    Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing/probe: trace_probe_primary_from_call(): checked list_first_entry [+ + +]
Author: Pietro Borrello <borrello@diag.uniroma1.it>
Date:   Sat Jan 28 16:23:41 2023 +0000

    tracing/probe: trace_probe_primary_from_call(): checked list_first_entry
    
    commit 81d0fa4cb4fc0e1a49c2b22f92c43d9fe972ebcf upstream.
    
    All callers of trace_probe_primary_from_call() check the return
    value to be non NULL. However, the function returns
    list_first_entry(&tpe->probes, ...) which can never be NULL.
    Additionally, it does not check for the list being possibly empty,
    possibly causing a type confusion on empty lists.
    Use list_first_entry_or_null() which solves both problems.
    
    Link: https://lore.kernel.org/linux-trace-kernel/20230128-list-entry-null-check-v1-1-8bde6a3da2ef@diag.uniroma1.it/
    
    Fixes: 60d53e2c3b75 ("tracing/probe: Split trace_event related data from trace_probe")
    Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
    Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Acked-by: Mukesh Ojha <quic_mojha@quicinc.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tty: serial: fsl_lpuart: use UARTCTRL_TXINV to send break instead of UARTCTRL_SBK [+ + +]
Author: Sherry Sun <sherry.sun@nxp.com>
Date:   Fri May 19 17:47:51 2023 +0800

    tty: serial: fsl_lpuart: use UARTCTRL_TXINV to send break instead of UARTCTRL_SBK
    
    commit 2474e05467c00f7d51af3039b664de6886325257 upstream.
    
    LPUART IP now has two known bugs, one is that CTS has higher priority
    than the break signal, which causes the break signal sending through
    UARTCTRL_SBK may impacted by the CTS input if the HW flow control is
    enabled. It exists on all platforms we support in this driver.
    So we add a workaround patch for this issue: commit c4c81db5cf8b
    ("tty: serial: fsl_lpuart: disable the CTS when send break signal").
    
    Another IP bug is i.MX8QM LPUART may have an additional break character
    being sent after SBK was cleared. It may need to add some delay between
    clearing SBK and re-enabling CTS to ensure that the SBK latch are
    completely cleared.
    
    But we found that during the delay period before CTS is enabled, there
    is still a risk that Bluetooth data in TX FIFO may be sent out during
    this period because of break off and CTS disabled(even if BT sets CTS
    line deasserted, data is still sent to BT).
    
    Due to this risk, we have to drop the CTS-disabling workaround for SBK
    bugs, use TXINV seems to be a better way to replace SBK feature and
    avoid above risk. Also need to disable the transmitter to prevent any
    data from being sent out during break, then invert the TX line to send
    break. Then disable the TXINV when turn off break and re-enable
    transmitter.
    
    Fixes: c4c81db5cf8b ("tty: serial: fsl_lpuart: disable the CTS when send break signal")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
    Link: https://lore.kernel.org/r/20230519094751.28948-1-sherry.sun@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
udp6: Fix race condition in udp6_sendmsg & connect [+ + +]
Author: Vladislav Efanov <VEfanov@ispras.ru>
Date:   Tue May 30 14:39:41 2023 +0300

    udp6: Fix race condition in udp6_sendmsg & connect
    
    [ Upstream commit 448a5ce1120c5bdbce1f1ccdabcd31c7d029f328 ]
    
    Syzkaller got the following report:
    BUG: KASAN: use-after-free in sk_setup_caps+0x621/0x690 net/core/sock.c:2018
    Read of size 8 at addr ffff888027f82780 by task syz-executor276/3255
    
    The function sk_setup_caps (called by ip6_sk_dst_store_flow->
    ip6_dst_store) referenced already freed memory as this memory was
    freed by parallel task in udpv6_sendmsg->ip6_sk_dst_lookup_flow->
    sk_dst_check.
    
              task1 (connect)              task2 (udp6_sendmsg)
            sk_setup_caps->sk_dst_set |
                                      |  sk_dst_check->
                                      |      sk_dst_set
                                      |      dst_release
            sk_setup_caps references  |
            to already freed dst_entry|
    
    The reason for this race condition is: sk_setup_caps() keeps using
    the dst after transferring the ownership to the dst cache.
    
    Found by Linux Verification Center (linuxtesting.org) with syzkaller.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Vladislav Efanov <VEfanov@ispras.ru>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usb: gadget: f_fs: Add unbind event before functionfs_unbind [+ + +]
Author: Uttkarsh Aggarwal <quic_uaggarwa@quicinc.com>
Date:   Thu May 25 14:58:54 2023 +0530

    usb: gadget: f_fs: Add unbind event before functionfs_unbind
    
    commit efb6b535207395a5c7317993602e2503ca8cb4b3 upstream.
    
    While exercising the unbind path, with the current implementation
    the functionfs_unbind would be calling which waits for the ffs->mutex
    to be available, however within the same time ffs_ep0_read is invoked
    & if no setup packets are pending, it will invoke function
    wait_event_interruptible_exclusive_locked_irq which by definition waits
    for the ev.count to be increased inside the same mutex for which
    functionfs_unbind is waiting.
    This creates deadlock situation because the functionfs_unbind won't
    get the lock until ev.count is increased which can only happen if
    the caller ffs_func_unbind can proceed further.
    
    Following is the illustration:
    
            CPU1                            CPU2
    
    ffs_func_unbind()               ffs_ep0_read()
                                    mutex_lock(ffs->mutex)
                                    wait_event(ffs->ev.count)
    functionfs_unbind()
      mutex_lock(ffs->mutex)
      mutex_unlock(ffs->mutex)
    
    ffs_event_add()
    
    <deadlock>
    
    Fix this by moving the event unbind before functionfs_unbind
    to ensure the ev.count is incrased properly.
    
    Fixes: 6a19da111057 ("usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Uttkarsh Aggarwal <quic_uaggarwa@quicinc.com>
    Link: https://lore.kernel.org/r/20230525092854.7992-1-quic_uaggarwa@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
watchdog: menz069_wdt: fix watchdog initialisation [+ + +]
Author: Johannes Thumshirn <jth@kernel.org>
Date:   Tue Apr 18 19:25:30 2023 +0200

    watchdog: menz069_wdt: fix watchdog initialisation
    
    [ Upstream commit 87b22656ca6a896d0378e9e60ffccb0c82f48b08 ]
    
    Doing a 'cat /dev/watchdog0' with menz069_wdt as watchdog0 will result in
    a NULL pointer dereference.
    
    This happens because we're passing the wrong pointer to
    watchdog_register_device(). Fix this by getting rid of the static
    watchdog_device structure and use the one embedded into the driver's
    per-instance private data.
    
    Signed-off-by: Johannes Thumshirn <jth@kernel.org>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20230418172531.177349-2-jth@kernel.org
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
wifi: b43: fix incorrect __packed annotation [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 16 20:34:22 2023 +0200

    wifi: b43: fix incorrect __packed annotation
    
    [ Upstream commit 212457ccbd60dba34f965e4ffbe62f0e4f970538 ]
    
    clang warns about an unpacked structure inside of a packed one:
    
    drivers/net/wireless/broadcom/b43/b43.h:654:4: error: field data within 'struct b43_iv' is less aligned than 'union (unnamed union at /home/arnd/arm-soc/drivers/net/wireless/broadcom/b43/b43.h:651:2)' and is usually due to 'struct b43_iv' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
    
    The problem here is that the anonymous union has the default alignment
    from its members, apparently because the original author mixed up the
    placement of the __packed attribute by placing it next to the struct
    member rather than the union definition. As the struct itself is
    also marked as __packed, there is no need to mark its members, so just
    move the annotation to the inner type instead.
    
    As Michael noted, the same problem is present in b43legacy, so
    change both at the same time.
    
    Acked-by: Michael Büsch <m@bues.ch>
    Reported-by: kernel test robot <lkp@intel.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
    Link: https://lore.kernel.org/oe-kbuild-all/202305160749.ay1HAoyP-lkp@intel.com/
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20230516183442.536589-1-arnd@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value [+ + +]
Author: Yun Lu <luyun@kylinos.cn>
Date:   Fri May 12 09:20:55 2023 +0800

    wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value
    
    [ Upstream commit 20429444e653ee8242dfbf815c0c37866beb371b ]
    
    When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a
    probability of failure, which shows "authentication with ... timed out".
    Through debugging, it was found that the RCR register has been inexplicably
    modified to an incorrect value, resulting in the nic not being able to
    receive authenticated frames.
    
    To fix this problem, add regrcr in rtl8xxxu_priv struct, and store
    the RCR value every time the register is written, and use it the next
    time the register need to be modified.
    
    Signed-off-by: Yun Lu <luyun@kylinos.cn>
    Link: https://lore.kernel.org/all/20230427020512.1221062-1-luyun_611@163.com
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20230512012055.2990472-1-luyun_611@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/boot: Wrap literal addresses in absolute_pointer() [+ + +]
Author: Kees Cook <keescook@chromium.org>
Date:   Sun Feb 27 11:59:18 2022 -0800

    x86/boot: Wrap literal addresses in absolute_pointer()
    
    commit aeb84412037b89e06f45e382f044da6f200e12f8 upstream.
    
    GCC 11 (incorrectly[1]) assumes that literal values cast to (void *)
    should be treated like a NULL pointer with an offset, and raises
    diagnostics when doing bounds checking under -Warray-bounds. GCC 12
    got "smarter" about finding these:
    
      In function 'rdfs8',
          inlined from 'vga_recalc_vertical' at /srv/code/arch/x86/boot/video-mode.c:124:29,
          inlined from 'set_mode' at /srv/code/arch/x86/boot/video-mode.c:163:3:
      /srv/code/arch/x86/boot/boot.h:114:9: warning: array subscript 0 is outside array bounds of 'u8[0]' {aka 'unsigned char[]'} [-Warray-bounds]
        114 |         asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr));
            |         ^~~
    
    This has been solved in other places[2] already by using the recently
    added absolute_pointer() macro. Do the same here.
    
      [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
      [2] https://lore.kernel.org/all/20210912160149.2227137-1-linux@roeck-us.net/
    
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20220227195918.705219-1-keescook@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xfrm: Check if_id in inbound policy/secpath match [+ + +]
Author: Benedict Wong <benedictwong@google.com>
Date:   Wed May 10 01:14:14 2023 +0000

    xfrm: Check if_id in inbound policy/secpath match
    
    [ Upstream commit 8680407b6f8f5fba59e8f1d63c869abc280f04df ]
    
    This change ensures that if configured in the policy, the if_id set in
    the policy and secpath states match during the inbound policy check.
    Without this, there is potential for ambiguity where entries in the
    secpath differing by only the if_id could be mismatched.
    
    Notably, this is checked in the outbound direction when resolving
    templates to SAs, but not on the inbound path when matching SAs and
    policies.
    
    Test: Tested against Android kernel unit tests & CTS
    Signed-off-by: Benedict Wong <benedictwong@google.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>