Linux 4.19.260

 
ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop [+ + +]
Author: Callum Osmotherly <callum.osmotherly@gmail.com>
Date:   Thu Sep 15 22:36:08 2022 +0930

    ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop
    
    commit 1885ff13d4c42910b37a0e3f7c2f182520f4eed1 upstream.
    
    Just as with the 5570 (and the other Dell laptops), this enables the two
    subwoofer speakers on the Dell Precision 5530 together with the main
    ones, significantly increasing the audio quality. I've tested this
    myself on a 5530 and can confirm it's working as expected.
    
    Signed-off-by: Callum Osmotherly <callum.osmotherly@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/YyMjQO3mhyXlMbCf@piranha
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/sigmatel: Fix unused variable warning for beep power change [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Sep 5 15:06:30 2022 +0200

    ALSA: hda/sigmatel: Fix unused variable warning for beep power change
    
    commit 51bdc8bb82525cd70feb92279c8b7660ad7948dd upstream.
    
    The newly added stac_check_power_status() caused a compile warning
    when CONFIG_SND_HDA_INPUT_BEEP is disabled.  Fix it.
    
    Fixes: 414d38ba8710 ("ALSA: hda/sigmatel: Keep power up while beep is enabled")
    Reported-by: kernel test robot <lkp@intel.com>
    Link: https://lore.kernel.org/r/20220905130630.2845-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/sigmatel: Keep power up while beep is enabled [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Sun Sep 4 09:27:50 2022 +0200

    ALSA: hda/sigmatel: Keep power up while beep is enabled
    
    [ Upstream commit 414d38ba871092aeac4ed097ac4ced89486646f7 ]
    
    It seems that the beep playback doesn't work well on IDT codec devices
    when the codec auto-pm is enabled.  Keep the power on while the beep
    switch is enabled.
    
    Link: https://bugzilla.suse.com/show_bug.cgi?id=1200544
    Link: https://lore.kernel.org/r/20220904072750.26164-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: hda/tegra: set depop delay for tegra [+ + +]
Author: Mohan Kumar <mkumard@nvidia.com>
Date:   Tue Sep 13 11:06:41 2022 +0530

    ALSA: hda/tegra: set depop delay for tegra
    
    commit 3c4d8c24fb6c44f426e447b04800b0ed61a7b5ae upstream.
    
    Reduce the suspend time by setting depop delay to 10ms for
    tegra.
    
    Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220913053641.23299-1-mkumard@nvidia.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda: add Intel 5 Series / 3400 PCI DID [+ + +]
Author: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Date:   Mon Sep 12 21:37:16 2022 +0300

    ALSA: hda: add Intel 5 Series / 3400 PCI DID
    
    commit 4d40ceef4745536289012670103c59264e0fb3ec upstream.
    
    Handle 0x3b57 variant with same AZX_DCAPS_INTEL_PCH_NOPM
    capabilities as 0x3b56. In practise this allow use of HDMI/DP
    display audio via i915.
    
    BugLink: https://gitlab.freedesktop.org/drm/intel/-/issues/2751
    Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220912183716.2126312-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64: dts: rockchip: Remove 'enable-active-low' from rk3399-puma [+ + +]
Author: Fabio Estevam <festevam@denx.de>
Date:   Sat Aug 27 14:51:39 2022 -0300

    arm64: dts: rockchip: Remove 'enable-active-low' from rk3399-puma
    
    [ Upstream commit a994b34b9abb9c08ee09e835b4027ff2147f9d94 ]
    
    The 'enable-active-low' property is not a valid one.
    
    Only 'enable-active-high' is valid, and when this property is absent
    the gpio regulator will act as active low by default.
    
    Remove the invalid 'enable-active-low' property.
    
    Fixes: 2c66fc34e945 ("arm64: dts: rockchip: add RK3399-Q7 (Puma) SoM")
    Signed-off-by: Fabio Estevam <festevam@denx.de>
    Link: https://lore.kernel.org/r/20220827175140.1696699-1-festevam@denx.de
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz [+ + +]
Author: zain wang <wzz@rock-chips.com>
Date:   Tue Aug 30 13:16:17 2022 -0700

    arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz
    
    [ Upstream commit 8123437cf46ea5a0f6ca5cb3c528d8b6db97b9c2 ]
    
    We've found the AUX channel to be less reliable with PCLK_EDP at a
    higher rate (typically 25 MHz). This is especially important on systems
    with PSR-enabled panels (like Gru-Kevin), since we make heavy, constant
    use of AUX.
    
    According to Rockchip, using any rate other than 24 MHz can cause
    "problems between syncing the PHY an PCLK", which leads to all sorts of
    unreliabilities around register operations.
    
    Fixes: d67a38c5a623 ("arm64: dts: rockchip: move core edp from rk3399-kevin to shared chromebook")
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: zain wang <wzz@rock-chips.com>
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Link: https://lore.kernel.org/r/20220830131212.v2.1.I98d30623f13b785ca77094d0c0fd4339550553b6@changeid
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: nau8824: Fix semaphore unbalance at error paths [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Aug 23 10:09:57 2022 +0200

    ASoC: nau8824: Fix semaphore unbalance at error paths
    
    [ Upstream commit 5628560e90395d3812800a8e44a01c32ffa429ec ]
    
    The semaphore of nau8824 wasn't properly unlocked at some error
    handling code paths, hence this may result in the unbalance (and
    potential lock-up).  Fix them to handle the semaphore up properly.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://lore.kernel.org/r/20220823081000.2965-3-tiwai@suse.de
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
can: gs_usb: gs_can_open(): fix race dev->can.state condition [+ + +]
Author: Marc Kleine-Budde <mkl@pengutronix.de>
Date:   Tue Sep 20 11:40:56 2022 +0200

    can: gs_usb: gs_can_open(): fix race dev->can.state condition
    
    [ Upstream commit 5440428b3da65408dba0241985acb7a05258b85e ]
    
    The dev->can.state is set to CAN_STATE_ERROR_ACTIVE, after the device
    has been started. On busy networks the CAN controller might receive
    CAN frame between and go into an error state before the dev->can.state
    is assigned.
    
    Assign dev->can.state before starting the controller to close the race
    window.
    
    Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
    Link: https://lore.kernel.org/all/20220920195216.232481-1-mkl@pengutronix.de
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
cifs: don't send down the destination address to sendmsg for a SOCK_STREAM [+ + +]
Author: Stefan Metzmacher <metze@samba.org>
Date:   Wed Sep 14 05:25:46 2022 +0200

    cifs: don't send down the destination address to sendmsg for a SOCK_STREAM
    
    commit 17d3df38dc5f4cec9b0ac6eb79c1859b6e2693a4 upstream.
    
    This is ignored anyway by the tcp layer.
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Cc: stable@vger.kernel.org
    Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region [+ + +]
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
Date:   Sat Aug 27 15:03:45 2022 +0200

    Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region
    
    [ Upstream commit f0880e2cb7e1f8039a048fdd01ce45ab77247221 ]
    
    Passed through PCI device sometimes misbehave on Gen1 VMs when Hyper-V
    DRM driver is also loaded. Looking at IOMEM assignment, we can see e.g.
    
    $ cat /proc/iomem
    ...
    f8000000-fffbffff : PCI Bus 0000:00
      f8000000-fbffffff : 0000:00:08.0
        f8000000-f8001fff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
    ...
    fe0000000-fffffffff : PCI Bus 0000:00
      fe0000000-fe07fffff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
        fe0000000-fe07fffff : 2ba2:00:02.0
          fe0000000-fe07fffff : mlx4_core
    
    the interesting part is the 'f8000000' region as it is actually the
    VM's framebuffer:
    
    $ lspci -v
    ...
    0000:00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller])
            Flags: bus master, fast devsel, latency 0, IRQ 11
            Memory at f8000000 (32-bit, non-prefetchable) [size=64M]
    ...
    
     hv_vmbus: registering driver hyperv_drm
     hyperv_drm 5620e0c7-8062-4dce-aeb7-520c7ef76171: [drm] Synthvid Version major 3, minor 5
     hyperv_drm 0000:00:08.0: vgaarb: deactivate vga console
     hyperv_drm 0000:00:08.0: BAR 0: can't reserve [mem 0xf8000000-0xfbffffff]
     hyperv_drm 5620e0c7-8062-4dce-aeb7-520c7ef76171: [drm] Cannot request framebuffer, boot fb still active?
    
    Note: "Cannot request framebuffer" is not a fatal error in
    hyperv_setup_gen1() as the code assumes there's some other framebuffer
    device there but we actually have some other PCI device (mlx4 in this
    case) config space there!
    
    The problem appears to be that vmbus_allocate_mmio() can use dedicated
    framebuffer region to serve any MMIO request from any device. The
    semantics one might assume of a parameter named "fb_overlap_ok"
    aren't implemented because !fb_overlap_ok essentially has no effect.
    The existing semantics are really "prefer_fb_overlap". This patch
    implements the expected and needed semantics, which is to not allocate
    from the frame buffer space when !fb_overlap_ok.
    
    Note, Gen2 VMs are usually unaffected by the issue because
    framebuffer region is already taken by EFI fb (in case kernel supports
    it) but Gen1 VMs may have this region unclaimed by the time Hyper-V PCI
    pass-through driver tries allocating MMIO space if Hyper-V DRM/FB drivers
    load after it. Devices can be brought up in any sequence so let's
    resolve the issue by always ignoring 'fb_mmio' region for non-FB
    requests, even if the region is unclaimed.
    
    Reviewed-by: Michael Kelley <mikelley@microsoft.com>
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Link: https://lore.kernel.org/r/20220827130345.1320254-4-vkuznets@redhat.com
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: Limit user regamma to a valid value [+ + +]
Author: Yao Wang1 <Yao.Wang1@amd.com>
Date:   Mon Aug 22 18:30:31 2022 +0800

    drm/amd/display: Limit user regamma to a valid value
    
    [ Upstream commit 3601d620f22e37740cf73f8278eabf9f2aa19eb7 ]
    
    [Why]
    For HDR mode, we get total 512 tf_point and after switching to SDR mode
    we actually get 400 tf_point and the rest of points(401~512) still use
    dirty value from HDR mode. We should limit the rest of the points to max
    value.
    
    [How]
    Limit the value when coordinates_x.x > 1, just like what we do in
    translate_from_linear_space for other re-gamma build paths.
    
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
    Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
    Acked-by: Pavle Kotarac <Pavle.Kotarac@amd.com>
    Signed-off-by: Yao Wang1 <Yao.Wang1@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/meson: Correct OSD1 global alpha value [+ + +]
