Changelog in Linux kernel 6.1.130

 
acct: block access to kernel internal filesystems [+ + +]
Author: Christian Brauner <brauner@kernel.org>
Date:   Tue Feb 11 18:16:00 2025 +0100

    acct: block access to kernel internal filesystems
    
    commit 890ed45bde808c422c3c27d3285fc45affa0f930 upstream.
    
    There's no point in allowing anything kernel internal nor procfs or
    sysfs.
    
    Link: https://lore.kernel.org/r/20250127091811.3183623-1-quzicheng@huawei.com
    Link: https://lore.kernel.org/r/20250211-work-acct-v1-2-1c16aecab8b3@kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reviewed-by: Amir Goldstein <amir73il@gmail.com>
    Reported-by: Zicheng Qu <quzicheng@huawei.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

acct: perform last write from workqueue [+ + +]
Author: Christian Brauner <brauner@kernel.org>
Date:   Tue Feb 11 18:15:59 2025 +0100

    acct: perform last write from workqueue
    
    commit 56d5f3eba3f5de0efdd556de4ef381e109b973a9 upstream.
    
    In [1] it was reported that the acct(2) system call can be used to
    trigger NULL deref in cases where it is set to write to a file that
    triggers an internal lookup. This can e.g., happen when pointing acc(2)
    to /sys/power/resume. At the point the where the write to this file
    happens the calling task has already exited and called exit_fs(). A
    lookup will thus trigger a NULL-deref when accessing current->fs.
    
    Reorganize the code so that the the final write happens from the
    workqueue but with the caller's credentials. This preserves the
    (strange) permission model and has almost no regression risk.
    
    This api should stop to exist though.
    
    Link: https://lore.kernel.org/r/20250127091811.3183623-1-quzicheng@huawei.com [1]
    Link: https://lore.kernel.org/r/20250211-work-acct-v1-1-1c16aecab8b3@kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Zicheng Qu <quzicheng@huawei.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
