Changelog in Linux kernel 6.12.18

 
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: Give an afs_server object a ref on the afs_cell object it points to [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Tue Feb 18 19:22:48 2025 +0000

    afs: Give an afs_server object a ref on the afs_cell object it points to
    
    [ Upstream commit 1f0fc3374f3345ff1d150c5c56ac5016e5d3826a ]
    
    Give an afs_server object a ref on the afs_cell object it points to so that
    the cell doesn't get deleted before the server record.
    
    Whilst this is circular (cell -> vol -> server_list -> server -> cell), the
    ref only pins the memory, not the lifetime as that's controlled by the
    activity counter.  When the volume's activity counter reaches 0, it
    detaches from the cell and discards its server list; when a cell's activity
    counter reaches 0, it discards its root volume.  At that point, the
    circularity is cut.
    
    Fixes: d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation")
    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-6-dhowells@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: hda/realtek: Fix microphone regression on ASUS N705UD [+ + +]
Author: Adrien Vergé <adrienverge@gmail.com>
Date:   Wed Feb 26 14:55:15 2025 +0100

    ALSA: hda/realtek: Fix microphone regression on ASUS N705UD
    
    commit c6557ccf8094ce2e1142c6e49cd47f5d5e2933a8 upstream.
    
    This fixes a regression introduced a few weeks ago in stable kernels
    6.12.14 and 6.13.3. The internal microphone on ASUS Vivobook N705UD /
    X705UD laptops is broken: the microphone appears in userspace (e.g.
    Gnome settings) but no sound is detected.
    I bisected it to commit 3b4309546b48 ("ALSA: hda: Fix headset detection
    failure due to unstable sort").
    
    I figured out the cause:
    1. The initial pins enabled for the ALC256 driver are:
           cfg->inputs == {
             { pin=0x19, type=AUTO_PIN_MIC,
               is_headset_mic=1, is_headphone_mic=0, has_boost_on_pin=1 },
             { pin=0x1a, type=AUTO_PIN_MIC,
               is_headset_mic=0, is_headphone_mic=0, has_boost_on_pin=1 } }
    2. Since 2017 and commits c1732ede5e8 ("ALSA: hda/realtek - Fix headset
       and mic on several ASUS laptops with ALC256") and 28e8af8a163 ("ALSA:
       hda/realtek: Fix mic and headset jack sense on ASUS X705UD"), the
       quirk ALC256_FIXUP_ASUS_MIC is also applied to ASUS X705UD / N705UD
       laptops.
       This added another internal microphone on pin 0x13:
           cfg->inputs == {
             { pin=0x13, type=AUTO_PIN_MIC,
               is_headset_mic=0, is_headphone_mic=0, has_boost_on_pin=1 },
             { pin=0x19, type=AUTO_PIN_MIC,
               is_headset_mic=1, is_headphone_mic=0, has_boost_on_pin=1 },
             { pin=0x1a, type=AUTO_PIN_MIC,
               is_headset_mic=0, is_headphone_mic=0, has_boost_on_pin=1 } }
       I don't know what this pin 0x13 corresponds to. To the best of my
       knowledge, these laptops have only one internal microphone.
    3. Before 2025 and commit 3b4309546b48 ("ALSA: hda: Fix headset
       detection failure due to unstable sort"), the sort function would let
       the microphone of pin 0x1a (the working one) *before* the microphone
       of pin 0x13 (the phantom one).
    4. After this commit 3b4309546b48, the fixed sort function puts the
       working microphone (pin 0x1a) *after* the phantom one (pin 0x13). As
       a result, no sound is detected anymore.
    
    It looks like the quirk ALC256_FIXUP_ASUS_MIC is not needed anymore for
    ASUS Vivobook X705UD / N705UD laptops. Without it, everything works
    fine:
    - the internal microphone is detected and records actual sound,
    - plugging in a jack headset is detected and can record actual sound
      with it,
    - unplugging the jack headset makes the system go back to internal
      microphone and can record actual sound.
    
    Cc: stable@vger.kernel.org
    Cc: Kuan-Wei Chiu <visitorckw@gmail.com>
    Cc: Chris Chiu <chris.chiu@canonical.com>
    Fixes: 3b4309546b48 ("ALSA: hda: Fix headset detection failure due to unstable sort")
    Tested-by: Adrien Vergé <adrienverge@gmail.com>
    Signed-off-by: Adrien Vergé <adrienverge@gmail.com>
    Link: https://patch.msgid.link/20250226135515.24219-1-adrienverge@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Fix wrong mic setup for ASUS VivoBook 15 [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Tue Feb 25 16:45:32 2025 +0100

    ALSA: hda/realtek: Fix wrong mic setup for ASUS VivoBook 15
    
    [ Upstream commit 9e7c6779e3530bbdd465214afcd13f19c33e51a2 ]
    
    ASUS VivoBook 15 with SSID 1043:1460 took an incorrect quirk via the
    pin pattern matching for ASUS (ALC256_FIXUP_ASUS_MIC), resulting in
    the two built-in mic pins (0x13 and 0x1b).  This had worked without
    problems casually in the past because the right pin (0x1b) was picked
    up as the primary device.  But since we fixed the pin enumeration for
    other bugs, the bogus one (0x13) is picked up as the primary device,
    hence the bug surfaced now.
    
    For addressing the regression, this patch explicitly specifies the
    quirk entry with ALC256_FIXUP_ASUS_MIC_NO_PRESENCE, which sets up only
    the headset mic pin.
    
    Fixes: 3b4309546b48 ("ALSA: hda: Fix headset detection failure due to unstable sort")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219807
    Link: https://patch.msgid.link/20250225154540.13543-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.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/mm: Fix Boot panic on Ampere Altra [+ + +]
Author: Ryan Roberts <ryan.roberts@arm.com>
Date:   Tue Feb 25 11:46:36 2025 +0000

    arm64/mm: Fix Boot panic on Ampere Altra
    
    commit 2b1283e1ea9b5e0b06f075f79391a51d9f70749b upstream.
    
    When the range of present physical memory is sufficiently small enough
    and the reserved address space for the linear map is sufficiently large
    enough, The linear map base address is randomized in
    arm64_memblock_init().
    
    Prior to commit 62cffa496aac ("arm64/mm: Override PARange for !LPA2 and
    use it consistently"), we decided if the sizes were suitable with the
    help of the raw mmfr0.parange. But the commit changed this to use the
    sanitized version instead. But the function runs before the register has
    been sanitized so this returns 0, interpreted as a parange of 32 bits.
    Some fun wrapping occurs and the logic concludes that there is enough
    room to randomize the linear map base address, when really there isn't.
    So the top of the linear map ends up outside the reserved address space.
    
    Since the PA range cannot be overridden in the first place, restore the
    mmfr0 reading logic to its state prior to 62cffa496aac, where the raw
    register value is used.
    
    Reported-by: Luiz Capitulino <luizcap@redhat.com>
    Suggested-by: Ard Biesheuvel <ardb@kernel.org>
    Closes: https://lore.kernel.org/all/a3d9acbe-07c2-43b6-9ba9-a7585f770e83@redhat.com/
    Fixes: 62cffa496aac ("arm64/mm: Override PARange for !LPA2 and use it consistently")
    Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
    Link: https://lore.kernel.org/r/20250225114638.2038006-1-ryan.roberts@arm.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ASoC: cs35l56: Prevent races when soft-resetting using SPI control [+ + +]
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Tue Feb 25 13:18:43 2025 +0000

    ASoC: cs35l56: Prevent races when soft-resetting using SPI control
    
    [ Upstream commit 769c1b79295c38d60fde4c0a8f5f31e01360c54f ]
    
    When SPI is used for control, the driver must hold the SPI bus lock
    while issuing the sequence of writes to perform a soft reset.
    
    >From the time the driver writes the SYSTEM_RESET command until the
    driver does a write to terminate the reset, there must not be any
    activity on the SPI bus lines. If there is any SPI activity during the
    soft-reset, another soft-reset will be triggered. The state of the SPI
    chip select is irrelevant.
    
    A repeated soft-reset does not in itself cause any problems, and it is
    not an infinite loop. The problem is a race between these resets and
    the driver polling for boot completion. There is a time window between
    soft resets where the driver could read HALO_STATE as 2 (fully booted)
    while the chip is actually soft-resetting. Although this window is
    small, it is long enough that it is possible to hit it in normal
    operation.
    
    To prevent this race and ensure the chip really is fully booted, the
    driver calls spi_bus_lock() to prevent other activity while resetting.
    It then issues the SYSTEM_RESET mailbox command. After allowing
    sufficient time for reset to take effect, the driver issues a PING
    mailbox command, which will force completion of the full soft-reset
    sequence. The SPI bus lock can then be released. The mailbox is
    checked for any boot or wakeup response from the firmware, before the
    value in HALO_STATE will be trusted.
    
    This does not affect SoundWire or I2C control.
    
    Fixes: 8a731fd37f8b ("ASoC: cs35l56: Move utility functions to shared file")
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Link: https://patch.msgid.link/20250225131843.113752-3-rf@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@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: Rename stream name of SAI DAI driver [+ + +]
Author: Chancel Liu <chancel.liu@nxp.com>
Date:   Mon Feb 17 10:04:37 2025 +0900

    ASoC: fsl: Rename stream name of SAI DAI driver
    
    [ Upstream commit 0da83ab025bc45e9742e87c2cce19bff423377c8 ]
    
    If stream names of DAI driver are duplicated there'll be warnings when
    machine driver tries to add widgets on a route:
    
    [    8.831335] fsl-asoc-card sound-wm8960: ASoC: sink widget CPU-Playback overwritten
    [    8.839917] fsl-asoc-card sound-wm8960: ASoC: source widget CPU-Capture overwritten
    
    Use different stream names to avoid such warnings.
    DAI names in AUDMIX are also updated accordingly.
    
    Fixes: 15c958390460 ("ASoC: fsl_sai: Add separate DAI for transmitter and receiver")
    Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
    Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
    Link: https://patch.msgid.link/20250217010437.258621-1-chancel.liu@nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
block: Remove zone write plugs when handling native zone append writes [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Fri Feb 14 13:14:34 2025 +0900

    block: Remove zone write plugs when handling native zone append writes
    
    commit a6aa36e957a1bfb5341986dec32d013d23228fe1 upstream.
    
    For devices that natively support zone append operations,
    REQ_OP_ZONE_APPEND BIOs are not processed through zone write plugging
    and are immediately issued to the zoned device. This means that there is
    no write pointer offset tracking done for these operations and that a
    zone write plug is not necessary.
    
    However, when receiving a zone append BIO, we may already have a zone
    write plug for the target zone if that zone was previously partially
    written using regular write operations. In such case, since the write
    pointer offset of the zone write plug is not incremented by the amount
    of sectors appended to the zone, 2 issues arise:
    1) we risk leaving the plug in the disk hash table if the zone is fully
       written using zone append or regular write operations, because the
       write pointer offset will never reach the "zone full" state.
    2) Regular write operations that are issued after zone append operations
       will always be failed by blk_zone_wplug_prepare_bio() as the write
       pointer alignment check will fail, even if the user correctly
       accounted for the zone append operations and issued the regular
       writes with a correct sector.
    
    Avoid these issues by immediately removing the zone write plug of zones
    that are the target of zone append operations when blk_zone_plug_bio()
    is called. The new function blk_zone_wplug_handle_native_zone_append()
    implements this for devices that natively support zone append. The
    removal of the zone write plug using disk_remove_zone_wplug() requires
    aborting all plugged regular write using disk_zone_wplug_abort() as
    otherwise the plugged write BIOs would never be executed (with the plug
    removed, the completion path will never see again the zone write plug as
    disk_get_zone_wplug() will return NULL). Rate-limited warnings are added
    to blk_zone_wplug_handle_native_zone_append() and to
    disk_zone_wplug_abort() to signal this.
    
    Since blk_zone_wplug_handle_native_zone_append() is called in the hot
    path for operations that will not be plugged, disk_get_zone_wplug() is
    optimized under the assumption that a user issuing zone append
    operations is not at the same time issuing regular writes and that there
    are no hashed zone write plugs. The struct gendisk atomic counter
    nr_zone_wplugs is added to check this, with this counter incremented in
    disk_insert_zone_wplug() and decremented in disk_remove_zone_wplug().
    
    To be consistent with this fix, we do not need to fill the zone write
    plug hash table with zone write plugs for zones that are partially
    written for a device that supports native zone append operations.
    So modify blk_revalidate_seq_zone() to return early to avoid allocating
    and inserting a zone write plug for partially written sequential zones
    if the device natively supports zone append.
    
    Reported-by: Jorgen Hansen <Jorgen.Hansen@wdc.com>
    Fixes: 9b1ce7f0c6f8 ("block: Implement zone append emulation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Tested-by: Jorgen Hansen <Jorgen.Hansen@wdc.com>
    Link: https://lore.kernel.org/r/20250214041434.82564-1-dlemoal@kernel.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    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>

 
dm vdo: add missing spin_lock_init [+ + +]
Author: Ken Raeburn <raeburn@redhat.com>
Date:   Wed Feb 19 17:56:00 2025 -0500

    dm vdo: add missing spin_lock_init
    
    commit 36e1b81f599a093ec7477e4593e110104adcfb96 upstream.
    
    Signed-off-by: Ken Raeburn <raeburn@redhat.com>
    Signed-off-by: Matthew Sakai <msakai@redhat.com>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-integrity: Avoid divide by zero in table status in Inline mode [+ + +]
Author: Milan Broz <gmazyland@gmail.com>
Date:   Sun Feb 16 11:42:09 2025 +0100

    dm-integrity: Avoid divide by zero in table status in Inline mode
    
    commit 7fb39882b20c98a9a393c244c86b56ef6933cff8 upstream.
    
    In Inline mode, the journal is unused, and journal_sectors is zero.
    
    Calculating the journal watermark requires dividing by journal_sectors,
    which should be done only if the journal is configured.
    
    Otherwise, a simple table query (dmsetup table) can cause OOPS.
    
    This bug did not show on some systems, perhaps only due to
    compiler optimization.
    
    On my 32-bit testing machine, this reliably crashes with the following:
    
     : Oops: divide error: 0000 [#1] PREEMPT SMP
     : CPU: 0 UID: 0 PID: 2450 Comm: dmsetup Not tainted 6.14.0-rc2+ #959
     : EIP: dm_integrity_status+0x2f8/0xab0 [dm_integrity]
     ...
    
    Signed-off-by: Milan Broz <gmazyland@gmail.com>
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Fixes: fb0987682c62 ("dm-integrity: introduce the Inline mode")
    Cc: stable@vger.kernel.org # 6.11+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amd/display: add a quirk to enable eDP0 on DP1 [+ + +]
Author: Yilin Chen <Yilin.Chen@amd.com>
Date:   Fri Feb 7 15:26:19 2025 -0500

    drm/amd/display: add a quirk to enable eDP0 on DP1
    
    commit b5f7242e49b927cfe488b369fa552f2eff579ef1 upstream.
    
    [why]
    some board designs have eDP0 connected to DP1, need a way to enable
    support_edp0_on_dp1 flag, otherwise edp related features cannot work
    
    [how]
    do a dmi check during dm initialization to identify systems that
    require support_edp0_on_dp1. Optimize quirk table with callback
    functions to set quirk entries, retrieve_dmi_info can set quirks
    according to quirk entries
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Signed-off-by: Yilin Chen <Yilin.Chen@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 f6d17270d18a6a6753fff046330483d43f8405e4)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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/amdgpu: disable BAR resize on Dell G5 SE [+ + +]
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Mon Feb 17 10:55:05 2025 -0500

    drm/amdgpu: disable BAR resize on Dell G5 SE
    
    commit 099bffc7cadff40bfab1517c3461c53a7a38a0d7 upstream.
    
    There was a quirk added to add a workaround for a Sapphire
    RX 5600 XT Pulse that didn't allow BAR resizing.  However,
    the quirk caused a regression with runtime pm on Dell laptops
    using those chips, rather than narrowing the scope of the
    resizing quirk, add a quirk to prevent amdgpu from resizing
    the BAR on those Dell platforms unless runtime pm is disabled.
    
    v2: update commit message, add runpm check
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/1707
    Fixes: 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
    Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 5235053f443cef4210606e5fb71f99b915a9723d)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdgpu: init return value in amdgpu_ttm_clear_buffer [+ + +]
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Date:   Thu Feb 20 14:41:59 2025 +0100

    drm/amdgpu: init return value in amdgpu_ttm_clear_buffer
    
    commit d3c7059b6a8600fc62cd863f1ea203b8675e63e1 upstream.
    
    Otherwise an uninitialized value can be returned if
    amdgpu_res_cleared returns true for all regions.
    
    Possibly closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3812
    
    Fixes: a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")
    Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 7c62aacc3b452f73a1284198c81551035fac6d71)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdkfd: Preserve cp_hqd_pq_control on update_mqd [+ + +]
Author: David Yat Sin <David.YatSin@amd.com>
Date:   Wed Feb 19 17:34:38 2025 -0500

    drm/amdkfd: Preserve cp_hqd_pq_control on update_mqd
    
    commit 3502ab5022bb5ef1edd063bdb6465a8bf3b46e66 upstream.
    
    When userspace applications call AMDKFD_IOC_UPDATE_QUEUE. Preserve
    bitfields that do not need to be modified as they contain flags to
    track queue states that are used by CP FW.
    
    Signed-off-by: David Yat Sin <David.YatSin@amd.com>
    Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 8150827990b709ab5a40c46c30d21b7f7b9e9440)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/xe/oa: Add syncs support to OA config ioctl [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Oct 22 13:03:51 2024 -0700

    drm/xe/oa: Add syncs support to OA config ioctl
    
    [ Upstream commit 9920c8b88c5cf2e44f4ff508dd3c0c96e4364db0 ]
    
    In addition to stream open, add xe_sync support to the OA config ioctl,
    where it is even more useful. This allows e.g. Mesa to replay a workload
    repeatedly on the GPU, each time with a different OA configuration, while
    precisely controlling (at batch buffer granularity) the workload segment
    for which a particular OA configuration is active, without introducing
    stalls in the userspace pipeline.
    
    v2: Emit OA config even when config id is same as previous, to ensure
        consistent sync behavior (Jose)
    
    Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241022200352.1192560-7-ashutosh.dixit@intel.com
    Stable-dep-of: 5bd566703e16 ("drm/xe/oa: Allow oa_exponent value of 0")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/oa: Allow oa_exponent value of 0 [+ + +]
Author: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Date:   Fri Feb 21 13:33:52 2025 -0800

    drm/xe/oa: Allow oa_exponent value of 0
    
    [ Upstream commit 5bd566703e16b17d17f4fb648440d54f8967462c ]
    
    OA exponent value of 0 is a valid value for periodic reports. Allow user
    to pass 0 for the OA sampling interval since it gets converted to 2 gt
    clock ticks.
    
    v2: Update the check in xe_oa_stream_init as well (Ashutosh)
    v3: Fix mi-rpc failure by setting default exponent to -1 (CI)
    v4: Add the Fixes tag
    
    Fixes: b6fd51c62119 ("drm/xe/oa/uapi: Define and parse OA stream properties")
    Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250221213352.1712932-1-umesh.nerlige.ramappa@intel.com
    (cherry picked from commit 30341f0b8ea71725cc4ab2c43e3a3b749892fc92)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/oa: Allow only certain property changes from config [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Oct 22 13:03:52 2024 -0700

    drm/xe/oa: Allow only certain property changes from config
    
    [ Upstream commit 85d3f9e84e0628c412b69aa99b63654dfa08ad68 ]
    
    Whereas all properties can be specified during OA stream open, when the OA
    stream is reconfigured only the config_id and syncs can be specified.
    
    v2: Use separate function table for reconfig case (Jonathan)
        Change bool function args to enum (Matt B)
    v3: s/xe_oa_set_property_funcs/xe_oa_set_property_funcs_open/ (Jonathan)
    
    Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
    Suggested-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241022200352.1192560-8-ashutosh.dixit@intel.com
    Stable-dep-of: 5bd566703e16 ("drm/xe/oa: Allow oa_exponent value of 0")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/oa: Move functions up so they can be reused for config ioctl [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Oct 22 13:03:50 2024 -0700

    drm/xe/oa: Move functions up so they can be reused for config ioctl
    
    [ Upstream commit cc4e6994d5a237ef38363e459ac83cf8ef7626ff ]
    
    No code changes, only code movement so that functions used during stream
    open can be reused for the stream reconfiguration
    ioctl (DRM_XE_OBSERVATION_IOCTL_CONFIG).
    
    Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241022200352.1192560-6-ashutosh.dixit@intel.com
    Stable-dep-of: 5bd566703e16 ("drm/xe/oa: Allow oa_exponent value of 0")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/oa: Signal output fences [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Oct 22 13:03:49 2024 -0700

    drm/xe/oa: Signal output fences
    
    [ Upstream commit 343dd246fd9b58e67b395153e8e7298bd250f943 ]
    
    Introduce 'struct xe_oa_fence' which includes the dma_fence used to signal
    output fences in the xe_sync array. The fences are signaled
    asynchronously. When there are no output fences to signal, the OA
    configuration wait is synchronously re-introduced into the ioctl.
    
    v2: Don't wait in the work, use callback + delayed work (Matt B)
        Use a single, not a per-fence spinlock (Matt Brost)
    v3: Move ofence alloc before job submission (Matt)
        Assert, don't fail, from dma_fence_add_callback (Matt)
        Additional dma_fence_get for dma_fence_wait (Matt)
        Change dma_fence_wait to non-interruptible (Matt)
    v4: Introduce last_fence to prevent uaf if stream is closed with
        pending OA config jobs
    v5: Remove oa_fence_lock, move spinlock back into xe_oa_fence to
        prevent uaf
    
    Suggested-by: Matthew Brost <matthew.brost@intel.com>
    Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Matthew Brost <matthew.brost@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241022200352.1192560-5-ashutosh.dixit@intel.com
    Stable-dep-of: 5bd566703e16 ("drm/xe/oa: Allow oa_exponent value of 0")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe/regs: remove a duplicate definition for RING_CTL_SIZE(size) [+ + +]
Author: Mingcong Bai <jeffbai@aosc.io>
Date:   Tue Feb 25 15:31:01 2025 +0800

    drm/xe/regs: remove a duplicate definition for RING_CTL_SIZE(size)
    
    commit f2ba0cf1ca32e075617813de98c826ab55d57f11 upstream.
    
    Commit b79e8fd954c4 ("drm/xe: Remove dependency on intel_engine_regs.h")
    introduced an internal set of engine registers, however, as part of this
    change, it has also introduced two duplicate `define' lines for
    `RING_CTL_SIZE(size)'. This commit was introduced to the tree in v6.8-rc1.
    
    While this is harmless as the definitions did not change, so no compiler
    warning was observed.
    
    Drop this line anyway for the sake of correctness.
    
    Cc: stable@vger.kernel.org # v6.8-rc1+
    Fixes: b79e8fd954c4 ("drm/xe: Remove dependency on intel_engine_regs.h")
    Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
    Reviewed-by: Matthew Brost <matthew.brost@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250225073104.865230-1-jeffbai@aosc.io
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    (cherry picked from commit 6b68c4542ffecc36087a9e14db8fc990c88bb01b)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/xe/userptr: fix EFAULT handling [+ + +]
Author: Matthew Auld <matthew.auld@intel.com>
Date:   Fri Feb 21 14:38:42 2025 +0000

    drm/xe/userptr: fix EFAULT handling
    
    commit a9f4fa3a7efa65615ff7db13023ac84516e99e21 upstream.
    
    Currently we treat EFAULT from hmm_range_fault() as a non-fatal error
    when called from xe_vm_userptr_pin() with the idea that we want to avoid
    killing the entire vm and chucking an error, under the assumption that
    the user just did an unmap or something, and has no intention of
    actually touching that memory from the GPU.  At this point we have
    already zapped the PTEs so any access should generate a page fault, and
    if the pin fails there also it will then become fatal.
    
    However it looks like it's possible for the userptr vma to still be on
    the rebind list in preempt_rebind_work_func(), if we had to retry the
    pin again due to something happening in the caller before we did the
    rebind step, but in the meantime needing to re-validate the userptr and
    this time hitting the EFAULT.
    
    This explains an internal user report of hitting:
    
    [  191.738349] WARNING: CPU: 1 PID: 157 at drivers/gpu/drm/xe/xe_res_cursor.h:158 xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
    [  191.738551] Workqueue: xe-ordered-wq preempt_rebind_work_func [xe]
    [  191.738616] RIP: 0010:xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
    [  191.738690] Call Trace:
    [  191.738692]  <TASK>
    [  191.738694]  ? show_regs+0x69/0x80
    [  191.738698]  ? __warn+0x93/0x1a0
    [  191.738703]  ? xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
    [  191.738759]  ? report_bug+0x18f/0x1a0
    [  191.738764]  ? handle_bug+0x63/0xa0
    [  191.738767]  ? exc_invalid_op+0x19/0x70
    [  191.738770]  ? asm_exc_invalid_op+0x1b/0x20
    [  191.738777]  ? xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
    [  191.738834]  ? ret_from_fork_asm+0x1a/0x30
    [  191.738849]  bind_op_prepare+0x105/0x7b0 [xe]
    [  191.738906]  ? dma_resv_reserve_fences+0x301/0x380
    [  191.738912]  xe_pt_update_ops_prepare+0x28c/0x4b0 [xe]
    [  191.738966]  ? kmemleak_alloc+0x4b/0x80
    [  191.738973]  ops_execute+0x188/0x9d0 [xe]
    [  191.739036]  xe_vm_rebind+0x4ce/0x5a0 [xe]
    [  191.739098]  ? trace_hardirqs_on+0x4d/0x60
    [  191.739112]  preempt_rebind_work_func+0x76f/0xd00 [xe]
    
    Followed by NPD, when running some workload, since the sg was never
    actually populated but the vma is still marked for rebind when it should
    be skipped for this special EFAULT case. This is confirmed to fix the
    user report.
    
    v2 (MattB):
     - Move earlier.
    v3 (MattB):
     - Update the commit message to make it clear that this indeed fixes the
       issue.
    
    Fixes: 521db22a1d70 ("drm/xe: Invalidate userptr VMA on page pin fault")
    Signed-off-by: Matthew Auld <matthew.auld@intel.com>
    Cc: Matthew Brost <matthew.brost@intel.com>
    Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Cc: <stable@vger.kernel.org> # v6.10+
    Reviewed-by: Matthew Brost <matthew.brost@intel.com>
    Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250221143840.167150-5-matthew.auld@intel.com
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    (cherry picked from commit 6b93cb98910c826c2e2004942f8b060311e43618)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/xe/userptr: restore invalidation list on error [+ + +]
Author: Matthew Auld <matthew.auld@intel.com>
Date:   Fri Feb 21 14:38:41 2025 +0000

    drm/xe/userptr: restore invalidation list on error
    
    commit e043dc16c28c8446e66c55adfe7c6e862a6a7bb7 upstream.
    
    On error restore anything still on the pin_list back to the invalidation
    list on error. For the actual pin, so long as the vma is tracked on
    either list it should get picked up on the next pin, however it looks
    possible for the vma to get nuked but still be present on this per vm
    pin_list leading to corruption. An alternative might be then to instead
    just remove the link when destroying the vma.
    
    v2:
     - Also add some asserts.
     - Keep the overzealous locking so that we are consistent with the docs;
       updating the docs and related bits will be done as a follow up.
    
    Fixes: ed2bdf3b264d ("drm/xe/vm: Subclass userptr vmas")
    Suggested-by: Matthew Brost <matthew.brost@intel.com>
    Signed-off-by: Matthew Auld <matthew.auld@intel.com>
    Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Cc: <stable@vger.kernel.org> # v6.8+
    Reviewed-by: Matthew Brost <matthew.brost@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250221143840.167150-4-matthew.auld@intel.com
    Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
    (cherry picked from commit 4e37e928928b730de9aa9a2f5dc853feeebc1742)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
efi: Don't map the entire mokvar table to determine its size [+ + +]
Author: Peter Jones <pjones@redhat.com>
Date:   Wed Feb 26 15:18:39 2025 -0500

    efi: Don't map the entire mokvar table to determine its size
    
    commit 2b90e7ace79774a3540ce569e000388f8d22c9e0 upstream.
    
    Currently, when validating the mokvar table, we (re)map the entire table
    on each iteration of the loop, adding space as we discover new entries.
    If the table grows over a certain size, this fails due to limitations of
    early_memmap(), and we get a failure and traceback:
    
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:139 __early_ioremap+0xef/0x220
      ...
      Call Trace:
       <TASK>
       ? __early_ioremap+0xef/0x220
       ? __warn.cold+0x93/0xfa
       ? __early_ioremap+0xef/0x220
       ? report_bug+0xff/0x140
       ? early_fixup_exception+0x5d/0xb0
       ? early_idt_handler_common+0x2f/0x3a
       ? __early_ioremap+0xef/0x220
       ? efi_mokvar_table_init+0xce/0x1d0
       ? setup_arch+0x864/0xc10
       ? start_kernel+0x6b/0xa10
       ? x86_64_start_reservations+0x24/0x30
       ? x86_64_start_kernel+0xed/0xf0
       ? common_startup_64+0x13e/0x141
       </TASK>
      ---[ end trace 0000000000000000 ]---
      mokvar: Failed to map EFI MOKvar config table pa=0x7c4c3000, size=265187.
    
    Mapping the entire structure isn't actually necessary, as we don't ever
    need more than one entry header mapped at once.
    
    Changes efi_mokvar_table_init() to only map each entry header, not the
    entire table, when determining the table size.  Since we're not mapping
    any data past the variable name, it also changes the code to enforce
    that each variable name is NUL terminated, rather than attempting to
    verify it in place.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Peter Jones <pjones@redhat.com>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
firmware: cs_dsp: Remove async regmap writes [+ + +]
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Tue Feb 25 13:18:42 2025 +0000

    firmware: cs_dsp: Remove async regmap writes
    
    [ Upstream commit fe08b7d5085a9774abc30c26d5aebc5b9cdd6091 ]
    
    Change calls to async regmap write functions to use the normal
    blocking writes so that the cs35l56 driver can use spi_bus_lock() to
    gain exclusive access to the SPI bus.
    
    As this is part of a fix, it makes only the minimal change to swap the
    functions to the blocking equivalents. There's no need to risk
    reworking the buffer allocation logic that is now partially redundant.
    
    The async writes are a 12-year-old workaround for inefficiency of
    synchronous writes in the SPI subsystem. The SPI subsystem has since
    been changed to avoid the overheads, so this workaround should not be
    necessary.
    
    The cs35l56 driver needs to use spi_bus_lock() prevent bus activity
    while it is soft-resetting the cs35l56. But spi_bus_lock() is
    incompatible with spi_async() calls, which will fail with -EBUSY.
    
    Fixes: 8a731fd37f8b ("ASoC: cs35l56: Move utility functions to shared file")
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Link: https://patch.msgid.link/20250225131843.113752-2-rf@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@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>

 
i2c: ls2x: Fix frequency division register access [+ + +]
Author: Binbin Zhou <zhoubinbin@loongson.cn>
Date:   Thu Feb 20 20:56:12 2025 +0800

    i2c: ls2x: Fix frequency division register access
    
    commit 71c49ee9bb41e1709abac7e2eb05f9193222e580 upstream.
    
    According to the chip manual, the I2C register access type of
    Loongson-2K2000/LS7A is "B", so we can only access registers in byte
    form (readb()/writeb()).
    
    Although Loongson-2K0500/Loongson-2K1000 do not have similar
    constraints, register accesses in byte form also behave correctly.
    
    Also, in hardware, the frequency division registers are defined as two
    separate registers (high 8-bit and low 8-bit), so we just access them
    directly as bytes.
    
    Fixes: 015e61f0bffd ("i2c: ls2x: Add driver for Loongson-2K/LS7A I2C controller")
    Co-developed-by: Hongliang Wang <wanghongliang@loongson.cn>
    Signed-off-by: Hongliang Wang <wanghongliang@loongson.cn>
    Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
    Cc: stable@vger.kernel.org # v6.3+
    Reviewed-by: Andy Shevchenko <andy@kernel.org>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20250220125612.1910990-1-zhoubinbin@loongson.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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>

 
ice: add E830 HW VF mailbox message limit support [+ + +]
Author: Paul Greenwalt <paul.greenwalt@intel.com>
Date:   Tue Aug 20 17:26:16 2024 -0400

    ice: add E830 HW VF mailbox message limit support
    
    [ Upstream commit 59f4d59b25aec39a015c0949f4ec235c7a839c44 ]
    
    E830 adds hardware support to prevent the VF from overflowing the PF
    mailbox with VIRTCHNL messages. E830 will use the hardware feature
    (ICE_F_MBX_LIMIT) instead of the software solution ice_is_malicious_vf().
    
    To prevent a VF from overflowing the PF, the PF sets the number of
    messages per VF that can be in the PF's mailbox queue
    (ICE_MBX_OVERFLOW_WATERMARK). When the PF processes a message from a VF,
    the PF decrements the per VF message count using the E830_MBX_VF_DEC_TRIG
    register.
    
    Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
    Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
    Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Stable-dep-of: 79990cf5e7ad ("ice: Fix deinitializing VF in error path")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ice: Avoid setting default Rx VSI twice in switchdev setup [+ + +]
Author: Marcin Szycik <marcin.szycik@linux.intel.com>
Date:   Mon Feb 24 11:06:42 2025 -0800

    ice: Avoid setting default Rx VSI twice in switchdev setup
    
    [ Upstream commit 5c07be96d8b3f8447e980f29b967bf2e1d7ac732 ]
    
    As part of switchdev environment setup, uplink VSI is configured as
    default for both Tx and Rx. Default Rx VSI is also used by promiscuous
    mode. If promisc mode is enabled and an attempt to enter switchdev mode
    is made, the setup will fail because Rx VSI is already configured as
    default (rule exists).
    
    Reproducer:
      devlink dev eswitch set $PF1_PCI mode switchdev
      ip l s $PF1 up
      ip l s $PF1 promisc on
      echo 1 > /sys/class/net/$PF1/device/sriov_numvfs
    
    In switchdev setup, use ice_set_dflt_vsi() instead of plain
    ice_cfg_dflt_vsi(), which avoids repeating setting default VSI for Rx if
    it's already configured.
    
    Fixes: 50d62022f455 ("ice: default Tx rule instead of to queue")
    Reported-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
    Closes: https://lore.kernel.org/intel-wired-lan/PH0PR11MB50138B635F2E5CEB7075325D961F2@PH0PR11MB5013.namprd11.prod.outlook.com
    Reviewed-by: Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com>
    Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Link: https://patch.msgid.link/20250224190647.3601930-3-anthony.l.nguyen@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ice: Fix deinitializing VF in error path [+ + +]
Author: Marcin Szycik <marcin.szycik@linux.intel.com>
Date:   Mon Feb 24 11:06:41 2025 -0800

    ice: Fix deinitializing VF in error path
    
    [ Upstream commit 79990cf5e7aded76d0c092c9f5ed31eb1c75e02c ]
    
    If ice_ena_vfs() fails after calling ice_create_vf_entries(), it frees
    all VFs without removing them from snapshot PF-VF mailbox list, leading
    to list corruption.
    
    Reproducer:
      devlink dev eswitch set $PF1_PCI mode switchdev
      ip l s $PF1 up
      ip l s $PF1 promisc on
      sleep 1
      echo 1 > /sys/class/net/$PF1/device/sriov_numvfs
      sleep 1
      echo 1 > /sys/class/net/$PF1/device/sriov_numvfs
    
    Trace (minimized):
      list_add corruption. next->prev should be prev (ffff8882e241c6f0), but was 0000000000000000. (next=ffff888455da1330).
      kernel BUG at lib/list_debug.c:29!
      RIP: 0010:__list_add_valid_or_report+0xa6/0x100
       ice_mbx_init_vf_info+0xa7/0x180 [ice]
       ice_initialize_vf_entry+0x1fa/0x250 [ice]
       ice_sriov_configure+0x8d7/0x1520 [ice]
       ? __percpu_ref_switch_mode+0x1b1/0x5d0
       ? __pfx_ice_sriov_configure+0x10/0x10 [ice]
    
    Sometimes a KASAN report can be seen instead with a similar stack trace:
      BUG: KASAN: use-after-free in __list_add_valid_or_report+0xf1/0x100
    
    VFs are added to this list in ice_mbx_init_vf_info(), but only removed
    in ice_free_vfs(). Move the removing to ice_free_vf_entries(), which is
    also being called in other places where VFs are being removed (including
    ice_free_vfs() itself).
    
    Fixes: 8cd8a6b17d27 ("ice: move VF overflow message count into struct ice_mbx_vf_info")
    Reported-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
    Closes: https://lore.kernel.org/intel-wired-lan/PH0PR11MB50138B635F2E5CEB7075325D961F2@PH0PR11MB5013.namprd11.prod.outlook.com
    Reviewed-by: Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com>
    Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Link: https://patch.msgid.link/20250224190647.3601930-2-anthony.l.nguyen@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
idpf: fix checksums set in idpf_rx_rsc() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Feb 26 22:12:52 2025 +0000

    idpf: fix checksums set in idpf_rx_rsc()
    
    [ Upstream commit 674fcb4f4a7e3e277417a01788cc6daae47c3804 ]
    
    idpf_rx_rsc() uses skb_transport_offset(skb) while the transport header
    is not set yet.
    
    This triggers the following warning for CONFIG_DEBUG_NET=y builds.
    
    DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb))
    
    [   69.261620] WARNING: CPU: 7 PID: 0 at ./include/linux/skbuff.h:3020 idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
    [   69.261629] Modules linked in: vfat fat dummy bridge intel_uncore_frequency_tpmi intel_uncore_frequency_common intel_vsec_tpmi idpf intel_vsec cdc_ncm cdc_eem cdc_ether usbnet mii xhci_pci xhci_hcd ehci_pci ehci_hcd libeth
    [   69.261644] CPU: 7 UID: 0 PID: 0 Comm: swapper/7 Tainted: G S      W          6.14.0-smp-DEV #1697
    [   69.261648] Tainted: [S]=CPU_OUT_OF_SPEC, [W]=WARN
    [   69.261650] RIP: 0010:idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
    [   69.261677] ? __warn (kernel/panic.c:242 kernel/panic.c:748)
    [   69.261682] ? idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
    [   69.261687] ? report_bug (lib/bug.c:?)
    [   69.261690] ? handle_bug (arch/x86/kernel/traps.c:285)
    [   69.261694] ? exc_invalid_op (arch/x86/kernel/traps.c:309)
    [   69.261697] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621)
    [   69.261700] ? __pfx_idpf_vport_splitq_napi_poll (drivers/net/ethernet/intel/idpf/idpf_txrx.c:4011) idpf
    [   69.261704] ? idpf_vport_splitq_napi_poll (include/linux/skbuff.h:3020) idpf
    [   69.261708] ? idpf_vport_splitq_napi_poll (drivers/net/ethernet/intel/idpf/idpf_txrx.c:3072) idpf
    [   69.261712] __napi_poll (net/core/dev.c:7194)
    [   69.261716] net_rx_action (net/core/dev.c:7265)
    [   69.261718] ? __qdisc_run (net/sched/sch_generic.c:293)
    [   69.261721] ? sched_clock (arch/x86/include/asm/preempt.h:84 arch/x86/kernel/tsc.c:288)
    [   69.261726] handle_softirqs (kernel/softirq.c:561)
    
    Fixes: 3a8845af66edb ("idpf: add RX splitq napi poll support")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Alan Brady <alan.brady@intel.com>
    Cc: Joshua Hay <joshua.a.hay@intel.com>
    Cc: Willem de Bruijn <willemb@google.com>
    Acked-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Link: https://patch.msgid.link/20250226221253.1927782-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ima: Reset IMA_NONACTION_RULE_FLAGS after post_setattr [+ + +]
Author: Roberto Sassu <roberto.sassu@huawei.com>
Date:   Tue Feb 4 13:57:20 2025 +0100

    ima: Reset IMA_NONACTION_RULE_FLAGS after post_setattr
    
    commit 57a0ef02fefafc4b9603e33a18b669ba5ce59ba3 upstream.
    
    Commit 0d73a55208e9 ("ima: re-introduce own integrity cache lock")
    mistakenly reverted the performance improvement introduced in commit
    42a4c603198f0 ("ima: fix ima_inode_post_setattr"). The unused bit mask was
    subsequently removed by commit 11c60f23ed13 ("integrity: Remove unused
    macro IMA_ACTION_RULE_FLAGS").
    
    Restore the performance improvement by introducing the new mask
    IMA_NONACTION_RULE_FLAGS, equal to IMA_NONACTION_FLAGS without
    IMA_NEW_FILE, which is not a rule-specific flag.
    
    Finally, reset IMA_NONACTION_RULE_FLAGS instead of IMA_NONACTION_FLAGS in
    process_measurement(), if the IMA_CHANGE_ATTR atomic flag is set (after
    file metadata modification).
    
    With this patch, new files for which metadata were modified while they are
    still open, can be reopened before the last file close (when security.ima
    is written), since the IMA_NEW_FILE flag is not cleared anymore. Otherwise,
    appraisal fails because security.ima is missing (files with IMA_NEW_FILE
    set are an exception).
    
    Cc: stable@vger.kernel.org # v4.16.x
    Fixes: 0d73a55208e9 ("ima: re-introduce own integrity cache lock")
    Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
    Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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: 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>

 
iommu/vt-d: Fix suspicious RCU usage [+ + +]
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Fri Feb 28 18:27:26 2025 +0800

    iommu/vt-d: Fix suspicious RCU usage
    
    commit b150654f74bf0df8e6a7936d5ec51400d9ec06d8 upstream.
    
    Commit <d74169ceb0d2> ("iommu/vt-d: Allocate DMAR fault interrupts
    locally") moved the call to enable_drhd_fault_handling() to a code
    path that does not hold any lock while traversing the drhd list. Fix
    it by ensuring the dmar_global_lock lock is held when traversing the
    drhd list.
    
    Without this fix, the following warning is triggered:
     =============================
     WARNING: suspicious RCU usage
     6.14.0-rc3 #55 Not tainted
     -----------------------------
     drivers/iommu/intel/dmar.c:2046 RCU-list traversed in non-reader section!!
                   other info that might help us debug this:
                   rcu_scheduler_active = 1, debug_locks = 1
     2 locks held by cpuhp/1/23:
     #0: ffffffff84a67c50 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun+0x87/0x2c0
     #1: ffffffff84a6a380 (cpuhp_state-up){+.+.}-{0:0}, at: cpuhp_thread_fun+0x87/0x2c0
     stack backtrace:
     CPU: 1 UID: 0 PID: 23 Comm: cpuhp/1 Not tainted 6.14.0-rc3 #55
     Call Trace:
      <TASK>
      dump_stack_lvl+0xb7/0xd0
      lockdep_rcu_suspicious+0x159/0x1f0
      ? __pfx_enable_drhd_fault_handling+0x10/0x10
      enable_drhd_fault_handling+0x151/0x180
      cpuhp_invoke_callback+0x1df/0x990
      cpuhp_thread_fun+0x1ea/0x2c0
      smpboot_thread_fn+0x1f5/0x2e0
      ? __pfx_smpboot_thread_fn+0x10/0x10
      kthread+0x12a/0x2d0
      ? __pfx_kthread+0x10/0x10
      ret_from_fork+0x4a/0x60
      ? __pfx_kthread+0x10/0x10
      ret_from_fork_asm+0x1a/0x30
      </TASK>
    
    Holding the lock in enable_drhd_fault_handling() triggers a lockdep splat
    about a possible deadlock between dmar_global_lock and cpu_hotplug_lock.
    This is avoided by not holding dmar_global_lock when calling
    iommu_device_register(), which initiates the device probe process.
    
    Fixes: d74169ceb0d2 ("iommu/vt-d: Allocate DMAR fault interrupts locally")
    Reported-and-tested-by: Ido Schimmel <idosch@nvidia.com>
    Closes: https://lore.kernel.org/linux-iommu/Zx9OwdLIc_VoQ0-a@shredder.mtl.com/
    Tested-by: Breno Leitao <leitao@debian.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20250218022422.2315082-1-baolu.lu@linux.intel.com
    Tested-by: Ido Schimmel <idosch@nvidia.com>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iommu/vt-d: Remove device comparison in context_setup_pass_through_cb [+ + +]
Author: Jerry Snitselaar <jsnitsel@redhat.com>
Date:   Fri Feb 28 18:27:25 2025 +0800

    iommu/vt-d: Remove device comparison in context_setup_pass_through_cb
    
    commit 64f792981e35e191eb619f6f2fefab76cc7d6112 upstream.
    
    Remove the device comparison check in context_setup_pass_through_cb.
    pci_for_each_dma_alias already makes a decision on whether the
    callback function should be called for a device. With the check
    in place it will fail to create context entries for aliases as
    it walks up to the root bus.
    
    Fixes: 2031c469f816 ("iommu/vt-d: Add support for static identity domain")
    Closes: https://lore.kernel.org/linux-iommu/82499eb6-00b7-4f83-879a-e97b4144f576@linux.intel.com/
    Cc: stable@vger.kernel.org
    Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
    Link: https://lore.kernel.org/r/20250224180316.140123-1-jsnitsel@redhat.com
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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>

 
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>

 
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>

 
KVM: arm64: Ensure a VMID is allocated before programming VTTBR_EL2 [+ + +]
Author: Oliver Upton <oliver.upton@linux.dev>
Date:   Wed Feb 19 14:07:37 2025 -0800

    KVM: arm64: Ensure a VMID is allocated before programming VTTBR_EL2
    
    commit fa808ed4e199ed17d878eb75b110bda30dd52434 upstream.
    
    Vladimir reports that a race condition to attach a VMID to a stage-2 MMU
    sometimes results in a vCPU entering the guest with a VMID of 0:
    
    | CPU1                                            |   CPU2
    |                                                 |
    |                                                 | kvm_arch_vcpu_ioctl_run
    |                                                 |   vcpu_load             <= load VTTBR_EL2
    |                                                 |                            kvm_vmid->id = 0
    |                                                 |
    | kvm_arch_vcpu_ioctl_run                         |
    |   vcpu_load             <= load VTTBR_EL2       |
    |                            with kvm_vmid->id = 0|
    |   kvm_arm_vmid_update   <= allocates fresh      |
    |                            kvm_vmid->id and     |
    |                            reload VTTBR_EL2     |
    |                                                 |
    |                                                 |   kvm_arm_vmid_update <= observes that kvm_vmid->id
    |                                                 |                          already allocated,
    |                                                 |                          skips reload VTTBR_EL2
    
    Oh yeah, it's as bad as it looks. Remember that VHE loads the stage-2
    MMU eagerly but a VMID only gets attached to the MMU later on in the
    KVM_RUN loop.
    
    Even in the "best case" where VTTBR_EL2 correctly gets reprogrammed
    before entering the EL1&0 regime, there is a period of time where
    hardware is configured with VMID 0. That's completely insane. So, rather
    than decorating the 'late' binding with another hack, just allocate the
    damn thing up front.
    
    Attaching a VMID from vcpu_load() is still rollover safe since
    (surprise!) it'll always get called after a vCPU was preempted.
    
    Excuse me while I go find a brown paper bag.
    
    Cc: stable@vger.kernel.org
    Fixes: 934bf871f011 ("KVM: arm64: Load the stage-2 MMU context in kvm_vcpu_load_vhe()")
    Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
    Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
    Link: https://lore.kernel.org/r/20250219220737.130842-1-oliver.upton@linux.dev
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
landlock: Fix non-TCP sockets restriction [+ + +]
Author: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
Date:   Wed Feb 5 17:36:49 2025 +0800

    landlock: Fix non-TCP sockets restriction
    
    [ Upstream commit 854277e2cc8c75dc3c216c82e72523258fcf65b9 ]
    
    Use sk_is_tcp() to check if socket is TCP in bind(2) and connect(2)
    hooks.
    
    SMC, MPTCP, SCTP protocols are currently restricted by TCP access
    rights.  The purpose of TCP access rights is to provide control over
    ports that can be used by userland to establish a TCP connection.
    Therefore, it is incorrect to deny bind(2) and connect(2) requests for a
    socket of another protocol.
    
    However, SMC, MPTCP and RDS implementations use TCP internal sockets to
    establish communication or even to exchange packets over a TCP
    connection [1]. Landlock rules that configure bind(2) and connect(2)
    usage for TCP sockets should not cover requests for sockets of such
    protocols. These protocols have different set of security issues and
    security properties, therefore, it is necessary to provide the userland
    with the ability to distinguish between them (eg. [2]).
    
    Control over TCP connection used by other protocols can be achieved with
    upcoming support of socket creation control [3].
    
    [1] https://lore.kernel.org/all/62336067-18c2-3493-d0ec-6dd6a6d3a1b5@huawei-partners.com/
    [2] https://lore.kernel.org/all/20241204.fahVio7eicim@digikod.net/
    [3] https://lore.kernel.org/all/20240904104824.1844082-1-ivanov.mikhail1@huawei-partners.com/
    
    Closes: https://github.com/landlock-lsm/linux/issues/40
    Fixes: fff69fb03dde ("landlock: Support network rules with TCP bind and connect")
    Signed-off-by: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
    Link: https://lore.kernel.org/r/20250205093651.1424339-2-ivanov.mikhail1@huawei-partners.com
    [mic: Format commit message to 72 columns]
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Linux 6.12.18 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Mar 7 18:25:47 2025 +0100

    Linux 6.12.18
    
    Link: https://lore.kernel.org/r/20250305174503.801402104@linuxfoundation.org
    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: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Hardik Garg <hargar@linux.microsoft.com>
    Link: https://lore.kernel.org/r/20250306151415.047855127@linuxfoundation.org
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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>

 
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: 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: dsa: rtl8366rb: Fix compilation problem [+ + +]
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Thu Feb 20 19:48:15 2025 +0100

    net: dsa: rtl8366rb: Fix compilation problem
    
    [ Upstream commit f15176b8b6e72ac30e14fd273282d2b72562d26b ]
    
    When the kernel is compiled without LED framework support the
    rtl8366rb fails to build like this:
    
    rtl8366rb.o: in function `rtl8366rb_setup_led':
    rtl8366rb.c:953:(.text.unlikely.rtl8366rb_setup_led+0xe8):
      undefined reference to `led_init_default_state_get'
    rtl8366rb.c:980:(.text.unlikely.rtl8366rb_setup_led+0x240):
      undefined reference to `devm_led_classdev_register_ext'
    
    As this is constantly coming up in different randconfig builds,
    bite the bullet and create a separate file for the offending
    code, split out a header with all stuff needed both in the
    core driver and the leds code.
    
    Add a new bool Kconfig option for the LED compile target, such
    that it depends on LEDS_CLASS=y || LEDS_CLASS=RTL8366RB
    which make LED support always available when LEDS_CLASS is
    compiled into the kernel and enforce that if the LEDS_CLASS
    is a module, then the RTL8366RB driver needs to be a module
    as well so that modprobe can resolve the dependencies.
    
    Fixes: 32d617005475 ("net: dsa: realtek: add LED drivers for rtl8366rb")
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202502070525.xMUImayb-lkp@intel.com/
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    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: enetc: VFs do not support HWTSTAMP_TX_ONESTEP_SYNC [+ + +]
Author: Wei Fang <wei.fang@nxp.com>
Date:   Mon Feb 24 19:12:47 2025 +0800

    net: enetc: VFs do not support HWTSTAMP_TX_ONESTEP_SYNC
    
    commit a562d0c4a893eae3ea51d512c4d90ab858a6b7ec upstream.
    
    Actually ENETC VFs do not support HWTSTAMP_TX_ONESTEP_SYNC because only
    ENETC PF can access PMa_SINGLE_STEP registers. And there will be a crash
    if VFs are used to test one-step timestamp, the crash log as follows.
    
    [  129.110909] Unable to handle kernel paging request at virtual address 00000000000080c0
    [  129.287769] Call trace:
    [  129.290219]  enetc_port_mac_wr+0x30/0xec (P)
    [  129.294504]  enetc_start_xmit+0xda4/0xe74
    [  129.298525]  enetc_xmit+0x70/0xec
    [  129.301848]  dev_hard_start_xmit+0x98/0x118
    
    Fixes: 41514737ecaa ("enetc: add get_ts_info interface for ethtool")
    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-5-wei.fang@nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: ethernet: ti: am65-cpsw: select PAGE_POOL [+ + +]
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Mon Feb 24 06:17:16 2025 +0100

    net: ethernet: ti: am65-cpsw: select PAGE_POOL
    
    [ Upstream commit bab3a6e9ffd600f9db0ebaf8f45e1c6111cf314c ]
    
    am65-cpsw uses page_pool_dev_alloc_pages(), thus needs PAGE_POOL
    selected to avoid linker errors. This is missing since the driver
    started to use page_pool helpers in 8acacc40f733 ("net: ethernet:
    ti: am65-cpsw: Add minimal XDP support")
    
    Fixes: 8acacc40f733 ("net: ethernet: ti: am65-cpsw: Add minimal XDP support")
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Link: https://patch.msgid.link/20250224-net-am654-nuss-kconfig-v2-1-c124f4915c92@pengutronix.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.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: 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: phy: qcom: qca807x fix condition for DAC_DSP_BIAS_CURRENT [+ + +]
Author: George Moussalem <george.moussalem@outlook.com>
Date:   Wed Feb 19 14:09:21 2025 +0100

    net: phy: qcom: qca807x fix condition for DAC_DSP_BIAS_CURRENT
    
    commit 992ee3ed6e9fdd0be83a7daa5ff738e3cf86047f upstream.
    
    While setting the DAC value, the wrong boolean value is evaluated to set
    the DSP bias current. So let's correct the conditional statement and use
    the right boolean value read from the DTS set in the priv.
    
    Cc: stable@vger.kernel.org
    Fixes: d1cb613efbd3 ("net: phy: qcom: add support for QCA807x PHY Family")
    Signed-off-by: George Moussalem <george.moussalem@outlook.com>
    Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20250219130923.7216-1-ansuelsmth@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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>

net: stmmac: dwmac-loongson: Add fix_soc_reset() callback [+ + +]
Author: Qunqin Zhao <zhaoqunqin@loongson.cn>
Date:   Wed Feb 19 10:07:01 2025 +0800

    net: stmmac: dwmac-loongson: Add fix_soc_reset() callback
    
    commit f06e4bfd010faefa637689d2df2c727dbf6e1d27 upstream.
    
    Loongson's DWMAC device may take nearly two seconds to complete DMA reset,
    however, the default waiting time for reset is 200 milliseconds.
    Therefore, the following error message may appear:
    
    [14.427169] dwmac-loongson-pci 0000:00:03.2: Failed to reset the dma
    
    Fixes: 803fc61df261 ("net: stmmac: dwmac-loongson: Add Loongson Multi-channels GMAC support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Qunqin Zhao <zhaoqunqin@loongson.cn>
    Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Acked-by: Yanteng Si <si.yanteng@linux.dev>
    Link: https://patch.msgid.link/20250219020701.15139-1-zhaoqunqin@loongson.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: ti: icss-iep: Reject perout generation request [+ + +]
Author: Meghana Malladi <m-malladi@ti.com>
Date:   Thu Feb 27 14:54:41 2025 +0530

    net: ti: icss-iep: Reject perout generation request
    
    [ Upstream commit 54e1b4becf5e220be03db4e1be773c1310e8cbbd ]
    
    IEP driver supports both perout and pps signal generation
    but perout feature is faulty with half-cooked support
    due to some missing configuration. Remove perout
    support from the driver and reject perout requests with
    "not supported" error code.
    
    Fixes: c1e0230eeaab2 ("net: ti: icss-iep: Add IEP driver")
    Signed-off-by: Meghana Malladi <m-malladi@ti.com>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Link: https://patch.msgid.link/20250227092441.1848419-1-m-malladi@ti.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFS: Adjust delegated timestamps for O_DIRECT reads and writes [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Sat Feb 1 14:59:03 2025 -0500

    NFS: Adjust delegated timestamps for O_DIRECT reads and writes
    
    [ Upstream commit 88025c67fe3c025a0123bc7af50535b97f7af89a ]
    
    Adjust the timestamps if O_DIRECT is being combined with attribute
    delegations.
    
    Fixes: e12912d94137 ("NFSv4: Add support for delegated atime and mtime attributes")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

NFS: O_DIRECT writes must check and adjust the file length [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Sat Feb 1 14:59:02 2025 -0500

    NFS: O_DIRECT writes must check and adjust the file length
    
    [ Upstream commit fcf857ee1958e9247298251f7615d0c76f1e9b38 ]
    
    While it is uncommon for delegations to be held while O_DIRECT writes
    are in progress, it is possible. The xfstests generic/647 and
    generic/729 both end up triggering that state, and end up failing due to
    the fact that the file size is not adjusted.
    
    Reported-by: Chuck Lever <chuck.lever@oracle.com>
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=219738
    Cc: stable@vger.kernel.org
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Stable-dep-of: 88025c67fe3c ("NFS: Adjust delegated timestamps for O_DIRECT reads and writes")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
NFSv4: Fix a deadlock when recovering state on a sillyrenamed file [+ + +]
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Sat Feb 1 15:00:09 2025 -0500

    NFSv4: Fix a deadlock when recovering state on a sillyrenamed file
    
    [ Upstream commit 8f8df955f078e1a023ee55161935000a67651f38 ]
    
    If the file is sillyrenamed, and slated for delete on close, it is
    possible for a server reboot to triggeer an open reclaim, with can again
    race with the application call to close(). When that happens, the call
    to put_nfs_open_context() can trigger a synchronous delegreturn call
    which deadlocks because it is not marked as privileged.
    
    Instead, ensure that the call to nfs4_inode_return_delegation_on_close()
    catches the delegreturn, and schedules it asynchronously.
    
    Reported-by: Li Lingfeng <lilingfeng3@huawei.com>
    Fixes: adb4b42d19ae ("Return the delegation when deleting sillyrenamed files")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
objtool: Fix C jump table annotations for Clang [+ + +]
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Fri Feb 21 14:57:07 2025 +0100

    objtool: Fix C jump table annotations for Clang
    
    [ Upstream commit 73cfc53cc3b6380eccf013049574485f64cb83ca ]
    
    A C jump table (such as the one used by the BPF interpreter) is a const
    global array of absolute code addresses, and this means that the actual
    values in the table may not be known until the kernel is booted (e.g.,
    when using KASLR or when the kernel VA space is sized dynamically).
    
    When using PIE codegen, the compiler will default to placing such const
    global objects in .data.rel.ro (which is annotated as writable), rather
    than .rodata (which is annotated as read-only). As C jump tables are
    explicitly emitted into .rodata, this used to result in warnings for
    LoongArch builds (which uses PIE codegen for the entire kernel) like
    
      Warning: setting incorrect section attributes for .rodata..c_jump_table
    
    due to the fact that the explicitly specified .rodata section inherited
    the read-write annotation that the compiler uses for such objects when
    using PIE codegen.
    
    This warning was suppressed by explicitly adding the read-only
    annotation to the __attribute__((section(""))) string, by commit
    
      c5b1184decc8 ("compiler.h: specify correct attribute for .rodata..c_jump_table")
    
    Unfortunately, this hack does not work on Clang's integrated assembler,
    which happily interprets the appended section type and permission
    specifiers as part of the section name, which therefore no longer
    matches the hard-coded pattern '.rodata..c_jump_table' that objtool
    expects, causing it to emit a warning
    
      kernel/bpf/core.o: warning: objtool: ___bpf_prog_run+0x20: sibling call from callable instruction with modified stack frame
    
    Work around this, by emitting C jump tables into .data.rel.ro instead,
    which is treated as .rodata by the linker script for all builds, not
    just PIE based ones.
    
    Fixes: c5b1184decc8 ("compiler.h: specify correct attribute for .rodata..c_jump_table")
    Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn> # on LoongArch
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://lore.kernel.org/r/20250221135704.431269-6-ardb+git@google.com
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

objtool: Remove annotate_{,un}reachable() [+ + +]
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Thu Nov 28 10:39:04 2024 +0100

    objtool: Remove annotate_{,un}reachable()
    
    [ Upstream commit 06e24745985c8dd0da18337503afcf2f2fdbdff1 ]
    
    There are no users of annotate_reachable() left.
    
    And the annotate_unreachable() usage in unreachable() is plain wrong;
    it will hide dangerous fall-through code-gen.
    
    Remove both.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Link: https://lore.kernel.org/r/20241128094312.235637588@infradead.org
    Stable-dep-of: 73cfc53cc3b6 ("objtool: Fix C jump table annotations for Clang")
    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: Add RCU read lock protection to perf_iterate_ctx() [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Fri Jan 17 06:41:07 2025 -0800

    perf/core: Add RCU read lock protection to perf_iterate_ctx()
    
    commit 0fe8813baf4b2e865d3b2c735ce1a15b86002c74 upstream.
    
    The perf_iterate_ctx() function performs RCU list traversal but
    currently lacks RCU read lock protection. This causes lockdep warnings
    when running perf probe with unshare(1) under CONFIG_PROVE_RCU_LIST=y:
    
            WARNING: suspicious RCU usage
            kernel/events/core.c:8168 RCU-list traversed in non-reader section!!
    
             Call Trace:
              lockdep_rcu_suspicious
              ? perf_event_addr_filters_apply
              perf_iterate_ctx
              perf_event_exec
              begin_new_exec
              ? load_elf_phdrs
              load_elf_binary
              ? lock_acquire
              ? find_held_lock
              ? bprm_execve
              bprm_execve
              do_execveat_common.isra.0
              __x64_sys_execve
              do_syscall_64
              entry_SYSCALL_64_after_hwframe
    
    This protection was previously present but was removed in commit
    bd2756811766 ("perf: Rewrite core context handling"). Add back the
    necessary rcu_read_lock()/rcu_read_unlock() pair around
    perf_iterate_ctx() call in perf_event_exec().
    
    [ mingo: Use scoped_guard() as suggested by Peter ]
    
    Fixes: bd2756811766 ("perf: Rewrite core context handling")
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250117-fix_perf_rcu-v1-1-13cb9210fc6a@debian.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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/core: Order the PMU list to fix warning about unordered pmu_ctx_list [+ + +]
Author: Luo Gengkun <luogengkun@huaweicloud.com>
Date:   Wed Jan 22 07:33:56 2025 +0000

    perf/core: Order the PMU list to fix warning about unordered pmu_ctx_list
    
    [ Upstream commit 2016066c66192a99d9e0ebf433789c490a6785a2 ]
    
    Syskaller triggers a warning due to prev_epc->pmu != next_epc->pmu in
    perf_event_swap_task_ctx_data(). vmcore shows that two lists have the same
    perf_event_pmu_context, but not in the same order.
    
    The problem is that the order of pmu_ctx_list for the parent is impacted by
    the time when an event/PMU is added. While the order for a child is
    impacted by the event order in the pinned_groups and flexible_groups. So
    the order of pmu_ctx_list in the parent and child may be different.
    
    To fix this problem, insert the perf_event_pmu_context to its proper place
    after iteration of the pmu_ctx_list.
    
    The follow testcase can trigger above warning:
    
     # perf record -e cycles --call-graph lbr -- taskset -c 3 ./a.out &
     # perf stat -e cpu-clock,cs -p xxx // xxx is the pid of a.out
    
     test.c
    
     void main() {
            int count = 0;
            pid_t pid;
    
            printf("%d running\n", getpid());
            sleep(30);
            printf("running\n");
    
            pid = fork();
            if (pid == -1) {
                    printf("fork error\n");
                    return;
            }
            if (pid == 0) {
                    while (1) {
                            count++;
                    }
            } else {
                    while (1) {
                            count++;
                    }
            }
     }
    
    The testcase first opens an LBR event, so it will allocate task_ctx_data,
    and then open tracepoint and software events, so the parent context will
    have 3 different perf_event_pmu_contexts. On inheritance, child ctx will
    insert the perf_event_pmu_context in another order and the warning will
    trigger.
    
    [ mingo: Tidied up the changelog. ]
    
    Fixes: bd2756811766 ("perf: Rewrite core context handling")
    Signed-off-by: Luo Gengkun <luogengkun@huaweicloud.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
    Link: https://lore.kernel.org/r/20250122073356.1824736-1-luogengkun@huaweicloud.com
    Signed-off-by: Sasha Levin <sashal@kernel.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>

 
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: exynos5-usbdrd: gs101: ensure power is gated to SS phy in phy_exit() [+ + +]
Author: André Draszik <andre.draszik@linaro.org>
Date:   Thu Dec 5 10:22:00 2024 +0000

    phy: exynos5-usbdrd: gs101: ensure power is gated to SS phy in phy_exit()
    
    commit 8789b4296aa796f658a19cac7d27365012893de1 upstream.
    
    We currently don't gate the power to the SS phy in phy_exit().
    
    Shuffle the code slightly to ensure the power is gated to the SS phy as
    well.
    
    Fixes: 32267c29bc7d ("phy: exynos5-usbdrd: support Exynos USBDRD 3.1 combo phy (HS & SS)")
    CC: stable@vger.kernel.org # 6.11+
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
    Signed-off-by: André Draszik <andre.draszik@linaro.org>
    Link: https://lore.kernel.org/r/20241205-gs101-usb-phy-fix-v4-1-0278809fb810@linaro.org
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

phy: rockchip: fix Kconfig dependency more [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Jan 22 07:52:44 2025 +0100

    phy: rockchip: fix Kconfig dependency more
    
    [ Upstream commit fcf5d353b09b3fc212ab24b89ef23a7a8f7b308e ]
    
    A previous patch ensured that USB Type C connector support is enabled,
    but it is still possible to build the phy driver without enabling
    CONFIG_USB (host support) or CONFIG_USB_GADGET (device support), and
    in that case the common helper functions are unavailable:
    
    aarch64-linux-ld: drivers/phy/rockchip/phy-rockchip-usbdp.o: in function `rk_udphy_probe':
    phy-rockchip-usbdp.c:(.text+0xe74): undefined reference to `usb_get_maximum_speed'
    
    Select CONFIG_USB_COMMON directly here, like we do in some other phy
    drivers, to make sure this is available even when actual USB support
    is disabled or in a loadable module that cannot be reached from a
    built-in phy driver.
    
    Fixes: 9c79b779643e ("phy: rockchip: fix CONFIG_TYPEC dependency")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Reviewed-by: Heiko Stuebner <heiko@sntech.de>
    Link: https://lore.kernel.org/r/20250122065249.1390081-1-arnd@kernel.org
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.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>

 
rcuref: Plug slowpath race in rcuref_put() [+ + +]
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Sun Jan 19 00:55:32 2025 +0100

    rcuref: Plug slowpath race in rcuref_put()
    
    commit b9a49520679e98700d3d89689cc91c08a1c88c1d upstream.
    
    Kernel test robot reported an "imbalanced put" in the rcuref_put() slow
    path, which turned out to be a false positive. Consider the following race:
    
                ref  = 0 (via rcuref_init(ref, 1))
     T1                                      T2
     rcuref_put(ref)
     -> atomic_add_negative_release(-1, ref)                                         # ref -> 0xffffffff
     -> rcuref_put_slowpath(ref)
                                             rcuref_get(ref)
                                             -> atomic_add_negative_relaxed(1, &ref->refcnt)
                                               -> return true;                       # ref -> 0
    
                                             rcuref_put(ref)
                                             -> atomic_add_negative_release(-1, ref) # ref -> 0xffffffff
                                             -> rcuref_put_slowpath()
    
        -> cnt = atomic_read(&ref->refcnt);                                          # cnt -> 0xffffffff / RCUREF_NOREF
        -> atomic_try_cmpxchg_release(&ref->refcnt, &cnt, RCUREF_DEAD))              # ref -> 0xe0000000 / RCUREF_DEAD
           -> return true
                                               -> cnt = atomic_read(&ref->refcnt);   # cnt -> 0xe0000000 / RCUREF_DEAD
                                               -> if (cnt > RCUREF_RELEASED)         # 0xe0000000 > 0xc0000000
                                                 -> WARN_ONCE(cnt >= RCUREF_RELEASED, "rcuref - imbalanced put()")
    
    The problem is the additional read in the slow path (after it
    decremented to RCUREF_NOREF) which can happen after the counter has been
    marked RCUREF_DEAD.
    
    Prevent this by reusing the return value of the decrement. Now every "final"
    put uses RCUREF_NOREF in the slow path and attempts the final cmpxchg() to
    RCUREF_DEAD.
    
    [ bigeasy: Add changelog ]
    
    Fixes: ee1ee6db07795 ("atomics: Provide rcuref - scalable reference counting")
    Reported-by: kernel test robot <oliver.sang@intel.com>
    Debugged-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Cc: stable@vger.kernel.org
    Closes: https://lore.kernel.org/oe-lkp/202412311453.9d7636a2-lkp@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA/bnxt_re: Add sanity checks on rdev validity [+ + +]
Author: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Date:   Tue Feb 4 00:21:23 2025 -0800

    RDMA/bnxt_re: Add sanity checks on rdev validity
    
    [ Upstream commit f0df225d12fcb049429fb5bf5122afe143c2dd15 ]
    
    There is a possibility that ulp_irq_stop and ulp_irq_start
    callbacks will be called when the device is in detached state.
    This can cause a crash due to NULL pointer dereference as
    the rdev is already freed.
    
    Fixes: cc5b9b48d447 ("RDMA/bnxt_re: Recover the device when FW error is detected")
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Link: https://patch.msgid.link/1738657285-23968-3-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Allocate dev_attr information dynamically [+ + +]
Author: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Date:   Thu Jan 9 10:18:13 2025 -0800

    RDMA/bnxt_re: Allocate dev_attr information dynamically
    
    [ Upstream commit 9264cd6aa8f194753507cb6e1f444141e7c79f48 ]
    
    In order to optimize the size of driver private structure,
    the memory for dev_attr is allocated dynamically during the
    chip context initialization. In order to make certain runtime
    decisions, store dev_attr in the qplib_res structure.
    
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Link: https://patch.msgid.link/1736446693-6692-3-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Stable-dep-of: 8238c7bd8420 ("RDMA/bnxt_re: Fix the statistics for Gen P7 VF")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Cache MSIx info to a local structure [+ + +]
Author: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Date:   Thu Nov 14 01:49:08 2024 -0800

    RDMA/bnxt_re: Cache MSIx info to a local structure
    
    [ Upstream commit 31bad59805c388f92f3a13174a149c2228301c15 ]
    
    L2 driver allocates the vectors for RoCE and pass it through the
    en_dev structure to RoCE. During probe, cache the MSIx related
    info to a local structure.
    
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Link: https://patch.msgid.link/1731577748-1804-5-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Stable-dep-of: f0df225d12fc ("RDMA/bnxt_re: Add sanity checks on rdev validity")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Fail probe early when not enough MSI-x vectors are reserved [+ + +]
Author: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Date:   Thu Nov 14 01:49:05 2024 -0800

    RDMA/bnxt_re: Fail probe early when not enough MSI-x vectors are reserved
    
    [ Upstream commit 65ecee132774e0f15cd76a766eb39ec21118bffc ]
    
    L2 driver allocates and populates the MSI-x vector details for RoCE
    in the en_dev structure. RoCE driver requires minimum 2 MSIx vectors.
    Hence during probe, driver has to check and bail out if there are not
    enough MSI-x vectors reserved for it before proceeding further
    initialization.
    
    Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
    Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
    Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com>
    Reviewed-by: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
    Reviewed-by: Kashyap Desai <kashyap.desai@broadcom.com>
    Reviewed-by: Chandramohan Akula <chandramohan.akula@broadcom.com>
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Link: https://patch.msgid.link/1731577748-1804-2-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Stable-dep-of: f0df225d12fc ("RDMA/bnxt_re: Add sanity checks on rdev validity")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Fix the page details for the srq created by kernel consumers [+ + +]
Author: Kashyap Desai <kashyap.desai@broadcom.com>
Date:   Sat Feb 22 07:20:21 2025 -0800

    RDMA/bnxt_re: Fix the page details for the srq created by kernel consumers
    
    [ Upstream commit b66535356a4834a234f99e16a97eb51f2c6c5a7d ]
    
    While using nvme target with use_srq on, below kernel panic is noticed.
    
    [  549.698111] bnxt_en 0000:41:00.0 enp65s0np0: FEC autoneg off encoding: Clause 91 RS(544,514)
    [  566.393619] Oops: divide error: 0000 [#1] PREEMPT SMP NOPTI
    ..
    [  566.393799]  <TASK>
    [  566.393807]  ? __die_body+0x1a/0x60
    [  566.393823]  ? die+0x38/0x60
    [  566.393835]  ? do_trap+0xe4/0x110
    [  566.393847]  ? bnxt_qplib_alloc_init_hwq+0x1d4/0x580 [bnxt_re]
    [  566.393867]  ? bnxt_qplib_alloc_init_hwq+0x1d4/0x580 [bnxt_re]
    [  566.393881]  ? do_error_trap+0x7c/0x120
    [  566.393890]  ? bnxt_qplib_alloc_init_hwq+0x1d4/0x580 [bnxt_re]
    [  566.393911]  ? exc_divide_error+0x34/0x50
    [  566.393923]  ? bnxt_qplib_alloc_init_hwq+0x1d4/0x580 [bnxt_re]
    [  566.393939]  ? asm_exc_divide_error+0x16/0x20
    [  566.393966]  ? bnxt_qplib_alloc_init_hwq+0x1d4/0x580 [bnxt_re]
    [  566.393997]  bnxt_qplib_create_srq+0xc9/0x340 [bnxt_re]
    [  566.394040]  bnxt_re_create_srq+0x335/0x3b0 [bnxt_re]
    [  566.394057]  ? srso_return_thunk+0x5/0x5f
    [  566.394068]  ? __init_swait_queue_head+0x4a/0x60
    [  566.394090]  ib_create_srq_user+0xa7/0x150 [ib_core]
    [  566.394147]  nvmet_rdma_queue_connect+0x7d0/0xbe0 [nvmet_rdma]
    [  566.394174]  ? lock_release+0x22c/0x3f0
    [  566.394187]  ? srso_return_thunk+0x5/0x5f
    
    Page size and shift info is set only for the user space SRQs.
    Set page size and page shift for kernel space SRQs also.
    
    Fixes: 0c4dcd602817 ("RDMA/bnxt_re: Refactor hardware queue memory allocation")
    Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Link: https://patch.msgid.link/1740237621-29291-1-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Fix the statistics for Gen P7 VF [+ + +]
Author: Selvin Xavier <selvin.xavier@broadcom.com>
Date:   Tue Feb 4 00:21:25 2025 -0800

    RDMA/bnxt_re: Fix the statistics for Gen P7 VF
    
    [ Upstream commit 8238c7bd84209c8216b1381ab0dbe6db9e203769 ]
    
    Gen P7 VF support the extended stats and is prevented
    by a VF check. Fix the check to issue the FW command
    for GenP7 VFs also.
    
    Fixes: 1801d87b3598 ("RDMA/bnxt_re: Support new 5760X P7 devices")
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Link: https://patch.msgid.link/1738657285-23968-5-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/bnxt_re: Refactor NQ allocation [+ + +]
Author: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Date:   Thu Nov 14 01:49:06 2024 -0800

    RDMA/bnxt_re: Refactor NQ allocation
    
    [ Upstream commit 30b871338c3ebab4c5efb74f6b23b59f1ac4ca1f ]
    
    Move NQ related data structures from rdev to a new structure
    named "struct bnxt_re_nq_record" by keeping a pointer to in
    the rdev structure. Allocate the memory for it dynamically.
    This change is needed for subsequent patches in the series.
    
    Also, removed the nq_task variable from rdev structure as it
    is redundant and no longer used.
    
    This change would help to reduce the size of the driver private
    structure as well.
    
    Reviewed-by: Chandramohan Akula <chandramohan.akula@broadcom.com>
    Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
    Link: https://patch.msgid.link/1731577748-1804-3-git-send-email-selvin.xavier@broadcom.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Stable-dep-of: f0df225d12fc ("RDMA/bnxt_re: Add sanity checks on rdev validity")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/hns: Fix mbox timing out by adding retry mechanism [+ + +]
Author: Junxian Huang <huangjunxian6@hisilicon.com>
Date:   Sat Feb 8 18:59:30 2025 +0800

    RDMA/hns: Fix mbox timing out by adding retry mechanism
    
    [ Upstream commit 9747c0c7791d4a5a62018a0c9c563dd2e6f6c1c0 ]
    
    If a QP is modified to error state and a flush CQE process is triggered,
    the subsequent QP destruction mbox can still be successfully posted but
    will be blocked in HW until the flush CQE process finishes. This causes
    further mbox posting timeouts in driver. The blocking time is related
    to QP depth. Considering an extreme case where SQ depth and RQ depth
    are both 32K, the blocking time can reach about 135ms.
    
    This patch adds a retry mechanism for mbox posting. For each try, FW
    waits 15ms for HW to complete the previous mbox, otherwise return a
    timeout error code to driver. Counting other time consumption in FW,
    set 8 tries for mbox posting and a 5ms time gap before each retry to
    increase to a sufficient timeout limit.
    
    Fixes: 0425e3e6e0c7 ("RDMA/hns: Support flush cqe for hip08 in kernel space")
    Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
    Link: https://patch.msgid.link/20250208105930.522796-1-huangjunxian6@hisilicon.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/mana_ib: Allocate PAGE aligned doorbell index [+ + +]
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Feb 5 02:30:05 2025 -0800

    RDMA/mana_ib: Allocate PAGE aligned doorbell index
    
    [ Upstream commit 29b7bb98234cc287cebef9bccf638c2e3f39be71 ]
    
    Allocate a PAGE aligned doorbell index to ensure each process gets a
    separate PAGE sized doorbell area space remapped to it in mana_ib_mmap
    
    Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
    Signed-off-by: Shiraz Saleem <shirazsaleem@microsoft.com>
    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://patch.msgid.link/1738751405-15041-1-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/mlx5: Fix a race for DMABUF MR which can lead to CQE with error [+ + +]
Author: Yishai Hadas <yishaih@nvidia.com>
Date:   Mon Feb 3 14:50:59 2025 +0200

    RDMA/mlx5: Fix a race for DMABUF MR which can lead to CQE with error
    
    [ Upstream commit cc668a11e6ac8adb0e016711080d3f314722cc91 ]
    
    This patch addresses a potential race condition for a DMABUF MR that can
    result in a CQE with an error on the UMR QP.
    
    During the __mlx5_ib_dereg_mr() flow, the following sequence of calls
    occurs:
    mlx5_revoke_mr()
    mlx5r_umr_revoke_mr()
    mlx5r_umr_post_send_wait()
    At this point, the lkey is freed from the hardware's perspective.
    
    However, concurrently, mlx5_ib_dmabuf_invalidate_cb() might be triggered
    by another task attempting to invalidate the MR having that freed lkey.
    
    Since the lkey has already been freed, this can lead to a CQE error,
    causing the UMR QP to enter an error state.
    
    To resolve this race condition, the dma_resv_lock() which was hold as
    part of the mlx5_ib_dmabuf_invalidate_cb() is now also acquired as part
    of the mlx5_revoke_mr() scope.
    
    Upon a successful revoke, we set umem_dmabuf->private which points to
    that MR to NULL, preventing any further invalidation attempts on its
    lkey.
    
    Fixes: e6fb246ccafb ("RDMA/mlx5: Consolidate MR destruction to mlx5_ib_dereg_mr()")
    Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
    Reviewed-by: Artemy Kovalyov <artemyko@mnvidia.com>
    Link: https://patch.msgid.link/70617067abbfaa0c816a2544c922e7f4346def58.1738587016.git.leon@kernel.org
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/mlx5: Fix a WARN during dereg_mr for DM type [+ + +]
Author: Yishai Hadas <yishaih@nvidia.com>
Date:   Mon Feb 3 14:51:43 2025 +0200

    RDMA/mlx5: Fix a WARN during dereg_mr for DM type
    
    [ Upstream commit abc7b3f1f056d69a8f11d6dceecc0c9549ace770 ]
    
    Memory regions (MR) of type DM (device memory) do not have an associated
    umem.
    
    In the __mlx5_ib_dereg_mr() -> mlx5_free_priv_descs() flow, the code
    incorrectly takes the wrong branch, attempting to call
    dma_unmap_single() on a DMA address that is not mapped.
    
    This results in a WARN [1], as shown below.
    
    The issue is resolved by properly accounting for the DM type and
    ensuring the correct branch is selected in mlx5_free_priv_descs().
    
    [1]
    WARNING: CPU: 12 PID: 1346 at drivers/iommu/dma-iommu.c:1230 iommu_dma_unmap_page+0x79/0x90
    Modules linked in: ip6table_mangle ip6table_nat ip6table_filter ip6_tables iptable_mangle xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry ovelay rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm ib_ipoib iw_cm ib_cm mlx5_ib ib_uverbs ib_core fuse mlx5_core
    CPU: 12 UID: 0 PID: 1346 Comm: ibv_rc_pingpong Not tainted 6.12.0-rc7+ #1631
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
    RIP: 0010:iommu_dma_unmap_page+0x79/0x90
    Code: 2b 49 3b 29 72 26 49 3b 69 08 73 20 4d 89 f0 44 89 e9 4c 89 e2 48 89 ee 48 89 df 5b 5d 41 5c 41 5d 41 5e 41 5f e9 07 b8 88 ff <0f> 0b 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 66 0f 1f 44 00
    RSP: 0018:ffffc90001913a10 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: ffff88810194b0a8 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
    RBP: ffff88810194b0a8 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
    R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000000
    FS:  00007f537abdd740(0000) GS:ffff88885fb00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f537aeb8000 CR3: 000000010c248001 CR4: 0000000000372eb0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <TASK>
    ? __warn+0x84/0x190
    ? iommu_dma_unmap_page+0x79/0x90
    ? report_bug+0xf8/0x1c0
    ? handle_bug+0x55/0x90
    ? exc_invalid_op+0x13/0x60
    ? asm_exc_invalid_op+0x16/0x20
    ? iommu_dma_unmap_page+0x79/0x90
    dma_unmap_page_attrs+0xe6/0x290
    mlx5_free_priv_descs+0xb0/0xe0 [mlx5_ib]
    __mlx5_ib_dereg_mr+0x37e/0x520 [mlx5_ib]
    ? _raw_spin_unlock_irq+0x24/0x40
    ? wait_for_completion+0xfe/0x130
    ? rdma_restrack_put+0x63/0xe0 [ib_core]
    ib_dereg_mr_user+0x5f/0x120 [ib_core]
    ? lock_release+0xc6/0x280
    destroy_hw_idr_uobject+0x1d/0x60 [ib_uverbs]
    uverbs_destroy_uobject+0x58/0x1d0 [ib_uverbs]
    uobj_destroy+0x3f/0x70 [ib_uverbs]
    ib_uverbs_cmd_verbs+0x3e4/0xbb0 [ib_uverbs]
    ? __pfx_uverbs_destroy_def_handler+0x10/0x10 [ib_uverbs]
    ? lock_acquire+0xc1/0x2f0
    ? ib_uverbs_ioctl+0xcb/0x170 [ib_uverbs]
    ? ib_uverbs_ioctl+0x116/0x170 [ib_uverbs]
    ? lock_release+0xc6/0x280
    ib_uverbs_ioctl+0xe7/0x170 [ib_uverbs]
    ? ib_uverbs_ioctl+0xcb/0x170 [ib_uverbs]
    __x64_sys_ioctl+0x1b0/0xa70
    do_syscall_64+0x6b/0x140
    entry_SYSCALL_64_after_hwframe+0x76/0x7e
    RIP: 0033:0x7f537adaf17b
    Code: 0f 1e fa 48 8b 05 1d ad 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d ed ac 0c 00 f7 d8 64 89 01 48
    RSP: 002b:00007ffff218f0b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 00007ffff218f1d8 RCX: 00007f537adaf17b
    RDX: 00007ffff218f1c0 RSI: 00000000c0181b01 RDI: 0000000000000003
    RBP: 00007ffff218f1a0 R08: 00007f537aa8d010 R09: 0000561ee2e4f270
    R10: 00007f537aace3a8 R11: 0000000000000246 R12: 00007ffff218f190
    R13: 000000000000001c R14: 0000561ee2e4d7c0 R15: 00007ffff218f450
    </TASK>
    
    Fixes: f18ec4223117 ("RDMA/mlx5: Use a union inside mlx5_ib_mr")
    Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
    Link: https://patch.msgid.link/2039c22cfc3df02378747ba4d623a558b53fc263.1738587076.git.leon@kernel.org
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/mlx5: Fix AH static rate parsing [+ + +]
Author: Patrisious Haddad <phaddad@nvidia.com>
Date:   Mon Feb 10 13:32:39 2025 +0200

    RDMA/mlx5: Fix AH static rate parsing
    
    [ Upstream commit c534ffda781f44a1c6ac25ef6e0e444da38ca8af ]
    
    Previously static rate wasn't translated according to our PRM but simply
    used the 4 lower bytes.
    
    Correctly translate static rate value passed in AH creation attribute
    according to our PRM expected values.
    
    In addition change 800GB mapping to zero, which is the PRM
    specified value.
    
    Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
    Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
    Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
    Link: https://patch.msgid.link/18ef4cc5396caf80728341eb74738cd777596f60.1739187089.git.leon@kernel.org
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.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>

RDMA/mlx5: Fix implicit ODP hang on parent deregistration [+ + +]
Author: Yishai Hadas <yishaih@nvidia.com>
Date:   Mon Feb 10 13:31:11 2025 +0200

    RDMA/mlx5: Fix implicit ODP hang on parent deregistration
    
    [ Upstream commit 3d8c6f26893d55fab218ad086719de1fc9bb86ba ]
    
    Fix the destroy_unused_implicit_child_mr() to prevent hanging during
    parent deregistration as of below [1].
    
    Upon entering destroy_unused_implicit_child_mr(), the reference count
    for the implicit MR parent is incremented using:
    refcount_inc_not_zero().
    
    A corresponding decrement must be performed if
    free_implicit_child_mr_work() is not called.
    
    The code has been updated to properly manage the reference count that
    was incremented.
    
    [1]
    INFO: task python3:2157 blocked for more than 120 seconds.
    Not tainted 6.12.0-rc7+ #1633
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    task:python3         state:D stack:0     pid:2157 tgid:2157  ppid:1685   flags:0x00000000
    Call Trace:
    <TASK>
    __schedule+0x420/0xd30
    schedule+0x47/0x130
    __mlx5_ib_dereg_mr+0x379/0x5d0 [mlx5_ib]
    ? __pfx_autoremove_wake_function+0x10/0x10
    ib_dereg_mr_user+0x5f/0x120 [ib_core]
    ? lock_release+0xc6/0x280
    destroy_hw_idr_uobject+0x1d/0x60 [ib_uverbs]
    uverbs_destroy_uobject+0x58/0x1d0 [ib_uverbs]
    uobj_destroy+0x3f/0x70 [ib_uverbs]
    ib_uverbs_cmd_verbs+0x3e4/0xbb0 [ib_uverbs]
    ? __pfx_uverbs_destroy_def_handler+0x10/0x10 [ib_uverbs]
    ? lock_acquire+0xc1/0x2f0
    ? ib_uverbs_ioctl+0xcb/0x170 [ib_uverbs]
    ? ib_uverbs_ioctl+0x116/0x170 [ib_uverbs]
    ? lock_release+0xc6/0x280
    ib_uverbs_ioctl+0xe7/0x170 [ib_uverbs]
    ? ib_uverbs_ioctl+0xcb/0x170 [ib_uverbs]
     __x64_sys_ioctl+0x1b0/0xa70
    ? kmem_cache_free+0x221/0x400
    do_syscall_64+0x6b/0x140
    entry_SYSCALL_64_after_hwframe+0x76/0x7e
    RIP: 0033:0x7f20f21f017b
    RSP: 002b:00007ffcfc4a77c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 00007ffcfc4a78d8 RCX: 00007f20f21f017b
    RDX: 00007ffcfc4a78c0 RSI: 00000000c0181b01 RDI: 0000000000000003
    RBP: 00007ffcfc4a78a0 R08: 000056147d125190 R09: 00007f20f1f14c60
    R10: 0000000000000001 R11: 0000000000000246 R12: 00007ffcfc4a7890
    R13: 000000000000001c R14: 000056147d100fc0 R15: 00007f20e365c9d0
    </TASK>
    
    Fixes: d3d930411ce3 ("RDMA/mlx5: Fix implicit ODP use after free")
    Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
    Reviewed-by: Artemy Kovalyov <artemyko@nvidia.com>
    Link: https://patch.msgid.link/80f2fcd19952dfa7d9981d93fd6359b4471f8278.1739186929.git.leon@kernel.org
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/mlx5: Fix the recovery flow of the UMR QP [+ + +]
Author: Yishai Hadas <yishaih@nvidia.com>
Date:   Sun Jan 19 14:36:13 2025 +0200

    RDMA/mlx5: Fix the recovery flow of the UMR QP
    
    [ Upstream commit d97505baea64d93538b16baf14ce7b8c1fbad746 ]
    
    This patch addresses an issue in the recovery flow of the UMR QP,
    ensuring tasks do not get stuck, as highlighted by the call trace [1].
    
    During recovery, before transitioning the QP to the RESET state, the
    software must wait for all outstanding WRs to complete.
    
    Failing to do so can cause the firmware to skip sending some flushed
    CQEs with errors and simply discard them upon the RESET, as per the IB
    specification.
    
    This race condition can result in lost CQEs and tasks becoming stuck.
    
    To resolve this, the patch sends a final WR which serves only as a
    barrier before moving the QP state to RESET.
    
    Once a CQE is received for that final WR, it guarantees that no
    outstanding WRs remain, making it safe to transition the QP to RESET and
    subsequently back to RTS, restoring proper functionality.
    
    Note:
    For the barrier WR, we simply reuse the failed and ready WR.
    Since the QP is in an error state, it will only receive
    IB_WC_WR_FLUSH_ERR. However, as it serves only as a barrier we don't
    care about its status.
    
    [1]
    INFO: task rdma_resource_l:1922 blocked for more than 120 seconds.
    Tainted: G        W          6.12.0-rc7+ #1626
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    task:rdma_resource_l state:D stack:0  pid:1922 tgid:1922  ppid:1369
         flags:0x00004004
    Call Trace:
    <TASK>
    __schedule+0x420/0xd30
    schedule+0x47/0x130
    schedule_timeout+0x280/0x300
    ? mark_held_locks+0x48/0x80
    ? lockdep_hardirqs_on_prepare+0xe5/0x1a0
    wait_for_completion+0x75/0x130
    mlx5r_umr_post_send_wait+0x3c2/0x5b0 [mlx5_ib]
    ? __pfx_mlx5r_umr_done+0x10/0x10 [mlx5_ib]
    mlx5r_umr_revoke_mr+0x93/0xc0 [mlx5_ib]
    __mlx5_ib_dereg_mr+0x299/0x520 [mlx5_ib]
    ? _raw_spin_unlock_irq+0x24/0x40
    ? wait_for_completion+0xfe/0x130
    ? rdma_restrack_put+0x63/0xe0 [ib_core]
    ib_dereg_mr_user+0x5f/0x120 [ib_core]
    ? lock_release+0xc6/0x280
    destroy_hw_idr_uobject+0x1d/0x60 [ib_uverbs]
    uverbs_destroy_uobject+0x58/0x1d0 [ib_uverbs]
    uobj_destroy+0x3f/0x70 [ib_uverbs]
    ib_uverbs_cmd_verbs+0x3e4/0xbb0 [ib_uverbs]
    ? __pfx_uverbs_destroy_def_handler+0x10/0x10 [ib_uverbs]
    ? __lock_acquire+0x64e/0x2080
    ? mark_held_locks+0x48/0x80
    ? find_held_lock+0x2d/0xa0
    ? lock_acquire+0xc1/0x2f0
    ? ib_uverbs_ioctl+0xcb/0x170 [ib_uverbs]
    ? __fget_files+0xc3/0x1b0
    ib_uverbs_ioctl+0xe7/0x170 [ib_uverbs]
    ? ib_uverbs_ioctl+0xcb/0x170 [ib_uverbs]
    __x64_sys_ioctl+0x1b0/0xa70
    do_syscall_64+0x6b/0x140
    entry_SYSCALL_64_after_hwframe+0x76/0x7e
    RIP: 0033:0x7f99c918b17b
    RSP: 002b:00007ffc766d0468 EFLAGS: 00000246 ORIG_RAX:
         0000000000000010
    RAX: ffffffffffffffda RBX: 00007ffc766d0578 RCX:
         00007f99c918b17b
    RDX: 00007ffc766d0560 RSI: 00000000c0181b01 RDI:
         0000000000000003
    RBP: 00007ffc766d0540 R08: 00007f99c8f99010 R09:
         000000000000bd7e
    R10: 00007f99c94c1c70 R11: 0000000000000246 R12:
         00007ffc766d0530
    R13: 000000000000001c R14: 0000000040246a80 R15:
         0000000000000000
    </TASK>
    
    Fixes: 158e71bb69e3 ("RDMA/mlx5: Add a umr recovery flow")
    Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
    Reviewed-by: Michael Guralnik <michaelgur@nvidia.com>
    Link: https://patch.msgid.link/27b51b92ec42dfb09d8096fcbd51878f397ce6ec.1737290141.git.leon@kernel.org
    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>

 
riscv: cacheinfo: Use of_property_present() for non-boolean properties [+ + +]
Author: Rob Herring <robh@kernel.org>
Date:   Mon Nov 4 13:03:13 2024 -0600

    riscv: cacheinfo: Use of_property_present() for non-boolean properties
    
    commit fb8179ce2996bffaa36a04e2b6262843b01b7565 upstream.
    
    The use of of_property_read_bool() for non-boolean properties is
    deprecated in favor of of_property_present() when testing for property
    presence.
    
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Reviewed-by: Clément Léger <cleger@rivosinc.com>
    Cc: stable@vger.kernel.org
    Fixes: 76d2a0493a17 ("RISC-V: Init and Halt Code")
    Link: https://lore.kernel.org/r/20241104190314.270095-1-robh@kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

riscv: cpufeature: use bitmap_equal() instead of memcmp() [+ + +]
Author: Clément Léger <cleger@rivosinc.com>
Date:   Mon Feb 10 16:56:14 2025 +0100

    riscv: cpufeature: use bitmap_equal() instead of memcmp()
    
    commit c6ec1e1b078d8e2ecd075e46db6197a14930a3fc upstream.
    
    Comparison of bitmaps should be done using bitmap_equal(), not memcmp(),
    use the former one to compare isa bitmaps.
    
    Signed-off-by: Clément Léger <cleger@rivosinc.com>
    Fixes: 625034abd52a8c ("riscv: add ISA extensions validation callback")
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250210155615.1545738-1-cleger@rivosinc.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

riscv: KVM: Fix hart suspend status check [+ + +]
Author: Andrew Jones <ajones@ventanamicro.com>
Date:   Mon Feb 17 09:45:08 2025 +0100

    riscv: KVM: Fix hart suspend status check
    
    [ Upstream commit c7db342e3b4744688be1e27e31254c1d31a35274 ]
    
    "Not stopped" means started or suspended so we need to check for
    a single state in order to have a chance to check for each state.
    Also, we need to use target_vcpu when checking for the suspend
    state.
    
    Fixes: 763c8bed8c05 ("RISC-V: KVM: Implement SBI HSM suspend call")
    Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
    Reviewed-by: Anup Patel <anup@brainfault.org>
    Link: https://lore.kernel.org/r/20250217084506.18763-8-ajones@ventanamicro.com
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: KVM: Fix hart suspend_type use [+ + +]
Author: Andrew Jones <ajones@ventanamicro.com>
Date:   Mon Feb 17 09:45:09 2025 +0100

    riscv: KVM: Fix hart suspend_type use
    
    [ Upstream commit e3219b0c491f2aa0e0b200a39d3352ab05cdda96 ]
    
    The spec says suspend_type is 32 bits wide and "In case the data is
    defined as 32bit wide, higher privilege software must ensure that it
    only uses 32 bit data." Mask off upper bits of suspend_type before
    using it.
    
    Fixes: 763c8bed8c05 ("RISC-V: KVM: Implement SBI HSM suspend call")
    Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
    Reviewed-by: Anup Patel <anup@brainfault.org>
    Link: https://lore.kernel.org/r/20250217084506.18763-9-ajones@ventanamicro.com
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: KVM: Fix SBI IPI error generation [+ + +]
Author: Andrew Jones <ajones@ventanamicro.com>
Date:   Mon Feb 17 09:45:10 2025 +0100

    riscv: KVM: Fix SBI IPI error generation
    
    [ Upstream commit 0611f78f83c93c000029ab01daa28166d03590ed ]
    
    When an invalid function ID of an SBI extension is used we should
    return not-supported, not invalid-param. Also, when we see that at
    least one hartid constructed from the base and mask parameters is
    invalid, then we should return invalid-param. Finally, rather than
    relying on overflowing a left shift to result in zero and then using
    that zero in a condition which [correctly] skips sending an IPI (but
    loops unnecessarily), explicitly check for overflow and exit the loop
    immediately.
    
    Fixes: 5f862df5585c ("RISC-V: KVM: Add v0.1 replacement SBI extensions defined in v0.2")
    Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
    Reviewed-by: Anup Patel <anup@brainfault.org>
    Link: https://lore.kernel.org/r/20250217084506.18763-10-ajones@ventanamicro.com
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: KVM: Fix SBI TIME error generation [+ + +]
Author: Andrew Jones <ajones@ventanamicro.com>
Date:   Mon Feb 17 09:45:11 2025 +0100

    riscv: KVM: Fix SBI TIME error generation
    
    [ Upstream commit b901484852992cf3d162a5eab72251cc813ca624 ]
    
    When an invalid function ID of an SBI extension is used we should
    return not-supported, not invalid-param.
    
    Fixes: 5f862df5585c ("RISC-V: KVM: Add v0.1 replacement SBI extensions defined in v0.2")
    Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
    Reviewed-by: Anup Patel <anup@brainfault.org>
    Link: https://lore.kernel.org/r/20250217084506.18763-11-ajones@ventanamicro.com
    Signed-off-by: Anup Patel <anup@brainfault.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: signal: fix signal frame size [+ + +]
Author: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Date:   Fri Dec 20 16:39:23 2024 +0800

    riscv: signal: fix signal frame size
    
    commit aa49bc2ca8524186ceb0811c23a7f00c3dea6987 upstream.
    
    The signal context of certain RISC-V extensions will be appended after
    struct __riscv_extra_ext_header, which already includes an empty context
    header. Therefore, there is no need to preserve a separate hdr for the
    END of signal context.
    
    Fixes: 8ee0b41898fa ("riscv: signal: Add sigcontext save/restore for vector")
    Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
    Reviewed-by: Zong Li <zong.li@sifive.com>
    Reviewed-by: Andy Chiu <AndybnAC@gmail.com>
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241220083926.19453-2-yongxuan.wang@sifive.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

riscv: signal: fix signal_minsigstksz [+ + +]
Author: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Date:   Fri Dec 20 16:39:24 2024 +0800

    riscv: signal: fix signal_minsigstksz
    
    commit 564fc8eb6f78e01292ff10801f318feae6153fdd upstream.
    
    The init_rt_signal_env() funciton is called before the alternative patch
    is applied, so using the alternative-related API to check the availability
    of an extension within this function doesn't have the intended effect.
    This patch reorders the init_rt_signal_env() and apply_boot_alternatives()
    to get the correct signal_minsigstksz.
    
    Fixes: e92f469b0771 ("riscv: signal: Report signal frame size to userspace via auxv")
    Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
    Reviewed-by: Zong Li <zong.li@sifive.com>
    Reviewed-by: Andy Chiu <andybnac@gmail.com>
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241220083926.19453-3-yongxuan.wang@sifive.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rseq/selftests: Fix riscv rseq_offset_deref_addv inline asm [+ + +]
Author: Stafford Horne <shorne@gmail.com>
Date:   Tue Jan 14 17:07:21 2025 +0000

    rseq/selftests: Fix riscv rseq_offset_deref_addv inline asm
    
    commit 713e788c0e07e185fd44dd581f74855ef149722f upstream.
    
    When working on OpenRISC support for restartable sequences I noticed
    and fixed these two issues with the riscv support bits.
    
     1 The 'inc' argument to RSEQ_ASM_OP_R_DEREF_ADDV was being implicitly
       passed to the macro.  Fix this by adding 'inc' to the list of macro
       arguments.
     2 The inline asm input constraints for 'inc' and 'off' use "er",  The
       riscv gcc port does not have an "e" constraint, this looks to be
       copied from the x86 port.  Fix this by just using an "r" constraint.
    
    I have compile tested this only for riscv.  However, the same fixes I
    use in the OpenRISC rseq selftests and everything passes with no issues.
    
    Fixes: 171586a6ab66 ("selftests/rseq: riscv: Template memory ordering and percpu access mode")
    Signed-off-by: Stafford Horne <shorne@gmail.com>
    Tested-by: Charlie Jenkins <charlie@rivosinc.com>
    Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
    Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Acked-by: Shuah Khan <skhan@linuxfoundation.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20250114170721.3613280-1-shorne@gmail.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rxrpc: rxperf: Fix missing decoding of terminal magic cookie [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Tue Feb 18 19:22:44 2025 +0000

    rxrpc: rxperf: Fix missing decoding of terminal magic cookie
    
    [ Upstream commit c34d999ca3145d9fe858258cc3342ec493f47d2e ]
    
    The rxperf RPCs seem to have a magic cookie at the end of the request that
    was failing to be taken account of by the unmarshalling of the request.
    Fix the rxperf code to expect this.
    
    Fixes: 75bfdbf2fca3 ("rxrpc: Implement an in-kernel rxperf server for testing purposes")
    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-2-dhowells@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.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>

 
sched_ext: Fix pick_task_scx() picking non-queued tasks when it's called without balance() [+ + +]
Author: Tejun Heo <tj@kernel.org>
Date:   Tue Feb 25 06:02:23 2025 -1000

    sched_ext: Fix pick_task_scx() picking non-queued tasks when it's called without balance()
    
    commit 8fef0a3b17bb258130a4fcbcb5addf94b25e9ec5 upstream.
    
    a6250aa251ea ("sched_ext: Handle cases where pick_task_scx() is called
    without preceding balance_scx()") added a workaround to handle the cases
    where pick_task_scx() is called without prececing balance_scx() which is due
    to a fair class bug where pick_taks_fair() may return NULL after a true
    return from balance_fair().
    
    The workaround detects when pick_task_scx() is called without preceding
    balance_scx() and emulates SCX_RQ_BAL_KEEP and triggers kicking to avoid
    stalling. Unfortunately, the workaround code was testing whether @prev was
    on SCX to decide whether to keep the task running. This is incorrect as the
    task may be on SCX but no longer runnable.
    
    This could lead to a non-runnable task to be returned from pick_task_scx()
    which cause interesting confusions and failures. e.g. A common failure mode
    is the task ending up with (!on_rq && on_cpu) state which can cause
    potential wakers to busy loop, which can easily lead to deadlocks.
    
    Fix it by testing whether @prev has SCX_TASK_QUEUED set. This makes
    @prev_on_scx only used in one place. Open code the usage and improve the
    comment while at it.
    
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Reported-by: Pat Cody <patcody@meta.com>
    Fixes: a6250aa251ea ("sched_ext: Handle cases where pick_task_scx() is called without preceding balance_scx()")
    Cc: stable@vger.kernel.org # v6.12+
    Acked-by: Andrea Righi <arighi@nvidia.com>
    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: ufs: core: bsg: Fix crash when arpmb command fails [+ + +]
Author: Arthur Simchaev <arthur.simchaev@sandisk.com>
Date:   Thu Feb 20 16:20:39 2025 +0200

    scsi: ufs: core: bsg: Fix crash when arpmb command fails
    
    commit f27a95845b01e86d67c8b014b4f41bd3327daa63 upstream.
    
    If the device doesn't support arpmb we'll crash due to copying user data in
    bsg_transport_sg_io_fn().
    
    In the case where ufs_bsg_exec_advanced_rpmb_req() returns an error, do not
    set the job's reply_len.
    
    Memory crash backtrace:
    3,1290,531166405,-;ufshcd 0000:00:12.5: ARPMB OP failed: error code -22
    
    4,1308,531166555,-;Call Trace:
    
    4,1309,531166559,-; <TASK>
    
    4,1310,531166565,-; ? show_regs+0x6d/0x80
    
    4,1311,531166575,-; ? die+0x37/0xa0
    
    4,1312,531166583,-; ? do_trap+0xd4/0xf0
    
    4,1313,531166593,-; ? do_error_trap+0x71/0xb0
    
    4,1314,531166601,-; ? usercopy_abort+0x6c/0x80
    
    4,1315,531166610,-; ? exc_invalid_op+0x52/0x80
    
    4,1316,531166622,-; ? usercopy_abort+0x6c/0x80
    
    4,1317,531166630,-; ? asm_exc_invalid_op+0x1b/0x20
    
    4,1318,531166643,-; ? usercopy_abort+0x6c/0x80
    
    4,1319,531166652,-; __check_heap_object+0xe3/0x120
    
    4,1320,531166661,-; check_heap_object+0x185/0x1d0
    
    4,1321,531166670,-; __check_object_size.part.0+0x72/0x150
    
    4,1322,531166679,-; __check_object_size+0x23/0x30
    
    4,1323,531166688,-; bsg_transport_sg_io_fn+0x314/0x3b0
    
    Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg")
    Cc: stable@vger.kernel.org
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Signed-off-by: Arthur Simchaev <arthur.simchaev@sandisk.com>
    Link: https://lore.kernel.org/r/20250220142039.250992-1-arthur.simchaev@sandisk.com
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: ufs: core: Fix ufshcd_is_ufs_dev_busy() and ufshcd_eh_timed_out() [+ + +]
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Fri Feb 14 14:43:44 2025 -0800

    scsi: ufs: core: Fix ufshcd_is_ufs_dev_busy() and ufshcd_eh_timed_out()
    
    [ Upstream commit 4fa382be430421e1445f9c95c4dc9b7e0949ae8a ]
    
    ufshcd_is_ufs_dev_busy(), ufshcd_print_host_state() and
    ufshcd_eh_timed_out() are used in both modes (legacy mode and MCQ mode).
    hba->outstanding_reqs only represents the outstanding requests in legacy
    mode. Hence, change hba->outstanding_reqs into scsi_host_busy(hba->host) in
    these functions.
    
    Fixes: eacb139b77ff ("scsi: ufs: core: mcq: Enable multi-circular queue")
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://lore.kernel.org/r/20250214224352.3025151-1-bvanassche@acm.org
    Reviewed-by: Peter Wang <peter.wang@mediatek.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ufs: core: Set default runtime/system PM levels before ufshcd_hba_init() [+ + +]
Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Date:   Wed Feb 19 16:20:47 2025 +0530

    scsi: ufs: core: Set default runtime/system PM levels before ufshcd_hba_init()
    
    [ Upstream commit fe06b7c07f3fbcce2a2ca6f7b0d543b5699ea00f ]
    
    Commit bb9850704c04 ("scsi: ufs: core: Honor runtime/system PM levels if
    set by host controller drivers") introduced the check for setting default
    PM levels only if the levels are uninitialized by the host controller
    drivers. But it missed the fact that the levels could be initialized to 0
    (UFS_PM_LVL_0) on purpose by the controller drivers. Even though none of
    the drivers are doing so now, the logic should be fixed irrespectively.
    
    So set the default levels unconditionally before calling ufshcd_hba_init()
    API which initializes the controller drivers. It ensures that the
    controller drivers could override the default levels if required.
    
    Fixes: bb9850704c04 ("scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers")
    Reported-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Link: https://lore.kernel.org/r/20250219105047.49932-1-manivannan.sadhasivam@linaro.org
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/landlock: Test TCP accesses with protocol=IPPROTO_TCP [+ + +]
Author: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
Date:   Wed Feb 5 17:36:50 2025 +0800

    selftests/landlock: Test TCP accesses with protocol=IPPROTO_TCP
    
    commit f5534d511bcd273720f168386de74af76e148a9b upstream.
    
    Extend protocol_variant structure with protocol field (Cf. socket(2)).
    
    Extend protocol fixture with TCP test suits with protocol=IPPROTO_TCP
    which can be used as an alias for IPPROTO_IP (=0) in socket(2).
    
    Signed-off-by: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
    Link: https://lore.kernel.org/r/20250205093651.1424339-3-ivanov.mikhail1@huawei-partners.com
    Cc: <stable@vger.kernel.org> # 6.7.x
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests/landlock: Test that MPTCP actions are not restricted [+ + +]
Author: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
Date:   Wed Feb 5 17:36:51 2025 +0800

    selftests/landlock: Test that MPTCP actions are not restricted
    
    commit 3d4033985ff508ef587ca11f1c8361ba57c7e09f upstream.
    
    Extend protocol fixture with test suits for MPTCP protocol.
    Add CONFIG_MPTCP and CONFIG_MPTCP_IPV6 options in config.
    
    Signed-off-by: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
    Link: https://lore.kernel.org/r/20250205093651.1424339-4-ivanov.mikhail1@huawei-partners.com
    Cc: <stable@vger.kernel.org> # 6.7.x
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests: drv-net: Check if combined-count exists [+ + +]
Author: Joe Damato <jdamato@fastly.com>
Date:   Wed Feb 26 18:19:57 2025 +0000

    selftests: drv-net: Check if combined-count exists
    
    [ Upstream commit 1cbddbddee68d17feb6467fc556c144777af91ef ]
    
    Some drivers, like tg3, do not set combined-count:
    
    $ ethtool -l enp4s0f1
    Channel parameters for enp4s0f1:
    Pre-set maximums:
    RX:             4
    TX:             4
    Other:          n/a
    Combined:       n/a
    Current hardware settings:
    RX:             4
    TX:             1
    Other:          n/a
    Combined:       n/a
    
    In the case where combined-count is not set, the ethtool netlink code
    in the kernel elides the value and the code in the test:
    
      netnl.channels_get(...)
    
    With a tg3 device, the returned dictionary looks like:
    
    {'header': {'dev-index': 3, 'dev-name': 'enp4s0f1'},
     'rx-max': 4,
     'rx-count': 4,
     'tx-max': 4,
     'tx-count': 1}
    
    Note that the key 'combined-count' is missing. As a result of this
    missing key the test raises an exception:
    
     # Exception|     if channels['combined-count'] == 0:
     # Exception|        ~~~~~~~~^^^^^^^^^^^^^^^^^^
     # Exception| KeyError: 'combined-count'
    
    Change the test to check if 'combined-count' is a key in the dictionary
    first and if not assume that this means the driver has separate RX and
    TX queues.
    
    With this change, the test now passes successfully on tg3 and mlx5
    (which does have a 'combined-count').
    
    Fixes: 1cf270424218 ("net: selftest: add test for netdev netlink queue-get API")
    Signed-off-by: Joe Damato <jdamato@fastly.com>
    Reviewed-by: David Wei <dw@davidwei.uk>
    Link: https://patch.msgid.link/20250226181957.212189-1-jdamato@fastly.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
SUNRPC: Handle -ETIMEDOUT return from tlshd [+ + +]
Author: Benjamin Coddington <bcodding@redhat.com>
Date:   Tue Feb 11 12:31:57 2025 -0500

    SUNRPC: Handle -ETIMEDOUT return from tlshd
    
    [ Upstream commit 7a2f6f7687c5f7083a35317cddec5ad9fa491443 ]
    
    If the TLS handshake attempt returns -ETIMEDOUT, we currently translate
    that error into -EACCES.  This becomes problematic for cases where the RPC
    layer is attempting to re-connect in paths that don't resonably handle
    -EACCES, for example: writeback.  The RPC layer can handle -ETIMEDOUT quite
    well, however - so if the handshake returns this error let's just pass it
    along.
    
    Fixes: 75eb6af7acdf ("SUNRPC: Add a TCP-with-TLS RPC transport class")
    Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
    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: devmem: don't write truncated dmabuf CMSGs to userspace [+ + +]
Author: Stanislav Fomichev <sdf@fomichev.me>
Date:   Mon Feb 24 09:44:01 2025 -0800

    tcp: devmem: don't write truncated dmabuf CMSGs to userspace
    
    [ Upstream commit 18912c520674ec4d920fe3826e7e4fefeecdf5ae ]
    
    Currently, we report -ETOOSMALL (err) only on the first iteration
    (!sent). When we get put_cmsg error after a bunch of successful
    put_cmsg calls, we don't signal the error at all. This might be
    confusing on the userspace side which will see truncated CMSGs
    but no MSG_CTRUNC signal.
    
    Consider the following case:
    - sizeof(struct cmsghdr) = 16
    - sizeof(struct dmabuf_cmsg) = 24
    - total cmsg size (CMSG_LEN) = 40 (16+24)
    
    When calling recvmsg with msg_controllen=60, the userspace
    will receive two(!) dmabuf_cmsg(s), the first one will
    be a valid one and the second one will be silently truncated. There is no
    easy way to discover the truncation besides doing something like
    "cm->cmsg_len != CMSG_LEN(sizeof(dmabuf_cmsg))".
    
    Introduce new put_devmem_cmsg wrapper that reports an error instead
    of doing the truncation. Mina suggests that it's the intended way
    this API should work.
    
    Note that we might now report MSG_CTRUNC when the users (incorrectly)
    call us with msg_control == NULL.
    
    Fixes: 8f0b3cc9a4c1 ("tcp: RX path for devmem TCP")
    Reviewed-by: Mina Almasry <almasrymina@google.com>
    Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250224174401.3582695-1-sdf@fomichev.me
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
thermal/of: Fix cdev lookup in thermal_of_should_bind() [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri Feb 21 17:57:11 2025 +0100

    thermal/of: Fix cdev lookup in thermal_of_should_bind()
    
    [ Upstream commit 423de5b5bc5b267586b449abd1c4fde562aa0cf9 ]
    
    Since thermal_of_should_bind() terminates the loop after processing
    the first child found in cooling-maps, it will never match more than
    one cdev to a given trip point which is incorrect, as there may be
    cooling-maps associating one trip point with multiple cooling devices.
    
    Address this by letting the loop continue until either all
    children have been processed or a matching one has been found.
    
    To avoid adding conditionals or goto statements, put the loop in
    question into a separate function and make that function return
    right away after finding a matching cooling-maps entry.
    
    Fixes: 94c6110b0b13 ("thermal/of: Use the .should_bind() thermal zone callback")
    Link: https://lore.kernel.org/linux-pm/20250219-fix-thermal-of-v1-1-de36e7a590c4@chromium.org/
    Reported-by: Yu-Che Cheng <giver@chromium.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: Yu-Che Cheng <giver@chromium.org>
    Tested-by: Yu-Che Cheng <giver@chromium.org>
    Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
    Tested-by: Lukasz Luba <lukasz.luba@arm.com>
    Link: https://patch.msgid.link/2788228.mvXUDI8C0e@rjwysocki.net
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
thermal: core: Move lists of thermal instances to trip descriptors [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri Oct 4 21:39:19 2024 +0200

    thermal: core: Move lists of thermal instances to trip descriptors
    
    [ Upstream commit 0dc23567c20639049ad57fd8cc2165ee9f493ab6 ]
    
    In almost all places where a thermal zone's list of thermal instances
    is walked, there is a check to match a specific trip point and it is
    walked in vain whenever there are no cooling devices associated with
    the given trip.
    
    To address this, store the lists of thermal instances in trip point
    descriptors instead of storing them in thermal zones and adjust all
    code using those lists accordingly.
    
    No intentional functional impact.
    
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://patch.msgid.link/5522726.Sb9uPGUboI@rjwysocki.net
    Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
    Stable-dep-of: 0cde378a10c1 ("thermal: gov_power_allocator: Update total_weight on bind and cdev updates")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

thermal: gov_power_allocator: Add missing NULL pointer check [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Mon Nov 25 12:24:46 2024 +0100

    thermal: gov_power_allocator: Add missing NULL pointer check
    
    commit ac1f43c03fc91eee53cc95683245350d4d87781e upstream.
    
    Commit 0dc23567c206 ("thermal: core: Move lists of thermal instances
    to trip descriptors") overlooked the case in which the Power Allocator
    governor attempts to bind to a tripless thermal zone and params->trip_max
    is NULL in check_power_actors().
    
    No power actors can be found in that case, so check_power_actors() needs
    to be made return 0 then to restore its previous behavior.
    
    Fixes: 0dc23567c206 ("thermal: core: Move lists of thermal instances to trip descriptors")
    Closes: https://lore.kernel.org/linux-pm/Z0NeGF4ryCe_b5rr@sashalap/
    Reported-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
    Link: https://patch.msgid.link/2761105.mvXUDI8C0e@rjwysocki.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thermal: gov_power_allocator: Fix incorrect calculation in divvy_up_power() [+ + +]
Author: Yu-Che Cheng <giver@chromium.org>
Date:   Wed Feb 19 15:07:48 2025 +0800

    thermal: gov_power_allocator: Fix incorrect calculation in divvy_up_power()
    
    [ Upstream commit 4ecaa75771a75f2b78a431bf67dea165d19d72a6 ]
    
    divvy_up_power() should use weighted_req_power instead of req_power to
    calculate granted_power. Otherwise, granted_power may be unexpected as
    the denominator total_req_power is a weighted sum.
    
    This is a mistake made during the previous refactor.
    
    Replace req_power with weighted_req_power in divvy_up_power()
    calculation.
    
    Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
    Signed-off-by: Yu-Che Cheng <giver@chromium.org>
    Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
    Link: https://patch.msgid.link/20250219-fix-power-allocator-calc-v1-1-48b860291919@chromium.org
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

thermal: gov_power_allocator: Update total_weight on bind and cdev updates [+ + +]
Author: Yu-Che Cheng <giver@chromium.org>
Date:   Sat Feb 22 11:20:34 2025 +0800

    thermal: gov_power_allocator: Update total_weight on bind and cdev updates
    
    [ Upstream commit 0cde378a10c1cbfaa8dd2b89672d42f36c2809c3 ]
    
    params->total_weight is not initialized during bind and not updated when
    the bound cdev changes. The cooling device weight will not be used due
    to the uninitialized total_weight, until an update via sysfs is
    triggered.
    
    The bound cdevs are updated during thermal zone registration, where each
    cooling device will be bound to the thermal zone one by one, but
    power_allocator_bind() can be called without an additional cdev update
    when manually changing the policy of a thermal zone via sysfs.
    
    Add a new function to handle weight update logic, including updating
    total_weight, and call it when bind, weight changes, and cdev updates to
    ensure total_weight is always correct.
    
    Fixes: a3cd6db4cc2e ("thermal: gov_power_allocator: Support new update callback of weights")
    Signed-off-by: Yu-Che Cheng <giver@chromium.org>
    Link: https://patch.msgid.link/20250222-fix-power-allocator-weight-v2-1-a94de86b685a@chromium.org
    [ rjw: Changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

thermal: of: Simplify thermal_of_should_bind with scoped for each OF child [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Thu Oct 10 20:06:17 2024 +0200

    thermal: of: Simplify thermal_of_should_bind with scoped for each OF child
    
    [ Upstream commit 69f3aa6ad92447d6e9f50c5b5aea85b56e80b198 ]
    
    Use scoped for_each_child_of_node_scoped() when iterating over device
    nodes to make code a bit simpler.
    
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://patch.msgid.link/20241010-b4-cleanup-h-of-node-put-thermal-v4-1-bfbe29ad81f4@linaro.org
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Stable-dep-of: 423de5b5bc5b ("thermal/of: Fix cdev lookup in thermal_of_should_bind()")
    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>

 
unreachable: Unify [+ + +]
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Thu Nov 28 10:39:01 2024 +0100

    unreachable: Unify
    
    [ Upstream commit c837de3810982cd41cd70e5170da1931439f025c ]
    
    Since barrier_before_unreachable() is empty for !GCC it is trivial to
    unify the two definitions. Less is more.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Link: https://lore.kernel.org/r/20241128094311.924381359@infradead.org
    Stable-dep-of: 73cfc53cc3b6 ("objtool: Fix C jump table annotations for Clang")
    Signed-off-by: Sasha Levin <sashal@kernel.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>

 
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: 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>

 
x86/microcode/AMD: Add get_patch_level() [+ + +]
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Thu Jan 23 13:02:32 2025 +0100

    x86/microcode/AMD: Add get_patch_level()
    
    commit 037e81fb9d2dfe7b31fd97e5f578854e38f09887 upstream.
    
    Put the MSR_AMD64_PATCH_LEVEL reading of the current microcode revision
    the hw has, into a separate function.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20250211163648.30531-6-bp@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/microcode/AMD: Get rid of the _load_microcode_amd() forward declaration [+ + +]
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Thu Jan 23 12:51:37 2025 +0100

    x86/microcode/AMD: Get rid of the _load_microcode_amd() forward declaration
    
    commit b39c387164879eef71886fc93cee5ca7dd7bf500 upstream.
    
    Simply move save_microcode_in_initrd() down.
    
    No functional changes.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20250211163648.30531-5-bp@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/microcode/AMD: Have __apply_microcode_amd() return bool [+ + +]
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Mon Nov 18 17:17:24 2024 +0100

    x86/microcode/AMD: Have __apply_microcode_amd() return bool
    
    commit 78e0aadbd4c6807a06a9d25bc190fe515d3f3c42 upstream
    
    This is the natural thing to do anyway.
    
    No functional changes.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/microcode/AMD: Load only SHA256-checksummed patches [+ + +]
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Thu Jan 23 14:44:53 2025 +0100

    x86/microcode/AMD: Load only SHA256-checksummed patches
    
    commit 50cef76d5cb0e199cda19f026842560f6eedc4f7 upstream.
    
    Load patches for which the driver carries a SHA256 checksum of the patch
    blob.
    
    This can be disabled by adding "microcode.amd_sha_check=off" on the
    kernel cmdline. But it is highly NOT recommended.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/microcode/AMD: Merge early_apply_microcode() into its single callsite [+ + +]
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Thu Jan 23 12:46:45 2025 +0100

    x86/microcode/AMD: Merge early_apply_microcode() into its single callsite
    
    commit dc15675074dcfd79a2f10a6e39f96b0244961a01 upstream.
    
    No functional changes.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20250211163648.30531-4-bp@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/microcode/AMD: Remove ugly linebreak in __verify_patch_section() signature [+ + +]
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Thu Jan 23 13:14:34 2025 +0100

    x86/microcode/AMD: Remove ugly linebreak in __verify_patch_section() signature
    
    commit 7103f0589ac220eac3d2b1e8411494b31b883d06 upstream.
    
    No functional changes.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20250211163648.30531-2-bp@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/microcode/AMD: Remove unused save_microcode_in_initrd_amd() declarations [+ + +]
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Thu Jan 23 12:23:47 2025 +0100

    x86/microcode/AMD: Remove unused save_microcode_in_initrd_amd() declarations
    
    commit 3ef0740d10b005a45e8ae5b4b7b5d37bfddf63c0 upstream.
    
    Commit
    
      a7939f016720 ("x86/microcode/amd: Cache builtin/initrd microcode early")
    
    renamed it to save_microcode_in_initrd() and made it static. Zap the
    forgotten declarations.
    
    No functional changes.
    
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20250211163648.30531-3-bp@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

x86/microcode/AMD: Return bool from find_blobs_in_containers() [+ + +]
Author: Nikolay Borisov <nik.borisov@suse.com>
Date:   Fri Oct 18 18:51:49 2024 +0300

    x86/microcode/AMD: Return bool from find_blobs_in_containers()
    
    commit a85c08aaa665b5436d325f6d7138732a0e1315ce upstream.
    
    Instead of open-coding the check for size/data move it inside the
    function and make it return a boolean indicating whether data was found
    or not.
    
    No functional changes.
    
      [ bp: Write @ret in find_blobs_in_containers() only on success. ]
    
    Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20241018155151.702350-2-nik.borisov@suse.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>