Author: Stuart Menefy <stuart.menefy@mathembedded.com>
Date:   Thu Sep 8 16:51:03 2022 +0100

    drm/meson: Correct OSD1 global alpha value
    
    [ Upstream commit 6836829c8ea453c9e3e518e61539e35881c8ed5f ]
    
    VIU_OSD1_CTRL_STAT.GLOBAL_ALPHA is a 9 bit field, so the maximum
    value is 0x100 not 0xff.
    
    This matches the vendor kernel.
    
    Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
    Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
    Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220908155103.686904-1-stuart.menefy@mathembedded.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/rockchip: Fix return type of cdn_dp_connector_mode_valid [+ + +]
Author: Nathan Huckleberry <nhuck@google.com>
Date:   Tue Sep 13 13:55:55 2022 -0700

    drm/rockchip: Fix return type of cdn_dp_connector_mode_valid
    
    [ Upstream commit b0b9408f132623dc88e78adb5282f74e4b64bb57 ]
    
    The mode_valid field in drm_connector_helper_funcs is expected to be of
    type:
    enum drm_mode_status (* mode_valid) (struct drm_connector *connector,
                                         struct drm_display_mode *mode);
    
    The mismatched return type breaks forward edge kCFI since the underlying
    function definition does not match the function hook definition.
    
    The return type of cdn_dp_connector_mode_valid should be changed from
    int to enum drm_mode_status.
    
    Reported-by: Dan Carpenter <error27@gmail.com>
    Link: https://github.com/ClangBuiltLinux/linux/issues/1703
    Cc: llvm@lists.linux.dev
    Signed-off-by: Nathan Huckleberry <nhuck@google.com>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220913205555.155149-1-nhuck@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