afs: Fix the server_list to unuse a displaced server rather than putting it [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Tue Feb 18 19:22:47 2025 +0000

    afs: Fix the server_list to unuse a displaced server rather than putting it
    
    [ Upstream commit add117e48df4788a86a21bd0515833c0a6db1ad1 ]
    
    When allocating and building an afs_server_list struct object from a VLDB
    record, we look up each server address to get the server record for it -
    but a server may have more than one entry in the record and we discard the
    duplicate pointers.  Currently, however, when we discard, we only put a
    server record, not unuse it - but the lookup got as an active-user count.
    
    The active-user count on an afs_server_list object determines its lifetime
    whereas the refcount keeps the memory backing it around.  Failing to reduce
    the active-user counter prevents the record from being cleaned up and can
    lead to multiple copied being seen - and pointing to deleted afs_cell
    objects and other such things.
    
    Fix this by switching the incorrect 'put' to an 'unuse' instead.
    
    Without this, occasionally, a dead server record can be seen in
    /proc/net/afs/servers and list corruption may be observed:
    
        list_del corruption. prev->next should be ffff888102423e40, but was 0000000000000000. (prev=ffff88810140cd38)
    
    Fixes: 977e5f8ed0ab ("afs: Split the usage count on struct afs_server")
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: Simon Horman <horms@kernel.org>
    cc: linux-afs@lists.infradead.org
    Link: https://patch.msgid.link/20250218192250.296870-5-dhowells@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

afs: Make it possible to find the volumes that are using a server [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Thu Nov 2 16:08:43 2023 +0000

    afs: Make it possible to find the volumes that are using a server
    
    [ Upstream commit ca0e79a46097d54e4af46c67c852479d97af35bb ]
    
    Make it possible to find the afs_volume structs that are using an
    afs_server struct to aid in breaking volume callbacks.
    
    The way this is done is that each afs_volume already has an array of
    afs_server_entry records that point to the servers where that volume might
    be found.  An afs_volume backpointer and a list node is added to each entry
    and each entry is then added to an RCU-traversable list on the afs_server
    to which it points.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    Stable-dep-of: add117e48df4 ("afs: Fix the server_list to unuse a displaced server rather than putting it")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

afs: remove variable nr_servers [+ + +]
Author: Colin Ian King <colin.i.king@gmail.com>
Date:   Thu Oct 20 18:39:23 2022 +0100

    afs: remove variable nr_servers
    
    [ Upstream commit 318b83b71242998814a570c3420c042ee6165fca ]
    
    Variable nr_servers is no longer being used, the last reference
    to it was removed in commit 45df8462730d ("afs: Fix server list handling")
    so clean up the code by removing it.
    
    Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    Link: https://lore.kernel.org/r/20221020173923.21342-1-colin.i.king@gmail.com/
    Stable-dep-of: add117e48df4 ("afs: Fix the server_list to unuse a displaced server rather than putting it")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda/cirrus: Correct the full scale volume set logic [+ + +]
Author: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Date:   Fri Feb 14 21:07:28 2025 +0000

    ALSA: hda/cirrus: Correct the full scale volume set logic
    
    [ Upstream commit 08b613b9e2ba431db3bd15cb68ca72472a50ef5c ]
    
    This patch corrects the full-scale volume setting logic. On certain
    platforms, the full-scale volume bit is required. The current logic
    mistakenly sets this bit and incorrectly clears reserved bit 0, causing
    the headphone output to be muted.
    
    Fixes: 342b6b610ae2 ("ALSA: hda/cs8409: Fix Full Scale Volume setting for all variants")
    Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
    Link: https://patch.msgid.link/20250214210736.30814-1-vitalyr@opensource.cirrus.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: hda/conexant: Add quirk for HP ProBook 450 G4 mute LED [+ + +]
Author: John Veness <john-linux@pelago.org.uk>
Date:   Mon Feb 17 12:15:50 2025 +0000

    ALSA: hda/conexant: Add quirk for HP ProBook 450 G4 mute LED
    
    commit 6d1f86610f23b0bc334d6506a186f21a98f51392 upstream.
    
    Allows the LED on the dedicated mute button on the HP ProBook 450 G4
    laptop to change colour correctly.
    
    Signed-off-by: John Veness <john-linux@pelago.org.uk>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/2fb55d48-6991-4a42-b591-4c78f2fad8d7@pelago.org.uk
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Fixup ALC225 depop procedure [+ + +]
Author: Kailang Yang <kailang@realtek.com>
Date:   Wed Feb 12 14:40:46 2025 +0800

    ALSA: hda/realtek: Fixup ALC225 depop procedure
    
    [ Upstream commit 174448badb4409491bfba2e6b46f7aa078741c5e ]
    
    Headset MIC will no function when power_save=0.
    
    Fixes: 1fd50509fe14 ("ALSA: hda/realtek: Update ALC225 depop procedure")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=219743
    Signed-off-by: Kailang Yang <kailang@realtek.com>
    Link: https://lore.kernel.org/0474a095ab0044d0939ec4bf4362423d@realtek.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Thu Feb 13 15:45:43 2025 +0800

    ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls()
    
    commit 822b7ec657e99b44b874e052d8540d8b54fe8569 upstream.
    
    Check the return value of snd_ctl_rename_id() in
    snd_hda_create_dig_out_ctls(). Ensure that failures
    are properly handled.
    
    [ Note: the error cannot happen practically because the only error
      condition in snd_ctl_rename_id() is the missing ID, but this is a
      rename, hence it must be present.  But for the code consistency,
      it's safer to have always the proper return check -- tiwai ]
    
    Fixes: 5c219a340850 ("ALSA: hda: Fix kctl->id initialization")
    Cc: stable@vger.kernel.org # 6.4+
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Link: https://patch.msgid.link/20250213074543.1620-1-vulab@iscas.ac.cn
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Avoid dropping MIDI events at closing multiple ports [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Feb 18 12:40:24 2025 +0100

    ALSA: usb-audio: Avoid dropping MIDI events at closing multiple ports
    
    [ Upstream commit a3bdd8f5c2217e1cb35db02c2eed36ea20fb50f5 ]
    
    We fixed the UAF issue in USB MIDI code by canceling the pending work
    at closing each MIDI output device in the commit below.  However, this
    assumed that it's the only one that is tied with the endpoint, and it
    resulted in unexpected data truncations when multiple devices are
    assigned to a single endpoint and opened simultaneously.
    
    For addressing the unexpected MIDI message drops, simply replace
    cancel_work_sync() with flush_work().  The drain callback should have
    been already invoked before the close callback, hence the port->active
    flag must be already cleared.  So this just assures that the pending
    work is finished before freeing the resources.
    
    Fixes: 0125de38122f ("ALSA: usb-audio: Cancel pending work at closing a MIDI substream")
    Reported-and-tested-by: John Keeping <jkeeping@inmusicbrands.com>
    Closes: https://lore.kernel.org/20250217111647.3368132-1-jkeeping@inmusicbrands.com
    Link: https://patch.msgid.link/20250218114024.23125-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: usb-audio: Re-add sample rate quirk for Pioneer DJM-900NXS2 [+ + +]
Author: Dmitry Panchenko <dmitry@d-systems.ee>
Date:   Thu Feb 20 18:15:37 2025 +0200

    ALSA: usb-audio: Re-add sample rate quirk for Pioneer DJM-900NXS2
    
    commit 9af3b4f2d879da01192d6168e6c651e7fb5b652d upstream.
    
    Re-add the sample-rate quirk for the Pioneer DJM-900NXS2. This
    device does not work without setting sample-rate.
    
    Signed-off-by: Dmitry Panchenko <dmitry@d-systems.ee>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20250220161540.3624660-1-dmitry@d-systems.ee
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
amdgpu/pm/legacy: fix suspend/resume issues [+ + +]
Author: chr[] <chris@rudorff.com>
Date:   Wed Feb 12 16:51:38 2025 +0100

    amdgpu/pm/legacy: fix suspend/resume issues
    
    commit 91dcc66b34beb72dde8412421bdc1b4cd40e4fb8 upstream.
    
    resume and irq handler happily races in set_power_state()
    
    * amdgpu_legacy_dpm_compute_clocks() needs lock
    * protect irq work handler
    * fix dpm_enabled usage
    
    v2: fix clang build, integrate Lijo's comments (Alex)
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2524
    Fixes: 3712e7a49459 ("drm/amd/pm: unified lock protections in amdgpu_dpm.c")
    Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
    Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> # on Oland PRO
    Signed-off-by: chr[] <chris@rudorff.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit ee3dc9e204d271c9c7a8d4d38a0bce4745d33e71)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64: dts: mediatek: mt8183: Disable DSI display output by default [+ + +]
Author: Chen-Yu Tsai <wenst@chromium.org>
Date:   Fri Oct 25 15:56:28 2024 +0800

    arm64: dts: mediatek: mt8183: Disable DSI display output by default
    
    [ Upstream commit 26f6e91fa29a58fdc76b47f94f8f6027944a490c ]
    
    Most SoC dtsi files have the display output interfaces disabled by
    default, and only enabled on boards that utilize them. The MT8183
    has it backwards: the display outputs are left enabled by default,
    and only disabled at the board level.
    
    Reverse the situation for the DSI output so that it follows the
    normal scheme. For ease of backporting the DPI output is handled
    in a separate patch.
    
    Fixes: 88ec840270e6 ("arm64: dts: mt8183: Add dsi node")
    Fixes: 19b6403f1e2a ("arm64: dts: mt8183: add mt8183 pumpkin board")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    Reviewed-by: Fei Shao <fshao@chromium.org>
    Link: https://lore.kernel.org/r/20241025075630.3917458-2-wenst@chromium.org
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: dts: qcom: sm8450: Fix CDSP memory length [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Dec 13 15:53:54 2024 +0100

    arm64: dts: qcom: sm8450: Fix CDSP memory length
    
    [ Upstream commit 3751fe2cba2a9fba2204ef62102bc4bb027cec7b ]
    
    The address space in CDSP PAS (Peripheral Authentication Service)
    remoteproc node should point to the QDSP PUB address space
    (QDSP6...SS_PUB) which has a length of 0x10000.  Value of 0x1400000 was
    copied from older DTS, but it does not look accurate at all.
    
    This should have no functional impact on Linux users, because PAS loader
    does not use this address space at all.
    
    Fixes: 1172729576fb ("arm64: dts: qcom: sm8450: Add remoteproc enablers and instances")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20241213-dts-qcom-cdsp-mpss-base-address-v3-5-2e0036fccd8d@linaro.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: dts: qcom: trim addresses to 8 digits [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Tue Nov 15 11:50:46 2022 +0100

    arm64: dts: qcom: trim addresses to 8 digits
    
    [ Upstream commit 22dbcfd6f4a9f7d4391f0aa66d3f46addea4bee9 ]
    
    Hex numbers in addresses and sizes should be rather eight digits, not
    nine.  Drop leading zeros.  No functional change (same DTB).
    
    Suggested-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/20221115105046.95254-1-krzysztof.kozlowski@linaro.org
    Stable-dep-of: 3751fe2cba2a ("arm64: dts: qcom: sm8450: Fix CDSP memory length")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: mte: Do not allow PROT_MTE on MAP_HUGETLB user mappings [+ + +]
Author: Catalin Marinas <catalin.marinas@arm.com>
Date:   Thu Feb 20 15:58:01 2025 +0000

    arm64: mte: Do not allow PROT_MTE on MAP_HUGETLB user mappings
    
    PROT_MTE (memory tagging extensions) is not supported on all user mmap()
    types for various reasons (memory attributes, backing storage, CoW
    handling). The arm64 arch_validate_flags() function checks whether the
    VM_MTE_ALLOWED flag has been set for a vma during mmap(), usually by
    arch_calc_vm_flag_bits().
    
    Linux prior to 6.13 does not support PROT_MTE hugetlb mappings. This was
    added by commit 25c17c4b55de ("hugetlb: arm64: add mte support").
    However, earlier kernels inadvertently set VM_MTE_ALLOWED on
    (MAP_ANONYMOUS | MAP_HUGETLB) mappings by only checking for
    MAP_ANONYMOUS.
    
    Explicitly check MAP_HUGETLB in arch_calc_vm_flag_bits() and avoid
    setting VM_MTE_ALLOWED for such mappings.
    
    Fixes: 9f3419315f3c ("arm64: mte: Add PROT_MTE support to mmap() and mprotect()")
    Cc: <stable@vger.kernel.org> # 5.10.x-6.12.x
    Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
arp: switch to dev_getbyhwaddr() in arp_req_set_public() [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Tue Feb 18 05:49:31 2025 -0800

    arp: switch to dev_getbyhwaddr() in arp_req_set_public()
    
    [ Upstream commit 4eae0ee0f1e6256d0b0b9dd6e72f1d9cf8f72e08 ]
    
    The arp_req_set_public() function is called with the rtnl lock held,
    which provides enough synchronization protection. This makes the RCU
    variant of dev_getbyhwaddr() unnecessary. Switch to using the simpler
    dev_getbyhwaddr() function since we already have the required rtnl
    locking.
    
    This change helps maintain consistency in the networking code by using
    the appropriate helper function for the existing locking context.
    Since we're not holding the RCU read lock in arp_req_set_public()
    existing code could trigger false positive locking warnings.
    
    Fixes: 941666c2e3e0 ("net: RCU conversion of dev_getbyhwaddr() and arp_ioctl()")
    Suggested-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Link: https://patch.msgid.link/20250218-arm_fix_selftest-v5-2-d3d6892db9e1@debian.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ASoC: es8328: fix route from DAC to output [+ + +]
Author: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Date:   Sat Feb 22 20:39:57 2025 +0100

    ASoC: es8328: fix route from DAC to output
    
    [ Upstream commit 5b0c02f9b8acf2a791e531bbc09acae2d51f4f9b ]
    
    The ES8328 codec driver, which is also used for the ES8388 chip that
    appears to have an identical register map, claims that the output can
    either take the route from DAC->Mixer->Output or through DAC->Output
    directly. To the best of what I could find, this is not true, and
    creates problems.
    
    Without DACCONTROL17 bit index 7 set for the left channel, as well as
    DACCONTROL20 bit index 7 set for the right channel, I cannot get any
    analog audio out on Left Out 2 and Right Out 2 respectively, despite the
    DAPM routes claiming that this should be possible. Furthermore, the same
    is the case for Left Out 1 and Right Out 1, showing that those two don't
    have a direct route from DAC to output bypassing the mixer either.
    
    Those control bits toggle whether the DACs are fed (stale bread?) into
    their respective mixers. If one "unmutes" the mixer controls in
    alsamixer, then sure, the audio output works, but if it doesn't work
    without the mixer being fed the DAC input then evidently it's not a
    direct output from the DAC.
    
    ES8328/ES8388 are seemingly not alone in this. ES8323, which uses a
    separate driver for what appears to be a very similar register map,
    simply flips those two bits on in its probe function, and then pretends
    there is no power management whatsoever for the individual controls.
    Fair enough.
    
    My theory as to why nobody has noticed this up to this point is that
    everyone just assumes it's their fault when they had to unmute an
    additional control in ALSA.
    
    Fix this in the es8328 driver by removing the erroneous direct route,
    then get rid of the playback switch controls and have those bits tied to
    the mixer's widget instead, which until now had no register to play
    with.
    
    Fixes: 567e4f98922c ("ASoC: add es8328 codec driver")
    Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
    Link: https://patch.msgid.link/20250222-es8328-route-bludgeoning-v1-1-99bfb7fb22d9@collabora.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: fsl_micfil: Enable default case in micfil_set_quality() [+ + +]
Author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Date:   Thu Jan 16 06:24:36 2025 -0800

    ASoC: fsl_micfil: Enable default case in micfil_set_quality()
    
    commit a8c9a453387640dbe45761970f41301a6985e7fa upstream.
    
    If 'micfil->quality' received from micfil_quality_set() somehow ends
    up with an unpredictable value, switch() operator will fail to
    initialize local variable qsel before regmap_update_bits() tries
    to utilize it.
    
    While it is unlikely, play it safe and enable a default case that
    returns -EINVAL error.
    
    Found by Linux Verification Center (linuxtesting.org) with static
    analysis tool SVACE.
    
    Fixes: bea1d61d5892 ("ASoC: fsl_micfil: rework quality setting")
    Cc: stable@vger.kernel.org
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
    Link: https://patch.msgid.link/20250116142436.22389-1-n.zhandarovich@fintech.ru
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: renesas: rz-ssi: Add a check for negative sample_space [+ + +]
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed Jan 8 12:28:46 2025 +0300

    ASoC: renesas: rz-ssi: Add a check for negative sample_space
    
    [ Upstream commit 82a0a3e6f8c02b3236b55e784a083fa4ee07c321 ]
    
    My static checker rule complains about this code.  The concern is that
    if "sample_space" is negative then the "sample_space >= runtime->channels"
    condition will not work as intended because it will be type promoted to a
    high unsigned int value.
    
    strm->fifo_sample_size is SSI_FIFO_DEPTH (32).  The SSIFSR_TDC_MASK is
    0x3f.  Without any further context it does seem like a reasonable warning
    and it can't hurt to add a check for negatives.
    
    Cc: stable@vger.kernel.org
    Fixes: 03e786bd4341 ("ASoC: sh: Add RZ/G2L SSIF-2 driver")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Link: https://patch.msgid.link/e07c3dc5-d885-4b04-a742-71f42243f4fd@stanley.mountain
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: rockchip: i2s-tdm: fix shift config for SND_SOC_DAIFMT_DSP_[AB] [+ + +]
Author: John Keeping <jkeeping@inmusicbrands.com>
Date:   Tue Feb 4 16:13:10 2025 +0000

    ASoC: rockchip: i2s-tdm: fix shift config for SND_SOC_DAIFMT_DSP_[AB]
    
    [ Upstream commit 6b24e67b4056ba83b1e95e005b7e50fdb1cc6cf4 ]
    
    Commit 2f45a4e289779 ("ASoC: rockchip: i2s_tdm: Fixup config for
    SND_SOC_DAIFMT_DSP_A/B") applied a partial change to fix the
    configuration for DSP A and DSP B formats.
    
    The shift control also needs updating to set the correct offset for
    frame data compared to LRCK.  Set the correct values.
    
    Fixes: 081068fd64140 ("ASoC: rockchip: add support for i2s-tdm controller")
    Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
    Link: https://patch.msgid.link/20250204161311.2117240-1-jkeeping@inmusicbrands.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
block, bfq: fix bfqq uaf in bfq_limit_depth() [+ + +]
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Fri Nov 29 17:15:09 2024 +0800

    block, bfq: fix bfqq uaf in bfq_limit_depth()
    
    commit e8b8344de3980709080d86c157d24e7de07d70ad upstream.
    
    Set new allocated bfqq to bic or remove freed bfqq from bic are both
    protected by bfqd->lock, however bfq_limit_depth() is deferencing bfqq
    from bic without the lock, this can lead to UAF if the io_context is
    shared by multiple tasks.
    
    For example, test bfq with io_uring can trigger following UAF in v6.6:
    
    ==================================================================
    BUG: KASAN: slab-use-after-free in bfqq_group+0x15/0x50
    
    Call Trace:
     <TASK>
     dump_stack_lvl+0x47/0x80
     print_address_description.constprop.0+0x66/0x300
     print_report+0x3e/0x70
     kasan_report+0xb4/0xf0
     bfqq_group+0x15/0x50
     bfqq_request_over_limit+0x130/0x9a0
     bfq_limit_depth+0x1b5/0x480
     __blk_mq_alloc_requests+0x2b5/0xa00
     blk_mq_get_new_requests+0x11d/0x1d0
     blk_mq_submit_bio+0x286/0xb00
     submit_bio_noacct_nocheck+0x331/0x400
     __block_write_full_folio+0x3d0/0x640
     writepage_cb+0x3b/0xc0
     write_cache_pages+0x254/0x6c0
     write_cache_pages+0x254/0x6c0
     do_writepages+0x192/0x310
     filemap_fdatawrite_wbc+0x95/0xc0
     __filemap_fdatawrite_range+0x99/0xd0
     filemap_write_and_wait_range.part.0+0x4d/0xa0
     blkdev_read_iter+0xef/0x1e0
     io_read+0x1b6/0x8a0
     io_issue_sqe+0x87/0x300
     io_wq_submit_work+0xeb/0x390
     io_worker_handle_work+0x24d/0x550
     io_wq_worker+0x27f/0x6c0
     ret_from_fork_asm+0x1b/0x30
     </TASK>
    
    Allocated by task 808602:
     kasan_save_stack+0x1e/0x40
     kasan_set_track+0x21/0x30
     __kasan_slab_alloc+0x83/0x90
     kmem_cache_alloc_node+0x1b1/0x6d0
     bfq_get_queue+0x138/0xfa0
     bfq_get_bfqq_handle_split+0xe3/0x2c0
     bfq_init_rq+0x196/0xbb0
     bfq_insert_request.isra.0+0xb5/0x480
     bfq_insert_requests+0x156/0x180
     blk_mq_insert_request+0x15d/0x440
     blk_mq_submit_bio+0x8a4/0xb00
     submit_bio_noacct_nocheck+0x331/0x400
     __blkdev_direct_IO_async+0x2dd/0x330
     blkdev_write_iter+0x39a/0x450
     io_write+0x22a/0x840
     io_issue_sqe+0x87/0x300
     io_wq_submit_work+0xeb/0x390
     io_worker_handle_work+0x24d/0x550
     io_wq_worker+0x27f/0x6c0
     ret_from_fork+0x2d/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Freed by task 808589:
     kasan_save_stack+0x1e/0x40
     kasan_set_track+0x21/0x30
     kasan_save_free_info+0x27/0x40
     __kasan_slab_free+0x126/0x1b0
     kmem_cache_free+0x10c/0x750
     bfq_put_queue+0x2dd/0x770
     __bfq_insert_request.isra.0+0x155/0x7a0
     bfq_insert_request.isra.0+0x122/0x480
     bfq_insert_requests+0x156/0x180
     blk_mq_dispatch_plug_list+0x528/0x7e0
     blk_mq_flush_plug_list.part.0+0xe5/0x590
     __blk_flush_plug+0x3b/0x90
     blk_finish_plug+0x40/0x60
     do_writepages+0x19d/0x310
     filemap_fdatawrite_wbc+0x95/0xc0
     __filemap_fdatawrite_range+0x99/0xd0
     filemap_write_and_wait_range.part.0+0x4d/0xa0
     blkdev_read_iter+0xef/0x1e0
     io_read+0x1b6/0x8a0
     io_issue_sqe+0x87/0x300
     io_wq_submit_work+0xeb/0x390
     io_worker_handle_work+0x24d/0x550
     io_wq_worker+0x27f/0x6c0
     ret_from_fork+0x2d/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Fix the problem by protecting bic_to_bfqq() with bfqd->lock.
    
    CC: Jan Kara <jack@suse.cz>
    Fixes: 76f1df88bbc2 ("bfq: Limit number of requests consumed by each cgroup")
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Link: https://lore.kernel.org/r/20241129091509.2227136-1-yukuai1@huaweicloud.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

block, bfq: split sync bfq_queues on a per-actuator basis [+ + +]
Author: Paolo Valente <paolo.valente@linaro.org>
Date:   Tue Jan 3 15:54:56 2023 +0100

    block, bfq: split sync bfq_queues on a per-actuator basis
    
    commit 9778369a2d6c5ed2b81a04164c4aa9da1bdb193d upstream.
    
    Single-LUN multi-actuator SCSI drives, as well as all multi-actuator
    SATA drives appear as a single device to the I/O subsystem [1].  Yet
    they address commands to different actuators internally, as a function
    of Logical Block Addressing (LBAs). A given sector is reachable by
    only one of the actuators. For example, Seagate’s Serial Advanced
    Technology Attachment (SATA) version contains two actuators and maps
    the lower half of the SATA LBA space to the lower actuator and the
    upper half to the upper actuator.
    
    Evidently, to fully utilize actuators, no actuator must be left idle
    or underutilized while there is pending I/O for it. The block layer
    must somehow control the load of each actuator individually. This
    commit lays the ground for allowing BFQ to provide such a per-actuator
    control.
    
    BFQ associates an I/O-request sync bfq_queue with each process doing
    synchronous I/O, or with a group of processes, in case of queue
    merging. Then BFQ serves one bfq_queue at a time. While in service, a
    bfq_queue is emptied in request-position order. Yet the same process,
    or group of processes, may generate I/O for different actuators. In
    this case, different streams of I/O (each for a different actuator)
    get all inserted into the same sync bfq_queue. So there is basically
    no individual control on when each stream is served, i.e., on when the
    I/O requests of the stream are picked from the bfq_queue and
    dispatched to the drive.
    
    This commit enables BFQ to control the service of each actuator
    individually for synchronous I/O, by simply splitting each sync
    bfq_queue into N queues, one for each actuator. In other words, a sync
    bfq_queue is now associated to a pair (process, actuator). As a
    consequence of this split, the per-queue proportional-share policy
    implemented by BFQ will guarantee that the sync I/O generated for each
    actuator, by each process, receives its fair share of service.
    
    This is just a preparatory patch. If the I/O of the same process
    happens to be sent to different queues, then each of these queues may
    undergo queue merging. To handle this event, the bfq_io_cq data
    structure must be properly extended. In addition, stable merging must
    be disabled to avoid loss of control on individual actuators. Finally,
    also async queues must be split. These issues are described in detail
    and addressed in next commits. As for this commit, although multiple
    per-process bfq_queues are provided, the I/O of each process or group
    of processes is still sent to only one queue, regardless of the
    actuator the I/O is for. The forwarding to distinct bfq_queues will be
    enabled after addressing the above issues.
    
    [1] https://www.linaro.org/blog/budget-fair-queueing-bfq-linux-io-scheduler-optimizations-for-multi-actuator-sata-hard-drives/
    
    Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
    Signed-off-by: Gabriele Felici <felicigb@gmail.com>
    Signed-off-by: Carmine Zaccagnino <carmine@carminezacc.com>
    Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
    Link: https://lore.kernel.org/r/20230103145503.71712-2-paolo.valente@linaro.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Stable-dep-of: e8b8344de398 ("block, bfq: fix bfqq uaf in bfq_limit_depth()")
    [Hagar: needed contextual fixes]
    Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response [+ + +]
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Fri Feb 14 10:30:25 2025 -0500

    Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
    
    [ Upstream commit b25120e1d5f2ebb3db00af557709041f47f7f3d0 ]
    
    L2CAP_ECRED_CONN_RSP needs to respond DCID in the same order received as
    SCID but the order is reversed due to use of list_add which actually
    prepend channels to the list so the response is reversed:
    
    > ACL Data RX: Handle 16 flags 0x02 dlen 26
          LE L2CAP: Enhanced Credit Connection Request (0x17) ident 2 len 18
            PSM: 39 (0x0027)
            MTU: 256
            MPS: 251
            Credits: 65535
            Source CID: 116
            Source CID: 117
            Source CID: 118
            Source CID: 119
            Source CID: 120
    < ACL Data TX: Handle 16 flags 0x00 dlen 26
          LE L2CAP: Enhanced Credit Connection Response (0x18) ident 2 len 18
            MTU: 517
            MPS: 247
            Credits: 3
            Result: Connection successful (0x0000)
            Destination CID: 68
            Destination CID: 67
            Destination CID: 66
            Destination CID: 65
            Destination CID: 64
    
    Also make sure the response don't include channels that are not on
    BT_CONNECT2 since the chan->ident can be set to the same value as in the
    following trace:
    
    < ACL Data TX: Handle 16 flags 0x00 dlen 12
          LE L2CAP: LE Flow Control Credit (0x16) ident 6 len 4
            Source CID: 64
            Credits: 1
    ...
    > ACL Data RX: Handle 16 flags 0x02 dlen 18
          LE L2CAP: Enhanced Credit Connection Request (0x17) ident 6 len 10
            PSM: 39 (0x0027)
            MTU: 517
            MPS: 251
            Credits: 255
            Source CID: 70
    < ACL Data TX: Handle 16 flags 0x00 dlen 20
          LE L2CAP: Enhanced Credit Connection Response (0x18) ident 6 len 12
            MTU: 517
            MPS: 247
            Credits: 3
            Result: Connection successful (0x0000)
            Destination CID: 64
            Destination CID: 68
    
    Closes: https://github.com/bluez/bluez/issues/1094
    Fixes: 9aa9d9473f15 ("Bluetooth: L2CAP: Fix responding with wrong PDU type")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: qca: Fix poor RF performance for WCN6855 [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Mon Jan 13 22:43:23 2025 +0800

    Bluetooth: qca: Fix poor RF performance for WCN6855
    
    [ Upstream commit a2fad248947d702ed3dcb52b8377c1a3ae201e44 ]
    
    For WCN6855, board ID specific NVM needs to be downloaded once board ID
    is available, but the default NVM is always downloaded currently.
    
    The wrong NVM causes poor RF performance, and effects user experience
    for several types of laptop with WCN6855 on the market.
    
    Fix by downloading board ID specific NVM if board ID is available.
    
    Fixes: 095327fede00 ("Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6855")
    Cc: stable@vger.kernel.org # 6.4
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Steev Klimaszewski <steev@kali.org> #Thinkpad X13s
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: qca: Support downloading board id specific NVM for WCN7850 [+ + +]
Author: Zijun Hu <quic_zijuhu@quicinc.com>
Date:   Wed Apr 17 15:49:34 2024 +0800

    Bluetooth: qca: Support downloading board id specific NVM for WCN7850
    
    [ Upstream commit e41137d8bd1a8e8bab8dcbfe3ec056418db3df18 ]
    
    Download board id specific NVM instead of default for WCN7850 if board id
    is available.
    
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: a2fad248947d ("Bluetooth: qca: Fix poor RF performance for WCN6855")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: qca: Update firmware-name to support board specific nvm [+ + +]
Author: Cheng Jiang <quic_chejiang@quicinc.com>
Date:   Tue Jan 7 17:26:49 2025 +0800

    Bluetooth: qca: Update firmware-name to support board specific nvm
    
    [ Upstream commit a4c5a468c6329bde7dfd46bacff2cbf5f8a8152e ]
    
    Different connectivity boards may be attached to the same platform. For
    example, QCA6698-based boards can support either a two-antenna or
    three-antenna solution, both of which work on the sa8775p-ride platform.
    Due to differences in connectivity boards and variations in RF
    performance from different foundries, different NVM configurations are
    used based on the board ID.
    
    Therefore, in the firmware-name property, if the NVM file has an
    extension, the NVM file will be used. Otherwise, the system will first
    try the .bNN (board ID) file, and if that fails, it will fall back to
    the .bin file.
    
    Possible configurations:
    firmware-name = "QCA6698/hpnv21";
    firmware-name = "QCA6698/hpnv21.bin";
    
    Signed-off-by: Cheng Jiang <quic_chejiang@quicinc.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: a2fad248947d ("Bluetooth: qca: Fix poor RF performance for WCN6855")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf, test_run: Fix use-after-free issue in eth_skb_pkt_type() [+ + +]
Author: Shigeru Yoshida <syoshida@redhat.com>
Date:   Wed Jan 22 00:06:42 2025 +0900

    bpf, test_run: Fix use-after-free issue in eth_skb_pkt_type()
    
    [ Upstream commit 6b3d638ca897e099fa99bd6d02189d3176f80a47 ]
    
    KMSAN reported a use-after-free issue in eth_skb_pkt_type()[1]. The
    cause of the issue was that eth_skb_pkt_type() accessed skb's data
    that didn't contain an Ethernet header. This occurs when
    bpf_prog_test_run_xdp() passes an invalid value as the user_data
    argument to bpf_test_init().
    
    Fix this by returning an error when user_data is less than ETH_HLEN in
    bpf_test_init(). Additionally, remove the check for "if (user_size >
    size)" as it is unnecessary.
    
    [1]
    BUG: KMSAN: use-after-free in eth_skb_pkt_type include/linux/etherdevice.h:627 [inline]
    BUG: KMSAN: use-after-free in eth_type_trans+0x4ee/0x980 net/ethernet/eth.c:165
     eth_skb_pkt_type include/linux/etherdevice.h:627 [inline]
     eth_type_trans+0x4ee/0x980 net/ethernet/eth.c:165
     __xdp_build_skb_from_frame+0x5a8/0xa50 net/core/xdp.c:635
     xdp_recv_frames net/bpf/test_run.c:272 [inline]
     xdp_test_run_batch net/bpf/test_run.c:361 [inline]
     bpf_test_run_xdp_live+0x2954/0x3330 net/bpf/test_run.c:390
     bpf_prog_test_run_xdp+0x148e/0x1b10 net/bpf/test_run.c:1318
     bpf_prog_test_run+0x5b7/0xa30 kernel/bpf/syscall.c:4371
     __sys_bpf+0x6a6/0xe20 kernel/bpf/syscall.c:5777
     __do_sys_bpf kernel/bpf/syscall.c:5866 [inline]
     __se_sys_bpf kernel/bpf/syscall.c:5864 [inline]
     __x64_sys_bpf+0xa4/0xf0 kernel/bpf/syscall.c:5864
     x64_sys_call+0x2ea0/0x3d90 arch/x86/include/generated/asm/syscalls_64.h:322
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xd9/0x1d0 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Uninit was created at:
     free_pages_prepare mm/page_alloc.c:1056 [inline]
     free_unref_page+0x156/0x1320 mm/page_alloc.c:2657
     __free_pages+0xa3/0x1b0 mm/page_alloc.c:4838
     bpf_ringbuf_free kernel/bpf/ringbuf.c:226 [inline]
     ringbuf_map_free+0xff/0x1e0 kernel/bpf/ringbuf.c:235
     bpf_map_free kernel/bpf/syscall.c:838 [inline]
     bpf_map_free_deferred+0x17c/0x310 kernel/bpf/syscall.c:862
     process_one_work kernel/workqueue.c:3229 [inline]
     process_scheduled_works+0xa2b/0x1b60 kernel/workqueue.c:3310
     worker_thread+0xedf/0x1550 kernel/workqueue.c:3391
     kthread+0x535/0x6b0 kernel/kthread.c:389
     ret_from_fork+0x6e/0x90 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
    
    CPU: 1 UID: 0 PID: 17276 Comm: syz.1.16450 Not tainted 6.12.0-05490-g9bb88c659673 #8
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014
    
    Fixes: be3d72a2896c ("bpf: move user_size out of bpf_test_init")
    Reported-by: syzkaller <syzkaller@googlegroups.com>
    Suggested-by: Martin KaFai Lau <martin.lau@linux.dev>
    Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://patch.msgid.link/20250121150643.671650-1-syoshida@redhat.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf: Fix wrong copied_seq calculation [+ + +]
Author: Jiayuan Chen <mrpre@163.com>
Date:   Wed Jan 22 18:09:14 2025 +0800

    bpf: Fix wrong copied_seq calculation
    
    [ Upstream commit 36b62df5683c315ba58c950f1a9c771c796c30ec ]
    
    'sk->copied_seq' was updated in the tcp_eat_skb() function when the action
    of a BPF program was SK_REDIRECT. For other actions, like SK_PASS, the
    update logic for 'sk->copied_seq' was moved to tcp_bpf_recvmsg_parser()
    to ensure the accuracy of the 'fionread' feature.
    
    It works for a single stream_verdict scenario, as it also modified
    sk_data_ready->sk_psock_verdict_data_ready->tcp_read_skb
    to remove updating 'sk->copied_seq'.
    
    However, for programs where both stream_parser and stream_verdict are
    active (strparser purpose), tcp_read_sock() was used instead of
    tcp_read_skb() (sk_data_ready->strp_data_ready->tcp_read_sock).
    tcp_read_sock() now still updates 'sk->copied_seq', leading to duplicate
    updates.
    
    In summary, for strparser + SK_PASS, copied_seq is redundantly calculated
    in both tcp_read_sock() and tcp_bpf_recvmsg_parser().
    
    The issue causes incorrect copied_seq calculations, which prevent
    correct data reads from the recv() interface in user-land.
    
    We do not want to add new proto_ops to implement a new version of
    tcp_read_sock, as this would introduce code complexity [1].
    
    We could have added noack and copied_seq to desc, and then called
    ops->read_sock. However, unfortunately, other modules didn’t fully
    initialize desc to zero. So, for now, we are directly calling
    tcp_read_sock_noack() in tcp_bpf.c.
    
    [1]: https://lore.kernel.org/bpf/20241218053408.437295-1-mrpre@163.com
    
    Fixes: e5c6de5fa025 ("bpf, sockmap: Incorrectly handling copied_seq")
    Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
    Signed-off-by: Jiayuan Chen <mrpre@163.com>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Acked-by: John Fastabend <john.fastabend@gmail.com>
    Link: https://patch.msgid.link/20250122100917.49845-3-mrpre@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: skip non exist keys in generic_map_lookup_batch [+ + +]
Author: Yan Zhai <yan@cloudflare.com>
Date:   Sun Feb 9 23:22:35 2025 -0800

    bpf: skip non exist keys in generic_map_lookup_batch
    
    [ Upstream commit 5644c6b50ffee0a56c1e01430a8c88e34decb120 ]
    
    The generic_map_lookup_batch currently returns EINTR if it fails with
    ENOENT and retries several times on bpf_map_copy_value. The next batch
    would start from the same location, presuming it's a transient issue.
    This is incorrect if a map can actually have "holes", i.e.
    "get_next_key" can return a key that does not point to a valid value. At
    least the array of maps type may contain such holes legitly. Right now
    these holes show up, generic batch lookup cannot proceed any more. It
    will always fail with EINTR errors.
    
    Rather, do not retry in generic_map_lookup_batch. If it finds a non
    existing element, skip to the next key. This simple solution comes with
    a price that transient errors may not be recovered, and the iteration
    might cycle back to the first key under parallel deletion. For example,
    Hou Tao <houtao@huaweicloud.com> pointed out a following scenario:
    
    For LPM trie map:
    (1) ->map_get_next_key(map, prev_key, key) returns a valid key
    
    (2) bpf_map_copy_value() return -ENOMENT
    It means the key must be deleted concurrently.
    
    (3) goto next_key
    It swaps the prev_key and key
    
    (4) ->map_get_next_key(map, prev_key, key) again
    prev_key points to a non-existing key, for LPM trie it will treat just
    like prev_key=NULL case, the returned key will be duplicated.
    
    With the retry logic, the iteration can continue to the key next to the
    deleted one. But if we directly skip to the next key, the iteration loop
    would restart from the first key for the lpm_trie type.
    
    However, not all races may be recovered. For example, if current key is
    deleted after instead of before bpf_map_copy_value, or if the prev_key
    also gets deleted, then the loop will still restart from the first key
    for lpm_tire anyway. For generic lookup it might be better to stay
    simple, i.e. just skip to the next key. To guarantee that the output
    keys are not duplicated, it is better to implement map type specific
    batch operations, which can properly lock the trie and synchronize with
    concurrent mutators.
    
    Fixes: cb4d03ab499d ("bpf: Add generic support for lookup batch op")
    Closes: https://lore.kernel.org/bpf/Z6JXtA1M5jAZx8xD@debian.debian/
    Signed-off-by: Yan Zhai <yan@cloudflare.com>
    Acked-by: Hou Tao <houtao1@huawei.com>
    Link: https://lore.kernel.org/r/85618439eea75930630685c467ccefeac0942e2b.1739171594.git.yan@cloudflare.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
clk: mediatek: clk-mtk: Add dummy clock ops [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Fri Jan 20 10:20:37 2023 +0100

    clk: mediatek: clk-mtk: Add dummy clock ops
    
    [ Upstream commit b8eb1081d267708ba976525a1fe2162901b34f3a ]
    
    In order to migrate some (few) old clock drivers to the common
    mtk_clk_simple_probe() function, add dummy clock ops to be able
    to insert a dummy clock with ID 0 at the beginning of the list.
    
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Reviewed-by: Miles Chen <miles.chen@mediatek.com>
    Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
    Tested-by: Miles Chen <miles.chen@mediatek.com>
    Link: https://lore.kernel.org/r/20230120092053.182923-8-angelogioacchino.delregno@collabora.com
    Tested-by: Mingming Su <mingming.su@mediatek.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Stable-dep-of: 7c8746126a4e ("clk: mediatek: mt2701-vdec: fix conversion to mtk_clk_simple_probe")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: mt2701-bdp: add missing dummy clk [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:14:24 2024 +0000

    clk: mediatek: mt2701-bdp: add missing dummy clk
    
    [ Upstream commit fd291adc5e9a4ee6cd91e57f148f3b427f80647b ]
    
    Add dummy clk for index 0 which was missed during the conversion to
    mtk_clk_simple_probe().
    
    Fixes: 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/b8526c882a50f2b158df0eccb4a165956fd8fa13.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: mt2701-img: add missing dummy clk [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:14:48 2024 +0000

    clk: mediatek: mt2701-img: add missing dummy clk
    
    [ Upstream commit 366640868ccb4a7991aebe8442b01340fab218e2 ]
    
    Add dummy clk for index 0 which was missed during the conversion to
    mtk_clk_simple_probe().
    
    Fixes: 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/d677486a5c563fe5c47aa995841adc2aaa183b8a.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

clk: mediatek: mt2701-vdec: fix conversion to mtk_clk_simple_probe [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Sun Dec 15 22:13:49 2024 +0000

    clk: mediatek: mt2701-vdec: fix conversion to mtk_clk_simple_probe
    
    [ Upstream commit 7c8746126a4e256fcf1af9174ee7d92cc3f3bc31 ]
    
    Commit 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to
    simplify driver") broke DT bindings as the highest index was reduced by
    1 because the id count starts from 1 and not from 0.
    
    Fix this, like for other drivers which had the same issue, by adding a
    dummy clk at index 0.
    
    Fixes: 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Link: https://lore.kernel.org/r/b126a5577f3667ef19b1b5feea5e70174084fb03.1734300668.git.daniel@makrotopia.org
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: Disable PSR-SU on eDP panels [+ + +]
Author: Tom Chung <chiahsuan.chung@amd.com>
Date:   Thu Feb 6 11:31:23 2025 +0800

    drm/amd/display: Disable PSR-SU on eDP panels
    
    commit e8863f8b0316d8ee1e7e5291e8f2f72c91ac967d upstream.
    
    [Why]
    PSR-SU may cause some glitching randomly on several panels.
    
    [How]
    Temporarily disable the PSR-SU and fallback to PSR1 for
    all eDP panels.
    
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3388
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Sun peng Li <sunpeng.li@amd.com>
    Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
    Signed-off-by: Roman Li <roman.li@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 6deeefb820d0efb0b36753622fb982d03b37b3ad)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Fix HPD after gpu reset [+ + +]
Author: Roman Li <Roman.Li@amd.com>
Date:   Wed Feb 12 14:49:36 2025 -0500

    drm/amd/display: Fix HPD after gpu reset
    
    commit 4de141b8b1b7991b607f77e5f4580e1c67c24717 upstream.
    
    [Why]
    DC is not using amdgpu_irq_get/put to manage the HPD interrupt refcounts.
    So when amdgpu_irq_gpu_reset_resume_helper() reprograms all of the IRQs,
    HPD gets disabled.
    
    [How]
    Use amdgpu_irq_get/put() for HPD init/fini in DM in order to sync refcounts
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Roman Li <Roman.Li@amd.com>
    Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit f3dde2ff7fcaacd77884502e8f572f2328e9c745)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: fixed integer types and null check locations [+ + +]
Author: Sohaib Nadeem <sohaib.nadeem@amd.com>
Date:   Wed Jan 31 16:40:37 2024 -0500

    drm/amd/display: fixed integer types and null check locations
    
    commit 0484e05d048b66d01d1f3c1d2306010bb57d8738 upstream.
    
    [why]:
    issues fixed:
    - comparison with wider integer type in loop condition which can cause
    infinite loops
    - pointer dereference before null check
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Josip Pavic <josip.pavic@amd.com>
    Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Sohaib Nadeem <sohaib.nadeem@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    [ delete changes made in drivers/gpu/drm/amd/display/dc/link/link_validation.c
      for this file is not present in linux-6.1.y  ]
    Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
    Signed-off-by: He Zhe <zhe.he@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/i915: Make sure all planes in use by the joiner have their crtc included [+ + +]
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Wed Feb 12 18:43:21 2025 +0200

    drm/i915: Make sure all planes in use by the joiner have their crtc included
    
    commit 07fb70d82e0df085980246bf17bc12537588795f upstream.
    
    Any active plane needs to have its crtc included in the atomic
    state. For planes enabled via uapi that is all handler in the core.
    But when we use a plane for joiner the uapi code things the plane
    is disabled and therefore doesn't have a crtc. So we need to pull
    those in by hand. We do it first thing in
    intel_joiner_add_affected_crtcs() so that any newly added crtc will
    subsequently pull in all of its joined crtcs as well.
    
    The symptoms from failing to do this are:
    - duct tape in the form of commit 1d5b09f8daf8 ("drm/i915: Fix NULL
      ptr deref by checking new_crtc_state")
    - the plane's hw state will get overwritten by the disabled
      uapi state if it can't find the uapi counterpart plane in
      the atomic state from where it should copy the correct state
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250212164330.16891-2-ville.syrjala@linux.intel.com
    (cherry picked from commit 91077d1deb5374eb8be00fb391710f00e751dc4b)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/msm/dpu: Disable dither in phys encoder cleanup [+ + +]
Author: Jessica Zhang <quic_jesszhan@quicinc.com>
Date:   Tue Feb 11 19:59:19 2025 -0800

    drm/msm/dpu: Disable dither in phys encoder cleanup
    
    commit f063ac6b55df03ed25996bdc84d9e1c50147cfa1 upstream.
    
    Disable pingpong dither in dpu_encoder_helper_phys_cleanup().
    
    This avoids the issue where an encoder unknowingly uses dither after
    reserving a pingpong block that was previously bound to an encoder that
    had enabled dither.
    
    Cc: stable@vger.kernel.org
    Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Closes: https://lore.kernel.org/all/jr7zbj5w7iq4apg3gofuvcwf4r2swzqjk7sshwcdjll4mn6ctt@l2n3qfpujg3q/
    Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Fixes: 3c128638a07d ("drm/msm/dpu: add support for dither block in display")
    Patchwork: https://patchwork.freedesktop.org/patch/636517/
    Link: https://lore.kernel.org/r/20250211-dither-disable-v1-1-ac2cb455f6b9@quicinc.com
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/msm/dpu: Don't leak bits_per_component into random DSC_ENC fields [+ + +]
Author: Marijn Suijten <marijn.suijten@somainline.org>
Date:   Tue Feb 11 00:19:32 2025 +0100

    drm/msm/dpu: Don't leak bits_per_component into random DSC_ENC fields
    
    [ Upstream commit 144429831f447223253a0e4376489f84ff37d1a7 ]
    
    What used to be the input_10_bits boolean - feeding into the lowest
    bit of DSC_ENC - on MSM downstream turned into an accidental OR with
    the full bits_per_component number when it was ported to the upstream
    kernel.
    
    On typical bpc=8 setups we don't notice this because line_buf_depth is
    always an odd value (it contains bpc+1) and will also set the 4th bit
    after left-shifting by 3 (hence this |= bits_per_component is a no-op).
    
    Now that guards are being removed to allow more bits_per_component
    values besides 8 (possible since commit 49fd30a7153b ("drm/msm/dsi: use
    DRM DSC helpers for DSC setup")), a bpc of 10 will instead clash with
    the 5th bit which is convert_rgb.  This is "fortunately" also always set
    to true by MSM's dsi_populate_dsc_params() already, but once a bpc of 12
    starts being used it'll write into simple_422 which is normally false.
    
    To solve all these overlaps, simply replicate downstream code and only
    set this lowest bit if bits_per_component is equal to 10.  It is unclear
    why DSC requires this only for bpc=10 but not bpc=12, and also notice
    that this lowest bit wasn't set previously despite having a panel and
    patch on the list using it without any mentioned issues.
    
    Fixes: c110cfd1753e ("drm/msm/disp/dpu1: Add support for DSC")
    Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
    Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Patchwork: https://patchwork.freedesktop.org/patch/636311/
    Link: https://lore.kernel.org/r/20250211-dsc-10-bit-v1-1-1c85a9430d9a@somainline.org
    Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/rcar-du: dsi: Fix PHY lock bit check [+ + +]
Author: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Date:   Tue Dec 17 07:31:35 2024 +0200

    drm/rcar-du: dsi: Fix PHY lock bit check
    
    [ Upstream commit 6389e616fae8a101ce00068f7690461ab57b29d8 ]
    
    The driver checks for bit 16 (using CLOCKSET1_LOCK define) in CLOCKSET1
    register when waiting for the PPI clock. However, the right bit to check
    is bit 17 (CLOCKSET1_LOCK_PHY define). Not only that, but there's
    nothing in the documents for bit 16 for V3U nor V4H.
    
    So, fix the check to use bit 17, and drop the define for bit 16.
    
    Fixes: 155358310f01 ("drm: rcar-du: Add R-Car DSI driver")
    Fixes: 11696c5e8924 ("drm: Place Renesas drivers in a separate dir")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241217-rcar-gh-dsi-v5-1-e77421093c05@ideasonboard.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/tidss: Add simple K2G manual reset [+ + +]
Author: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date:   Thu Nov 9 09:38:00 2023 +0200

    drm/tidss: Add simple K2G manual reset
    
    [ Upstream commit 576d96c5c896221b5bc8feae473739469a92e144 ]
    
    K2G display controller does not support soft reset, but we can do the
    most important steps manually: mask the IRQs and disable the VPs.
    
    Reviewed-by: Aradhya Bhatia <a-bhatia1@ti.com>
    Link: https://lore.kernel.org/r/20231109-tidss-probe-v2-7-ac91b5ea35c0@ideasonboard.com
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Stable-dep-of: a9a73f2661e6 ("drm/tidss: Fix race condition while handling interrupt registers")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/tidss: Fix race condition while handling interrupt registers [+ + +]
Author: Devarsh Thakkar <devarsht@ti.com>
Date:   Mon Oct 21 17:07:50 2024 +0300

    drm/tidss: Fix race condition while handling interrupt registers
    
    [ Upstream commit a9a73f2661e6f625d306c9b0ef082e4593f45a21 ]
    
    The driver has a spinlock for protecting the irq_masks field and irq
    enable registers. However, the driver misses protecting the irq status
    registers which can lead to races.
    
    Take the spinlock when accessing irqstatus too.
    
    Fixes: 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")
    Cc: stable@vger.kernel.org
    Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
    [Tomi: updated the desc]
    Reviewed-by: Jonathan Cormier <jcormier@criticallink.com>
    Tested-by: Jonathan Cormier <jcormier@criticallink.com>
    Reviewed-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241021-tidss-irq-fix-v1-6-82ddaec94e4a@ideasonboard.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drop_monitor: fix incorrect initialization order [+ + +]
Author: Gavrilov Ilia <Ilia.Gavrilov@infotecs.ru>
Date:   Thu Feb 13 15:20:55 2025 +0000

    drop_monitor: fix incorrect initialization order
    
    commit 07b598c0e6f06a0f254c88dafb4ad50f8a8c6eea upstream.
    
    Syzkaller reports the following bug:
    
    BUG: spinlock bad magic on CPU#1, syz-executor.0/7995
     lock: 0xffff88805303f3e0, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
    CPU: 1 PID: 7995 Comm: syz-executor.0 Tainted: G            E     5.10.209+ #1
    Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11/12/2020
    Call Trace:
     __dump_stack lib/dump_stack.c:77 [inline]
     dump_stack+0x119/0x179 lib/dump_stack.c:118
     debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
     do_raw_spin_lock+0x1f6/0x270 kernel/locking/spinlock_debug.c:112
     __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:117 [inline]
     _raw_spin_lock_irqsave+0x50/0x70 kernel/locking/spinlock.c:159
     reset_per_cpu_data+0xe6/0x240 [drop_monitor]
     net_dm_cmd_trace+0x43d/0x17a0 [drop_monitor]
     genl_family_rcv_msg_doit+0x22f/0x330 net/netlink/genetlink.c:739
     genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]
     genl_rcv_msg+0x341/0x5a0 net/netlink/genetlink.c:800
     netlink_rcv_skb+0x14d/0x440 net/netlink/af_netlink.c:2497
     genl_rcv+0x29/0x40 net/netlink/genetlink.c:811
     netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
     netlink_unicast+0x54b/0x800 net/netlink/af_netlink.c:1348
     netlink_sendmsg+0x914/0xe00 net/netlink/af_netlink.c:1916
     sock_sendmsg_nosec net/socket.c:651 [inline]
     __sock_sendmsg+0x157/0x190 net/socket.c:663
     ____sys_sendmsg+0x712/0x870 net/socket.c:2378
     ___sys_sendmsg+0xf8/0x170 net/socket.c:2432
     __sys_sendmsg+0xea/0x1b0 net/socket.c:2461
     do_syscall_64+0x30/0x40 arch/x86/entry/common.c:46
     entry_SYSCALL_64_after_hwframe+0x62/0xc7
    RIP: 0033:0x7f3f9815aee9
    Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007f3f972bf0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
    RAX: ffffffffffffffda RBX: 00007f3f9826d050 RCX: 00007f3f9815aee9
    RDX: 0000000020000000 RSI: 0000000020001300 RDI: 0000000000000007
    RBP: 00007f3f981b63bd R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    R13: 000000000000006e R14: 00007f3f9826d050 R15: 00007ffe01ee6768
    
    If drop_monitor is built as a kernel module, syzkaller may have time
    to send a netlink NET_DM_CMD_START message during the module loading.
    This will call the net_dm_monitor_start() function that uses
    a spinlock that has not yet been initialized.
    
    To fix this, let's place resource initialization above the registration
    of a generic netlink family.
    
    Found by InfoTeCS on behalf of Linux Verification Center
    (linuxtesting.org) with Syzkaller.
    
    Fixes: 9a8afc8d3962 ("Network Drop Monitor: Adding drop monitor implementation & Netlink protocol")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ilia Gavrilov <Ilia.Gavrilov@infotecs.ru>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20250213152054.2785669-1-Ilia.Gavrilov@infotecs.ru
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
EDAC/qcom: Correct interrupt enable register configuration [+ + +]
Author: Komal Bajaj <quic_kbajaj@quicinc.com>
Date:   Tue Nov 19 12:16:08 2024 +0530

    EDAC/qcom: Correct interrupt enable register configuration
    
    commit c158647c107358bf1be579f98e4bb705c1953292 upstream.
    
    The previous implementation incorrectly configured the cmn_interrupt_2_enable
    register for interrupt handling. Using cmn_interrupt_2_enable to configure
    Tag, Data RAM ECC interrupts would lead to issues like double handling of the
    interrupts (EL1 and EL3) as cmn_interrupt_2_enable is meant to be configured
    for interrupts which needs to be handled by EL3.
    
    EL1 LLCC EDAC driver needs to use cmn_interrupt_0_enable register to configure
    Tag, Data RAM ECC interrupts instead of cmn_interrupt_2_enable.
    
    Fixes: 27450653f1db ("drivers: edac: Add EDAC driver support for QCOM SoCs")
    Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Cc: <stable@kernel.org>
    Link: https://lore.kernel.org/r/20241119064608.12326-1-quic_kbajaj@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
flow_dissector: Fix handling of mixed port and port-range keys [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Mon Feb 17 20:32:07 2025 -0800

    flow_dissector: Fix handling of mixed port and port-range keys
    
    [ Upstream commit 3e5796862c692ea608d96f0a1437f9290f44953a ]
    
    This patch fixes a bug in TC flower filter where rules combining a
    specific destination port with a source port range weren't working
    correctly.
    
    The specific case was when users tried to configure rules like:
    
    tc filter add dev ens38 ingress protocol ip flower ip_proto udp \
    dst_port 5000 src_port 2000-3000 action drop
    
    The root cause was in the flow dissector code. While both
    FLOW_DISSECTOR_KEY_PORTS and FLOW_DISSECTOR_KEY_PORTS_RANGE flags
    were being set correctly in the classifier, the __skb_flow_dissect_ports()
    function was only populating one of them: whichever came first in
    the enum check. This meant that when the code needed both a specific
    port and a port range, one of them would be left as 0, causing the
    filter to not match packets as expected.
    
    Fix it by removing the either/or logic and instead checking and
    populating both key types independently when they're in use.
    
    Fixes: 8ffb055beae5 ("cls_flower: Fix the behavior using port ranges with hw-offload")
    Reported-by: Qiang Zhang <dtzq01@gmail.com>
    Closes: https://lore.kernel.org/netdev/CAPx+-5uvFxkhkz4=j_Xuwkezjn9U6kzKTD5jz4tZ9msSJ0fOJA@mail.gmail.com/
    Cc: Yoshiki Komachi <komachi.yoshiki@gmail.com>
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Jiri Pirko <jiri@resnulli.us>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20250218043210.732959-2-xiyou.wangcong@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

flow_dissector: Fix port range key handling in BPF conversion [+ + +]
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Mon Feb 17 20:32:09 2025 -0800

    flow_dissector: Fix port range key handling in BPF conversion
    
    [ Upstream commit 69ab34f705fbfabcace64b5d53bb7a4450fac875 ]
    
    Fix how port range keys are handled in __skb_flow_bpf_to_target() by:
    - Separating PORTS and PORTS_RANGE key handling
    - Using correct key_ports_range structure for range keys
    - Properly initializing both key types independently
    
    This ensures port range information is correctly stored in its dedicated
    structure rather than incorrectly using the regular ports key structure.
    
    Fixes: 59fb9b62fb6c ("flow_dissector: Fix to use new variables for port ranges in bpf hook")
    Reported-by: Qiang Zhang <dtzq01@gmail.com>
    Closes: https://lore.kernel.org/netdev/CAPx+-5uvFxkhkz4=j_Xuwkezjn9U6kzKTD5jz4tZ9msSJ0fOJA@mail.gmail.com/
    Cc: Yoshiki Komachi <komachi.yoshiki@gmail.com>
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Jiri Pirko <jiri@resnulli.us>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Link: https://patch.msgid.link/20250218043210.732959-4-xiyou.wangcong@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ftrace: Avoid potential division by zero in function_stat_show() [+ + +]
Author: Nikolay Kuratov <kniv@yandex-team.ru>
Date:   Thu Feb 6 12:01:56 2025 +0300

    ftrace: Avoid potential division by zero in function_stat_show()
    
    commit a1a7eb89ca0b89dc1c326eeee2596f263291aca3 upstream.
    
    Check whether denominator expression x * (x - 1) * 1000 mod {2^32, 2^64}
    produce zero and skip stddev computation in that case.
    
    For now don't care about rec->counter * rec->counter overflow because
    rec->time * rec->time overflow will likely happen earlier.
    
    Cc: stable@vger.kernel.org
    Cc: Wen Yang <wenyang@linux.alibaba.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Link: https://lore.kernel.org/20250206090156.1561783-1-kniv@yandex-team.ru
    Fixes: e31f7939c1c27 ("ftrace: Avoid potential division by zero in function profiler")
    Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ftrace: Correct preemption accounting for function tracing. [+ + +]
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Thu Feb 20 15:07:49 2025 +0100

    ftrace: Correct preemption accounting for function tracing.
    
    commit 57b76bedc5c52c66968183b5ef57234894c25ce7 upstream.
    
    The function tracer should record the preemption level at the point when
    the function is invoked. If the tracing subsystem decrement the
    preemption counter it needs to correct this before feeding the data into
    the trace buffer. This was broken in the commit cited below while
    shifting the preempt-disabled section.
    
    Use tracing_gen_ctx_dec() which properly subtracts one from the
    preemption counter on a preemptible kernel.
    
    Cc: stable@vger.kernel.org
    Cc: Wander Lairson Costa <wander@redhat.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/20250220140749.pfw8qoNZ@linutronix.de
    Fixes: ce5e48036c9e7 ("ftrace: disable preemption when recursion locked")
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Tested-by: Wander Lairson Costa <wander@redhat.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ftrace: Do not add duplicate entries in subops manager ops [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Thu Feb 20 15:20:11 2025 -0500

    ftrace: Do not add duplicate entries in subops manager ops
    
    commit 8eb4b09e0bbd30981305643229fe7640ad41b667 upstream.
    
    Check if a function is already in the manager ops of a subops. A manager
    ops contains multiple subops, and if two or more subops are tracing the
    same function, the manager ops only needs a single entry in its hash.
    
    Cc: stable@vger.kernel.org
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Cc: Alexander Gordeev <agordeev@linux.ibm.com>
    Link: https://lore.kernel.org/20250220202055.226762894@goodmis.org
    Fixes: 4f554e955614f ("ftrace: Add ftrace_set_filter_ips function")
    Tested-by: Heiko Carstens <hca@linux.ibm.com>
    Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
geneve: Fix use-after-free in geneve_find_dev(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Thu Feb 13 13:33:54 2025 +0900

    geneve: Fix use-after-free in geneve_find_dev().
    
    [ Upstream commit 9593172d93b9f91c362baec4643003dc29802929 ]
    
    syzkaller reported a use-after-free in geneve_find_dev() [0]
    without repro.
    
    geneve_configure() links struct geneve_dev.next to
    net_generic(net, geneve_net_id)->geneve_list.
    
    The net here could differ from dev_net(dev) if IFLA_NET_NS_PID,
    IFLA_NET_NS_FD, or IFLA_TARGET_NETNSID is set.
    
    When dev_net(dev) is dismantled, geneve_exit_batch_rtnl() finally
    calls unregister_netdevice_queue() for each dev in the netns,
    and later the dev is freed.
    
    However, its geneve_dev.next is still linked to the backend UDP
    socket netns.
    
    Then, use-after-free will occur when another geneve dev is created
    in the netns.
    
    Let's call geneve_dellink() instead in geneve_destroy_tunnels().
    
    [0]:
    BUG: KASAN: slab-use-after-free in geneve_find_dev drivers/net/geneve.c:1295 [inline]
    BUG: KASAN: slab-use-after-free in geneve_configure+0x234/0x858 drivers/net/geneve.c:1343
    Read of size 2 at addr ffff000054d6ee24 by task syz.1.4029/13441
    
    CPU: 1 UID: 0 PID: 13441 Comm: syz.1.4029 Not tainted 6.13.0-g0ad9617c78ac #24 dc35ca22c79fb82e8e7bc5c9c9adafea898b1e3d
    Hardware name: linux,dummy-virt (DT)
    Call trace:
     show_stack+0x38/0x50 arch/arm64/kernel/stacktrace.c:466 (C)
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0xbc/0x108 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:378 [inline]
     print_report+0x16c/0x6f0 mm/kasan/report.c:489
     kasan_report+0xc0/0x120 mm/kasan/report.c:602
     __asan_report_load2_noabort+0x20/0x30 mm/kasan/report_generic.c:379
     geneve_find_dev drivers/net/geneve.c:1295 [inline]
     geneve_configure+0x234/0x858 drivers/net/geneve.c:1343
     geneve_newlink+0xb8/0x128 drivers/net/geneve.c:1634
     rtnl_newlink_create+0x23c/0x868 net/core/rtnetlink.c:3795
     __rtnl_newlink net/core/rtnetlink.c:3906 [inline]
     rtnl_newlink+0x1054/0x1630 net/core/rtnetlink.c:4021
     rtnetlink_rcv_msg+0x61c/0x918 net/core/rtnetlink.c:6911
     netlink_rcv_skb+0x1dc/0x398 net/netlink/af_netlink.c:2543
     rtnetlink_rcv+0x34/0x50 net/core/rtnetlink.c:6938
     netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
     netlink_unicast+0x618/0x838 net/netlink/af_netlink.c:1348
     netlink_sendmsg+0x5fc/0x8b0 net/netlink/af_netlink.c:1892
     sock_sendmsg_nosec net/socket.c:713 [inline]
     __sock_sendmsg net/socket.c:728 [inline]
     ____sys_sendmsg+0x410/0x6f8 net/socket.c:2568
     ___sys_sendmsg+0x178/0x1d8 net/socket.c:2622
     __sys_sendmsg net/socket.c:2654 [inline]
     __do_sys_sendmsg net/socket.c:2659 [inline]
     __se_sys_sendmsg net/socket.c:2657 [inline]
     __arm64_sys_sendmsg+0x12c/0x1c8 net/socket.c:2657
     __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
     invoke_syscall+0x90/0x278 arch/arm64/kernel/syscall.c:49
     el0_svc_common+0x13c/0x250 arch/arm64/kernel/syscall.c:132
     do_el0_svc+0x54/0x70 arch/arm64/kernel/syscall.c:151
     el0_svc+0x4c/0xa8 arch/arm64/kernel/entry-common.c:744
     el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:762
     el0t_64_sync+0x198/0x1a0 arch/arm64/kernel/entry.S:600
    
    Allocated by task 13247:
     kasan_save_stack mm/kasan/common.c:47 [inline]
     kasan_save_track+0x30/0x68 mm/kasan/common.c:68
     kasan_save_alloc_info+0x44/0x58 mm/kasan/generic.c:568
     poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
     __kasan_kmalloc+0x84/0xa0 mm/kasan/common.c:394
     kasan_kmalloc include/linux/kasan.h:260 [inline]
     __do_kmalloc_node mm/slub.c:4298 [inline]
     __kmalloc_node_noprof+0x2a0/0x560 mm/slub.c:4304
     __kvmalloc_node_noprof+0x9c/0x230 mm/util.c:645
     alloc_netdev_mqs+0xb8/0x11a0 net/core/dev.c:11470
     rtnl_create_link+0x2b8/0xb50 net/core/rtnetlink.c:3604
     rtnl_newlink_create+0x19c/0x868 net/core/rtnetlink.c:3780
     __rtnl_newlink net/core/rtnetlink.c:3906 [inline]
     rtnl_newlink+0x1054/0x1630 net/core/rtnetlink.c:4021
     rtnetlink_rcv_msg+0x61c/0x918 net/core/rtnetlink.c:6911
     netlink_rcv_skb+0x1dc/0x398 net/netlink/af_netlink.c:2543
     rtnetlink_rcv+0x34/0x50 net/core/rtnetlink.c:6938
     netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
     netlink_unicast+0x618/0x838 net/netlink/af_netlink.c:1348
     netlink_sendmsg+0x5fc/0x8b0 net/netlink/af_netlink.c:1892
     sock_sendmsg_nosec net/socket.c:713 [inline]
     __sock_sendmsg net/socket.c:728 [inline]
     ____sys_sendmsg+0x410/0x6f8 net/socket.c:2568
     ___sys_sendmsg+0x178/0x1d8 net/socket.c:2622
     __sys_sendmsg net/socket.c:2654 [inline]
     __do_sys_sendmsg net/socket.c:2659 [inline]
     __se_sys_sendmsg net/socket.c:2657 [inline]
     __arm64_sys_sendmsg+0x12c/0x1c8 net/socket.c:2657
     __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
     invoke_syscall+0x90/0x278 arch/arm64/kernel/syscall.c:49
     el0_svc_common+0x13c/0x250 arch/arm64/kernel/syscall.c:132
     do_el0_svc+0x54/0x70 arch/arm64/kernel/syscall.c:151
     el0_svc+0x4c/0xa8 arch/arm64/kernel/entry-common.c:744
     el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:762
     el0t_64_sync+0x198/0x1a0 arch/arm64/kernel/entry.S:600
    
    Freed by task 45:
     kasan_save_stack mm/kasan/common.c:47 [inline]
     kasan_save_track+0x30/0x68 mm/kasan/common.c:68
     kasan_save_free_info+0x58/0x70 mm/kasan/generic.c:582
     poison_slab_object mm/kasan/common.c:247 [inline]
     __kasan_slab_free+0x48/0x68 mm/kasan/common.c:264
     kasan_slab_free include/linux/kasan.h:233 [inline]
     slab_free_hook mm/slub.c:2353 [inline]
     slab_free mm/slub.c:4613 [inline]
     kfree+0x140/0x420 mm/slub.c:4761
     kvfree+0x4c/0x68 mm/util.c:688
     netdev_release+0x94/0xc8 net/core/net-sysfs.c:2065
     device_release+0x98/0x1c0
     kobject_cleanup lib/kobject.c:689 [inline]
     kobject_release lib/kobject.c:720 [inline]
     kref_put include/linux/kref.h:65 [inline]
     kobject_put+0x2b0/0x438 lib/kobject.c:737
     netdev_run_todo+0xe5c/0xfc8 net/core/dev.c:11185
     rtnl_unlock+0x20/0x38 net/core/rtnetlink.c:151
     cleanup_net+0x4fc/0x8c0 net/core/net_namespace.c:648
     process_one_work+0x700/0x1398 kernel/workqueue.c:3236
     process_scheduled_works kernel/workqueue.c:3317 [inline]
     worker_thread+0x8c4/0xe10 kernel/workqueue.c:3398
     kthread+0x4bc/0x608 kernel/kthread.c:464
     ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862
    
    The buggy address belongs to the object at ffff000054d6e000
     which belongs to the cache kmalloc-cg-4k of size 4096
    The buggy address is located 3620 bytes inside of
     freed 4096-byte region [ffff000054d6e000, ffff000054d6f000)
    
    The buggy address belongs to the physical page:
    page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x94d68
    head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
    memcg:ffff000016276181
    flags: 0x3fffe0000000040(head|node=0|zone=0|lastcpupid=0x1ffff)
    page_type: f5(slab)
    raw: 03fffe0000000040 ffff0000c000f500 dead000000000122 0000000000000000
    raw: 0000000000000000 0000000000040004 00000001f5000000 ffff000016276181
    head: 03fffe0000000040 ffff0000c000f500 dead000000000122 0000000000000000
    head: 0000000000000000 0000000000040004 00000001f5000000 ffff000016276181
    head: 03fffe0000000003 fffffdffc1535a01 ffffffffffffffff 0000000000000000
    head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    
    Memory state around the buggy address:
     ffff000054d6ed00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff000054d6ed80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff000054d6ee00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                   ^
     ffff000054d6ee80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ffff000054d6ef00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    
    Fixes: 2d07dc79fe04 ("geneve: add initial netdev driver for GENEVE tunnels")
    Reported-by: syzkaller <syzkaller@googlegroups.com>
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://patch.msgid.link/20250213043354.91368-1-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

geneve: Suppress list corruption splat in geneve_destroy_tunnels(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Mon Feb 17 12:37:05 2025 -0800

    geneve: Suppress list corruption splat in geneve_destroy_tunnels().
    
    [ Upstream commit 62fab6eef61f245dc8797e3a6a5b890ef40e8628 ]
    
    As explained in the previous patch, iterating for_each_netdev() and
    gn->geneve_list during ->exit_batch_rtnl() could trigger ->dellink()
    twice for the same device.
    
    If CONFIG_DEBUG_LIST is enabled, we will see a list_del() corruption
    splat in the 2nd call of geneve_dellink().
    
    Let's remove for_each_netdev() in geneve_destroy_tunnels() and delegate
    that part to default_device_exit_batch().
    
    Fixes: 9593172d93b9 ("geneve: Fix use-after-free in geneve_find_dev().")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://patch.msgid.link/20250217203705.40342-3-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gtp: Suppress list corruption splat in gtp_net_exit_batch_rtnl(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Mon Feb 17 12:37:04 2025 -0800

    gtp: Suppress list corruption splat in gtp_net_exit_batch_rtnl().
    
    [ Upstream commit 4ccacf86491d33d2486b62d4d44864d7101b299d ]
    
    Brad Spengler reported the list_del() corruption splat in
    gtp_net_exit_batch_rtnl(). [0]
    
    Commit eb28fd76c0a0 ("gtp: Destroy device along with udp socket's netns
    dismantle.") added the for_each_netdev() loop in gtp_net_exit_batch_rtnl()
    to destroy devices in each netns as done in geneve and ip tunnels.
    
    However, this could trigger ->dellink() twice for the same device during
    ->exit_batch_rtnl().
    
    Say we have two netns A & B and gtp device B that resides in netns B but
    whose UDP socket is in netns A.
    
      1. cleanup_net() processes netns A and then B.
    
      2. gtp_net_exit_batch_rtnl() finds the device B while iterating
         netns A's gn->gtp_dev_list and calls ->dellink().
    
      [ device B is not yet unlinked from netns B
        as unregister_netdevice_many() has not been called. ]
    
      3. gtp_net_exit_batch_rtnl() finds the device B while iterating
         netns B's for_each_netdev() and calls ->dellink().
    
    gtp_dellink() cleans up the device's hash table, unlinks the dev from
    gn->gtp_dev_list, and calls unregister_netdevice_queue().
    
    Basically, calling gtp_dellink() multiple times is fine unless
    CONFIG_DEBUG_LIST is enabled.
    
    Let's remove for_each_netdev() in gtp_net_exit_batch_rtnl() and
    delegate the destruction to default_device_exit_batch() as done
    in bareudp.
    
    [0]:
    list_del corruption, ffff8880aaa62c00->next (autoslab_size_M_dev_P_net_core_dev_11127_8_1328_8_S_4096_A_64_n_139+0xc00/0x1000 [slab object]) is LIST_POISON1 (ffffffffffffff02) (prev is 0xffffffffffffff04)
    kernel BUG at lib/list_debug.c:58!
    Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN
    CPU: 1 UID: 0 PID: 1804 Comm: kworker/u8:7 Tainted: G                T   6.12.13-grsec-full-20250211091339 #1
    Tainted: [T]=RANDSTRUCT
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
    Workqueue: netns cleanup_net
    RIP: 0010:[<ffffffff84947381>] __list_del_entry_valid_or_report+0x141/0x200 lib/list_debug.c:58
    Code: c2 76 91 31 c0 e8 9f b1 f7 fc 0f 0b 4d 89 f0 48 c7 c1 02 ff ff ff 48 89 ea 48 89 ee 48 c7 c7 e0 c2 76 91 31 c0 e8 7f b1 f7 fc <0f> 0b 4d 89 e8 48 c7 c1 04 ff ff ff 48 89 ea 48 89 ee 48 c7 c7 60
    RSP: 0018:fffffe8040b4fbd0 EFLAGS: 00010283
    RAX: 00000000000000cc RBX: dffffc0000000000 RCX: ffffffff818c4054
    RDX: ffffffff84947381 RSI: ffffffff818d1512 RDI: 0000000000000000
    RBP: ffff8880aaa62c00 R08: 0000000000000001 R09: fffffbd008169f32
    R10: fffffe8040b4f997 R11: 0000000000000001 R12: a1988d84f24943e4
    R13: ffffffffffffff02 R14: ffffffffffffff04 R15: ffff8880aaa62c08
    RBX: kasan shadow of 0x0
    RCX: __wake_up_klogd.part.0+0x74/0xe0 kernel/printk/printk.c:4554
    RDX: __list_del_entry_valid_or_report+0x141/0x200 lib/list_debug.c:58
    RSI: vprintk+0x72/0x100 kernel/printk/printk_safe.c:71
    RBP: autoslab_size_M_dev_P_net_core_dev_11127_8_1328_8_S_4096_A_64_n_139+0xc00/0x1000 [slab object]
    RSP: process kstack fffffe8040b4fbd0+0x7bd0/0x8000 [kworker/u8:7+netns 1804 ]
    R09: kasan shadow of process kstack fffffe8040b4f990+0x7990/0x8000 [kworker/u8:7+netns 1804 ]
    R10: process kstack fffffe8040b4f997+0x7997/0x8000 [kworker/u8:7+netns 1804 ]
    R15: autoslab_size_M_dev_P_net_core_dev_11127_8_1328_8_S_4096_A_64_n_139+0xc08/0x1000 [slab object]
    FS:  0000000000000000(0000) GS:ffff888116000000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000748f5372c000 CR3: 0000000015408000 CR4: 00000000003406f0 shadow CR4: 00000000003406f0
    Stack:
     0000000000000000 ffffffff8a0c35e7 ffffffff8a0c3603 ffff8880aaa62c00
     ffff8880aaa62c00 0000000000000004 ffff88811145311c 0000000000000005
     0000000000000001 ffff8880aaa62000 fffffe8040b4fd40 ffffffff8a0c360d
    Call Trace:
     <TASK>
     [<ffffffff8a0c360d>] __list_del_entry_valid include/linux/list.h:131 [inline] fffffe8040b4fc28
     [<ffffffff8a0c360d>] __list_del_entry include/linux/list.h:248 [inline] fffffe8040b4fc28
     [<ffffffff8a0c360d>] list_del include/linux/list.h:262 [inline] fffffe8040b4fc28
     [<ffffffff8a0c360d>] gtp_dellink+0x16d/0x360 drivers/net/gtp.c:1557 fffffe8040b4fc28
     [<ffffffff8a0d0404>] gtp_net_exit_batch_rtnl+0x124/0x2c0 drivers/net/gtp.c:2495 fffffe8040b4fc88
     [<ffffffff8e705b24>] cleanup_net+0x5a4/0xbe0 net/core/net_namespace.c:635 fffffe8040b4fcd0
     [<ffffffff81754c97>] process_one_work+0xbd7/0x2160 kernel/workqueue.c:3326 fffffe8040b4fd88
     [<ffffffff81757195>] process_scheduled_works kernel/workqueue.c:3407 [inline] fffffe8040b4fec0
     [<ffffffff81757195>] worker_thread+0x6b5/0xfa0 kernel/workqueue.c:3488 fffffe8040b4fec0
     [<ffffffff817782a0>] kthread+0x360/0x4c0 kernel/kthread.c:397 fffffe8040b4ff78
     [<ffffffff814d8594>] ret_from_fork+0x74/0xe0 arch/x86/kernel/process.c:172 fffffe8040b4ffb8
     [<ffffffff8110f509>] ret_from_fork_asm+0x29/0xc0 arch/x86/entry/entry_64.S:399 fffffe8040b4ffe8
     </TASK>
    Modules linked in:
    
    Fixes: eb28fd76c0a0 ("gtp: Destroy device along with udp socket's netns dismantle.")
    Reported-by: Brad Spengler <spender@grsecurity.net>
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://patch.msgid.link/20250217203705.40342-2-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
i2c: npcm: disable interrupt enable bit before devm_request_irq [+ + +]
Author: Tyrone Ting <kfting@nuvoton.com>
Date:   Thu Feb 20 12:00:29 2025 +0800

    i2c: npcm: disable interrupt enable bit before devm_request_irq
    
    commit dd1998e243f5fa25d348a384ba0b6c84d980f2b2 upstream.
    
    The customer reports that there is a soft lockup issue related to
    the i2c driver. After checking, the i2c module was doing a tx transfer
    and the bmc machine reboots in the middle of the i2c transaction, the i2c
    module keeps the status without being reset.
    
    Due to such an i2c module status, the i2c irq handler keeps getting
    triggered since the i2c irq handler is registered in the kernel booting
    process after the bmc machine is doing a warm rebooting.
    The continuous triggering is stopped by the soft lockup watchdog timer.
    
    Disable the interrupt enable bit in the i2c module before calling
    devm_request_irq to fix this issue since the i2c relative status bit
    is read-only.
    
    Here is the soft lockup log.
    [   28.176395] watchdog: BUG: soft lockup - CPU#0 stuck for 26s! [swapper/0:1]
    [   28.183351] Modules linked in:
    [   28.186407] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.120-yocto-s-dirty-bbebc78 #1
    [   28.201174] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [   28.208128] pc : __do_softirq+0xb0/0x368
    [   28.212055] lr : __do_softirq+0x70/0x368
    [   28.215972] sp : ffffff8035ebca00
    [   28.219278] x29: ffffff8035ebca00 x28: 0000000000000002 x27: ffffff80071a3780
    [   28.226412] x26: ffffffc008bdc000 x25: ffffffc008bcc640 x24: ffffffc008be50c0
    [   28.233546] x23: ffffffc00800200c x22: 0000000000000000 x21: 000000000000001b
    [   28.240679] x20: 0000000000000000 x19: ffffff80001c3200 x18: ffffffffffffffff
    [   28.247812] x17: ffffffc02d2e0000 x16: ffffff8035eb8b40 x15: 00001e8480000000
    [   28.254945] x14: 02c3647e37dbfcb6 x13: 02c364f2ab14200c x12: 0000000002c364f2
    [   28.262078] x11: 00000000fa83b2da x10: 000000000000b67e x9 : ffffffc008010250
    [   28.269211] x8 : 000000009d983d00 x7 : 7fffffffffffffff x6 : 0000036d74732434
    [   28.276344] x5 : 00ffffffffffffff x4 : 0000000000000015 x3 : 0000000000000198
    [   28.283476] x2 : ffffffc02d2e0000 x1 : 00000000000000e0 x0 : ffffffc008bdcb40
    [   28.290611] Call trace:
    [   28.293052]  __do_softirq+0xb0/0x368
    [   28.296625]  __irq_exit_rcu+0xe0/0x100
    [   28.300374]  irq_exit+0x14/0x20
    [   28.303513]  handle_domain_irq+0x68/0x90
    [   28.307440]  gic_handle_irq+0x78/0xb0
    [   28.311098]  call_on_irq_stack+0x20/0x38
    [   28.315019]  do_interrupt_handler+0x54/0x5c
    [   28.319199]  el1_interrupt+0x2c/0x4c
    [   28.322777]  el1h_64_irq_handler+0x14/0x20
    [   28.326872]  el1h_64_irq+0x74/0x78
    [   28.330269]  __setup_irq+0x454/0x780
    [   28.333841]  request_threaded_irq+0xd0/0x1b4
    [   28.338107]  devm_request_threaded_irq+0x84/0x100
    [   28.342809]  npcm_i2c_probe_bus+0x188/0x3d0
    [   28.346990]  platform_probe+0x6c/0xc4
    [   28.350653]  really_probe+0xcc/0x45c
    [   28.354227]  __driver_probe_device+0x8c/0x160
    [   28.358578]  driver_probe_device+0x44/0xe0
    [   28.362670]  __driver_attach+0x124/0x1d0
    [   28.366589]  bus_for_each_dev+0x7c/0xe0
    [   28.370426]  driver_attach+0x28/0x30
    [   28.373997]  bus_add_driver+0x124/0x240
    [   28.377830]  driver_register+0x7c/0x124
    [   28.381662]  __platform_driver_register+0x2c/0x34
    [   28.386362]  npcm_i2c_init+0x3c/0x5c
    [   28.389937]  do_one_initcall+0x74/0x230
    [   28.393768]  kernel_init_freeable+0x24c/0x2b4
    [   28.398126]  kernel_init+0x28/0x130
    [   28.401614]  ret_from_fork+0x10/0x20
    [   28.405189] Kernel panic - not syncing: softlockup: hung tasks
    [   28.411011] SMP: stopping secondary CPUs
    [   28.414933] Kernel Offset: disabled
    [   28.418412] CPU features: 0x00000000,00000802
    [   28.427644] Rebooting in 20 seconds..
    
    Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
    Signed-off-by: Tyrone Ting <kfting@nuvoton.com>
    Cc: <stable@vger.kernel.org> # v5.8+
    Reviewed-by: Tali Perry <tali.perry1@gmail.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20250220040029.27596-2-kfting@nuvoton.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
IB/mlx5: Set and get correct qp_num for a DCT QP [+ + +]
Author: Mark Zhang <markzhang@nvidia.com>
Date:   Sun Jan 19 14:39:46 2025 +0200

    IB/mlx5: Set and get correct qp_num for a DCT QP
    
    [ Upstream commit 12d044770e12c4205fa69535b4fa8a9981fea98f ]
    
    When a DCT QP is created on an active lag, it's dctc.port is assigned
    in a round-robin way, which is from 1 to dev->lag_port. In this case
    when querying this QP, we may get qp_attr.port_num > 2.
    Fix this by setting qp->port when modifying a DCT QP, and read port_num
    from qp->port instead of dctc.port when querying it.
    
    Fixes: 7c4b1ab9f167 ("IB/mlx5: Add DCT RoCE LAG support")
    Signed-off-by: Mark Zhang <markzhang@nvidia.com>
    Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
    Link: https://patch.msgid.link/94c76bf0adbea997f87ffa27674e0a7118ad92a9.1737290358.git.leon@kernel.org
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ibmvnic: Add stat for tx direct vs tx batched [+ + +]
Author: Nick Child <nnac123@linux.ibm.com>
Date:   Tue Oct 1 11:35:31 2024 -0500

    ibmvnic: Add stat for tx direct vs tx batched
    
    [ Upstream commit 2ee73c54a615b74d2e7ee6f20844fd3ba63fc485 ]
    
    Allow tracking of packets sent with send_subcrq direct vs
    indirect. `ethtool -S <dev>` will now provide a counter
    of the number of uses of each xmit method. This metric will
    be useful in performance debugging.
    
    Signed-off-by: Nick Child <nnac123@linux.ibm.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241001163531.1803152-1-nnac123@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: bdf5d13aa05e ("ibmvnic: Don't reference skb after sending to VIOS")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ibmvnic: Don't reference skb after sending to VIOS [+ + +]
Author: Nick Child <nnac123@linux.ibm.com>
Date:   Fri Feb 14 09:52:33 2025 -0600

    ibmvnic: Don't reference skb after sending to VIOS
    
    [ Upstream commit bdf5d13aa05ec314d4385b31ac974d6c7e0997c9 ]
    
    Previously, after successfully flushing the xmit buffer to VIOS,
    the tx_bytes stat was incremented by the length of the skb.
    
    It is invalid to access the skb memory after sending the buffer to
    the VIOS because, at any point after sending, the VIOS can trigger
    an interrupt to free this memory. A race between reading skb->len
    and freeing the skb is possible (especially during LPM) and will
    result in use-after-free:
     ==================================================================
     BUG: KASAN: slab-use-after-free in ibmvnic_xmit+0x75c/0x1808 [ibmvnic]
     Read of size 4 at addr c00000024eb48a70 by task hxecom/14495
     <...>
     Call Trace:
     [c000000118f66cf0] [c0000000018cba6c] dump_stack_lvl+0x84/0xe8 (unreliable)
     [c000000118f66d20] [c0000000006f0080] print_report+0x1a8/0x7f0
     [c000000118f66df0] [c0000000006f08f0] kasan_report+0x128/0x1f8
     [c000000118f66f00] [c0000000006f2868] __asan_load4+0xac/0xe0
     [c000000118f66f20] [c0080000046eac84] ibmvnic_xmit+0x75c/0x1808 [ibmvnic]
     [c000000118f67340] [c0000000014be168] dev_hard_start_xmit+0x150/0x358
     <...>
     Freed by task 0:
     kasan_save_stack+0x34/0x68
     kasan_save_track+0x2c/0x50
     kasan_save_free_info+0x64/0x108
     __kasan_mempool_poison_object+0x148/0x2d4
     napi_skb_cache_put+0x5c/0x194
     net_tx_action+0x154/0x5b8
     handle_softirqs+0x20c/0x60c
     do_softirq_own_stack+0x6c/0x88
     <...>
     The buggy address belongs to the object at c00000024eb48a00 which
      belongs to the cache skbuff_head_cache of size 224
    ==================================================================
    
    Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
    Signed-off-by: Nick Child <nnac123@linux.ibm.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250214155233.235559-1-nnac123@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ibmvnic: Introduce send sub-crq direct [+ + +]
Author: Nick Child <nnac123@linux.ibm.com>
Date:   Wed Aug 7 16:18:07 2024 -0500

    ibmvnic: Introduce send sub-crq direct
    
    [ Upstream commit 74839f7a82689bf5a21a5447cae8e3a7b7a606d2 ]
    
    Firmware supports two hcalls to send a sub-crq request:
    H_SEND_SUB_CRQ_INDIRECT and H_SEND_SUB_CRQ. The indirect hcall allows
    for submission of batched messages while the other hcall is limited to
    only one message. This protocol is defined in PAPR section 17.2.3.3.
    
    Previously, the ibmvnic xmit function only used the indirect hcall. This
    allowed the driver to batch it's skbs. A single skb can occupy a few
    entries per hcall depending on if FW requires skb header information or
    not. The FW only needs header information if the packet is segmented.
    
    By this logic, if an skb is not GSO then it can fit in one sub-crq
    message and therefore is a candidate for H_SEND_SUB_CRQ.
    Batching skb transmission is only useful when there are more packets
    coming down the line (ie netdev_xmit_more is true).
    
    As it turns out, H_SEND_SUB_CRQ induces less latency than
    H_SEND_SUB_CRQ_INDIRECT. Therefore, use H_SEND_SUB_CRQ where
    appropriate.
    
    Small latency gains seen when doing TCP_RR_150 (request/response
    workload). Ftrace results (graph-time=1):
      Previous:
         ibmvnic_xmit = 29618270.83 us / 8860058.0 hits = AVG 3.34
         ibmvnic_tx_scrq_flush = 21972231.02 us / 6553972.0 hits = AVG 3.35
      Now:
         ibmvnic_xmit = 22153350.96 us / 8438942.0 hits = AVG 2.63
         ibmvnic_tx_scrq_flush = 15858922.4 us / 6244076.0 hits = AVG 2.54
    
    Signed-off-by: Nick Child <nnac123@linux.ibm.com>
    Link: https://patch.msgid.link/20240807211809.1259563-6-nnac123@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: bdf5d13aa05e ("ibmvnic: Don't reference skb after sending to VIOS")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ibmvnic: Return error code on TX scrq flush fail [+ + +]
Author: Nick Child <nnac123@linux.ibm.com>
Date:   Tue Apr 16 11:41:28 2024 -0500

    ibmvnic: Return error code on TX scrq flush fail
    
    [ Upstream commit 5cb431dcf8048572e9ffc6c30cdbd8832cbe502d ]
    
    In ibmvnic_xmit() if ibmvnic_tx_scrq_flush() returns H_CLOSED then
    it will inform upper level networking functions to disable tx
    queues. H_CLOSED signals that the connection with the vnic server is
    down and a transport event is expected to recover the device.
    
    Previously, ibmvnic_tx_scrq_flush() was hard-coded to return success.
    Therefore, the queues would remain active until ibmvnic_cleanup() is
    called within do_reset().
    
    The problem is that do_reset() depends on the RTNL lock. If several
    ibmvnic devices are resetting then there can be a long wait time until
    the last device can grab the lock. During this time the tx/rx queues
    still appear active to upper level functions.
    
    FYI, we do make a call to netif_carrier_off() outside the RTNL lock but
    its calls to dev_deactivate() are also dependent on the RTNL lock.
    
    As a result, large amounts of retransmissions were observed in a short
    period of time, eventually leading to ETIMEOUT. This was specifically
    seen with HNV devices, likely because of even more RTNL dependencies.
    
    Therefore, ensure the return code of ibmvnic_tx_scrq_flush() is
    propagated to the xmit function to allow for an earlier (and lock-less)
    response to a transport event.
    
    Signed-off-by: Nick Child <nnac123@linux.ibm.com>
    Link: https://lore.kernel.org/r/20240416164128.387920-1-nnac123@linux.ibm.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: bdf5d13aa05e ("ibmvnic: Don't reference skb after sending to VIOS")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
include: net: add static inline dst_dev_overhead() to dst.h [+ + +]
Author: Justin Iurman <justin.iurman@uliege.be>
Date:   Tue Dec 3 13:49:42 2024 +0100

    include: net: add static inline dst_dev_overhead() to dst.h
    
    [ Upstream commit 0600cf40e9b36fe17f9c9f04d4f9cef249eaa5e7 ]
    
    Add static inline dst_dev_overhead() function to include/net/dst.h. This
    helper function is used by ioam6_iptunnel, rpl_iptunnel and
    seg6_iptunnel to get the dev's overhead based on a cache entry
    (dst_entry). If the cache is empty, the default and generic value
    skb->mac_len is returned. Otherwise, LL_RESERVED_SPACE() over dst's dev
    is returned.
    
    Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
    Cc: Alexander Lobakin <aleksander.lobakin@intel.com>
    Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: c64a0727f9b1 ("net: ipv6: fix dst ref loop on input in seg6 lwt")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
intel_idle: Handle older CPUs, which stop the TSC in deeper C states, correctly [+ + +]
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue Feb 25 23:37:08 2025 +0100

    intel_idle: Handle older CPUs, which stop the TSC in deeper C states, correctly
    
    commit c157d351460bcf202970e97e611cb6b54a3dd4a4 upstream.
    
    The Intel idle driver is preferred over the ACPI processor idle driver,
    but fails to implement the work around for Core2 generation CPUs, where
    the TSC stops in C2 and deeper C-states. This causes stalls and boot
    delays, when the clocksource watchdog does not catch the unstable TSC
    before the CPU goes deep idle for the first time.
    
    The ACPI driver marks the TSC unstable when it detects that the CPU
    supports C2 or deeper and the CPU does not have a non-stop TSC.
    
    Add the equivivalent work around to the Intel idle driver to cure that.
    
    Fixes: 18734958e9bf ("intel_idle: Use ACPI _CST for processor models without C-state tables")
    Reported-by: Fab Stz <fabstz-it@yahoo.fr>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: Fab Stz <fabstz-it@yahoo.fr>
    Cc: All applicable <stable@vger.kernel.org>
    Closes: https://lore.kernel.org/all/10cf96aa-1276-4bd4-8966-c890377030c3@yahoo.fr
    Link: https://patch.msgid.link/87bjupfy7f.ffs@tglx
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/net: save msg_control for compat [+ + +]
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Tue Feb 25 15:59:02 2025 +0000

    io_uring/net: save msg_control for compat
    
    [ Upstream commit 6ebf05189dfc6d0d597c99a6448a4d1064439a18 ]
    
    Match the compat part of io_sendmsg_copy_hdr() with its counterpart and
    save msg_control.
    
    Fixes: c55978024d123 ("io_uring/net: move receive multishot out of the generic msghdr path")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/2a8418821fe83d3b64350ad2b3c0303e9b732bbd.1740498502.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipv4: Convert icmp_route_lookup() to dscp_t. [+ + +]
Author: Guillaume Nault <gnault@redhat.com>
Date:   Tue Oct 1 21:28:37 2024 +0200

    ipv4: Convert icmp_route_lookup() to dscp_t.
    
    [ Upstream commit 913c83a610bb7dd8e5952a2b4663e1feec0b5de6 ]
    
    Pass a dscp_t variable to icmp_route_lookup(), instead of a plain u8,
    to prevent accidental setting of ECN bits in ->flowi4_tos. Rename that
    variable ("tos" -> "dscp") to make the intent clear.
    
    While there, reorganise the function parameters to fill up horizontal
    space.
    
    Signed-off-by: Guillaume Nault <gnault@redhat.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Link: https://patch.msgid.link/294fead85c6035bcdc5fcf9a6bb4ce8798c45ba1.1727807926.git.gnault@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 27843ce6ba3d ("ipvlan: ensure network headers are in skb linear part")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipv4: Convert ip_route_input() to dscp_t. [+ + +]
Author: Guillaume Nault <gnault@redhat.com>
Date:   Tue Oct 1 21:28:43 2024 +0200

    ipv4: Convert ip_route_input() to dscp_t.
    
    [ Upstream commit 7e863e5db6185b1add0df4cb01b31a4ed1c4b738 ]
    
    Pass a dscp_t variable to ip_route_input(), instead of a plain u8, to
    prevent accidental setting of ECN bits in ->flowi4_tos.
    
    Callers of ip_route_input() to consider are:
    
      * input_action_end_dx4_finish() and input_action_end_dt4() in
        net/ipv6/seg6_local.c. These functions set the tos parameter to 0,
        which is already a valid dscp_t value, so they don't need to be
        adjusted for the new prototype.
    
      * icmp_route_lookup(), which already has a dscp_t variable to pass as
        parameter. We just need to remove the inet_dscp_to_dsfield()
        conversion.
    
      * br_nf_pre_routing_finish(), ip_options_rcv_srr() and ip4ip6_err(),
        which get the DSCP directly from IPv4 headers. Define a helper to
        read the .tos field of struct iphdr as dscp_t, so that these
        function don't have to do the conversion manually.
    
    While there, declare *iph as const in br_nf_pre_routing_finish(),
    declare its local variables in reverse-christmas-tree order and move
    the "err = ip_route_input()" assignment out of the conditional to avoid
    checkpatch warning.
    
    Signed-off-by: Guillaume Nault <gnault@redhat.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Link: https://patch.msgid.link/e9d40781d64d3d69f4c79ac8a008b8d67a033e8d.1727807926.git.gnault@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 27843ce6ba3d ("ipvlan: ensure network headers are in skb linear part")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipv4: icmp: Pass full DS field to ip_route_input() [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Wed Aug 21 15:52:49 2024 +0300

    ipv4: icmp: Pass full DS field to ip_route_input()
    
    [ Upstream commit 1c6f50b37f711b831d78973dad0df1da99ad0014 ]
    
    Align the ICMP code to other callers of ip_route_input() and pass the
    full DS field. In the future this will allow us to perform a route
    lookup according to the full DSCP value.
    
    No functional changes intended since the upper DSCP bits are masked when
    comparing against the TOS selectors in FIB rules and routes.
    
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Guillaume Nault <gnault@redhat.com>
    Acked-by: Florian Westphal <fw@strlen.de>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Link: https://patch.msgid.link/20240821125251.1571445-11-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 27843ce6ba3d ("ipvlan: ensure network headers are in skb linear part")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipv4: icmp: Unmask upper DSCP bits in icmp_route_lookup() [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Thu Aug 29 09:54:50 2024 +0300

    ipv4: icmp: Unmask upper DSCP bits in icmp_route_lookup()
    
    [ Upstream commit 4805646c42e51d2fbf142864d281473ad453ad5d ]
    
    The function is called to resolve a route for an ICMP message that is
    sent in response to a situation. Based on the type of the generated ICMP
    message, the function is either passed the DS field of the packet that
    generated the ICMP message or a DS field that is derived from it.
    
    Unmask the upper DSCP bits before resolving and output route via
    ip_route_output_key_hash() so that in the future the lookup could be
    performed according to the full DSCP value.
    
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Guillaume Nault <gnault@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 27843ce6ba3d ("ipvlan: ensure network headers are in skb linear part")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipvlan: ensure network headers are in skb linear part [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Feb 20 15:53:36 2025 +0000

    ipvlan: ensure network headers are in skb linear part
    
    [ Upstream commit 27843ce6ba3d3122b65066550fe33fb8839f8aef ]
    
    syzbot found that ipvlan_process_v6_outbound() was assuming
    the IPv6 network header isis present in skb->head [1]
    
    Add the needed pskb_network_may_pull() calls for both
    IPv4 and IPv6 handlers.
    
    [1]
    BUG: KMSAN: uninit-value in __ipv6_addr_type+0xa2/0x490 net/ipv6/addrconf_core.c:47
      __ipv6_addr_type+0xa2/0x490 net/ipv6/addrconf_core.c:47
      ipv6_addr_type include/net/ipv6.h:555 [inline]
      ip6_route_output_flags_noref net/ipv6/route.c:2616 [inline]
      ip6_route_output_flags+0x51/0x720 net/ipv6/route.c:2651
      ip6_route_output include/net/ip6_route.h:93 [inline]
      ipvlan_route_v6_outbound+0x24e/0x520 drivers/net/ipvlan/ipvlan_core.c:476
      ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:491 [inline]
      ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:541 [inline]
      ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:605 [inline]
      ipvlan_queue_xmit+0xd72/0x1780 drivers/net/ipvlan/ipvlan_core.c:671
      ipvlan_start_xmit+0x5b/0x210 drivers/net/ipvlan/ipvlan_main.c:223
      __netdev_start_xmit include/linux/netdevice.h:5150 [inline]
      netdev_start_xmit include/linux/netdevice.h:5159 [inline]
      xmit_one net/core/dev.c:3735 [inline]
      dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3751
      sch_direct_xmit+0x399/0xd40 net/sched/sch_generic.c:343
      qdisc_restart net/sched/sch_generic.c:408 [inline]
      __qdisc_run+0x14da/0x35d0 net/sched/sch_generic.c:416
      qdisc_run+0x141/0x4d0 include/net/pkt_sched.h:127
      net_tx_action+0x78b/0x940 net/core/dev.c:5484
      handle_softirqs+0x1a0/0x7c0 kernel/softirq.c:561
      __do_softirq+0x14/0x1a kernel/softirq.c:595
      do_softirq+0x9a/0x100 kernel/softirq.c:462
      __local_bh_enable_ip+0x9f/0xb0 kernel/softirq.c:389
      local_bh_enable include/linux/bottom_half.h:33 [inline]
      rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline]
      __dev_queue_xmit+0x2758/0x57d0 net/core/dev.c:4611
      dev_queue_xmit include/linux/netdevice.h:3311 [inline]
      packet_xmit+0x9c/0x6c0 net/packet/af_packet.c:276
      packet_snd net/packet/af_packet.c:3132 [inline]
      packet_sendmsg+0x93e0/0xa7e0 net/packet/af_packet.c:3164
      sock_sendmsg_nosec net/socket.c:718 [inline]
    
    Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
    Reported-by: syzbot+93ab4a777bafb9d9f960@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/67b74f01.050a0220.14d86d.02d8.GAE@google.com/T/#u
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Mahesh Bandewar <maheshb@google.com>
    Link: https://patch.msgid.link/20250220155336.61884-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvlan: Prepare ipvlan_process_v4_outbound() to future .flowi4_tos conversion. [+ + +]
Author: Guillaume Nault <gnault@redhat.com>
Date:   Wed Oct 30 13:43:11 2024 +0100

    ipvlan: Prepare ipvlan_process_v4_outbound() to future .flowi4_tos conversion.
    
    [ Upstream commit 0c30d6eedd1ec0c1382bcab9576d26413cd278a3 ]
    
    Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
    dscp_t value to __u8 with inet_dscp_to_dsfield().
    
    Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
    the inet_dscp_to_dsfield() call.
    
    Signed-off-by: Guillaume Nault <gnault@redhat.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/f48335504a05b3587e0081a9b4511e0761571ca5.1730292157.git.gnault@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 27843ce6ba3d ("ipvlan: ensure network headers are in skb linear part")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvlan: Unmask upper DSCP bits in ipvlan_process_v4_outbound() [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Thu Aug 29 09:54:57 2024 +0300

    ipvlan: Unmask upper DSCP bits in ipvlan_process_v4_outbound()
    
    [ Upstream commit 939cd1abf080c629552a9c5e6db4c0509d13e4c7 ]
    
    Unmask the upper DSCP bits when calling ip_route_output_flow() so that
    in the future it could perform the FIB lookup according to the full DSCP
    value.
    
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Guillaume Nault <gnault@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 27843ce6ba3d ("ipvlan: ensure network headers are in skb linear part")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipvs: Always clear ipvs_property flag in skb_scrub_packet() [+ + +]
Author: Philo Lu <lulie@linux.alibaba.com>
Date:   Sat Feb 22 11:35:18 2025 +0800

    ipvs: Always clear ipvs_property flag in skb_scrub_packet()
    
    [ Upstream commit de2c211868b9424f9aa9b3432c4430825bafb41b ]
    
    We found an issue when using bpf_redirect with ipvs NAT mode after
    commit ff70202b2d1a ("dev_forward_skb: do not scrub skb mark within
    the same name space"). Particularly, we use bpf_redirect to return
    the skb directly back to the netif it comes from, i.e., xnet is
    false in skb_scrub_packet(), and then ipvs_property is preserved
    and SNAT is skipped in the rx path.
    
    ipvs_property has been already cleared when netns is changed in
    commit 2b5ec1a5f973 ("netfilter/ipvs: clear ipvs_property flag when
    SKB net namespace changed"). This patch just clears it in spite of
    netns.
    
    Fixes: 2b5ec1a5f973 ("netfilter/ipvs: clear ipvs_property flag when SKB net namespace changed")
    Signed-off-by: Philo Lu <lulie@linux.alibaba.com>
    Acked-by: Julian Anastasov <ja@ssi.bg>
    Link: https://patch.msgid.link/20250222033518.126087-1-lulie@linux.alibaba.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Linux 6.1.130 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Mar 7 16:56:52 2025 +0100

    Linux 6.1.130
    
    Link: https://lore.kernel.org/r/20250305174505.437358097@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20250306151414.484343862@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
md/md-bitmap: add 'sync_size' into struct md_bitmap_stats [+ + +]
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Mon Aug 26 15:44:16 2024 +0800

    md/md-bitmap: add 'sync_size' into struct md_bitmap_stats
    
    [ Upstream commit ec6bb299c7c3dd4ca1724d13d5f5fae3ee54fc65 ]
    
    To avoid dereferencing bitmap directly in md-cluster to prepare
    inventing a new bitmap.
    
    BTW, also fix following checkpatch warnings:
    
    WARNING: Deprecated use of 'kmap_atomic', prefer 'kmap_local_page' instead
    WARNING: Deprecated use of 'kunmap_atomic', prefer 'kunmap_local' instead
    
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Link: https://lore.kernel.org/r/20240826074452.1490072-7-yukuai1@huaweicloud.com
    Signed-off-by: Song Liu <song@kernel.org>
    Stable-dep-of: 8d28d0ddb986 ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

md/md-bitmap: replace md_bitmap_status() with a new helper md_bitmap_get_stats() [+ + +]
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Mon Aug 26 15:44:12 2024 +0800

    md/md-bitmap: replace md_bitmap_status() with a new helper md_bitmap_get_stats()
    
    [ Upstream commit 38f287d7e495ae00d4481702f44ff7ca79f5c9bc ]
    
    There are no functional changes, and the new helper will be used in
    multiple places in following patches to avoid dereferencing bitmap
    directly.
    
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Link: https://lore.kernel.org/r/20240826074452.1490072-3-yukuai1@huaweicloud.com
    Signed-off-by: Song Liu <song@kernel.org>
    Stable-dep-of: 8d28d0ddb986 ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime [+ + +]
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Fri Jan 24 17:20:55 2025 +0800

    md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime
    
    [ Upstream commit 8d28d0ddb986f56920ac97ae704cc3340a699a30 ]
    
    After commit ec6bb299c7c3 ("md/md-bitmap: add 'sync_size' into struct
    md_bitmap_stats"), following panic is reported:
    
    Oops: general protection fault, probably for non-canonical address
    RIP: 0010:bitmap_get_stats+0x2b/0xa0
    Call Trace:
     <TASK>
     md_seq_show+0x2d2/0x5b0
     seq_read_iter+0x2b9/0x470
     seq_read+0x12f/0x180
     proc_reg_read+0x57/0xb0
     vfs_read+0xf6/0x380
     ksys_read+0x6c/0xf0
     do_syscall_64+0x82/0x170
     entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    Root cause is that bitmap_get_stats() can be called at anytime if mddev
    is still there, even if bitmap is destroyed, or not fully initialized.
    Deferenceing bitmap in this case can crash the kernel. Meanwhile, the
    above commit start to deferencing bitmap->storage, make the problem
    easier to trigger.
    
    Fix the problem by protecting bitmap_get_stats() with bitmap_info.mutex.
    
    Cc: stable@vger.kernel.org # v6.12+
    Fixes: 32a7627cf3a3 ("[PATCH] md: optimised resync using Bitmap based intent logging")
    Reported-and-tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Closes: https://lore.kernel.org/linux-raid/ca3a91a2-50ae-4f68-b317-abd9889f3907@oracle.com/T/#m6e5086c95201135e4941fe38f9efa76daf9666c5
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Link: https://lore.kernel.org/r/20250124092055.4050195-1-yukuai1@huaweicloud.com
    Signed-off-by: Song Liu <song@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
md/md-cluster: fix spares warnings for __le64 [+ + +]
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Mon Aug 26 15:44:15 2024 +0800

    md/md-cluster: fix spares warnings for __le64
    
    [ Upstream commit 82697ccf7e495c1ba81e315c2886d6220ff84c2c ]
    
    drivers/md/md-cluster.c:1220:22: warning: incorrect type in assignment (different base types)
    drivers/md/md-cluster.c:1220:22:    expected unsigned long my_sync_size
    drivers/md/md-cluster.c:1220:22:    got restricted __le64 [usertype] sync_size
    drivers/md/md-cluster.c:1252:35: warning: incorrect type in assignment (different base types)
    drivers/md/md-cluster.c:1252:35:    expected unsigned long sync_size
    drivers/md/md-cluster.c:1252:35:    got restricted __le64 [usertype] sync_size
    drivers/md/md-cluster.c:1253:41: warning: restricted __le64 degrades to integer
    
    Fix the warnings by using le64_to_cpu() to convet __le64 to integer.
    
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Link: https://lore.kernel.org/r/20240826074452.1490072-6-yukuai1@huaweicloud.com
    Signed-off-by: Song Liu <song@kernel.org>
    Stable-dep-of: 8d28d0ddb986 ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
media: mediatek: vcodec: Fix H264 multi stateless decoder smatch warning [+ + +]
Author: Yunfei Dong <yunfei.dong@mediatek.com>
Date:   Thu Jun 13 17:33:55 2024 +0800

    media: mediatek: vcodec: Fix H264 multi stateless decoder smatch warning
    
    commit 9be85491619f1953b8a29590ca630be571941ffa upstream.
    
    Fix a smatch static checker warning on vdec_h264_req_multi_if.c.
    Which leads to a kernel crash when fb is NULL.
    
    Fixes: 397edc703a10 ("media: mediatek: vcodec: add h264 decoder driver for mt8186")
    Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    [ drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
      is renamed from drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c
      since 0934d3759615 ("media: mediatek: vcodec: separate decoder and encoder").
      The path is changed accordingly to apply the patch on 6.1.y. ]
    Signed-off-by: Wenshan Lan <jetlan9@163.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: mtk-vcodec: potential null pointer deference in SCP [+ + +]
Author: Fullway Wang <fullwaywang@outlook.com>
Date:   Thu Jan 18 02:35:06 2024 +0000

    media: mtk-vcodec: potential null pointer deference in SCP
    
    commit 53dbe08504442dc7ba4865c09b3bbf5fe849681b upstream.
    
    The return value of devm_kzalloc() needs to be checked to avoid
    NULL pointer deference. This is similar to CVE-2022-3113.
    
    Link: https://lore.kernel.org/linux-media/PH7PR20MB5925094DAE3FD750C7E39E01BF712@PH7PR20MB5925.namprd20.prod.outlook.com
    Signed-off-by: Fullway Wang <fullwaywang@outlook.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
    Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
    Signed-off-by: He Zhe <zhe.he@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: Switch to use dev_err_probe() helper [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Mon Sep 19 23:58:43 2022 +0800

    media: Switch to use dev_err_probe() helper
    
    [ Upstream commit 6cb7d1b3ff83e98e852db9739892c4643a31804b ]
    
    In the probe path, dev_err() can be replaced with dev_err_probe()
    which will check if error code is -EPROBE_DEFER.
    
    Reviewed-by: Sean Young <sean@mess.org>
    Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Stable-dep-of: a9ea1a3d88b7 ("media: uvcvideo: Fix crash during unbind if gpio unit is in use")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: uvcvideo: Fix crash during unbind if gpio unit is in use [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Wed Nov 6 20:36:07 2024 +0000

    media: uvcvideo: Fix crash during unbind if gpio unit is in use
    
    [ Upstream commit a9ea1a3d88b7947ce8cadb2afceee7a54872bbc5 ]
    
    We used the wrong device for the device managed functions. We used the
    usb device, when we should be using the interface device.
    
    If we unbind the driver from the usb interface, the cleanup functions
    are never called. In our case, the IRQ is never disabled.
    
    If an IRQ is triggered, it will try to access memory sections that are
    already free, causing an OOPS.
    
    We cannot use the function devm_request_threaded_irq here. The devm_*
    clean functions may be called after the main structure is released by
    uvc_delete.
    
    Luckily this bug has small impact, as it is only affected by devices
    with gpio units and the user has to unbind the device, a disconnect will
    not trigger this error.
    
    Cc: stable@vger.kernel.org
    Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT")
    Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://lore.kernel.org/r/20241106-uvc-crashrmmod-v6-1-fbf9781c6e83@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: uvcvideo: Only save async fh if success [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Tue Dec 3 21:20:08 2024 +0000

    media: uvcvideo: Only save async fh if success
    
    [ Upstream commit d9fecd096f67a4469536e040a8a10bbfb665918b ]
    
    Now we keep a reference to the active fh for any call to uvc_ctrl_set,
    regardless if it is an actual set or if it is a just a try or if the
    device refused the operation.
    
    We should only keep the file handle if the device actually accepted
    applying the operation.
    
    Cc: stable@vger.kernel.org
    Fixes: e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
    Suggested-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://lore.kernel.org/r/20241203-uvc-fix-async-v6-1-26c867231118@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: uvcvideo: Refactor iterators [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Mon Apr 29 15:04:42 2024 +0000

    media: uvcvideo: Refactor iterators
    
    [ Upstream commit 64627daf0c5f7838111f52bbbd1a597cb5d6871a ]
    
    Avoid using the iterators after the list_for_each() constructs.
    This patch should be a NOP, but makes cocci, happier:
    
    drivers/media/usb/uvc/uvc_ctrl.c:1861:44-50: ERROR: invalid reference to the index variable of the iterator on line 1850
    drivers/media/usb/uvc/uvc_ctrl.c:2195:17-23: ERROR: invalid reference to the index variable of the iterator on line 2179
    
    Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Stable-dep-of: d9fecd096f67 ("media: uvcvideo: Only save async fh if success")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: uvcvideo: Remove dangling pointers [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Tue Dec 3 21:20:10 2024 +0000

    media: uvcvideo: Remove dangling pointers
    
    [ Upstream commit 221cd51efe4565501a3dbf04cc011b537dcce7fb ]
    
    When an async control is written, we copy a pointer to the file handle
    that started the operation. That pointer will be used when the device is
    done. Which could be anytime in the future.
    
    If the user closes that file descriptor, its structure will be freed,
    and there will be one dangling pointer per pending async control, that
    the driver will try to use.
    
    Clean all the dangling pointers during release().
    
    To avoid adding a performance penalty in the most common case (no async
    operation), a counter has been introduced with some logic to make sure
    that it is properly handled.
    
    Cc: stable@vger.kernel.org
    Fixes: e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://lore.kernel.org/r/20241203-uvc-fix-async-v6-3-26c867231118@chromium.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
memcg: fix soft lockup in the OOM process [+ + +]
Author: Chen Ridong <chenridong@huawei.com>
Date:   Tue Dec 24 02:52:38 2024 +0000

    memcg: fix soft lockup in the OOM process
    
    [ Upstream commit ade81479c7dda1ce3eedb215c78bc615bbd04f06 ]
    
    A soft lockup issue was found in the product with about 56,000 tasks were
    in the OOM cgroup, it was traversing them when the soft lockup was
    triggered.
    
    watchdog: BUG: soft lockup - CPU#2 stuck for 23s! [VM Thread:1503066]
    CPU: 2 PID: 1503066 Comm: VM Thread Kdump: loaded Tainted: G
    Hardware name: Huawei Cloud OpenStack Nova, BIOS
    RIP: 0010:console_unlock+0x343/0x540
    RSP: 0000:ffffb751447db9a0 EFLAGS: 00000247 ORIG_RAX: ffffffffffffff13
    RAX: 0000000000000001 RBX: 0000000000000000 RCX: 00000000ffffffff
    RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000247
    RBP: ffffffffafc71f90 R08: 0000000000000000 R09: 0000000000000040
    R10: 0000000000000080 R11: 0000000000000000 R12: ffffffffafc74bd0
    R13: ffffffffaf60a220 R14: 0000000000000247 R15: 0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f2fe6ad91f0 CR3: 00000004b2076003 CR4: 0000000000360ee0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     vprintk_emit+0x193/0x280
     printk+0x52/0x6e
     dump_task+0x114/0x130
     mem_cgroup_scan_tasks+0x76/0x100
     dump_header+0x1fe/0x210
     oom_kill_process+0xd1/0x100
     out_of_memory+0x125/0x570
     mem_cgroup_out_of_memory+0xb5/0xd0
     try_charge+0x720/0x770
     mem_cgroup_try_charge+0x86/0x180
     mem_cgroup_try_charge_delay+0x1c/0x40
     do_anonymous_page+0xb5/0x390
     handle_mm_fault+0xc4/0x1f0
    
    This is because thousands of processes are in the OOM cgroup, it takes a
    long time to traverse all of them.  As a result, this lead to soft lockup
    in the OOM process.
    
    To fix this issue, call 'cond_resched' in the 'mem_cgroup_scan_tasks'
    function per 1000 iterations.  For global OOM, call
    'touch_softlockup_watchdog' per 1000 iterations to avoid this issue.
    
    Link: https://lkml.kernel.org/r/20241224025238.3768787-1-chenridong@huaweicloud.com
    Fixes: 9cbb78bb3143 ("mm, memcg: introduce own oom handler to iterate only over its own threads")
    Signed-off-by: Chen Ridong <chenridong@huawei.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Roman Gushchin <roman.gushchin@linux.dev>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Shakeel Butt <shakeelb@google.com>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: Michal Koutný <mkoutny@suse.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm,madvise,hugetlb: check for 0-length range after end address adjustment [+ + +]
Author: Ricardo Cañuelo Navarro <rcn@igalia.com>
Date:   Mon Feb 3 08:52:06 2025 +0100

    mm,madvise,hugetlb: check for 0-length range after end address adjustment
    
    commit 2ede647a6fde3e54a6bfda7cf01c716649655900 upstream.
    
    Add a sanity check to madvise_dontneed_free() to address a corner case in
    madvise where a race condition causes the current vma being processed to
    be backed by a different page size.
    
    During a madvise(MADV_DONTNEED) call on a memory region registered with a
    userfaultfd, there's a period of time where the process mm lock is
    temporarily released in order to send a UFFD_EVENT_REMOVE and let
    userspace handle the event.  During this time, the vma covering the
    current address range may change due to an explicit mmap done concurrently
    by another thread.
    
    If, after that change, the memory region, which was originally backed by
    4KB pages, is now backed by hugepages, the end address is rounded down to
    a hugepage boundary to avoid data loss (see "Fixes" below).  This rounding
    may cause the end address to be truncated to the same address as the
    start.
    
    Make this corner case follow the same semantics as in other similar cases
    where the requested region has zero length (ie.  return 0).
    
    This will make madvise_walk_vmas() continue to the next vma in the range
    (this time holding the process mm lock) which, due to the prev pointer
    becoming stale because of the vma change, will be the same hugepage-backed
    vma that was just checked before.  The next time madvise_dontneed_free()
    runs for this vma, if the start address isn't aligned to a hugepage
    boundary, it'll return -EINVAL, which is also in line with the madvise
    api.
    
    From userspace perspective, madvise() will return EINVAL because the start
    address isn't aligned according to the new vma alignment requirements
    (hugepage), even though it was correctly page-aligned when the call was
    issued.
    
    Link: https://lkml.kernel.org/r/20250203075206.1452208-1-rcn@igalia.com
    Fixes: 8ebe0a5eaaeb ("mm,madvise,hugetlb: fix unexpected data loss with MADV_DONTNEED on hugetlbfs")
    Signed-off-by: Ricardo Cañuelo Navarro <rcn@igalia.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Florent Revest <revest@google.com>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/memory: Use exception ip to search exception tables [+ + +]
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date:   Fri Feb 2 12:30:28 2024 +0000

    mm/memory: Use exception ip to search exception tables
    
    commit 8fa5070833886268e4fb646daaca99f725b378e9 upstream.
    
    On architectures with delay slot, instruction_pointer() may differ
    from where exception was triggered.
    
    Use exception_ip we just introduced to search exception tables to
    get rid of the problem.
    
    Fixes: 4bce37a68ff8 ("mips/mm: Convert to using lock_mm_and_find_vma()")
    Reported-by: Xi Ruoyao <xry111@xry111.site>
    Link: https://lore.kernel.org/r/75e9fd7b08562ad9b456a5bdaacb7cc220311cc9.camel@xry111.site/
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: Salvatore Bonaccorso <carnil@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm: Don't pin ZERO_PAGE in pin_user_pages() [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Fri May 26 22:41:40 2023 +0100

    mm: Don't pin ZERO_PAGE in pin_user_pages()
    
    [ Upstream commit c8070b78751955e59b42457b974bea4a4fe00187 ]
    
    Make pin_user_pages*() leave a ZERO_PAGE unpinned if it extracts a pointer
    to it from the page tables and make unpin_user_page*() correspondingly
    ignore a ZERO_PAGE when unpinning.  We don't want to risk overrunning a
    zero page's refcount as we're only allowed ~2 million pins on it -
    something that userspace can conceivably trigger.
    
    Add a pair of functions to test whether a page or a folio is a ZERO_PAGE.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Christoph Hellwig <hch@infradead.org>
    cc: David Hildenbrand <david@redhat.com>
    cc: Lorenzo Stoakes <lstoakes@gmail.com>
    cc: Andrew Morton <akpm@linux-foundation.org>
    cc: Jens Axboe <axboe@kernel.dk>
    cc: Al Viro <viro@zeniv.linux.org.uk>
    cc: Matthew Wilcox <willy@infradead.org>
    cc: Jan Kara <jack@suse.cz>
    cc: Jeff Layton <jlayton@kernel.org>
    cc: Jason Gunthorpe <jgg@nvidia.com>
    cc: Logan Gunthorpe <logang@deltatee.com>
    cc: Hillf Danton <hdanton@sina.com>
    cc: Christian Brauner <brauner@kernel.org>
    cc: Linus Torvalds <torvalds@linux-foundation.org>
    cc: linux-fsdevel@vger.kernel.org
    cc: linux-block@vger.kernel.org
    cc: linux-kernel@vger.kernel.org
    cc: linux-mm@kvack.org
    Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: David Hildenbrand <david@redhat.com>
    Link: https://lore.kernel.org/r/20230526214142.958751-2-dhowells@redhat.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Stable-dep-of: bddf10d26e6e ("uprobes: Reject the shared zeropage in uprobe_write_opcode()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm: update mark_victim tracepoints fields [+ + +]
Author: Carlos Galo <carlosgalo@google.com>
Date:   Fri Feb 23 17:32:49 2024 +0000

    mm: update mark_victim tracepoints fields
    
    [ Upstream commit 72ba14deb40a9e9668ec5e66a341ed657e5215c2 ]
    
    The current implementation of the mark_victim tracepoint provides only the
    process ID (pid) of the victim process.  This limitation poses challenges
    for userspace tools requiring real-time OOM analysis and intervention.
    Although this information is available from the kernel logs, it’s not
    the appropriate format to provide OOM notifications.  In Android, BPF
    programs are used with the mark_victim trace events to notify userspace of
    an OOM kill.  For consistency, update the trace event to include the same
    information about the OOMed victim as the kernel logs.
    
    - UID
       In Android each installed application has a unique UID. Including
       the `uid` assists in correlating OOM events with specific apps.
    
    - Process Name (comm)
       Enables identification of the affected process.
    
    - OOM Score
      Will allow userspace to get additional insight of the relative kill
      priority of the OOM victim. In Android, the oom_score_adj is used to
      categorize app state (foreground, background, etc.), which aids in
      analyzing user-perceptible impacts of OOM events [1].
    
    - Total VM, RSS Stats, and pgtables
      Amount of memory used by the victim that will, potentially, be freed up
      by killing it.
    
    [1] https://cs.android.com/android/platform/superproject/main/+/246dc8fc95b6d93afcba5c6d6c133307abb3ac2e:frameworks/base/services/core/java/com/android/server/am/ProcessList.java;l=188-283
    Signed-off-by: Carlos Galo <carlosgalo@google.com>
    Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: ade81479c7dd ("memcg: fix soft lockup in the OOM process")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mptcp: always handle address removal under msk socket lock [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Mon Feb 24 19:11:50 2025 +0100

    mptcp: always handle address removal under msk socket lock
    
    commit f865c24bc55158313d5779fc81116023a6940ca3 upstream.
    
    Syzkaller reported a lockdep splat in the PM control path:
    
      WARNING: CPU: 0 PID: 6693 at ./include/net/sock.h:1711 sock_owned_by_me include/net/sock.h:1711 [inline]
      WARNING: CPU: 0 PID: 6693 at ./include/net/sock.h:1711 msk_owned_by_me net/mptcp/protocol.h:363 [inline]
      WARNING: CPU: 0 PID: 6693 at ./include/net/sock.h:1711 mptcp_pm_nl_addr_send_ack+0x57c/0x610 net/mptcp/pm_netlink.c:788
      Modules linked in:
      CPU: 0 UID: 0 PID: 6693 Comm: syz.0.205 Not tainted 6.14.0-rc2-syzkaller-00303-gad1b832bf1cf #0
      Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
      RIP: 0010:sock_owned_by_me include/net/sock.h:1711 [inline]
      RIP: 0010:msk_owned_by_me net/mptcp/protocol.h:363 [inline]
      RIP: 0010:mptcp_pm_nl_addr_send_ack+0x57c/0x610 net/mptcp/pm_netlink.c:788
      Code: 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 ca 7b d3 f5 eb b9 e8 c3 7b d3 f5 90 0f 0b 90 e9 dd fb ff ff e8 b5 7b d3 f5 90 <0f> 0b 90 e9 3e fb ff ff 44 89 f1 80 e1 07 38 c1 0f 8c eb fb ff ff
      RSP: 0000:ffffc900034f6f60 EFLAGS: 00010283
      RAX: ffffffff8bee3c2b RBX: 0000000000000001 RCX: 0000000000080000
      RDX: ffffc90004d42000 RSI: 000000000000a407 RDI: 000000000000a408
      RBP: ffffc900034f7030 R08: ffffffff8bee37f6 R09: 0100000000000000
      R10: dffffc0000000000 R11: ffffed100bcc62e4 R12: ffff88805e6316e0
      R13: ffff88805e630c00 R14: dffffc0000000000 R15: ffff88805e630c00
      FS:  00007f7e9a7e96c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b2fd18ff8 CR3: 0000000032c24000 CR4: 00000000003526f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       mptcp_pm_remove_addr+0x103/0x1d0 net/mptcp/pm.c:59
       mptcp_pm_remove_anno_addr+0x1f4/0x2f0 net/mptcp/pm_netlink.c:1486
       mptcp_nl_remove_subflow_and_signal_addr net/mptcp/pm_netlink.c:1518 [inline]
       mptcp_pm_nl_del_addr_doit+0x118d/0x1af0 net/mptcp/pm_netlink.c:1629
       genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline]
       genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
       genl_rcv_msg+0xb1f/0xec0 net/netlink/genetlink.c:1210
       netlink_rcv_skb+0x206/0x480 net/netlink/af_netlink.c:2543
       genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
       netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
       netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1348
       netlink_sendmsg+0x8de/0xcb0 net/netlink/af_netlink.c:1892
       sock_sendmsg_nosec net/socket.c:718 [inline]
       __sock_sendmsg+0x221/0x270 net/socket.c:733
       ____sys_sendmsg+0x53a/0x860 net/socket.c:2573
       ___sys_sendmsg net/socket.c:2627 [inline]
       __sys_sendmsg+0x269/0x350 net/socket.c:2659
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7f7e9998cde9
      Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f7e9a7e9038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007f7e99ba5fa0 RCX: 00007f7e9998cde9
      RDX: 000000002000c094 RSI: 0000400000000000 RDI: 0000000000000007
      RBP: 00007f7e99a0e2a0 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 0000000000000000 R14: 00007f7e99ba5fa0 R15: 00007fff49231088
    
    Indeed the PM can try to send a RM_ADDR over a msk without acquiring
    first the msk socket lock.
    
    The bugged code-path comes from an early optimization: when there
    are no subflows, the PM should (usually) not send RM_ADDR
    notifications.
    
    The above statement is incorrect, as without locks another process
    could concurrent create a new subflow and cause the RM_ADDR generation.
    
    Additionally the supposed optimization is not very effective even
    performance-wise, as most mptcp sockets should have at least one
    subflow: the MPC one.
    
    Address the issue removing the buggy code path, the existing "slow-path"
    will handle correctly even the edge case.
    
    Fixes: b6c08380860b ("mptcp: remove addr and subflow in PM netlink")
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+cd3ce3d03a3393ae9700@syzkaller.appspotmail.com
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/546
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250224-net-mptcp-misc-fixes-v1-1-f550f636b435@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: reset when MPTCP opts are dropped after join [+ + +]
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Mon Feb 24 19:11:51 2025 +0100

    mptcp: reset when MPTCP opts are dropped after join
    
    commit 8668860b0ad32a13fcd6c94a0995b7aa7638c9ef upstream.
    
    Before this patch, if the checksum was not used, the subflow was only
    reset if map_data_len was != 0. If there were no MPTCP options or an
    invalid mapping, map_data_len was not set to the data len, and then the
    subflow was not reset as it should have been, leaving the MPTCP
    connection in a wrong fallback mode.
    
    This map_data_len condition has been introduced to handle the reception
    of the infinite mapping. Instead, a new dedicated mapping error could
    have been returned and treated as a special case. However, the commit
    31bf11de146c ("mptcp: introduce MAPPING_BAD_CSUM") has been introduced
    by Paolo Abeni soon after, and backported later on to stable. It better
    handle the csum case, and it means the exception for valid_csum_seen in
    subflow_can_fallback(), plus this one for the infinite mapping in
    subflow_check_data_avail(), are no longer needed.
    
    In other words, the code can be simplified there: a fallback should only
    be done if msk->allow_infinite_fallback is set. This boolean is set to
    false once MPTCP-specific operations acting on the whole MPTCP
    connection vs the initial path have been done, e.g. a second path has
    been created, or an MPTCP re-injection -- yes, possible even with a
    single subflow. The subflow_can_fallback() helper can then be dropped,
    and replaced by this single condition.
    
    This also makes the code clearer: a fallback should only be done if it
    is possible to do so.
    
    While at it, no need to set map_data_len to 0 in get_mapping_status()
    for the infinite mapping case: it will be set to skb->len just after, at
    the end of subflow_check_data_avail(), and not read in between.
    
    Fixes: f8d4bcacff3b ("mptcp: infinite mapping receiving")
    Cc: stable@vger.kernel.org
    Reported-by: Chester A. Unal <chester.a.unal@xpedite-tech.com>
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/544
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Tested-by: Chester A. Unal <chester.a.unal@xpedite-tech.com>
    Link: https://patch.msgid.link/20250224-net-mptcp-misc-fixes-v1-2-f550f636b435@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mtd: rawnand: cadence: fix error code in cadence_nand_init() [+ + +]
Author: Niravkumar L Rabara <niravkumar.l.rabara@intel.com>
Date:   Mon Feb 10 13:35:49 2025 +0800

    mtd: rawnand: cadence: fix error code in cadence_nand_init()
    
    commit 2b9df00cded911e2ca2cfae5c45082166b24f8aa upstream.
    
    Replace dma_request_channel() with dma_request_chan_by_mask() and use
    helper functions to return proper error code instead of fixed -EBUSY.
    
    Fixes: ec4ba01e894d ("mtd: rawnand: Add new Cadence NAND driver to MTD subsystem")
    Cc: stable@vger.kernel.org
    Signed-off-by: Niravkumar L Rabara <niravkumar.l.rabara@intel.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mtd: rawnand: cadence: fix incorrect device in dma_unmap_single [+ + +]
Author: Niravkumar L Rabara <niravkumar.l.rabara@intel.com>
Date:   Mon Feb 10 13:35:51 2025 +0800

    mtd: rawnand: cadence: fix incorrect device in dma_unmap_single
    
    commit f37d135b42cb484bdecee93f56b9f483214ede78 upstream.
    
    dma_map_single is using physical/bus device (DMA) but dma_unmap_single
    is using framework device(NAND controller), which is incorrect.
    Fixed dma_unmap_single to use correct physical/bus device.
    
    Fixes: ec4ba01e894d ("mtd: rawnand: Add new Cadence NAND driver to MTD subsystem")
    Cc: stable@vger.kernel.org
    Signed-off-by: Niravkumar L Rabara <niravkumar.l.rabara@intel.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mtd: rawnand: cadence: use dma_map_resource for sdma address [+ + +]
Author: Niravkumar L Rabara <niravkumar.l.rabara@intel.com>
Date:   Mon Feb 10 13:35:50 2025 +0800

    mtd: rawnand: cadence: use dma_map_resource for sdma address
    
    commit d76d22b5096c5b05208fd982b153b3f182350b19 upstream.
    
    Remap the slave DMA I/O resources to enhance driver portability.
    Using a physical address causes DMA translation failure when the
    ARM SMMU is enabled.
    
    Fixes: ec4ba01e894d ("mtd: rawnand: Add new Cadence NAND driver to MTD subsystem")
    Cc: stable@vger.kernel.org
    Signed-off-by: Niravkumar L Rabara <niravkumar.l.rabara@intel.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/ipv4: add tracepoint for icmp_send [+ + +]
Author: Peilin He <he.peilin@zte.com.cn>
Date:   Tue May 7 15:41:03 2024 +0800

    net/ipv4: add tracepoint for icmp_send
    
    [ Upstream commit db3efdcf70c752e8a8deb16071d8e693c3ef8746 ]
    
    Introduce a tracepoint for icmp_send, which can help users to get more
    detail information conveniently when icmp abnormal events happen.
    
    1. Giving an usecase example:
    =============================
    When an application experiences packet loss due to an unreachable UDP
    destination port, the kernel will send an exception message through the
    icmp_send function. By adding a trace point for icmp_send, developers or
    system administrators can obtain detailed information about the UDP
    packet loss, including the type, code, source address, destination address,
    source port, and destination port. This facilitates the trouble-shooting
    of UDP packet loss issues especially for those network-service
    applications.
    
    2. Operation Instructions:
    ==========================
    Switch to the tracing directory.
            cd /sys/kernel/tracing
    Filter for destination port unreachable.
            echo "type==3 && code==3" > events/icmp/icmp_send/filter
    Enable trace event.
            echo 1 > events/icmp/icmp_send/enable
    
    3. Result View:
    ================
     udp_client_erro-11370   [002] ...s.12   124.728002:
     icmp_send: icmp_send: type=3, code=3.
     From 127.0.0.1:41895 to 127.0.0.1:6666 ulen=23
     skbaddr=00000000589b167a
    
    Signed-off-by: Peilin He <he.peilin@zte.com.cn>
    Signed-off-by: xu xin <xu.xin16@zte.com.cn>
    Reviewed-by: Yunkai Zhang <zhang.yunkai@zte.com.cn>
    Cc: Yang Yang <yang.yang29@zte.com.cn>
    Cc: Liu Chun <liu.chun2@zte.com.cn>
    Cc: Xuexin Jiang <jiang.xuexin@zte.com.cn>
    Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 27843ce6ba3d ("ipvlan: ensure network headers are in skb linear part")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx5: IRQ, Fix null string in debug print [+ + +]
Author: Shay Drory <shayd@nvidia.com>
Date:   Tue Feb 25 09:26:08 2025 +0200

    net/mlx5: IRQ, Fix null string in debug print
    
    [ Upstream commit 2f5a6014eb168a97b24153adccfa663d3b282767 ]
    
    irq_pool_alloc() debug print can print a null string.
    Fix it by providing a default string to print.
    
    Fixes: 71e084e26414 ("net/mlx5: Allocating a pool of MSI-X vectors for SFs")
    Signed-off-by: Shay Drory <shayd@nvidia.com>
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202501141055.SwfIphN0-lkp@intel.com/
    Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
    Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Link: https://patch.msgid.link/20250225072608.526866-4-tariqt@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: Add non-RCU dev_getbyhwaddr() helper [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Tue Feb 18 05:49:30 2025 -0800

    net: Add non-RCU dev_getbyhwaddr() helper
    
    [ Upstream commit 4b5a28b38c4a0106c64416a1b2042405166b26ce ]
    
    Add dedicated helper for finding devices by hardware address when
    holding rtnl_lock, similar to existing dev_getbyhwaddr_rcu(). This prevents
    PROVE_LOCKING warnings when rtnl_lock is held but RCU read lock is not.
    
    Extract common address comparison logic into dev_addr_cmp().
    
    The context about this change could be found in the following
    discussion:
    
    Link: https://lore.kernel.org/all/20250206-scarlet-ermine-of-improvement-1fcac5@leitao/
    
    Cc: kuniyu@amazon.com
    Cc: ushankar@purestorage.com
    Suggested-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://patch.msgid.link/20250218-arm_fix_selftest-v5-1-d3d6892db9e1@debian.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 4eae0ee0f1e6 ("arp: switch to dev_getbyhwaddr() in arp_req_set_public()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: axienet: Set mac_managed_pm [+ + +]
Author: Nick Hu <nick.hu@sifive.com>
Date:   Mon Feb 17 13:58:42 2025 +0800

    net: axienet: Set mac_managed_pm
    
    [ Upstream commit a370295367b55662a32a4be92565fe72a5aa79bb ]
    
    The external PHY will undergo a soft reset twice during the resume process
    when it wake up from suspend. The first reset occurs when the axienet
    driver calls phylink_of_phy_connect(), and the second occurs when
    mdio_bus_phy_resume() invokes phy_init_hw(). The second soft reset of the
    external PHY does not reinitialize the internal PHY, which causes issues
    with the internal PHY, resulting in the PHY link being down. To prevent
    this, setting the mac_managed_pm flag skips the mdio_bus_phy_resume()
    function.
    
    Fixes: a129b41fe0a8 ("Revert "net: phy: dp83867: perform soft reset and retain established link"")
    Signed-off-by: Nick Hu <nick.hu@sifive.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://patch.msgid.link/20250217055843.19799-1-nick.hu@sifive.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: cadence: macb: Synchronize stats calculations [+ + +]
Author: Sean Anderson <sean.anderson@linux.dev>
Date:   Thu Feb 20 11:29:50 2025 -0500

    net: cadence: macb: Synchronize stats calculations
    
    [ Upstream commit fa52f15c745ce55261b92873676f64f7348cfe82 ]
    
    Stats calculations involve a RMW to add the stat update to the existing
    value. This is currently not protected by any synchronization mechanism,
    so data races are possible. Add a spinlock to protect the update. The
    reader side could be protected using u64_stats, but we would still need
    a spinlock for the update side anyway. And we always do an update
    immediately before reading the stats anyway.
    
    Fixes: 89e5785fc8a6 ("[PATCH] Atmel MACB ethernet driver")
    Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
    Link: https://patch.msgid.link/20250220162950.95941-1-sean.anderson@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: Clear old fragment checksum value in napi_reuse_skb [+ + +]
Author: Mohammad Heib <mheib@redhat.com>
Date:   Tue Feb 25 13:28:52 2025 +0200

    net: Clear old fragment checksum value in napi_reuse_skb
    
    [ Upstream commit 49806fe6e61b045b5be8610e08b5a3083c109aa0 ]
    
    In certain cases, napi_get_frags() returns an skb that points to an old
    received fragment, This skb may have its skb->ip_summed, csum, and other
    fields set from previous fragment handling.
    
    Some network drivers set skb->ip_summed to either CHECKSUM_COMPLETE or
    CHECKSUM_UNNECESSARY when getting skb from napi_get_frags(), while
    others only set skb->ip_summed when RX checksum offload is enabled on
    the device, and do not set any value for skb->ip_summed when hardware
    checksum offload is disabled, assuming that the skb->ip_summed
    initiated to zero by napi_reuse_skb, ionic driver for example will
    ignore/unset any value for the ip_summed filed if HW checksum offload is
    disabled, and if we have a situation where the user disables the
    checksum offload during a traffic that could lead to the following
    errors shown in the kernel logs:
    <IRQ>
    dump_stack_lvl+0x34/0x48
     __skb_gro_checksum_complete+0x7e/0x90
    tcp6_gro_receive+0xc6/0x190
    ipv6_gro_receive+0x1ec/0x430
    dev_gro_receive+0x188/0x360
    ? ionic_rx_clean+0x25a/0x460 [ionic]
    napi_gro_frags+0x13c/0x300
    ? __pfx_ionic_rx_service+0x10/0x10 [ionic]
    ionic_rx_service+0x67/0x80 [ionic]
    ionic_cq_service+0x58/0x90 [ionic]
    ionic_txrx_napi+0x64/0x1b0 [ionic]
     __napi_poll+0x27/0x170
    net_rx_action+0x29c/0x370
    handle_softirqs+0xce/0x270
    __irq_exit_rcu+0xa3/0xc0
    common_interrupt+0x80/0xa0
    </IRQ>
    
    This inconsistency sometimes leads to checksum validation issues in the
    upper layers of the network stack.
    
    To resolve this, this patch clears the skb->ip_summed value for each
    reused skb in by napi_reuse_skb(), ensuring that the caller is responsible
    for setting the correct checksum status. This eliminates potential
    checksum validation issues caused by improper handling of
    skb->ip_summed.
    
    Fixes: 76620aafd66f ("gro: New frags interface to avoid copying shinfo")
    Signed-off-by: Mohammad Heib <mheib@redhat.com>
    Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250225112852.2507709-1-mheib@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: enetc: correct the xdp_tx statistics [+ + +]
Author: Wei Fang <wei.fang@nxp.com>
Date:   Mon Feb 24 19:12:46 2025 +0800

    net: enetc: correct the xdp_tx statistics
    
    commit 432a2cb3ee97a7c6ea578888fe81baad035b9307 upstream.
    
    The 'xdp_tx' is used to count the number of XDP_TX frames sent, not the
    number of Tx BDs.
    
    Fixes: 7ed2bc80074e ("net: enetc: add support for XDP_TX")
    Cc: stable@vger.kernel.org
    Signed-off-by: Wei Fang <wei.fang@nxp.com>
    Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://patch.msgid.link/20250224111251.1061098-4-wei.fang@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: enetc: fix the off-by-one issue in enetc_map_tx_buffs() [+ + +]
Author: Wei Fang <wei.fang@nxp.com>
Date:   Mon Feb 24 19:12:44 2025 +0800

    net: enetc: fix the off-by-one issue in enetc_map_tx_buffs()
    
    commit 39ab773e4c120f7f98d759415ccc2aca706bbc10 upstream.
    
    When a DMA mapping error occurs while processing skb frags, it will free
    one more tx_swbd than expected, so fix this off-by-one issue.
    
    Fixes: d4fd0404c1c9 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
    Cc: stable@vger.kernel.org
    Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Suggested-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Signed-off-by: Wei Fang <wei.fang@nxp.com>
    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
    Link: https://patch.msgid.link/20250224111251.1061098-2-wei.fang@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: enetc: fix the off-by-one issue in enetc_map_tx_tso_buffs() [+ + +]
Author: Wei Fang <wei.fang@nxp.com>
Date:   Mon Feb 24 19:12:51 2025 +0800

    net: enetc: fix the off-by-one issue in enetc_map_tx_tso_buffs()
    
    commit 249df695c3ffe8c8d36d46c2580ce72410976f96 upstream.
    
    There is an off-by-one issue for the err_chained_bd path, it will free
    one more tx_swbd than expected. But there is no such issue for the
    err_map_data path. To fix this off-by-one issue and make the two error
    handling consistent, the increment of 'i' and 'count' remain in sync
    and enetc_unwind_tx_frame() is called for error handling.
    
    Fixes: fb8629e2cbfc ("net: enetc: add support for software TSO")
    Cc: stable@vger.kernel.org
    Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: Wei Fang <wei.fang@nxp.com>
    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
    Link: https://patch.msgid.link/20250224111251.1061098-9-wei.fang@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: enetc: keep track of correct Tx BD count in enetc_map_tx_tso_buffs() [+ + +]
Author: Wei Fang <wei.fang@nxp.com>
Date:   Mon Feb 24 19:12:45 2025 +0800

    net: enetc: keep track of correct Tx BD count in enetc_map_tx_tso_buffs()
    
    commit da291996b16ebd10626d4b20288327b743aff110 upstream.
    
    When creating a TSO header, if the skb is VLAN tagged, the extended BD
    will be used and the 'count' should be increased by 2 instead of 1.
    Otherwise, when an error occurs, less tx_swbd will be freed than the
    actual number.
    
    Fixes: fb8629e2cbfc ("net: enetc: add support for software TSO")
    Cc: stable@vger.kernel.org
    Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: Wei Fang <wei.fang@nxp.com>
    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
    Link: https://patch.msgid.link/20250224111251.1061098-3-wei.fang@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: enetc: update UDP checksum when updating originTimestamp field [+ + +]
Author: Wei Fang <wei.fang@nxp.com>
Date:   Mon Feb 24 19:12:48 2025 +0800

    net: enetc: update UDP checksum when updating originTimestamp field
    
    commit bbcbc906ab7b5834c1219cd17a38d78dba904aa0 upstream.
    
    There is an issue with one-step timestamp based on UDP/IP. The peer will
    discard the sync packet because of the wrong UDP checksum. For ENETC v1,
    the software needs to update the UDP checksum when updating the
    originTimestamp field, so that the hardware can correctly update the UDP
    checksum when updating the correction field. Otherwise, the UDP checksum
    in the sync packet will be wrong.
    
    Fixes: 7294380c5211 ("enetc: support PTP Sync packet one-step timestamping")
    Cc: stable@vger.kernel.org
    Signed-off-by: Wei Fang <wei.fang@nxp.com>
    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Link: https://patch.msgid.link/20250224111251.1061098-6-wei.fang@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: ipv6: fix dst ref loop on input in rpl lwt [+ + +]
Author: Justin Iurman <justin.iurman@uliege.be>
Date:   Tue Feb 25 18:51:39 2025 +0100

    net: ipv6: fix dst ref loop on input in rpl lwt
    
    [ Upstream commit 13e55fbaec176119cff68a7e1693b251c8883c5f ]
    
    Prevent a dst ref loop on input in rpl_iptunnel.
    
    Fixes: a7a29f9c361f ("net: ipv6: add rpl sr tunnel")
    Cc: Alexander Aring <alex.aring@gmail.com>
    Cc: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ipv6: fix dst ref loop on input in seg6 lwt [+ + +]
Author: Justin Iurman <justin.iurman@uliege.be>
Date:   Tue Feb 25 18:51:38 2025 +0100

    net: ipv6: fix dst ref loop on input in seg6 lwt
    
    [ Upstream commit c64a0727f9b1cbc63a5538c8c0014e9a175ad864 ]
    
    Prevent a dst ref loop on input in seg6_iptunnel.
    
    Fixes: af4a2209b134 ("ipv6: sr: use dst_cache in seg6_input")
    Cc: David Lebrun <dlebrun@google.com>
    Cc: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ipv6: rpl_iptunnel: mitigate 2-realloc issue [+ + +]
Author: Justin Iurman <justin.iurman@uliege.be>
Date:   Tue Dec 3 13:49:45 2024 +0100

    net: ipv6: rpl_iptunnel: mitigate 2-realloc issue
    
    [ Upstream commit 985ec6f5e6235242191370628acb73d7a9f0c0ea ]
    
    This patch mitigates the two-reallocations issue with rpl_iptunnel by
    providing the dst_entry (in the cache) to the first call to
    skb_cow_head(). As a result, the very first iteration would still
    trigger two reallocations (i.e., empty cache), while next iterations
    would only trigger a single reallocation.
    
    Performance tests before/after applying this patch, which clearly shows
    there is no impact (it even shows improvement):
    - before: https://ibb.co/nQJhqwc
    - after: https://ibb.co/4ZvW6wV
    
    Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
    Cc: Alexander Aring <aahringo@redhat.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: 13e55fbaec17 ("net: ipv6: fix dst ref loop on input in rpl lwt")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ipv6: seg6_iptunnel: mitigate 2-realloc issue [+ + +]
Author: Justin Iurman <justin.iurman@uliege.be>
Date:   Tue Dec 3 13:49:44 2024 +0100

    net: ipv6: seg6_iptunnel: mitigate 2-realloc issue
    
    [ Upstream commit 40475b63761abb6f8fdef960d03228a08662c9c4 ]
    
    This patch mitigates the two-reallocations issue with seg6_iptunnel by
    providing the dst_entry (in the cache) to the first call to
    skb_cow_head(). As a result, the very first iteration would still
    trigger two reallocations (i.e., empty cache), while next iterations
    would only trigger a single reallocation.
    
    Performance tests before/after applying this patch, which clearly shows
    the improvement:
    - before: https://ibb.co/3Cg4sNH
    - after: https://ibb.co/8rQ350r
    
    Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
    Cc: David Lebrun <dlebrun@google.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: c64a0727f9b1 ("net: ipv6: fix dst ref loop on input in seg6 lwt")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: loopback: Avoid sending IP packets without an Ethernet header [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Thu Feb 20 09:25:59 2025 +0200

    net: loopback: Avoid sending IP packets without an Ethernet header
    
    [ Upstream commit 0e4427f8f587c4b603475468bb3aee9418574893 ]
    
    After commit 22600596b675 ("ipv4: give an IPv4 dev to blackhole_netdev")
    IPv4 neighbors can be constructed on the blackhole net device, but they
    are constructed with an output function (neigh_direct_output()) that
    simply calls dev_queue_xmit(). The latter will transmit packets via
    'skb->dev' which might not be the blackhole net device if dst_dev_put()
    switched 'dst->dev' to the blackhole net device while another CPU was
    using the dst entry in ip_output(), but after it already initialized
    'skb->dev' from 'dst->dev'.
    
    Specifically, the following can happen:
    
        CPU1                                      CPU2
    
    udp_sendmsg(sk1)                          udp_sendmsg(sk2)
    udp_send_skb()                            [...]
    ip_output()
        skb->dev = skb_dst(skb)->dev
                                              dst_dev_put()
                                                  dst->dev = blackhole_netdev
    ip_finish_output2()
        resolves neigh on dst->dev
    neigh_output()
    neigh_direct_output()
    dev_queue_xmit()
    
    This will result in IPv4 packets being sent without an Ethernet header
    via a valid net device:
    
    tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
    listening on enp9s0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
    22:07:02.329668 20:00:40:11:18:fb > 45:00:00:44:f4:94, ethertype Unknown
    (0x58c6), length 68:
            0x0000:  8dda 74ca f1ae ca6c ca6c 0098 969c 0400  ..t....l.l......
            0x0010:  0000 4730 3f18 6800 0000 0000 0000 9971  ..G0?.h........q
            0x0020:  c4c9 9055 a157 0a70 9ead bf83 38ca ab38  ...U.W.p....8..8
            0x0030:  8add ab96 e052                           .....R
    
    Fix by making sure that neighbors are constructed on top of the
    blackhole net device with an output function that simply consumes the
    packets, in a similar fashion to dst_discard_out() and
    blackhole_netdev_xmit().
    
    Fixes: 8d7017fd621d ("blackhole_netdev: use blackhole_netdev to invalidate dst entries")
    Fixes: 22600596b675 ("ipv4: give an IPv4 dev to blackhole_netdev")
    Reported-by: Florian Meister <fmei@sfs.com>
    Closes: https://lore.kernel.org/netdev/20250210084931.23a5c2e4@hermes.local/
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250220072559.782296-1-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mvpp2: cls: Fixed Non IP flow, with vlan tag flow defination. [+ + +]
Author: Harshal Chaudhari <hchaudhari@marvell.com>
Date:   Mon Feb 24 20:20:58 2025 -0800

    net: mvpp2: cls: Fixed Non IP flow, with vlan tag flow defination.
    
    [ Upstream commit 2d253726ff7106b39a44483b6864398bba8a2f74 ]
    
    Non IP flow, with vlan tag not working as expected while
    running below command for vlan-priority. fixed that.
    
    ethtool -N eth1 flow-type ether vlan 0x8000 vlan-mask 0x1fff action 0 loc 0
    
    Fixes: 1274daede3ef ("net: mvpp2: cls: Add steering based on vlan Id and priority.")
    Signed-off-by: Harshal Chaudhari <hchaudhari@marvell.com>
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20250225042058.2643838-1-hchaudhari@marvell.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: set the minimum for net_hotdata.netdev_budget_usecs [+ + +]
Author: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Date:   Thu Feb 20 12:07:52 2025 +0100

    net: set the minimum for net_hotdata.netdev_budget_usecs
    
    [ Upstream commit c180188ec02281126045414e90d08422a80f75b4 ]
    
    Commit 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs
    to enable softirq tuning") added a possibility to set
    net_hotdata.netdev_budget_usecs, but added no lower bound checking.
    
    Commit a4837980fd9f ("net: revert default NAPI poll timeout to 2 jiffies")
    made the *initial* value HZ-dependent, so the initial value is at least
    2 jiffies even for lower HZ values (2 ms for 1000 Hz, 8ms for 250 Hz, 20
    ms for 100 Hz).
    
    But a user still can set improper values by a sysctl. Set .extra1
    (the lower bound) for net_hotdata.netdev_budget_usecs to the same value
    as in the latter commit. That is to 2 jiffies.
    
    Fixes: a4837980fd9f ("net: revert default NAPI poll timeout to 2 jiffies")
    Fixes: 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs to enable softirq tuning")
    Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
    Cc: Dmitry Yakunin <zeil@yandex-team.ru>
    Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
    Link: https://patch.msgid.link/20250220110752.137639-1-jirislaby@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netfilter: allow exp not to be removed in nf_ct_find_expectation [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Sun Jul 16 17:09:17 2023 -0400

    netfilter: allow exp not to be removed in nf_ct_find_expectation
    
    commit 4914109a8e1e494c6aa9852f9e84ec77a5fc643f upstream.
    
    Currently nf_conntrack_in() calling nf_ct_find_expectation() will
    remove the exp from the hash table. However, in some scenario, we
    expect the exp not to be removed when the created ct will not be
    confirmed, like in OVS and TC conntrack in the following patches.
    
    This patch allows exp not to be removed by setting IPS_CONFIRMED
    in the status of the tmpl.
    
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Acked-by: Aaron Conole <aconole@redhat.com>
    Acked-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nfp: bpf: Add check for nfp_app_ctrl_msg_alloc() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Tue Feb 18 11:04:09 2025 +0800

    nfp: bpf: Add check for nfp_app_ctrl_msg_alloc()
    
    commit 878e7b11736e062514e58f3b445ff343e6705537 upstream.
    
    Add check for the return value of nfp_app_ctrl_msg_alloc() in
    nfp_bpf_cmsg_alloc() to prevent null pointer dereference.
    
    Fixes: ff3d43f7568c ("nfp: bpf: implement helpers for FW map ops")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Link: https://patch.msgid.link/20250218030409.2425798-1-haoxiang_li2024@163.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nouveau/svm: fix missing folio unlock + put after make_device_exclusive_range() [+ + +]
Author: David Hildenbrand <david@redhat.com>
Date:   Fri Jan 24 19:15:23 2025 +0100

    nouveau/svm: fix missing folio unlock + put after make_device_exclusive_range()
    
    [ Upstream commit b3fefbb30a1691533cb905006b69b2a474660744 ]
    
    In case we have to retry the loop, we are missing to unlock+put the
    folio. In that case, we will keep failing make_device_exclusive_range()
    because we cannot grab the folio lock, and even return from the function
    with the folio locked and referenced, effectively never succeeding the
    make_device_exclusive_range().
    
    While at it, convert the other unlock+put to use a folio as well.
    
    This was found by code inspection.
    
    Fixes: 8f187163eb89 ("nouveau/svm: implement atomic SVM access")
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Alistair Popple <apopple@nvidia.com>
    Tested-by: Alistair Popple <apopple@nvidia.com>
    Signed-off-by: Danilo Krummrich <dakr@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250124181524.3584236-2-david@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme/ioctl: add missing space in err message [+ + +]
Author: Caleb Sander Mateos <csander@purestorage.com>
Date:   Thu Feb 13 10:05:14 2025 -0700

    nvme/ioctl: add missing space in err message
    
    [ Upstream commit 487a3ea7b1b8ba2ca7d2c2bb3c3594dc360d6261 ]
    
    nvme_validate_passthru_nsid() logs an err message whose format string is
    split over 2 lines. There is a missing space between the two pieces,
    resulting in log lines like "... does not match nsid (1)of namespace".
    Add the missing space between ")" and "of". Also combine the format
    string pieces onto a single line to make the err message easier to grep.
    
    Fixes: e7d4b5493a2d ("nvme: factor out a nvme_validate_passthru_nsid helper")
    Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ovl: fix UAF in ovl_dentry_update_reval by moving dput() in ovl_link_up [+ + +]
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Sat Feb 15 00:51:48 2025 +0300

    ovl: fix UAF in ovl_dentry_update_reval by moving dput() in ovl_link_up
    
    [ Upstream commit c84e125fff2615b4d9c259e762596134eddd2f27 ]
    
    The issue was caused by dput(upper) being called before
    ovl_dentry_update_reval(), while upper->d_flags was still
    accessed in ovl_dentry_remote().
    
    Move dput(upper) after its last use to prevent use-after-free.
    
    BUG: KASAN: slab-use-after-free in ovl_dentry_remote fs/overlayfs/util.c:162 [inline]
    BUG: KASAN: slab-use-after-free in ovl_dentry_update_reval+0xd2/0xf0 fs/overlayfs/util.c:167
    
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
     print_address_description mm/kasan/report.c:377 [inline]
     print_report+0xc3/0x620 mm/kasan/report.c:488
     kasan_report+0xd9/0x110 mm/kasan/report.c:601
     ovl_dentry_remote fs/overlayfs/util.c:162 [inline]
     ovl_dentry_update_reval+0xd2/0xf0 fs/overlayfs/util.c:167
     ovl_link_up fs/overlayfs/copy_up.c:610 [inline]
     ovl_copy_up_one+0x2105/0x3490 fs/overlayfs/copy_up.c:1170
     ovl_copy_up_flags+0x18d/0x200 fs/overlayfs/copy_up.c:1223
     ovl_rename+0x39e/0x18c0 fs/overlayfs/dir.c:1136
     vfs_rename+0xf84/0x20a0 fs/namei.c:4893
    ...
     </TASK>
    
    Fixes: b07d5cc93e1b ("ovl: update of dentry revalidate flags after copy up")
    Reported-by: syzbot+316db8a1191938280eb6@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=316db8a1191938280eb6
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Link: https://lore.kernel.org/r/20250214215148.761147-1-kovalev@altlinux.org
    Reviewed-by: Amir Goldstein <amir73il@gmail.com>
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf/core: Fix low freq setting via IOC_PERIOD [+ + +]
Author: Kan Liang <kan.liang@linux.intel.com>
Date:   Fri Jan 17 07:19:12 2025 -0800

    perf/core: Fix low freq setting via IOC_PERIOD
    
    commit 0d39844150546fa1415127c5fbae26db64070dd3 upstream.
    
    A low attr::freq value cannot be set via IOC_PERIOD on some platforms.
    
    The perf_event_check_period() introduced in:
    
      81ec3f3c4c4d ("perf/x86: Add check_period PMU callback")
    
    was intended to check the period, rather than the frequency.
    A low frequency may be mistakenly rejected by limit_period().
    
    Fix it.
    
    Fixes: 81ec3f3c4c4d ("perf/x86: Add check_period PMU callback")
    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250117151913.3043942-2-kan.liang@linux.intel.com
    Closes: https://lore.kernel.org/lkml/20250115154949.3147-1-ravi.bangoria@amd.com/
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
perf/x86: Fix low freqency setting issue [+ + +]
Author: Kan Liang <kan.liang@linux.intel.com>
Date:   Fri Jan 17 07:19:11 2025 -0800

    perf/x86: Fix low freqency setting issue
    
    commit 88ec7eedbbd21cad38707620ad6c48a4e9a87c18 upstream.
    
    Perf doesn't work at low frequencies:
    
      $ perf record -e cpu_core/instructions/ppp -F 120
      Error:
      The sys_perf_event_open() syscall returned with 22 (Invalid argument)
      for event (cpu_core/instructions/ppp).
      "dmesg | grep -i perf" may provide additional information.
    
    The limit_period() check avoids a low sampling period on a counter. It
    doesn't intend to limit the frequency.
    
    The check in the x86_pmu_hw_config() should be limited to non-freq mode.
    The attr.sample_period and attr.sample_freq are union. The
    attr.sample_period should not be used to indicate the frequency mode.
    
    Fixes: c46e665f0377 ("perf/x86: Add INST_RETIRED.ALL workarounds")
    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250117151913.3043942-1-kan.liang@linux.intel.com
    Closes: https://lore.kernel.org/lkml/20250115154949.3147-1-ravi.bangoria@amd.com/
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pfifo_tail_enqueue: Drop new packet when sch->limit == 0 [+ + +]
Author: Quang Le <quanglex97@gmail.com>
Date:   Mon Feb 3 16:58:38 2025 -0800

    pfifo_tail_enqueue: Drop new packet when sch->limit == 0
    
    commit 647cef20e649c576dff271e018d5d15d998b629d upstream.
    
    Expected behaviour:
    In case we reach scheduler's limit, pfifo_tail_enqueue() will drop a
    packet in scheduler's queue and decrease scheduler's qlen by one.
    Then, pfifo_tail_enqueue() enqueue new packet and increase
    scheduler's qlen by one. Finally, pfifo_tail_enqueue() return
    `NET_XMIT_CN` status code.
    
    Weird behaviour:
    In case we set `sch->limit == 0` and trigger pfifo_tail_enqueue() on a
    scheduler that has no packet, the 'drop a packet' step will do nothing.
    This means the scheduler's qlen still has value equal 0.
    Then, we continue to enqueue new packet and increase scheduler's qlen by
    one. In summary, we can leverage pfifo_tail_enqueue() to increase qlen by
    one and return `NET_XMIT_CN` status code.
    
    The problem is:
    Let's say we have two qdiscs: Qdisc_A and Qdisc_B.
     - Qdisc_A's type must have '->graft()' function to create parent/child relationship.
       Let's say Qdisc_A's type is `hfsc`. Enqueue packet to this qdisc will trigger `hfsc_enqueue`.
     - Qdisc_B's type is pfifo_head_drop. Enqueue packet to this qdisc will trigger `pfifo_tail_enqueue`.
     - Qdisc_B is configured to have `sch->limit == 0`.
     - Qdisc_A is configured to route the enqueued's packet to Qdisc_B.
    
    Enqueue packet through Qdisc_A will lead to:
     - hfsc_enqueue(Qdisc_A) -> pfifo_tail_enqueue(Qdisc_B)
     - Qdisc_B->q.qlen += 1
     - pfifo_tail_enqueue() return `NET_XMIT_CN`
     - hfsc_enqueue() check for `NET_XMIT_SUCCESS` and see `NET_XMIT_CN` => hfsc_enqueue() don't increase qlen of Qdisc_A.
    
    The whole process lead to a situation where Qdisc_A->q.qlen == 0 and Qdisc_B->q.qlen == 1.
    Replace 'hfsc' with other type (for example: 'drr') still lead to the same problem.
    This violate the design where parent's qlen should equal to the sum of its childrens'qlen.
    
    Bug impact: This issue can be used for user->kernel privilege escalation when it is reachable.
    
    Fixes: 57dbb2d83d10 ("sched: add head drop fifo queue")
    Reported-by: Quang Le <quanglex97@gmail.com>
    Signed-off-by: Quang Le <quanglex97@gmail.com>
    Signed-off-by: Cong Wang <cong.wang@bytedance.com>
    Link: https://patch.msgid.link/20250204005841.223511-2-xiyou.wangcong@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
phy: exynos5-usbdrd: fix MPLL_MULTIPLIER and SSC_REFCLKSEL masks in refclk [+ + +]
Author: Kaustabh Chakraborty <kauschluss@disroot.org>
Date:   Sun Feb 9 00:29:30 2025 +0530

    phy: exynos5-usbdrd: fix MPLL_MULTIPLIER and SSC_REFCLKSEL masks in refclk
    
    commit e2158c953c973adb49383ddea2504faf08d375b7 upstream.
    
    In exynos5_usbdrd_{pipe3,utmi}_set_refclk(), the masks
    PHYCLKRST_MPLL_MULTIPLIER_MASK and PHYCLKRST_SSC_REFCLKSEL_MASK are not
    inverted when applied to the register values. Fix it.
    
    Cc: stable@vger.kernel.org
    Fixes: 59025887fb08 ("phy: Add new Exynos5 USB 3.0 PHY driver")
    Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Anand Moon <linux.amoon@gmail.com>
    Link: https://lore.kernel.org/r/20250209-exynos5-usbdrd-masks-v1-1-4f7f83f323d7@disroot.org
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

phy: rockchip: naneng-combphy: compatible reset with old DT [+ + +]
Author: Chukun Pan <amadeus@jmu.edu.cn>
Date:   Mon Jan 6 18:00:01 2025 +0800

    phy: rockchip: naneng-combphy: compatible reset with old DT
    
    [ Upstream commit 3126ea9be66b53e607f87f067641ba724be24181 ]
    
    The device tree of RK3568 did not specify reset-names before.
    So add fallback to old behaviour to be compatible with old DT.
    
    Fixes: fbcbffbac994 ("phy: rockchip: naneng-combphy: fix phy reset")
    Cc: Jianfeng Liu <liujianfeng1994@gmail.com>
    Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
    Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
    Link: https://lore.kernel.org/r/20250106100001.1344418-2-amadeus@jmu.edu.cn
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

phy: tegra: xusb: reset VBUS & ID OVERRIDE [+ + +]
Author: BH Hsieh <bhsieh@nvidia.com>
Date:   Wed Jan 22 18:59:43 2025 +0800

    phy: tegra: xusb: reset VBUS & ID OVERRIDE
    
    commit 55f1a5f7c97c3c92ba469e16991a09274410ceb7 upstream.
    
    Observed VBUS_OVERRIDE & ID_OVERRIDE might be programmed
    with unexpected value prior to XUSB PADCTL driver, this
    could also occur in virtualization scenario.
    
    For example, UEFI firmware programs ID_OVERRIDE=GROUNDED to set
    a type-c port to host mode and keeps the value to kernel.
    If the type-c port is connected a usb host, below errors can be
    observed right after usb host mode driver gets probed. The errors
    would keep until usb role class driver detects the type-c port
    as device mode and notifies usb device mode driver to set both
    ID_OVERRIDE and VBUS_OVERRIDE to correct value by XUSB PADCTL
    driver.
    
    [  173.765814] usb usb3-port2: Cannot enable. Maybe the USB cable is bad?
    [  173.765837] usb usb3-port2: config error
    
    Taking virtualization into account, asserting XUSB PADCTL
    reset would break XUSB functions used by other guest OS,
    hence only reset VBUS & ID OVERRIDE of the port in
    utmi_phy_init.
    
    Fixes: bbf711682cd5 ("phy: tegra: xusb: Add Tegra186 support")
    Cc: stable@vger.kernel.org
    Change-Id: Ic63058d4d49b4a1f8f9ab313196e20ad131cc591
    Signed-off-by: BH Hsieh <bhsieh@nvidia.com>
    Signed-off-by: Henry Lin <henryl@nvidia.com>
    Link: https://lore.kernel.org/r/20250122105943.8057-1-henryl@nvidia.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
power: supply: da9150-fg: fix potential overflow [+ + +]
Author: Andrey Vatoropin <a.vatoropin@crpt.ru>
Date:   Thu Jan 30 09:00:34 2025 +0000

    power: supply: da9150-fg: fix potential overflow
    
    [ Upstream commit 3fb3cb4350befc4f901c54e0cb4a2a47b1302e08 ]
    
    Size of variable sd_gain equals four bytes - DA9150_QIF_SD_GAIN_SIZE.
    Size of variable shunt_val equals two bytes - DA9150_QIF_SHUNT_VAL_SIZE.
    
    The expression sd_gain * shunt_val is currently being evaluated using
    32-bit arithmetic. So during the multiplication an overflow may occur.
    
    As the value of type 'u64' is used as storage for the eventual result, put
    ULL variable at the first position of each expression in order to give the
    compiler complete information about the proper arithmetic to use. According
    to C99 the guaranteed width for a variable of type 'unsigned long long' >=
    64 bits.
    
    Remove the explicit cast to u64 as it is meaningless.
    
    Just for the sake of consistency, perform the similar trick with another
    expression concerning 'iavg'.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: a419b4fd9138 ("power: Add support for DA9150 Fuel-Gauge")
    Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
    Link: https://lore.kernel.org/r/20250130090030.53422-1-a.vatoropin@crpt.ru
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
powerpc/64s/mm: Move __real_pte stubs into hash-4k.h [+ + +]
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Wed Aug 21 18:07:29 2024 +1000

    powerpc/64s/mm: Move __real_pte stubs into hash-4k.h
    
    [ Upstream commit 8ae4f16f7d7b59cca55aeca6db7c9636ffe7fbaa ]
    
    The stub versions of __real_pte() etc are only used with HPT & 4K pages,
    so move them into the hash-4k.h header.
    
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20240821080729.872034-1-mpe@ellerman.id.au
    Stable-dep-of: 61bcc752d1b8 ("powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline [+ + +]
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Sun Jan 12 19:24:46 2025 +0100

    powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline
    
    [ Upstream commit 61bcc752d1b81fde3cae454ff20c1d3c359df500 ]
    
    Rewrite __real_pte() and __rpte_to_hidx() as static inline in order to
    avoid following warnings/errors when building with 4k page size:
    
              CC      arch/powerpc/mm/book3s64/hash_tlb.o
            arch/powerpc/mm/book3s64/hash_tlb.c: In function 'hpte_need_flush':
            arch/powerpc/mm/book3s64/hash_tlb.c:49:16: error: variable 'offset' set but not used [-Werror=unused-but-set-variable]
               49 |         int i, offset;
                  |                ^~~~~~
    
              CC      arch/powerpc/mm/book3s64/hash_native.o
            arch/powerpc/mm/book3s64/hash_native.c: In function 'native_flush_hash_range':
            arch/powerpc/mm/book3s64/hash_native.c:782:29: error: variable 'index' set but not used [-Werror=unused-but-set-variable]
              782 |         unsigned long hash, index, hidx, shift, slot;
                  |                             ^~~~~
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202501081741.AYFwybsq-lkp@intel.com/
    Fixes: ff31e105464d ("powerpc/mm/hash64: Store the slot information at the right offset for hugetlb")
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/e0d340a5b7bd478ecbf245d826e6ab2778b74e06.1736706263.git.christophe.leroy@csgroup.eu
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
powerpc/code-patching: Fix KASAN hit by not flagging text patching area as VM_ALLOC [+ + +]
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Wed Feb 12 07:46:28 2025 +0100

    powerpc/code-patching: Fix KASAN hit by not flagging text patching area as VM_ALLOC
    
    [ Upstream commit d262a192d38e527faa5984629aabda2e0d1c4f54 ]
    
    Erhard reported the following KASAN hit while booting his PowerMac G4
    with a KASAN-enabled kernel 6.13-rc6:
    
      BUG: KASAN: vmalloc-out-of-bounds in copy_to_kernel_nofault+0xd8/0x1c8
      Write of size 8 at addr f1000000 by task chronyd/1293
    
      CPU: 0 UID: 123 PID: 1293 Comm: chronyd Tainted: G        W          6.13.0-rc6-PMacG4 #2
      Tainted: [W]=WARN
      Hardware name: PowerMac3,6 7455 0x80010303 PowerMac
      Call Trace:
      [c2437590] [c1631a84] dump_stack_lvl+0x70/0x8c (unreliable)
      [c24375b0] [c0504998] print_report+0xdc/0x504
      [c2437610] [c050475c] kasan_report+0xf8/0x108
      [c2437690] [c0505a3c] kasan_check_range+0x24/0x18c
      [c24376a0] [c03fb5e4] copy_to_kernel_nofault+0xd8/0x1c8
      [c24376c0] [c004c014] patch_instructions+0x15c/0x16c
      [c2437710] [c00731a8] bpf_arch_text_copy+0x60/0x7c
      [c2437730] [c0281168] bpf_jit_binary_pack_finalize+0x50/0xac
      [c2437750] [c0073cf4] bpf_int_jit_compile+0xb30/0xdec
      [c2437880] [c0280394] bpf_prog_select_runtime+0x15c/0x478
      [c24378d0] [c1263428] bpf_prepare_filter+0xbf8/0xc14
      [c2437990] [c12677ec] bpf_prog_create_from_user+0x258/0x2b4
      [c24379d0] [c027111c] do_seccomp+0x3dc/0x1890
      [c2437ac0] [c001d8e0] system_call_exception+0x2dc/0x420
      [c2437f30] [c00281ac] ret_from_syscall+0x0/0x2c
      --- interrupt: c00 at 0x5a1274
      NIP:  005a1274 LR: 006a3b3c CTR: 005296c8
      REGS: c2437f40 TRAP: 0c00   Tainted: G        W           (6.13.0-rc6-PMacG4)
      MSR:  0200f932 <VEC,EE,PR,FP,ME,IR,DR,RI>  CR: 24004422  XER: 00000000
    
      GPR00: 00000166 af8f3fa0 a7ee3540 00000001 00000000 013b6500 005a5858 0200f932
      GPR08: 00000000 00001fe9 013d5fc8 005296c8 2822244c 00b2fcd8 00000000 af8f4b57
      GPR16: 00000000 00000001 00000000 00000000 00000000 00000001 00000000 00000002
      GPR24: 00afdbb0 00000000 00000000 00000000 006e0004 013ce060 006e7c1c 00000001
      NIP [005a1274] 0x5a1274
      LR [006a3b3c] 0x6a3b3c
      --- interrupt: c00
    
      The buggy address belongs to the virtual mapping at
       [f1000000, f1002000) created by:
       text_area_cpu_up+0x20/0x190
    
      The buggy address belongs to the physical page:
      page: refcount:1 mapcount:0 mapping:00000000 index:0x0 pfn:0x76e30
      flags: 0x80000000(zone=2)
      raw: 80000000 00000000 00000122 00000000 00000000 00000000 ffffffff 00000001
      raw: 00000000
      page dumped because: kasan: bad access detected
    
      Memory state around the buggy address:
       f0ffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
       f0ffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      >f1000000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
                 ^
       f1000080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
       f1000100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
      ==================================================================
    
    f8 corresponds to KASAN_VMALLOC_INVALID which means the area is not
    initialised hence not supposed to be used yet.
    
    Powerpc text patching infrastructure allocates a virtual memory area
    using get_vm_area() and flags it as VM_ALLOC. But that flag is meant
    to be used for vmalloc() and vmalloc() allocated memory is not
    supposed to be used before a call to __vmalloc_node_range() which is
    never called for that area.
    
    That went undetected until commit e4137f08816b ("mm, kasan, kmsan:
    instrument copy_from/to_kernel_nofault")
    
    The area allocated by text_area_cpu_up() is not vmalloc memory, it is
    mapped directly on demand when needed by map_kernel_page(). There is
    no VM flag corresponding to such usage, so just pass no flag. That way
    the area will be unpoisonned and usable immediately.
    
    Reported-by: Erhard Furtner <erhard_f@mailbox.org>
    Closes: https://lore.kernel.org/all/20250112135832.57c92322@yea/
    Fixes: 37bc3e5fd764 ("powerpc/lib/code-patching: Use alternate map for patch_instruction()")
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/06621423da339b374f48c0886e3a5db18e896be8.1739342693.git.christophe.leroy@csgroup.eu
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ptrace: Introduce exception_ip arch hook [+ + +]
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
Date:   Fri Feb 2 12:30:26 2024 +0000

    ptrace: Introduce exception_ip arch hook
    
    commit 11ba1728be3edb6928791f4c622f154ebe228ae6 upstream.
    
    On architectures with delay slot, architecture level instruction
    pointer (or program counter) in pt_regs may differ from where
    exception was triggered.
    
    Introduce exception_ip hook to invoke architecture code and determine
    actual instruction pointer to the exception.
    
    Link: https://lore.kernel.org/lkml/00d1b813-c55f-4365-8d81-d70258e10b16@app.fastmail.com/
    Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: Salvatore Bonaccorso <carnil@debian.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA/mlx5: Fix bind QP error cleanup flow [+ + +]
Author: Patrisious Haddad <phaddad@nvidia.com>
Date:   Thu Feb 20 08:47:10 2025 +0200

    RDMA/mlx5: Fix bind QP error cleanup flow
    
    [ Upstream commit e1a0bdbdfdf08428f0ede5ae49c7f4139ac73ef5 ]
    
    When there is a failure during bind QP, the cleanup flow destroys the
    counter regardless if it is the one that created it or not, which is
    problematic since if it isn't the one that created it, that counter could
    still be in use.
    
    Fix that by destroying the counter only if it was created during this call.
    
    Fixes: 45842fc627c7 ("IB/mlx5: Support statistic q counter configuration")
    Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
    Reviewed-by: Mark Zhang <markzhang@nvidia.com>
    Link: https://patch.msgid.link/25dfefddb0ebefa668c32e06a94d84e3216257cf.1740033937.git.leon@kernel.org
    Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
riscv/futex: sign extend compare value in atomic cmpxchg [+ + +]
Author: Andreas Schwab <schwab@suse.de>
Date:   Mon Feb 3 11:06:00 2025 +0100

    riscv/futex: sign extend compare value in atomic cmpxchg
    
    commit 599c44cd21f4967774e0acf58f734009be4aea9a upstream.
    
    Make sure the compare value in the lr/sc loop is sign extended to match
    what lr.w does.  Fortunately, due to the compiler keeping the register
    contents sign extended anyway the lack of the explicit extension didn't
    result in wrong code so far, but this cannot be relied upon.
    
    Fixes: b90edb33010b ("RISC-V: Add futex support.")
    Signed-off-by: Andreas Schwab <schwab@suse.de>
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/mvmfrkv2vhz.fsf@suse.de
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sched/core: Prevent rescheduling when interrupts are disabled [+ + +]
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Mon Dec 16 14:20:56 2024 +0100

    sched/core: Prevent rescheduling when interrupts are disabled
    
    commit 82c387ef7568c0d96a918a5a78d9cad6256cfa15 upstream.
    
    David reported a warning observed while loop testing kexec jump:
    
      Interrupts enabled after irqrouter_resume+0x0/0x50
      WARNING: CPU: 0 PID: 560 at drivers/base/syscore.c:103 syscore_resume+0x18a/0x220
       kernel_kexec+0xf6/0x180
       __do_sys_reboot+0x206/0x250
       do_syscall_64+0x95/0x180
    
    The corresponding interrupt flag trace:
    
      hardirqs last  enabled at (15573): [<ffffffffa8281b8e>] __up_console_sem+0x7e/0x90
      hardirqs last disabled at (15580): [<ffffffffa8281b73>] __up_console_sem+0x63/0x90
    
    That means __up_console_sem() was invoked with interrupts enabled. Further
    instrumentation revealed that in the interrupt disabled section of kexec
    jump one of the syscore_suspend() callbacks woke up a task, which set the
    NEED_RESCHED flag. A later callback in the resume path invoked
    cond_resched() which in turn led to the invocation of the scheduler:
    
      __cond_resched+0x21/0x60
      down_timeout+0x18/0x60
      acpi_os_wait_semaphore+0x4c/0x80
      acpi_ut_acquire_mutex+0x3d/0x100
      acpi_ns_get_node+0x27/0x60
      acpi_ns_evaluate+0x1cb/0x2d0
      acpi_rs_set_srs_method_data+0x156/0x190
      acpi_pci_link_set+0x11c/0x290
      irqrouter_resume+0x54/0x60
      syscore_resume+0x6a/0x200
      kernel_kexec+0x145/0x1c0
      __do_sys_reboot+0xeb/0x240
      do_syscall_64+0x95/0x180
    
    This is a long standing problem, which probably got more visible with
    the recent printk changes. Something does a task wakeup and the
    scheduler sets the NEED_RESCHED flag. cond_resched() sees it set and
    invokes schedule() from a completely bogus context. The scheduler
    enables interrupts after context switching, which causes the above
    warning at the end.
    
    Quite some of the code paths in syscore_suspend()/resume() can result in
    triggering a wakeup with the exactly same consequences. They might not
    have done so yet, but as they share a lot of code with normal operations
    it's just a question of time.
    
    The problem only affects the PREEMPT_NONE and PREEMPT_VOLUNTARY scheduling
    models. Full preemption is not affected as cond_resched() is disabled and
    the preemption check preemptible() takes the interrupt disabled flag into
    account.
    
    Cure the problem by adding a corresponding check into cond_resched().
    
    Reported-by: David Woodhouse <dwmw@amazon.co.uk>
    Suggested-by: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Tested-by: David Woodhouse <dwmw@amazon.co.uk>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: stable@vger.kernel.org
    Closes: https://lore.kernel.org/all/7717fe2ac0ce5f0a2c43fdab8b11f4483d54a2a4.camel@infradead.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
scsi: core: Clear driver private data when retrying request [+ + +]
Author: Ye Bin <yebin10@huawei.com>
Date:   Mon Feb 17 10:16:28 2025 +0800

    scsi: core: Clear driver private data when retrying request
    
    [ Upstream commit dce5c4afd035e8090a26e5d776b1682c0e649683 ]
    
    After commit 1bad6c4a57ef ("scsi: zero per-cmd private driver data for each
    MQ I/O"), the xen-scsifront/virtio_scsi/snic drivers all removed code that
    explicitly zeroed driver-private command data.
    
    In combination with commit 464a00c9e0ad ("scsi: core: Kill DRIVER_SENSE"),
    after virtio_scsi performs a capacity expansion, the first request will
    return a unit attention to indicate that the capacity has changed. And then
    the original command is retried. As driver-private command data was not
    cleared, the request would return UA again and eventually time out and fail.
    
    Zero driver-private command data when a request is retried.
    
    Fixes: f7de50da1479 ("scsi: xen-scsifront: Remove code that zeroes driver-private command data")
    Fixes: c2bb87318baa ("scsi: virtio_scsi: Remove code that zeroes driver-private command data")
    Fixes: c3006a926468 ("scsi: snic: Remove code that zeroes driver-private command data")
    Signed-off-by: Ye Bin <yebin10@huawei.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://lore.kernel.org/r/20250217021628.2929248-1-yebin@huaweicloud.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: core: Do not retry I/Os during depopulation [+ + +]
Author: Igor Pylypiv <ipylypiv@google.com>
Date:   Fri Jan 31 10:44:07 2025 -0800

    scsi: core: Do not retry I/Os during depopulation
    
    [ Upstream commit 9ff7c383b8ac0c482a1da7989f703406d78445c6 ]
    
    Fail I/Os instead of retry to prevent user space processes from being
    blocked on the I/O completion for several minutes.
    
    Retrying I/Os during "depopulation in progress" or "depopulation restore in
    progress" results in a continuous retry loop until the depopulation
    completes or until the I/O retry loop is aborted due to a timeout by the
    scsi_cmd_runtime_exceeced().
    
    Depopulation is slow and can take 24+ hours to complete on 20+ TB HDDs.
    Most I/Os in the depopulation retry loop end up taking several minutes
    before returning the failure to user space.
    
    Cc: stable@vger.kernel.org # 4.18.x: 2bbeb8d scsi: core: Handle depopulation and restoration in progress
    Cc: stable@vger.kernel.org # 4.18.x
    Fixes: e37c7d9a0341 ("scsi: core: sanitize++ in progress")
    Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
    Link: https://lore.kernel.org/r/20250131184408.859579-1-ipylypiv@google.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: core: Handle depopulation and restoration in progress [+ + +]
Author: Douglas Gilbert <dgilbert@interlog.com>
Date:   Sun Oct 15 01:06:50 2023 -0400

    scsi: core: Handle depopulation and restoration in progress
    
    [ Upstream commit 2bbeb8d12404cf0603f513fc33269ef9abfbb396 ]
    
    The default handling of the NOT READY sense key is to wait for the device
    to become ready. The "wait" is assumed to be relatively short. However
    there is a sub-class of NOT READY that have the "... in progress" phrase in
    their additional sense code and these can take much longer.  Following on
    from commit 505aa4b6a883 ("scsi: sd: Defer spinning up drive while SANITIZE
    is in progress") we now have element depopulation and restoration that can
    take a long time.  For example, over 24 hours for a 20 TB, 7200 rpm hard
    disk to depopulate 1 of its 20 elements.
    
    Add handling of ASC/ASCQ: 0x4,0x24 (depopulation in progress)
    and ASC/ASCQ: 0x4,0x25 (depopulation restoration in progress)
    to sd.c . The scsi_lib.c has incomplete handling of these
    two messages, so complete it.
    
    Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
    Link: https://lore.kernel.org/r/20231015050650.131145-1-dgilbert@interlog.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Stable-dep-of: 9ff7c383b8ac ("scsi: core: Do not retry I/Os during depopulation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
smb: client: Add check for next_buffer in receive_encrypted_standard() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Mon Feb 17 15:20:38 2025 +0800

    smb: client: Add check for next_buffer in receive_encrypted_standard()
    
    commit 860ca5e50f73c2a1cef7eefc9d39d04e275417f7 upstream.
    
    Add check for the return value of cifs_buf_get() and cifs_small_buf_get()
    in receive_encrypted_standard() to prevent null pointer dereference.
    
    Fixes: eec04ea11969 ("smb: client: fix OOB in receive_encrypted_standard()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
soc/mediatek: mtk-devapc: Convert to platform remove callback returning void [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Mon Sep 25 11:55:05 2023 +0200

    soc/mediatek: mtk-devapc: Convert to platform remove callback returning void
    
    [ Upstream commit a129ac3555c0dca6f04ae404dc0f0790656587fb ]
    
    The .remove() callback for a platform driver returns an int which makes
    many driver authors wrongly assume it's possible to do error handling by
    returning an error code. However the value returned is ignored (apart
    from emitting a warning) and this typically results in resource leaks.
    To improve here there is a quest to make the remove callback return
    void. In the first step of this quest all drivers are converted to
    .remove_new() which already returns void. Eventually after all drivers
    are converted, .remove_new() will be renamed to .remove().
    
    Trivially convert this driver from always returning zero in the remove
    callback to the void returning variant.
    
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/20230925095532.1984344-15-u.kleine-koenig@pengutronix.de
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Stable-dep-of: c9c0036c1990 ("soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Sat Jan 4 15:20:12 2025 +0100

    soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove
    
    [ Upstream commit c9c0036c1990da8d2dd33563e327e05a775fcf10 ]
    
    Driver removal should fully clean up - unmap the memory.
    
    Fixes: 0890beb22618 ("soc: mediatek: add mt6779 devapc driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20250104142012.115974-2-krzysztof.kozlowski@linaro.org
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

soc: mediatek: mtk-devapc: Fix leaking IO map on error paths [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Sat Jan 4 15:20:11 2025 +0100

    soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
    
    [ Upstream commit c0eb059a4575ed57f265d9883a5203799c19982c ]
    
    Error paths of mtk_devapc_probe() should unmap the memory.  Reported by
    Smatch:
    
      drivers/soc/mediatek/mtk-devapc.c:292 mtk_devapc_probe() warn: 'ctx->infra_base' from of_iomap() not released on lines: 277,281,286.
    
    Fixes: 0890beb22618 ("soc: mediatek: add mt6779 devapc driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20250104142012.115974-1-krzysztof.kozlowski@linaro.org
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

soc: mediatek: mtk-devapc: Switch to devm_clk_get_enabled() [+ + +]
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date:   Thu Oct 6 13:09:35 2022 +0200

    soc: mediatek: mtk-devapc: Switch to devm_clk_get_enabled()
    
    [ Upstream commit 916120df5aa926d65f4666c075ed8d4955ef7bab ]
    
    This driver does exactly devm_clk_get() and clk_prepare_enable() right
    after, which is exactly what devm_clk_get_enabled() does: clean that
    up by switching to the latter.
    
    This commit brings no functional changes.
    
    Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/20221006110935.59695-1-angelogioacchino.delregno@collabora.com
    Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
    Stable-dep-of: c0eb059a4575 ("soc: mediatek: mtk-devapc: Fix leaking IO map on error paths")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
spi: atmel-qspi: Memory barriers after memory-mapped I/O [+ + +]
Author: Bence Csókás <csokas.bence@prolan.hu>
Date:   Thu Dec 19 10:12:58 2024 +0100

    spi: atmel-qspi: Memory barriers after memory-mapped I/O
    
    [ Upstream commit be92ab2de0ee1a13291c3b47b2d7eb24d80c0a2c ]
    
    The QSPI peripheral control and status registers are
    accessible via the SoC's APB bus, whereas MMIO transactions'
    data travels on the AHB bus.
    
    Microchip documentation and even sample code from Atmel
    emphasises the need for a memory barrier before the first
    MMIO transaction to the AHB-connected QSPI, and before the
    last write to its registers via APB. This is achieved by
    the following lines in `atmel_qspi_transfer()`:
    
            /* Dummy read of QSPI_IFR to synchronize APB and AHB accesses */
            (void)atmel_qspi_read(aq, QSPI_IFR);
    
    However, the current documentation makes no mention to
    synchronization requirements in the other direction, i.e.
    after the last data written via AHB, and before the first
    register access on APB.
    
    In our case, we were facing an issue where the QSPI peripheral
    would cease to send any new CSR (nCS Rise) interrupts,
    leading to a timeout in `atmel_qspi_wait_for_completion()`
    and ultimately this panic in higher levels:
    
            ubi0 error: ubi_io_write: error -110 while writing 63108 bytes
     to PEB 491:128, written 63104 bytes
    
    After months of extensive research of the codebase, fiddling
    around the debugger with kgdb, and back-and-forth with
    Microchip, we came to the conclusion that the issue is
    probably that the peripheral is still busy receiving on AHB
    when the LASTXFER bit is written to its Control Register
    on APB, therefore this write gets lost, and the peripheral
    still thinks there is more data to come in the MMIO transfer.
    This was first formulated when we noticed that doubling the
    write() of QSPI_CR_LASTXFER seemed to solve the problem.
    
    Ultimately, the solution is to introduce memory barriers
    after the AHB-mapped MMIO transfers, to ensure ordering.
    
    Fixes: d5433def3153 ("mtd: spi-nor: atmel-quadspi: Add spi-mem support to atmel-quadspi")
    Cc: Hari.PrasathGE@microchip.com
    Cc: Mahesh.Abotula@microchip.com
    Cc: Marco.Cardellini@microchip.com
    Cc: stable@vger.kernel.org # c0a0203cf579: ("spi: atmel-quadspi: Create `atmel_qspi_ops`"...)
    Cc: stable@vger.kernel.org # 6.x.y
    Signed-off-by: Bence Csókás <csokas.bence@prolan.hu>
    Link: https://patch.msgid.link/20241219091258.395187-1-csokas.bence@prolan.hu
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

spi: atmel-quadspi: Add support for configuring CS timing [+ + +]
Author: Tudor Ambarus <tudor.ambarus@linaro.org>
Date:   Thu Nov 17 12:52:45 2022 +0200

    spi: atmel-quadspi: Add support for configuring CS timing
    
    [ Upstream commit f732646d0ccd22f42ed7de5e59c0abb7a848e034 ]
    
    The at91 QSPI IP uses a default value of half of the period of the QSPI
    clock period for the cs-setup time, which is not always enough, an example
    being the sst26vf064b SPI NOR flash which requires a minimum cs-setup time
    of 5 ns. It was observed that none of the at91 SoCs can fulfill the
    minimum CS setup time for the aforementioned flash, as they operate at
    high frequencies and half a period does not suffice for the required CS
    setup time. Add support for configuring the CS timing in the controller.
    
    Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
    Link: https://lore.kernel.org/r/20221117105249.115649-5-tudor.ambarus@microchip.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: be92ab2de0ee ("spi: atmel-qspi: Memory barriers after memory-mapped I/O")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

spi: atmel-quadspi: Avoid overwriting delay register settings [+ + +]
Author: Alexander Dahl <ada@thorsis.com>
Date:   Wed Sep 18 10:27:43 2024 +0200

    spi: atmel-quadspi: Avoid overwriting delay register settings
    
    commit 329ca3eed4a9a161515a8714be6ba182321385c7 upstream.
    
    Previously the MR and SCR registers were just set with the supposedly
    required values, from cached register values (cached reg content
    initialized to zero).
    
    All parts fixed here did not consider the current register (cache)
    content, which would make future support of cs_setup, cs_hold, and
    cs_inactive impossible.
    
    Setting SCBR in atmel_qspi_setup() erases a possible DLYBS setting from
    atmel_qspi_set_cs_timing().  The DLYBS setting is applied by ORing over
    the current setting, without resetting the bits first.  All writes to MR
    did not consider possible settings of DLYCS and DLYBCT.
    
    Signed-off-by: Alexander Dahl <ada@thorsis.com>
    Fixes: f732646d0ccd ("spi: atmel-quadspi: Add support for configuring CS timing")
    Link: https://patch.msgid.link/20240918082744.379610-2-ada@thorsis.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

spi: atmel-quadspi: Create `atmel_qspi_ops` to support newer SoC families [+ + +]
Author: Csókás, Bence <csokas.bence@prolan.hu>
Date:   Thu Nov 28 18:43:14 2024 +0100

    spi: atmel-quadspi: Create `atmel_qspi_ops` to support newer SoC families
    
    [ Upstream commit c0a0203cf57963792d59b3e4317a1d07b73df42a ]
    
    Refactor the code to introduce an ops struct, to prepare for merging
    support for later SoCs, such as SAMA7G5. This code was based on the
    vendor's kernel (linux4microchip). Cc'ing original contributors.
    
    Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
    Link: https://patch.msgid.link/20241128174316.3209354-2-csokas.bence@prolan.hu
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: be92ab2de0ee ("spi: atmel-qspi: Memory barriers after memory-mapped I/O")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

spi: atmel-quadspi: Fix wrong register value written to MR [+ + +]
Author: Alexander Dahl <ada@thorsis.com>
Date:   Thu Sep 26 11:03:56 2024 +0200

    spi: atmel-quadspi: Fix wrong register value written to MR
    
    commit 162d9b5d2308c7e48efbc97d36babbf4d73b2c61 upstream.
    
    aq->mr should go to MR, nothing else.
    
    Fixes: 329ca3eed4a9 ("spi: atmel-quadspi: Avoid overwriting delay register settings")
    Signed-off-by: Alexander Dahl <ada@thorsis.com>
    Link: https://lore.kernel.org/linux-spi/20240926-macarena-wincing-7c4995487a29@thorsis.com/T/#u
    Link: https://patch.msgid.link/20240926090356.105789-1-ada@thorsis.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

spi: atmel-quadspi: switch to use modern name [+ + +]
Author: Yang Yingliang <yangyingliang@huawei.com>
Date:   Tue Jan 10 21:18:05 2023 +0800

    spi: atmel-quadspi: switch to use modern name
    
    [ Upstream commit ccbc6554ed66dc37778b8ed823bcaaabfb1731cf ]
    
    Change legacy name master to modern name host or controller.
    
    No functional changed.
    
    Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
    Link: https://lore.kernel.org/r/20230110131805.2827248-4-yangyingliang@huawei.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Stable-dep-of: be92ab2de0ee ("spi: atmel-qspi: Memory barriers after memory-mapped I/O")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Squashfs: check the inode number is not the invalid value of zero [+ + +]
Author: Phillip Lougher <phillip@squashfs.org.uk>
Date:   Mon Apr 8 23:02:06 2024 +0100

    Squashfs: check the inode number is not the invalid value of zero
    
    commit 9253c54e01b6505d348afbc02abaa4d9f8a01395 upstream.
    
    Syskiller has produced an out of bounds access in fill_meta_index().
    
    That out of bounds access is ultimately caused because the inode
    has an inode number with the invalid value of zero, which was not checked.
    
    The reason this causes the out of bounds access is due to following
    sequence of events:
    
    1. Fill_meta_index() is called to allocate (via empty_meta_index())
       and fill a metadata index.  It however suffers a data read error
       and aborts, invalidating the newly returned empty metadata index.
       It does this by setting the inode number of the index to zero,
       which means unused (zero is not a valid inode number).
    
    2. When fill_meta_index() is subsequently called again on another
       read operation, locate_meta_index() returns the previous index
       because it matches the inode number of 0.  Because this index
       has been returned it is expected to have been filled, and because
       it hasn't been, an out of bounds access is performed.
    
    This patch adds a sanity check which checks that the inode number
    is not zero when the inode is created and returns -EINVAL if it is.
    
    [phillip@squashfs.org.uk: whitespace fix]
      Link: https://lkml.kernel.org/r/20240409204723.446925-1-phillip@squashfs.org.uk
    Link: https://lkml.kernel.org/r/20240408220206.435788-1-phillip@squashfs.org.uk
    Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
    Reported-by: "Ubisectech Sirius" <bugreport@ubisectech.com>
    Closes: https://lore.kernel.org/lkml/87f5c007-b8a5-41ae-8b57-431e924c5915.bugreport@ubisectech.com/
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: He Zhe <zhe.he@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
strparser: Add read_sock callback [+ + +]
Author: Jiayuan Chen <mrpre@163.com>
Date:   Wed Jan 22 18:09:13 2025 +0800

    strparser: Add read_sock callback
    
    [ Upstream commit 0532a79efd68a4d9686b0385e4993af4b130ff82 ]
    
    Added a new read_sock handler, allowing users to customize read operations
    instead of relying on the native socket's read_sock.
    
    Signed-off-by: Jiayuan Chen <mrpre@163.com>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Acked-by: John Fastabend <john.fastabend@gmail.com>
    Link: https://patch.msgid.link/20250122100917.49845-2-mrpre@163.com
    Stable-dep-of: 36b62df5683c ("bpf: Fix wrong copied_seq calculation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
SUNRPC: convert RPC_TASK_* constants to enum [+ + +]
Author: Stephen Brennan <stephen.s.brennan@oracle.com>
Date:   Mon Aug 19 08:58:59 2024 -0700

    SUNRPC: convert RPC_TASK_* constants to enum
    
    [ Upstream commit 0b108e83795c9c23101f584ef7e3ab4f1f120ef0 ]
    
    The RPC_TASK_* constants are defined as macros, which means that most
    kernel builds will not contain their definitions in the debuginfo.
    However, it's quite useful for debuggers to be able to view the task
    state constant and interpret it correctly. Conversion to an enum will
    ensure the constants are present in debuginfo and can be interpreted by
    debuggers without needing to hard-code them and track their changes.
    
    Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Stable-dep-of: 5bbd6e863b15 ("SUNRPC: Prevent looping due to rpc_signal_task() races")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

SUNRPC: Prevent looping due to rpc_signal_task() races [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Sat Feb 1 15:00:02 2025 -0500

    SUNRPC: Prevent looping due to rpc_signal_task() races
    
    [ Upstream commit 5bbd6e863b15a85221e49b9bdb2d5d8f0bb91f3d ]
    
    If rpc_signal_task() is called while a task is in an rpc_call_done()
    callback function, and the latter calls rpc_restart_call(), the task can
    end up looping due to the RPC_TASK_SIGNALLED flag being set without the
    tk_rpc_status being set.
    Removing the redundant mechanism for signalling the task fixes the
    looping behaviour.
    
    Reported-by: Li Lingfeng <lilingfeng3@huawei.com>
    Fixes: 39494194f93b ("SUNRPC: Fix races with rpc_killall_tasks()")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sunrpc: suppress warnings for unused procfs functions [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Feb 25 15:52:21 2025 +0100

    sunrpc: suppress warnings for unused procfs functions
    
    [ Upstream commit 1f7a4f98c11fbeb18ed21f3b3a497e90a50ad2e0 ]
    
    There is a warning about unused variables when building with W=1 and no procfs:
    
    net/sunrpc/cache.c:1660:30: error: 'cache_flush_proc_ops' defined but not used [-Werror=unused-const-variable=]
     1660 | static const struct proc_ops cache_flush_proc_ops = {
          |                              ^~~~~~~~~~~~~~~~~~~~
    net/sunrpc/cache.c:1622:30: error: 'content_proc_ops' defined but not used [-Werror=unused-const-variable=]
     1622 | static const struct proc_ops content_proc_ops = {
          |                              ^~~~~~~~~~~~~~~~
    net/sunrpc/cache.c:1598:30: error: 'cache_channel_proc_ops' defined but not used [-Werror=unused-const-variable=]
     1598 | static const struct proc_ops cache_channel_proc_ops = {
          |                              ^~~~~~~~~~~~~~~~~~~~~~
    
    These are used inside of an #ifdef, so replacing that with an
    IS_ENABLED() check lets the compiler see how they are used while
    still dropping them during dead code elimination.
    
    Fixes: dbf847ecb631 ("knfsd: allow cache_register to return error on failure")
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Acked-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tcp: Defer ts_recent changes until req is owned [+ + +]
Author: Wang Hai <wanghai38@huawei.com>
Date:   Mon Feb 24 17:00:47 2025 +0800

    tcp: Defer ts_recent changes until req is owned
    
    [ Upstream commit 8d52da23b6c68a0f6bad83959ebb61a2cf623c4e ]
    
    Recently a bug was discovered where the server had entered TCP_ESTABLISHED
    state, but the upper layers were not notified.
    
    The same 5-tuple packet may be processed by different CPUSs, so two
    CPUs may receive different ack packets at the same time when the
    state is TCP_NEW_SYN_RECV.
    
    In that case, req->ts_recent in tcp_check_req may be changed concurrently,
    which will probably cause the newsk's ts_recent to be incorrectly large.
    So that tcp_validate_incoming will fail. At this point, newsk will not be
    able to enter the TCP_ESTABLISHED.
    
    cpu1                                    cpu2
    tcp_check_req
                                            tcp_check_req
     req->ts_recent = rcv_tsval = t1
                                             req->ts_recent = rcv_tsval = t2
    
     syn_recv_sock
      tcp_sk(child)->rx_opt.ts_recent = req->ts_recent = t2 // t1 < t2
    tcp_child_process
     tcp_rcv_state_process
      tcp_validate_incoming
       tcp_paws_check
        if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
            // t2 - t1 > paws_win, failed
                                            tcp_v4_do_rcv
                                             tcp_rcv_state_process
                                             // TCP_ESTABLISHED
    
    The cpu2's skb or a newly received skb will call tcp_v4_do_rcv to get
    the newsk into the TCP_ESTABLISHED state, but at this point it is no
    longer possible to notify the upper layer application. A notification
    mechanism could be added here, but the fix is more complex, so the
    current fix is used.
    
    In tcp_check_req, req->ts_recent is used to assign a value to
    tcp_sk(child)->rx_opt.ts_recent, so removing the change in req->ts_recent
    and changing tcp_sk(child)->rx_opt.ts_recent directly after owning the
    req fixes this bug.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Wang Hai <wanghai38@huawei.com>
    Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tcp: drop secpath at the same time as we currently drop dst [+ + +]
Author: Sabrina Dubroca <sd@queasysnail.net>
Date:   Mon Feb 17 11:23:35 2025 +0100

    tcp: drop secpath at the same time as we currently drop dst
    
    [ Upstream commit 9b6412e6979f6f9e0632075f8f008937b5cd4efd ]
    
    Xiumei reported hitting the WARN in xfrm6_tunnel_net_exit while
    running tests that boil down to:
     - create a pair of netns
     - run a basic TCP test over ipcomp6
     - delete the pair of netns
    
    The xfrm_state found on spi_byaddr was not deleted at the time we
    delete the netns, because we still have a reference on it. This
    lingering reference comes from a secpath (which holds a ref on the
    xfrm_state), which is still attached to an skb. This skb is not
    leaked, it ends up on sk_receive_queue and then gets defer-free'd by
    skb_attempt_defer_free.
    
    The problem happens when we defer freeing an skb (push it on one CPU's
    defer_list), and don't flush that list before the netns is deleted. In
    that case, we still have a reference on the xfrm_state that we don't
    expect at this point.
    
    We already drop the skb's dst in the TCP receive path when it's no
    longer needed, so let's also drop the secpath. At this point,
    tcp_filter has already called into the LSM hooks that may require the
    secpath, so it should not be needed anymore. However, in some of those
    places, the MPTCP extension has just been attached to the skb, so we
    cannot simply drop all extensions.
    
    Fixes: 68822bdf76f1 ("net: generalize skb freeing deferral to per-cpu lists")
    Reported-by: Xiumei Mu <xmu@redhat.com>
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/5055ba8f8f72bdcb602faa299faca73c280b7735.1739743613.git.sd@queasysnail.net
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tee: optee: Fix supplicant wait loop [+ + +]
Author: Sumit Garg <sumit.garg@linaro.org>
Date:   Tue Feb 4 13:04:18 2025 +0530

    tee: optee: Fix supplicant wait loop
    
    commit 70b0d6b0a199c5a3ee6c72f5e61681ed6f759612 upstream.
    
    OP-TEE supplicant is a user-space daemon and it's possible for it
    be hung or crashed or killed in the middle of processing an OP-TEE
    RPC call. It becomes more complicated when there is incorrect shutdown
    ordering of the supplicant process vs the OP-TEE client application which
    can eventually lead to system hang-up waiting for the closure of the
    client application.
    
    Allow the client process waiting in kernel for supplicant response to
    be killed rather than indefinitely waiting in an unkillable state. Also,
    a normal uninterruptible wait should not have resulted in the hung-task
    watchdog getting triggered, but the endless loop would.
    
    This fixes issues observed during system reboot/shutdown when supplicant
    got hung for some reason or gets crashed/killed which lead to client
    getting hung in an unkillable state. It in turn lead to system being in
    hung up state requiring hard power off/on to recover.
    
    Fixes: 4fb0a5eb364d ("tee: add OP-TEE driver")
    Suggested-by: Arnd Bergmann <arnd@arndb.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
    Reviewed-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tpm: Change to kvalloc() in eventlog/acpi.c [+ + +]
Author: Jarkko Sakkinen <jarkko@kernel.org>
Date:   Fri Dec 27 17:39:09 2024 +0200

    tpm: Change to kvalloc() in eventlog/acpi.c
    
    [ Upstream commit a3a860bc0fd6c07332e4911cf9a238d20de90173 ]
    
    The following failure was reported on HPE ProLiant D320:
    
    [   10.693310][    T1] tpm_tis STM0925:00: 2.0 TPM (device-id 0x3, rev-id 0)
    [   10.848132][    T1] ------------[ cut here ]------------
    [   10.853559][    T1] WARNING: CPU: 59 PID: 1 at mm/page_alloc.c:4727 __alloc_pages_noprof+0x2ca/0x330
    [   10.862827][    T1] Modules linked in:
    [   10.866671][    T1] CPU: 59 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-lp155.2.g52785e2-default #1 openSUSE Tumbleweed (unreleased) 588cd98293a7c9eba9013378d807364c088c9375
    [   10.882741][    T1] Hardware name: HPE ProLiant DL320 Gen12/ProLiant DL320 Gen12, BIOS 1.20 10/28/2024
    [   10.892170][    T1] RIP: 0010:__alloc_pages_noprof+0x2ca/0x330
    [   10.898103][    T1] Code: 24 08 e9 4a fe ff ff e8 34 36 fa ff e9 88 fe ff ff 83 fe 0a 0f 86 b3 fd ff ff 80 3d 01 e7 ce 01 00 75 09 c6 05 f8 e6 ce 01 01 <0f> 0b 45 31 ff e9 e5 fe ff ff f7 c2 00 00 08 00 75 42 89 d9 80 e1
    [   10.917750][    T1] RSP: 0000:ffffb7cf40077980 EFLAGS: 00010246
    [   10.923777][    T1] RAX: 0000000000000000 RBX: 0000000000040cc0 RCX: 0000000000000000
    [   10.931727][    T1] RDX: 0000000000000000 RSI: 000000000000000c RDI: 0000000000040cc0
    
    The above transcript shows that ACPI pointed a 16 MiB buffer for the log
    events because RSI maps to the 'order' parameter of __alloc_pages_noprof().
    Address the bug by moving from devm_kmalloc() to devm_add_action() and
    kvmalloc() and devm_add_action().
    
    Suggested-by: Ard Biesheuvel <ardb@kernel.org>
    Cc: stable@vger.kernel.org # v2.6.16+
    Fixes: 55a82ab3181b ("[PATCH] tpm: add bios measurement log")
    Reported-by: Andy Liang <andy.liang@hpe.com>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219495
    Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Takashi Iwai <tiwai@suse.de>
    Tested-by: Andy Liang <andy.liang@hpe.com>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tpm: Use managed allocation for bios event log [+ + +]
Author: Eddie James <eajames@linux.ibm.com>
Date:   Thu Jan 26 15:08:09 2023 -0600

    tpm: Use managed allocation for bios event log
    
    [ Upstream commit 441b7152729f4a2bdb100135a58625fa0aeb69e4 ]
    
    Since the bios event log is freed in the device release function,
    let devres handle the deallocation. This will allow other memory
    allocation/mapping functions to be used for the bios event log.
    
    Signed-off-by: Eddie James <eajames@linux.ibm.com>
    Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Stable-dep-of: a3a860bc0fd6 ("tpm: Change to kvalloc() in eventlog/acpi.c")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tracing: Fix bad hist from corrupting named_triggers list [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Thu Feb 27 16:39:44 2025 -0500

    tracing: Fix bad hist from corrupting named_triggers list
    
    commit 6f86bdeab633a56d5c6dccf1a2c5989b6a5e323e upstream.
    
    The following commands causes a crash:
    
     ~# cd /sys/kernel/tracing/events/rcu/rcu_callback
     ~# echo 'hist:name=bad:keys=common_pid:onmax(bogus).save(common_pid)' > trigger
     bash: echo: write error: Invalid argument
     ~# echo 'hist:name=bad:keys=common_pid' > trigger
    
    Because the following occurs:
    
    event_trigger_write() {
      trigger_process_regex() {
        event_hist_trigger_parse() {
    
          data = event_trigger_alloc(..);
    
          event_trigger_register(.., data) {
            cmd_ops->reg(.., data, ..) [hist_register_trigger()] {
              data->ops->init() [event_hist_trigger_init()] {
                save_named_trigger(name, data) {
                  list_add(&data->named_list, &named_triggers);
                }
              }
            }
          }
    
          ret = create_actions(); (return -EINVAL)
          if (ret)
            goto out_unreg;
    [..]
          ret = hist_trigger_enable(data, ...) {
            list_add_tail_rcu(&data->list, &file->triggers); <<<---- SKIPPED!!! (this is important!)
    [..]
     out_unreg:
          event_hist_unregister(.., data) {
            cmd_ops->unreg(.., data, ..) [hist_unregister_trigger()] {
              list_for_each_entry(iter, &file->triggers, list) {
                if (!hist_trigger_match(data, iter, named_data, false))   <- never matches
                    continue;
                [..]
                test = iter;
              }
              if (test && test->ops->free) <<<-- test is NULL
    
                test->ops->free(test) [event_hist_trigger_free()] {
                  [..]
                  if (data->name)
                    del_named_trigger(data) {
                      list_del(&data->named_list);  <<<<-- NEVER gets removed!
                    }
                  }
               }
             }
    
             [..]
             kfree(data); <<<-- frees item but it is still on list
    
    The next time a hist with name is registered, it causes an u-a-f bug and
    the kernel can crash.
    
    Move the code around such that if event_trigger_register() succeeds, the
    next thing called is hist_trigger_enable() which adds it to the list.
    
    A bunch of actions is called if get_named_trigger_data() returns false.
    But that doesn't need to be called after event_trigger_register(), so it
    can be moved up, allowing event_trigger_register() to be called just
    before hist_trigger_enable() keeping them together and allowing the
    file->triggers to be properly populated.
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Link: https://lore.kernel.org/20250227163944.1c37f85f@gandalf.local.home
    Fixes: 067fe038e70f6 ("tracing: Add variable reference handling to hist triggers")
    Reported-by: Tomas Glozar <tglozar@redhat.com>
    Tested-by: Tomas Glozar <tglozar@redhat.com>
    Reviewed-by: Tom Zanussi <zanussi@kernel.org>
    Closes: https://lore.kernel.org/all/CAP4=nvTsxjckSBTz=Oe_UYh8keD9_sZC4i++4h72mJLic4_W4A@mail.gmail.com/
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
uprobes: Reject the shared zeropage in uprobe_write_opcode() [+ + +]
Author: Tong Tiangen <tongtiangen@huawei.com>
Date:   Mon Feb 24 11:11:49 2025 +0800

    uprobes: Reject the shared zeropage in uprobe_write_opcode()
    
    [ Upstream commit bddf10d26e6e5114e7415a0e442ec6f51a559468 ]
    
    We triggered the following crash in syzkaller tests:
    
      BUG: Bad page state in process syz.7.38  pfn:1eff3
      page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1eff3
      flags: 0x3fffff00004004(referenced|reserved|node=0|zone=1|lastcpupid=0x1fffff)
      raw: 003fffff00004004 ffffe6c6c07bfcc8 ffffe6c6c07bfcc8 0000000000000000
      raw: 0000000000000000 0000000000000000 00000000fffffffe 0000000000000000
      page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
      Call Trace:
       <TASK>
       dump_stack_lvl+0x32/0x50
       bad_page+0x69/0xf0
       free_unref_page_prepare+0x401/0x500
       free_unref_page+0x6d/0x1b0
       uprobe_write_opcode+0x460/0x8e0
       install_breakpoint.part.0+0x51/0x80
       register_for_each_vma+0x1d9/0x2b0
       __uprobe_register+0x245/0x300
       bpf_uprobe_multi_link_attach+0x29b/0x4f0
       link_create+0x1e2/0x280
       __sys_bpf+0x75f/0xac0
       __x64_sys_bpf+0x1a/0x30
       do_syscall_64+0x56/0x100
       entry_SYSCALL_64_after_hwframe+0x78/0xe2
    
       BUG: Bad rss-counter state mm:00000000452453e0 type:MM_FILEPAGES val:-1
    
    The following syzkaller test case can be used to reproduce:
    
      r2 = creat(&(0x7f0000000000)='./file0\x00', 0x8)
      write$nbd(r2, &(0x7f0000000580)=ANY=[], 0x10)
      r4 = openat(0xffffffffffffff9c, &(0x7f0000000040)='./file0\x00', 0x42, 0x0)
      mmap$IORING_OFF_SQ_RING(&(0x7f0000ffd000/0x3000)=nil, 0x3000, 0x0, 0x12, r4, 0x0)
      r5 = userfaultfd(0x80801)
      ioctl$UFFDIO_API(r5, 0xc018aa3f, &(0x7f0000000040)={0xaa, 0x20})
      r6 = userfaultfd(0x80801)
      ioctl$UFFDIO_API(r6, 0xc018aa3f, &(0x7f0000000140))
      ioctl$UFFDIO_REGISTER(r6, 0xc020aa00, &(0x7f0000000100)={{&(0x7f0000ffc000/0x4000)=nil, 0x4000}, 0x2})
      ioctl$UFFDIO_ZEROPAGE(r5, 0xc020aa04, &(0x7f0000000000)={{&(0x7f0000ffd000/0x1000)=nil, 0x1000}})
      r7 = bpf$PROG_LOAD(0x5, &(0x7f0000000140)={0x2, 0x3, &(0x7f0000000200)=ANY=[@ANYBLOB="1800000000120000000000000000000095"], &(0x7f0000000000)='GPL\x00', 0x7, 0x0, 0x0, 0x0, 0x0, '\x00', 0x0, @fallback=0x30, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, @void, @value}, 0x94)
      bpf$BPF_LINK_CREATE_XDP(0x1c, &(0x7f0000000040)={r7, 0x0, 0x30, 0x1e, @val=@uprobe_multi={&(0x7f0000000080)='./file0\x00', &(0x7f0000000100)=[0x2], 0x0, 0x0, 0x1}}, 0x40)
    
    The cause is that zero pfn is set to the PTE without increasing the RSS
    count in mfill_atomic_pte_zeropage() and the refcount of zero folio does
    not increase accordingly. Then, the operation on the same pfn is performed
    in uprobe_write_opcode()->__replace_page() to unconditional decrease the
    RSS count and old_folio's refcount.
    
    Therefore, two bugs are introduced:
    
     1. The RSS count is incorrect, when process exit, the check_mm() report
        error "Bad rss-count".
    
     2. The reserved folio (zero folio) is freed when folio->refcount is zero,
        then free_pages_prepare->free_page_is_bad() report error
        "Bad page state".
    
    There is more, the following warning could also theoretically be triggered:
    
      __replace_page()
        -> ...
          -> folio_remove_rmap_pte()
            -> VM_WARN_ON_FOLIO(is_zero_folio(folio), folio)
    
    Considering that uprobe hit on the zero folio is a very rare case, just
    reject zero old folio immediately after get_user_page_vma_remote().
    
    [ mingo: Cleaned up the changelog ]
    
    Fixes: 7396fa818d62 ("uprobes/core: Make background page replacement logic account for rss_stat counters")
    Fixes: 2b1444983508 ("uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints")
    Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Link: https://lore.kernel.org/r/20250224031149.1598949-1-tongtiangen@huawei.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
USB: gadget: core: create sysfs link between udc and gadget [+ + +]
Author: Roy Luo <royluo@google.com>
Date:   Thu Mar 7 03:09:22 2024 +0000

    USB: gadget: core: create sysfs link between udc and gadget
    
    [ Upstream commit 0ef40f399aa2be8c04aee9b7430705612c104ce5 ]
    
    udc device and gadget device are tightly coupled, yet there's no good
    way to corelate the two. Add a sysfs link in udc that points to the
    corresponding gadget device.
    An example use case: userspace configures a f_midi configfs driver and
    bind the udc device, then it tries to locate the corresponding midi
    device, which is a child device of the gadget device. The gadget device
    that's associated to the udc device has to be identified in order to
    index the midi device. Having a sysfs link would make things much
    easier.
    
    Signed-off-by: Roy Luo <royluo@google.com>
    Link: https://lore.kernel.org/r/20240307030922.3573161-1-royluo@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 399a45e5237c ("usb: gadget: core: flush gadget workqueue after device removal")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usb: gadget: core: flush gadget workqueue after device removal [+ + +]
Author: Roy Luo <royluo@google.com>
Date:   Tue Feb 4 23:36:42 2025 +0000

    usb: gadget: core: flush gadget workqueue after device removal
    
    [ Upstream commit 399a45e5237ca14037120b1b895bd38a3b4492ea ]
    
    device_del() can lead to new work being scheduled in gadget->work
    workqueue. This is observed, for example, with the dwc3 driver with the
    following call stack:
      device_del()
        gadget_unbind_driver()
          usb_gadget_disconnect_locked()
            dwc3_gadget_pullup()
              dwc3_gadget_soft_disconnect()
                usb_gadget_set_state()
                  schedule_work(&gadget->work)
    
    Move flush_work() after device_del() to ensure the workqueue is cleaned
    up.
    
    Fixes: 5702f75375aa9 ("usb: gadget: udc-core: move sysfs_notify() to a workqueue")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Roy Luo <royluo@google.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20250204233642.666991-1-royluo@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
USB: gadget: f_midi: f_midi_complete to call queue_work [+ + +]
Author: Jill Donahue <jilliandonahue58@gmail.com>
Date:   Tue Feb 11 10:48:05 2025 -0700

    USB: gadget: f_midi: f_midi_complete to call queue_work
    
    [ Upstream commit 4ab37fcb42832cdd3e9d5e50653285ca84d6686f ]
    
    When using USB MIDI, a lock is attempted to be acquired twice through a
    re-entrant call to f_midi_transmit, causing a deadlock.
    
    Fix it by using queue_work() to schedule the inner f_midi_transmit() via
    a high priority work queue from the completion handler.
    
    Link: https://lore.kernel.org/all/CAArt=LjxU0fUZOj06X+5tkeGT+6RbXzpWg1h4t4Fwa_KGVAX6g@mail.gmail.com/
    Fixes: d5daf49b58661 ("USB: gadget: midi: add midi function driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jill Donahue <jilliandonahue58@gmail.com>
    Link: https://lore.kernel.org/r/20250211174805.1369265-1-jdonahue@fender.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usbnet: gl620a: fix endpoint checking in genelink_bind() [+ + +]
Author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Date:   Mon Feb 24 20:29:17 2025 +0300

    usbnet: gl620a: fix endpoint checking in genelink_bind()
    
    commit 1cf9631d836b289bd5490776551961c883ae8a4f upstream.
    
    Syzbot reports [1] a warning in usb_submit_urb() triggered by
    inconsistencies between expected and actually present endpoints
    in gl620a driver. Since genelink_bind() does not properly
    verify whether specified eps are in fact provided by the device,
    in this case, an artificially manufactured one, one may get a
    mismatch.
    
    Fix the issue by resorting to a usbnet utility function
    usbnet_get_endpoints(), usually reserved for this very problem.
    Check for endpoints and return early before proceeding further if
    any are missing.
    
    [1] Syzbot report:
    usb 5-1: Manufacturer: syz
    usb 5-1: SerialNumber: syz
    usb 5-1: config 0 descriptor??
    gl620a 5-1:0.23 usb0: register 'gl620a' at usb-dummy_hcd.0-1, ...
    ------------[ cut here ]------------
    usb 5-1: BOGUS urb xfer, pipe 3 != type 1
    WARNING: CPU: 2 PID: 1841 at drivers/usb/core/urb.c:503 usb_submit_urb+0xe4b/0x1730 drivers/usb/core/urb.c:503
    Modules linked in:
    CPU: 2 UID: 0 PID: 1841 Comm: kworker/2:2 Not tainted 6.12.0-syzkaller-07834-g06afb0f36106 #0
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
    Workqueue: mld mld_ifc_work
    RIP: 0010:usb_submit_urb+0xe4b/0x1730 drivers/usb/core/urb.c:503
    ...
    Call Trace:
     <TASK>
     usbnet_start_xmit+0x6be/0x2780 drivers/net/usb/usbnet.c:1467
     __netdev_start_xmit include/linux/netdevice.h:5002 [inline]
     netdev_start_xmit include/linux/netdevice.h:5011 [inline]
     xmit_one net/core/dev.c:3590 [inline]
     dev_hard_start_xmit+0x9a/0x7b0 net/core/dev.c:3606
     sch_direct_xmit+0x1ae/0xc30 net/sched/sch_generic.c:343
     __dev_xmit_skb net/core/dev.c:3827 [inline]
     __dev_queue_xmit+0x13d4/0x43e0 net/core/dev.c:4400
     dev_queue_xmit include/linux/netdevice.h:3168 [inline]
     neigh_resolve_output net/core/neighbour.c:1514 [inline]
     neigh_resolve_output+0x5bc/0x950 net/core/neighbour.c:1494
     neigh_output include/net/neighbour.h:539 [inline]
     ip6_finish_output2+0xb1b/0x2070 net/ipv6/ip6_output.c:141
     __ip6_finish_output net/ipv6/ip6_output.c:215 [inline]
     ip6_finish_output+0x3f9/0x1360 net/ipv6/ip6_output.c:226
     NF_HOOK_COND include/linux/netfilter.h:303 [inline]
     ip6_output+0x1f8/0x540 net/ipv6/ip6_output.c:247
     dst_output include/net/dst.h:450 [inline]
     NF_HOOK include/linux/netfilter.h:314 [inline]
     NF_HOOK include/linux/netfilter.h:308 [inline]
     mld_sendpack+0x9f0/0x11d0 net/ipv6/mcast.c:1819
     mld_send_cr net/ipv6/mcast.c:2120 [inline]
     mld_ifc_work+0x740/0xca0 net/ipv6/mcast.c:2651
     process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229
     process_scheduled_works kernel/workqueue.c:3310 [inline]
     worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391
     kthread+0x2c1/0x3a0 kernel/kthread.c:389
     ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
     </TASK>
    
    Reported-by: syzbot+d693c07c6f647e0388d3@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=d693c07c6f647e0388d3
    Fixes: 47ee3051c856 ("[PATCH] USB: usbnet (5/9) module for genesys gl620a cables")
    Cc: stable@vger.kernel.org
    Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
    Link: https://patch.msgid.link/20250224172919.1220522-1-n.zhandarovich@fintech.ru
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vmlinux.lds: Ensure that const vars with relocations are mapped R/O [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Feb 21 14:57:06 2025 +0100

    vmlinux.lds: Ensure that const vars with relocations are mapped R/O
    
    commit 68f3ea7ee199ef77551e090dfef5a49046ea8443 upstream.
    
    In the kernel, there are architectures (x86, arm64) that perform
    boot-time relocation (for KASLR) without relying on PIE codegen. In this
    case, all const global objects are emitted into .rodata, including const
    objects with fields that will be fixed up by the boot-time relocation
    code.  This implies that .rodata (and .text in some cases) need to be
    writable at boot, but they will usually be mapped read-only as soon as
    the boot completes.
    
    When using PIE codegen, the compiler will emit const global objects into
    .data.rel.ro rather than .rodata if the object contains fields that need
    such fixups at boot-time. This permits the linker to annotate such
    regions as requiring read-write access only at load time, but not at
    execution time (in user space), while keeping .rodata truly const (in
    user space, this is important for reducing the CoW footprint of dynamic
    executables).
    
    This distinction does not matter for the kernel, but it does imply that
    const data will end up in writable memory if the .data.rel.ro sections
    are not treated in a special way, as they will end up in the writable
    .data segment by default.
    
    So emit .data.rel.ro into the .rodata segment.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://lore.kernel.org/r/20250221135704.431269-5-ardb+git@google.com
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/cpu/kvm: SRSO: Fix possible missing IBPB on VM-Exit [+ + +]
Author: Patrick Bellasi <derkling@google.com>
Date:   Wed Feb 5 14:04:41 2025 +0000

    x86/cpu/kvm: SRSO: Fix possible missing IBPB on VM-Exit
    
    commit 318e8c339c9a0891c389298bb328ed0762a9935e upstream.
    
    In [1] the meaning of the synthetic IBPB flags has been redefined for a
    better separation of concerns:
     - ENTRY_IBPB     -- issue IBPB on entry only
     - IBPB_ON_VMEXIT -- issue IBPB on VM-Exit only
    and the Retbleed mitigations have been updated to match this new
    semantics.
    
    Commit [2] was merged shortly before [1], and their interaction was not
    handled properly. This resulted in IBPB not being triggered on VM-Exit
    in all SRSO mitigation configs requesting an IBPB there.
    
    Specifically, an IBPB on VM-Exit is triggered only when
    X86_FEATURE_IBPB_ON_VMEXIT is set. However:
    
     - X86_FEATURE_IBPB_ON_VMEXIT is not set for "spec_rstack_overflow=ibpb",
       because before [1] having X86_FEATURE_ENTRY_IBPB was enough. Hence,
       an IBPB is triggered on entry but the expected IBPB on VM-exit is
       not.
    
     - X86_FEATURE_IBPB_ON_VMEXIT is not set also when
       "spec_rstack_overflow=ibpb-vmexit" if X86_FEATURE_ENTRY_IBPB is
       already set.
    
       That's because before [1] this was effectively redundant. Hence, e.g.
       a "retbleed=ibpb spec_rstack_overflow=bpb-vmexit" config mistakenly
       reports the machine still vulnerable to SRSO, despite an IBPB being
       triggered both on entry and VM-Exit, because of the Retbleed selected
       mitigation config.
    
     - UNTRAIN_RET_VM won't still actually do anything unless
       CONFIG_MITIGATION_IBPB_ENTRY is set.
    
    For "spec_rstack_overflow=ibpb", enable IBPB on both entry and VM-Exit
    and clear X86_FEATURE_RSB_VMEXIT which is made superfluous by
    X86_FEATURE_IBPB_ON_VMEXIT. This effectively makes this mitigation
    option similar to the one for 'retbleed=ibpb', thus re-order the code
    for the RETBLEED_MITIGATION_IBPB option to be less confusing by having
    all features enabling before the disabling of the not needed ones.
    
    For "spec_rstack_overflow=ibpb-vmexit", guard this mitigation setting
    with CONFIG_MITIGATION_IBPB_ENTRY to ensure UNTRAIN_RET_VM sequence is
    effectively compiled in. Drop instead the CONFIG_MITIGATION_SRSO guard,
    since none of the SRSO compile cruft is required in this configuration.
    Also, check only that the required microcode is present to effectively
    enabled the IBPB on VM-Exit.
    
    Finally, update the KConfig description for CONFIG_MITIGATION_IBPB_ENTRY
    to list also all SRSO config settings enabled by this guard.
    
    Fixes: 864bcaa38ee4 ("x86/cpu/kvm: Provide UNTRAIN_RET_VM") [1]
    Fixes: d893832d0e1e ("x86/srso: Add IBPB on VMEXIT") [2]
    Reported-by: Yosry Ahmed <yosryahmed@google.com>
    Signed-off-by: Patrick Bellasi <derkling@google.com>
    Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/CPU: Fix warm boot hang regression on AMD SC1100 SoC systems [+ + +]
Author: Russell Senior <russell@personaltelco.net>
Date:   Tue Feb 25 22:31:20 2025 +0100

    x86/CPU: Fix warm boot hang regression on AMD SC1100 SoC systems
    
    [ Upstream commit bebe35bb738b573c32a5033499cd59f20293f2a3 ]
    
    I still have some Soekris net4826 in a Community Wireless Network I
    volunteer with. These devices use an AMD SC1100 SoC. I am running
    OpenWrt on them, which uses a patched kernel, that naturally has
    evolved over time.  I haven't updated the ones in the field in a
    number of years (circa 2017), but have one in a test bed, where I have
    intermittently tried out test builds.
    
    A few years ago, I noticed some trouble, particularly when "warm
    booting", that is, doing a reboot without removing power, and noticed
    the device was hanging after the kernel message:
    
      [    0.081615] Working around Cyrix MediaGX virtual DMA bugs.
    
    If I removed power and then restarted, it would boot fine, continuing
    through the message above, thusly:
    
      [    0.081615] Working around Cyrix MediaGX virtual DMA bugs.
      [    0.090076] Enable Memory-Write-back mode on Cyrix/NSC processor.
      [    0.100000] Enable Memory access reorder on Cyrix/NSC processor.
      [    0.100070] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
      [    0.110058] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
      [    0.120037] CPU: NSC Geode(TM) Integrated Processor by National Semi (family: 0x5, model: 0x9, stepping: 0x1)
      [...]
    
    In order to continue using modern tools, like ssh, to interact with
    the software on these old devices, I need modern builds of the OpenWrt
    firmware on the devices. I confirmed that the warm boot hang was still
    an issue in modern OpenWrt builds (currently using a patched linux
    v6.6.65).
    
    Last night, I decided it was time to get to the bottom of the warm
    boot hang, and began bisecting. From preserved builds, I narrowed down
    the bisection window from late February to late May 2019. During this
    period, the OpenWrt builds were using 4.14.x. I was able to build
    using period-correct Ubuntu 18.04.6. After a number of bisection
    iterations, I identified a kernel bump from 4.14.112 to 4.14.113 as
    the commit that introduced the warm boot hang.
    
      https://github.com/openwrt/openwrt/commit/07aaa7e3d62ad32767d7067107db64b6ade81537
    
    Looking at the upstream changes in the stable kernel between 4.14.112
    and 4.14.113 (tig v4.14.112..v4.14.113), I spotted a likely suspect:
    
      https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=20afb90f730982882e65b01fb8bdfe83914339c5
    
    So, I tried reverting just that kernel change on top of the breaking
    OpenWrt commit, and my warm boot hang went away.
    
    Presumably, the warm boot hang is due to some register not getting
    cleared in the same way that a loss of power does. That is
    approximately as much as I understand about the problem.
    
    More poking/prodding and coaching from Jonas Gorski, it looks
    like this test patch fixes the problem on my board: Tested against
    v6.6.67 and v4.14.113.
    
    Fixes: 18fb053f9b82 ("x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors")
    Debugged-by: Jonas Gorski <jonas.gorski@gmail.com>
    Signed-off-by: Russell Senior <russell@personaltelco.net>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/CAHP3WfOgs3Ms4Z+L9i0-iBOE21sdMk5erAiJurPjnrL9LSsgRA@mail.gmail.com
    Cc: Matthew Whitehead <tedheadster@gmail.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>