Linux 5.4.215

 
afs: Return -EAGAIN, not -EREMOTEIO, when a file already locked [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Tue Sep 6 22:09:11 2022 +0100

    afs: Return -EAGAIN, not -EREMOTEIO, when a file already locked
    
    [ Upstream commit 0066f1b0e27556381402db3ff31f85d2a2265858 ]
    
    When trying to get a file lock on an AFS file, the server may return
    UAEAGAIN to indicate that the lock is already held.  This is currently
    translated by the default path to -EREMOTEIO.
    
    Translate it instead to -EAGAIN so that we know we can retry it.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    Reviewed-by: Jeffrey E Altman <jaltman@auristor.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    Link: https://lore.kernel.org/r/166075761334.3533338.2591992675160918098.stgit@warthog.procyon.org.uk/
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack [+ + +]
Author: Luke D. Jones <luke@ljones.dev>
Date:   Thu Sep 15 20:09:19 2022 +1200

    ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack
    
    commit c611e659044168e7abcbae8ba1ea833521498fbb upstream.
    
    Fixes up the pincfg for ASUS ROG Strix G513 headphone and mic combo jack
    
    [ Fixed the position in the quirk table by tiwai ]
    
    Signed-off-by: Luke D. Jones <luke@ljones.dev>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220915080921.35563-2-luke@ljones.dev
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack [+ + +]
Author: Luke D. Jones <luke@ljones.dev>
Date:   Thu Sep 15 20:09:20 2022 +1200

    ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack
    
    commit bc2c23549ccd7105eb6ff0d4f0ac519285628673 upstream.
    
    Fixes up the pincfg for ASUS ROG Strix G15 (G533Z) headphone combo jack
    
    [ Fixed the position in the quirk table by tiwai ]
    
    Signed-off-by: Luke D. Jones <luke@ljones.dev>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220915080921.35563-3-luke@ljones.dev
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Add quirk for ASUS GA503R laptop [+ + +]
Author: Luke D. Jones <luke@ljones.dev>
Date:   Thu Sep 15 20:09:21 2022 +1200

    ALSA: hda/realtek: Add quirk for ASUS GA503R laptop
    
    commit ba1f818053b0668a1ce2fe86b840e81b592cc560 upstream.
    
    The ASUS G15 2022 (GA503R) series laptop has the same node-to-DAC pairs
    as early models and the G14, this includes bass speakers which are by
    default mapped incorrectly to the 0x06 node.
    
    Add a quirk to use the same DAC pairs as the G14.
    
    Signed-off-by: Luke D. Jones <luke@ljones.dev>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220915080921.35563-4-luke@ljones.dev
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Add quirk for Huawei WRT-WX9 [+ + +]
Author: huangwenhui <huangwenhuia@uniontech.com>
Date:   Tue Sep 13 13:46:22 2022 +0800

    ALSA: hda/realtek: Add quirk for Huawei WRT-WX9
    
    commit cbcdf8c4d35cd74aee8581eb2f0453e0ecab7b05 upstream.
    
    Fixes headphone and headset microphone detection on Huawei WRT-WX9.
    
    Signed-off-by: huangwenhui <huangwenhuia@uniontech.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220913054622.15979-1-huangwenhuia@uniontech.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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/realtek: Re-arrange quirk table entries [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Sep 15 17:47:24 2022 +0200

    ALSA: hda/realtek: Re-arrange quirk table entries
    
    commit b16c8f229a58eaddfc58aab447253464abd3c85e upstream.
    
    A few entries have been mistakenly inserted in wrong positions without
    considering the SSID ordering.  Place them at right positions.
    
    Fixes: b7557267c233 ("ALSA: hda/realtek: Add quirk for ASUS GA402")
    Fixes: 94db9cc8f8fa ("ALSA: hda/realtek: Add quirk for ASUS GU603")
    Fixes: 739d0959fbed ("ALSA: hda: Add quirk for ASUS Flow x13")
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20220915154724.31634-1-tiwai@suse.de
    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: Align BDL entry to 4KB boundary [+ + +]
Author: Mohan Kumar <mkumard@nvidia.com>
Date:   Mon Sep 5 22:54:20 2022 +0530

    ALSA: hda/tegra: Align BDL entry to 4KB boundary
    
    [ Upstream commit 8d44e6044a0e885acdd01813768a0b27906d64fd ]
    
    AZA HW may send a burst read/write request crossing 4K memory boundary.
    The 4KB boundary is not guaranteed by Tegra HDA HW. Make SW change to
    include the flag AZX_DCAPS_4K_BDLE_BOUNDARY to align BDLE to 4K
    boundary.
    
    Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
    Link: https://lore.kernel.org/r/20220905172420.3801-1-mkumard@nvidia.com
    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>

ALSA: pcm: oss: Fix race at SNDCTL_DSP_SYNC [+ + +]
Author: Sasha Levin <sashal@kernel.org>
Date:   Mon Sep 19 08:07:54 2022 -0400

    ALSA: pcm: oss: Fix race at SNDCTL_DSP_SYNC
    
    [ Upstream commit 8423f0b6d513b259fdab9c9bf4aaa6188d054c2d ]
    
    There is a small race window at snd_pcm_oss_sync() that is called from
    OSS PCM SNDCTL_DSP_SYNC ioctl; namely the function calls
    snd_pcm_oss_make_ready() at first, then takes the params_lock mutex
    for the rest.  When the stream is set up again by another thread
    between them, it leads to inconsistency, and may result in unexpected
    results such as NULL dereference of OSS buffer as a fuzzer spotted
    recently.
    
    The fix is simply to cover snd_pcm_oss_make_ready() call into the same
    params_lock mutex with snd_pcm_oss_make_ready_locked() variant.
    
    Reported-and-tested-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
    Reviewed-by: Jaroslav Kysela <perex@perex.cz>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/CAFcO6XN7JDM4xSXGhtusQfS2mSBcx50VJKwQpCq=WeLt57aaZA@mail.gmail.com
    Link: https://lore.kernel.org/r/20220905060714.22549-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
arm64: dts: rockchip: Pull up wlan wake# on Gru-Bob [+ + +]
Author: Brian Norris <briannorris@chromium.org>
Date:   Mon Aug 22 16:45:04 2022 -0700

    arm64: dts: rockchip: Pull up wlan wake# on Gru-Bob
    
    [ Upstream commit e5467359a725de90b6b8d0dd865500f6373828ca ]
    
    The Gru-Bob board does not have a pull-up resistor on its
    WLAN_HOST_WAKE# pin, but Kevin does. The production/vendor kernel
    specified the pin configuration correctly as a pull-up, but this didn't
    get ported correctly to upstream.
    
    This means Bob's WLAN_HOST_WAKE# pin is floating, causing inconsistent
    wakeup behavior.
    
    Note that bt_host_wake_l has a similar dynamic, but apparently the
    upstream choice was to redundantly configure both internal and external
    pull-up on Kevin (see the "Kevin has an external pull up" comment in
    rk3399-gru.dtsi). This doesn't cause any functional problem, although
    it's perhaps wasteful.
    
    Fixes: 8559bbeeb849 ("arm64: dts: rockchip: add Google Bob")
    Signed-off-by: Brian Norris <briannorris@chromium.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20220822164453.1.I75c57b48b0873766ec993bdfb7bc1e63da5a1637@changeid
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Sasha Levin <sashal@kernel.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>

 
cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all() [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Thu Aug 25 17:38:38 2022 +0900

    cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all()
    
    commit 43626dade36fa74d3329046f4ae2d7fdefe401c6 upstream.
    
    syzbot is hitting percpu_rwsem_assert_held(&cpu_hotplug_lock) warning at
    cpuset_attach() [1], for commit 4f7e7236435ca0ab ("cgroup: Fix
    threadgroup_rwsem <-> cpus_read_lock() deadlock") missed that
    cpuset_attach() is also called from cgroup_attach_task_all().
    Add cpus_read_lock() like what cgroup_procs_write_start() does.
    
    Link: https://syzkaller.appspot.com/bug?extid=29d3a3b4d86c8136ad9e [1]
    Reported-by: syzbot <syzbot+29d3a3b4d86c8136ad9e@syzkaller.appspotmail.com>
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Fixes: 4f7e7236435ca0ab ("cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock")
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cifs: always initialize struct msghdr smb_msg completely [+ + +]
Author: Stefan Metzmacher <metze@samba.org>
Date:   Wed Sep 14 05:25:47 2022 +0200

    cifs: always initialize struct msghdr smb_msg completely
    
    [ Upstream commit bedc8f76b3539ac4f952114b316bcc2251e808ce ]
    
    So far we were just lucky because the uninitialized members
    of struct msghdr are not used by default on a SOCK_STREAM tcp
    socket.
    
    But as new things like msg_ubuf and sg_from_iter where added
    recently, we should play on the safe side and avoid potention
    problems in future.
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Cc: stable@vger.kernel.org
    Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    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>

cifs: revalidate mapping when doing direct writes [+ + +]
Author: Ronnie Sahlberg <lsahlber@redhat.com>
Date:   Mon Sep 12 13:04:46 2022 +1000

    cifs: revalidate mapping when doing direct writes
    
    commit 7500a99281dfed2d4a84771c933bcb9e17af279b upstream.
    
    Kernel bugzilla: 216301
    
    When doing direct writes we need to also invalidate the mapping in case
    we have a cached copy of the affected page(s) in memory or else
    subsequent reads of the data might return the old/stale content
    before we wrote an update to the server.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
    Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
    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/amdgpu: use dirty framebuffer helper [+ + +]
Author: Hamza Mahfooz <hamza.mahfooz@amd.com>
Date:   Tue Sep 6 15:01:49 2022 -0400

    drm/amdgpu: use dirty framebuffer helper
    
    [ Upstream commit 66f99628eb24409cb8feb5061f78283c8b65f820 ]
    
    Currently, we aren't handling DRM_IOCTL_MODE_DIRTYFB. So, use
    drm_atomic_helper_dirtyfb() as the dirty callback in the amdgpu_fb_funcs
    struct.
    
    Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@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/meson: Fix OSD1 RGB to YCbCr coefficient [+ + +]
Author: Stuart Menefy <stuart.menefy@mathembedded.com>
Date:   Thu Sep 8 16:52:43 2022 +0100

    drm/meson: Fix OSD1 RGB to YCbCr coefficient
    
    [ Upstream commit 6463d3930ba5b6addcfc8f80a4543976a2fc7656 ]
    
    VPP_WRAP_OSD1_MATRIX_COEF22.Coeff22 is documented as being bits 0-12,
    not 16-28.
    
    Without this the output tends to have a pink hue, changing it results
    in better color accuracy.
    
    The vendor kernel doesn't use this register. However the code which
    sets VIU2_OSD1_MATRIX_COEF22 also uses bits 0-12. There is a slightly
    different style of registers for configuring some of the other matrices,
    which do use bits 16-28 for this coefficient, but those have names
    ending in MATRIX_COEF22_30, and this is not one of those.
    
    Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
    Fixes: 728883948b0d ("drm/meson: Add G12A Support for VIU setup")
    Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220908155243.687143-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: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 [+ + +]
Author: Luís Henriques <lhenriques@suse.de>
Date:   Mon Aug 22 10:42:35 2022 +0100

    ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0
    
    commit 29a5b8a137ac8eb410cc823653a29ac0e7b7e1b0 upstream.
    
    When walking through an inode extents, the ext4_ext_binsearch_idx() function
    assumes that the extent header has been previously validated.  However, there
    are no checks that verify that the number of entries (eh->eh_entries) is
    non-zero when depth is > 0.  And this will lead to problems because the
    EXT_FIRST_INDEX() and EXT_LAST_INDEX() will return garbage and result in this:
    
    [  135.245946] ------------[ cut here ]------------
    [  135.247579] kernel BUG at fs/ext4/extents.c:2258!
    [  135.249045] invalid opcode: 0000 [#1] PREEMPT SMP
    [  135.250320] CPU: 2 PID: 238 Comm: tmp118 Not tainted 5.19.0-rc8+ #4
    [  135.252067] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
    [  135.255065] RIP: 0010:ext4_ext_map_blocks+0xc20/0xcb0
    [  135.256475] Code:
    [  135.261433] RSP: 0018:ffffc900005939f8 EFLAGS: 00010246
    [  135.262847] RAX: 0000000000000024 RBX: ffffc90000593b70 RCX: 0000000000000023
    [  135.264765] RDX: ffff8880038e5f10 RSI: 0000000000000003 RDI: ffff8880046e922c
    [  135.266670] RBP: ffff8880046e9348 R08: 0000000000000001 R09: ffff888002ca580c
    [  135.268576] R10: 0000000000002602 R11: 0000000000000000 R12: 0000000000000024
    [  135.270477] R13: 0000000000000000 R14: 0000000000000024 R15: 0000000000000000
    [  135.272394] FS:  00007fdabdc56740(0000) GS:ffff88807dd00000(0000) knlGS:0000000000000000
    [  135.274510] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  135.276075] CR2: 00007ffc26bd4f00 CR3: 0000000006261004 CR4: 0000000000170ea0
    [  135.277952] Call Trace:
    [  135.278635]  <TASK>
    [  135.279247]  ? preempt_count_add+0x6d/0xa0
    [  135.280358]  ? percpu_counter_add_batch+0x55/0xb0
    [  135.281612]  ? _raw_read_unlock+0x18/0x30
    [  135.282704]  ext4_map_blocks+0x294/0x5a0
    [  135.283745]  ? xa_load+0x6f/0xa0
    [  135.284562]  ext4_mpage_readpages+0x3d6/0x770
    [  135.285646]  read_pages+0x67/0x1d0
    [  135.286492]  ? folio_add_lru+0x51/0x80
    [  135.287441]  page_cache_ra_unbounded+0x124/0x170
    [  135.288510]  filemap_get_pages+0x23d/0x5a0
    [  135.289457]  ? path_openat+0xa72/0xdd0
    [  135.290332]  filemap_read+0xbf/0x300
    [  135.291158]  ? _raw_spin_lock_irqsave+0x17/0x40
    [  135.292192]  new_sync_read+0x103/0x170
    [  135.293014]  vfs_read+0x15d/0x180
    [  135.293745]  ksys_read+0xa1/0xe0
    [  135.294461]  do_syscall_64+0x3c/0x80
    [  135.295284]  entry_SYSCALL_64_after_hwframe+0x46/0xb0
    
    This patch simply adds an extra check in __ext4_ext_check(), verifying that
    eh_entries is not 0 when eh_depth is > 0.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=215941
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216283
    Cc: Baokun Li <libaokun1@huawei.com>
    Cc: stable@kernel.org
    Signed-off-by: Luís Henriques <lhenriques@suse.de>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Baokun Li <libaokun1@huawei.com>
    Link: https://lore.kernel.org/r/20220822094235.2690-1-lhenriques@suse.de
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    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 bad page state [+ + +]
Author: Norbert Zulinski <norbertx.zulinski@intel.com>
Date:   Wed Sep 14 15:39:13 2022 +0200

    iavf: Fix bad page state
    
    [ Upstream commit 66039eb9015eee4f7ff0c99b83c65c7ecb3c8190 ]
    
    Fix bad page state, free inappropriate page in handling dummy
    descriptor. iavf_build_skb now has to check not only if rx_buffer is
    NULL but also if size is zero, same thing in iavf_clean_rx_irq.
    Without this patch driver would free page that will be used
    by napi_build_skb.
    
    Fixes: a9f49e006030 ("iavf: Fix handling of dummy receive descriptors")
    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>

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>

iavf: Fix set max MTU size with port VLAN and jumbo frames [+ + +]
Author: Michal Jaron <michalx.jaron@intel.com>
Date:   Tue Sep 13 15:38:35 2022 +0200

    iavf: Fix set max MTU size with port VLAN and jumbo frames
    
    [ Upstream commit 399c98c4dc50b7eb7e9f24da7ffdda6f025676ef ]
    
    After setting port VLAN and MTU to 9000 on VF with ice driver there
    was an iavf error
    "PF returned error -5 (IAVF_ERR_PARAM) to our request 6".
    
    During queue configuration, VF's max packet size was set to
    IAVF_MAX_RXBUFFER but on ice max frame size was smaller by VLAN_HLEN
    due to making some space for port VLAN as VF is not aware whether it's
    in a port VLAN. This mismatch in sizes caused ice to reject queue
    configuration with ERR_PARAM error. Proper max_mtu is sent from ice PF
    to VF with GET_VF_RESOURCES msg but VF does not look at this.
    
    In iavf change max_frame from IAVF_MAX_RXBUFFER to max_mtu
    received from pf with GET_VF_RESOURCES msg to make vf's
    max_frame_size dependent from pf. Add check if received max_mtu is
    not in eligible range then set it to IAVF_MAX_RXBUFFER.
    
    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>

 
iomap: iomap that extends beyond EOF should be marked dirty [+ + +]
Author: Chandan Babu R <chandan.babu@oracle.com>
Date:   Wed Sep 21 08:53:37 2022 +0530

    iomap: iomap that extends beyond EOF should be marked dirty
    
    From: Dave Chinner <dchinner@redhat.com>
    
    commit 7684e2c4384d5d1f884b01ab8bff2369e4db0bff upstream.
    
    When doing a direct IO that spans the current EOF, and there are
    written blocks beyond EOF that extend beyond the current write, the
    only metadata update that needs to be done is a file size extension.
    
    However, we don't mark such iomaps as IOMAP_F_DIRTY to indicate that
    there is IO completion metadata updates required, and hence we may
    fail to correctly sync file size extensions made in IO completion
    when O_DSYNC writes are being used and the hardware supports FUA.
    
    Hence when setting IOMAP_F_DIRTY, we need to also take into account
    whether the iomap spans the current EOF. If it does, then we need to
    mark it dirty so that IO completion will call generic_write_sync()
    to flush the inode size update to stable storage correctly.
    
    Fixes: 3460cac1ca76 ("iomap: Use FUA for pure data O_DSYNC DIO writes")
    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    [darrick: removed the ext4 part; they'll handle it separately]
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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 5.4.215 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Sep 28 11:04:12 2022 +0200

    Linux 5.4.215
    
    Link: https://lore.kernel.org/r/20220926100750.519221159@linuxfoundation.org
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20220926163546.791705298@linuxfoundation.org
    Tested-by: Florian Fainelli <f.fainelli@gmail.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Hulk Robot <hulkrobot@huawei.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
MAINTAINERS: add Chandan as xfs maintainer for 5.4.y [+ + +]
Author: Chandan Babu R <chandan.babu@oracle.com>
Date:   Wed Sep 21 08:53:36 2022 +0530

    MAINTAINERS: add Chandan as xfs maintainer for 5.4.y
    
    This is an attempt to direct the bots and humans that are testing
    LTS 5.4.y towards the maintainer of xfs in the 5.4.y tree.
    
    Update Darrick's email address from upstream and add Chandan as xfs
    maintaier for the 5.4.y tree.
    
    Suggested-by: Darrick J. Wong <djwong@kernel.org>
    Link: https://lore.kernel.org/linux-xfs/Yrx6%2F0UmYyuBPjEr@magnolia/
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.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: Loongson32: Fix PHY-mode being left unspecified [+ + +]
Author: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Date:   Mon Sep 12 00:10:09 2022 +0800

    MIPS: Loongson32: Fix PHY-mode being left unspecified
    
    [ Upstream commit e9f3f8f488005f6da3cfb66070706770ecaef747 ]
    
    commit 0060c8783330 ("net: stmmac: implement support for passive mode
    converters via dt") has changed the plat->interface field semantics from
    containing the PHY-mode to specifying the MAC-PCS interface mode. Due to
    that the loongson32 platform code will leave the phylink interface
    uninitialized with the PHY-mode intended by the means of the actual
    platform setup. The commit-author most likely has just missed the
    arch-specific code to fix. Let's mend the Loongson32 platform code then by
    assigning the PHY-mode to the phy_interface field of the STMMAC platform
    data.
    
    Fixes: 0060c8783330 ("net: stmmac: implement support for passive mode converters via dt")
    Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
    Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
    Tested-by: Keguang Zhang <keguang.zhang@gmail.com>
    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>

 
net/sched: taprio: avoid disabling offload when it was never enabled [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Thu Sep 15 13:08:01 2022 +0300

    net/sched: taprio: avoid disabling offload when it was never enabled
    
    [ Upstream commit db46e3a88a09c5cf7e505664d01da7238cd56c92 ]
    
    In an incredibly strange API design decision, qdisc->destroy() gets
    called even if qdisc->init() never succeeded, not exclusively since
    commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation"),
    but apparently also earlier (in the case of qdisc_create_dflt()).
    
    The taprio qdisc does not fully acknowledge this when it attempts full
    offload, because it starts off with q->flags = TAPRIO_FLAGS_INVALID in
    taprio_init(), then it replaces q->flags with TCA_TAPRIO_ATTR_FLAGS
    parsed from netlink (in taprio_change(), tail called from taprio_init()).
    
    But in taprio_destroy(), we call taprio_disable_offload(), and this
    determines what to do based on FULL_OFFLOAD_IS_ENABLED(q->flags).
    
    But looking at the implementation of FULL_OFFLOAD_IS_ENABLED()
    (a bitwise check of bit 1 in q->flags), it is invalid to call this macro
    on q->flags when it contains TAPRIO_FLAGS_INVALID, because that is set
    to U32_MAX, and therefore FULL_OFFLOAD_IS_ENABLED() will return true on
    an invalid set of flags.
    
    As a result, it is possible to crash the kernel if user space forces an
    error between setting q->flags = TAPRIO_FLAGS_INVALID, and the calling
    of taprio_enable_offload(). This is because drivers do not expect the
    offload to be disabled when it was never enabled.
    
    The error that we force here is to attach taprio as a non-root qdisc,
    but instead as child of an mqprio root qdisc:
    
    $ tc qdisc add dev swp0 root handle 1: \
            mqprio num_tc 8 map 0 1 2 3 4 5 6 7 \
            queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0
    $ tc qdisc replace dev swp0 parent 1:1 \
            taprio num_tc 8 map 0 1 2 3 4 5 6 7 \
            queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 base-time 0 \
            sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \
            flags 0x0 clockid CLOCK_TAI
    Unable to handle kernel paging request at virtual address fffffffffffffff8
    [fffffffffffffff8] pgd=0000000000000000, p4d=0000000000000000
    Internal error: Oops: 96000004 [#1] PREEMPT SMP
    Call trace:
     taprio_dump+0x27c/0x310
     vsc9959_port_setup_tc+0x1f4/0x460
     felix_port_setup_tc+0x24/0x3c
     dsa_slave_setup_tc+0x54/0x27c
     taprio_disable_offload.isra.0+0x58/0xe0
     taprio_destroy+0x80/0x104
     qdisc_create+0x240/0x470
     tc_modify_qdisc+0x1fc/0x6b0
     rtnetlink_rcv_msg+0x12c/0x390
     netlink_rcv_skb+0x5c/0x130
     rtnetlink_rcv+0x1c/0x2c
    
    Fix this by keeping track of the operations we made, and undo the
    offload only if we actually did it.
    
    I've added "bool offloaded" inside a 4 byte hole between "int clockid"
    and "atomic64_t picos_per_byte". Now the first cache line looks like
    below:
    
    $ pahole -C taprio_sched net/sched/sch_taprio.o
    struct taprio_sched {
            struct Qdisc * *           qdiscs;               /*     0     8 */
            struct Qdisc *             root;                 /*     8     8 */
            u32                        flags;                /*    16     4 */
            enum tk_offsets            tk_offset;            /*    20     4 */
            int                        clockid;              /*    24     4 */
            bool                       offloaded;            /*    28     1 */
    
            /* XXX 3 bytes hole, try to pack */
    
            atomic64_t                 picos_per_byte;       /*    32     0 */
    
            /* XXX 8 bytes hole, try to pack */
    
            spinlock_t                 current_entry_lock;   /*    40     0 */
    
            /* XXX 8 bytes hole, try to pack */
    
            struct sched_entry *       current_entry;        /*    48     8 */
            struct sched_gate_list *   oper_sched;           /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
    
    Fixes: 9c66d1564676 ("taprio: Add support for hardware offloading")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs [+ + +]
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Thu Sep 15 13:08:02 2022 +0300

    net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child qdiscs
    
    [ Upstream commit 1461d212ab277d8bba1a753d33e9afe03d81f9d4 ]
    
    taprio can only operate as root qdisc, and to that end, there exists the
    following check in taprio_init(), just as in mqprio:
    
            if (sch->parent != TC_H_ROOT)
                    return -EOPNOTSUPP;
    
    And indeed, when we try to attach taprio to an mqprio child, it fails as
    expected:
    
    $ tc qdisc add dev swp0 root handle 1: mqprio num_tc 8 \
            map 0 1 2 3 4 5 6 7 \
            queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0
    $ tc qdisc replace dev swp0 parent 1:2 taprio num_tc 8 \
            map 0 1 2 3 4 5 6 7 \
            queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
            base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \
            flags 0x0 clockid CLOCK_TAI
    Error: sch_taprio: Can only be attached as root qdisc.
    
    (extack message added by me)
    
    But when we try to attach a taprio child to a taprio root qdisc,
    surprisingly it doesn't fail:
    
    $ tc qdisc replace dev swp0 root handle 1: taprio num_tc 8 \
            map 0 1 2 3 4 5 6 7 queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
            base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \
            flags 0x0 clockid CLOCK_TAI
    $ tc qdisc replace dev swp0 parent 1:2 taprio num_tc 8 \
            map 0 1 2 3 4 5 6 7 \
            queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
            base-time 0 sched-entry S 0x7f 990000 sched-entry S 0x80 100000 \
            flags 0x0 clockid CLOCK_TAI
    
    This is because tc_modify_qdisc() behaves differently when mqprio is
    root, vs when taprio is root.
    
    In the mqprio case, it finds the parent qdisc through
    p = qdisc_lookup(dev, TC_H_MAJ(clid)), and then the child qdisc through
    q = qdisc_leaf(p, clid). This leaf qdisc q has handle 0, so it is
    ignored according to the comment right below ("It may be default qdisc,
    ignore it"). As a result, tc_modify_qdisc() goes through the
    qdisc_create() code path, and this gives taprio_init() a chance to check
    for sch_parent != TC_H_ROOT and error out.
    
    Whereas in the taprio case, the returned q = qdisc_leaf(p, clid) is
    different. It is not the default qdisc created for each netdev queue
    (both taprio and mqprio call qdisc_create_dflt() and keep them in
    a private q->qdiscs[], or priv->qdiscs[], respectively). Instead, taprio
    makes qdisc_leaf() return the _root_ qdisc, aka itself.
    
    When taprio does that, tc_modify_qdisc() goes through the qdisc_change()
    code path, because the qdisc layer never finds out about the child qdisc
    of the root. And through the ->change() ops, taprio has no reason to
    check whether its parent is root or not, just through ->init(), which is
    not called.
    
    The problem is the taprio_leaf() implementation. Even though code wise,
    it does the exact same thing as mqprio_leaf() which it is copied from,
    it works with different input data. This is because mqprio does not
    attach itself (the root) to each device TX queue, but one of the default
    qdiscs from its private array.
    
    In fact, since commit 13511704f8d7 ("net: taprio offload: enforce qdisc
    to netdev queue mapping"), taprio does this too, but just for the full
    offload case. So if we tried to attach a taprio child to a fully
    offloaded taprio root qdisc, it would properly fail too; just not to a
    software root taprio.
    
    To fix the problem, stop looking at the Qdisc that's attached to the TX
    queue, and instead, always return the default qdiscs that we've
    allocated (and to which we privately enqueue and dequeue, in software
    scheduling mode).
    
    Since Qdisc_class_ops :: leaf  is only called from tc_modify_qdisc(),
    the risk of unforeseen side effects introduced by this change is
    minimal.
    
    Fixes: 5a781ccbd19e ("tc: Add support for configuring the taprio scheduler")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: sched: fix possible refcount leak in tc_new_tfilter() [+ + +]
Author: Hangyu Hua <hbh25y@gmail.com>
Date:   Wed Sep 21 17:27:34 2022 +0800

    net: sched: fix possible refcount leak in tc_new_tfilter()
    
    [ Upstream commit c2e1cfefcac35e0eea229e148c8284088ce437b5 ]
    
    tfilter_put need to be called to put the refount got by tp->ops->get to
    avoid possible refcount leak when chain->tmplt_ops != NULL and
    chain->tmplt_ops != tp->ops.
    
    Fixes: 7d5509fa0d3d ("net: sched: extend proto ops with 'put' callback")
    Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
    Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
    Link: https://lore.kernel.org/r/20220921092734.31700-1-hbh25y@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    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>

netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find() [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Wed Sep 7 10:26:18 2022 +0200

    netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find()
    
    [ Upstream commit 559c36c5a8d730c49ef805a72b213d3bba155cc8 ]
    
    nf_osf_find() incorrectly returns true on mismatch, this leads to
    copying uninitialized memory area in nft_osf which can be used to leak
    stale kernel stack data to userspace.
    
    Fixes: 22c7652cdaa8 ("netfilter: nft_osf: Add version option support")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0 [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Thu Aug 25 14:49:05 2022 -0400

    NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0
    
    [ Upstream commit 2a9d683b48c8a87e61a4215792d44c90bcbbb536 ]
    
    The NFSv4.0 protocol only supports open() by name. It cannot therefore
    be used with open_by_handle() and friends, nor can it be re-exported by
    knfsd.
    
    Reported-by: Chuck Lever III <chuck.lever@oracle.com>
    Fixes: 20fa19027286 ("nfs: add export operations")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    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>

 
Revert "usb: add quirks for Lenovo OneLink+ Dock" [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Aug 31 10:34:25 2022 +0200

    Revert "usb: add quirks for Lenovo OneLink+ Dock"
    
    [ Upstream commit 58bfe7d8e31014d7ce246788df99c56e3cfe6c68 ]
    
    This reverts commit 3d5f70949f1b1168fbb17d06eb5c57e984c56c58.
    
    The quirk does not work properly, more work is needed to determine what
    should be done here.
    
    Reported-by: Oliver Neukum <oneukum@suse.com>
    Cc: Jean-Francois Le Fillatre <jflf_kernel@gmx.com>
    Cc: stable <stable@kernel.org>
    Fixes: 3d5f70949f1b ("usb: add quirks for Lenovo OneLink+ Dock")
    Link: https://lore.kernel.org/r/9a17ea86-079f-510d-e919-01bc53a6d09f@gmx.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio" [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Sep 2 09:10:08 2022 +0200

    Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio"
    
    [ Upstream commit fe0a2ac7c627b064c479ad0c3b25e531d342e048 ]
    
    This reverts commit 8cb339f1c1f04baede9d54c1e40ac96247a6393b as it
    throws up a bunch of sparse warnings as reported by the kernel test
    robot.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Link: https://lore.kernel.org/r/202209020044.CX2PfZzM-lkp@intel.com
    Fixes: 8cb339f1c1f0 ("usb: gadget: udc-xilinx: replace memcpy with memcpy_toio")
    Cc: stable@vger.kernel.org
    Cc: Linus Walleij <linus.walleij@linaro.org>
    Cc: Piyush Mehta <piyush.mehta@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rxrpc: Fix calc of resend age [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Tue Apr 5 13:34:09 2022 +0100

    rxrpc: Fix calc of resend age
    
    [ Upstream commit 214a9dc7d852216e83acac7b75bc18f01ce184c2 ]
    
    Fix the calculation of the resend age to add a microsecond value as
    microseconds, not nanoseconds.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    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: atmel: remove redundant assignment in rs485_config [+ + +]
Author: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Date:   Sun Apr 10 12:46:42 2022 +0200

    serial: atmel: remove redundant assignment in rs485_config
    
    [ Upstream commit 60efd0513916f195dd85bfbf21653f74f9ab019c ]
    
    In uart_set_rs485_config() the serial core already assigns the passed
    serial_rs485 struct to the uart port.
    
    So remove the assignment from the drivers rs485_config() function to avoid
    redundancy.
    
    Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
    Acked-by: Richard Genoud <richard.genoud@gmail.com>
    Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
    Link: https://lore.kernel.org/r/20220410104642.32195-10-LinoSanfilippo@gmx.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 692a8ebcfc24 ("tty: serial: atmel: Preserve previous USART mode if RS485 disabled")
    Signed-off-by: Sasha Levin <sashal@kernel.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-tcu: Use uart_xmit_advance(), fixes icount.tx accounting [+ + +]
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Thu Sep 1 17:39:34 2022 +0300

    serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting
    
    commit 1d10cd4da593bc0196a239dcc54dac24b6b0a74e upstream.
    
    Tx'ing does not correctly account Tx'ed characters into icount.tx.
    Using uart_xmit_advance() fixes the problem.
    
    Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART 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-4-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>

 
task_stack, x86/cea: Force-inline stack helpers [+ + +]
Author: Borislav Petkov <bp@suse.de>
Date:   Wed Mar 23 20:02:41 2022 +0100

    task_stack, x86/cea: Force-inline stack helpers
    
    [ Upstream commit e87f4152e542610d0b4c6c8548964a68a59d2040 ]
    
    Force-inline two stack helpers to fix the following objtool warnings:
    
      vmlinux.o: warning: objtool: in_task_stack()+0xc: call to task_stack_page() leaves .noinstr.text section
      vmlinux.o: warning: objtool: in_entry_stack()+0x10: call to cpu_entry_stack() leaves .noinstr.text section
    
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20220324183607.31717-2-bp@alien8.de
    Stable-dep-of: 54c3931957f6 ("tracing: hold caller_addr to hardirq_{enable,disable}_ip")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tracing: hold caller_addr to hardirq_{enable,disable}_ip [+ + +]
Author: Yipeng Zou <zouyipeng@huawei.com>
Date:   Thu Sep 1 18:45:14 2022 +0800

    tracing: hold caller_addr to hardirq_{enable,disable}_ip
    
    [ Upstream commit 54c3931957f6a6194d5972eccc36d052964b2abe ]
    
    Currently, The arguments passing to lockdep_hardirqs_{on,off} was fixed
    in CALLER_ADDR0.
    The function trace_hardirqs_on_caller should have been intended to use
    caller_addr to represent the address that caller wants to be traced.
    
    For example, lockdep log in riscv showing the last {enabled,disabled} at
    __trace_hardirqs_{on,off} all the time(if called by):
    [   57.853175] hardirqs last  enabled at (2519): __trace_hardirqs_on+0xc/0x14
    [   57.853848] hardirqs last disabled at (2520): __trace_hardirqs_off+0xc/0x14
    
    After use trace_hardirqs_xx_caller, we can get more effective information:
    [   53.781428] hardirqs last  enabled at (2595): restore_all+0xe/0x66
    [   53.782185] hardirqs last disabled at (2596): ret_from_exception+0xa/0x10
    
    Link: https://lkml.kernel.org/r/20220901104515.135162-2-zouyipeng@huawei.com
    
    Cc: stable@vger.kernel.org
    Fixes: c3bc8fd637a96 ("tracing: Centralize preemptirq tracepoints and unify their usage")
    Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tty/serial: atmel: RS485 & ISO7816: wait for TXRDY before sending data [+ + +]
Author: Codrin.Ciubotariu@microchip.com <Codrin.Ciubotariu@microchip.com>
Date:   Tue Jan 7 11:17:47 2020 +0000

    tty/serial: atmel: RS485 & ISO7816: wait for TXRDY before sending data
    
    [ Upstream commit 477b8383100023ea0769979cff67e9be3a720397 ]
    
    At this moment, TXEMPTY is checked before sending data on RS485 and ISO7816
    modes. However, TXEMPTY is risen when FIFO (if used) or the Transmit Shift
    Register are empty, even though TXRDY might be up and controller is able to
    receive data. Since the controller sends data only when TXEMPTY is ready,
    on RS485, when DMA is not used, the RTS pin is driven low after each byte.
    With this patch, the characters will be transmitted when TXRDY is up and
    so, RTS pin will remain high between bytes.
    The performance improvement on RS485 is about 8% with a baudrate of 300.
    
    Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
    Acked-by: Richard Genoud <richard.genoud@gmail.com>
    Link: https://lore.kernel.org/r/20200107111656.26308-1-codrin.ciubotariu@microchip.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 692a8ebcfc24 ("tty: serial: atmel: Preserve previous USART mode if RS485 disabled")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tty: serial: atmel: Preserve previous USART mode if RS485 disabled [+ + +]
Author: Sergiu Moga <sergiu.moga@microchip.com>
Date:   Wed Aug 24 17:29:03 2022 +0300

    tty: serial: atmel: Preserve previous USART mode if RS485 disabled
    
    [ Upstream commit 692a8ebcfc24f4a5bea0eb2967e450f584193da6 ]
    
    Whenever the atmel_rs485_config() driver method would be called,
    the USART mode is reset to normal mode before even checking if
    RS485 flag is set, thus resulting in losing the previous USART
    mode in the case where the checking fails.
    
    Some tools, such as `linux-serial-test`, lead to the driver calling
    this method when doing the setup of the serial port: after setting the
    port mode (Hardware Flow Control, Normal Mode, RS485 Mode, etc.),
    `linux-serial-test` tries to enable/disable RS485 depending on
    the commandline arguments that were passed.
    
    Example of how this issue could reveal itself:
    When doing a serial communication with Hardware Flow Control through
    `linux-serial-test`, the tool would lead to the driver roughly doing
    the following:
    - set the corresponding bit to 1 (ATMEL_US_USMODE_HWHS bit in the
    ATMEL_US_MR register) through the atmel_set_termios() to enable
    Hardware Flow Control
    - disable RS485 through the atmel_config_rs485() method
    Thus, when the latter is called, the mode will be reset and the
    previously set bit is unset, leaving USART in normal mode instead of
    the expected Hardware Flow Control mode.
    
    This fix ensures that this reset is only done if the checking for
    RS485 succeeds and that the previous mode is preserved otherwise.
    
    Fixes: e8faff7330a35 ("ARM: 6092/1: atmel_serial: support for RS485 communications")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
    Link: https://lore.kernel.org/r/20220824142902.502596-1-sergiu.moga@microchip.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usb: add quirks for Lenovo OneLink+ Dock [+ + +]
Author: Jean-Francois Le Fillatre <jflf_kernel@gmx.com>
Date:   Wed Aug 24 21:13:21 2022 +0200

    usb: add quirks for Lenovo OneLink+ Dock
    
    [ Upstream commit 3d5f70949f1b1168fbb17d06eb5c57e984c56c58 ]
    
    The Lenovo OneLink+ Dock contains two VL812 USB3.0 controllers:
    17ef:1018 upstream
    17ef:1019 downstream
    
    Those two controllers both have problems with some USB3.0 devices,
    particularly self-powered ones. Typical error messages include:
    
      Timeout while waiting for setup device command
      device not accepting address X, error -62
      unable to enumerate USB device
    
    By process of elimination the controllers themselves were identified as
    the cause of the problem. Through trial and error the issue was solved
    by using USB_QUIRK_RESET_RESUME for both chips.
    
    Signed-off-by: Jean-Francois Le Fillatre <jflf_kernel@gmx.com>
    Cc: stable <stable@kernel.org>
    Link: https://lore.kernel.org/r/20220824191320.17883-1-jflf_kernel@gmx.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: cdns3: fix issue with rearming ISO OUT endpoint [+ + +]
Author: Pawel Laszczak <pawell@cadence.com>
Date:   Thu Aug 25 08:21:37 2022 +0200

    usb: cdns3: fix issue with rearming ISO OUT endpoint
    
    [ Upstream commit b46a6b09fa056042a302b181a1941f0056944603 ]
    
    ISO OUT endpoint is enabled during queuing first usb request
    in transfer ring and disabled when TRBERR is reported by controller.
    After TRBERR and before next transfer added to TR driver must again
    reenable endpoint but does not.
    To solve this issue during processing TRBERR event driver must
    set the flag EP_UPDATE_EP_TRBADDR in priv_ep->flags field.
    
    Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
    cc: <stable@vger.kernel.org>
    Acked-by: Peter Chen <peter.chen@kernel.org>
    Signed-off-by: Pawel Laszczak <pawell@cadence.com>
    Link: https://lore.kernel.org/r/20220825062137.5766-1-pawell@cadence.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.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: gadget: Avoid duplicate requests to enable Run/Stop [+ + +]
Author: Wesley Cheng <quic_wcheng@quicinc.com>
Date:   Wed Jul 27 19:06:47 2022 -0700

    usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop
    
    [ Upstream commit 040f2dbd2010c43f33ad27249e6dac48456f4d99 ]
    
    Relocate the pullups_connected check until after it is ensured that there
    are no runtime PM transitions.  If another context triggered the DWC3
    core's runtime resume, it may have already enabled the Run/Stop.  Do not
    re-run the entire pullup sequence again, as it may issue a core soft
    reset while Run/Stop is already set.
    
    This patch depends on
      commit 69e131d1ac4e ("usb: dwc3: gadget: Prevent repeat pullup()")
    
    Fixes: 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Link: https://lore.kernel.org/r/20220728020647.9377-1-quic_wcheng@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: gadget: Avoid starting DWC3 gadget during UDC unbind [+ + +]
Author: Wesley Cheng <wcheng@codeaurora.org>
Date:   Thu Sep 16 19:18:52 2021 -0700

    usb: dwc3: gadget: Avoid starting DWC3 gadget during UDC unbind
    
    [ Upstream commit 8217f07a50236779880f13e87f99224cd9117f83 ]
    
    There is a race present where the DWC3 runtime resume runs in parallel
    to the UDC unbind sequence.  This will eventually lead to a possible
    scenario where we are enabling the run/stop bit, without a valid
    composition defined.
    
    Thread#1 (handling UDC unbind):
    usb_gadget_remove_driver()
    -->usb_gadget_disconnect()
      -->dwc3_gadget_pullup(0)
    --> continue UDC unbind sequence
    -->Thread#2 is running in parallel here
    
    Thread#2 (handing next cable connect)
    __dwc3_set_mode()
      -->pm_runtime_get_sync()
        -->dwc3_gadget_resume()
          -->dwc->gadget_driver is NOT NULL yet
          -->dwc3_gadget_run_stop(1)
          --> _dwc3gadget_start()
    ...
    
    Fix this by tracking the pullup disable routine, and avoiding resuming
    of the DWC3 gadget.  Once the UDC is re-binded, that will trigger the
    pullup enable routine, which would handle enabling the DWC3 gadget.
    
    Acked-by: Felipe Balbi <balbi@kernel.org>
    Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
    Link: https://lore.kernel.org/r/20210917021852.2037-1-wcheng@codeaurora.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: gadget: Don't modify GEVNTCOUNT in pullup() [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Thu Apr 21 19:22:44 2022 -0700

    usb: dwc3: gadget: Don't modify GEVNTCOUNT in pullup()
    
    [ Upstream commit 8f8034f493b5eb1ad21ff392fd30c0cf9e71f73f ]
    
    If the GEVNTCOUNT indicates events in the event buffer, the driver needs
    to acknowledge them before the controller can halt. Simply let the
    interrupt handler acknowledges the remaining event generated by the
    controller while polling for DSTS.DEVCTLHLT. This avoids disabling irq
    and taking care of race condition between the interrupt handlers and
    pullup().
    
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/ea306ec93c41ccafbdb5d16404ff3b6eca299613.1650593829.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: gadget: Prevent repeat pullup() [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Thu Apr 21 19:22:31 2022 -0700

    usb: dwc3: gadget: Prevent repeat pullup()
    
    [ Upstream commit 69e131d1ac4e52a59ec181ab4f8aa8c48cd8fb64 ]
    
    Don't do soft-disconnect if it's previously done. Likewise, don't do
    soft-connect if the device is currently connected and running. It would
    break normal operation.
    
    Currently the caller of pullup() (udc's sysfs soft_connect) only checks
    if it had initiated disconnect to prevent repeating soft-disconnect. It
    doesn't check for soft-connect. To be safe, let's keep the check here
    regardless whether the udc core is fixed.
    
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/1c1345bd66c97a9d32f77d63aaadd04b7b037143.1650593829.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: gadget: Refactor pullup() [+ + +]
Author: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Date:   Thu Apr 21 19:22:38 2022 -0700

    usb: dwc3: gadget: Refactor pullup()
    
    [ Upstream commit 861c010a2ee1bc4a66d23f0da4aa22e75d8eaa24 ]
    
    Move soft-disconnect sequence out of dwc3_gadget_pullup(). No
    functional change here.
    
    Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/4c0f259b17d95acaaa931f90276683a48a32fe22.1650593829.git.Thinh.Nguyen@synopsys.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: dwc3: Issue core soft reset before enabling run/stop [+ + +]
Author: Wesley Cheng <quic_wcheng@quicinc.com>
Date:   Tue Mar 15 18:13:58 2022 -0700

    usb: dwc3: Issue core soft reset before enabling run/stop
    
    [ Upstream commit 0066472de157439d58454f4a55786f1045ea5681 ]
    
    It is recommended by the Synopsis databook to issue a DCTL.CSftReset
    when reconnecting from a device-initiated disconnect routine.  This
    resolves issues with enumeration during fast composition switching
    cases, which result in an unknown device on the host.
    
    Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Link: https://lore.kernel.org/r/20220316011358.3057-1-quic_wcheng@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: gadget: udc-xilinx: replace memcpy with memcpy_toio [+ + +]
Author: Piyush Mehta <piyush.mehta@amd.com>
Date:   Wed Aug 24 12:42:53 2022 +0530

    usb: gadget: udc-xilinx: replace memcpy with memcpy_toio
    
    [ Upstream commit 8cb339f1c1f04baede9d54c1e40ac96247a6393b ]
    
    For ARM processor, unaligned access to device memory is not allowed.
    Method memcpy does not take care of alignment.
    
    USB detection failure with the unaligned address of memory access, with
    below kernel crash. To fix the unaligned address the kernel panic issue,
    replace memcpy with memcpy_toio method.
    
    Kernel crash:
    Unable to handle kernel paging request at virtual address ffff80000c05008a
    Mem abort info:
      ESR = 0x96000061
      EC = 0x25: DABT (current EL), IL = 32 bits
      SET = 0, FnV = 0
      EA = 0, S1PTW = 0
      FSC = 0x21: alignment fault
    Data abort info:
      ISV = 0, ISS = 0x00000061
      CM = 0, WnR = 1
    swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000000143b000
    [ffff80000c05008a] pgd=100000087ffff003, p4d=100000087ffff003,
    pud=100000087fffe003, pmd=1000000800bcc003, pte=00680000a0010713
    Internal error: Oops: 96000061 [#1] SMP
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.19-xilinx-v2022.1 #1
    Hardware name: ZynqMP ZCU102 Rev1.0 (DT)
    pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : __memcpy+0x30/0x260
    lr : __xudc_ep0_queue+0xf0/0x110
    sp : ffff800008003d00
    x29: ffff800008003d00 x28: ffff800009474e80 x27: 00000000000000a0
    x26: 0000000000000100 x25: 0000000000000012 x24: ffff000800bc8080
    x23: 0000000000000001 x22: 0000000000000012 x21: ffff000800bc8080
    x20: 0000000000000012 x19: ffff000800bc8080 x18: 0000000000000000
    x17: ffff800876482000 x16: ffff800008004000 x15: 0000000000004000
    x14: 00001f09785d0400 x13: 0103020101005567 x12: 0781400000000200
    x11: 00000000c5672a10 x10: 00000000000008d0 x9 : ffff800009463cf0
    x8 : ffff8000094757b0 x7 : 0201010055670781 x6 : 4000000002000112
    x5 : ffff80000c05009a x4 : ffff000800a15012 x3 : ffff00080362ad80
    x2 : 0000000000000012 x1 : ffff000800a15000 x0 : ffff80000c050088
    Call trace:
     __memcpy+0x30/0x260
     xudc_ep0_queue+0x3c/0x60
     usb_ep_queue+0x38/0x44
     composite_ep0_queue.constprop.0+0x2c/0xc0
     composite_setup+0x8d0/0x185c
     configfs_composite_setup+0x74/0xb0
     xudc_irq+0x570/0xa40
     __handle_irq_event_percpu+0x58/0x170
     handle_irq_event+0x60/0x120
     handle_fasteoi_irq+0xc0/0x220
     handle_domain_irq+0x60/0x90
     gic_handle_irq+0x74/0xa0
     call_on_irq_stack+0x2c/0x60
     do_interrupt_handler+0x54/0x60
     el1_interrupt+0x30/0x50
     el1h_64_irq_handler+0x18/0x24
     el1h_64_irq+0x78/0x7c
     arch_cpu_idle+0x18/0x2c
     do_idle+0xdc/0x15c
     cpu_startup_entry+0x28/0x60
     rest_init+0xc8/0xe0
     arch_call_rest_init+0x10/0x1c
     start_kernel+0x694/0x6d4
     __primary_switched+0xa4/0xac
    
    Fixes: 1f7c51660034 ("usb: gadget: Add xilinx usb2 device support")
    Cc: stable@vger.kernel.org
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
    Link: https://lore.kernel.org/r/20220824071253.1261096-1-piyush.mehta@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.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>

 
usb: xhci-mtk: add a function to (un)load bandwidth info [+ + +]
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon Mar 8 10:51:55 2021 +0800

    usb: xhci-mtk: add a function to (un)load bandwidth info
    
    [ Upstream commit 338af695fffb12a9407c376ce0cebce896c15050 ]
    
    Extract a function to load/unload bandwidth info, and remove
    a dummy check of TT offset.
    
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/6fbc000756a4a4a7efbce651b785fee7561becb6.1615170625.git.chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci-mtk: add only one extra CS for FS/LS INTR [+ + +]
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon Mar 8 10:51:53 2021 +0800

    usb: xhci-mtk: add only one extra CS for FS/LS INTR
    
    [ Upstream commit 1bf661daf6b084bc4d753f55b54f35dc98709685 ]
    
    In USB2 Spec:
    "11.18.5 TT Response Generation
    In general, there will be two (or more) complete-split
    transactions scheduled for a periodic endpoint.
    However, for interrupt endpoints, the maximum size of
    the full-/low-speed transaction guarantees that it can
    never require more than two complete-split transactions.
    Two complete-split transactions are only required
    when the transaction spans a microframe boundary."
    
    Due to the maxp is 64, and less then 188 (at most in one
    microframe), seems never span boundary, so use only one CS
    for FS/LS interrupt transfer, this will save some bandwidth.
    
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/5b9ff09f53d23cf9e5c5437db4ffc18b798bf60c.1615170625.git.chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci-mtk: add some schedule error number [+ + +]
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon Mar 8 10:52:02 2021 +0800

    usb: xhci-mtk: add some schedule error number
    
    [ Upstream commit ccda8c224c0701caac007311d06a2de9543a7590 ]
    
    This is used to provide more information about which case
    causes bandwidth schedule failure.
    
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/9771f44093053b581e9c4be4b7fb68d9fcecad08.1615170625.git.chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci-mtk: allow multiple Start-Split in a microframe [+ + +]
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Fri Jun 18 13:46:05 2021 +0800

    usb: xhci-mtk: allow multiple Start-Split in a microframe
    
    [ Upstream commit d3997fce189fc4423169c51a81ba5ca01144d886 ]
    
    This patch is used to relax bandwidth schedule by allowing multiple
    Start-Split in the same microframe.
    
    Reviewed-and-Tested-by: Ikjoon Jang <ikjn@chromium.org>
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/1623995165-25759-1-git-send-email-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci-mtk: fix issue of out-of-bounds array access [+ + +]
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Tue Aug 17 16:36:25 2021 +0800

    usb: xhci-mtk: fix issue of out-of-bounds array access
    
    commit de5107f473190538a65aac7edea85209cd5c1a8f upstream.
    
    Bus bandwidth array access is based on esit, increase one
    will cause out-of-bounds issue; for example, when esit is
    XHCI_MTK_MAX_ESIT, will overstep boundary.
    
    Fixes: 7c986fbc16ae ("usb: xhci-mtk: get the microframe boundary for ESIT")
    Cc: <stable@vger.kernel.org>
    Reported-by: Stan Lu <stan.lu@mediatek.com>
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/1629189389-18779-5-git-send-email-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: xhci-mtk: get the microframe boundary for ESIT [+ + +]
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon Mar 8 10:51:52 2021 +0800

    usb: xhci-mtk: get the microframe boundary for ESIT
    
    [ Upstream commit 7c986fbc16ae6b2f914a3ebf06a3a4a8d9bb0b7c ]
    
    Tune the boundary for FS/LS ESIT due to CS:
    For ISOC out-ep, the controller starts transfer data after
    the first SS; for others, the data is already transferred
    before the last CS.
    
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/49e5a269a47984f3126a70c3fb471b0c2874b8c2.1615170625.git.chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci-mtk: relax TT periodic bandwidth allocation [+ + +]
Author: Ikjoon Jang <ikjn@chromium.org>
Date:   Thu Aug 5 13:39:57 2021 +0800

    usb: xhci-mtk: relax TT periodic bandwidth allocation
    
    [ Upstream commit 548011957d1d72e0b662300c8b32b81d593b796e ]
    
    Currently xhci-mtk needs software-managed bandwidth allocation for
    periodic endpoints, it allocates the microframe index for the first
    start-split packet for each endpoint. As this index allocation logic
    should avoid the conflicts with other full/low-speed periodic endpoints,
    it uses the worst case byte budgets on high-speed bus bandwidth
    For example, for an isochronos IN endpoint with 192 bytes budget,
    it will consume the whole 4 u-frames(188 * 4) while the actual
    full-speed bus budget should be just 192bytes.
    
    This patch changes the low/full-speed bandwidth allocation logic
    to use "approximate" best case budget for lower speed bandwidth
    management. For the same endpoint from the above example, the
    approximate best case budget is now reduced to (188 * 2) bytes.
    
    Without this patch, many usb audio headsets with 3 interfaces
    (audio input, audio output, and HID) cannot be configured
    on xhci-mtk.
    
    Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
    Link: https://lore.kernel.org/r/20210805133937.1.Ia8174b875bc926c12ce427a5a1415dea31cc35ae@changeid
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

usb: xhci-mtk: use @sch_tt to check whether need do TT schedule [+ + +]
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon Mar 8 10:51:54 2021 +0800

    usb: xhci-mtk: use @sch_tt to check whether need do TT schedule
    
    [ Upstream commit 4a56adf4fafbc41ceffce0c3f385f59d4fc3c16a ]
    
    It's clearer to use @sch_tt to check whether need do TT schedule,
    no function is changed.
    
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/324a76782ccaf857a8f01f67aee435e8ec7d0e28.1615170625.git.chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation")
    Signed-off-by: Sasha Levin <sashal@kernel.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>

 
xfs: add missing assert in xfs_fsmap_owner_from_rmap [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:42 2022 +0530

    xfs: add missing assert in xfs_fsmap_owner_from_rmap
    
    commit 110f09cb705af8c53f2a457baf771d2935ed62d4 upstream.
    
    The fsmap handler shouldn't fail silently if the rmap code ever feeds it
    a special owner number that isn't known to the fsmap handler.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: always log corruption errors [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:48 2022 +0530

    xfs: always log corruption errors
    
    commit a5155b870d687de1a5f07e774b49b1e8ef0f6f50 upstream.
    
    Make sure we log something to dmesg whenever we return -EFSCORRUPTED up
    the call stack.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: attach dquots and reserve quota blocks during unwritten conversion [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:44 2022 +0530

    xfs: attach dquots and reserve quota blocks during unwritten conversion
    
    commit 2815a16d7ff6230a8e37928829d221bb075aa160 upstream.
    
    In xfs_iomap_write_unwritten, we need to ensure that dquots are attached
    to the inode and quota blocks reserved so that we capture in the quota
    counters any blocks allocated to handle a bmbt split.  This can happen
    on the first unwritten extent conversion to a preallocated sparse file
    on a fresh mount.
    
    This was found by running generic/311 with quotas enabled.  The bug
    seems to have been introduced in "[XFS] rework iocore infrastructure,
    remove some code and make it more" from ~2002?
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: constify the buffer pointer arguments to error functions [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:47 2022 +0530

    xfs: constify the buffer pointer arguments to error functions
    
    commit d243b89a611e83dc97ce7102419360677a664076 upstream.
    
    Some of the xfs error message functions take a pointer to a buffer that
    will be dumped to the system log.  The logging functions don't change
    the contents, so constify all the parameters.  This enables the next
    patch to ensure that we log bad metadata when we encounter it.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: convert EIO to EFSCORRUPTED when log contents are invalid [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:46 2022 +0530

    xfs: convert EIO to EFSCORRUPTED when log contents are invalid
    
    commit 895e196fb6f84402dcd0c1d3c3feb8a58049564e upstream.
    
    Convert EIO to EFSCORRUPTED in the logging code when we can determine
    that the log contents are invalid.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: don't commit sunit/swidth updates to disk if that would cause repair failures [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:54 2022 +0530

    xfs: don't commit sunit/swidth updates to disk if that would cause repair failures
    
    commit 13eaec4b2adf2657b8167b67e27c97cc7314d923 upstream.
    
    Alex Lyakas reported[1] that mounting an xfs filesystem with new sunit
    and swidth values could cause xfs_repair to fail loudly.  The problem
    here is that repair calculates the where mkfs should have allocated the
    root inode, based on the superblock geometry.  The allocation decisions
    depend on sunit, which means that we really can't go updating sunit if
    it would lead to a subsequent repair failure on an otherwise correct
    filesystem.
    
    Port from xfs_repair some code that computes the location of the root
    inode and teach mount to skip the ondisk update if it would cause
    problems for repair.  Along the way we'll update the documentation,
    provide a function for computing the minimum AGFL size instead of
    open-coding it, and cut down some indenting in the mount code.
    
    Note that we allow the mount to proceed (and new allocations will
    reflect this new geometry) because we've never screened this kind of
    thing before.  We'll have to wait for a new future incompat feature to
    enforce correct behavior, alas.
    
    Note that the geometry reporting always uses the superblock values, not
    the incore ones, so that is what xfs_info and xfs_growfs will report.
    
    [1] https://lore.kernel.org/linux-xfs/20191125130744.GA44777@bfoster/T/#m00f9594b511e076e2fcdd489d78bc30216d72a7d
    
    Reported-by: Alex Lyakas <alex@zadara.com>
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix an ABBA deadlock in xfs_rename [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:55 2022 +0530

    xfs: fix an ABBA deadlock in xfs_rename
    
    commit 6da1b4b1ab36d80a3994fd4811c8381de10af604 upstream.
    
    When overlayfs is running on top of xfs and the user unlinks a file in
    the overlay, overlayfs will create a whiteout inode and ask xfs to
    "rename" the whiteout file atop the one being unlinked.  If the file
    being unlinked loses its one nlink, we then have to put the inode on the
    unlinked list.
    
    This requires us to grab the AGI buffer of the whiteout inode to take it
    off the unlinked list (which is where whiteouts are created) and to grab
    the AGI buffer of the file being deleted.  If the whiteout was created
    in a higher numbered AG than the file being deleted, we'll lock the AGIs
    in the wrong order and deadlock.
    
    Therefore, grab all the AGI locks we think we'll need ahead of time, and
    in order of increasing AG number per the locking rules.
    
    Reported-by: wenli xie <wlxie7296@gmail.com>
    Fixes: 93597ae8dac0 ("xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename()")
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename() [+ + +]
Author: kaixuxia <xiakaixu1987@gmail.com>
Date:   Sat Sep 24 18:26:45 2022 +0530

    xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename()
    
    commit 93597ae8dac0149b5c00b787cba6bf7ba213e666 upstream.
    
    When target_ip exists in xfs_rename(), the xfs_dir_replace() call may
    need to hold the AGF lock to allocate more blocks, and then invoking
    the xfs_droplink() call to hold AGI lock to drop target_ip onto the
    unlinked list, so we get the lock order AGF->AGI. This would break the
    ordering constraint on AGI and AGF locking - inode allocation locks
    the AGI, then can allocate a new extent for new inodes, locking the
    AGF after the AGI.
    
    In this patch we check whether the replace operation need more
    blocks firstly. If so, acquire the agi lock firstly to preserve
    locking order(AGI/AGF). Actually, the locking order problem only
    occurs when we are locking the AGI/AGF of the same AG. For multiple
    AGs the AGI lock will be released after the transaction committed.
    
    Signed-off-by: kaixuxia <kaixuxia@tencent.com>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    [darrick: reword the comment]
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix some memory leaks in log recovery [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:49 2022 +0530

    xfs: fix some memory leaks in log recovery
    
    commit 050552cbe06a3a9c3f977dcf11ff998ae1d5c2d5 upstream.
    
    Fix a few places where we xlog_alloc_buffer a buffer, hit an error, and
    then bail out without freeing the buffer.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix use-after-free when aborting corrupt attr inactivation [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:56 2022 +0530

    xfs: fix use-after-free when aborting corrupt attr inactivation
    
    commit 496b9bcd62b0b3a160be61e3265a086f97adcbd3 upstream.
    
    Log the corrupt buffer before we release the buffer.
    
    Fixes: a5155b870d687 ("xfs: always log corruption errors")
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: range check ri_cnt when recovering log items [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:43 2022 +0530

    xfs: range check ri_cnt when recovering log items
    
    commit d6abecb82573fed5f7e4b595b5c0bd37707d2848 upstream.
    
    Range check the region counter when we're reassembling regions from log
    items during log recovery.  In the old days ASSERT would halt the
    kernel, but this isn't true any more so we have to make an explicit
    error return.
    
    Coverity-id: 1132508
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: refactor agfl length computation function [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:52 2022 +0530

    xfs: refactor agfl length computation function
    
    commit 1cac233cfe71f21e069705a4930c18e48d897be6 upstream.
    
    Refactor xfs_alloc_min_freelist to accept a NULL @pag argument, in which
    case it returns the largest possible minimum length.  This will be used
    in an upcoming patch to compute the length of the AGFL at mkfs time.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:40 2022 +0530

    xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata
    
    commit c2414ad6e66ab96b867309454498f7fb29b7e855 upstream.
    
    There are a few places where we return -EIO instead of -EFSCORRUPTED
    when we find corrupt metadata.  Fix those places.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: slightly tweak an assert in xfs_fs_map_blocks [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Sat Sep 24 18:26:41 2022 +0530

    xfs: slightly tweak an assert in xfs_fs_map_blocks
    
    commit 88cdb7147b21b2d8b4bd3f3d95ce0bffd73e1ac3 upstream.
    
    We should never see delalloc blocks for a pNFS layout, write or not.
    Adjust the assert to check for that.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: split the sunit parameter update into two parts [+ + +]
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Sat Sep 24 18:26:53 2022 +0530

    xfs: split the sunit parameter update into two parts
    
    commit 4f5b1b3a8fa07dc8ecedfaf539b3deed8931a73e upstream.
    
    If the administrator provided a sunit= mount option, we need to validate
    the raw parameter, convert the mount option units (512b blocks) into the
    internal unit (fs blocks), and then validate that the (now cooked)
    parameter doesn't screw anything up on disk.  The incore inode geometry
    computation can depend on the new sunit option, but a subsequent patch
    will make validating the cooked value depends on the computed inode
    geometry, so break the sunit update into two steps.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: stabilize insert range start boundary to avoid COW writeback race [+ + +]
Author: Brian Foster <bfoster@redhat.com>
Date:   Sat Sep 24 18:26:50 2022 +0530

    xfs: stabilize insert range start boundary to avoid COW writeback race
    
    commit d0c2204135a0cdbc607c94c481cf1ccb2f659aa7 upstream.
    
    generic/522 (fsx) occasionally fails with a file corruption due to
    an insert range operation. The primary characteristic of the
    corruption is a misplaced insert range operation that differs from
    the requested target offset. The reason for this behavior is a race
    between the extent shift sequence of an insert range and a COW
    writeback completion that causes a front merge with the first extent
    in the shift.
    
    The shift preparation function flushes and unmaps from the target
    offset of the operation to the end of the file to ensure no
    modifications can be made and page cache is invalidated before file
    data is shifted. An insert range operation then splits the extent at
    the target offset, if necessary, and begins to shift the start
    offset of each extent starting from the end of the file to the start
    offset. The shift sequence operates at extent level and so depends
    on the preparation sequence to guarantee no changes can be made to
    the target range during the shift. If the block immediately prior to
    the target offset was dirty and shared, however, it can undergo
    writeback and move from the COW fork to the data fork at any point
    during the shift. If the block is contiguous with the block at the
    start offset of the insert range, it can front merge and alter the
    start offset of the extent. Once the shift sequence reaches the
    target offset, it shifts based on the latest start offset and
    silently changes the target offset of the operation and corrupts the
    file.
    
    To address this problem, update the shift preparation code to
    stabilize the start boundary along with the full range of the
    insert. Also update the existing corruption check to fail if any
    extent is shifted with a start offset behind the target offset of
    the insert range. This prevents insert from racing with COW
    writeback completion and fails loudly in the event of an unexpected
    extent shift.
    
    Signed-off-by: Brian Foster <bfoster@redhat.com>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: use bitops interface for buf log item AIL flag check [+ + +]
Author: Brian Foster <bfoster@redhat.com>
Date:   Sat Sep 24 18:26:51 2022 +0530

    xfs: use bitops interface for buf log item AIL flag check
    
    commit 826f7e34130a4ce756138540170cbe935c537a47 upstream.
    
    The xfs_log_item flags were converted to atomic bitops as of commit
    22525c17ed ("xfs: log item flags are racy"). The assert check for
    AIL presence in xfs_buf_item_relse() still uses the old value based
    check. This likely went unnoticed as XFS_LI_IN_AIL evaluates to 0
    and causes the assert to unconditionally pass. Fix up the check.
    
    Signed-off-by: Brian Foster <bfoster@redhat.com>
    Fixes: 22525c17ed ("xfs: log item flags are racy")
    Reviewed-by: Eric Sandeen <sandeen@redhat.com>
    Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>