efi: libstub: check Shim mode using MokSBStateRT [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Tue Sep 20 17:08:23 2022 +0200

    efi: libstub: check Shim mode using MokSBStateRT
    
    commit 5f56a74cc0a6d9b9f8ba89cea29cd7c4774cb2b1 upstream.
    
    We currently check the MokSBState variable to decide whether we should
    treat UEFI secure boot as being disabled, even if the firmware thinks
    otherwise. This is used by shim to indicate that it is not checking
    signatures on boot images. In the kernel, we use this to relax lockdown
    policies.
    
    However, in cases where shim is not even being used, we don't want this
    variable to interfere with lockdown, given that the variable may be
    non-volatile and therefore persist across a reboot. This means setting
    it once will persistently disable lockdown checks on a given system.
    
    So switch to the mirrored version of this variable, called MokSBStateRT,
    which is supposed to be volatile, and this is something we can check.
    
    Cc: <stable@vger.kernel.org> # v4.19+
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
    Reviewed-by: Peter Jones <pjones@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ext4: make directory inode spreading reflect flexbg size [+ + +]
Author: Jan Kara <jack@suse.cz>
Date:   Thu Sep 8 11:21:26 2022 +0200

    ext4: make directory inode spreading reflect flexbg size
    
    commit 613c5a85898d1cd44e68f28d65eccf64a8ace9cf upstream.
    
    Currently the Orlov inode allocator searches for free inodes for a
    directory only in flex block groups with at most inodes_per_group/16
    more directory inodes than average per flex block group. However with
    growing size of flex block group this becomes unnecessarily strict.
    Scale allowed difference from average directory count per flex block
    group with flex block group size as we do with other metrics.
    
    Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
    Tested-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/all/0d81a7c2-46b7-6010-62a4-3e6cfc1628d6@i2se.com/
    Signed-off-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20220908092136.11770-3-jack@suse.cz
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx [+ + +]
Author: Pali Rohár <pali@kernel.org>
Date:   Tue Sep 6 12:54:31 2022 +0200

    gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx
    
    [ Upstream commit 279c12df8d2efb28def9d037f288cbfb97c30fe2 ]
    
    Commit e39d5ef67804 ("powerpc/5xxx: extend mpc8xxx_gpio driver to support
    mpc512x gpios") implemented support for IRQ_TYPE_LEVEL_LOW flow type in
    mpc512x via falling edge type. Do same for mpc85xx which support was added
    in commit 345e5c8a1cc3 ("powerpc: Add interrupt support to mpc8xxx_gpio").
    
    Fixes probing of lm90 hwmon driver on mpc85xx based board which use level
    interrupt. Without it kernel prints error and refuse lm90 to work:
    
        [   15.258370] genirq: Setting trigger mode 8 for irq 49 failed (mpc8xxx_irq_set_type+0x0/0xf8)
        [   15.267168] lm90 0-004c: cannot request IRQ 49
        [   15.272708] lm90: probe of 0-004c failed with error -22
    
    Fixes: 345e5c8a1cc3 ("powerpc: Add interrupt support to mpc8xxx_gpio")
    Signed-off-by: Pali Rohár <pali@kernel.org>
    Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
i40e: Fix set max_tx_rate when it is lower than 1 Mbps [+ + +]
Author: Michal Jaron <michalx.jaron@intel.com>
Date:   Thu Sep 1 09:49:33 2022 +0200

    i40e: Fix set max_tx_rate when it is lower than 1 Mbps
    
    [ Upstream commit 198eb7e1b81d8ba676d0f4f120c092032ae69a8e ]
    
    While converting max_tx_rate from bytes to Mbps, this value was set to 0,
    if the original value was lower than 125000 bytes (1 Mbps). This would
    cause no transmission rate limiting to occur. This happened due to lack of
    check of max_tx_rate against the 1 Mbps value for max_tx_rate and the
    following division by 125000. Fix this issue by adding a helper
    i40e_bw_bytes_to_mbits() which sets max_tx_rate to minimum usable value of
    50 Mbps, if its value is less than 1 Mbps, otherwise do the required
    conversion by dividing by 125000.
    
    Fixes: 5ecae4120a6b ("i40e: Refactor VF BW rate limiting")
    Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
    Signed-off-by: Andrii Staikov <andrii.staikov@intel.com>
    Tested-by: Bharathi Sreenivas <bharathi.sreenivas@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

i40e: Fix VF set max MTU size [+ + +]
Author: Michal Jaron <michalx.jaron@intel.com>
Date:   Tue Sep 13 15:38:36 2022 +0200

    i40e: Fix VF set max MTU size
    
    [ Upstream commit 372539def2824c43b6afe2403045b140f65c5acc ]
    
    Max MTU sent to VF is set to 0 during memory allocation. It cause
    that max MTU on VF is changed to IAVF_MAX_RXBUFFER and does not
    depend on data from HW.
    
    Set max_mtu field in virtchnl_vf_resource struct to inform
    VF in GET_VF_RESOURCES msg what size should be max frame.
    
    Fixes: dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum frame size for Rx")
    Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iavf: Fix cached head and tail value for iavf_get_tx_pending [+ + +]
Author: Brett Creeley <brett.creeley@intel.com>
Date:   Thu Sep 1 16:34:40 2022 +0200

    iavf: Fix cached head and tail value for iavf_get_tx_pending
    
    [ Upstream commit 809f23c0423a43266e47a7dc67e95b5cb4d1cbfc ]
    
    The underlying hardware may or may not allow reading of the head or tail
    registers and it really makes no difference if we use the software
    cached values. So, always used the software cached values.
    
    Fixes: 9c6c12595b73 ("i40e: Detection and recovery of TX queue hung logic moved to service_task from tx_timeout")
    Signed-off-by: Brett Creeley <brett.creeley@intel.com>
    Co-developed-by: Norbert Zulinski <norbertx.zulinski@intel.com>
    Signed-off-by: Norbert Zulinski <norbertx.zulinski@intel.com>
    Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header [+ + +]
Author: Lu Wei <luwei32@huawei.com>
Date:   Wed Sep 7 18:12:04 2022 +0800

    ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header
    
    [ Upstream commit 81225b2ea161af48e093f58e8dfee6d705b16af4 ]
    
    If an AF_PACKET socket is used to send packets through ipvlan and the
    default xmit function of the AF_PACKET socket is changed from
    dev_queue_xmit() to packet_direct_xmit() via setsockopt() with the option
    name of PACKET_QDISC_BYPASS, the skb->mac_header may not be reset and
    remains as the initial value of 65535, this may trigger slab-out-of-bounds
    bugs as following:
    
    =================================================================
    UG: KASAN: slab-out-of-bounds in ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan]
    PU: 2 PID: 1768 Comm: raw_send Kdump: loaded Not tainted 6.0.0-rc4+ #6
    ardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33
    all Trace:
    print_address_description.constprop.0+0x1d/0x160
    print_report.cold+0x4f/0x112
    kasan_report+0xa3/0x130
    ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan]
    ipvlan_start_xmit+0x29/0xa0 [ipvlan]
    __dev_direct_xmit+0x2e2/0x380
    packet_direct_xmit+0x22/0x60
    packet_snd+0x7c9/0xc40
    sock_sendmsg+0x9a/0xa0
    __sys_sendto+0x18a/0x230
    __x64_sys_sendto+0x74/0x90
    do_syscall_64+0x3b/0x90
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    The root cause is:
      1. packet_snd() only reset skb->mac_header when sock->type is SOCK_RAW
         and skb->protocol is not specified as in packet_parse_headers()
    
      2. packet_direct_xmit() doesn't reset skb->mac_header as dev_queue_xmit()
    
    In this case, skb->mac_header is 65535 when ipvlan_xmit_mode_l2() is
    called. So when ipvlan_xmit_mode_l2() gets mac header with eth_hdr() which
    use "skb->head + skb->mac_header", out-of-bound access occurs.
    
    This patch replaces eth_hdr() with skb_eth_hdr() in ipvlan_xmit_mode_l2()
    and reset mac header in multicast to solve this out-of-bound bug.
    
    Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
    Signed-off-by: Lu Wei <luwei32@huawei.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Linux 4.19.260 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Sep 28 11:02:58 2022 +0200

    Linux 4.19.260
    
    Link: https://lore.kernel.org/r/20220926100741.430882406@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20220926163538.084331103@linuxfoundation.org
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko [+ + +]
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Sat Sep 17 16:25:40 2022 -0700

    MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko
    
    [ Upstream commit 502550123bee6a2ffa438409b5b9aad4d6db3a8c ]
    
    The lantiq WDT driver uses clk_get_io(), which is not exported,
    so export it to fix a build error:
    
    ERROR: modpost: "clk_get_io" [drivers/watchdog/lantiq_wdt.ko] undefined!
    
    Fixes: 287e3f3f4e68 ("MIPS: lantiq: implement support for clkdev api")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Reported-by: kernel test robot <lkp@intel.com>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: John Crispin <john@phrozen.org>
    Cc: linux-mips@vger.kernel.org
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping() [+ + +]
Author: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Date:   Tue Sep 6 11:59:43 2022 +0200

    MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping()
    
    [ Upstream commit ba912afbd611d3a5f22af247721a071ad1d5b9e0 ]
    
    For irq_domain_associate() to work the virq descriptor has to be
    pre-allocated in advance. Otherwise the following happens:
    
    WARNING: CPU: 0 PID: 0 at .../kernel/irq/irqdomain.c:527 irq_domain_associate+0x298/0x2e8
    error: virq128 is not allocated
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.78-... #1
            ...
    Call Trace:
    [<ffffffff801344c4>] show_stack+0x9c/0x130
    [<ffffffff80769550>] dump_stack+0x90/0xd0
    [<ffffffff801576d0>] __warn+0x118/0x130
    [<ffffffff80157734>] warn_slowpath_fmt+0x4c/0x70
    [<ffffffff801b83c0>] irq_domain_associate+0x298/0x2e8
    [<ffffffff80a43bb8>] octeon_irq_init_ciu+0x4c8/0x53c
    [<ffffffff80a76cbc>] of_irq_init+0x1e0/0x388
    [<ffffffff80a452cc>] init_IRQ+0x4c/0xf4
    [<ffffffff80a3cc00>] start_kernel+0x404/0x698
    
    Use irq_alloc_desc_at() to avoid the above problem.
    
    Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mksysmap: Fix the mismatch of 'L0' symbols in System.map [+ + +]
Author: Youling Tang <tangyouling@loongson.cn>
Date:   Thu Sep 1 19:10:59 2022 +0800

    mksysmap: Fix the mismatch of 'L0' symbols in System.map
    
    [ Upstream commit c17a2538704f926ee4d167ba625e09b1040d8439 ]
    
    When System.map was generated, the kernel used mksysmap to filter the
    kernel symbols, we need to filter "L0" symbols in LoongArch architecture.
    
    $ cat System.map | grep L0
    9000000000221540 t L0
    
    The L0 symbol exists in System.map, but not in .tmp_System.map. When
    "cmp -s System.map .tmp_System.map" will show "Inconsistent kallsyms
    data" error message in link-vmlinux.sh script.
    
    Signed-off-by: Youling Tang <tangyouling@loongson.cn>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm/slub: fix to return errno if kmalloc() fails [+ + +]
Author: Chao Yu <chao.yu@oppo.com>
Date:   Wed Aug 31 22:54:54 2022 +0800

    mm/slub: fix to return errno if kmalloc() fails
    
    commit 7e9c323c52b379d261a72dc7bd38120a761a93cd upstream.
    
    In create_unique_id(), kmalloc(, GFP_KERNEL) can fail due to
    out-of-memory, if it fails, return errno correctly rather than
    triggering panic via BUG_ON();
    
    kernel BUG at mm/slub.c:5893!
    Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
    
    Call trace:
     sysfs_slab_add+0x258/0x260 mm/slub.c:5973
     __kmem_cache_create+0x60/0x118 mm/slub.c:4899
     create_cache mm/slab_common.c:229 [inline]
     kmem_cache_create_usercopy+0x19c/0x31c mm/slab_common.c:335
     kmem_cache_create+0x1c/0x28 mm/slab_common.c:390
     f2fs_kmem_cache_create fs/f2fs/f2fs.h:2766 [inline]
     f2fs_init_xattr_caches+0x78/0xb4 fs/f2fs/xattr.c:808
     f2fs_fill_super+0x1050/0x1e0c fs/f2fs/super.c:4149
     mount_bdev+0x1b8/0x210 fs/super.c:1400
     f2fs_mount+0x44/0x58 fs/f2fs/super.c:4512
     legacy_get_tree+0x30/0x74 fs/fs_context.c:610
     vfs_get_tree+0x40/0x140 fs/super.c:1530
     do_new_mount+0x1dc/0x4e4 fs/namespace.c:3040
     path_mount+0x358/0x914 fs/namespace.c:3370
     do_mount fs/namespace.c:3383 [inline]
     __do_sys_mount fs/namespace.c:3591 [inline]
     __se_sys_mount fs/namespace.c:3568 [inline]
     __arm64_sys_mount+0x2f8/0x408 fs/namespace.c:3568
    
    Cc: <stable@kernel.org>
    Fixes: 81819f0fc8285 ("SLUB core")
    Reported-by: syzbot+81684812ea68216e08c5@syzkaller.appspotmail.com
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
    Signed-off-by: Chao Yu <chao.yu@oppo.com>
    Acked-by: David Rientjes <rientjes@google.com>
    Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mvpp2: no need to check return value of debugfs_create functions [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sat Aug 10 12:17:28 2019 +0200

    mvpp2: no need to check return value of debugfs_create functions
    
    [ Upstream commit e6882aa623f6fe0d80fa82ebf3ee78c353bffbe1 ]
    
    When calling debugfs functions, there is no need to ever check the
    return value.  The function can work or not, but the code logic should
    never do something different based on this.
    
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Nathan Huckleberry <nhuck@google.com>
    Cc: netdev@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD [+ + +]
Author: Sean Anderson <seanga2@gmail.com>
Date:   Tue Sep 20 19:50:18 2022 -0400

    net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD
    
    [ Upstream commit 878e2405710aacfeeb19364c300f38b7a9abfe8f ]
    
    There is a separate receive path for small packets (under 256 bytes).
    Instead of allocating a new dma-capable skb to be used for the next packet,
    this path allocates a skb and copies the data into it (reusing the existing
    sbk for the next packet). There are two bytes of junk data at the beginning
    of every packet. I believe these are inserted in order to allow aligned DMA
    and IP headers. We skip over them using skb_reserve. Before copying over
    the data, we must use a barrier to ensure we see the whole packet. The
    current code only synchronizes len bytes, starting from the beginning of
    the packet, including the junk bytes. However, this leaves off the final
    two bytes in the packet. Synchronize the whole packet.
    
    To reproduce this problem, ping a HME with a payload size between 17 and
    214
    
            $ ping -s 17 <hme_address>
    
    which will complain rather loudly about the data mismatch. Small packets
    (below 60 bytes on the wire) do not have this issue. I suspect this is
    related to the padding added to increase the minimum packet size.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Sean Anderson <seanga2@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20220920235018.1675956-1-seanga2@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: team: Unsync device addresses on ndo_stop [+ + +]
Author: Benjamin Poirier <bpoirier@nvidia.com>
Date:   Wed Sep 7 16:56:41 2022 +0900

    net: team: Unsync device addresses on ndo_stop
    
    [ Upstream commit bd60234222b2fd5573526da7bcd422801f271f5f ]
    
    Netdev drivers are expected to call dev_{uc,mc}_sync() in their
    ndo_set_rx_mode method and dev_{uc,mc}_unsync() in their ndo_stop method.
    This is mentioned in the kerneldoc for those dev_* functions.
    
    The team driver calls dev_{uc,mc}_unsync() during ndo_uninit instead of
    ndo_stop. This is ineffective because address lists (dev->{uc,mc}) have
    already been emptied in unregister_netdevice_many() before ndo_uninit is
    called. This mistake can result in addresses being leftover on former team
    ports after a team device has been deleted; see test_LAG_cleanup() in the
    last patch in this series.
    
    Add unsync calls at their expected location, team_close().
    
    v3:
    * When adding or deleting a port, only sync/unsync addresses if the team
      device is up. In other cases, it is taken care of at the right time by
      ndo_open/ndo_set_rx_mode/ndo_stop.
    
    Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
    Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: usb: qmi_wwan: add Quectel RM520N [+ + +]
Author: jerry.meng <jerry-meng@foxmail.com>
Date:   Mon Sep 5 09:24:52 2022 +0800

    net: usb: qmi_wwan: add Quectel RM520N
    
    [ Upstream commit e1091e226a2bab4ded1fe26efba2aee1aab06450 ]
    
    add support for Quectel RM520N which is based on Qualcomm SDX62 chip.
    
    0x0801: DIAG + NMEA + AT + MODEM + RMNET
    
    T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 10 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=0801 Rev= 5.04
    S:  Manufacturer=Quectel
    S:  Product=RM520N-GL
    S:  SerialNumber=384af524
    C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: jerry.meng <jerry-meng@foxmail.com>
    Acked-by: Bjørn Mork <bjorn@mork.no>
    Link: https://lore.kernel.org/r/tencent_E50CA8A206904897C2D20DDAE90731183C05@qq.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netfilter: ebtables: fix memory leak when blob is malformed [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Tue Sep 20 14:20:17 2022 +0200

    netfilter: ebtables: fix memory leak when blob is malformed
    
    [ Upstream commit 62ce44c4fff947eebdf10bb582267e686e6835c9 ]
    
    The bug fix was incomplete, it "replaced" crash with a memory leak.
    The old code had an assignment to "ret" embedded into the conditional,
    restore this.
    
    Fixes: 7997eff82828 ("netfilter: ebtables: reject blobs that don't provide all entry points")
    Reported-and-tested-by: syzbot+a24c5252f3e3ab733464@syzkaller.appspotmail.com
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_conntrack_irc: Tighten matching on DCC message [+ + +]
Author: David Leadbeater <dgl@dgl.cx>
Date:   Fri Aug 26 14:56:57 2022 +1000

    netfilter: nf_conntrack_irc: Tighten matching on DCC message
    
    [ Upstream commit e8d5dfd1d8747b56077d02664a8838c71ced948e ]
    
    CTCP messages should only be at the start of an IRC message, not
    anywhere within it.
    
    While the helper only decodes packes in the ORIGINAL direction, its
    possible to make a client send a CTCP message back by empedding one into
    a PING request.  As-is, thats enough to make the helper believe that it
    saw a CTCP message.
    
    Fixes: 869f37d8e48f ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port")
    Signed-off-by: David Leadbeater <dgl@dgl.cx>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_conntrack_sip: fix ct_sip_walk_headers [+ + +]
Author: Igor Ryzhov <iryzhov@nfware.com>
Date:   Wed Jun 5 12:32:40 2019 +0300

    netfilter: nf_conntrack_sip: fix ct_sip_walk_headers
    
    [ Upstream commit 39aebedeaaa95757f5c1f2ddb5f43fdddbf478ca ]
    
    ct_sip_next_header and ct_sip_get_header return an absolute
    value of matchoff, not a shift from current dataoff.
    So dataoff should be assigned matchoff, not incremented by it.
    
    This issue can be seen in the scenario when there are multiple
    Contact headers and the first one is using a hostname and other headers
    use IP addresses. In this case, ct_sip_walk_headers will work as follows:
    
    The first ct_sip_get_header call to will find the first Contact header
    but will return -1 as the header uses a hostname. But matchoff will
    be changed to the offset of this header. After that, dataoff should be
    set to matchoff, so that the next ct_sip_get_header call find the next
    Contact header. But instead of assigning dataoff to matchoff, it is
    incremented by it, which is not correct, as matchoff is an absolute
    value of the offset. So on the next call to the ct_sip_get_header,
    dataoff will be incorrect, and the next Contact header may not be
    found at all.
    
    Fixes: 05e3ced297fe ("[NETFILTER]: nf_conntrack_sip: introduce SIP-URI parsing helper")
    Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvmet: fix a use-after-free [+ + +]
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Fri Aug 12 14:03:17 2022 -0700

    nvmet: fix a use-after-free
    
    [ Upstream commit 6a02a61e81c231cc5c680c5dbf8665275147ac52 ]
    
    Fix the following use-after-free complaint triggered by blktests nvme/004:
    
    BUG: KASAN: user-memory-access in blk_mq_complete_request_remote+0xac/0x350
    Read of size 4 at addr 0000607bd1835943 by task kworker/13:1/460
    Workqueue: nvmet-wq nvme_loop_execute_work [nvme_loop]
    Call Trace:
     show_stack+0x52/0x58
     dump_stack_lvl+0x49/0x5e
     print_report.cold+0x36/0x1e2
     kasan_report+0xb9/0xf0
     __asan_load4+0x6b/0x80
     blk_mq_complete_request_remote+0xac/0x350
     nvme_loop_queue_response+0x1df/0x275 [nvme_loop]
     __nvmet_req_complete+0x132/0x4f0 [nvmet]
     nvmet_req_complete+0x15/0x40 [nvmet]
     nvmet_execute_io_connect+0x18a/0x1f0 [nvmet]
     nvme_loop_execute_work+0x20/0x30 [nvme_loop]
     process_one_work+0x56e/0xa70
     worker_thread+0x2d1/0x640
     kthread+0x183/0x1c0
     ret_from_fork+0x1f/0x30
    
    Cc: stable@vger.kernel.org
    Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
of: fdt: fix off-by-one error in unflatten_dt_nodes() [+ + +]
Author: Sergey Shtylyov <s.shtylyov@omp.ru>
Date:   Sat Aug 13 23:34:16 2022 +0300

    of: fdt: fix off-by-one error in unflatten_dt_nodes()
    
    [ Upstream commit 2f945a792f67815abca26fa8a5e863ccf3fa1181 ]
    
    Commit 78c44d910d3e ("drivers/of: Fix depth when unflattening devicetree")
    forgot to fix up the depth check in the loop body in unflatten_dt_nodes()
    which makes it possible to overflow the nps[] buffer...
    
    Found by Linux Verification Center (linuxtesting.org) with the SVACE static
    analysis tool.
    
    Fixes: 78c44d910d3e ("drivers/of: Fix depth when unflattening devicetree")
    Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
    Signed-off-by: Rob Herring <robh@kernel.org>
    Link: https://lore.kernel.org/r/7c354554-006f-6b31-c195-cdfe4caee392@omp.ru
    Signed-off-by: Sasha Levin <sashal@kernel.org>
of: mdio: Add of_node_put() when breaking out of for_each_xx [+ + +]
Author: Liang He <windhl@126.com>
Date:   Tue Sep 13 20:56:59 2022 +0800

    of: mdio: Add of_node_put() when breaking out of for_each_xx
    
    [ Upstream commit 1c48709e6d9d353acaaac1d8e33474756b121d78 ]
    
    In of_mdiobus_register(), we should call of_node_put() for 'child'
    escaped out of for_each_available_child_of_node().
    
    Fixes: 66bdede495c7 ("of_mdio: Fix broken PHY IRQ in case of probe deferral")
    Co-developed-by: Miaoqian Lin <linmq006@gmail.com>
    Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
    Signed-off-by: Liang He <windhl@126.com>
    Link: https://lore.kernel.org/r/20220913125659.3331969-1-windhl@126.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Wed Aug 24 17:36:57 2022 +0800

    parisc: ccio-dma: Add missing iounmap in error path in ccio_probe()
    
    [ Upstream commit 38238be4e881a5d0abbe4872b4cd6ed790be06c8 ]
    
    Add missing iounmap() before return from ccio_probe(), if ccio_init_resources()
    fails.
    
    Fixes: d46c742f827f ("parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources()")
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf jit: Include program header in ELF files [+ + +]
Author: Lieven Hey <lieven.hey@kdab.com>
Date:   Thu Sep 15 11:29:10 2022 +0200

    perf jit: Include program header in ELF files
    
    [ Upstream commit babd04386b1df8c364cdaa39ac0e54349502e1e5 ]
    
    The missing header makes it hard for programs like elfutils to open
    these files.
    
    Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols")
    Reviewed-by: Leo Yan <leo.yan@linaro.org>
    Signed-off-by: Lieven Hey <lieven.hey@kdab.com>
    Tested-by: Leo Yan <leo.yan@linaro.org>
    Cc: Leo Yan <leo.yan@linaro.org>
    Link: https://lore.kernel.org/r/20220915092910.711036-1-lieven.hey@kdab.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf kcore_copy: Do not check /proc/modules is unchanged [+ + +]
Author: Adrian Hunter <adrian.hunter@intel.com>
Date:   Wed Sep 14 15:24:29 2022 +0300

    perf kcore_copy: Do not check /proc/modules is unchanged
    
    [ Upstream commit 5b427df27b94aec1312cace48a746782a0925c53 ]
    
    /proc/kallsyms and /proc/modules are compared before and after the copy
    in order to ensure no changes during the copy.
    
    However /proc/modules also might change due to reference counts changing
    even though that does not make any difference.
    
    Any modules loaded or unloaded should be visible in changes to kallsyms,
    so it is not necessary to check /proc/modules also anyway.
    
    Remove the comparison checking that /proc/modules is unchanged.
    
    Fixes: fc1b691d7651d949 ("perf buildid-cache: Add ability to add kcore to the cache")
    Reported-by: Daniel Dao <dqminh@cloudflare.com>
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Tested-by: Daniel Dao <dqminh@cloudflare.com>
    Acked-by: Namhyung Kim <namhyung@kernel.org>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/r/20220914122429.8770-1-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe() [+ + +]
Author: Xiaolei Wang <xiaolei.wang@windriver.com>
Date:   Thu Aug 25 19:19:22 2022 +0800

    regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe()
    
    [ Upstream commit 78e1e867f44e6bdc72c0e6a2609a3407642fb30b ]
    
    The pfuze_chip::regulator_descs is an array of size
    PFUZE100_MAX_REGULATOR, the pfuze_chip::pfuze_regulators
    is the pointer to the real regulators of a specific device.
    The number of real regulator is supposed to be less than
    the PFUZE100_MAX_REGULATOR, so we should use the size of
    'regulator_num * sizeof(struct pfuze_regulator)' in memcpy().
    This fixes the out of bounds access bug reported by KASAN.
    
    Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
    Link: https://lore.kernel.org/r/20220825111922.1368055-1-xiaolei.wang@windriver.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rxrpc: Fix local destruction being repeated [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Fri May 6 23:55:21 2022 +0100

    rxrpc: Fix local destruction being repeated
    
    [ Upstream commit d3d863036d688313f8d566b87acd7d99daf82749 ]
    
    If the local processor work item for the rxrpc local endpoint gets requeued
    by an event (such as an incoming packet) between it getting scheduled for
    destruction and the UDP socket being closed, the rxrpc_local_destroyer()
    function can get run twice.  The second time it can hang because it can end
    up waiting for cleanup events that will never happen.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup [+ + +]
Author: Stefan Haberland <sth@linux.ibm.com>
Date:   Mon Sep 19 17:49:31 2022 +0200

    s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup
    
    commit db7ba07108a48c0f95b74fabbfd5d63e924f992d upstream.
    
    Fix Oops in dasd_alias_get_start_dev() function caused by the pavgroup
    pointer being NULL.
    
    The pavgroup pointer is checked on the entrance of the function but
    without the lcu->lock being held. Therefore there is a race window
    between dasd_alias_get_start_dev() and _lcu_update() which sets
    pavgroup to NULL with the lcu->lock held.
    
    Fix by checking the pavgroup pointer with lcu->lock held.
    
    Cc: <stable@vger.kernel.org> # 2.6.25+
    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
    Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
    Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
    Link: https://lore.kernel.org/r/20220919154931.4123002-2-sth@linux.ibm.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
serial: Create uart_xmit_advance() [+ + +]
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Thu Sep 1 17:39:32 2022 +0300

    serial: Create uart_xmit_advance()
    
    commit e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d upstream.
    
    A very common pattern in the drivers is to advance xmit tail
    index and do bookkeeping of Tx'ed characters. Create
    uart_xmit_advance() to handle it.
    
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Cc: stable <stable@kernel.org>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20220901143934.8850-2-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting [+ + +]
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Thu Sep 1 17:39:33 2022 +0300

    serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting
    
    commit 754f68044c7dd6c52534ba3e0f664830285c4b15 upstream.
    
    DMA complete & stop paths did not correctly account Tx'ed characters
    into icount.tx. Using uart_xmit_advance() fixes the problem.
    
    Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
    Cc: <stable@vger.kernel.org> # serial: Create uart_xmit_advance()
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20220901143934.8850-3-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: core: Fix RST error in hub.c [+ + +]
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Thu Sep 1 10:36:34 2022 -0400

    USB: core: Fix RST error in hub.c
    
    commit 766a96dc558385be735a370db867e302c8f22153 upstream.
    
    A recent commit added an invalid RST expression to a kerneldoc comment
    in hub.c.  The fix is trivial.
    
    Fixes: 9c6d778800b9 ("USB: core: Prevent nested device-reset calls")
    Cc: <stable@vger.kernel.org>
    Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/YxDDcsLtRZ7c20pq@rowland.harvard.edu
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: dwc3: pci: Add Support for Intel Elkhart Lake Devices [+ + +]
Author: Felipe Balbi <felipe.balbi@linux.intel.com>
Date:   Mon Jun 11 11:21:12 2018 +0300

    usb: dwc3: pci: Add Support for Intel Elkhart Lake Devices
    
    [ Upstream commit dbb0569de852fb4576d6f62078d515f989a181ca ]
    
    This patch simply adds a new PCI Device ID
    
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Stable-dep-of: bad0d1d726ac ("usb: dwc3: pci: Add support for Intel Raptor Lake")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: pci: add support for the Intel Alder Lake-S [+ + +]
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Tue Oct 6 16:02:50 2020 +0300

    usb: dwc3: pci: add support for the Intel Alder Lake-S
    
    [ Upstream commit 1384ab4fee12c4c4f8bd37bc9f8686881587b286 ]
    
    This patch adds the necessary PCI ID for Intel Alder Lake-S
    devices.
    
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Felipe Balbi <balbi@kernel.org>
    Stable-dep-of: bad0d1d726ac ("usb: dwc3: pci: Add support for Intel Raptor Lake")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: pci: add support for the Intel Jasper Lake [+ + +]
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Tue Jun 30 15:24:59 2020 +0300

    usb: dwc3: pci: add support for the Intel Jasper Lake
    
    [ Upstream commit e25d1e8532c3d84f075deca1580a7d61e0f43ce6 ]
    
    This patch adds the necessary PCI ID for Intel Jasper Lake
    devices.
    
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Felipe Balbi <balbi@kernel.org>
    Stable-dep-of: bad0d1d726ac ("usb: dwc3: pci: Add support for Intel Raptor Lake")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: pci: add support for the Intel Tiger Lake PCH -H variant [+ + +]
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Thu Jun 25 10:34:32 2020 +0300

    usb: dwc3: pci: add support for the Intel Tiger Lake PCH -H variant
    
    [ Upstream commit c3f595a8119207cc0f82b3dc6ec5bbf6f3e6b135 ]
    
    This patch adds the necessary PCI ID for TGP-H devices.
    
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Felipe Balbi <balbi@kernel.org>
    Stable-dep-of: bad0d1d726ac ("usb: dwc3: pci: Add support for Intel Raptor Lake")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: pci: add support for TigerLake Devices [+ + +]
Author: Felipe Balbi <felipe.balbi@linux.intel.com>
Date:   Wed Dec 13 16:03:22 2017 +0200

    usb: dwc3: pci: add support for TigerLake Devices
    
    [ Upstream commit b3649dee5fbb0f6585010e6e9313dfcbb075b22b ]
    
    This patch adds the necessary PCI ID for TGP-LP devices.
    
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Stable-dep-of: bad0d1d726ac ("usb: dwc3: pci: Add support for Intel Raptor Lake")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality [+ + +]
Author: Raymond Tan <raymond.tan@intel.com>
Date:   Fri Aug 21 16:11:01 2020 +0300

    usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality
    
    commit a609ce2a13360d639b384b6ca783b38c1247f2db upstream.
    
    Similar to some other IA platforms, Elkhart Lake too depends on the
    PMU register write to request transition of Dx power state.
    
    Thus, we add the PCI_DEVICE_ID_INTEL_EHLLP to the list of devices that
    shall execute the ACPI _DSM method during D0/D3 sequence.
    
    [heikki.krogerus@linux.intel.com: included Fixes tag]
    
    Fixes: dbb0569de852 ("usb: dwc3: pci: Add Support for Intel Elkhart Lake Devices")
    Cc: stable@vger.kernel.org
    Signed-off-by: Raymond Tan <raymond.tan@intel.com>
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Felipe Balbi <balbi@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: serial: option: add Quectel BG95 0x0203 composition [+ + +]
Author: Carl Yin(殷张成) <carl.yin@quectel.com>
Date:   Fri Sep 2 09:49:43 2022 +0000

    USB: serial: option: add Quectel BG95 0x0203 composition
    
    commit f8f67eff6847f9b8d753fa029723bcc54296055a upstream.
    
    Add support for the following Quectel BG95 composition:
    
    0x0203: Diag + GNSS + Modem + ECM
    
    usb-devices output:
    T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=0203 Rev= 0.00
    S:  Manufacturer=Quectel, Incorporated
    S:  Product=Quectel LPWA Module
    S:  SerialNumber=71d3a21b
    C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    A:  FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
    E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
    I:  If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: Carl Yin <carl.yin@quectel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Quectel RM520N [+ + +]
Author: jerry meng <jerry-meng@foxmail.com>
Date:   Mon Sep 5 14:35:33 2022 +0800

    USB: serial: option: add Quectel RM520N
    
    commit d640c4cb8f2f933c0ca896541f9de7fb1ae245f4 upstream.
    
    add support for Quectel RM520N which is based on Qualcomm SDX62 chip.
    
    0x0801: DIAG + NMEA + AT + MODEM + RMNET
    
    T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 10 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=0801 Rev= 5.04
    S:  Manufacturer=Quectel
    S:  Product=RM520N-GL
    S:  SerialNumber=384af524
    C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
    E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Signed-off-by: jerry meng <jerry-meng@foxmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Mon Jun 20 07:17:46 2022 -0700

    video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write
    
    [ Upstream commit a09d2d00af53b43c6f11e6ab3cb58443c2cac8a7 ]
    
    In pxa3xx_gcu_write, a count parameter of type size_t is passed to words of
    type int.  Then, copy_from_user() may cause a heap overflow because it is used
    as the third argument of copy_from_user().
    
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
wifi: mac80211: Fix UAF in ieee80211_scan_rx() [+ + +]
Author: Siddh Raman Pant <code@siddh.me>
Date:   Sat Aug 20 01:33:40 2022 +0530

    wifi: mac80211: Fix UAF in ieee80211_scan_rx()
    
    [ Upstream commit 60deb9f10eec5c6a20252ed36238b55d8b614a2c ]
    
    ieee80211_scan_rx() tries to access scan_req->flags after a
    null check, but a UAF is observed when the scan is completed
    and __ieee80211_scan_completed() executes, which then calls
    cfg80211_scan_done() leading to the freeing of scan_req.
    
    Since scan_req is rcu_dereference()'d, prevent the racing in
    __ieee80211_scan_completed() by ensuring that from mac80211's
    POV it is no longer accessed from an RCU read critical section
    before we call cfg80211_scan_done().
    
    Cc: stable@vger.kernel.org
    Link: https://syzkaller.appspot.com/bug?extid=f9acff9bf08a845f225d
    Reported-by: syzbot+f9acff9bf08a845f225d@syzkaller.appspotmail.com
    Suggested-by: Johannes Berg <johannes@sipsolutions.net>
    Signed-off-by: Siddh Raman Pant <code@siddh.me>
    Link: https://lore.kernel.org/r/20220819200340.34826-1-code@siddh.me
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
workqueue: don't skip lockdep work dependency in cancel_work_sync() [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Fri Jul 29 13:30:23 2022 +0900

    workqueue: don't skip lockdep work dependency in cancel_work_sync()
    
    [ Upstream commit c0feea594e058223973db94c1c32a830c9807c86 ]
    
    Like Hillf Danton mentioned
    
      syzbot should have been able to catch cancel_work_sync() in work context
      by checking lockdep_map in __flush_work() for both flush and cancel.
    
    in [1], being unable to report an obvious deadlock scenario shown below is
    broken. From locking dependency perspective, sync version of cancel request
    should behave as if flush request, for it waits for completion of work if
    that work has already started execution.
    
      ----------
      #include <linux/module.h>
      #include <linux/sched.h>
      static DEFINE_MUTEX(mutex);
      static void work_fn(struct work_struct *work)
      {
        schedule_timeout_uninterruptible(HZ / 5);
        mutex_lock(&mutex);
        mutex_unlock(&mutex);
      }
      static DECLARE_WORK(work, work_fn);
      static int __init test_init(void)
      {
        schedule_work(&work);
        schedule_timeout_uninterruptible(HZ / 10);
        mutex_lock(&mutex);
        cancel_work_sync(&work);
        mutex_unlock(&mutex);
        return -EINVAL;
      }
      module_init(test_init);
      MODULE_LICENSE("GPL");
      ----------
    
    The check this patch restores was added by commit 0976dfc1d0cd80a4
    ("workqueue: Catch more locking problems with flush_work()").
    
    Then, lockdep's crossrelease feature was added by commit b09be676e0ff25bd
    ("locking/lockdep: Implement the 'crossrelease' feature"). As a result,
    this check was once removed by commit fd1a5b04dfb899f8 ("workqueue: Remove
    now redundant lock acquisitions wrt. workqueue flushes").
    
    But lockdep's crossrelease feature was removed by commit e966eaeeb623f099
    ("locking/lockdep: Remove the cross-release locking checks"). At this
    point, this check should have been restored.
    
    Then, commit d6e89786bed977f3 ("workqueue: skip lockdep wq dependency in
    cancel_work_sync()") introduced a boolean flag in order to distinguish
    flush_work() and cancel_work_sync(), for checking "struct workqueue_struct"
    dependency when called from cancel_work_sync() was causing false positives.
    
    Then, commit 87915adc3f0acdf0 ("workqueue: re-add lockdep dependencies for
    flushing") tried to restore "struct work_struct" dependency check, but by
    error checked this boolean flag. Like an example shown above indicates,
    "struct work_struct" dependency needs to be checked for both flush_work()
    and cancel_work_sync().
    
    Link: https://lkml.kernel.org/r/20220504044800.4966-1-hdanton@sina.com [1]
    Reported-by: Hillf Danton <hdanton@sina.com>
    Suggested-by: Lai Jiangshan <jiangshanlai@gmail.com>
    Fixes: 87915adc3f0acdf0 ("workqueue: re-add lockdep dependencies for flushing")
    Cc: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>