commit bd3a9e5771a8b332f466d06f7c130a69cab0d526
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Nov 28 17:20:18 2023 +0000

    Linux 6.6.3
    
    Link: https://lore.kernel.org/r/20231124172028.107505484@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Nam Cao <namcao@linutronix.de>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Link: https://lore.kernel.org/r/20231125163158.249616313@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: SeongJae Park <sj@kernel.org>
    Link: https://lore.kernel.org/r/20231125194417.090791215@linuxfoundation.org
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Link: https://lore.kernel.org/r/20231126154418.032283745@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Ricardo B. Marliere <ricardo@marliere.net>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Nam Cao <namcao@linutronix.de>
    Tested-by: Allen Pais <apais@linux.microsoft.com>
    Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Tested-by: Rudi Heitbaum <rudi@heitbaum.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 17661e606e6d643e2e39af9470064c3d50da9834
Author: Lewis Huang <lewis.huang@amd.com>
Date:   Thu Oct 19 17:22:21 2023 +0800

    drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox
    
    commit 5911d02cac70d7fb52009fbd37423e63f8f6f9bc upstream.
    
    [WHY]
    Flush command sent to DMCUB spends more time for execution on
    a dGPU than on an APU. This causes cursor lag when using high
    refresh rate mouses.
    
    [HOW]
    1. Change the DMCUB mailbox memory location from FB to inbox.
    2. Only change windows memory to inbox.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Lewis Huang <lewis.huang@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a4a131bdd9cf37c76388276835a1c31d3e1dc240
Author: Paul Hsieh <paul.hsieh@amd.com>
Date:   Wed Oct 25 10:53:35 2023 +0800

    drm/amd/display: Clear dpcd_sink_ext_caps if not set
    
    commit 923bbfe6c888812db1088d684bd30c24036226d2 upstream.
    
    [WHY]
    Some eDP panels' ext caps don't set initial values
    and the value of dpcd_addr (0x317) is random.
    It means that sometimes the eDP can be OLED, miniLED and etc,
    and cause incorrect backlight control interface.
    
    [HOW]
    Add remove_sink_ext_caps to remove sink ext caps (HDR, OLED and etc)
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Anthony Koo <anthony.koo@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Paul Hsieh <paul.hsieh@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9a5ae53e0f46ab17176ae8c50de3318be10c00b6
Author: Tianci Yin <tianci.yin@amd.com>
Date:   Wed Nov 1 09:47:13 2023 +0800

    drm/amd/display: Enable fast plane updates on DCN3.2 and above
    
    commit 435f5b369657cffee4b04db1f5805b48599f4dbe upstream.
    
    [WHY]
    When cursor moves across screen boarder, lag cursor observed,
    since subvp settings need to sync up with vblank that causes
    cursor updates being delayed.
    
    [HOW]
    Enable fast plane updates on DCN3.2 to fix it.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Tianci Yin <tianci.yin@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1d07b7e84276777dad3c8cfebdf8e739606f90c9
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Wed Nov 8 13:31:57 2023 -0600

    drm/amd/display: fix a NULL pointer dereference in amdgpu_dm_i2c_xfer()
    
    commit b71f4ade1b8900d30c661d6c27f87c35214c398c upstream.
    
    When ddc_service_construct() is called, it explicitly checks both the
    link type and whether there is something on the link which will
    dictate whether the pin is marked as hw_supported.
    
    If the pin isn't set or the link is not set (such as from
    unloading/reloading amdgpu in an IGT test) then fail the
    amdgpu_dm_i2c_xfer() call.
    
    Cc: stable@vger.kernel.org
    Fixes: 22676bc500c2 ("drm/amd/display: Fix dmub soft hang for PSR 1")
    Link: https://github.com/fwupd/fwupd/issues/6327
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6c888a71d8d4358298305e3578b1664920af7168
Author: Fangzhi Zuo <jerry.zuo@amd.com>
Date:   Mon Oct 23 13:57:32 2023 -0400

    drm/amd/display: Fix DSC not Enabled on Direct MST Sink
    
    commit a58555359a9f870543aaddef277c3396159895ce upstream.
    
    [WHY & HOW]
    For the scenario when a dsc capable MST sink device is directly
    connected, it needs to use max dsc compression as the link bw constraint.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Roman Li <roman.li@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5a4d4bf6e3549a2b537c6cfe4a4e90468ad97367
Author: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Date:   Wed Sep 13 16:18:44 2023 -0400

    drm/amd/display: Guard against invalid RPTR/WPTR being set
    
    commit 1ffa8602e39b89469dc703ebab7a7e44c33da0f7 upstream.
    
    [WHY]
    HW can return invalid values on register read, guard against these being
    set and causing us to access memory out of range and page fault.
    
    [HOW]
    Guard at sync_inbox1 and guard at pushing commands.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Hansen Dsouza <hansen.dsouza@amd.com>
    Acked-by: Alex Hung <alex.hung@amd.com>
    Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5e4d9fda7e65cd267900f7d2c7c1579a98bf413c
Author: Felix Kuehling <Felix.Kuehling@amd.com>
Date:   Tue Oct 31 13:30:00 2023 -0400

    drm/amdgpu: Fix possible null pointer dereference
    
    commit 256503071c2de2b5b5c20e06654aa9a44f13aa62 upstream.
    
    mem = bo->tbo.resource may be NULL in amdgpu_vm_bo_update.
    
    Fixes: 180253782038 ("drm/ttm: stop allocating dummy resources during BO creation")
    Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c0707623d46021262e68e6aa9e2111ba84593412
Author: Christian König <christian.koenig@amd.com>
Date:   Thu Nov 9 10:14:14 2023 +0100

    drm/amdgpu: lower CS errors to debug severity
    
    commit 17daf01ab4e3e5a5929747aa05cc15eb2bad5438 upstream.
    
    Otherwise userspace can spam the logs by using incorrect input values.
    
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit df9142a336767a570002f81d89599aafd2afcb77
Author: Christian König <christian.koenig@amd.com>
Date:   Thu Nov 9 10:12:39 2023 +0100

    drm/amdgpu: fix error handling in amdgpu_bo_list_get()
    
    commit 12f76050d8d4d10dab96333656b821bd4620d103 upstream.
    
    We should not leak the pointer where we couldn't grab the reference
    on to the caller because it can be that the error handling still
    tries to put the reference then.
    
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5e94f18d5e93bd7c352e6bb7c04fbe3c4f44a6d6
Author: Christian König <christian.koenig@amd.com>
Date:   Tue Oct 31 15:35:27 2023 +0100

    drm/amdgpu: fix error handling in amdgpu_vm_init
    
    commit 8473bfdcb5b1a32fd05629c4535ccacd73bc5567 upstream.
    
    When clearing the root PD fails we need to properly release it again.
    
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b4d34b72bf5381e6e3dc42431c0a508168f67b0b
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Tue Oct 17 15:40:01 2023 -0400

    drm/amdgpu: don't use ATRM for external devices
    
    commit 432e664e7c98c243fab4c3c95bd463bea3aeed28 upstream.
    
    The ATRM ACPI method is for fetching the dGPU vbios rom
    image on laptops and all-in-one systems.  It should not be
    used for external add in cards.  If the dGPU is thunderbolt
    connected, don't try ATRM.
    
    v2: pci_is_thunderbolt_attached only works for Intel.  Use
        pdev->external_facing instead.
    v3: dev_is_removable() seems to be what we want
    
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e9b8533d571746d6f4e171b13c1b46e5de2cd12b
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Thu Oct 19 13:56:56 2023 -0400

    drm/amdgpu: add a retry for IP discovery init
    
    commit 3938eb956e383ef88b8fc7d556492336ebee52df upstream.
    
    AMD dGPUs have integrated FW that runs as soon as the
    device gets power and initializes the board (determines
    the amount of memory, provides configuration details to
    the driver, etc.).  For direct PCIe attached cards this
    happens as soon as power is applied and normally completes
    well before the OS has even started loading.  However, with
    hotpluggable ports like USB4, the driver needs to wait for
    this to complete before initializing the device.
    
    This normally takes 60-100ms, but could take longer on
    some older boards periodically due to memory training.
    
    Retry for up to a second.  In the non-hotplug case, there
    should be no change in behavior and this should complete
    on the first try.
    
    v2: adjust test criteria
    v3: adjust checks for the masks, only enable on removable devices
    v4: skip bif_fb_en check
    
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 553d26837568814821a78295a9d7ff3247d0df92
Author: Tim Huang <Tim.Huang@amd.com>
Date:   Wed Nov 1 14:22:04 2023 +0800

    drm/amdgpu: fix GRBM read timeout when do mes_self_test
    
    commit 36e7ff5c13cb15cb7b06c76d42bb76cbf6b7ea75 upstream.
    
    Use a proper MEID to make sure the CP_HQD_* and CP_GFX_HQD_* registers
    can be touched when initialize the compute and gfx mqd in mes_self_test.
    Otherwise, we expect no response from CP and an GRBM eventual timeout.
    
    Signed-off-by: Tim Huang <Tim.Huang@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 32121a75b4d3f53445ad22a6eabc408be71c62b3
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Tue Oct 17 16:30:00 2023 -0400

    drm/amdgpu: don't use pci_is_thunderbolt_attached()
    
    commit 7b1c6263eaf4fd64ffe1cafdc504a42ee4bfbb33 upstream.
    
    It's only valid on Intel systems with the Intel VSEC.
    Use dev_is_removable() instead.  This should do the right
    thing regardless of the platform.
    
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0b7582054e906a7b060a0086c9e4bd1491a27d43
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Wed Nov 1 15:48:14 2023 -0400

    drm/amdgpu/smu13: drop compute workload workaround
    
    commit 23170863ea0a0965d224342c0eb2ad8303b1f267 upstream.
    
    This was fixed in PMFW before launch and is no longer
    required.
    
    Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org # 6.1.x
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e00915dbfe245f993686be8367fb3c0bfc0ae455
Author: Ma Jun <Jun.Ma2@amd.com>
Date:   Tue Oct 31 11:11:04 2023 +0800

    drm/amd/pm: Fix error of MACO flag setting code
    
    commit 7f3e6b840fa8b0889d776639310a5dc672c1e9e1 upstream.
    
    MACO only works if BACO is supported
    
    Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
    Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org # 6.1.x
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4a6bb69835864a8c9003feb2a4ef48acdd321436
Author: Nirmoy Das <nirmoy.das@intel.com>
Date:   Wed Oct 18 11:38:15 2023 +0200

    drm/i915: Flush WC GGTT only on required platforms
    
    commit 7d7a328d0e8d6edefb7b0d665185d468667588d0 upstream.
    
    gen8_ggtt_invalidate() is only needed for limited set of platforms
    where GGTT is mapped as WC. This was added as way to fix WC based GGTT in
    commit 0f9b91c754b7 ("drm/i915: flush system agent TLBs on SNB") and
    there are no reference in HW docs that forces us to use this on non-WC
    backed GGTT.
    
    This can also cause unwanted side-effects on XE_HP platforms where
    GFX_FLSH_CNTL_GEN6 is not valid anymore.
    
    v2: Add a func to detect wc ggtt detection (Ville)
    v3: Improve commit log and add reference commit (Daniel)
    
    Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
    Cc: John Harrison <john.c.harrison@intel.com>
    Cc: Andi Shyti <andi.shyti@linux.intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: <stable@vger.kernel.org> # v6.2+
    Suggested-by: Matt Roper <matthew.d.roper@intel.com>
    Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
    Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
    Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231018093815.1349-1-nirmoy.das@intel.com
    (cherry picked from commit 81de3e296b10a13e5c9f13172825b0d8d9495c68)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 269303d2d5e5ea24135d9da61e60efd01709e806
Author: Kunwu Chan <chentao@kylinos.cn>
Date:   Fri Nov 3 11:09:22 2023 +0000

    drm/i915: Fix potential spectre vulnerability
    
    commit 1a8e9bad6ef563c28ab0f8619628d5511be55431 upstream.
    
    Fix smatch warning:
    drivers/gpu/drm/i915/gem/i915_gem_context.c:847 set_proto_ctx_sseu()
    warn: potential spectre issue 'pc->user_engines' [r] (local cap)
    
    Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
    Cc: <stable@vger.kernel.org> # v5.15+
    Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
    Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231103110922.430122-1-tvrtko.ursulin@linux.intel.com
    (cherry picked from commit 27b086382c22efb7e0a16442f7bdc2e120108ef3)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8722d668845303969d45d81f1fd61e9e2f277401
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Tue Oct 31 18:08:00 2023 +0200

    drm/i915: Bump GLK CDCLK frequency when driving multiple pipes
    
    commit 0cb89cd42fd22bbdec0b046c48f35775f5b88bdb upstream.
    
    On GLK CDCLK frequency needs to be at least 2*96 MHz when accessing
    the audio hardware. Currently we bump the CDCLK frequency up
    temporarily (if not high enough already) whenever audio hardware
    is being accessed, and drop it back down afterwards.
    
    With a single active pipe this works just fine as we can switch
    between all the valid CDCLK frequencies by changing the cd2x
    divider, which doesn't require a full modeset. However with
    multiple active pipes the cd2x divider trick no longer works,
    and thus we end up blinking all displays off and back on.
    
    To avoid this let's just bump the CDCLK frequency to >=2*96MHz
    whenever multiple pipes are active. The downside is slightly
    higher power consumption, but that seems like an acceptable
    tradeoff. With a single active pipe we can stick to the current
    more optiomal (from power comsumption POV) behaviour.
    
    Cc: stable@vger.kernel.org
    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/9599
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231031160800.18371-1-ville.syrjala@linux.intel.com
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    (cherry picked from commit 451eaa1a614c911f5a51078dcb68022874e4cb12)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 76c32b807cc5d9f098d1e943128642a320b23c98
Author: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Date:   Wed Oct 18 17:06:22 2023 +0530

    drm/i915/mtl: Support HBR3 rate with C10 phy and eDP in MTL
    
    commit ce4941c2d6459664761c9854701015d8e99414fb upstream.
    
    eDP specification supports HBR3 link rate since v1.4a. Moreover,
    C10 phy can support HBR3 link rate for both DP and eDP. Therefore,
    do not clamp the supported rates for eDP at 6.75Gbps.
    
    Cc: <stable@vger.kernel.org>
    
    BSpec: 70073 74224
    
    Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
    Reviewed-by: Mika Kahola <mika.kahola@intel.com>
    Signed-off-by: Mika Kahola <mika.kahola@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231018113622.2761997-1-chaitanya.kumar.borah@intel.com
    (cherry picked from commit a3431650f30a94b179d419ef87c21213655c28cd)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 17117871bf0d6792f7aacec0f57cdc63fc01042a
Author: Gabe Teeger <gabe.teeger@amd.com>
Date:   Fri Sep 15 18:18:48 2023 -0400

    drm/amd/display: Add Null check for DPP resource
    
    commit e186400685d8a9287388a8535e2399bc673bfe95 upstream.
    
    [what and why]
    Check whether dpp resource pointer is null in advance and return early
    if so.
    
    Reviewed-by: Charlene Liu <charlene.liu@amd.com>
    Reviewed-by: Martin Leung <martin.leung@amd.com>
    Signed-off-by: Gabe Teeger <gabe.teeger@amd.com>
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b4166941c03dc0b8b958ff3f295ad6e67f967a3d
Author: Josh Poimboeuf <jpoimboe@kernel.org>
Date:   Mon Sep 4 22:04:59 2023 -0700

    x86/srso: Move retbleed IBPB check into existing 'has_microcode' code block
    
    commit 351236947a45a512c517153bbe109fe868d05e6d upstream.
    
    Simplify the code flow a bit by moving the retbleed IBPB check into the
    existing 'has_microcode' block.
    
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/0a22b86b1f6b07f9046a9ab763fc0e0d1b7a91d4.1693889988.git.jpoimboe@kernel.org
    Cc: Caleb Jorden <cjorden@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 154438369cbd93b00a852c94103c7a342ffd3256
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Thu Sep 14 16:11:59 2023 +0300

    drm: bridge: it66121: ->get_edid callback must not return err pointers
    
    commit 81995ee1620318b4c7bbeb02bcc372da2c078c76 upstream.
    
    The drm stack does not expect error valued pointers for EDID anywhere.
    
    Fixes: e66856508746 ("drm: bridge: it66121: Set DDC preamble only once before reading EDID")
    Cc: Paul Cercueil <paul@crapouillou.net>
    Cc: Robert Foss <robert.foss@linaro.org>
    Cc: Phong LE <ple@baylibre.com>
    Cc: Neil Armstrong <neil.armstrong@linaro.org>
    Cc: Andrzej Hajda <andrzej.hajda@intel.com>
    Cc: Robert Foss <rfoss@kernel.org>
    Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
    Cc: Jonas Karlman <jonas@kwiboo.se>
    Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
    Cc: <stable@vger.kernel.org> # v6.3+
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230914131159.2472513-1-jani.nikula@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f3f1c94dfdadcbeab4cb70636ad288153425ad76
Author: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Date:   Tue Oct 17 16:01:35 2023 +0200

    drm/amd/pm: Handle non-terminated overdrive commands.
    
    commit 08e9ebc75b5bcfec9d226f9e16bab2ab7b25a39a upstream.
    
    The incoming strings might not be terminated by a newline
    or a 0.
    
    (found while testing a program that just wrote the string
     itself, causing a crash)
    
    Cc: stable@vger.kernel.org
    Fixes: e3933f26b657 ("drm/amd/pp: Add edit/commit/show OD clock/voltage support in sysfs")
    Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7343c23ebcadbedc23a7063d1e24d976eccb0d0d
Author: Brian Foster <bfoster@redhat.com>
Date:   Mon Oct 2 14:50:20 2023 -0400

    ext4: fix racy may inline data check in dio write
    
    commit ce56d21355cd6f6937aca32f1f44ca749d1e4808 upstream.
    
    syzbot reports that the following warning from ext4_iomap_begin()
    triggers as of the commit referenced below:
    
            if (WARN_ON_ONCE(ext4_has_inline_data(inode)))
                    return -ERANGE;
    
    This occurs during a dio write, which is never expected to encounter
    an inode with inline data. To enforce this behavior,
    ext4_dio_write_iter() checks the current inline state of the inode
    and clears the MAY_INLINE_DATA state flag to either fall back to
    buffered writes, or enforce that any other writers in progress on
    the inode are not allowed to create inline data.
    
    The problem is that the check for existing inline data and the state
    flag can span a lock cycle. For example, if the ilock is originally
    locked shared and subsequently upgraded to exclusive, another writer
    may have reacquired the lock and created inline data before the dio
    write task acquires the lock and proceeds.
    
    The commit referenced below loosens the lock requirements to allow
    some forms of unaligned dio writes to occur under shared lock, but
    AFAICT the inline data check was technically already racy for any
    dio write that would have involved a lock cycle. Regardless, lift
    clearing of the state bit to the same lock critical section that
    checks for preexisting inline data on the inode to close the race.
    
    Cc: stable@kernel.org
    Reported-by: syzbot+307da6ca5cb0d01d581a@syzkaller.appspotmail.com
    Fixes: 310ee0902b8d ("ext4: allow concurrent unaligned dio overwrites")
    Signed-off-by: Brian Foster <bfoster@redhat.com>
    Link: https://lore.kernel.org/r/20231002185020.531537-1-bfoster@redhat.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3eb32071b57853067fbf3294ecc47062492703b3
Author: Jan Kara <jack@suse.cz>
Date:   Fri Oct 13 14:13:50 2023 +0200

    ext4: properly sync file size update after O_SYNC direct IO
    
    commit 91562895f8030cb9a0470b1db49de79346a69f91 upstream.
    
    Gao Xiang has reported that on ext4 O_SYNC direct IO does not properly
    sync file size update and thus if we crash at unfortunate moment, the
    file can have smaller size although O_SYNC IO has reported successful
    completion. The problem happens because update of on-disk inode size is
    handled in ext4_dio_write_iter() *after* iomap_dio_rw() (and thus
    dio_complete() in particular) has returned and generic_file_sync() gets
    called by dio_complete(). Fix the problem by handling on-disk inode size
    update directly in our ->end_io completion handler.
    
    References: https://lore.kernel.org/all/02d18236-26ef-09b0-90ad-030c4fe3ee20@linux.alibaba.com
    Reported-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    CC: stable@vger.kernel.org
    Fixes: 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure")
    Signed-off-by: Jan Kara <jack@suse.cz>
    Tested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
    Link: https://lore.kernel.org/r/20231013121350.26872-1-jack@suse.cz
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a657b36c1a0ca05996c77cbdcd0e44e2f0dceb1
Author: Kemeng Shi <shikemeng@huaweicloud.com>
Date:   Sun Aug 27 01:47:01 2023 +0800

    ext4: add missed brelse in update_backups
    
    commit 9adac8b01f4be28acd5838aade42b8daa4f0b642 upstream.
    
    add missed brelse in update_backups
    
    Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
    Reviewed-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230826174712.4059355-3-shikemeng@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b88c91b28706d6881048d3bd52acf2251bedb49a
Author: Kemeng Shi <shikemeng@huaweicloud.com>
Date:   Sun Aug 27 01:47:03 2023 +0800

    ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks
    
    commit 40dd7953f4d606c280074f10d23046b6812708ce upstream.
    
    Wrong check of gdb backup in meta bg as following:
    first_group is the first group of meta_bg which contains target group, so
    target group is always >= first_group. We check if target group has gdb
    backup by comparing first_group with [group + 1] and [group +
    EXT4_DESC_PER_BLOCK(sb) - 1]. As group >= first_group, then [group + N] is
    > first_group. So no copy of gdb backup in meta bg is done in
    setup_new_flex_group_blocks.
    
    No need to do gdb backup copy in meta bg from setup_new_flex_group_blocks
    as we always copy updated gdb block to backups at end of
    ext4_flex_group_add as following:
    
    ext4_flex_group_add
      /* no gdb backup copy for meta bg any more */
      setup_new_flex_group_blocks
    
      /* update current group number */
      ext4_update_super
        sbi->s_groups_count += flex_gd->count;
    
      /*
       * if group in meta bg contains backup is added, the primary gdb block
       * of the meta bg will be copy to backup in new added group here.
       */
      for (; gdb_num <= gdb_num_end; gdb_num++)
        update_backups(...)
    
    In summary, we can remove wrong gdb backup copy code in
    setup_new_flex_group_blocks.
    
    Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
    Reviewed-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230826174712.4059355-5-shikemeng@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afe944f1f176e7059ce1a5ffe3f4d46ead6b3b87
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Thu Aug 24 17:26:04 2023 +0800

    ext4: correct the start block of counting reserved clusters
    
    commit 40ea98396a3659062267d1fe5f99af4f7e4f05e3 upstream.
    
    When big allocate feature is enabled, we need to count and update
    reserved clusters before removing a delayed only extent_status entry.
    {init|count|get}_rsvd() have already done this, but the start block
    number of this counting isn't correct in the following case.
    
      lblk            end
       |               |
       v               v
              -------------------------
              |                       | orig_es
              -------------------------
                       ^              ^
          len1 is 0    |     len2     |
    
    If the start block of the orig_es entry founded is bigger than lblk, we
    passed lblk as start block to count_rsvd(), but the length is correct,
    finally, the range to be counted is offset. This patch fix this by
    passing the start blocks to 'orig_es->lblk + len1'.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/r/20230824092619.1327976-2-yi.zhang@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 409e2d00c21fb73f2312cf64df6158400ec963dc
Author: Kemeng Shi <shikemeng@huaweicloud.com>
Date:   Sun Aug 27 01:47:02 2023 +0800

    ext4: correct return value of ext4_convert_meta_bg
    
    commit 48f1551592c54f7d8e2befc72a99ff4e47f7dca0 upstream.
    
    Avoid to ignore error in "err".
    
    Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
    Link: https://lore.kernel.org/r/20230826174712.4059355-4-shikemeng@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c26e3adc65babf681c10c109a68bc437e2eec51f
Author: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Date:   Mon Sep 18 16:15:50 2023 +0530

    ext4: mark buffer new if it is unwritten to avoid stale data exposure
    
    commit 2cd8bdb5efc1e0d5b11a4b7ba6b922fd2736a87f upstream.
    
    ** Short Version **
    
    In ext4 with dioread_nolock, we could have a scenario where the bh returned by
    get_blocks (ext4_get_block_unwritten()) in __block_write_begin_int() has
    UNWRITTEN and MAPPED flag set. Since such a bh does not have NEW flag set we
    never zero out the range of bh that is not under write, causing whatever stale
    data is present in the folio at that time to be written out to disk. To fix this
    mark the buffer as new, in case it is unwritten, in ext4_get_block_unwritten().
    
    ** Long Version **
    
    The issue mentioned above was resulting in two different bugs:
    
    1. On block size < page size case in ext4, generic/269 was reliably
    failing with dioread_nolock. The state of the write was as follows:
    
      * The write was extending i_size.
      * The last block of the file was fallocated and had an unwritten extent
      * We were near ENOSPC and hence we were switching to non-delayed alloc
        allocation.
    
    In this case, the back trace that triggers the bug is as follows:
    
      ext4_da_write_begin()
        /* switch to nodelalloc due to low space */
        ext4_write_begin()
          ext4_should_dioread_nolock() // true since mount flags still have delalloc
          __block_write_begin(..., ext4_get_block_unwritten)
            __block_write_begin_int()
              for(each buffer head in page) {
                /* first iteration, this is bh1 which contains i_size */
                if (!buffer_mapped)
                  get_block() /* returns bh with only UNWRITTEN and MAPPED */
                /* second iteration, bh2 */
                  if (!buffer_mapped)
                    get_block() /* we fail here, could be ENOSPC */
              }
              if (err)
                /*
                 * this would zero out all new buffers and mark them uptodate.
                 * Since bh1 was never marked new, we skip it here which causes
                 * the bug later.
                 */
                folio_zero_new_buffers();
          /* ext4_wrte_begin() error handling */
          ext4_truncate_failed_write()
            ext4_truncate()
              ext4_block_truncate_page()
                __ext4_block_zero_page_range()
                  if(!buffer_uptodate())
                    ext4_read_bh_lock()
                      ext4_read_bh() -> ... ext4_submit_bh_wbc()
                        BUG_ON(buffer_unwritten(bh)); /* !!! */
    
    2. The second issue is stale data exposure with page size >= blocksize
    with dioread_nolock. The conditions needed for it to happen are same as
    the previous issue ie dioread_nolock around ENOSPC condition. The issue
    is also similar where in __block_write_begin_int() when we call
    ext4_get_block_unwritten() on the buffer_head and the underlying extent
    is unwritten, we get an unwritten and mapped buffer head. Since it is
    not new, we never zero out the partial range which is not under write,
    thus writing stale data to disk. This can be easily observed with the
    following reproducer:
    
     fallocate -l 4k testfile
     xfs_io -c "pwrite 2k 2k" testfile
     # hexdump output will have stale data in from byte 0 to 2k in testfile
     hexdump -C testfile
    
    NOTE: To trigger this, we need dioread_nolock enabled and write happening via
    ext4_write_begin(), which is usually used when we have -o nodealloc. Since
    dioread_nolock is disabled with nodelalloc, the only alternate way to call
    ext4_write_begin() is to ensure that delayed alloc switches to nodelalloc ie
    ext4_da_write_begin() calls ext4_write_begin(). This will usually happen when
    ext4 is almost full like the way generic/269 was triggering it in Issue 1 above.
    This might make the issue harder to hit. Hence, for reliable replication, I used
    the below patch to temporarily allow dioread_nolock with nodelalloc and then
    mount the disk with -o nodealloc,dioread_nolock. With this you can hit the stale
    data issue 100% of times:
    
    @@ -508,8 +508,8 @@ static inline int ext4_should_dioread_nolock(struct inode *inode)
      if (ext4_should_journal_data(inode))
        return 0;
      /* temporary fix to prevent generic/422 test failures */
    - if (!test_opt(inode->i_sb, DELALLOC))
    -   return 0;
    + // if (!test_opt(inode->i_sb, DELALLOC))
    + //  return 0;
      return 1;
     }
    
    After applying this patch to mark buffer as NEW, both the above issues are
    fixed.
    
    Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
    Cc: stable@kernel.org
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
    Link: https://lore.kernel.org/r/d0ed09d70a9733fbb5349c5c7b125caac186ecdf.1695033645.git.ojaswin@linux.ibm.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a5ab5da03870a832211e3c9c9d088e3347337026
Author: Kemeng Shi <shikemeng@huaweicloud.com>
Date:   Sun Aug 27 01:47:00 2023 +0800

    ext4: correct offset of gdb backup in non meta_bg group to update_backups
    
    commit 31f13421c004a420c0e9d288859c9ea9259ea0cc upstream.
    
    Commit 0aeaa2559d6d5 ("ext4: fix corruption when online resizing a 1K
    bigalloc fs") found that primary superblock's offset in its group is
    not equal to offset of backup superblock in its group when block size
    is 1K and bigalloc is enabled. As group descriptor blocks are right
    after superblock, we can't pass block number of gdb to update_backups
    for the same reason.
    
    The root casue of the issue above is that leading 1K padding block is
    count as data block offset for primary block while backup block has no
    padding block offset in its group.
    
    Remove padding data block count to fix the issue for gdb backups.
    
    For meta_bg case, update_backups treat blk_off as block number, do no
    conversion in this case.
    
    Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
    Reviewed-by: Theodore Ts'o <tytso@mit.edu>
    Link: https://lore.kernel.org/r/20230826174712.4059355-2-shikemeng@huaweicloud.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit df562e04a1c8a84dfd10c89c00db086fec85a3b5
Author: Max Kellermann <max.kellermann@ionos.com>
Date:   Tue Sep 19 10:18:23 2023 +0200

    ext4: apply umask if ACL support is disabled
    
    commit 484fd6c1de13b336806a967908a927cc0356e312 upstream.
    
    The function ext4_init_acl() calls posix_acl_create() which is
    responsible for applying the umask.  But without
    CONFIG_EXT4_FS_POSIX_ACL, ext4_init_acl() is an empty inline function,
    and nobody applies the umask.
    
    This fixes a bug which causes the umask to be ignored with O_TMPFILE
    on ext4:
    
     https://github.com/MusicPlayerDaemon/MPD/issues/558
     https://bugs.gentoo.org/show_bug.cgi?id=686142#c3
     https://bugzilla.kernel.org/show_bug.cgi?id=203625
    
    Reviewed-by: "J. Bruce Fields" <bfields@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
    Link: https://lore.kernel.org/r/20230919081824.1096619-1-max.kellermann@ionos.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3bc2023850b83b23bdfebecf059752bc6b9f58e2
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Thu Aug 24 17:26:05 2023 +0800

    ext4: make sure allocate pending entry not fail
    
    commit 8e387c89e96b9543a339f84043cf9df15fed2632 upstream.
    
    __insert_pending() allocate memory in atomic context, so the allocation
    could fail, but we are not handling that failure now. It could lead
    ext4_es_remove_extent() to get wrong reserved clusters, and the global
    data blocks reservation count will be incorrect. The same to
    extents_status entry preallocation, preallocate pending entry out of the
    i_es_lock with __GFP_NOFAIL, make sure __insert_pending() and
    __revise_pending() always succeeds.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/r/20230824092619.1327976-3-yi.zhang@huaweicloud.com
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 825ba5adcbbb70d6419acccf1a0f403797fcec83
Author: Wang Jianjian <wangjianjian0@foxmail.com>
Date:   Thu Aug 24 23:56:31 2023 +0800

    ext4: no need to generate from free list in mballoc
    
    commit ebf6cb7c6e1241984f75f29f1bdbfa2fe7168f88 upstream.
    
    Commit 7a2fcbf7f85 ("ext4: don't use blocks freed but not yet committed in
    buddy cache init") added a code to mark as used blocks in the list of not yet
    committed freed blocks during initialization of a buddy page. However
    ext4_mb_free_metadata() makes sure buddy page is already loaded and takes a
    reference to it so it cannot happen that ext4_mb_init_cache() is called
    when efd list is non-empty. Just remove the
    ext4_mb_generate_from_freelist() call.
    
    Fixes: 7a2fcbf7f85('ext4: don't use blocks freed but not yet committed in buddy cache init')
    Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
    Link: https://lore.kernel.org/r/tencent_53CBCB1668358AE862684E453DF37B722008@qq.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 904fa65c26ab9f98b6a9ff25a8996081dfc1792d
Author: Baokun Li <libaokun1@huawei.com>
Date:   Wed May 24 15:25:38 2023 +0800

    ext4: fix race between writepages and remount
    
    commit 745f17a4166e79315e4b7f33ce89d03e75a76983 upstream.
    
    We got a WARNING in ext4_add_complete_io:
    ==================================================================
     WARNING: at fs/ext4/page-io.c:231 ext4_put_io_end_defer+0x182/0x250
     CPU: 10 PID: 77 Comm: ksoftirqd/10 Tainted: 6.3.0-rc2 #85
     RIP: 0010:ext4_put_io_end_defer+0x182/0x250 [ext4]
     [...]
     Call Trace:
      <TASK>
      ext4_end_bio+0xa8/0x240 [ext4]
      bio_endio+0x195/0x310
      blk_update_request+0x184/0x770
      scsi_end_request+0x2f/0x240
      scsi_io_completion+0x75/0x450
      scsi_finish_command+0xef/0x160
      scsi_complete+0xa3/0x180
      blk_complete_reqs+0x60/0x80
      blk_done_softirq+0x25/0x40
      __do_softirq+0x119/0x4c8
      run_ksoftirqd+0x42/0x70
      smpboot_thread_fn+0x136/0x3c0
      kthread+0x140/0x1a0
      ret_from_fork+0x2c/0x50
    ==================================================================
    
    Above issue may happen as follows:
    
                cpu1                        cpu2
    ----------------------------|----------------------------
    mount -o dioread_lock
    ext4_writepages
     ext4_do_writepages
      *if (ext4_should_dioread_nolock(inode))*
        // rsv_blocks is not assigned here
                                     mount -o remount,dioread_nolock
      ext4_journal_start_with_reserve
       __ext4_journal_start
        __ext4_journal_start_sb
         jbd2__journal_start
          *if (rsv_blocks)*
            // h_rsv_handle is not initialized here
      mpage_map_and_submit_extent
        mpage_map_one_extent
          dioread_nolock = ext4_should_dioread_nolock(inode)
          if (dioread_nolock && (map->m_flags & EXT4_MAP_UNWRITTEN))
            mpd->io_submit.io_end->handle = handle->h_rsv_handle
            ext4_set_io_unwritten_flag
              io_end->flag |= EXT4_IO_END_UNWRITTEN
          // now io_end->handle is NULL but has EXT4_IO_END_UNWRITTEN flag
    
    scsi_finish_command
     scsi_io_completion
      scsi_io_completion_action
       scsi_end_request
        blk_update_request
         req_bio_endio
          bio_endio
           bio->bi_end_io  > ext4_end_bio
            ext4_put_io_end_defer
             ext4_add_complete_io
              // trigger WARN_ON(!io_end->handle && sbi->s_journal);
    
    The immediate cause of this problem is that ext4_should_dioread_nolock()
    function returns inconsistent values in the ext4_do_writepages() and
    mpage_map_one_extent(). There are four conditions in this function that
    can be changed at mount time to cause this problem. These four conditions
    can be divided into two categories:
    
        (1) journal_data and EXT4_EXTENTS_FL, which can be changed by ioctl
        (2) DELALLOC and DIOREAD_NOLOCK, which can be changed by remount
    
    The two in the first category have been fixed by commit c8585c6fcaf2
    ("ext4: fix races between changing inode journal mode and ext4_writepages")
    and commit cb85f4d23f79 ("ext4: fix race between writepages and enabling
    EXT4_EXTENTS_FL") respectively.
    
    Two cases in the other category have not yet been fixed, and the above
    issue is caused by this situation. We refer to the fix for the first
    category, when applying options during remount, we grab s_writepages_rwsem
    to avoid racing with writepages ops to trigger this problem.
    
    Fixes: 6b523df4fb5a ("ext4: use transaction reservation for extent conversion in ext4_end_io")
    Cc: stable@vger.kernel.org
    Signed-off-by: Baokun Li <libaokun1@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20230524072538.2883391-1-libaokun1@huawei.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c7a3af88e8af85f5cdaf45a005d029f94db41f3
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Tue Nov 21 09:09:33 2023 +0100

    Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E"
    
    commit 6a26310273c323380da21eb23fcfd50e31140913 upstream.
    
    This reverts commit efa5f1311c4998e9e6317c52bc5ee93b3a0f36df.
    
    I couldn't reproduce the reported issue. What I did, based on a pcap
    packet log provided by the reporter:
    - Used same chip version (RTL8168h)
    - Set MAC address to the one used on the reporters system
    - Replayed the EAPOL unicast packet that, according to the reporter,
      was filtered out by the mc filter.
    The packet was properly received.
    
    Therefore the root cause of the reported issue seems to be somewhere
    else. Disabling mc filtering completely for the most common chip
    version is a quite big hammer. Therefore revert the change and wait
    for further analysis results from the reporter.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a302879747f8f5bf6ff578acf877f310e0cd3f2f
Author: Jiri Kosina <jkosina@suse.cz>
Date:   Tue Nov 21 14:38:11 2023 +0100

    Revert "HID: logitech-dj: Add support for a new lightspeed receiver iteration"
    
    commit 5b4ffb176d7979ac66b349addf3f7de433335e00 upstream.
    
    This reverts commit 9d1bd9346241cd6963b58da7ffb7ed303285f684.
    
    Multiple people reported misbehaving devices and reverting this commit fixes
    the problem for them. As soon as the original commit author starts reacting
    again, we can try to figure out why he hasn't seen the issues (mismatching
    report descriptors?), but for the time being, fix for 6.7 by reverting.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=218172
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=218094
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ed9f1ea9188017ba31727ba3a1ed58cdff2daf6f
Author: Andrey Konovalov <andrey.konovalov@linaro.org>
Date:   Wed Aug 30 16:16:15 2023 +0100

    media: qcom: camss: Fix csid-gen2 for test pattern generator
    
    commit 87889f1b7ea40d2544b49c62092e6ef2792dced7 upstream.
    
    In the current driver csid Test Pattern Generator (TPG) doesn't work.
    This change:
    - fixes writing frame width and height values into CSID_TPG_DT_n_CFG_0
    - fixes the shift by one between test_pattern control value and the
      actual pattern.
    - drops fixed VC of 0x0a which testing showed prohibited some test
      patterns in the CSID to produce output.
    So that TPG starts working, but with the below limitations:
    - only test_pattern=9 works as it should
    - test_pattern=8 and test_pattern=7 produce black frame (all zeroes)
    - the rest of test_pattern's don't work (yavta doesn't get the data)
    - regardless of the CFA pattern set by 'media-ctl -V' the actual pixel
      order is always the same (RGGB for any RAW8 or RAW10P format in
      4608x2592 resolution).
    
    Tested with:
    
    RAW10P format, VC0:
     media-ctl -V '"msm_csid0":0[fmt:SRGGB10/4608x2592 field:none]'
     media-ctl -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/4608x2592 field:none]'
     media-ctl -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
     v4l2-ctl -d /dev/v4l-subdev6 -c test_pattern=9
     yavta -B capture-mplane --capture=3 -n 3 -f SRGGB10P -s 4608x2592 /dev/video0
    
    RAW10P format, VC1:
     media-ctl -V '"msm_csid0":2[fmt:SRGGB10/4608x2592 field:none]'
     media-ctl -V '"msm_vfe0_rdi1":0[fmt:SRGGB10/4608x2592 field:none]'
     media-ctl -l '"msm_csid0":2->"msm_vfe0_rdi1":0[1]'
     v4l2-ctl -d /dev/v4l-subdev6 -c test_pattern=9
     yavta -B capture-mplane --capture=3 -n 3 -f SRGGB10P -s 4608x2592 /dev/video1
    
    RAW8 format, VC0:
     media-ctl --reset
     media-ctl -V '"msm_csid0":0[fmt:SRGGB8/4608x2592 field:none]'
     media-ctl -V '"msm_vfe0_rdi0":0[fmt:SRGGB8/4608x2592 field:none]'
     media-ctl -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
     yavta -B capture-mplane --capture=3 -n 3 -f SRGGB8 -s 4608x2592 /dev/video0
    
    Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170")
    Cc: stable@vger.kernel.org
    Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e09e1ddc693509f2b2d151017fd8666e13470eda
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Wed Aug 30 16:16:13 2023 +0100

    media: qcom: camss: Fix invalid clock enable bit disjunction
    
    commit d8f7e1a60d01739a1d78db2b08603089c6cf7c8e upstream.
    
    define CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE BIT(7)
    
    disjunction for gen2 ? BIT(7) : is a nop we are setting the same bit
    either way.
    
    Fixes: 4abb21309fda ("media: camss: csiphy: Move to hardcode CSI Clock Lane number")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5fbdccc9f8f3828071845ed3de6d69033d2097f5
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Wed Aug 30 16:16:14 2023 +0100

    media: qcom: camss: Fix set CSI2_RX_CFG1_VC_MODE when VC is greater than 3
    
    commit e655d1ae9703286cef7fda8675cad62f649dc183 upstream.
    
    VC_MODE = 0 implies a two bit VC address.
    VC_MODE = 1 is required for VCs with a larger address than two bits.
    
    Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f6cc8265ebf10822d61fe8424b8b0d271fb833f8
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Wed Aug 30 16:16:12 2023 +0100

    media: qcom: camss: Fix missing vfe_lite clocks check
    
    commit b6e1bdca463a932c1ac02caa7d3e14bf39288e0c upstream.
    
    check_clock doesn't account for vfe_lite which means that vfe_lite will
    never get validated by this routine. Add the clock name to the expected set
    to remediate.
    
    Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Titan 170")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4dac469b07d4ef631379cd329cd6c0d70bdc09f3
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Wed Aug 30 16:16:11 2023 +0100

    media: qcom: camss: Fix VFE-480 vfe_disable_output()
    
    commit 7f24d291350426d40b36dfbe6b3090617cdfd37a upstream.
    
    vfe-480 is copied from vfe-17x and has the same racy idle timeout bug as in
    17x.
    
    Fix the vfe_disable_output() logic to no longer be racy and to conform
    to the 17x way of quiescing and then resetting the VFE.
    
    Fixes: 4edc8eae715c ("media: camss: Add initial support for VFE hardware version Titan 480")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1eaec007b6038e729402dba9276d2413c701dba
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Wed Aug 30 16:16:10 2023 +0100

    media: qcom: camss: Fix VFE-17x vfe_disable_output()
    
    commit 3143ad282fc08bf995ee73e32a9e40c527bf265d upstream.
    
    There are two problems with the current vfe_disable_output() routine.
    
    Firstly we rightly use a spinlock to protect output->gen2.active_num
    everywhere except for in the IDLE timeout path of vfe_disable_output().
    Even if that is not racy "in practice" somehow it is by happenstance not
    by design.
    
    Secondly we do not get consistent behaviour from this routine. On
    sc8280xp 50% of the time I get "VFE idle timeout - resetting". In this
    case the subsequent capture will succeed. The other 50% of the time, we
    don't hit the idle timeout, never do the VFE reset and subsequent
    captures stall indefinitely.
    
    Rewrite the vfe_disable_output() routine to
    
    - Quiesce write masters with vfe_wm_stop()
    - Set active_num = 0
    
    remembering to hold the spinlock when we do so followed by
    
    - Reset the VFE
    
    Testing on sc8280xp and sdm845 shows this to be a valid fix.
    
    Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Titan 170")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 816a4070bc6468e93867995e9a12176dbd91e430
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Wed Aug 30 16:16:09 2023 +0100

    media: qcom: camss: Fix vfe_get() error jump
    
    commit 26bda3da00c3edef727a6acb00ed2eb4b22f8723 upstream.
    
    Right now it is possible to do a vfe_get() with the internal reference
    count at 1. If vfe_check_clock_rates() returns non-zero then we will
    leave the reference count as-is and
    
    run:
    - pm_runtime_put_sync()
    - vfe->ops->pm_domain_off()
    
    skip:
    - camss_disable_clocks()
    
    Subsequent vfe_put() calls will when the ref-count is non-zero
    unconditionally run:
    
    - pm_runtime_put_sync()
    - vfe->ops->pm_domain_off()
    - camss_disable_clocks()
    
    vfe_get() should not attempt to roll-back on error when the ref-count is
    non-zero as the upper layers will still do their own vfe_put() operations.
    
    vfe_put() will drop the reference count and do the necessary power
    domain release, the cleanup jumps in vfe_get() should only be run when
    the ref-count is zero.
    
    [   50.095796] CPU: 7 PID: 3075 Comm: cam Not tainted 6.3.2+ #80
    [   50.095798] Hardware name: LENOVO 21BXCTO1WW/21BXCTO1WW, BIOS N3HET82W (1.54 ) 05/26/2023
    [   50.095799] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [   50.095802] pc : refcount_warn_saturate+0xf4/0x148
    [   50.095804] lr : refcount_warn_saturate+0xf4/0x148
    [   50.095805] sp : ffff80000c7cb8b0
    [   50.095806] x29: ffff80000c7cb8b0 x28: ffff16ecc0e3fc10 x27: 0000000000000000
    [   50.095810] x26: 0000000000000000 x25: 0000000000020802 x24: 0000000000000000
    [   50.095813] x23: ffff16ecc7360640 x22: 00000000ffffffff x21: 0000000000000005
    [   50.095815] x20: ffff16ed175f4400 x19: ffffb4d9852942a8 x18: ffffffffffffffff
    [   50.095818] x17: ffffb4d9852d4a48 x16: ffffb4d983da5db8 x15: ffff80000c7cb320
    [   50.095821] x14: 0000000000000001 x13: 2e656572662d7265 x12: 7466612d65737520
    [   50.095823] x11: 00000000ffffefff x10: ffffb4d9850cebf0 x9 : ffffb4d9835cf954
    [   50.095826] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : 0000000000057fa8
    [   50.095829] x5 : ffff16f813fe3d08 x4 : 0000000000000000 x3 : ffff621e8f4d2000
    [   50.095832] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff16ed32119040
    [   50.095835] Call trace:
    [   50.095836]  refcount_warn_saturate+0xf4/0x148
    [   50.095838]  device_link_put_kref+0x84/0xc8
    [   50.095843]  device_link_del+0x38/0x58
    [   50.095846]  vfe_pm_domain_off+0x3c/0x50 [qcom_camss]
    [   50.095860]  vfe_put+0x114/0x140 [qcom_camss]
    [   50.095869]  csid_set_power+0x2c8/0x408 [qcom_camss]
    [   50.095878]  pipeline_pm_power_one+0x164/0x170 [videodev]
    [   50.095896]  pipeline_pm_power+0xc4/0x110 [videodev]
    [   50.095909]  v4l2_pipeline_pm_use+0x5c/0xa0 [videodev]
    [   50.095923]  v4l2_pipeline_pm_get+0x1c/0x30 [videodev]
    [   50.095937]  video_open+0x7c/0x100 [qcom_camss]
    [   50.095945]  v4l2_open+0x84/0x130 [videodev]
    [   50.095960]  chrdev_open+0xc8/0x250
    [   50.095964]  do_dentry_open+0x1bc/0x498
    [   50.095966]  vfs_open+0x34/0x40
    [   50.095968]  path_openat+0xb44/0xf20
    [   50.095971]  do_filp_open+0xa4/0x160
    [   50.095974]  do_sys_openat2+0xc8/0x188
    [   50.095975]  __arm64_sys_openat+0x6c/0xb8
    [   50.095977]  invoke_syscall+0x50/0x128
    [   50.095982]  el0_svc_common.constprop.0+0x4c/0x100
    [   50.095985]  do_el0_svc+0x40/0xa8
    [   50.095988]  el0_svc+0x2c/0x88
    [   50.095991]  el0t_64_sync_handler+0xf4/0x120
    [   50.095994]  el0t_64_sync+0x190/0x198
    [   50.095996] ---[ end trace 0000000000000000 ]---
    
    Fixes: 779096916dae ("media: camss: vfe: Fix runtime PM imbalance on error")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 35c9b41dc83ffadb25ea6cc1cc68e25df7bef614
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date:   Wed Aug 30 16:16:06 2023 +0100

    media: qcom: camss: Fix pm_domain_on sequence in probe
    
    commit 7405116519ad70b8c7340359bfac8db8279e7ce4 upstream.
    
    We need to make sure camss_configure_pd() happens before
    camss_register_entities() as the vfe_get() path relies on the pointer
    provided by camss_configure_pd().
    
    Fix the ordering sequence in probe to ensure the pointers vfe_get() demands
    are present by the time camss_register_entities() runs.
    
    In order to facilitate backporting to stable kernels I've moved the
    configure_pd() call pretty early on the probe() function so that
    irrespective of the existence of the old error handling jump labels this
    patch should still apply to -next circa Aug 2023 to v5.13 inclusive.
    
    Fixes: 2f6f8af67203 ("media: camss: Refactor VFE power domain toggling")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ea67257276720eaabb6109f0bd149a743cf3dcd1
Author: Victor Shih <victor.shih@genesyslogic.com.tw>
Date:   Tue Nov 7 17:57:40 2023 +0800

    mmc: sdhci-pci-gli: GL9750: Mask the replay timer timeout of AER
    
    commit 015c9cbcf0ad709079117d27c2094a46e0eadcdb upstream.
    
    Due to a flaw in the hardware design, the GL9750 replay timer frequently
    times out when ASPM is enabled. As a result, the warning messages will
    often appear in the system log when the system accesses the GL9750
    PCI config. Therefore, the replay timer timeout must be masked.
    
    Fixes: d7133797e9e1 ("mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter ASPM L1.2")
    Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Acked-by: Kai-Heng Feng <kai.heng.geng@canonical.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231107095741.8832-2-victorshihgli@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c61d525f3d471bd9970b2775bba32b05f15fb3c9
Author: ChunHao Lin <hau@realtek.com>
Date:   Fri Nov 10 01:33:59 2023 +0800

    r8169: add handling DASH when DASH is disabled
    
    commit 0ab0c45d8aaea5192328bfa6989673aceafc767c upstream.
    
    For devices that support DASH, even DASH is disabled, there may still
    exist a default firmware that will influence device behavior.
    So driver needs to handle DASH for devices that support DASH, no
    matter the DASH status is.
    
    This patch also prepares for "fix network lost after resume on DASH
    systems".
    
    Fixes: ee7a1beb9759 ("r8169:call "rtl8168_driver_start" "rtl8168_driver_stop" only when hardware dash function is enabled")
    Cc: stable@vger.kernel.org
    Signed-off-by: ChunHao Lin <hau@realtek.com>
    Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
    Link: https://lore.kernel.org/r/20231109173400.4573-2-hau@realtek.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a51260968b80af88713d14d9cc5df1c1e81f6077
Author: ChunHao Lin <hau@realtek.com>
Date:   Fri Nov 10 01:34:00 2023 +0800

    r8169: fix network lost after resume on DASH systems
    
    commit 868c3b95afef4883bfb66c9397482da6840b5baf upstream.
    
    Device that support DASH may be reseted or powered off during suspend.
    So driver needs to handle DASH during system suspend and resume. Or
    DASH firmware will influence device behavior and causes network lost.
    
    Fixes: b646d90053f8 ("r8169: magic.")
    Cc: stable@vger.kernel.org
    Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
    Signed-off-by: ChunHao Lin <hau@realtek.com>
    Link: https://lore.kernel.org/r/20231109173400.4573-3-hau@realtek.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 55dd38166c5b875abe290bb9c6445e0c3b945b2c
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Tue Nov 14 00:16:17 2023 +0100

    selftests: mptcp: fix fastclose with csum failure
    
    commit 7cefbe5e1dacc7236caa77e9d072423f21422fe2 upstream.
    
    Running the mp_join selftest manually with the following command line:
    
      ./mptcp_join.sh -z -C
    
    leads to some failures:
    
      002 fastclose server test
      # ...
      rtx                                 [fail] got 1 MP_RST[s] TX expected 0
      # ...
      rstrx                               [fail] got 1 MP_RST[s] RX expected 0
    
    The problem is really in the wrong expectations for the RST checks
    implied by the csum validation. Note that the same check is repeated
    explicitly in the same test-case, with the correct expectation and
    pass successfully.
    
    Address the issue explicitly setting the correct expectation for
    the failing checks.
    
    Reported-by: Xiumei Mu <xmu@redhat.com>
    Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20231114-upstream-net-20231113-mptcp-misc-fixes-6-7-rc2-v1-5-7b9cd6a7b7f4@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dfac7f073b2b86267dc1e2f975de43edf84f21ef
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Tue Nov 14 00:16:16 2023 +0100

    mptcp: fix setsockopt(IP_TOS) subflow locking
    
    commit 7679d34f97b7a09fd565f5729f79fd61b7c55329 upstream.
    
    The MPTCP implementation of the IP_TOS socket option uses the lockless
    variant of the TOS manipulation helper and does not hold such lock at
    the helper invocation time.
    
    Add the required locking.
    
    Fixes: ffcacff87cd6 ("mptcp: Support for IP_TOS for MPTCP setsockopt()")
    Cc: stable@vger.kernel.org
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/457
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20231114-upstream-net-20231113-mptcp-misc-fixes-6-7-rc2-v1-4-7b9cd6a7b7f4@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 43fa3b0d7bc2a7f0679c153e485110e5e35cfcf2
Author: Geliang Tang <geliang.tang@suse.com>
Date:   Tue Nov 14 00:16:15 2023 +0100

    mptcp: add validity check for sending RM_ADDR
    
    commit 8df220b29282e8b450ea57be62e1eccd4996837c upstream.
    
    This patch adds the validity check for sending RM_ADDRs for userspace PM
    in mptcp_pm_remove_addrs(), only send a RM_ADDR when the address is in the
    anno_list or conn_list.
    
    Fixes: 8b1c94da1e48 ("mptcp: only send RM_ADDR in nl_cmd_remove")
    Cc: stable@vger.kernel.org
    Signed-off-by: Geliang Tang <geliang.tang@suse.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20231114-upstream-net-20231113-mptcp-misc-fixes-6-7-rc2-v1-3-7b9cd6a7b7f4@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 57ced2eb77343a91d28f4a73675b05fe7b555def
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Tue Nov 14 00:16:13 2023 +0100

    mptcp: deal with large GSO size
    
    commit 9fce92f050f448a0d1ddd9083ef967d9930f1e52 upstream.
    
    After the blamed commit below, the TCP sockets (and the MPTCP subflows)
    can build egress packets larger than 64K. That exceeds the maximum DSS
    data size, the length being misrepresent on the wire and the stream being
    corrupted, as later observed on the receiver:
    
      WARNING: CPU: 0 PID: 9696 at net/mptcp/protocol.c:705 __mptcp_move_skbs_from_subflow+0x2604/0x26e0
      CPU: 0 PID: 9696 Comm: syz-executor.7 Not tainted 6.6.0-rc5-gcd8bdf563d46 #45
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
      netlink: 8 bytes leftover after parsing attributes in process `syz-executor.4'.
      RIP: 0010:__mptcp_move_skbs_from_subflow+0x2604/0x26e0 net/mptcp/protocol.c:705
      RSP: 0018:ffffc90000006e80 EFLAGS: 00010246
      RAX: ffffffff83e9f674 RBX: ffff88802f45d870 RCX: ffff888102ad0000
      netlink: 8 bytes leftover after parsing attributes in process `syz-executor.4'.
      RDX: 0000000080000303 RSI: 0000000000013908 RDI: 0000000000003908
      RBP: ffffc90000007110 R08: ffffffff83e9e078 R09: 1ffff1100e548c8a
      R10: dffffc0000000000 R11: ffffed100e548c8b R12: 0000000000013908
      R13: dffffc0000000000 R14: 0000000000003908 R15: 000000000031cf29
      FS:  00007f239c47e700(0000) GS:ffff88811b200000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f239c45cd78 CR3: 000000006a66c006 CR4: 0000000000770ef0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
      PKRU: 55555554
      Call Trace:
       <IRQ>
       mptcp_data_ready+0x263/0xac0 net/mptcp/protocol.c:819
       subflow_data_ready+0x268/0x6d0 net/mptcp/subflow.c:1409
       tcp_data_queue+0x21a1/0x7a60 net/ipv4/tcp_input.c:5151
       tcp_rcv_established+0x950/0x1d90 net/ipv4/tcp_input.c:6098
       tcp_v6_do_rcv+0x554/0x12f0 net/ipv6/tcp_ipv6.c:1483
       tcp_v6_rcv+0x2e26/0x3810 net/ipv6/tcp_ipv6.c:1749
       ip6_protocol_deliver_rcu+0xd6b/0x1ae0 net/ipv6/ip6_input.c:438
       ip6_input+0x1c5/0x470 net/ipv6/ip6_input.c:483
       ipv6_rcv+0xef/0x2c0 include/linux/netfilter.h:304
       __netif_receive_skb+0x1ea/0x6a0 net/core/dev.c:5532
       process_backlog+0x353/0x660 net/core/dev.c:5974
       __napi_poll+0xc6/0x5a0 net/core/dev.c:6536
       net_rx_action+0x6a0/0xfd0 net/core/dev.c:6603
       __do_softirq+0x184/0x524 kernel/softirq.c:553
       do_softirq+0xdd/0x130 kernel/softirq.c:454
    
    Address the issue explicitly bounding the maximum GSO size to what MPTCP
    actually allows.
    
    Reported-by: Christoph Paasch <cpaasch@apple.com>
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/450
    Fixes: 7c4e983c4f3c ("net: allow gso_max_size to exceed 65536")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20231114-upstream-net-20231113-mptcp-misc-fixes-6-7-rc2-v1-1-7b9cd6a7b7f4@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 572d3e8b57f17a3b6bc738dd64730ef7ce85676b
Author: Roman Gushchin <roman.gushchin@linux.dev>
Date:   Tue Nov 7 09:18:02 2023 -0800

    mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors
    
    commit 24948e3b7b12e0031a6edb4f49bbb9fb2ad1e4e9 upstream.
    
    Objcg vectors attached to slab pages to store slab object ownership
    information are allocated using gfp flags for the original slab
    allocation.  Depending on slab page order and the size of slab objects,
    objcg vector can take several pages.
    
    If the original allocation was done with the __GFP_NOFAIL flag, it
    triggered a warning in the page allocation code.  Indeed, order > 1 pages
    should not been allocated with the __GFP_NOFAIL flag.
    
    Fix this by simply dropping the __GFP_NOFAIL flag when allocating the
    objcg vector.  It effectively allows to skip the accounting of a single
    slab object under a heavy memory pressure.
    
    An alternative would be to implement the mechanism to fallback to order-0
    allocations for accounting metadata, which is also not perfect because it
    will increase performance penalty and memory footprint of the kernel
    memory accounting under memory pressure.
    
    Link: https://lkml.kernel.org/r/ZUp8ZFGxwmCx4ZFr@P9FQF9L96D.corp.robot.car
    Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
    Reported-by: Christoph Lameter <cl@linux.com>
    Closes: https://lkml.kernel.org/r/6b42243e-f197-600a-5d22-56bd728a5ad8@gentwo.org
    Acked-by: Shakeel Butt <shakeelb@google.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9feb80bea42025ec47f4f70ce5cf7ac30016f754
Author: Stefan Roesch <shr@devkernel.io>
Date:   Mon Nov 6 10:19:18 2023 -0800

    mm: fix for negative counter: nr_file_hugepages
    
    commit a48d5bdc877b85201e42cef9c2fdf5378164c23a upstream.
    
    While qualifiying the 6.4 release, the following warning was detected in
    messages:
    
    vmstat_refresh: nr_file_hugepages -15664
    
    The warning is caused by the incorrect updating of the NR_FILE_THPS
    counter in the function split_huge_page_to_list.  The if case is checking
    for folio_test_swapbacked, but the else case is missing the check for
    folio_test_pmd_mappable.  The other functions that manipulate the counter
    like __filemap_add_folio and filemap_unaccount_folio have the
    corresponding check.
    
    I have a test case, which reproduces the problem. It can be found here:
      https://github.com/sroeschus/testcase/blob/main/vmstat_refresh/madv.c
    
    The test case reproduces on an XFS filesystem. Running the same test
    case on a BTRFS filesystem does not reproduce the problem.
    
    AFAIK version 6.1 until 6.6 are affected by this problem.
    
    [akpm@linux-foundation.org: whitespace fix]
    [shr@devkernel.io: test for folio_test_pmd_mappable()]
      Link: https://lkml.kernel.org/r/20231108171517.2436103-1-shr@devkernel.io
    Link: https://lkml.kernel.org/r/20231106181918.1091043-1-shr@devkernel.io
    Signed-off-by: Stefan Roesch <shr@devkernel.io>
    Co-debugged-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Yang Shi <shy828301@gmail.com>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cd93b7952c631ae0d122343ce7cb6c35edfa1ced
Author: Victor Shih <victor.shih@genesyslogic.com.tw>
Date:   Tue Sep 12 17:17:10 2023 +0800

    mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter ASPM L1.2
    
    commit d7133797e9e1b72fd89237f68cb36d745599ed86 upstream.
    
    When GL9750 enters ASPM L1 sub-states, it will stay at L1.1 and will not
    enter L1.2. The workaround is to toggle PM state to allow GL9750 to enter
    ASPM L1.2.
    
    Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
    Link: https://lore.kernel.org/r/20230912091710.7797-1-victorshihgli@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b59f21292e1858477d4007d9645678b88ae17abf
Author: Nam Cao <namcaov@gmail.com>
Date:   Tue Aug 29 20:25:00 2023 +0200

    riscv: kprobes: allow writing to x0
    
    commit 8cb22bec142624d21bc85ff96b7bad10b6220e6a upstream.
    
    Instructions can write to x0, so we should simulate these instructions
    normally.
    
    Currently, the kernel hangs if an instruction who writes to x0 is
    simulated.
    
    Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
    Cc: stable@vger.kernel.org
    Signed-off-by: Nam Cao <namcaov@gmail.com>
    Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
    Acked-by: Guo Ren <guoren@kernel.org>
    Link: https://lore.kernel.org/r/20230829182500.61875-1-namcaov@gmail.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c8b096a575000605da454d498369f5e15e9739b
Author: Song Shuai <suagrfillet@gmail.com>
Date:   Tue Aug 29 21:39:20 2023 -0700

    riscv: correct pt_level name via pgtable_l5/4_enabled
    
    commit e59e5e2754bf983fc58ad18f99b5eec01f1a0745 upstream.
    
    The pt_level uses CONFIG_PGTABLE_LEVELS to display page table names.
    But if page mode is downgraded from kernel cmdline or restricted by
    the hardware in 64BIT, it will give a wrong name.
    
    Like, using no4lvl for sv39, ptdump named the 1G-mapping as "PUD"
    that should be "PGD":
    
    0xffffffd840000000-0xffffffd900000000    0x00000000c0000000         3G PUD     D A G . . W R V
    
    So select "P4D/PUD" or "PGD" via pgtable_l5/4_enabled to correct it.
    
    Fixes: e8a62cc26ddf ("riscv: Implement sv48 support")
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Song Shuai <suagrfillet@gmail.com>
    Link: https://lore.kernel.org/r/20230712115740.943324-1-suagrfillet@gmail.com
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20230830044129.11481-3-palmer@rivosinc.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bf564cf9cac7d9e72c1455fc015f0b81408c3703
Author: Song Shuai <suagrfillet@gmail.com>
Date:   Wed Aug 9 11:10:23 2023 +0800

    riscv: mm: Update the comment of CONFIG_PAGE_OFFSET
    
    commit 559fe94a449cba5b50a7cffea60474b385598c00 upstream.
    
    Since the commit 011f09d12052 set sv57 as default for CONFIG_64BIT,
    the comment of CONFIG_PAGE_OFFSET should be updated too.
    
    Fixes: 011f09d12052 ("riscv: mm: Set sv57 on defaultly")
    Signed-off-by: Song Shuai <suagrfillet@gmail.com>
    Link: https://lore.kernel.org/r/20230809031023.3575407-1-songshuaishuai@tinylab.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a08b414d1ecec1ddc22b2d87f5c189aab1b3097b
Author: Nam Cao <namcaov@gmail.com>
Date:   Mon Aug 21 16:57:09 2023 +0200

    riscv: put interrupt entries into .irqentry.text
    
    commit 87615e95f6f9ccd36d4a3905a2d87f91967ea9d2 upstream.
    
    The interrupt entries are expected to be in the .irqentry.text section.
    For example, for kprobes to work properly, exception code cannot be
    probed; this is ensured by blacklisting addresses in the .irqentry.text
    section.
    
    Fixes: 7db91e57a0ac ("RISC-V: Task implementation")
    Signed-off-by: Nam Cao <namcaov@gmail.com>
    Link: https://lore.kernel.org/r/20230821145708.21270-1-namcaov@gmail.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7aa18f77e1c2075c06829efa9903c0962b2f954a
Author: Minda Chen <minda.chen@starfivetech.com>
Date:   Wed Aug 2 14:42:15 2023 +0800

    riscv: Using TOOLCHAIN_HAS_ZIHINTPAUSE marco replace zihintpause
    
    commit dd16ac404a685cce07e67261a94c6225d90ea7ba upstream.
    
    Actually it is a part of Conor's
    commit aae538cd03bc ("riscv: fix detection of toolchain
    Zihintpause support").
    It is looks like a merge issue. Samuel's
    commit 0b1d60d6dd9e ("riscv: Fix build with
    CONFIG_CC_OPTIMIZE_FOR_SIZE=y") do not base on Conor's commit and
    revert to __riscv_zihintpause. So this patch can fix it.
    
    Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
    Fixes: 3c349eacc559 ("Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"")
    Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
    Link: https://lore.kernel.org/r/20230802064215.31111-1-minda.chen@starfivetech.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ce7612496a4ba6068bc68aa1fa9d947dadb4ad9b
Author: Petr Tesarik <petr.tesarik1@huawei-partners.com>
Date:   Wed Nov 8 12:12:49 2023 +0100

    swiotlb: fix out-of-bounds TLB allocations with CONFIG_SWIOTLB_DYNAMIC
    
    commit 53c87e846e335e3c18044c397cc35178163d7827 upstream.
    
    Limit the free list length to the size of the IO TLB. Transient pool can be
    smaller than IO_TLB_SEGSIZE, but the free list is initialized with the
    assumption that the total number of slots is a multiple of IO_TLB_SEGSIZE.
    As a result, swiotlb_area_find_slots() may allocate slots past the end of
    a transient IO TLB buffer.
    
    Reported-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Closes: https://lore.kernel.org/linux-iommu/104a8c8fedffd1ff8a2890983e2ec1c26bff6810.camel@linux.ibm.com/
    Fixes: 79636caad361 ("swiotlb: if swiotlb is full, fall back to a transient memory pool")
    Cc: stable@vger.kernel.org
    Signed-off-by: Petr Tesarik <petr.tesarik1@huawei-partners.com>
    Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d6ab317502cd0bf30893806fae180f7b735b1fc
Author: Petr Tesarik <petrtesarik@huaweicloud.com>
Date:   Thu Nov 2 10:36:49 2023 +0100

    swiotlb: do not free decrypted pages if dynamic
    
    commit a5e3b127455d073f146a2a4ea3e7117635d34c5c upstream.
    
    Fix these two error paths:
    
    1. When set_memory_decrypted() fails, pages may be left fully or partially
       decrypted.
    
    2. Decrypted pages may be freed if swiotlb_alloc_tlb() determines that the
       physical address is too high.
    
    To fix the first issue, call set_memory_encrypted() on the allocated region
    after a failed decryption attempt. If that also fails, leak the pages.
    
    To fix the second issue, check that the TLB physical address is below the
    requested limit before decrypting.
    
    Let the caller differentiate between unsuitable physical address (=> retry
    from a lower zone) and allocation failures (=> no point in retrying).
    
    Cc: stable@vger.kernel.org
    Fixes: 79636caad361 ("swiotlb: if swiotlb is full, fall back to a transient memory pool")
    Signed-off-by: Petr Tesarik <petr.tesarik1@huawei-partners.com>
    Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0e9a6b8a7d88f28c401b2a9413ffd958faf10570
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date:   Wed Nov 8 21:12:39 2023 +0900

    tracing: fprobe-event: Fix to check tracepoint event and return
    
    commit ce51e6153f7781bcde0f8bb4c81d6fd85ee422e6 upstream.
    
    Fix to check the tracepoint event is not valid with $retval.
    The commit 08c9306fc2e3 ("tracing/fprobe-event: Assume fprobe is
    a return event by $retval") introduced automatic return probe
    conversion with $retval. But since tracepoint event does not
    support return probe, $retval is not acceptable.
    
    Without this fix, ftracetest, tprobe_syntax_errors.tc fails;
    
    [22] Tracepoint probe event parser error log check      [FAIL]
     ----
     # tail 22-tprobe_syntax_errors.tc-log.mRKroL
     + ftrace_errlog_check trace_fprobe t kfree ^$retval dynamic_events
     + printf %s t kfree
     + wc -c
     + pos=8
     + printf %s t kfree ^$retval
     + tr -d ^
     + command=t kfree $retval
     + echo Test command: t kfree $retval
     Test command: t kfree $retval
     + echo
     ----
    
    So 't kfree $retval' should fail (tracepoint doesn't support
    return probe) but passed it.
    
    Link: https://lore.kernel.org/all/169944555933.45057.12831706585287704173.stgit@devnote2/
    
    Fixes: 08c9306fc2e3 ("tracing/fprobe-event: Assume fprobe is a return event by $retval")
    Cc: stable@vger.kernel.org
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cff8bf67f126b1a330ada1a0fd8c98fd69f3cb1c
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Wed Nov 8 14:12:15 2023 +0800

    LoongArch: Mark __percpu functions as always inline
    
    commit 71945968d8b128c955204baa33ec03bdd91bdc26 upstream.
    
    A recent change to the optimization pipeline in LLVM reveals some
    fragility around the inlining of LoongArch's __percpu functions, which
    manifests as a BUILD_BUG() failure:
    
      In file included from kernel/sched/build_policy.c:17:
      In file included from include/linux/sched/cputime.h:5:
      In file included from include/linux/sched/signal.h:5:
      In file included from include/linux/rculist.h:11:
      In file included from include/linux/rcupdate.h:26:
      In file included from include/linux/irqflags.h:18:
      arch/loongarch/include/asm/percpu.h:97:3: error: call to '__compiletime_assert_51' declared with 'error' attribute: BUILD_BUG failed
         97 |                 BUILD_BUG();
            |                 ^
      include/linux/build_bug.h:59:21: note: expanded from macro 'BUILD_BUG'
         59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
            |                     ^
      include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
         39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
            |                                     ^
      include/linux/compiler_types.h:425:2: note: expanded from macro 'compiletime_assert'
        425 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
            |         ^
      include/linux/compiler_types.h:413:2: note: expanded from macro '_compiletime_assert'
        413 |         __compiletime_assert(condition, msg, prefix, suffix)
            |         ^
      include/linux/compiler_types.h:406:4: note: expanded from macro '__compiletime_assert'
        406 |                         prefix ## suffix();                             \
            |                         ^
      <scratch space>:86:1: note: expanded from here
         86 | __compiletime_assert_51
            | ^
      1 error generated.
    
    If these functions are not inlined (which the compiler is free to do
    even with functions marked with the standard 'inline' keyword), the
    BUILD_BUG() in the default case cannot be eliminated since the compiler
    cannot prove it is never used, resulting in a build failure due to the
    error attribute.
    
    Mark these functions as __always_inline to guarantee inlining so that
    the BUILD_BUG() only triggers when the default case genuinely cannot be
    eliminated due to an unexpected size.
    
    Cc:  <stable@vger.kernel.org>
    Closes: https://github.com/ClangBuiltLinux/linux/issues/1955
    Fixes: 46859ac8af52 ("LoongArch: Add multi-processor (SMP) support")
    Link: https://github.com/llvm/llvm-project/commit/1a2e77cf9e11dbf56b5720c607313a566eebb16e
    Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 68eb0889fd03fb8e7518aeabb5d2064a01a3cfd3
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Fri Nov 10 11:28:39 2023 -0500

    NFSD: Update nfsd_cache_append() to use xdr_stream
    
    commit 49cecd8628a9855cd993792a0377559ea32d5e7c upstream.
    
    When inserting a DRC-cached response into the reply buffer, ensure
    that the reply buffer's xdr_stream is updated properly. Otherwise
    the server will send a garbage response.
    
    Cc: stable@vger.kernel.org # v6.3+
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Tested-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47a9c946d850671c2492bb0cc20f151a3648a6de
Author: Mahmoud Adam <mngyadam@amazon.com>
Date:   Fri Nov 10 19:21:04 2023 +0100

    nfsd: fix file memleak on client_opens_release
    
    commit bc1b5acb40201a0746d68a7d7cfc141899937f4f upstream.
    
    seq_release should be called to free the allocated seq_file
    
    Cc: stable@vger.kernel.org # v5.3+
    Signed-off-by: Mahmoud Adam <mngyadam@amazon.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Fixes: 78599c42ae3c ("nfsd4: add file to display list of client's opens")
    Reviewed-by: NeilBrown <neilb@suse.de>
    Tested-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5798525216e39d2d7c01b85d4394c5f368ce3dfd
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Fri Nov 17 18:37:25 2023 +0100

    dm-verity: don't use blocking calls from tasklets
    
    commit 28f07f2ab4b3a2714f1fefcc58ada4bcc195f806 upstream.
    
    The commit 5721d4e5a9cd enhanced dm-verity, so that it can verify blocks
    from tasklets rather than from workqueues. This reportedly improves
    performance significantly.
    
    However, dm-verity was using the flag CRYPTO_TFM_REQ_MAY_SLEEP from
    tasklets which resulted in warnings about sleeping function being called
    from non-sleeping context.
    
    BUG: sleeping function called from invalid context at crypto/internal.h:206
    in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 14, name: ksoftirqd/0
    preempt_count: 100, expected: 0
    RCU nest depth: 0, expected: 0
    CPU: 0 PID: 14 Comm: ksoftirqd/0 Tainted: G        W 6.7.0-rc1 #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x32/0x50
     __might_resched+0x110/0x160
     crypto_hash_walk_done+0x54/0xb0
     shash_ahash_update+0x51/0x60
     verity_hash_update.isra.0+0x4a/0x130 [dm_verity]
     verity_verify_io+0x165/0x550 [dm_verity]
     ? free_unref_page+0xdf/0x170
     ? psi_group_change+0x113/0x390
     verity_tasklet+0xd/0x70 [dm_verity]
     tasklet_action_common.isra.0+0xb3/0xc0
     __do_softirq+0xaf/0x1ec
     ? smpboot_thread_fn+0x1d/0x200
     ? sort_range+0x20/0x20
     run_ksoftirqd+0x15/0x30
     smpboot_thread_fn+0xed/0x200
     kthread+0xdc/0x110
     ? kthread_complete_and_exit+0x20/0x20
     ret_from_fork+0x28/0x40
     ? kthread_complete_and_exit+0x20/0x20
     ret_from_fork_asm+0x11/0x20
     </TASK>
    
    This commit fixes dm-verity so that it doesn't use the flags
    CRYPTO_TFM_REQ_MAY_SLEEP and CRYPTO_TFM_REQ_MAY_BACKLOG from tasklets. The
    crypto API would do GFP_ATOMIC allocation instead, it could return -ENOMEM
    and we catch -ENOMEM in verity_tasklet and requeue the request to the
    workqueue.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org      # v6.0+
    Fixes: 5721d4e5a9cd ("dm verity: Add optional "try_verify_in_tasklet" feature")
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5be21d6543a2ff987a022b85fbd5079653f5c982
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Fri Nov 17 18:36:34 2023 +0100

    dm-bufio: fix no-sleep mode
    
    commit 2a695062a5a42aead8c539a344168d4806b3fda2 upstream.
    
    dm-bufio has a no-sleep mode. When activated (with the
    DM_BUFIO_CLIENT_NO_SLEEP flag), the bufio client is read-only and we
    could call dm_bufio_get from tasklets. This is used by dm-verity.
    
    Unfortunately, commit 450e8dee51aa ("dm bufio: improve concurrent IO
    performance") broke this and the kernel would warn that cache_get()
    was calling down_read() from no-sleeping context. The bug can be
    reproduced by using "veritysetup open" with the "--use-tasklets"
    flag.
    
    This commit fixes dm-bufio, so that the tasklet mode works again, by
    expanding use of the 'no_sleep_enabled' static_key to conditionally
    use either a rw_semaphore or rwlock_t (which are colocated in the
    buffer_tree structure using a union).
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org      # v6.4
    Fixes: 450e8dee51aa ("dm bufio: improve concurrent IO performance")
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4aa9db1eab76654aedbebe49d336bf6bc8b397d6
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Thu Sep 14 16:10:58 2023 +0300

    drm/mediatek/dp: fix memory leak on ->get_edid callback error path
    
    commit fcaf9761fd5884a64eaac48536f8c27ecfd2e6bc upstream.
    
    Setting new_edid to NULL leaks the buffer.
    
    Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
    Cc: Markus Schneider-Pargmann <msp@baylibre.com>
    Cc: Guillaume Ranquet <granquet@baylibre.com>
    Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
    Cc: CK Hu <ck.hu@mediatek.com>
    Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Cc: Philipp Zabel <p.zabel@pengutronix.de>
    Cc: Matthias Brugger <matthias.bgg@gmail.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: <stable@vger.kernel.org> # v6.1+
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Reviewed-by: Guillaume Ranquet <granquet@baylibre.com>
    Link: https://patchwork.kernel.org/project/dri-devel/patch/20230914131058.2472260-1-jani.nikula@intel.com/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 658eaf65c3bd186ec1edf2f73b95647b2ce29efa
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Thu Sep 14 18:53:17 2023 +0300

    drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
    
    commit dab12fa8d2bd3868cf2de485ed15a3feef28a13d upstream.
    
    The sads returned by drm_edid_to_sad() needs to be freed.
    
    Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")
    Cc: Guillaume Ranquet <granquet@baylibre.com>
    Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
    Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Cc: Philipp Zabel <p.zabel@pengutronix.de>
    Cc: Matthias Brugger <matthias.bgg@gmail.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: <stable@vger.kernel.org> # v6.1+
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
    Link: https://patchwork.kernel.org/project/dri-devel/patch/20230914155317.2511876-1-jani.nikula@intel.com/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 277fec855bc574c7d45e19862e8b7d07dd58fd36
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Mon Sep 4 15:57:37 2023 +0300

    media: ccs: Correctly initialise try compose rectangle
    
    commit 724ff68e968b19d786870d333f9952bdd6b119cb upstream.
    
    Initialise the try sink compose rectangle size to the sink compose
    rectangle for binner and scaler sub-devices. This was missed due to the
    faulty condition that lead to the compose rectangles to be initialised for
    the pixel array sub-device where it is not relevant.
    
    Fixes: ccfc97bdb5ae ("[media] smiapp: Add driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 648f39454813fcb59ddac09748b65ca1c347f777
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
Date:   Thu Aug 10 07:55:03 2023 +0530

    media: venus: hfi: add checks to handle capabilities from firmware
    
    commit 8d0b89398b7ebc52103e055bf36b60b045f5258f upstream.
    
    The hfi parser, parses the capabilities received from venus firmware and
    copies them to core capabilities. Consider below api, for example,
    fill_caps - In this api, caps in core structure gets updated with the
    number of capabilities received in firmware data payload. If the same api
    is called multiple times, there is a possibility of copying beyond the max
    allocated size in core caps.
    Similar possibilities in fill_raw_fmts and fill_profile_level functions.
    
    Cc: stable@vger.kernel.org
    Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db6bd4724356f4046f7b54dd4443cb272bfec6e8
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
Date:   Thu Aug 10 07:55:02 2023 +0530

    media: venus: hfi: fix the check to handle session buffer requirement
    
    commit b18e36dfd6c935da60a971310374f3dfec3c82e1 upstream.
    
    Buffer requirement, for different buffer type, comes from video firmware.
    While copying these requirements, there is an OOB possibility when the
    payload from firmware is more than expected size. Fix the check to avoid
    the OOB possibility.
    
    Cc: stable@vger.kernel.org
    Fixes: 09c2845e8fe4 ("[media] media: venus: hfi: add Host Firmware Interface (HFI)")
    Reviewed-by: Nathan Hebert <nhebert@chromium.org>
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47b12dc269d7c4d23818ebffdcc170ab39ddc3d4
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
Date:   Thu Aug 10 07:55:04 2023 +0530

    media: venus: hfi_parser: Add check to keep the number of codecs within range
    
    commit 0768a9dd809ef52440b5df7dce5a1c1c7e97abbd upstream.
    
    Supported codec bitmask is populated from the payload from venus firmware.
    There is a possible case when all the bits in the codec bitmask is set. In
    such case, core cap for decoder is filled  and MAX_CODEC_NUM is utilized.
    Now while filling the caps for encoder, it can lead to access the caps
    array beyong 32 index. Hence leading to OOB write.
    The fix counts the supported encoder and decoder. If the count is more than
    max, then it skips accessing the caps.
    
    Cc: stable@vger.kernel.org
    Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e981ecbac55a023ae7bc390c8512c44e41274f12
Author: Sean Young <sean@mess.org>
Date:   Fri Oct 6 12:54:25 2023 +0100

    media: sharp: fix sharp encoding
    
    commit 4f7efc71891462ab7606da7039f480d7c1584a13 upstream.
    
    The Sharp protocol[1] encoding has incorrect timings for bit space.
    
    [1] https://www.sbprojects.net/knowledge/ir/sharp.php
    
    Fixes: d35afc5fe097 ("[media] rc: ir-sharp-decoder: Add encode capability")
    Cc: stable@vger.kernel.org
    Reported-by: Joe Ferner <joe.m.ferner@gmail.com>
    Closes: https://sourceforge.net/p/lirc/mailman/message/38604507/
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 574bdc51e4893855db973308d8fe4d5b7d56ad43
Author: Sean Young <sean@mess.org>
Date:   Fri Oct 6 22:31:52 2023 +0100

    media: lirc: drop trailing space from scancode transmit
    
    commit c8a489f820179fb12251e262b50303c29de991ac upstream.
    
    When transmitting, infrared drivers expect an odd number of samples; iow
    without a trailing space. No problems have been observed so far, so
    this is just belt and braces.
    
    Fixes: 9b6192589be7 ("media: lirc: implement scancode sending")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d83309e7e006cee8afca83523559017c824fbf7a
Author: Jaegeuk Kim <jaegeuk@kernel.org>
Date:   Thu Sep 7 11:11:00 2023 -0700

    f2fs: split initial and dynamic conditions for extent_cache
    
    commit f803982190f0265fd36cf84670aa6daefc2b0768 upstream.
    
    Let's allocate the extent_cache tree without dynamic conditions to avoid a
    missing condition causing a panic as below.
    
     # create a file w/ a compressed flag
     # disable the compression
     # panic while updating extent_cache
    
    F2FS-fs (dm-64): Swapfile: last extent is not aligned to section
    F2FS-fs (dm-64): Swapfile (3) is not align to section: 1) creat(), 2) ioctl(F2FS_IOC_SET_PIN_FILE), 3) fallocate(2097152 * N)
    Adding 124996k swap on ./swap-file.  Priority:0 extents:2 across:17179494468k
    ==================================================================
    BUG: KASAN: null-ptr-deref in instrument_atomic_read_write out/common/include/linux/instrumented.h:101 [inline]
    BUG: KASAN: null-ptr-deref in atomic_try_cmpxchg_acquire out/common/include/asm-generic/atomic-instrumented.h:705 [inline]
    BUG: KASAN: null-ptr-deref in queued_write_lock out/common/include/asm-generic/qrwlock.h:92 [inline]
    BUG: KASAN: null-ptr-deref in __raw_write_lock out/common/include/linux/rwlock_api_smp.h:211 [inline]
    BUG: KASAN: null-ptr-deref in _raw_write_lock+0x5a/0x110 out/common/kernel/locking/spinlock.c:295
    Write of size 4 at addr 0000000000000030 by task syz-executor154/3327
    
    CPU: 0 PID: 3327 Comm: syz-executor154 Tainted: G           O      5.10.185 #1
    Hardware name: emulation qemu-x86/qemu-x86, BIOS 2023.01-21885-gb3cc1cd24d 01/01/2023
    Call Trace:
     __dump_stack out/common/lib/dump_stack.c:77 [inline]
     dump_stack_lvl+0x17e/0x1c4 out/common/lib/dump_stack.c:118
     __kasan_report+0x16c/0x260 out/common/mm/kasan/report.c:415
     kasan_report+0x51/0x70 out/common/mm/kasan/report.c:428
     kasan_check_range+0x2f3/0x340 out/common/mm/kasan/generic.c:186
     __kasan_check_write+0x14/0x20 out/common/mm/kasan/shadow.c:37
     instrument_atomic_read_write out/common/include/linux/instrumented.h:101 [inline]
     atomic_try_cmpxchg_acquire out/common/include/asm-generic/atomic-instrumented.h:705 [inline]
     queued_write_lock out/common/include/asm-generic/qrwlock.h:92 [inline]
     __raw_write_lock out/common/include/linux/rwlock_api_smp.h:211 [inline]
     _raw_write_lock+0x5a/0x110 out/common/kernel/locking/spinlock.c:295
     __drop_extent_tree+0xdf/0x2f0 out/common/fs/f2fs/extent_cache.c:1155
     f2fs_drop_extent_tree+0x17/0x30 out/common/fs/f2fs/extent_cache.c:1172
     f2fs_insert_range out/common/fs/f2fs/file.c:1600 [inline]
     f2fs_fallocate+0x19fd/0x1f40 out/common/fs/f2fs/file.c:1764
     vfs_fallocate+0x514/0x9b0 out/common/fs/open.c:310
     ksys_fallocate out/common/fs/open.c:333 [inline]
     __do_sys_fallocate out/common/fs/open.c:341 [inline]
     __se_sys_fallocate out/common/fs/open.c:339 [inline]
     __x64_sys_fallocate+0xb8/0x100 out/common/fs/open.c:339
     do_syscall_64+0x35/0x50 out/common/arch/x86/entry/common.c:46
    
    Cc: stable@vger.kernel.org
    Fixes: 72840cccc0a1 ("f2fs: allocate the extent_cache by default")
    Reported-and-tested-by: syzbot+d342e330a37b48c094b7@syzkaller.appspotmail.com
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3eebe636cac53886bd5d1cdd55e082ec9e84983f
Author: Su Hui <suhui@nfschina.com>
Date:   Sun Oct 8 14:39:30 2023 +0800

    f2fs: avoid format-overflow warning
    
    commit e0d4e8acb3789c5a8651061fbab62ca24a45c063 upstream.
    
    With gcc and W=1 option, there's a warning like this:
    
    fs/f2fs/compress.c: In function ‘f2fs_init_page_array_cache’:
    fs/f2fs/compress.c:1984:47: error: ‘%u’ directive writing between
    1 and 7 bytes into a region of size between 5 and 8
    [-Werror=format-overflow=]
     1984 |  sprintf(slab_name, "f2fs_page_array_entry-%u:%u", MAJOR(dev),
                    MINOR(dev));
          |                                               ^~
    
    String "f2fs_page_array_entry-%u:%u" can up to 35. The first "%u" can up
    to 4 and the second "%u" can up to 7, so total size is "24 + 4 + 7 = 35".
    slab_name's size should be 35 rather than 32.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Su Hui <suhui@nfschina.com>
    Reviewed-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 00de7280a5156f356d6ec3d50f448b6df244b146
Author: Jaegeuk Kim <jaegeuk@kernel.org>
Date:   Fri Sep 8 15:41:42 2023 -0700

    f2fs: set the default compress_level on ioctl
    
    commit f5f3bd903a5d3e3b2ba89f11e0e29db25e60c048 upstream.
    
    Otherwise, we'll get a broken inode.
    
     # touch $FILE
     # f2fs_io setflags compression $FILE
     # f2fs_io set_coption 2 8 $FILE
    
    [  112.227612] F2FS-fs (dm-51): sanity_check_compress_inode: inode (ino=8d3fe) has unsupported compress level: 0, run fsck to fix
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9de9f078bdf58e70653f9db91abf7dd9f87bf98b
Author: Jaegeuk Kim <jaegeuk@kernel.org>
Date:   Thu Oct 19 15:51:08 2023 -0700

    f2fs: do not return EFSCORRUPTED, but try to run online repair
    
    commit 50a472bbc79ff9d5a88be8019a60e936cadf9f13 upstream.
    
    If we return the error, there's no way to recover the status as of now, since
    fsck does not fix the xattr boundary issue.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 74ee67b1a776db627a9f6766b1a09b10dfe66528
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Sat Sep 9 22:25:06 2023 +0200

    i2c: i801: fix potential race in i801_block_transaction_byte_by_byte
    
    commit f78ca48a8ba9cdec96e8839351e49eec3233b177 upstream.
    
    Currently we set SMBHSTCNT_LAST_BYTE only after the host has started
    receiving the last byte. If we get e.g. preempted before setting
    SMBHSTCNT_LAST_BYTE, the host may be finished with receiving the byte
    before SMBHSTCNT_LAST_BYTE is set.
    Therefore change the code to set SMBHSTCNT_LAST_BYTE before writing
    SMBHSTSTS_BYTE_DONE for the byte before the last byte. Now the code
    is also consistent with what we do in i801_isr_byte_done().
    
    Reported-by: Jean Delvare <jdelvare@suse.com>
    Closes: https://lore.kernel.org/linux-i2c/20230828152747.09444625@endymion.delvare/
    Cc: stable@vger.kernel.org
    Acked-by: Andi Shyti <andi.shyti@kernel.org>
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Reviewed-by: Jean Delvare <jdelvare@suse.de>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c7e9a848265c7ba991ee9bf9e0d3aef8d57fbfdf
Author: Andreas Gruenbacher <agruenba@redhat.com>
Date:   Thu Nov 2 20:52:30 2023 +0100

    gfs2: don't withdraw if init_threads() got interrupted
    
    commit 0cdc6f44e9fdc2d20d720145bf99a39f611f6d61 upstream.
    
    In gfs2_fill_super(), when mounting a gfs2 filesystem is interrupted,
    kthread_create() can return -EINTR.  When that happens, we roll back
    what has already been done and abort the mount.
    
    Since commit 62dd0f98a0e5 ("gfs2: Flag a withdraw if init_threads()
    fails), we are calling gfs2_withdraw_delayed() in gfs2_fill_super();
    first via gfs2_make_fs_rw(), then directly.  But gfs2_withdraw_delayed()
    only marks the filesystem as withdrawing and relies on a caller further
    up the stack to do the actual withdraw, which doesn't exist in the
    gfs2_fill_super() case.  Because the filesystem is marked as withdrawing
    / withdrawn, function gfs2_lm_unmount() doesn't release the dlm
    lockspace, so when we try to mount that filesystem again, we get:
    
        gfs2: fsid=gohan:gohan0: Trying to join cluster "lock_dlm", "gohan:gohan0"
        gfs2: fsid=gohan:gohan0: dlm_new_lockspace error -17
    
    Since commit b77b4a4815a9 ("gfs2: Rework freeze / thaw logic"), the
    deadlock this gfs2_withdraw_delayed() call was supposed to work around
    cannot occur anymore because freeze_go_callback() won't take the
    sb->s_umount semaphore unconditionally anymore, so we can get rid of the
    gfs2_withdraw_delayed() in gfs2_fill_super() entirely.
    
    Reported-by: Alexander Aring <aahringo@redhat.com>
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Cc: stable@vger.kernel.org # v6.5+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d0bbeafd82eac165c38242b1a928b86de7316df
Author: Klaus Kudielka <klaus.kudielka@gmail.com>
Date:   Tue Nov 7 18:44:02 2023 +0100

    net: phylink: initialize carrier state at creation
    
    commit 02d5fdbf4f2b8c406f7a4c98fa52aa181a11d733 upstream.
    
    Background: Turris Omnia (Armada 385); eth2 (mvneta) connected to SFP bus;
    SFP module is present, but no fiber connected, so definitely no carrier.
    
    After booting, eth2 is down, but netdev LED trigger surprisingly reports
    link active. Then, after "ip link set eth2 up", the link indicator goes
    away - as I would have expected it from the beginning.
    
    It turns out, that the default carrier state after netdev creation is
    "carrier ok". Some ethernet drivers explicitly call netif_carrier_off
    during probing, others (like mvneta) don't - which explains the current
    behaviour: only when the device is brought up, phylink_start calls
    netif_carrier_off.
    
    Fix this for all drivers using phylink, by calling netif_carrier_off in
    phylink_create.
    
    Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
    Cc: stable@vger.kernel.org
    Suggested-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4517b1594fb03b9ca3a1edab9abef05ed5185cce
Author: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Date:   Fri Oct 27 08:57:38 2023 +0200

    net: dsa: lan9303: consequently nested-lock physical MDIO
    
    commit 5a22fbcc10f3f7d94c5d88afbbffa240a3677057 upstream.
    
    When LAN9303 is MDIO-connected two callchains exist into
    mdio->bus->write():
    
    1. switch ports 1&2 ("physical" PHYs):
    
    virtual (switch-internal) MDIO bus (lan9303_switch_ops->phy_{read|write})->
      lan9303_mdio_phy_{read|write} -> mdiobus_{read|write}_nested
    
    2. LAN9303 virtual PHY:
    
    virtual MDIO bus (lan9303_phy_{read|write}) ->
      lan9303_virt_phy_reg_{read|write} -> regmap -> lan9303_mdio_{read|write}
    
    If the latter functions just take
    mutex_lock(&sw_dev->device->bus->mdio_lock) it triggers a LOCKDEP
    false-positive splat. It's false-positive because the first
    mdio_lock in the second callchain above belongs to virtual MDIO bus, the
    second mdio_lock belongs to physical MDIO bus.
    
    Consequent annotation in lan9303_mdio_{read|write} as nested lock
    (similar to lan9303_mdio_phy_{read|write}, it's the same physical MDIO bus)
    prevents the following splat:
    
    WARNING: possible circular locking dependency detected
    5.15.71 #1 Not tainted
    ------------------------------------------------------
    kworker/u4:3/609 is trying to acquire lock:
    ffff000011531c68 (lan9303_mdio:131:(&lan9303_mdio_regmap_config)->lock){+.+.}-{3:3}, at: regmap_lock_mutex
    but task is already holding lock:
    ffff0000114c44d8 (&bus->mdio_lock){+.+.}-{3:3}, at: mdiobus_read
    which lock already depends on the new lock.
    the existing dependency chain (in reverse order) is:
    -> #1 (&bus->mdio_lock){+.+.}-{3:3}:
           lock_acquire
           __mutex_lock
           mutex_lock_nested
           lan9303_mdio_read
           _regmap_read
           regmap_read
           lan9303_probe
           lan9303_mdio_probe
           mdio_probe
           really_probe
           __driver_probe_device
           driver_probe_device
           __device_attach_driver
           bus_for_each_drv
           __device_attach
           device_initial_probe
           bus_probe_device
           deferred_probe_work_func
           process_one_work
           worker_thread
           kthread
           ret_from_fork
    -> #0 (lan9303_mdio:131:(&lan9303_mdio_regmap_config)->lock){+.+.}-{3:3}:
           __lock_acquire
           lock_acquire.part.0
           lock_acquire
           __mutex_lock
           mutex_lock_nested
           regmap_lock_mutex
           regmap_read
           lan9303_phy_read
           dsa_slave_phy_read
           __mdiobus_read
           mdiobus_read
           get_phy_device
           mdiobus_scan
           __mdiobus_register
           dsa_register_switch
           lan9303_probe
           lan9303_mdio_probe
           mdio_probe
           really_probe
           __driver_probe_device
           driver_probe_device
           __device_attach_driver
           bus_for_each_drv
           __device_attach
           device_initial_probe
           bus_probe_device
           deferred_probe_work_func
           process_one_work
           worker_thread
           kthread
           ret_from_fork
    other info that might help us debug this:
     Possible unsafe locking scenario:
           CPU0                    CPU1
           ----                    ----
      lock(&bus->mdio_lock);
                                   lock(lan9303_mdio:131:(&lan9303_mdio_regmap_config)->lock);
                                   lock(&bus->mdio_lock);
      lock(lan9303_mdio:131:(&lan9303_mdio_regmap_config)->lock);
    *** DEADLOCK ***
    5 locks held by kworker/u4:3/609:
     #0: ffff000002842938 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work
     #1: ffff80000bacbd60 (deferred_probe_work){+.+.}-{0:0}, at: process_one_work
     #2: ffff000007645178 (&dev->mutex){....}-{3:3}, at: __device_attach
     #3: ffff8000096e6e78 (dsa2_mutex){+.+.}-{3:3}, at: dsa_register_switch
     #4: ffff0000114c44d8 (&bus->mdio_lock){+.+.}-{3:3}, at: mdiobus_read
    stack backtrace:
    CPU: 1 PID: 609 Comm: kworker/u4:3 Not tainted 5.15.71 #1
    Workqueue: events_unbound deferred_probe_work_func
    Call trace:
     dump_backtrace
     show_stack
     dump_stack_lvl
     dump_stack
     print_circular_bug
     check_noncircular
     __lock_acquire
     lock_acquire.part.0
     lock_acquire
     __mutex_lock
     mutex_lock_nested
     regmap_lock_mutex
     regmap_read
     lan9303_phy_read
     dsa_slave_phy_read
     __mdiobus_read
     mdiobus_read
     get_phy_device
     mdiobus_scan
     __mdiobus_register
     dsa_register_switch
     lan9303_probe
     lan9303_mdio_probe
    ...
    
    Cc: stable@vger.kernel.org
    Fixes: dc7005831523 ("net: dsa: LAN9303: add MDIO managed mode support")
    Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20231027065741.534971-1-alexander.sverdlin@siemens.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 73e80544954402203bc2448a2b6023377392fdab
Author: Andrew Lunn <andrew@lunn.ch>
Date:   Sat Oct 28 21:25:11 2023 +0200

    net: ethtool: Fix documentation of ethtool_sprintf()
    
    commit f55d8e60f10909dbc5524e261041e1d28d7d20d8 upstream.
    
    This function takes a pointer to a pointer, unlike sprintf() which is
    passed a plain pointer. Fix up the documentation to make this clear.
    
    Fixes: 7888fe53b706 ("ethtool: Add common function for filling out strings")
    Cc: Alexander Duyck <alexanderduyck@fb.com>
    Cc: Justin Stitt <justinstitt@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Justin Stitt <justinstitt@google.com>
    Link: https://lore.kernel.org/r/20231028192511.100001-1-andrew@lunn.ch
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 553a485d8d852d7cdc643ad70d3813e4ae9fe94c
Author: Harald Freudenberger <freude@linux.ibm.com>
Date:   Mon Oct 23 09:57:10 2023 +0200

    s390/ap: fix AP bus crash on early config change callback invocation
    
    commit e14aec23025eeb1f2159ba34dbc1458467c4c347 upstream.
    
    Fix kernel crash in AP bus code caused by very early invocation of the
    config change callback function via SCLP.
    
    After a fresh IML of the machine the crypto cards are still offline and
    will get switched online only with activation of any LPAR which has the
    card in it's configuration. A crypto card coming online is reported
    to the LPAR via SCLP and the AP bus offers a callback function to get
    this kind of information. However, it may happen that the callback is
    invoked before the AP bus init function is complete. As the callback
    triggers a synchronous AP bus scan, the scan may already run but some
    internal states are not initialized by the AP bus init function resulting
    in a crash like this:
    
      [   11.635859] Unable to handle kernel pointer dereference in virtual kernel address space
      [   11.635861] Failing address: 0000000000000000 TEID: 0000000000000887
      [   11.635862] Fault in home space mode while using kernel ASCE.
      [   11.635864] AS:00000000894c4007 R3:00000001fece8007 S:00000001fece7800 P:000000000000013d
      [   11.635879] Oops: 0004 ilc:1 [#1] SMP
      [   11.635882] Modules linked in:
      [   11.635884] CPU: 5 PID: 42 Comm: kworker/5:0 Not tainted 6.6.0-rc3-00003-g4dbf7cdc6b42 #12
      [   11.635886] Hardware name: IBM 3931 A01 751 (LPAR)
      [   11.635887] Workqueue: events_long ap_scan_bus
      [   11.635891] Krnl PSW : 0704c00180000000 0000000000000000 (0x0)
      [   11.635895]            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
      [   11.635897] Krnl GPRS: 0000000001000a00 0000000000000000 0000000000000006 0000000089591940
      [   11.635899]            0000000080000000 0000000000000a00 0000000000000000 0000000000000000
      [   11.635901]            0000000081870c00 0000000089591000 000000008834e4e2 0000000002625a00
      [   11.635903]            0000000081734200 0000038000913c18 000000008834c6d6 0000038000913ac8
      [   11.635906] Krnl Code:>0000000000000000: 0000                illegal
      [   11.635906]            0000000000000002: 0000                illegal
      [   11.635906]            0000000000000004: 0000                illegal
      [   11.635906]            0000000000000006: 0000                illegal
      [   11.635906]            0000000000000008: 0000                illegal
      [   11.635906]            000000000000000a: 0000                illegal
      [   11.635906]            000000000000000c: 0000                illegal
      [   11.635906]            000000000000000e: 0000                illegal
      [   11.635915] Call Trace:
      [   11.635916]  [<0000000000000000>] 0x0
      [   11.635918]  [<000000008834e4e2>] ap_queue_init_state+0x82/0xb8
      [   11.635921]  [<000000008834ba1c>] ap_scan_domains+0x6fc/0x740
      [   11.635923]  [<000000008834c092>] ap_scan_adapter+0x632/0x8b0
      [   11.635925]  [<000000008834c3e4>] ap_scan_bus+0xd4/0x288
      [   11.635927]  [<00000000879a33ba>] process_one_work+0x19a/0x410
      [   11.635930] Discipline DIAG cannot be used without z/VM
      [   11.635930]  [<00000000879a3a2c>] worker_thread+0x3fc/0x560
      [   11.635933]  [<00000000879aea60>] kthread+0x120/0x128
      [   11.635936]  [<000000008792afa4>] __ret_from_fork+0x3c/0x58
      [   11.635938]  [<00000000885ebe62>] ret_from_fork+0xa/0x30
      [   11.635942] Last Breaking-Event-Address:
      [   11.635942]  [<000000008834c6d4>] ap_wait+0xcc/0x148
    
    This patch improves the ap_bus_force_rescan() function which is
    invoked by the config change callback by checking if a first
    initial AP bus scan has been done. If not, the force rescan request
    is simple ignored. Anyhow it does not make sense to trigger AP bus
    re-scans even before the very first bus scan is complete.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
    Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b382f69317efb2578ef327d3eb413ea983cac9e6
Author: Tam Nguyen <tamnguyenchi@os.amperecomputing.com>
Date:   Thu Nov 2 10:30:08 2023 +0700

    i2c: designware: Disable TX_EMPTY irq while waiting for block length byte
    
    commit e8183fa10c25c7b3c20670bf2b430ddcc1ee03c0 upstream.
    
    During SMBus block data read process, we have seen high interrupt rate
    because of TX_EMPTY irq status while waiting for block length byte (the
    first data byte after the address phase). The interrupt handler does not
    do anything because the internal state is kept as STATUS_WRITE_IN_PROGRESS.
    Hence, we should disable TX_EMPTY IRQ until I2C DesignWare receives
    first data byte from I2C device, then re-enable it to resume SMBus
    transaction.
    
    It takes 0.789 ms for host to receive data length from slave.
    Without the patch, i2c_dw_isr() is called 99 times by TX_EMPTY interrupt.
    And it is none after applying the patch.
    
    Cc: stable@vger.kernel.org
    Co-developed-by: Chuong Tran <chuong@os.amperecomputing.com>
    Signed-off-by: Chuong Tran <chuong@os.amperecomputing.com>
    Signed-off-by: Tam Nguyen <tamnguyenchi@os.amperecomputing.com>
    Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 16da1e7c64c21768bcacfd9e6db7c66b0ae29c41
Author: Darren Hart <darren@os.amperecomputing.com>
Date:   Thu Sep 21 02:02:36 2023 -0700

    sbsa_gwdt: Calculate timeout with 64-bit math
    
    commit 5d6aa89bba5bd6af2580f872b57f438dab883738 upstream.
    
    Commit abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
    introduced new timer math for watchdog revision 1 with the 48 bit offset
    register.
    
    The gwdt->clk and timeout are u32, but the argument being calculated is
    u64. Without a cast, the compiler performs u32 operations, truncating
    intermediate steps, resulting in incorrect values.
    
    A watchdog revision 1 implementation with a gwdt->clk of 1GHz and a
    timeout of 600s writes 3647256576 to the one shot watchdog instead of
    300000000000, resulting in the watchdog firing in 3.6s instead of 600s.
    
    Force u64 math by casting the first argument (gwdt->clk) as a u64. Make
    the order of operations explicit with parenthesis.
    
    Fixes: abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
    Reported-by: Vanshidhar Konda <vanshikonda@os.amperecomputing.com>
    Signed-off-by: Darren Hart <darren@os.amperecomputing.com>
    Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: <stable@vger.kernel.org> # 5.14.x
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/7d1713c5ffab19b0f3de796d82df19e8b1f340de.1695286124.git.darren@os.amperecomputing.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 37dab33f754abd24b384d2b7b07349dc6611381b
Author: Ondrej Mosnacek <omosnace@redhat.com>
Date:   Tue Oct 31 13:32:07 2023 +0100

    lsm: fix default return value for inode_getsecctx
    
    commit b36995b8609a5a8fe5cf259a1ee768fcaed919f8 upstream.
    
    -EOPNOTSUPP is the return value that implements a "no-op" hook, not 0.
    
    Without this fix having only the BPF LSM enabled (with no programs
    attached) can cause uninitialized variable reads in
    nfsd4_encode_fattr(), because the BPF hook returns 0 without touching
    the 'ctxlen' variable and the corresponding 'contextlen' variable in
    nfsd4_encode_fattr() remains uninitialized, yet being treated as valid
    based on the 0 return value.
    
    Cc: stable@vger.kernel.org
    Fixes: 98e828a0650f ("security: Refactor declaration of LSM hooks")
    Reported-by: Benjamin Coddington <bcodding@redhat.com>
    Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 64d84030ff5ebd48d87c4ea136894d42a40347d8
Author: Ondrej Mosnacek <omosnace@redhat.com>
Date:   Tue Oct 31 13:32:06 2023 +0100

    lsm: fix default return value for vm_enough_memory
    
    commit 866d648059d5faf53f1cd960b43fe8365ad93ea7 upstream.
    
    1 is the return value that implements a "no-op" hook, not 0.
    
    Cc: stable@vger.kernel.org
    Fixes: 98e828a0650f ("security: Refactor declaration of LSM hooks")
    Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ff4d0309780c9c40121206b446605ba18c31e675
Author: Robert Marko <robert.marko@sartura.hr>
Date:   Fri Nov 10 10:30:11 2023 +0100

    Revert "i2c: pxa: move to generic GPIO recovery"
    
    commit 7b211c7671212cad0b83603c674838c7e824d845 upstream.
    
    This reverts commit 0b01392c18b9993a584f36ace1d61118772ad0ca.
    
    Conversion of PXA to generic I2C recovery, makes the I2C bus completely
    lock up if recovery pinctrl is present in the DT and I2C recovery is
    enabled.
    
    So, until the generic I2C recovery can also work with PXA lets revert
    to have working I2C and I2C recovery again.
    
    Signed-off-by: Robert Marko <robert.marko@sartura.hr>
    Cc: stable@vger.kernel.org # 5.11+
    Acked-by: Andi Shyti <andi.shyti@kernel.org>
    Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Acked-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a67593893440cf0cd7fa16001a7f23cfdedb99d
Author: Johnathan Mantey <johnathanx.mantey@intel.com>
Date:   Mon Nov 13 08:30:29 2023 -0800

    Revert ncsi: Propagate carrier gain/loss events to the NCSI controller
    
    commit 9e2e7efbbbff69d8340abb56d375dd79d1f5770f upstream.
    
    This reverts commit 3780bb29311eccb7a1c9641032a112eed237f7e3.
    
    The cited commit introduced unwanted behavior.
    
    The intent for the commit was to be able to detect carrier loss/gain
    for just the NIC connected to the BMC. The unwanted effect is a
    carrier loss for auxiliary paths also causes the BMC to lose
    carrier. The BMC never regains carrier despite the secondary NIC
    regaining a link.
    
    This change, when merged, needs to be backported to stable kernels.
    5.4-stable, 5.10-stable, 5.15-stable, 6.1-stable, 6.5-stable
    
    Fixes: 3780bb29311e ("ncsi: Propagate carrier gain/loss events to the NCSI controller")
    CC: stable@vger.kernel.org
    Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6f47efb241e7d06ec7d327d3b39565ca026200f6
Author: Stefan Binding <sbinding@opensource.cirrus.com>
Date:   Wed Nov 15 16:21:16 2023 +0000

    ALSA: hda/realtek: Add quirks for HP Laptops
    
    commit 5d639b60971f003d3a9b2b31f8ec73b0718b5d57 upstream.
    
    These HP laptops use Realtek HDA codec combined with 2 or 4 CS35L41
    Amplifiers using SPI with Internal Boost.
    
    Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20231115162116.494968-3-sbinding@opensource.cirrus.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 661cd04d5922e1f7da0631c36d1cf28dc43149f3
Author: Matus Malych <matus@malych.org>
Date:   Tue Nov 14 14:35:25 2023 +0100

    ALSA: hda/realtek: Enable Mute LED on HP 255 G10
    
    commit b944aa9d86d5f782bfe5e51336434c960304839c upstream.
    
    HP 255 G10 has a mute LED that can be made to work using quirk
    ALC236_FIXUP_HP_MUTE_LED_COEFBIT2.
    Enable already existing quirk - at correct line to keep order
    
    Signed-off-by: Matus Malych <matus@malych.org>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20231114133524.11340-1-matus@malych.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d4176c66f7a955ddabf1de613fa4e52f8763d19e
Author: Chandradeep Dey <codesigning@chandradeepdey.com>
Date:   Sat Nov 11 19:25:49 2023 +0100

    ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC
    
    commit 713f040cd22285fcc506f40a0d259566e6758c3c upstream.
    
    Apply the already existing quirk chain ALC294_FIXUP_ASUS_SPK to enable
    the internal speaker of ASUS K6500ZC.
    
    Signed-off-by: Chandradeep Dey <codesigning@chandradeepdey.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/NizcVHQ--3-9@chandradeepdey.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c2269161387bb6a98a19ac69c6e2c6935fb07815
Author: Kailang Yang <kailang@realtek.com>
Date:   Fri Nov 10 15:16:06 2023 +0800

    ALSA: hda/realtek - Add Dell ALC295 to pin fall back table
    
    commit 4b21a669ca21ed8f24ef4530b2918be5730114de upstream.
    
    Add ALC295 to pin fall back table.
    Remove 5 pin quirks for Dell ALC295.
    ALC295 was only support MIC2 for external MIC function.
    ALC295 assigned model "ALC269_FIXUP_DELL1_MIC_NO_PRESENCE" for pin
    fall back table.
    It was assigned wrong model. So, let's remove it.
    
    Fixes: fbc571290d9f ("ALSA: hda/realtek - Fixed Headphone Mic can't record on Dell platform")
    Signed-off-by: Kailang Yang <kailang@realtek.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/7c1998e873834df98d59bd7e0d08c72e@realtek.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a2650aec825fa61a4532a9d621fa3da0ccc8d89c
Author: Eymen Yigit <eymenyg01@gmail.com>
Date:   Fri Nov 10 18:07:15 2023 +0300

    ALSA: hda/realtek: Enable Mute LED on HP 255 G8
    
    commit 8384c0baf223e1c3bc7b1c711d80a4c6106d210e upstream.
    
    This HP Notebook uses ALC236 codec with COEF 0x07 idx 1 controlling
    the mute LED. Enable already existing quirk for this device.
    
    Signed-off-by: Eymen Yigit <eymenyg01@gmail.com>
    Cc: Luka Guzenko <l.guzenko@web.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20231110150715.5141-1-eymenyg01@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2dac108b9dd7fa08450750dec10ba5db429c8817
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Nov 9 15:19:54 2023 +0100

    ALSA: info: Fix potential deadlock at disconnection
    
    commit c7a60651953359f98dbf24b43e1bf561e1573ed4 upstream.
    
    As reported recently, ALSA core info helper may cause a deadlock at
    the forced device disconnection during the procfs operation.
    
    The proc_remove() (that is called from the snd_card_disconnect()
    helper) has a synchronization of the pending procfs accesses via
    wait_for_completion().  Meanwhile, ALSA procfs helper takes the global
    mutex_lock(&info_mutex) at both the proc_open callback and
    snd_card_info_disconnect() helper.  Since the proc_open can't finish
    due to the mutex lock, wait_for_completion() never returns, either,
    hence it deadlocks.
    
            TASK#1                          TASK#2
            proc_reg_open()
              takes use_pde()
            snd_info_text_entry_open()
                                            snd_card_disconnect()
                                            snd_info_card_disconnect()
                                              takes mutex_lock(&info_mutex)
                                            proc_remove()
                                            wait_for_completion(unused_pde)
                                              ... waiting task#1 closes
            mutex_lock(&info_mutex)
                    => DEADLOCK
    
    This patch is a workaround for avoiding the deadlock scenario above.
    
    The basic strategy is to move proc_remove() call outside the mutex
    lock.  proc_remove() can work gracefully without extra locking, and it
    can delete the tree recursively alone.  So, we call proc_remove() at
    snd_info_card_disconnection() at first, then delete the rest resources
    recursively within the info_mutex lock.
    
    After the change, the function snd_info_disconnect() doesn't do
    disconnection by itself any longer, but it merely clears the procfs
    pointer.  So rename the function to snd_info_clear_entries() for
    avoiding confusion.
    
    The similar change is applied to snd_info_free_entry(), too.  Since
    the proc_remove() is called only conditionally with the non-NULL
    entry->p, it's skipped after the snd_info_clear_entries() call.
    
    Reported-by: Shinhyung Kang <s47.kang@samsung.com>
    Closes: https://lore.kernel.org/r/664457955.21699345385931.JavaMail.epsvc@epcpadp4
    Reviewed-by: Jaroslav Kysela <perex@perex.cz>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20231109141954.4283-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 23c73538752b0c30ad54e3f35495a2c7452a4f3d
Author: Naohiro Aota <naohiro.aota@wdc.com>
Date:   Tue Oct 17 17:00:31 2023 +0900

    btrfs: zoned: wait for data BG to be finished on direct IO allocation
    
    commit 776a838f1fa95670c1c1cf7109a898090b473fa3 upstream.
    
    Running the fio command below on a ZNS device results in "Resource
    temporarily unavailable" error.
    
      $ sudo fio --name=w --directory=/mnt --filesize=1GB --bs=16MB --numjobs=16 \
            --rw=write --ioengine=libaio --iodepth=128 --direct=1
    
      fio: io_u error on file /mnt/w.2.0: Resource temporarily unavailable: write offset=117440512, buflen=16777216
      fio: io_u error on file /mnt/w.2.0: Resource temporarily unavailable: write offset=134217728, buflen=16777216
      ...
    
    This happens because -EAGAIN error returned from btrfs_reserve_extent()
    called from btrfs_new_extent_direct() is spilling over to the userland.
    
    btrfs_reserve_extent() returns -EAGAIN when there is no active zone
    available. Then, the caller should wait for some other on-going IO to
    finish a zone and retry the allocation.
    
    This logic is already implemented for buffered write in cow_file_range(),
    but it is missing for the direct IO counterpart. Implement the same logic
    for it.
    
    Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
    Fixes: 2ce543f47843 ("btrfs: zoned: wait until zone is finished when allocation didn't progress")
    CC: stable@vger.kernel.org # 6.1+
    Tested-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 024fe6a4ca845bcdc7d0a71ce9d2ced97ff93b97
Author: Dave Chinner <dchinner@redhat.com>
Date:   Fri Nov 10 15:33:14 2023 +1100

    xfs: recovery should not clear di_flushiter unconditionally
    
    commit 7930d9e103700cde15833638855b750715c12091 upstream.
    
    Because on v3 inodes, di_flushiter doesn't exist. It overlaps with
    zero padding in the inode, except when NREXT64=1 configurations are
    in use and the zero padding is no longer padding but holds the 64
    bit extent counter.
    
    This manifests obviously on big endian platforms (e.g. s390) because
    the log dinode is in host order and the overlap is the LSBs of the
    extent count field. It is not noticed on little endian machines
    because the overlap is at the MSB end of the extent count field and
    we need to get more than 2^^48 extents in the inode before it
    manifests. i.e. the heat death of the universe will occur before we
    see the problem in little endian machines.
    
    This is a zero-day issue for NREXT64=1 configuraitons on big endian
    machines. Fix it by only clearing di_flushiter on v2 inodes during
    recovery.
    
    Fixes: 9b7d16e34bbe ("xfs: Introduce XFS_DIFLAG2_NREXT64 and associated helpers")
    cc: stable@kernel.org # 5.19+
    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c00e422bf3dea146cd02e7f4bea951a66f4646e
Author: David Howells <dhowells@redhat.com>
Date:   Mon Nov 6 14:40:11 2023 +0000

    cifs: Fix encryption of cleared, but unset rq_iter data buffers
    
    commit 37de5a80e932f828c34abeaae63170d73930dca3 upstream.
    
    Each smb_rqst struct contains two things: an array of kvecs (rq_iov) that
    contains the protocol data for an RPC op and an iterator (rq_iter) that
    contains the data payload of an RPC op.  When an smb_rqst is allocated
    rq_iter is it always cleared, but we don't set it up unless we're going to
    use it.
    
    The functions that determines the size of the ciphertext buffer that will
    be needed to encrypt a request, cifs_get_num_sgs(), assumes that rq_iter is
    always initialised - and employs user_backed_iter() to check that the
    iterator isn't user-backed.  This used to incidentally work, because
    ->user_backed was set to false because the iterator has never been
    initialised, but with commit f1b4cb650b9a0eeba206d8f069fcdc532bfbcd74[1]
    which changes user_backed_iter() to determine this based on the iterator
    type insted, a warning is now emitted:
    
            WARNING: CPU: 7 PID: 4584 at fs/smb/client/cifsglob.h:2165 smb2_get_aead_req+0x3fc/0x420 [cifs]
            ...
            RIP: 0010:smb2_get_aead_req+0x3fc/0x420 [cifs]
            ...
             crypt_message+0x33e/0x550 [cifs]
             smb3_init_transform_rq+0x27d/0x3f0 [cifs]
             smb_send_rqst+0xc7/0x160 [cifs]
             compound_send_recv+0x3ca/0x9f0 [cifs]
             cifs_send_recv+0x25/0x30 [cifs]
             SMB2_tcon+0x38a/0x820 [cifs]
             cifs_get_smb_ses+0x69c/0xee0 [cifs]
             cifs_mount_get_session+0x76/0x1d0 [cifs]
             dfs_mount_share+0x74/0x9d0 [cifs]
             cifs_mount+0x6e/0x2e0 [cifs]
             cifs_smb3_do_mount+0x143/0x300 [cifs]
             smb3_get_tree+0x15e/0x290 [cifs]
             vfs_get_tree+0x2d/0xe0
             do_new_mount+0x124/0x340
             __se_sys_mount+0x143/0x1a0
    
    The problem is that rq_iter was never set, so the type is 0 (ie. ITER_UBUF)
    which causes user_backed_iter() to return true.  The code doesn't
    malfunction because it checks the size of the iterator - which is 0.
    
    Fix cifs_get_num_sgs() to ignore rq_iter if its count is 0, thereby
    bypassing the warnings.
    
    It might be better to explicitly initialise rq_iter to a zero-length
    ITER_BVEC, say, as it can always be reinitialised later.
    
    Fixes: d08089f649a0 ("cifs: Change the I/O paths to use an iterator rather than a page list")
    Reported-by: Damian Tometzki <damian@riscv-rocks.de>
    Closes: https://lore.kernel.org/r/ZUfQo47uo0p2ZsYg@fedora.fritz.box/
    Tested-by: Damian Tometzki <damian@riscv-rocks.de>
    Cc: stable@vger.kernel.org
    cc: Eric Biggers <ebiggers@kernel.org>
    cc: linux-cifs@vger.kernel.org
    cc: linux-fsdevel@vger.kernel.org
    Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f1b4cb650b9a0eeba206d8f069fcdc532bfbcd74 [1]
    Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 739bf98ce9deebbd12000cba81d2b48ee1d009de
Author: Shyam Prasad N <sprasad@microsoft.com>
Date:   Mon Nov 6 16:22:11 2023 +0000

    cifs: do not pass cifs_sb when trying to add channels
    
    commit 9599d59eb8fc0c0fd9480c4f22901533d08965ee upstream.
    
    The only reason why cifs_sb gets passed today to cifs_try_adding_channels
    is to pass the local_nls field for the new channels and binding session.
    However, the ses struct already has local_nls field that is setup during
    the first cifs_setup_session. So there is no need to pass cifs_sb.
    
    This change removes cifs_sb from the arg list for this and the functions
    that it calls and uses ses->local_nls instead.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
    Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 328004e6df5a9a8692e4ee04b3330b6b8931dba2
Author: Shyam Prasad N <sprasad@microsoft.com>
Date:   Mon Oct 30 11:00:10 2023 +0000

    cifs: do not reset chan_max if multichannel is not supported at mount
    
    commit 6e5e64c9477d58e73cb1a0e83eacad1f8df247cf upstream.
    
    If the mount command has specified multichannel as a mount option,
    but multichannel is found to be unsupported by the server at the time
    of mount, we set chan_max to 1. Which means that the user needs to
    remount the share if the server starts supporting multichannel.
    
    This change removes this reset. What it means is that if the user
    specified multichannel or max_channels during mount, and at this
    time, multichannel is not supported, but the server starts supporting
    it at a later point, the client will be capable of scaling out the
    number of channels.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit aabf4851d1605523be8f2518e6a549f3f080e198
Author: Shyam Prasad N <sprasad@microsoft.com>
Date:   Mon Oct 30 11:00:11 2023 +0000

    cifs: force interface update before a fresh session setup
    
    commit d9a6d78096056a3cb5c5f07a730ab92f2f9ac4e6 upstream.
    
    During a session reconnect, it is possible that the
    server moved to another physical server (happens in case
    of Azure files). So at this time, force a query of server
    interfaces again (in case of multichannel session), such
    that the secondary channels connect to the right
    IP addresses (possibly updated now).
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e42c5730c14a92ab597f24467b17cc10cf31979e
Author: Shyam Prasad N <sprasad@microsoft.com>
Date:   Mon Oct 30 11:00:09 2023 +0000

    cifs: reconnect helper should set reconnect for the right channel
    
    commit c3326a61cdbf3ce1273d9198b6cbf90965d7e029 upstream.
    
    We introduced a helper function to be used by non-cifsd threads to
    mark the connection for reconnect. For multichannel, when only
    a particular channel needs to be reconnected, this had a bug.
    
    This change fixes that by marking that particular channel
    for reconnect.
    
    Fixes: dca65818c80c ("cifs: use a different reconnect helper for non-cifsd threads")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
    Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 390c08fd3eeb3ebd0e9576de8b6eec8eae2d595d
Author: Paulo Alcantara <pc@manguebit.com>
Date:   Thu Nov 9 12:01:48 2023 -0300

    smb: client: fix mount when dns_resolver key is not available
    
    commit 5e2fd17f434d2fed78efb123e2fc6711e4f598f1 upstream.
    
    There was a wrong assumption that with CONFIG_CIFS_DFS_UPCALL=y there
    would always be a dns_resolver key set up so we could unconditionally
    upcall to resolve UNC hostname rather than using the value provided by
    mount(2).
    
    Only require it when performing automount of junctions within a DFS
    share so users that don't have dns_resolver key still can mount their
    regular shares with server hostname resolved by mount.cifs(8).
    
    Fixes: 348a04a8d113 ("smb: client: get rid of dfs code dep in namespace.c")
    Cc: stable@vger.kernel.org
    Tested-by: Eduard Bachmakov <e.bachmakov@gmail.com>
    Reported-by: Eduard Bachmakov <e.bachmakov@gmail.com>
    Closes: https://lore.kernel.org/all/CADCRUiNvZuiUZ0VGZZO9HRyPyw6x92kiA7o7Q4tsX5FkZqUkKg@mail.gmail.com/
    Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c1a5962f1462b64fe7b69f20a4b6af8067bc2d26
Author: Paulo Alcantara <pc@manguebit.com>
Date:   Wed Oct 25 14:58:35 2023 -0300

    smb: client: fix potential deadlock when releasing mids
    
    commit e6322fd177c6885a21dd4609dc5e5c973d1a2eb7 upstream.
    
    All release_mid() callers seem to hold a reference of @mid so there is
    no need to call kref_put(&mid->refcount, __release_mid) under
    @server->mid_lock spinlock.  If they don't, then an use-after-free bug
    would have occurred anyways.
    
    By getting rid of such spinlock also fixes a potential deadlock as
    shown below
    
    CPU 0                                CPU 1
    ------------------------------------------------------------------
    cifs_demultiplex_thread()            cifs_debug_data_proc_show()
     release_mid()
      spin_lock(&server->mid_lock);
                                         spin_lock(&cifs_tcp_ses_lock)
                                          spin_lock(&server->mid_lock)
      __release_mid()
       smb2_find_smb_tcon()
        spin_lock(&cifs_tcp_ses_lock) *deadlock*
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93877b9afc2994c89362007aac480a7b150f386f
Author: Paulo Alcantara <pc@manguebit.com>
Date:   Mon Oct 30 17:19:56 2023 -0300

    smb: client: fix use-after-free in smb2_query_info_compound()
    
    commit 5c86919455c1edec99ebd3338ad213b59271a71b upstream.
    
    The following UAF was triggered when running fstests generic/072 with
    KASAN enabled against Windows Server 2022 and mount options
    'multichannel,max_channels=2,vers=3.1.1,mfsymlinks,noperm'
    
      BUG: KASAN: slab-use-after-free in smb2_query_info_compound+0x423/0x6d0 [cifs]
      Read of size 8 at addr ffff888014941048 by task xfs_io/27534
    
      CPU: 0 PID: 27534 Comm: xfs_io Not tainted 6.6.0-rc7 #1
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
      rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
      Call Trace:
       dump_stack_lvl+0x4a/0x80
       print_report+0xcf/0x650
       ? srso_alias_return_thunk+0x5/0x7f
       ? srso_alias_return_thunk+0x5/0x7f
       ? __phys_addr+0x46/0x90
       kasan_report+0xda/0x110
       ? smb2_query_info_compound+0x423/0x6d0 [cifs]
       ? smb2_query_info_compound+0x423/0x6d0 [cifs]
       smb2_query_info_compound+0x423/0x6d0 [cifs]
       ? __pfx_smb2_query_info_compound+0x10/0x10 [cifs]
       ? srso_alias_return_thunk+0x5/0x7f
       ? __stack_depot_save+0x39/0x480
       ? kasan_save_stack+0x33/0x60
       ? kasan_set_track+0x25/0x30
       ? ____kasan_slab_free+0x126/0x170
       smb2_queryfs+0xc2/0x2c0 [cifs]
       ? __pfx_smb2_queryfs+0x10/0x10 [cifs]
       ? __pfx___lock_acquire+0x10/0x10
       smb311_queryfs+0x210/0x220 [cifs]
       ? __pfx_smb311_queryfs+0x10/0x10 [cifs]
       ? srso_alias_return_thunk+0x5/0x7f
       ? __lock_acquire+0x480/0x26c0
       ? lock_release+0x1ed/0x640
       ? srso_alias_return_thunk+0x5/0x7f
       ? do_raw_spin_unlock+0x9b/0x100
       cifs_statfs+0x18c/0x4b0 [cifs]
       statfs_by_dentry+0x9b/0xf0
       fd_statfs+0x4e/0xb0
       __do_sys_fstatfs+0x7f/0xe0
       ? __pfx___do_sys_fstatfs+0x10/0x10
       ? srso_alias_return_thunk+0x5/0x7f
       ? lockdep_hardirqs_on_prepare+0x136/0x200
       ? srso_alias_return_thunk+0x5/0x7f
       do_syscall_64+0x3f/0x90
       entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    
      Allocated by task 27534:
       kasan_save_stack+0x33/0x60
       kasan_set_track+0x25/0x30
       __kasan_kmalloc+0x8f/0xa0
       open_cached_dir+0x71b/0x1240 [cifs]
       smb2_query_info_compound+0x5c3/0x6d0 [cifs]
       smb2_queryfs+0xc2/0x2c0 [cifs]
       smb311_queryfs+0x210/0x220 [cifs]
       cifs_statfs+0x18c/0x4b0 [cifs]
       statfs_by_dentry+0x9b/0xf0
       fd_statfs+0x4e/0xb0
       __do_sys_fstatfs+0x7f/0xe0
       do_syscall_64+0x3f/0x90
       entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    
      Freed by task 27534:
       kasan_save_stack+0x33/0x60
       kasan_set_track+0x25/0x30
       kasan_save_free_info+0x2b/0x50
       ____kasan_slab_free+0x126/0x170
       slab_free_freelist_hook+0xd0/0x1e0
       __kmem_cache_free+0x9d/0x1b0
       open_cached_dir+0xff5/0x1240 [cifs]
       smb2_query_info_compound+0x5c3/0x6d0 [cifs]
       smb2_queryfs+0xc2/0x2c0 [cifs]
    
    This is a race between open_cached_dir() and cached_dir_lease_break()
    where the cache entry for the open directory handle receives a lease
    break while creating it.  And before returning from open_cached_dir(),
    we put the last reference of the new @cfid because of
    !@cfid->has_lease.
    
    Besides the UAF, while running xfstests a lot of missed lease breaks
    have been noticed in tests that run several concurrent statfs(2) calls
    on those cached fids
    
      CIFS: VFS: \\w22-root1.gandalf.test No task to wake, unknown frame...
      CIFS: VFS: \\w22-root1.gandalf.test Cmd: 18 Err: 0x0 Flags: 0x1...
      CIFS: VFS: \\w22-root1.gandalf.test smb buf 00000000715bfe83 len 108
      CIFS: VFS: Dump pending requests:
      CIFS: VFS: \\w22-root1.gandalf.test No task to wake, unknown frame...
      CIFS: VFS: \\w22-root1.gandalf.test Cmd: 18 Err: 0x0 Flags: 0x1...
      CIFS: VFS: \\w22-root1.gandalf.test smb buf 000000005aa7316e len 108
      ...
    
    To fix both, in open_cached_dir() ensure that @cfid->has_lease is set
    right before sending out compounded request so that any potential
    lease break will be get processed by demultiplex thread while we're
    still caching @cfid.  And, if open failed for some reason, re-check
    @cfid->has_lease to decide whether or not put lease reference.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ab6f842452ce2cae04209d4671ac6289d0aef8a
Author: Paulo Alcantara <pc@manguebit.com>
Date:   Tue Oct 24 13:49:15 2023 -0300

    smb: client: fix use-after-free bug in cifs_debug_data_proc_show()
    
    commit d328c09ee9f15ee5a26431f5aad7c9239fa85e62 upstream.
    
    Skip SMB sessions that are being teared down
    (e.g. @ses->ses_status == SES_EXITING) in cifs_debug_data_proc_show()
    to avoid use-after-free in @ses.
    
    This fixes the following GPF when reading from /proc/fs/cifs/DebugData
    while mounting and umounting
    
      [ 816.251274] general protection fault, probably for non-canonical
      address 0x6b6b6b6b6b6b6d81: 0000 [#1] PREEMPT SMP NOPTI
      ...
      [  816.260138] Call Trace:
      [  816.260329]  <TASK>
      [  816.260499]  ? die_addr+0x36/0x90
      [  816.260762]  ? exc_general_protection+0x1b3/0x410
      [  816.261126]  ? asm_exc_general_protection+0x26/0x30
      [  816.261502]  ? cifs_debug_tcon+0xbd/0x240 [cifs]
      [  816.261878]  ? cifs_debug_tcon+0xab/0x240 [cifs]
      [  816.262249]  cifs_debug_data_proc_show+0x516/0xdb0 [cifs]
      [  816.262689]  ? seq_read_iter+0x379/0x470
      [  816.262995]  seq_read_iter+0x118/0x470
      [  816.263291]  proc_reg_read_iter+0x53/0x90
      [  816.263596]  ? srso_alias_return_thunk+0x5/0x7f
      [  816.263945]  vfs_read+0x201/0x350
      [  816.264211]  ksys_read+0x75/0x100
      [  816.264472]  do_syscall_64+0x3f/0x90
      [  816.264750]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      [  816.265135] RIP: 0033:0x7fd5e669d381
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 318e1c7e61c42a2066f511bf850c943ffb09f73c
Author: Steve French <stfrench@microsoft.com>
Date:   Tue Nov 7 21:38:13 2023 -0600

    smb3: fix caching of ctime on setxattr
    
    commit 5923d6686a100c2b4cabd4c2ca9d5a12579c7614 upstream.
    
    Fixes xfstest generic/728 which had been failing due to incorrect
    ctime after setxattr and removexattr
    
    Update ctime on successful set of xattr
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 67062c84922b439071c301afffaf14457fa3569a
Author: Steve French <stfrench@microsoft.com>
Date:   Thu Nov 9 15:28:12 2023 -0600

    smb3: allow dumping session and tcon id to improve stats analysis and debugging
    
    commit de4eceab578ead12a71e5b5588a57e142bbe8ceb upstream.
    
    When multiple mounts are to the same share from the same client it was not
    possible to determine which section of /proc/fs/cifs/Stats (and DebugData)
    correspond to that mount.  In some recent examples this turned out to  be
    a significant problem when trying to analyze performance data - since
    there are many cases where unless we know the tree id and session id we
    can't figure out which stats (e.g. number of SMB3.1.1 requests by type,
    the total time they take, which is slowest, how many fail etc.) apply to
    which mount. The only existing loosely related ioctl CIFS_IOC_GET_MNT_INFO
    does not return the information needed to uniquely identify which tcon
    is which mount although it does return various flags and device info.
    
    Add a cifs.ko ioctl CIFS_IOC_GET_TCON_INFO (0x800ccf0c) to return tid,
    session id, tree connect count.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b8c0124b2340a210227e735ec0d9487e8f5a61b5
Author: Steve French <stfrench@microsoft.com>
Date:   Mon Oct 16 12:18:23 2023 -0500

    smb3: fix touch -h of symlink
    
    commit 475efd9808a3094944a56240b2711349e433fb66 upstream.
    
    For example:
          touch -h -t 02011200 testfile
    where testfile is a symlink would not change the timestamp, but
          touch -t 02011200 testfile
    does work to change the timestamp of the target
    
    Suggested-by: David Howells <dhowells@redhat.com>
    Reported-by: Micah Veilleux <micah.veilleux@iba-group.com>
    Closes: https://bugzilla.samba.org/show_bug.cgi?id=14476
    Cc: stable@vger.kernel.org
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d612032717662a3a500963a10a7572a1ec1822c9
Author: Steve French <stfrench@microsoft.com>
Date:   Thu Oct 19 23:01:49 2023 -0500

    smb3: fix creating FIFOs when mounting with "sfu" mount option
    
    commit 72bc63f5e23a38b65ff2a201bdc11401d4223fa9 upstream.
    
    Fixes some xfstests including generic/564 and generic/157
    
    The "sfu" mount option can be useful for creating special files (character
    and block devices in particular) but could not create FIFOs. It did
    recognize existing empty files with the "system" attribute flag as FIFOs
    but this is too general, so to support creating FIFOs more safely use a new
    tag (but the same length as those for char and block devices ie "IntxLNK"
    and "IntxBLK") "LnxFIFO" to indicate that the file should be treated as a
    FIFO (when mounted with the "sfu").   For some additional context note that
    "sfu" followed the way that "Services for Unix" on Windows handled these
    special files (at least for character and block devices and symlinks),
    which is different than newer Windows which can handle special files
    as reparse points (which isn't an option to many servers).
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 429eff0936e39c87f1799a74e7dc5b098301a163
Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Date:   Thu Oct 19 13:29:20 2023 +0300

    xhci: Enable RPM on controllers that support low-power states
    
    commit a5d6264b638efeca35eff72177fd28d149e0764b upstream.
    
    Use the low-power states of the underlying platform to enable runtime PM.
    If the platform doesn't support runtime D3, then enabling default RPM will
    result in the controller malfunctioning, as in the case of hotplug devices
    not being detected because of a failed interrupt generation.
    
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20231019102924.2797346-16-mathias.nyman@linux.intel.com
    Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2345ef960d6663c9b52f8f73fb5ca05732c56144
Author: Helge Deller <deller@gmx.de>
Date:   Mon Nov 13 11:12:57 2023 +0100

    parisc: fix mmap_base calculation when stack grows upwards
    
    commit 5f74f820f6fc844b95f9e5e406e0a07d97510420 upstream.
    
    Matoro reported various userspace crashes on the parisc platform with kernel
    6.6 and bisected it to commit 3033cd430768 ("parisc: Use generic mmap top-down
    layout and brk randomization").
    
    That commit switched parisc to use the common infrastructure to calculate
    mmap_base, but missed that the mmap_base() function takes care for
    architectures where the stack grows downwards only.
    
    Fix the mmap_base() calculation to include the stack-grows-upwards case
    and thus fix the userspace crashes on parisc.
    
    Link: https://lkml.kernel.org/r/ZVH2qeS1bG7/1J/l@p100
    Fixes: 3033cd430768 ("parisc: Use generic mmap top-down layout and brk randomization")
    Signed-off-by: Helge Deller <deller@gmx.de>
    Reported-by: matoro <matoro_mailinglist_kernel@matoro.tk>
    Tested-by: matoro <matoro_mailinglist_kernel@matoro.tk>
    Cc: <stable@vger.kernel.org>    [6.6+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c0940ebe428777c9fe5856d6b305d75ca3e610ae
Author: Helge Deller <deller@gmx.de>
Date:   Fri Nov 17 16:43:52 2023 +0100

    parisc/power: Fix power soft-off when running on qemu
    
    commit 6ad6e15a9c46b8f0932cd99724f26f3db4db1cdf upstream.
    
    Firmware returns the physical address of the power switch,
    so need to use gsc_writel() instead of direct memory access.
    
    Fixes: d0c219472980 ("parisc/power: Add power soft-off when running on qemu")
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org # v6.0+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5ff2daf7737fe9da0cf1989de2cebf9a02b9e07d
Author: Helge Deller <deller@gmx.de>
Date:   Tue Nov 7 14:33:32 2023 +0100

    parisc/pgtable: Do not drop upper 5 address bits of physical address
    
    commit 166b0110d1ee53290bd11618df6e3991c117495a upstream.
    
    When calculating the pfn for the iitlbt/idtlbt instruction, do not
    drop the upper 5 address bits. This doesn't seem to have an effect
    on physical hardware which uses less physical address bits, but in
    qemu the missing bits are visible.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc:  <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e5f12229d9541c38a813002a0a8faaf637430b77
Author: Helge Deller <deller@gmx.de>
Date:   Fri Nov 10 16:13:15 2023 +0100

    parisc: Prevent booting 64-bit kernels on PA1.x machines
    
    commit a406b8b424fa01f244c1aab02ba186258448c36b upstream.
    
    Bail out early with error message when trying to boot a 64-bit kernel on
    32-bit machines. This fixes the previous commit to include the check for
    true 64-bit kernels as well.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Fixes: 591d2108f3abc ("parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines")
    Cc:  <stable@vger.kernel.org> # v6.0+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7989f7ad1f0a94bf47ab9d2bf0e96e1b974b6529
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Oct 2 12:48:08 2023 +0300

    selftests/resctrl: Extend signal handler coverage to unmount on receiving signal
    
    [ Upstream commit 3aff5146445582454c35900f3c0c972987cdd595 ]
    
    Unmounting resctrl FS has been moved into the per test functions in
    resctrl_tests.c by commit caddc0fbe495 ("selftests/resctrl: Move
    resctrl FS mount/umount to higher level"). In case a signal (SIGINT,
    SIGTERM, or SIGHUP) is received, the running selftest is aborted by
    ctrlc_handler() which then unmounts resctrl fs before exiting. The
    current section between signal_handler_register() and
    signal_handler_unregister(), however, does not cover the entire
    duration when resctrl FS is mounted.
    
    Move signal_handler_register() and signal_handler_unregister() calls
    from per test files into resctrl_tests.c to properly unmount resctrl
    fs. In order to not add signal_handler_register()/unregister() n times,
    create helpers test_prepare() and test_cleanup().
    
    Do not call ksft_exit_fail_msg() in test_prepare() but only in the per
    test function to keep the control flow cleaner without adding calls to
    exit() deep into the call chain.
    
    Adjust child process kill() call in ctrlc_handler() to only be invoked
    if the child was already forked.
    
    Fixes: caddc0fbe495 ("selftests/resctrl: Move resctrl FS mount/umount to higher level")
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b1d34cb556292014b04593428190352662020117
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Sep 4 12:53:37 2023 +0300

    selftests/resctrl: Make benchmark command const and build it with pointers
    
    [ Upstream commit e33cb5702a9f287d829b0e9e6abe57f6a4aba6d2 ]
    
    Benchmark command is used in multiple tests so it should not be
    mutated by the tests but CMT test alters span argument. Due to the
    order of tests (CMT test runs last), mutating the span argument in CMT
    test does not trigger any real problems currently.
    
    Mark benchmark_cmd strings as const and setup the benchmark command
    using pointers. Because the benchmark command becomes const, the input
    arguments can be used directly. Besides being simpler, using the input
    arguments directly also removes the internal size restriction.
    
    CMT test has to create a copy of the benchmark command before altering
    the benchmark command.
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Stable-dep-of: 3aff51464455 ("selftests/resctrl: Extend signal handler coverage to unmount on receiving signal")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ef8454af673735ec44b851d6f78e6f6f3bcba30b
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Sep 4 12:53:35 2023 +0300

    selftests/resctrl: Simplify span lifetime
    
    [ Upstream commit b1a901e078c4ee4a6fe13021c4577ef5f3155251 ]
    
    struct resctrl_val_param contains span member. resctrl_val(), however,
    never uses it because the value of span is embedded into the default
    benchmark command and parsed from it by run_benchmark().
    
    Remove span from resctrl_val_param. Provide DEFAULT_SPAN for the code
    that needs it. CMT and CAT tests communicate span that is different
    from the DEFAULT_SPAN between their internal functions which is
    converted into passing it directly as a parameter.
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Stable-dep-of: 3aff51464455 ("selftests/resctrl: Extend signal handler coverage to unmount on receiving signal")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fd7a4c555634e3bad0445e105f0428d51b732b58
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Sep 4 12:53:34 2023 +0300

    selftests/resctrl: Remove bw_report and bm_type from main()
    
    [ Upstream commit 47e36f16c7846bf3627ff68525e02555c53dc99e ]
    
    bw_report is always set to "reads" and bm_type is set to "fill_buf" but
    is never used.
    
    Set bw_report directly to "reads" in MBA/MBM test and remove bm_type.
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Stable-dep-of: 3aff51464455 ("selftests/resctrl: Extend signal handler coverage to unmount on receiving signal")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5268d95c06152dc73e673de284d128c76e9ce895
Author: Joel Fernandes (Google) <joel@joelfernandes.org>
Date:   Sat Jul 29 14:27:31 2023 +0000

    rcutorture: Fix stuttering races and other issues
    
    [ Upstream commit cca42bd8eb1b54a4c9bbf48c79d120e66619a3e4 ]
    
    The stuttering code isn't functioning as expected. Ideally, it should
    pause the torture threads for a designated period before resuming. Yet,
    it fails to halt the test for the correct duration. Additionally, a race
    condition exists, potentially causing the stuttering code to pause for
    an extended period if the 'spt' variable is non-zero due to the stutter
    orchestration thread's inadequate CPU time.
    
    Moreover, over-stuttering can hinder RCU's progress on TREE07 kernels.
    This happens as the stuttering code may run within a softirq due to RCU
    callbacks. Consequently, ksoftirqd keeps a CPU busy for several seconds,
    thus obstructing RCU's progress. This situation triggers a warning
    message in the logs:
    
    [ 2169.481783] rcu_torture_writer: rtort_pipe_count: 9
    
    This warning suggests that an RCU torture object, although invisible to
    RCU readers, couldn't make it past the pipe array and be freed -- a
    strong indication that there weren't enough grace periods during the
    stutter interval.
    
    To address these issues, this patch sets the "stutter end" time to an
    absolute point in the future set by the main stutter thread. This is
    then used for waiting in stutter_wait(). While the stutter thread still
    defines this absolute time, the waiters' waiting logic doesn't rely on
    the stutter thread receiving sufficient CPU time to halt the stuttering
    as the halting is now self-controlled.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1443ec850448d98005ffbd1539dceced1a754c42
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Wed Jul 26 13:57:03 2023 -0700

    torture: Make torture_hrtimeout_ns() take an hrtimer mode parameter
    
    [ Upstream commit a741deac787f0d2d7068638c067db20af9e63752 ]
    
    The current torture-test sleeps are waiting for a duration, but there
    are situations where it is better to wait for an absolute time, for
    example, when ending a stutter interval.  This commit therefore adds
    an hrtimer mode parameter to torture_hrtimeout_ns().  Why not also the
    other torture_hrtimeout_*() functions?  The theory is that most absolute
    times will be in nanoseconds, especially not (say) jiffies.
    
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Stable-dep-of: cca42bd8eb1b ("rcutorture: Fix stuttering races and other issues")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 54d72f6ab73e7a0d75c2a80f2906958112b7be40
Author: Muhammad Ahmed <ahmed.ahmed@amd.com>
Date:   Mon Sep 18 16:52:54 2023 -0400

    drm/amd/display: enable dsc_clk even if dsc_pg disabled
    
    [ Upstream commit 40255df370e94d44f0f0a924400d68db0ee31bec ]
    
    [why]
    need to enable dsc_clk regardless dsc_pg
    
    Reviewed-by: Charlene Liu <charlene.liu@amd.com>
    Cc: Mario Limonciello <mario.limonciello@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Muhammad Ahmed <ahmed.ahmed@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ac6d4cd9feeb7ad12f4ce672ac0bcb100ac70dfd
Author: Guan Wentao <guanwentao@uniontech.com>
Date:   Thu Oct 12 19:21:17 2023 +0800

    Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE
    
    [ Upstream commit da06ff1f585ea784c79f80e7fab0e0c4ebb49c1c ]
    
    Add PID/VID 0bda:b85b for Realtek RTL8852BE USB bluetooth part.
    The PID/VID was reported by the patch last year. [1]
    Some SBCs like rockpi 5B A8 module contains the device.
    And it`s founded in website. [2] [3]
    
    Here is the device tables in /sys/kernel/debug/usb/devices .
    
    T:  Bus=07 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
    D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0bda ProdID=b85b Rev= 0.00
    S:  Manufacturer=Realtek
    S:  Product=Bluetooth Radio
    S:  SerialNumber=00e04c000001
    C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    
    Link: https://lore.kernel.org/all/20220420052402.19049-1-tangmeng@uniontech.com/ [1]
    Link: https://forum.radxa.com/t/bluetooth-on-ubuntu/13051/4 [2]
    Link: https://ubuntuforums.org/showthread.php?t=2489527 [3]
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Meng Tang <tangmeng@uniontech.com>
    Signed-off-by: Guan Wentao <guanwentao@uniontech.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 03ec9c28817d97be94cc68084e844a69b2529ea6
Author: Masum Reza <masumrezarock100@gmail.com>
Date:   Sun Sep 24 16:46:55 2023 +0530

    Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables
    
    [ Upstream commit 02be109d3a405dbc4d53fb4b4473d7a113548088 ]
    
    This device is used in TP-Link TX20E WiFi+Bluetooth adapter.
    
    Relevant information in /sys/kernel/debug/usb/devices
    about the Bluetooth device is listed as the below.
    
    T:  Bus=01 Lev=01 Prnt=01 Port=08 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
    D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=13d3 ProdID=3570 Rev= 0.00
    S:  Manufacturer=Realtek
    S:  Product=Bluetooth Radio
    S:  SerialNumber=00e04c000001
    C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    
    Signed-off-by: Masum Reza <masumrezarock100@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: da06ff1f585e ("Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 96af45154a0be30485ad07f70f852b1456cb13d7
Author: John Johansen <john.johansen@canonical.com>
Date:   Sun Sep 10 03:35:22 2023 -0700

    apparmor: Fix regression in mount mediation
    
    [ Upstream commit 157a3537d6bc28ceb9a11fc8cb67f2152d860146 ]
    
    commit 2db154b3ea8e ("vfs: syscall: Add move_mount(2) to move mounts around")
    
    introduced a new move_mount(2) system call and a corresponding new LSM
    security_move_mount hook but did not implement this hook for any
    existing LSM. This creates a regression for AppArmor mediation of
    mount. This patch provides a base mapping of the move_mount syscall to
    the existing mount mediation. In the future we may introduce
    additional mediations around the new mount calls.
    
    Fixes: 2db154b3ea8e ("vfs: syscall: Add move_mount(2) to move mounts around")
    CC: stable@vger.kernel.org
    Reported-by: Andreas Steinmetz <anstein99@googlemail.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 690f33e1edf5cd996b54094409de0067ae3fa216
Author: John Johansen <john.johansen@canonical.com>
Date:   Mon Sep 19 20:48:48 2022 -0700

    apparmor: pass cred through to audit info.
    
    [ Upstream commit 90c436a64a6e20482a9a613c47eb4af2e8a5328e ]
    
    The cred is needed to properly audit some messages, and will be needed
    in the future for uid conditional mediation. So pass it through to
    where the apparmor_audit_data struct gets defined.
    
    Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Stable-dep-of: 157a3537d6bc ("apparmor: Fix regression in mount mediation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 30b3669d40ad2400dfac75d1250596b5b0cb241b
Author: John Johansen <john.johansen@canonical.com>
Date:   Mon Sep 19 00:46:09 2022 -0700

    apparmor: rename audit_data->label to audit_data->subj_label
    
    [ Upstream commit d20f5a1a6e792d22199c9989ec7ab9e95c48d60c ]
    
    rename audit_data's label field to subj_label to better reflect its
    use. Also at the same time drop unneeded assignments to ->subj_label
    as the later call to aa_check_perms will do the assignment if needed.
    
    Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Stable-dep-of: 157a3537d6bc ("apparmor: Fix regression in mount mediation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c57bc80f4508acd8c52bd89b01d324889065320d
Author: John Johansen <john.johansen@canonical.com>
Date:   Wed Sep 14 00:20:12 2022 -0700

    apparmor: combine common_audit_data and apparmor_audit_data
    
    [ Upstream commit bd7bd201ca46c211c3ab251ca9854787d1331a2f ]
    
    Everywhere where common_audit_data is used apparmor audit_data is also
    used. We can simplify the code and drop the use of the aad macro
    everywhere by combining the two structures.
    
    Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Stable-dep-of: 157a3537d6bc ("apparmor: Fix regression in mount mediation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 75ae5a7883761087bdcc8d6a456fb1f174d34143
Author: Gaosheng Cui <cuigaosheng1@huawei.com>
Date:   Sun Jun 25 09:13:49 2023 +0800

    apparmor: Fix kernel-doc warnings in apparmor/policy.c
    
    [ Upstream commit 25ff0ff2d6286928dc516c74b879809c691c2dd8 ]
    
    Fix kernel-doc warnings:
    
    security/apparmor/policy.c:294: warning: Function parameter or
    member 'proxy' not described in 'aa_alloc_profile'
    security/apparmor/policy.c:785: warning: Function parameter or
    member 'label' not described in 'aa_policy_view_capable'
    security/apparmor/policy.c:785: warning: Function parameter or
    member 'ns' not described in 'aa_policy_view_capable'
    security/apparmor/policy.c:847: warning: Function parameter or
    member 'ns' not described in 'aa_may_manage_policy'
    security/apparmor/policy.c:964: warning: Function parameter or
    member 'hname' not described in '__lookup_replace'
    security/apparmor/policy.c:964: warning: Function parameter or
    member 'info' not described in '__lookup_replace'
    security/apparmor/policy.c:964: warning: Function parameter or
    member 'noreplace' not described in '__lookup_replace'
    security/apparmor/policy.c:964: warning: Function parameter or
    member 'ns' not described in '__lookup_replace'
    security/apparmor/policy.c:964: warning: Function parameter or
    member 'p' not described in '__lookup_replace'
    
    Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Stable-dep-of: 157a3537d6bc ("apparmor: Fix regression in mount mediation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0e4721f553e287184634225c400d9433a9374c3d
Author: Gaosheng Cui <cuigaosheng1@huawei.com>
Date:   Sun Jun 25 09:13:46 2023 +0800

    apparmor: Fix kernel-doc warnings in apparmor/resource.c
    
    [ Upstream commit 13c1748e217078d437727eef333cb0387d13bc0e ]
    
    Fix kernel-doc warnings:
    
    security/apparmor/resource.c:111: warning: Function parameter or
    member 'label' not described in 'aa_task_setrlimit'
    security/apparmor/resource.c:111: warning: Function parameter or
    member 'new_rlim' not described in 'aa_task_setrlimit'
    security/apparmor/resource.c:111: warning: Function parameter or
    member 'resource' not described in 'aa_task_setrlimit'
    security/apparmor/resource.c:111: warning: Function parameter or
    member 'task' not described in 'aa_task_setrlimit'
    
    Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Stable-dep-of: 157a3537d6bc ("apparmor: Fix regression in mount mediation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 73221ebe13d90d1d5ad96c1ef1825f84e961a02e
Author: Gaosheng Cui <cuigaosheng1@huawei.com>
Date:   Sun Jun 25 09:13:44 2023 +0800

    apparmor: Fix kernel-doc warnings in apparmor/lib.c
    
    [ Upstream commit 8921482286116af193980f04f2f2755775a410a5 ]
    
    Fix kernel-doc warnings:
    
    security/apparmor/lib.c:33: warning: Excess function parameter
    'str' description in 'aa_free_str_table'
    security/apparmor/lib.c:33: warning: Function parameter or member
    't' not described in 'aa_free_str_table'
    security/apparmor/lib.c:94: warning: Function parameter or
    member 'n' not described in 'skipn_spaces'
    security/apparmor/lib.c:390: warning: Excess function parameter
    'deny' description in 'aa_check_perms'
    
    Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Stable-dep-of: 157a3537d6bc ("apparmor: Fix regression in mount mediation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 63c7297c62b97aad24b89c7fed8173e8d543db1f
Author: Gaosheng Cui <cuigaosheng1@huawei.com>
Date:   Sun Jun 25 09:13:39 2023 +0800

    apparmor: Fix kernel-doc warnings in apparmor/audit.c
    
    [ Upstream commit 26c9ecb34f5f5fa43c041a220de01d7cbea97dd0 ]
    
    Fix kernel-doc warnings:
    
    security/apparmor/audit.c:150: warning: Function parameter or
    member 'type' not described in 'aa_audit_msg'
    
    Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Stable-dep-of: 157a3537d6bc ("apparmor: Fix regression in mount mediation")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6b2e428e673b3f55965674a426c40922e91388aa
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Fri Oct 27 20:13:23 2023 -0700

    cxl/port: Fix delete_endpoint() vs parent unregistration race
    
    commit 8d2ad999ca3c64cb08cf6a58d227b9d9e746d708 upstream.
    
    The CXL subsystem, at cxl_mem ->probe() time, establishes a lineage of
    ports (struct cxl_port objects) between an endpoint and the root of a
    CXL topology. Each port including the endpoint port is attached to the
    cxl_port driver.
    
    Given that setup, it follows that when either any port in that lineage
    goes through a cxl_port ->remove() event, or the memdev goes through a
    cxl_mem ->remove() event. The hierarchy below the removed port, or the
    entire hierarchy if the memdev is removed needs to come down.
    
    The delete_endpoint() callback is careful to check whether it is being
    called to tear down the hierarchy, or if it is only being called to
    teardown the memdev because an ancestor port is going through
    ->remove().
    
    That care needs to take the device_lock() of the endpoint's parent.
    Which requires 2 bugs to be fixed:
    
    1/ A reference on the parent is needed to prevent use-after-free
       scenarios like this signature:
    
        BUG: spinlock bad magic on CPU#0, kworker/u56:0/11
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS edk2-20230524-3.fc38 05/24/2023
        Workqueue: cxl_port detach_memdev [cxl_core]
        RIP: 0010:spin_bug+0x65/0xa0
        Call Trace:
          do_raw_spin_lock+0x69/0xa0
         __mutex_lock+0x695/0xb80
         delete_endpoint+0xad/0x150 [cxl_core]
         devres_release_all+0xb8/0x110
         device_unbind_cleanup+0xe/0x70
         device_release_driver_internal+0x1d2/0x210
         detach_memdev+0x15/0x20 [cxl_core]
         process_one_work+0x1e3/0x4c0
         worker_thread+0x1dd/0x3d0
    
    2/ In the case of RCH topologies, the parent device that needs to be
       locked is not always @port->dev as returned by cxl_mem_find_port(), use
       endpoint->dev.parent instead.
    
    Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver")
    Cc: <stable@vger.kernel.org>
    Reported-by: Robert Richter <rrichter@amd.com>
    Closes: http://lore.kernel.org/r/20231018171713.1883517-2-rrichter@amd.com
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8a9ab9037f7530ce5b42695fd36e4e91fab956fd
Author: Jim Harris <jim.harris@samsung.com>
Date:   Thu Oct 26 10:09:06 2023 -0700

    cxl/region: Fix x1 root-decoder granularity calculations
    
    commit 98a04c7aced2b43b3ac4befe216c4eecc7257d4b upstream.
    
    Root decoder granularity must match value from CFWMS, which may not
    be the region's granularity for non-interleaved root decoders.
    
    So when calculating granularities for host bridge decoders, use the
    region's granularity instead of the root decoder's granularity to ensure
    the correct granularities are set for the host bridge decoders and any
    downstream switch decoders.
    
    Test configuration is 1 host bridge * 2 switches * 2 endpoints per switch.
    
    Region created with 2048 granularity using following command line:
    
    cxl create-region -m -d decoder0.0 -w 4 mem0 mem2 mem1 mem3 \
                      -g 2048 -s 2048M
    
    Use "cxl list -PDE | grep granularity" to get a view of the granularity
    set at each level of the topology.
    
    Before this patch:
            "interleave_granularity":2048,
            "interleave_granularity":2048,
        "interleave_granularity":512,
            "interleave_granularity":2048,
            "interleave_granularity":2048,
        "interleave_granularity":512,
    "interleave_granularity":256,
    
    After:
            "interleave_granularity":2048,
            "interleave_granularity":2048,
        "interleave_granularity":4096,
            "interleave_granularity":2048,
            "interleave_granularity":2048,
        "interleave_granularity":4096,
    "interleave_granularity":2048,
    
    Fixes: 27b3f8d13830 ("cxl/region: Program target lists")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Jim Harris <jim.harris@samsung.com>
    Link: https://lore.kernel.org/r/169824893473.1403938.16110924262989774582.stgit@bgt-140510-bm03.eng.stellus.in
    [djbw: fixup the prebuilt cxl_test region]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e726cb3d353dbd503756de7a4ca9d114d1748f3f
Author: Frank Li <Frank.Li@nxp.com>
Date:   Mon Oct 23 12:16:58 2023 -0400

    i3c: master: svc: fix random hot join failure since timeout error
    
    commit 9aaeef113c55248ecf3ab941c2e4460aaa8b8b9a upstream.
    
    master side report:
      silvaco-i3c-master 44330000.i3c-master: Error condition: MSTATUS 0x020090c7, MERRWARN 0x00100000
    
    BIT 20: TIMEOUT error
      The module has stalled too long in a frame. This happens when:
      - The TX FIFO or RX FIFO is not handled and the bus is stuck in the
    middle of a message,
      - No STOP was issued and between messages,
      - IBI manual is used and no decision was made.
      The maximum stall period is 100 μs.
    
    This can be considered as being just a warning as the system IRQ latency
    can easily be greater than 100us.
    
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Cc:  <stable@vger.kernel.org>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/r/20231023161658.3890811-7-Frank.Li@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98e366afabf14e1ee1bd9e7f2bb2deabbce38059
Author: Frank Li <Frank.Li@nxp.com>
Date:   Mon Oct 23 12:16:57 2023 -0400

    i3c: master: svc: fix SDA keep low when polling IBIWON timeout happen
    
    commit dfd7cd6aafdb1f5ba93828e97e56b38304b23a05 upstream.
    
    Upon IBIWON timeout, the SDA line will always be kept low if we don't emit
    a stop. Calling svc_i3c_master_emit_stop() there will let the bus return to
    idle state.
    
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Cc:  <stable@vger.kernel.org>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20231023161658.3890811-6-Frank.Li@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ac33f259748461ea8c48c5f32b4ea626021eccc0
Author: Frank Li <Frank.Li@nxp.com>
Date:   Mon Oct 23 12:16:56 2023 -0400

    i3c: master: svc: fix check wrong status register in irq handler
    
    commit 225d5ef048c4ed01a475c95d94833bd7dd61072d upstream.
    
    svc_i3c_master_irq_handler() wrongly checks register SVC_I3C_MINTMASKED. It
    should be SVC_I3C_MSTATUS.
    
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Cc:  <stable@vger.kernel.org>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20231023161658.3890811-5-Frank.Li@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93ba03b2a90e694de6076cc53aa9f7c8dd71ea5c
Author: Frank Li <Frank.Li@nxp.com>
Date:   Mon Oct 23 12:16:55 2023 -0400

    i3c: master: svc: fix ibi may not return mandatory data byte
    
    commit c85e209b799f12d18a90ae6353b997b1bb1274a5 upstream.
    
    MSTATUS[RXPEND] is only updated after the data transfer cycle started. This
    creates an issue when the I3C clock is slow, and the CPU is running fast
    enough that MSTATUS[RXPEND] may not be updated when the code reaches
    checking point. As a result, mandatory data can be missed.
    
    Add a wait for MSTATUS[COMPLETE] to ensure that all mandatory data is
    already in FIFO. It also works without mandatory data.
    
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Cc:  <stable@vger.kernel.org>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20231023161658.3890811-4-Frank.Li@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eaf992baaceacbc6e479e5b6085106d7bb3062e1
Author: Frank Li <Frank.Li@nxp.com>
Date:   Mon Oct 23 12:16:54 2023 -0400

    i3c: master: svc: fix wrong data return when IBI happen during start frame
    
    commit 5e5e3c92e748a6d859190e123b9193cf4911fcca upstream.
    
         ┌─────┐     ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┌─────
    SCL: ┘     └─────┛  └──┛  └──┛  └──┛  └──┛  └──┛  └──┛  └──┛  └──┘
         ───┐                       ┌─────┐     ┌─────┐     ┌───────────┐
    SDA:    └───────────────────────┘     └─────┘     └─────┘           └─────
         xxx╱    ╲╱                                        ╲╱    ╲╱    ╲╱    ╲
       : xxx╲IBI ╱╲               Addr(0x0a)               ╱╲ RW ╱╲NACK╱╲ S  ╱
    
    If an In-Band Interrupt (IBI) occurs and IBI work thread is not immediately
    scheduled, when svc_i3c_master_priv_xfers() initiates the I3C transfer and
    attempts to send address 0x7e, the target interprets it as an
    IBI handler and returns the target address 0x0a.
    
    However, svc_i3c_master_priv_xfers() does not handle this case and proceeds
    with other transfers, resulting in incorrect data being returned.
    
    Add IBIWON check in svc_i3c_master_xfer(). In case this situation occurs,
    return a failure to the driver.
    
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Cc:  <stable@vger.kernel.org>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20231023161658.3890811-3-Frank.Li@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3188677d9aa0e9ae58c4a2cc84dc27b275cf4499
Author: Frank Li <Frank.Li@nxp.com>
Date:   Mon Oct 23 12:16:53 2023 -0400

    i3c: master: svc: fix race condition in ibi work thread
    
    commit 6bf3fc268183816856c96b8794cd66146bc27b35 upstream.
    
    The ibi work thread operates asynchronously with other transfers, such as
    svc_i3c_master_priv_xfers(). Introduce mutex protection to ensure the
    completion of the entire i3c/i2c transaction.
    
    Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
    Cc:  <stable@vger.kernel.org>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20231023161658.3890811-2-Frank.Li@nxp.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9f8f73391b3102522fe7c2eb301f4f3816f7c130
Author: Joshua Yeong <joshua.yeong@starfivetech.com>
Date:   Wed Sep 13 11:17:45 2023 +0800

    i3c: master: cdns: Fix reading status register
    
    commit 4bd8405257da717cd556f99e5fb68693d12c9766 upstream.
    
    IBIR_DEPTH and CMDR_DEPTH should read from status0 instead of status1.
    
    Cc: stable@vger.kernel.org
    Fixes: 603f2bee2c54 ("i3c: master: Add driver for Cadence IP")
    Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/r/20230913031743.11439-2-joshua.yeong@starfivetech.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 07ffcd8ec79cf7383e1e45815f4842fd357991c2
Author: Jim Harris <jim.harris@samsung.com>
Date:   Wed Oct 11 14:51:31 2023 +0000

    cxl/region: Do not try to cleanup after cxl_region_setup_targets() fails
    
    commit 0718588c7aaa7a1510b4de972370535b61dddd0d upstream.
    
    Commit 5e42bcbc3fef ("cxl/region: decrement ->nr_targets on error in
    cxl_region_attach()") tried to avoid 'eiw' initialization errors when
    ->nr_targets exceeded 16, by just decrementing ->nr_targets when
    cxl_region_setup_targets() failed.
    
    Commit 86987c766276 ("cxl/region: Cleanup target list on attach error")
    extended that cleanup to also clear cxled->pos and p->targets[pos]. The
    initialization error was incidentally fixed separately by:
    Commit 8d4285425714 ("cxl/region: Fix port setup uninitialized variable
    warnings") which was merged a few days after 5e42bcbc3fef.
    
    But now the original cleanup when cxl_region_setup_targets() fails
    prevents endpoint and switch decoder resources from being reused:
    
    1) the cleanup does not set the decoder's region to NULL, which results
       in future dpa_size_store() calls returning -EBUSY
    2) the decoder is not properly freed, which results in future commit
       errors associated with the upstream switch
    
    Now that the initialization errors were fixed separately, the proper
    cleanup for this case is to just return immediately. Then the resources
    associated with this target get cleanup up as normal when the failed
    region is deleted.
    
    The ->nr_targets decrement in the error case also helped prevent
    a p->targets[] array overflow, so add a new check to prevent against
    that overflow.
    
    Tested by trying to create an invalid region for a 2 switch * 2 endpoint
    topology, and then following up with creating a valid region.
    
    Fixes: 5e42bcbc3fef ("cxl/region: decrement ->nr_targets on error in cxl_region_attach()")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Jim Harris <jim.harris@samsung.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Acked-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Link: https://lore.kernel.org/r/169703589120.1202031.14696100866518083806.stgit@bgt-140510-bm03.eng.stellus.in
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 63fbcea8d0d9f68583d4f4a0988b44f3171a6d0c
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Fri Oct 20 22:30:29 2023 +0200

    mtd: cfi_cmdset_0001: Byte swap OTP info
    
    commit 565fe150624ee77dc63a735cc1b3bff5101f38a3 upstream.
    
    Currently the offset into the device when looking for OTP
    bits can go outside of the address of the MTD NOR devices,
    and if that memory isn't readable, bad things happen
    on the IXP4xx (added prints that illustrate the problem before
    the crash):
    
    cfi_intelext_otp_walk walk OTP on chip 0 start at reg_prot_offset 0x00000100
    ixp4xx_copy_from copy from 0x00000100 to 0xc880dd78
    cfi_intelext_otp_walk walk OTP on chip 0 start at reg_prot_offset 0x12000000
    ixp4xx_copy_from copy from 0x12000000 to 0xc880dd78
    8<--- cut here ---
    Unable to handle kernel paging request at virtual address db000000
    [db000000] *pgd=00000000
    (...)
    
    This happens in this case because the IXP4xx is big endian and
    the 32- and 16-bit fields in the struct cfi_intelext_otpinfo are not
    properly byteswapped. Compare to how the code in read_pri_intelext()
    byteswaps the fields in struct cfi_pri_intelext.
    
    Adding a small byte swapping loop for the OTP in read_pri_intelext()
    and the crash goes away.
    
    The problem went unnoticed for many years until I enabled
    CONFIG_MTD_OTP on the IXP4xx as well, triggering the bug.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Nicolas Pitre <nico@fluxnic.net>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20231020-mtd-otp-byteswap-v4-1-0d132c06aa9d@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2500a33323b867ab6229ea2491d800b7b8ddfb64
Author: Florent Revest <revest@chromium.org>
Date:   Mon Aug 28 17:08:56 2023 +0200

    mm: make PR_MDWE_REFUSE_EXEC_GAIN an unsigned long
    
    commit 0da668333fb07805c2836d5d50e26eda915b24a1 upstream.
    
    Defining a prctl flag as an int is a footgun because on a 64 bit machine
    and with a variadic implementation of prctl (like in musl and glibc), when
    used directly as a prctl argument, it can get casted to long with garbage
    upper bits which would result in unexpected behaviors.
    
    This patch changes the constant to an unsigned long to eliminate that
    possibilities.  This does not break UAPI.
    
    I think that a stable backport would be "nice to have": to reduce the
    chances that users build binaries that could end up with garbage bits in
    their MDWE prctl arguments.  We are not aware of anyone having yet
    encountered this corner case with MDWE prctls but a backport would reduce
    the likelihood it happens, since this sort of issues has happened with
    other prctls.  But If this is perceived as a backporting burden, I suppose
    we could also live without a stable backport.
    
    Link: https://lkml.kernel.org/r/20230828150858.393570-5-revest@chromium.org
    Fixes: b507808ebce2 ("mm: implement memory-deny-write-execute as a prctl")
    Signed-off-by: Florent Revest <revest@chromium.org>
    Suggested-by: Alexey Izbyshev <izbyshev@ispras.ru>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: Ayush Jain <ayush.jain3@amd.com>
    Cc: Greg Thelen <gthelen@google.com>
    Cc: Joey Gouly <joey.gouly@arm.com>
    Cc: KP Singh <kpsingh@kernel.org>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
    Cc: Topi Miettinen <toiwoton@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c1589c7f2ad2dc20f4015027b8e3b80e3dd3367
Author: Zi Yan <ziy@nvidia.com>
Date:   Wed Sep 13 16:12:46 2023 -0400

    mm/memory_hotplug: use pfn math in place of direct struct page manipulation
    
    commit 1640a0ef80f6d572725f5b0330038c18e98ea168 upstream.
    
    When dealing with hugetlb pages, manipulating struct page pointers
    directly can get to wrong struct page, since struct page is not guaranteed
    to be contiguous on SPARSEMEM without VMEMMAP.  Use pfn calculation to
    handle it properly.
    
    Without the fix, a wrong number of page might be skipped. Since skip cannot be
    negative, scan_movable_page() will end early and might miss a movable page with
    -ENOENT. This might fail offline_pages(). No bug is reported. The fix comes
    from code inspection.
    
    Link: https://lkml.kernel.org/r/20230913201248.452081-4-zi.yan@sent.com
    Fixes: eeb0efd071d8 ("mm,memory_hotplug: fix scan_movable_pages() for gigantic hugepages")
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Acked-by: David Hildenbrand <david@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport (IBM) <rppt@kernel.org>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 18576d128e9bc91aa1eac85e2f93909ebc24ee2a
Author: Zi Yan <ziy@nvidia.com>
Date:   Wed Sep 13 16:12:45 2023 -0400

    mm/hugetlb: use nth_page() in place of direct struct page manipulation
    
    commit 426056efe835cf4864ccf4c328fe3af9146fc539 upstream.
    
    When dealing with hugetlb pages, manipulating struct page pointers
    directly can get to wrong struct page, since struct page is not guaranteed
    to be contiguous on SPARSEMEM without VMEMMAP.  Use nth_page() to handle
    it properly.
    
    A wrong or non-existing page might be tried to be grabbed, either
    leading to a non freeable page or kernel memory access errors.  No bug
    is reported.  It comes from code inspection.
    
    Link: https://lkml.kernel.org/r/20230913201248.452081-3-zi.yan@sent.com
    Fixes: 57a196a58421 ("hugetlb: simplify hugetlb handling in follow_page_mask")
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport (IBM) <rppt@kernel.org>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6b16a62e509313a45b10a46d6c9ce310bb77c5e5
Author: Zi Yan <ziy@nvidia.com>
Date:   Wed Sep 13 16:12:44 2023 -0400

    mm/cma: use nth_page() in place of direct struct page manipulation
    
    commit 2e7cfe5cd5b6b0b98abf57a3074885979e187c1c upstream.
    
    Patch series "Use nth_page() in place of direct struct page manipulation",
    v3.
    
    On SPARSEMEM without VMEMMAP, struct page is not guaranteed to be
    contiguous, since each memory section's memmap might be allocated
    independently.  hugetlb pages can go beyond a memory section size, thus
    direct struct page manipulation on hugetlb pages/subpages might give wrong
    struct page.  Kernel provides nth_page() to do the manipulation properly.
    Use that whenever code can see hugetlb pages.
    
    
    This patch (of 5):
    
    When dealing with hugetlb pages, manipulating struct page pointers
    directly can get to wrong struct page, since struct page is not guaranteed
    to be contiguous on SPARSEMEM without VMEMMAP.  Use nth_page() to handle
    it properly.
    
    Without the fix, page_kasan_tag_reset() could reset wrong page tags,
    causing a wrong kasan result.  No related bug is reported.  The fix
    comes from code inspection.
    
    Link: https://lkml.kernel.org/r/20230913201248.452081-1-zi.yan@sent.com
    Link: https://lkml.kernel.org/r/20230913201248.452081-2-zi.yan@sent.com
    Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc")
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport (IBM) <rppt@kernel.org>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7453e81061a492085f00e9d3bcb26a95217577d9
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Tue Oct 24 10:15:19 2023 +0200

    s390/cmma: fix detection of DAT pages
    
    commit 44d93045247661acbd50b1629e62f415f2747577 upstream.
    
    If the cmma no-dat feature is available the kernel page tables are walked
    to identify and mark all pages which are used for address translation (all
    region, segment, and page tables). In a subsequent loop all other pages are
    marked as "no-dat" pages with the ESSA instruction.
    
    This information is visible to the hypervisor, so that the hypervisor can
    optimize purging of guest TLB entries. The initial loop however is
    incorrect: only the first three of the four pages which belong to segment
    and region tables will be marked as being used for DAT. The last page is
    incorrectly marked as no-dat.
    
    This can result in incorrect guest TLB flushes.
    
    Fix this by simply marking all four pages.
    
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bfabe8d0c1c106f6567f5688f29fd4cee1675d6c
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Fri Oct 20 17:26:50 2023 +0200

    s390/mm: add missing arch_set_page_dat() call to gmap allocations
    
    commit 1954da4a2b621a3328a63382cae7e5f5e2af502c upstream.
    
    If the cmma no-dat feature is available all pages that are not used for
    dynamic address translation are marked as "no-dat" with the ESSA
    instruction. This information is visible to the hypervisor, so that the
    hypervisor can optimize purging of guest TLB entries. This also means that
    pages which are used for dynamic address translation must not be marked as
    "no-dat", since the hypervisor may then incorrectly not purge guest TLB
    entries.
    
    Region, segment, and page tables allocated within the gmap code are
    incorrectly marked as "no-dat", since an explicit call to
    arch_set_page_dat() is missing, which would remove the "no-dat" mark.
    
    In order to fix this add a new gmap_alloc_crst() function which should
    be used to allocate region and segment tables, and which also calls
    arch_set_page_dat().
    
    Also add the arch_set_page_dat() call to page_table_alloc_pgste().
    
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8847617e2f0a0344ff88147a2cd89a42bd309ed8
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Tue Oct 17 21:07:04 2023 +0200

    s390/mm: add missing arch_set_page_dat() call to vmem_crst_alloc()
    
    commit 09cda0a400519b1541591c506e54c9c48e3101bf upstream.
    
    If the cmma no-dat feature is available all pages that are not used for
    dynamic address translation are marked as "no-dat" with the ESSA
    instruction. This information is visible to the hypervisor, so that the
    hypervisor can optimize purging of guest TLB entries. This also means that
    pages which are used for dynamic address translation must not be marked as
    "no-dat", since the hypervisor may then incorrectly not purge guest TLB
    entries.
    
    Region and segment tables allocated via vmem_crst_alloc() are incorrectly
    marked as "no-dat", as soon as slab_is_available() returns true.
    
    Such tables are allocated e.g. when kernel page tables are split, memory is
    hotplugged, or a DCSS segment is loaded.
    
    Fix this by adding the missing arch_set_page_dat() call.
    
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d356d3379d8782f0b6db324cd6e01e718ea8fe2e
Author: Alain Volmat <alain.volmat@foss.st.com>
Date:   Mon Oct 9 10:24:50 2023 +0200

    dmaengine: stm32-mdma: correct desc prep when channel running
    
    commit 03f25d53b145bc2f7ccc82fc04e4482ed734f524 upstream.
    
    In case of the prep descriptor while the channel is already running, the
    CCR register value stored into the channel could already have its EN bit
    set.  This would lead to a bad transfer since, at start transfer time,
    enabling the channel while other registers aren't yet properly set.
    To avoid this, ensure to mask the CCR_EN bit when storing the ccr value
    into the mdma channel structure.
    
    Fixes: a4ffb13c8946 ("dmaengine: Add STM32 MDMA driver")
    Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
    Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
    Cc: stable@vger.kernel.org
    Tested-by: Alain Volmat <alain.volmat@foss.st.com>
    Link: https://lore.kernel.org/r/20231009082450.452877-1-amelie.delaunay@foss.st.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 07f2f69f0b82578da6bda5f10320ddfe0be43d96
Author: Sanjuán García, Jorge <Jorge.SanjuanGarcia@duagon.com>
Date:   Thu Oct 19 14:15:34 2023 +0000

    mcb: fix error handling for different scenarios when parsing
    
    commit 63ba2d07b4be72b94216d20561f43e1150b25d98 upstream.
    
    chameleon_parse_gdd() may fail for different reasons and end up
    in the err tag. Make sure we at least always free the mcb_device
    allocated with mcb_alloc_dev().
    
    If mcb_device_register() fails, make sure to give up the reference
    in the same place the device was added.
    
    Fixes: 728ac3389296 ("mcb: mcb-parse: fix error handing in chameleon_parse_gdd()")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Jose Javier Rodriguez Barbarin <JoseJavier.Rodriguez@duagon.com>
    Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com>
    Link: https://lore.kernel.org/r/20231019141434.57971-2-jorge.sanjuangarcia@duagon.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e4eccf228ac2c050d17af9a7bc6457a4d4e9116b
Author: Saravana Kannan <saravanak@google.com>
Date:   Tue Oct 17 18:38:50 2023 -0700

    driver core: Release all resources during unbind before updating device links
    
    commit 2e84dc37920012b458e9458b19fc4ed33f81bc74 upstream.
    
    This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional
    dependencies tracking support") where the device link status was
    incorrectly updated in the driver unbind path before all the device's
    resources were released.
    
    Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support")
    Cc: stable <stable@kernel.org>
    Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Closes: https://lore.kernel.org/all/20231014161721.f4iqyroddkcyoefo@pengutronix.de/
    Signed-off-by: Saravana Kannan <saravanak@google.com>
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Cc: Yang Yingliang <yangyingliang@huawei.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Matti Vaittinen <mazziesaccount@gmail.com>
    Cc: James Clark <james.clark@arm.com>
    Acked-by: "Rafael J. Wysocki" <rafael@kernel.org>
    Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/20231018013851.3303928-1-saravanak@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 707e483e711614e2ca4cf7bd73d983564cae2ccd
Author: Steven Rostedt (Google) <rostedt@goodmis.org>
Date:   Tue Oct 31 15:10:33 2023 -0400

    tracing: Have the user copy of synthetic event address use correct context
    
    commit 4f7969bcd6d33042d62e249b41b5578161e4c868 upstream.
    
    A synthetic event is created by the synthetic event interface that can
    read both user or kernel address memory. In reality, it reads any
    arbitrary memory location from within the kernel. If the address space is
    in USER (where CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE is set) then
    it uses strncpy_from_user_nofault() to copy strings otherwise it uses
    strncpy_from_kernel_nofault().
    
    But since both functions use the same variable there's no annotation to
    what that variable is (ie. __user). This makes sparse complain.
    
    Quiet sparse by typecasting the strncpy_from_user_nofault() variable to
    a __user pointer.
    
    Link: https://lore.kernel.org/linux-trace-kernel/20231031151033.73c42e23@gandalf.local.home
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Fixes: 0934ae9977c2 ("tracing: Fix reading strings from synthetic events");
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202311010013.fm8WTxa5-lkp@intel.com/
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4c004ed95273f22228ce67147f4a5615e7a62845
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
Date:   Tue Jul 11 17:13:34 2023 +0800

    selftests/clone3: Fix broken test under !CONFIG_TIME_NS
    
    commit fc7f04dc23db50206bee7891516ed4726c3f64cf upstream.
    
    When execute the following command to test clone3 under !CONFIG_TIME_NS:
    
      # make headers && cd tools/testing/selftests/clone3 && make && ./clone3
    
    we can see the following error info:
    
      # [7538] Trying clone3() with flags 0x80 (size 0)
      # Invalid argument - Failed to create new process
      # [7538] clone3() with flags says: -22 expected 0
      not ok 18 [7538] Result (-22) is different than expected (0)
      ...
      # Totals: pass:18 fail:1 xfail:0 xpass:0 skip:0 error:0
    
    This is because if CONFIG_TIME_NS is not set, but the flag
    CLONE_NEWTIME (0x80) is used to clone a time namespace, it
    will return -EINVAL in copy_time_ns().
    
    If kernel does not support CONFIG_TIME_NS, /proc/self/ns/time
    will be not exist, and then we should skip clone3() test with
    CLONE_NEWTIME.
    
    With this patch under !CONFIG_TIME_NS:
    
      # make headers && cd tools/testing/selftests/clone3 && make && ./clone3
      ...
      # Time namespaces are not supported
      ok 18 # SKIP Skipping clone3() with CLONE_NEWTIME
      ...
      # Totals: pass:18 fail:0 xfail:0 xpass:0 skip:1 error:0
    
    Link: https://lkml.kernel.org/r/1689066814-13295-1-git-send-email-yangtiezhu@loongson.cn
    Fixes: 515bddf0ec41 ("selftests/clone3: test clone3 with CLONE_NEWTIME")
    Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3473cf43b9068b9dfef2f545f833f33c6a544b91
Author: Benjamin Bara <benjamin.bara@skidata.com>
Date:   Sat Jul 15 09:53:24 2023 +0200

    i2c: core: Run atomic i2c xfer when !preemptible
    
    commit aa49c90894d06e18a1ee7c095edbd2f37c232d02 upstream.
    
    Since bae1d3a05a8b, i2c transfers are non-atomic if preemption is
    disabled. However, non-atomic i2c transfers require preemption (e.g. in
    wait_for_completion() while waiting for the DMA).
    
    panic() calls preempt_disable_notrace() before calling
    emergency_restart(). Therefore, if an i2c device is used for the
    restart, the xfer should be atomic. This avoids warnings like:
    
    [   12.667612] WARNING: CPU: 1 PID: 1 at kernel/rcu/tree_plugin.h:318 rcu_note_context_switch+0x33c/0x6b0
    [   12.676926] Voluntary context switch within RCU read-side critical section!
    ...
    [   12.742376]  schedule_timeout from wait_for_completion_timeout+0x90/0x114
    [   12.749179]  wait_for_completion_timeout from tegra_i2c_wait_completion+0x40/0x70
    ...
    [   12.994527]  atomic_notifier_call_chain from machine_restart+0x34/0x58
    [   13.001050]  machine_restart from panic+0x2a8/0x32c
    
    Use !preemptible() instead, which is basically the same check as
    pre-v5.2.
    
    Fixes: bae1d3a05a8b ("i2c: core: remove use of in_atomic()")
    Cc: stable@vger.kernel.org # v5.2+
    Suggested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Acked-by: Wolfram Sang <wsa@kernel.org>
    Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Tested-by: Nishanth Menon <nm@ti.com>
    Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
    Link: https://lore.kernel.org/r/20230327-tegra-pmic-reboot-v7-2-18699d5dcd76@skidata.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit df5062f0815ab3b2477cc146ec9a71f4686340e8
Author: Zi Yan <ziy@nvidia.com>
Date:   Wed Sep 13 16:12:48 2023 -0400

    mips: use nth_page() in place of direct struct page manipulation
    
    commit aa5fe31b6b59210cb4ea28a59e68781f48eeca74 upstream.
    
    __flush_dcache_pages() is called during hugetlb migration via
    migrate_pages() -> migrate_hugetlbs() -> unmap_and_move_huge_page() ->
    move_to_new_folio() -> flush_dcache_folio().  And with hugetlb and without
    sparsemem vmemmap, struct page is not guaranteed to be contiguous beyond a
    section.  Use nth_page() instead.
    
    Without the fix, a wrong address might be used for data cache page flush.
    No bug is reported. The fix comes from code inspection.
    
    Link: https://lkml.kernel.org/r/20230913201248.452081-6-zi.yan@sent.com
    Fixes: 15fa3e8e3269 ("mips: implement the new page table range API")
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport (IBM) <rppt@kernel.org>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc64f5ea94442d8fb663ead545ccfb6976cc2a11
Author: Zi Yan <ziy@nvidia.com>
Date:   Wed Sep 13 16:12:47 2023 -0400

    fs: use nth_page() in place of direct struct page manipulation
    
    commit 8db0ec791f7788cd21e7f91ee5ff42c1c458d0e7 upstream.
    
    When dealing with hugetlb pages, struct page is not guaranteed to be
    contiguous on SPARSEMEM without VMEMMAP.  Use nth_page() to handle it
    properly.
    
    Without the fix, a wrong subpage might be checked for HWPoison, causing wrong
    number of bytes of a page copied to user space. No bug is reported. The fix
    comes from code inspection.
    
    Link: https://lkml.kernel.org/r/20230913201248.452081-5-zi.yan@sent.com
    Fixes: 38c1ddbde6c6 ("hugetlbfs: improve read HWPOISON hugepage")
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport (IBM) <rppt@kernel.org>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 08c52a25fa57eb48f53647217036357ecda42e62
Author: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Date:   Tue Oct 31 16:22:36 2023 -0400

    scripts/gdb/vmalloc: disable on no-MMU
    
    commit 6620999f0d41e4fd6f047727936a964c3399d249 upstream.
    
    vmap_area does not exist on no-MMU, therefore the GDB scripts fail to
    load:
    
    Traceback (most recent call last):
      File "<...>/vmlinux-gdb.py", line 51, in <module>
        import linux.vmalloc
      File "<...>/scripts/gdb/linux/vmalloc.py", line 14, in <module>
        vmap_area_ptr_type = vmap_area_type.get_type().pointer()
                             ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<...>/scripts/gdb/linux/utils.py", line 28, in get_type
        self._type = gdb.lookup_type(self._name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    gdb.error: No struct type named vmap_area.
    
    To fix this, disable the command and add an informative error message if
    CONFIG_MMU is not defined, following the example of lx-slabinfo.
    
    Link: https://lkml.kernel.org/r/20231031202235.2655333-2-ben.wolsieffer@hefring.com
    Fixes: 852622bf3616 ("scripts/gdb/vmalloc: add vmallocinfo support")
    Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
    Cc: Jan Kiszka <jan.kiszka@siemens.com>
    Cc: Kieran Bingham <kbingham@kernel.org>
    Cc: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b3d81d3e8b607116af4323840bb5a904918acea2
Author: Benjamin Bara <benjamin.bara@skidata.com>
Date:   Sat Jul 15 09:53:23 2023 +0200

    kernel/reboot: emergency_restart: Set correct system_state
    
    commit 60466c067927abbcaff299845abd4b7069963139 upstream.
    
    As the emergency restart does not call kernel_restart_prepare(), the
    system_state stays in SYSTEM_RUNNING.
    
    Since bae1d3a05a8b, this hinders i2c_in_atomic_xfer_mode() from becoming
    active, and therefore might lead to avoidable warnings in the restart
    handlers, e.g.:
    
    [   12.667612] WARNING: CPU: 1 PID: 1 at kernel/rcu/tree_plugin.h:318 rcu_note_context_switch+0x33c/0x6b0
    [   12.676926] Voluntary context switch within RCU read-side critical section!
    ...
    [   12.742376]  schedule_timeout from wait_for_completion_timeout+0x90/0x114
    [   12.749179]  wait_for_completion_timeout from tegra_i2c_wait_completion+0x40/0x70
    ...
    [   12.994527]  atomic_notifier_call_chain from machine_restart+0x34/0x58
    [   13.001050]  machine_restart from panic+0x2a8/0x32c
    
    Avoid these by setting the correct system_state.
    
    Fixes: bae1d3a05a8b ("i2c: core: remove use of in_atomic()")
    Cc: stable@vger.kernel.org # v5.2+
    Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
    Tested-by: Nishanth Menon <nm@ti.com>
    Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
    Link: https://lore.kernel.org/r/20230327-tegra-pmic-reboot-v7-1-18699d5dcd76@skidata.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0b98335aded47ebf3d218f69fc6ab0ceb7e423c6
Author: Eric Biggers <ebiggers@google.com>
Date:   Mon Sep 4 17:32:27 2023 -0700

    quota: explicitly forbid quota files from being encrypted
    
    commit d3cc1b0be258191d6360c82ea158c2972f8d3991 upstream.
    
    Since commit d7e7b9af104c ("fscrypt: stop using keyrings subsystem for
    fscrypt_master_key"), xfstest generic/270 causes a WARNING when run on
    f2fs with test_dummy_encryption in the mount options:
    
    $ kvm-xfstests -c f2fs/encrypt generic/270
    [...]
    WARNING: CPU: 1 PID: 2453 at fs/crypto/keyring.c:240 fscrypt_destroy_keyring+0x1f5/0x260
    
    The cause of the WARNING is that not all encrypted inodes have been
    evicted before fscrypt_destroy_keyring() is called, which violates an
    assumption.  This happens because the test uses an external quota file,
    which gets automatically encrypted due to test_dummy_encryption.
    
    Encryption of quota files has never really been supported.  On ext4,
    ext4_quota_read() does not decrypt the data, so encrypted quota files
    are always considered invalid on ext4.  On f2fs, f2fs_quota_read() uses
    the pagecache, so trying to use an encrypted quota file gets farther,
    resulting in the issue described above being possible.  But this was
    never intended to be possible, and there is no use case for it.
    
    Therefore, make the quota support layer explicitly reject using
    IS_ENCRYPTED inodes when quotaon is attempted.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Message-Id: <20230905003227.326998-1-ebiggers@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5706a65c3bd110e01dd695039c218d4ea2f67339
Author: Zhihao Cheng <chengzhihao1@huawei.com>
Date:   Tue Sep 19 09:25:25 2023 +0800

    jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev
    
    commit 61187fce8600e8ef90e601be84f9d0f3222c1206 upstream.
    
    JBD2 makes sure journal data is fallen on fs device by sync_blockdev(),
    however, other process could intercept the EIO information from bdev's
    mapping, which leads journal recovering successful even EIO occurs during
    data written back to fs device.
    
    We found this problem in our product, iscsi + multipath is chosen for block
    device of ext4. Unstable network may trigger kpartx to rescan partitions in
    device mapper layer. Detailed process is shown as following:
    
      mount          kpartx          irq
    jbd2_journal_recover
     do_one_pass
      memcpy(nbh->b_data, obh->b_data) // copy data to fs dev from journal
      mark_buffer_dirty // mark bh dirty
             vfs_read
              generic_file_read_iter // dio
               filemap_write_and_wait_range
                __filemap_fdatawrite_range
                 do_writepages
                  block_write_full_folio
                   submit_bh_wbc
                        >>  EIO occurs in disk  <<
                                 end_buffer_async_write
                                  mark_buffer_write_io_error
                                   mapping_set_error
                                    set_bit(AS_EIO, &mapping->flags) // set!
                filemap_check_errors
                 test_and_clear_bit(AS_EIO, &mapping->flags) // clear!
     err2 = sync_blockdev
      filemap_write_and_wait
       filemap_check_errors
        test_and_clear_bit(AS_EIO, &mapping->flags) // false
     err2 = 0
    
    Filesystem is mounted successfully even data from journal is failed written
    into disk, and ext4/ocfs2 could become corrupted.
    
    Fix it by comparing the wb_err state in fs block device before recovering
    and after recovering.
    
    A reproducer can be found in the kernel bugzilla referenced below.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217888
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20230919012525.1783108-1-chengzhihao1@huawei.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6d1adbec337228b31c6a76d908e36b8754872723
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Tue Oct 3 17:54:22 2023 +0200

    ASoC: codecs: wsa-macro: fix uninitialized stack variables with name prefix
    
    commit 72151ad0cba8a07df90130ff62c979520d71f23b upstream.
    
    Driver compares widget name in wsa_macro_spk_boost_event() widget event
    callback, however it does not handle component's name prefix.  This
    leads to using uninitialized stack variables as registers and register
    values.  Handle gracefully such case.
    
    Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route")
    Cc: stable@vger.kernel.org
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Link: https://lore.kernel.org/r/20231003155422.801160-1-krzysztof.kozlowski@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 465b557215664536cd20001872dade2cc4ae2d6a
Author: Jamie Lentin <jm@lentin.co.uk>
Date:   Mon Oct 2 15:09:14 2023 +0000

    hid: lenovo: Resend all settings on reset_resume for compact keyboards
    
    commit 2f2bd7cbd1d1548137b351040dc4e037d18cdfdc upstream.
    
    The USB Compact Keyboard variant requires a reset_resume function to
    restore keyboard configuration after a suspend in some situations. Move
    configuration normally done on probe to lenovo_features_set_cptkbd(), then
    recycle this for use on reset_resume.
    
    Without, the keyboard and driver would end up in an inconsistent state,
    breaking middle-button scrolling amongst other problems, and twiddling
    sysfs values wouldn't help as the middle-button mode won't be set until
    the driver is reloaded.
    
    Tested on a USB and Bluetooth Thinkpad Compact Keyboard.
    
    CC: stable@vger.kernel.org
    Fixes: 94eefa271323 ("HID: lenovo: Use native middle-button mode for compact keyboards")
    Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
    Signed-off-by: Martin Kepplinger <martink@posteo.de>
    Link: https://lore.kernel.org/r/20231002150914.22101-1-martink@posteo.de
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7fb9d792c06d664587b7aebb5b5c0ec8ec2bdc26
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Oct 2 12:48:13 2023 +0300

    selftests/resctrl: Reduce failures due to outliers in MBA/MBM tests
    
    commit ef43c30858754d99373a63dff33280a9969b49bc upstream.
    
    The initial value of 5% chosen for the maximum allowed percentage
    difference between resctrl mbm value and IMC mbm value in
    
    commit 06bd03a57f8c ("selftests/resctrl: Fix MBA/MBM results reporting
           format") was "randomly chosen value" (as admitted by the changelog).
    
    When running tests in our lab across a large number platforms, 5%
    difference upper bound for success seems a bit on the low side for the
    MBA and MBM tests. Some platforms produce outliers that are slightly
    above that, typically 6-7%, which leads MBA/MBM test frequently
    failing.
    
    Replace the "randomly chosen value" with a success bound that is based
    on those measurements across large number of platforms by relaxing the
    MBA/MBM success bound to 8%. The relaxed bound removes the failures due
    the frequent outliers.
    
    Fixed commit description style error during merge:
    Shuah Khan <skhan@linuxfoundation.org>
    
    Fixes: 06bd03a57f8c ("selftests/resctrl: Fix MBA/MBM results reporting format")
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a8eba04777849eb59bf3c2d59a0ad4ada9046dbd
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Oct 2 12:48:12 2023 +0300

    selftests/resctrl: Fix feature checks
    
    commit 06035f019422ba17e85c11e70d6d8bdbe9fa1afd upstream.
    
    The MBA and CMT tests expect support of other features to be able to
    run.
    
    When platform only supports MBA but not MBM, MBA test will fail with:
    Failed to open total bw file: No such file or directory
    
    When platform only supports CMT but not CAT, CMT test will fail with:
    Failed to open bit mask file '/sys/fs/resctrl/info/L3/cbm_mask': No such file or directory
    
    It leads to the test reporting test fail (even if no test was run at
    all).
    
    Extend feature checks to cover these two conditions to show these tests
    were skipped rather than failed.
    
    Fixes: ee0415681eb6 ("selftests/resctrl: Use resctrl/info for feature detection")
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Cc: <stable@vger.kernel.org> # selftests/resctrl: Refactor feature check to use resource and feature name
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 077171788ac8a1e2611b450e6bf90092627d2bb4
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Oct 2 12:48:11 2023 +0300

    selftests/resctrl: Refactor feature check to use resource and feature name
    
    commit d56e5da0e0f557a206bace16bbbdad00a5800e34 upstream.
    
    Feature check in validate_resctrl_feature_request() takes in the test
    name string and maps that to what to check per test.
    
    Pass resource and feature names to validate_resctrl_feature_request()
    directly rather than deriving them from the test name inside the
    function which makes the feature check easier to extend for new test
    cases.
    
    Use !! in the return statement to make the boolean conversion more
    obvious even if it is not strictly necessary from correctness point of
    view (to avoid it looking like the function is returning a freed
    pointer).
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Cc: <stable@vger.kernel.org> # selftests/resctrl: Remove duplicate feature check from CMT test
    Cc: <stable@vger.kernel.org> # selftests/resctrl: Move _GNU_SOURCE define into Makefile
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e775994f12f39da7f381da96efc2cd77f62ebd65
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Oct 2 12:48:10 2023 +0300

    selftests/resctrl: Move _GNU_SOURCE define into Makefile
    
    commit 3a1e4a91aa454a1c589a9824d54179fdbfccde45 upstream.
    
    _GNU_SOURCE is defined in resctrl.h. Defining _GNU_SOURCE has a large
    impact on what gets defined when including headers either before or
    after it. This can result in compile failures if .c file decides to
    include a standard header file before resctrl.h.
    
    It is safer to define _GNU_SOURCE in Makefile so it is always defined
    regardless of in which order includes are done.
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f30943452d8ed208f0a30eba98dfb441862f525e
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Oct 2 12:48:09 2023 +0300

    selftests/resctrl: Remove duplicate feature check from CMT test
    
    commit 030b48fb2cf045dead8ee2c5ead560930044c029 upstream.
    
    The test runner run_cmt_test() in resctrl_tests.c checks for CMT
    feature and does not run cmt_resctrl_val() if CMT is not supported.
    Then cmt_resctrl_val() also check is CMT is supported.
    
    Remove the duplicated feature check for CMT from cmt_resctrl_val().
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 38052bd5c1649f07d8b342cbec70df75429d83b1
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Oct 2 12:48:07 2023 +0300

    selftests/resctrl: Fix uninitialized .sa_flags
    
    commit beb7f471847663559bd0fe60af1d70e05a1d7c6c upstream.
    
    signal_handler_unregister() calls sigaction() with uninitializing
    sa_flags in the struct sigaction.
    
    Make sure sa_flags is always initialized in signal_handler_unregister()
    by initializing the struct sigaction when declaring it. Also add the
    initialization to signal_handler_register() even if there are no know
    bugs in there because correctness is then obvious from the code itself.
    
    Fixes: 73c55fa5ab55 ("selftests/resctrl: Commonize the signal handler register/unregister for all tests")
    Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0e0aa7108a147633146285f8956451bd8e86e6a7
Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date:   Thu Nov 23 10:47:49 2023 +0100

    ASoC: codecs: wsa883x: make use of new mute_unmute_on_trigger flag
    
    commit 805ce81826c896dd3c351a32814b28557f9edf54 upstream.
    
    In the current setup the PA is left unmuted even when the
    Soundwire ports are not started streaming. This can lead to click
    and pop sounds during start.
    There is a same issue in the reverse order where in the PA is
    left unmute even after the data stream is stopped, the time
    between data stream stopping and port closing is long enough
    to accumulate DC on the line resulting in Click/Pop noise
    during end of stream.
    
    making use of new mute_unmute_on_trigger flag is helping a
    lot with this Click/Pop issues reported on this Codec
    
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20231027105747.32450-3-srinivas.kandagatla@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 868eb92b6866aa859c37bfc837b85b3e67cc5494
Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date:   Thu Nov 23 10:47:48 2023 +0100

    ASoC: soc-dai: add flag to mute and unmute stream during trigger
    
    commit f0220575e65abe09c09cd17826a3cdea76e8d58f upstream.
    
    In some setups like Speaker amps which are very sensitive, ex: keeping them
    unmute without actual data stream for very short duration results in a
    static charge and results in pop and clicks. To minimize this, provide a way
    to mute and unmute such codecs during trigger callbacks.
    
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20231027105747.32450-2-srinivas.kandagatla@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    [ johan: backport to v6.6.2 ]
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8c9a954c60a7b3f9e46bdda5d1ab5dabe59539d9
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Nov 21 13:14:22 2023 +0100

    netfilter: nf_tables: split async and sync catchall in two functions
    
    [ Upstream commit 8837ba3e58ea1e3d09ae36db80b1e80853aada95 ]
    
    list_for_each_entry_safe() does not work for the async case which runs
    under RCU, therefore, split GC logic for catchall in two functions
    instead, one for each of the sync and async GC variants.
    
    The catchall sync GC variant never sees a _DEAD bit set on ever, thus,
    this handling is removed in such case, moreover, allocate GC sync batch
    via GFP_KERNEL.
    
    Fixes: 93995bf4af2c ("netfilter: nf_tables: remove catchall element in GC sync path")
    Reported-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 80d6a9236ab6d2c0fd241514d1af2e325d16a210
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Nov 21 13:14:21 2023 +0100

    netfilter: nf_tables: remove catchall element in GC sync path
    
    [ Upstream commit 93995bf4af2c5a99e2a87f0cd5ce547d31eb7630 ]
    
    The expired catchall element is not deactivated and removed from GC sync
    path. This path holds mutex so just call nft_setelem_data_deactivate()
    and nft_setelem_catchall_remove() before queueing the GC work.
    
    Fixes: 4a9e12ea7e70 ("netfilter: nft_set_pipapo: call nft_trans_gc_queue_sync() in catchall GC")
    Reported-by: lonial con <kongln9170@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a311638793fa0b07ecbca079273288f7b143ab2a
Author: Mimi Zohar <zohar@linux.ibm.com>
Date:   Wed Oct 18 14:47:02 2023 -0400

    ima: detect changes to the backing overlay file
    
    commit b836c4d29f2744200b2af41e14bf50758dddc818 upstream.
    
    Commit 18b44bc5a672 ("ovl: Always reevaluate the file signature for
    IMA") forced signature re-evaulation on every file access.
    
    Instead of always re-evaluating the file's integrity, detect a change
    to the backing file, by comparing the cached file metadata with the
    backing file's metadata.  Verifying just the i_version has not changed
    is insufficient.  In addition save and compare the i_ino and s_dev
    as well.
    
    Reviewed-by: Amir Goldstein <amir73il@gmail.com>
    Tested-by: Eric Snowberg <eric.snowberg@oracle.com>
    Tested-by: Raul E Rangel <rrangel@chromium.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1eb840f104c0c1fda8c5f7e9485b87882b88b952
Author: Amir Goldstein <amir73il@gmail.com>
Date:   Thu Oct 5 14:15:58 2023 +0300

    ima: annotate iint mutex to avoid lockdep false positive warnings
    
    commit e044374a8a0a99e46f4e6d6751d3042b6d9cc12e upstream.
    
    It is not clear that IMA should be nested at all, but as long is it
    measures files both on overlayfs and on underlying fs, we need to
    annotate the iint mutex to avoid lockdep false positives related to
    IMA + overlayfs, same as overlayfs annotates the inode mutex.
    
    Reported-and-tested-by: syzbot+b42fe626038981fb7bfa@syzkaller.appspotmail.com
    Signed-off-by: Amir Goldstein <amir73il@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit affae18838db5e6b463ee30c821385695af56dc2
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Oct 3 17:29:24 2023 +0200

    mfd: qcom-spmi-pmic: Fix revid implementation
    
    commit 7b439aaa62fee474a0d84d67a25f4984467e7b95 upstream.
    
    The Qualcomm SPMI PMIC revid implementation is broken in multiple ways.
    
    First, it assumes that just because the sibling base device has been
    registered that means that it is also bound to a driver, which may not
    be the case (e.g. due to probe deferral or asynchronous probe). This
    could trigger a NULL-pointer dereference when attempting to access the
    driver data of the unbound device.
    
    Second, it accesses driver data of a sibling device directly and without
    any locking, which means that the driver data may be freed while it is
    being accessed (e.g. on driver unbind).
    
    Third, it leaks a struct device reference to the sibling device which is
    looked up using the spmi_device_from_of() every time a function (child)
    device is calling the revid function (e.g. on probe).
    
    Fix this mess by reimplementing the revid lookup so that it is done only
    at probe of the PMIC device; the base device fetches the revid info from
    the hardware, while any secondary SPMI device fetches the information
    from the base device and caches it so that it can be accessed safely
    from its children. If the base device has not been probed yet then probe
    of a secondary device is deferred.
    
    Fixes: e9c11c6e3a0e ("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
    Cc: stable@vger.kernel.org      # 6.0
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
    Link: https://lore.kernel.org/r/20231003152927.15000-3-johan+linaro@kernel.org
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit df148c18b51c55c7fe8d2937de36627cc8a0a861
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Tue Oct 3 17:29:23 2023 +0200

    mfd: qcom-spmi-pmic: Fix reference leaks in revid helper
    
    commit a0fa44c261e448c531f9adb3a5189a3520f3e316 upstream.
    
    The Qualcomm SPMI PMIC revid implementation is broken in multiple ways.
    
    First, it totally ignores struct device_node reference counting and
    leaks references to the parent bus node as well as each child it
    iterates over using an open-coded for_each_child_of_node().
    
    Second, it leaks references to each spmi device on the bus that it
    iterates over by failing to drop the reference taken by the
    spmi_device_from_of() helper.
    
    Fix the struct device_node leaks by reimplementing the lookup using
    for_each_child_of_node() and adding the missing reference count
    decrements. Fix the sibling struct device leaks by dropping the
    unnecessary lookups of devices with the wrong USID.
    
    Note that this still leaves one struct device reference leak in case a
    base device is found but it is not the parent of the device used for the
    lookup. This will be addressed in a follow-on patch.
    
    Fixes: e9c11c6e3a0e ("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
    Cc: stable@vger.kernel.org      # 6.0
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
    Link: https://lore.kernel.org/r/20231003152927.15000-2-johan+linaro@kernel.org
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0eb10025063362850ba0ce6b437406bc21427f8c
Author: Christian Marangi <ansuelsmth@gmail.com>
Date:   Sat Oct 7 15:10:42 2023 +0200

    leds: trigger: netdev: Move size check in set_device_name
    
    commit 259e33cbb1712a7dd844fc9757661cc47cb0e39b upstream.
    
    GCC 13.2 complains about array subscript 17 is above array bounds of
    'char[16]' with IFNAMSIZ set to 16.
    
    The warning is correct but this scenario is impossible.
    set_device_name is called by device_name_store (store sysfs entry) and
    netdev_trig_activate.
    
    device_name_store already check if size is >= of IFNAMSIZ and return
    -EINVAL. (making the warning scenario impossible)
    
    netdev_trig_activate works on already defined interface, where the name
    has already been checked and should already follow the condition of
    strlen() < IFNAMSIZ.
    
    Aside from the scenario being impossible, set_device_name can be
    improved to both mute the warning and make the function safer.
    To make it safer, move size check from device_name_store directly to
    set_device_name and prevent any out of bounds scenario.
    
    Cc: stable@vger.kernel.org
    Fixes: 28a6a2ef18ad ("leds: trigger: netdev: refactor code setting device name")
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202309192035.GTJEEbem-lkp@intel.com/
    Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
    Link: https://lore.kernel.org/r/20231007131042.15032-1-ansuelsmth@gmail.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afa233688defa241d2c1b4bad88807ee3215d469
Author: Vignesh Viswanathan <quic_viswanat@quicinc.com>
Date:   Tue Sep 5 15:25:34 2023 +0530

    arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size
    
    commit 72fc3d58b87b0d622039c6299b89024fbb7b420f upstream.
    
    IPQ6018's TCSR Mutex HW lock register has 32 locks of size 4KB each.
    Total size of the TCSR Mutex registers is 128KB.
    
    Fix size of the tcsr_mutex hwlock register to 0x20000.
    
    Changes in v2:
     - Drop change to remove qcom,ipq6018-tcsr-mutex compatible string
     - Added Fixes and stable tags
    
    Cc: stable@vger.kernel.org
    Fixes: 5bf635621245 ("arm64: dts: ipq6018: Add a few device nodes")
    Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230905095535.1263113-2-quic_viswanat@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit abedf0d415d11588741d5d834e6ea69656604c23
Author: Vignesh Viswanathan <quic_viswanat@quicinc.com>
Date:   Mon Sep 4 22:55:15 2023 +0530

    arm64: dts: qcom: ipq9574: Fix hwlock index for SMEM
    
    commit 5fe8508e2bc8eb4208b0434b6c1ca306c1519ade upstream.
    
    SMEM uses lock index 3 of the TCSR Mutex hwlock for allocations
    in SMEM region shared by the Host and FW.
    
    Fix the SMEM hwlock index to 3 for IPQ9574.
    
    Cc: stable@vger.kernel.org
    Fixes: 46384ac7a618 ("arm64: dts: qcom: ipq9574: Add SMEM support")
    Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
    Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230904172516.479866-5-quic_viswanat@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e5f516b24c9ecd4c616b7867195a6c0adac57b03
Author: Vasily Khoruzhick <anarsoul@gmail.com>
Date:   Wed Sep 27 12:50:02 2023 -0700

    ACPI: FPDT: properly handle invalid FPDT subtables
    
    commit a83c68a3bf7c418c9a46693c63c638852b0c1f4e upstream.
    
    Buggy BIOSes may have invalid FPDT subtables, e.g. on my hardware:
    
    S3PT subtable:
    
    7F20FE30: 53 33 50 54 24 00 00 00-00 00 00 00 00 00 18 01  *S3PT$...........*
    7F20FE40: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  *................*
    7F20FE50: 00 00 00 00
    
    Here the first record has zero length.
    
    FBPT subtable:
    
    7F20FE50:             46 42 50 54-3C 00 00 00 46 42 50 54  *....FBPT<...FBPT*
    7F20FE60: 02 00 30 02 00 00 00 00-00 00 00 00 00 00 00 00  *..0.............*
    7F20FE70: 2A A6 BC 6E 0B 00 00 00-1A 44 41 70 0B 00 00 00  **..n.....DAp....*
    7F20FE80: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  *................*
    
    And here FBPT table has FBPT signature repeated instead of the first
    record.
    
    Current code will be looping indefinitely due to zero length records, so
    break out of the loop if record length is zero.
    
    While we are here, add proper handling for fpdt_process_subtable()
    failures.
    
    Fixes: d1eb86e59be0 ("ACPI: tables: introduce support for FPDT table")
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
    [ rjw: Comment edit, added empty code lines ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit df56691a37dbebdc31bf048890bb192381ecdd58
Author: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com>
Date:   Mon Sep 25 13:59:22 2023 +0530

    firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit
    
    commit 3337a6fea25370d3d244ec6bb38c71ee86fcf837 upstream.
    
    Per the "SMC calling convention specification", the 64-bit calling
    convention can only be used when the client is 64-bit. Whereas the
    32-bit calling convention can be used by either a 32-bit or a 64-bit
    client.
    
    Currently during SCM probe, irrespective of the client, 64-bit calling
    convention is made, which is incorrect and may lead to the undefined
    behaviour when the client is 32-bit. Let's fix it.
    
    Cc: stable@vger.kernel.org
    Fixes: 9a434cee773a ("firmware: qcom_scm: Dynamically support SMCCC and legacy conventions")
    Reviewed-By: Elliot Berman <quic_eberman@quicinc.com>
    Signed-off-by: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com>
    Link: https://lore.kernel.org/r/20230925-scm-v3-1-8790dff6a749@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 209013e103631c752a2728e5431f3c523e46eee9
Author: Vignesh Viswanathan <quic_viswanat@quicinc.com>
Date:   Mon Sep 4 22:55:14 2023 +0530

    arm64: dts: qcom: ipq8074: Fix hwlock index for SMEM
    
    commit 8a781d04e580705d36f7db07f5c80e748100b69d upstream.
    
    SMEM uses lock index 3 of the TCSR Mutex hwlock for allocations
    in SMEM region shared by the Host and FW.
    
    Fix the SMEM hwlock index to 3 for IPQ8074.
    
    Cc: stable@vger.kernel.org
    Fixes: 42124b947e8e ("arm64: dts: qcom: ipq8074: add SMEM support")
    Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
    Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230904172516.479866-4-quic_viswanat@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b9e69ada222016e3c52f679a68448cb15fb3e833
Author: Vignesh Viswanathan <quic_viswanat@quicinc.com>
Date:   Mon Sep 4 22:55:12 2023 +0530

    arm64: dts: qcom: ipq5332: Fix hwlock index for SMEM
    
    commit d08afd80158399a081b478a19902364e3dd0f84c upstream.
    
    SMEM uses lock index 3 of the TCSR Mutex hwlock for allocations
    in SMEM region shared by the Host and FW.
    
    Fix the SMEM hwlock index to 3 for IPQ5332.
    
    Cc: stable@vger.kernel.org
    Fixes: d56dd7f935e1 ("arm64: dts: qcom: ipq5332: add SMEM support")
    Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
    Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230904172516.479866-2-quic_viswanat@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0a8585281b11e3a0723bba8d8085d61f0b55f37c
Author: David Arcari <darcari@redhat.com>
Date:   Thu Oct 5 07:17:57 2023 -0400

    thermal: intel: powerclamp: fix mismatch in get function for max_idle
    
    commit fae633cfb729da2771b5433f6b84ae7e8b4aa5f7 upstream.
    
    KASAN reported this
    
          [ 444.853098] BUG: KASAN: global-out-of-bounds in param_get_int+0x77/0x90
          [ 444.853111] Read of size 4 at addr ffffffffc16c9220 by task cat/2105
          ...
          [ 444.853442] The buggy address belongs to the variable:
          [ 444.853443] max_idle+0x0/0xffffffffffffcde0 [intel_powerclamp]
    
    There is a mismatch between the param_get_int and the definition of
    max_idle.  Replacing param_get_int with param_get_byte resolves this
    issue.
    
    Fixes: ebf519710218 ("thermal: intel: powerclamp: Add two module parameters")
    Cc: 6.3+ <stable@vger.kernel.org> # 6.3+
    Signed-off-by: David Arcari <darcari@redhat.com>
    Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 85bb1d41d76fe03805f506b475595d3e70197200
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Mon Sep 18 14:15:33 2023 -0400

    btrfs: don't arbitrarily slow down delalloc if we're committing
    
    commit 11aeb97b45ad2e0040cbb2a589bc403152526345 upstream.
    
    We have a random schedule_timeout() if the current transaction is
    committing, which seems to be a holdover from the original delalloc
    reservation code.
    
    Remove this, we have the proper flushing stuff, we shouldn't be hoping
    for random timing things to make everything work.  This just induces
    latency for no reason.
    
    CC: stable@vger.kernel.org # 5.4+
    Signed-off-by: Josef Bacik <josef@toxicpanda.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b88cc37a8208d17a0298ec5c0c5bd519435aefee
Author: Catalin Marinas <catalin.marinas@arm.com>
Date:   Sat Sep 30 17:46:56 2023 +0000

    rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects
    
    commit 5f98fd034ca6fd1ab8c91a3488968a0e9caaabf6 upstream.
    
    Since the actual slab freeing is deferred when calling kvfree_rcu(), so
    is the kmemleak_free() callback informing kmemleak of the object
    deletion. From the perspective of the kvfree_rcu() caller, the object is
    freed and it may remove any references to it. Since kmemleak does not
    scan RCU internal data storing the pointer, it will report such objects
    as leaks during the grace period.
    
    Tell kmemleak to ignore such objects on the kvfree_call_rcu() path. Note
    that the tiny RCU implementation does not have such issue since the
    objects can be tracked from the rcu_ctrlblk structure.
    
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Reported-by: Christoph Paasch <cpaasch@apple.com>
    Closes: https://lore.kernel.org/all/F903A825-F05F-4B77-A2B5-7356282FBA2C@apple.com/
    Cc: <stable@vger.kernel.org>
    Tested-by: Christoph Paasch <cpaasch@apple.com>
    Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0756504578f28f3814219f414708536a16967ad7
Author: Brian Geffon <bgeffon@google.com>
Date:   Fri Sep 22 12:07:04 2023 -0400

    PM: hibernate: Clean up sync_read handling in snapshot_write_next()
    
    commit d08970df1980476f27936e24d452550f3e9e92e1 upstream.
    
    In snapshot_write_next(), sync_read is set and unset in three different
    spots unnecessiarly. As a result there is a subtle bug where the first
    page after the meta data has been loaded unconditionally sets sync_read
    to 0. If this first PFN was actually a highmem page, then the returned
    buffer will be the global "buffer," and the page needs to be loaded
    synchronously.
    
    That is, I'm not sure we can always assume the following to be safe:
    
            handle->buffer = get_buffer(&orig_bm, &ca);
            handle->sync_read = 0;
    
    Because get_buffer() can call get_highmem_page_buffer() which can
    return 'buffer'.
    
    The easiest way to address this is just set sync_read before
    snapshot_write_next() returns if handle->buffer == buffer.
    
    Signed-off-by: Brian Geffon <bgeffon@google.com>
    Fixes: 8357376d3df2 ("[PATCH] swsusp: Improve handling of highmem")
    Cc: All applicable <stable@vger.kernel.org>
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6321330d99e049d155561322c36664fde22ff1bd
Author: Brian Geffon <bgeffon@google.com>
Date:   Thu Sep 21 13:00:45 2023 -0400

    PM: hibernate: Use __get_safe_page() rather than touching the list
    
    commit f0c7183008b41e92fa676406d87f18773724b48b upstream.
    
    We found at least one situation where the safe pages list was empty and
    get_buffer() would gladly try to use a NULL pointer.
    
    Signed-off-by: Brian Geffon <bgeffon@google.com>
    Fixes: 8357376d3df2 ("[PATCH] swsusp: Improve handling of highmem")
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7d305a4804f3848f4a304addabf34e7b0156be57
Author: Biju Das <biju.das.jz@bp.renesas.com>
Date:   Thu Jul 27 09:18:44 2023 +0100

    dt-bindings: timer: renesas,rz-mtu3: Fix overflow/underflow interrupt names
    
    commit b7a8f1f7a8a25e09aaefebb6251a77f44cda638b upstream.
    
    As per R01UH0914EJ0130 Rev.1.30 HW manual the MTU3 overflow/underflow
    interrupt names starts with 'tci' instead of 'tgi'.
    
    Fix this documentation issue by replacing below overflow/underflow
    interrupt names:
     - tgiv0->tciv0
     - tgiv1->tciv1
     - tgiu1->tciu1
     - tgiv2->tciv2
     - tgiu2->tciu2
     - tgiv3->tciv3
     - tgiv4->tciv4
     - tgiv6->tciv6
     - tgiv7->tciv7
     - tgiv8->tciv8
     - tgiu8->tciu8
    
    Fixes: 0a9d6b54297e ("dt-bindings: timer: Document RZ/G2L MTU3a bindings")
    Cc: stable@kernel.org
    Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
    Acked-by: Conor Dooley <conor.dooley@microchip.com>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Link: https://lore.kernel.org/r/20230727081848.100834-2-biju.das.jz@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit aeefe80c525afa2a61de2456eb6230b3187ac651
Author: Vignesh Viswanathan <quic_viswanat@quicinc.com>
Date:   Mon Sep 4 22:55:13 2023 +0530

    arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM
    
    commit 95d97b111e1e184b0c8656137033ed64f2cf21e4 upstream.
    
    SMEM uses lock index 3 of the TCSR Mutex hwlock for allocations
    in SMEM region shared by the Host and FW.
    
    Fix the SMEM hwlock index to 3 for IPQ6018.
    
    Cc: stable@vger.kernel.org
    Fixes: 5bf635621245 ("arm64: dts: ipq6018: Add a few device nodes")
    Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
    Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230904172516.479866-3-quic_viswanat@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 60f9dd96da9384e7c8990f83202ed6583e2c1cd8
Author: Joel Fernandes (Google) <joel@joelfernandes.org>
Date:   Tue Sep 5 00:02:11 2023 +0000

    rcu/tree: Defer setting of jiffies during stall reset
    
    commit b96e7a5fa0ba9cda32888e04f8f4bac42d49a7f8 upstream.
    
    There are instances where rcu_cpu_stall_reset() is called when jiffies
    did not get a chance to update for a long time. Before jiffies is
    updated, the CPU stall detector can go off triggering false-positives
    where a just-started grace period appears to be ages old. In the past,
    we disabled stall detection in rcu_cpu_stall_reset() however this got
    changed [1]. This is resulting in false-positives in KGDB usecase [2].
    
    Fix this by deferring the update of jiffies to the third run of the FQS
    loop. This is more robust, as, even if rcu_cpu_stall_reset() is called
    just before jiffies is read, we would end up pushing out the jiffies
    read by 3 more FQS loops. Meanwhile the CPU stall detection will be
    delayed and we will not get any false positives.
    
    [1] https://lore.kernel.org/all/20210521155624.174524-2-senozhatsky@chromium.org/
    [2] https://lore.kernel.org/all/20230814020045.51950-2-chenhuacai@loongson.cn/
    
    Tested with rcutorture.cpu_stall option as well to verify stall behavior
    with/without patch.
    
    Tested-by: Huacai Chen <chenhuacai@loongson.cn>
    Reported-by: Binbin Zhou <zhoubinbin@loongson.cn>
    Closes: https://lore.kernel.org/all/20230814020045.51950-2-chenhuacai@loongson.cn/
    Suggested-by: Paul  McKenney <paulmck@kernel.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Fixes: a80be428fbc1 ("rcu: Do not disable GP stall detection in rcu_cpu_stall_reset()")
    Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit be739f32a45931c2cfd0f260bb7e11b33a94cd07
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Tue Oct 10 13:23:41 2023 -0400

    svcrdma: Drop connection after an RDMA Read error
    
    commit 197115ebf358cb440c73e868b2a0a5ef728decc6 upstream.
    
    When an RPC Call message cannot be pulled from the client, that
    is a message loss, by definition. Close the connection to trigger
    the client to resend.
    
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Tom Talpey <tom@talpey.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3ce1c2c3999b232258f7aabab311d47dda75605c
Author: Ajay Singh <ajay.kathat@microchip.com>
Date:   Tue Oct 17 10:43:38 2023 +0200

    wifi: wilc1000: use vmm_table as array in wilc struct
    
    commit 05ac1a198a63ad66bf5ae8b7321407c102d40ef3 upstream.
    
    Enabling KASAN and running some iperf tests raises some memory issues with
    vmm_table:
    
    BUG: KASAN: slab-out-of-bounds in wilc_wlan_handle_txq+0x6ac/0xdb4
    Write of size 4 at addr c3a61540 by task wlan0-tx/95
    
    KASAN detects that we are writing data beyond range allocated to vmm_table.
    There is indeed a mismatch between the size passed to allocator in
    wilc_wlan_init, and the range of possible indexes used later: allocation
    size is missing a multiplication by sizeof(u32)
    
    Fixes: 40b717bfcefa ("wifi: wilc1000: fix DMA on stack objects")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
    Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20231017-wilc1000_tx_oops-v3-1-b2155f1f7bee@bootlin.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0b496b19ab669caf7739ec3f13730021e69730ec
Author: Lukas Wunner <lukas@wunner.de>
Date:   Thu Sep 21 16:23:34 2023 +0200

    PCI: Lengthen reset delay for VideoPropulsion Torrent QN16e card
    
    commit c9260693aa0c1e029ed23693cfd4d7814eee6624 upstream.
    
    Commit ac91e6980563 ("PCI: Unify delay handling for reset and resume")
    shortened an unconditional 1 sec delay after a Secondary Bus Reset to 100
    msec for PCIe (per PCIe r6.1 sec 6.6.1).  The 1 sec delay is only required
    for Conventional PCI.
    
    But it turns out that there are PCIe devices which require a longer delay
    than prescribed before first config space access after reset recovery or
    resume from D3cold:
    
    Chad reports that a "VideoPropulsion Torrent QN16e" MPEG QAM Modulator
    "raises a PCI system error (PERR), as reported by the IPMI event log, and
    the hardware itself would suffer a catastrophic event, cycling the server"
    unless the longer delay is observed.
    
    The card is specified to conform to PCIe r1.0 and indeed only supports Gen1
    speed (2.5 GT/s) according to lspci.  PCIe r1.0 sec 7.6 prescribes the same
    100 msec delay as PCIe r6.1 sec 6.6.1:
    
      To allow components to perform internal initialization, system software
      must wait for at least 100 ms from the end of a reset (cold/warm/hot)
      before it is permitted to issue Configuration Requests
    
    The behavior of the Torrent QN16e card thus appears to be a quirk.  Treat
    it as such and lengthen the reset delay for this specific device.
    
    Fixes: ac91e6980563 ("PCI: Unify delay handling for reset and resume")
    Link: https://lore.kernel.org/r/47727e792c7f0282dc144e3ec8ce8eb6e713394e.1695304512.git.lukas@wunner.de
    Reported-by: Chad Schroeder <CSchroeder@sonifi.com>
    Closes: https://lore.kernel.org/linux-pci/DM6PR16MB2844903E34CAB910082DF019B1FAA@DM6PR16MB2844.namprd16.prod.outlook.com/
    Tested-by: Chad Schroeder <CSchroeder@sonifi.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit acfc0791bd138e3af9cb1f24464797b845bab8e5
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Sun Oct 1 19:02:51 2023 +0200

    PCI: exynos: Don't discard .remove() callback
    
    commit 83a939f0fdc208ff3639dd3d42ac9b3c35607fd2 upstream.
    
    With CONFIG_PCI_EXYNOS=y and exynos_pcie_remove() marked with __exit, the
    function is discarded from the driver. In this case a bound device can
    still get unbound, e.g via sysfs. Then no cleanup code is run resulting in
    resource leaks or worse.
    
    The right thing to do is do always have the remove callback available.
    This fixes the following warning by modpost:
    
      WARNING: modpost: drivers/pci/controller/dwc/pci-exynos: section mismatch in reference: exynos_pcie_driver+0x8 (section: .data) -> exynos_pcie_remove (section: .exit.text)
    
    (with ARCH=x86_64 W=1 allmodconfig).
    
    Fixes: 340cba6092c2 ("pci: Add PCIe driver for Samsung Exynos")
    Link: https://lore.kernel.org/r/20231001170254.2506508-2-u.kleine-koenig@pengutronix.de
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5274f925e7ae0d674107e4f31a77a1ba509fc4f8
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Sun Oct 1 19:02:52 2023 +0200

    PCI: kirin: Don't discard .remove() callback
    
    commit 3064ef2e88c1629c1e67a77d7bc20020b35846f2 upstream.
    
    With CONFIG_PCIE_KIRIN=y and kirin_pcie_remove() marked with __exit, the
    function is discarded from the driver. In this case a bound device can
    still get unbound, e.g via sysfs. Then no cleanup code is run resulting in
    resource leaks or worse.
    
    The right thing to do is do always have the remove callback available.
    This fixes the following warning by modpost:
    
      drivers/pci/controller/dwc/pcie-kirin: section mismatch in reference: kirin_pcie_driver+0x8 (section: .data) -> kirin_pcie_remove (section: .exit.text)
    
    (with ARCH=x86_64 W=1 allmodconfig).
    
    Fixes: 000f60db784b ("PCI: kirin: Add support for a PHY layer")
    Link: https://lore.kernel.org/r/20231001170254.2506508-3-u.kleine-koenig@pengutronix.de
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7fce228c561c1fe6d68390f470247e25b70e16ab
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Wed Oct 11 09:46:45 2023 +0200

    PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common()
    
    commit 8e37372ad0bea4c9b4712d9943f6ae96cff9491f upstream.
    
    aspm_attr_store_common(), which handles sysfs control of ASPM, has the same
    problem as fb097dcd5a28 ("PCI/ASPM: Disable only ASPM_STATE_L1 when driver
    disables L1"): disabling L1 adds only ASPM_L1 (but not any of the L1.x
    substates) to the "aspm_disable" mask.
    
    Enabling one substate, e.g., L1.1, via sysfs removes ASPM_L1 from the
    disable mask.  Since disabling L1 via sysfs doesn't add any of the
    substates to the disable mask, enabling L1.1 actually enables *all* the
    substates.
    
    In this scenario:
    
      - Write 0 to "l1_aspm" to disable L1
      - Write 1 to "l1_1_aspm" to enable L1.1
    
    the intention is to disable L1 and all L1.x substates, then enable just
    L1.1, but in fact, *all* L1.x substates are enabled.
    
    Fix this by explicitly disabling all the L1.x substates when disabling L1.
    
    Fixes: 72ea91afbfb0 ("PCI/ASPM: Add sysfs attributes for controlling ASPM link states")
    Link: https://lore.kernel.org/r/6ba7dd79-9cfe-4ed0-a002-d99cb842f361@gmail.com
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    [bhelgaas: commit log]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bf9a8870ad507c42dbf5568a27c889d79e4a50de
Author: Manivannan Sadhasivam <mani@kernel.org>
Date:   Wed Oct 25 18:30:29 2023 +0530

    PCI: qcom-ep: Add dedicated callback for writing to DBI2 registers
    
    commit a07d2497ed657eb2efeb967af47e22f573dcd1d6 upstream.
    
    The DWC core driver exposes the write_dbi2() callback for writing to the
    DBI2 registers in a vendor-specific way.
    
    On the Qcom EP platforms, the DBI_CS2 bit in the ELBI region needs to be
    asserted before writing to any DBI2 registers and deasserted once done.
    
    So, let's implement the callback for the Qcom PCIe EP driver so that the
    DBI2 writes are correctly handled in the hardware.
    
    Without this callback, the DBI2 register writes like BAR size won't go
    through and as a result, the default BAR size is set for all BARs.
    
    [kwilczynski: commit log, renamed function to match the DWC convention]
    Fixes: f55fee56a631 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver")
    Suggested-by: Serge Semin <fancer.lancer@gmail.com>
    Link: https://lore.kernel.org/linux-pci/20231025130029.74693-2-manivannan.sadhasivam@linaro.org
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Cc: stable@vger.kernel.org # 5.16+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bb94f1ad8cadb2b9c017da02ae4e941cee01a65a
Author: Bean Huo <beanhuo@micron.com>
Date:   Mon Oct 30 23:48:09 2023 +0100

    mmc: Add quirk MMC_QUIRK_BROKEN_CACHE_FLUSH for Micron eMMC Q2J54A
    
    commit ed9009ad300c0f15a3ecfe9613547b1962bde02c upstream.
    
    Micron MTFC4GACAJCN eMMC supports cache but requires that flush cache
    operation be allowed only after a write has occurred. Otherwise, the
    cache flush command or subsequent commands will time out.
    
    Signed-off-by: Bean Huo <beanhuo@micron.com>
    Signed-off-by: Rafael Beims <rafael.beims@toradex.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231030224809.59245-1-beanhuo@iokpp.de
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 582208858304ffc382fa9d921c8b03cf1f31c1c0
Author: Nitin Yadav <n-yadav@ti.com>
Date:   Thu Oct 26 11:44:58 2023 +0530

    mmc: sdhci_am654: fix start loop index for TAP value parsing
    
    commit 71956d0cb56c1e5f9feeb4819db87a076418e930 upstream.
    
    ti,otap-del-sel-legacy/ti,itap-del-sel-legacy passed from DT
    are currently ignored for all SD/MMC and eMMC modes. Fix this
    by making start loop index to MMC_TIMING_LEGACY.
    
    Fixes: 8ee5fc0e0b3b ("mmc: sdhci_am654: Update OTAPDLY writes")
    Signed-off-by: Nitin Yadav <n-yadav@ti.com>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231026061458.1116276-1-n-yadav@ti.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 053809f40e6f36292c9c1367ff549c9a082457bd
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Thu Nov 2 10:51:06 2023 +0300

    mmc: vub300: fix an error code
    
    commit b44f9da81783fda72632ef9b0d05ea3f3ca447a5 upstream.
    
    This error path should return -EINVAL instead of success.
    
    Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/0769d30c-ad80-421b-bf5d-7d6f5d85604e@moroto.mountain
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 712e01f32e577e7e48ab0adb5fe550646a3d93cb
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Sun Nov 5 12:46:24 2023 +0900

    ksmbd: fix slab out of bounds write in smb_inherit_dacl()
    
    commit eebff19acaa35820cb09ce2ccb3d21bee2156ffb upstream.
    
    slab out-of-bounds write is caused by that offsets is bigger than pntsd
    allocation size. This patch add the check to validate 3 offsets using
    allocation size.
    
    Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-22271
    Cc: stable@vger.kernel.org
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f4f863a0e901131aff9b7be77590b637acc6f8b1
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Tue Nov 7 21:04:31 2023 +0900

    ksmbd: handle malformed smb1 message
    
    commit 5a5409d90bd05f87fe5623a749ccfbf3f7c7d400 upstream.
    
    If set_smb1_rsp_status() is not implemented, It will cause NULL pointer
    dereferece error when client send malformed smb1 message.
    This patch add set_smb1_rsp_status() to ignore malformed smb1 message.
    
    Cc: stable@vger.kernel.org
    Reported-by: Robert Morris <rtm@csail.mit.edu>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c012fba75ac884825f45a4e4960c09f50896f439
Author: Marios Makassikis <mmakassikis@freebox.fr>
Date:   Sat Oct 14 12:48:25 2023 +0900

    ksmbd: fix recursive locking in vfs helpers
    
    commit 807252f028c59b9a3bac4d62ad84761548c10f11 upstream.
    
    Running smb2.rename test from Samba smbtorture suite against a kernel built
    with lockdep triggers a "possible recursive locking detected" warning.
    
    This is because mnt_want_write() is called twice with no mnt_drop_write()
    in between:
      -> ksmbd_vfs_mkdir()
        -> ksmbd_vfs_kern_path_create()
           -> kern_path_create()
              -> filename_create()
                -> mnt_want_write()
           -> mnt_want_write()
    
    Fix this by removing the mnt_want_write/mnt_drop_write calls from vfs
    helpers that call kern_path_create().
    
    Full lockdep trace below:
    
    ============================================
    WARNING: possible recursive locking detected
    6.6.0-rc5 #775 Not tainted
    --------------------------------------------
    kworker/1:1/32 is trying to acquire lock:
    ffff888005ac83f8 (sb_writers#5){.+.+}-{0:0}, at: ksmbd_vfs_mkdir+0xe1/0x410
    
    but task is already holding lock:
    ffff888005ac83f8 (sb_writers#5){.+.+}-{0:0}, at: filename_create+0xb6/0x260
    
    other info that might help us debug this:
     Possible unsafe locking scenario:
    
           CPU0
           ----
      lock(sb_writers#5);
      lock(sb_writers#5);
    
     *** DEADLOCK ***
    
     May be due to missing lock nesting notation
    
    4 locks held by kworker/1:1/32:
     #0: ffff8880064e4138 ((wq_completion)ksmbd-io){+.+.}-{0:0}, at: process_one_work+0x40e/0x980
     #1: ffff888005b0fdd0 ((work_completion)(&work->work)){+.+.}-{0:0}, at: process_one_work+0x40e/0x980
     #2: ffff888005ac83f8 (sb_writers#5){.+.+}-{0:0}, at: filename_create+0xb6/0x260
     #3: ffff8880057ce760 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: filename_create+0x123/0x260
    
    Cc: stable@vger.kernel.org
    Fixes: 40b268d384a2 ("ksmbd: add mnt_want_write to ksmbd vfs functions")
    Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7d7ba4b888b09e03829509f0371225b75deb4b67
Author: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com>
Date:   Thu Sep 14 12:29:52 2023 +0530

    clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks
    
    commit 99cd4935cb972d0aafb16838bb2aeadbcaf196ce upstream.
    
    GPLL, NSS crypto PLL clock rates are fixed and shouldn't be scaled based
    on the request from dependent clocks. Doing so will result in the
    unexpected behaviour. So drop the CLK_SET_RATE_PARENT flag from the PLL
    clocks.
    
    Cc: stable@vger.kernel.org
    Fixes: d9db07f088af ("clk: qcom: Add ipq6018 Global Clock Controller support")
    Signed-off-by: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230913-gpll_cleanup-v2-2-c8ceb1a37680@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9466443cd66e739673b716774d0bf4035d166e10
Author: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com>
Date:   Thu Sep 14 12:29:51 2023 +0530

    clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks
    
    commit e641a070137dd959932c7c222e000d9d941167a2 upstream.
    
    GPLL, NSS crypto PLL clock rates are fixed and shouldn't be scaled based
    on the request from dependent clocks. Doing so will result in the
    unexpected behaviour. So drop the CLK_SET_RATE_PARENT flag from the PLL
    clocks.
    
    Cc: stable@vger.kernel.org
    Fixes: b8e7e519625f ("clk: qcom: ipq8074: add remaining PLL’s")
    Signed-off-by: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com>
    Link: https://lore.kernel.org/r/20230913-gpll_cleanup-v2-1-c8ceb1a37680@quicinc.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3293de84bf3e041242b9826bb2a439a1f4d3da7d
Author: Michal Suchanek <msuchanek@suse.de>
Date:   Thu Sep 7 18:52:19 2023 +0200

    integrity: powerpc: Do not select CA_MACHINE_KEYRING
    
    commit 3edc22655647378dea01900f7b04e017ff96bda9 upstream.
    
    No other platform needs CA_MACHINE_KEYRING, either.
    
    This is policy that should be decided by the administrator, not Kconfig
    dependencies.
    
    Cc: stable@vger.kernel.org # v6.6+
    Fixes: d7d91c4743c4 ("integrity: PowerVM machine keyring enablement")
    Signed-off-by: Michal Suchanek <msuchanek@suse.de>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c21a0913da18574d71553622d70ec52ac6fb99a9
Author: Gustavo A. R. Silva <gustavoars@kernel.org>
Date:   Mon Oct 16 16:05:27 2023 -0600

    clk: visconti: Fix undefined behavior bug in struct visconti_pll_provider
    
    commit 5ad1e217a2b23aa046b241183bd9452d259d70d0 upstream.
    
    `struct clk_hw_onecell_data` is a flexible structure, which means that
    it contains flexible-array member at the bottom, in this case array
    `hws`:
    
    include/linux/clk-provider.h:
    1380 struct clk_hw_onecell_data {
    1381         unsigned int num;
    1382         struct clk_hw *hws[] __counted_by(num);
    1383 };
    
    This could potentially lead to an overwrite of the objects following
    `clk_data` in `struct visconti_pll_provider`, in this case
    `struct device_node *node;`, at run-time:
    
    drivers/clk/visconti/pll.h:
     16 struct visconti_pll_provider {
     17         void __iomem *reg_base;
     18         struct clk_hw_onecell_data clk_data;
     19         struct device_node *node;
     20 };
    
    Notice that a total of 56 bytes are allocated for flexible-array `hws`
    at line 328. See below:
    
    include/dt-bindings/clock/toshiba,tmpv770x.h:
     14 #define TMPV770X_NR_PLL             7
    
    drivers/clk/visconti/pll-tmpv770x.c:
     69 ctx = visconti_init_pll(np, reg_base, TMPV770X_NR_PLL);
    
    drivers/clk/visconti/pll.c:
    321 struct visconti_pll_provider * __init visconti_init_pll(struct device_node *np,
    322                                                         void __iomem *base,
    323                                                         unsigned long nr_plls)
    324 {
    325         struct visconti_pll_provider *ctx;
    ...
    328         ctx = kzalloc(struct_size(ctx, clk_data.hws, nr_plls), GFP_KERNEL);
    
    `struct_size(ctx, clk_data.hws, nr_plls)` above translates to
    sizeof(struct visconti_pll_provider) + sizeof(struct clk_hw *) * 7 ==
    24 + 8 * 7 == 24 + 56
                      ^^^^
                       |
            allocated bytes for flex array `hws`
    
    $ pahole -C visconti_pll_provider drivers/clk/visconti/pll.o
    struct visconti_pll_provider {
            void *                     reg_base;             /*     0     8 */
            struct clk_hw_onecell_data clk_data;             /*     8     8 */
            struct device_node *       node;                 /*    16     8 */
    
            /* size: 24, cachelines: 1, members: 3 */
            /* last cacheline: 24 bytes */
    };
    
    And then, after the allocation, some data is written into all members
    of `struct visconti_pll_provider`:
    
    332         for (i = 0; i < nr_plls; ++i)
    333                 ctx->clk_data.hws[i] = ERR_PTR(-ENOENT);
    334
    335         ctx->node = np;
    336         ctx->reg_base = base;
    337         ctx->clk_data.num = nr_plls;
    
    Fix all these by placing the declaration of object `clk_data` at the
    end of `struct visconti_pll_provider`. Also, add a comment to make it
    clear that this object must always be last in the structure, and
    prevent this bug from being introduced again in the future.
    
    -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting
    ready to enable it globally.
    
    Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")
    Cc: stable@vger.kernel.org
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Acked-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
    Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
    Link: https://lore.kernel.org/r/57a831d94ee2b3889b11525d4ad500356f89576f.1697492890.git.gustavoars@kernel.org
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b0a660d46d40ad122d200cfdfbdba81a6346f4cb
Author: Gustavo A. R. Silva <gustavoars@kernel.org>
Date:   Mon Oct 23 21:30:52 2023 -0600

    clk: socfpga: Fix undefined behavior bug in struct stratix10_clock_data
    
    commit d761bb01c85b22d5b44abe283eb89019693f6595 upstream.
    
    `struct clk_hw_onecell_data` is a flexible structure, which means that
    it contains flexible-array member at the bottom, in this case array
    `hws`:
    
    include/linux/clk-provider.h:
    1380 struct clk_hw_onecell_data {
    1381         unsigned int num;
    1382         struct clk_hw *hws[] __counted_by(num);
    1383 };
    
    This could potentially lead to an overwrite of the objects following
    `clk_data` in `struct stratix10_clock_data`, in this case
    `void __iomem *base;` at run-time:
    
    drivers/clk/socfpga/stratix10-clk.h:
      9 struct stratix10_clock_data {
     10         struct clk_hw_onecell_data      clk_data;
     11         void __iomem            *base;
     12 };
    
    There are currently three different places where memory is allocated for
    `struct stratix10_clock_data`, including the flex-array `hws` in
    `struct clk_hw_onecell_data`:
    
    drivers/clk/socfpga/clk-agilex.c:
    469         clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws,
    470                                 num_clks), GFP_KERNEL);
    
    drivers/clk/socfpga/clk-agilex.c:
    509         clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws,
    510                                 num_clks), GFP_KERNEL);
    
    drivers/clk/socfpga/clk-s10.c:
    400         clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws,
    401                                                  num_clks), GFP_KERNEL);
    
    I'll use just one of them to describe the issue. See below.
    
    Notice that a total of 440 bytes are allocated for flexible-array member
    `hws` at line 469:
    
    include/dt-bindings/clock/agilex-clock.h:
     70 #define AGILEX_NUM_CLKS     55
    
    drivers/clk/socfpga/clk-agilex.c:
    459         struct stratix10_clock_data *clk_data;
    460         void __iomem *base;
    ...
    466
    467         num_clks = AGILEX_NUM_CLKS;
    468
    469         clk_data = devm_kzalloc(dev, struct_size(clk_data, clk_data.hws,
    470                                 num_clks), GFP_KERNEL);
    
    `struct_size(clk_data, clk_data.hws, num_clks)` above translates to
    sizeof(struct stratix10_clock_data) + sizeof(struct clk_hw *) * 55 ==
    16 + 8 * 55 == 16 + 440
                        ^^^
                         |
            allocated bytes for flex-array `hws`
    
    474         for (i = 0; i < num_clks; i++)
    475                 clk_data->clk_data.hws[i] = ERR_PTR(-ENOENT);
    476
    477         clk_data->base = base;
    
    and then some data is written into both `hws` and `base` objects.
    
    Fix this by placing the declaration of object `clk_data` at the end of
    `struct stratix10_clock_data`. Also, add a comment to make it clear
    that this object must always be last in the structure.
    
    -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting
    ready to enable it globally.
    
    Fixes: ba7e258425ac ("clk: socfpga: Convert to s10/agilex/n5x to use clk_hw")
    Cc: stable@vger.kernel.org
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
    Link: https://lore.kernel.org/r/1da736106d8e0806aeafa6e471a13ced490eae22.1698117815.git.gustavoars@kernel.org
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6806b24ebd3bcf65a463e535b35c499f784cbb5a
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Tue Oct 24 22:17:19 2023 +0300

    powercap: intel_rapl: Downgrade BIOS locked limits pr_warn() to pr_debug()
    
    commit a60ec4485f1c72dfece365cf95e6de82bdd74300 upstream.
    
    Before the refactoring the pr_warn() only triggered when
    someone explicitly tried to write to a BIOS locked limit.
    After the refactoring the warning is also triggering during
    system resume. The user can't do anything about this so
    printing scary warnings doesn't make sense
    
    Keep the printk but make it pr_debug() instead of pr_warn()
    to make it clear it's not a serious issue.
    
    Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits support")
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: 6.5+ <stable@vger.kernel.org> # 6.5+
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 22d4c2a841d7d912a8e047a080790da580f8ce56
Author: Christian Marangi <ansuelsmth@gmail.com>
Date:   Tue Oct 24 20:30:14 2023 +0200

    cpufreq: stats: Fix buffer overflow detection in trans_stats()
    
    commit ea167a7fc2426f7685c3735e104921c1a20a6d3f upstream.
    
    Commit 3c0897c180c6 ("cpufreq: Use scnprintf() for avoiding potential
    buffer overflow") switched from snprintf to the more secure scnprintf
    but never updated the exit condition for PAGE_SIZE.
    
    As the commit say and as scnprintf document, what scnprintf returns what
    is actually written not counting the '\0' end char. This results in the
    case of len exceeding the size, len set to PAGE_SIZE - 1, as it can be
    written at max PAGE_SIZE - 1 (as '\0' is not counted)
    
    Because of len is never set to PAGE_SIZE, the function never break early,
    never prints the warning and never return -EFBIG.
    
    Fix this by changing the condition to PAGE_SIZE - 1 to correctly trigger
    the error.
    
    Cc: 5.10+ <stable@vger.kernel.org> # 5.10+
    Fixes: 3c0897c180c6 ("cpufreq: Use scnprintf() for avoiding potential buffer overflow")
    Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47b816649a186064b5c51bb1db2364a0e3afe5ed
Author: Helge Deller <deller@gmx.de>
Date:   Tue Oct 17 22:19:53 2023 +0200

    parisc/power: Add power soft-off when running on qemu
    
    commit d0c219472980d15f5cbc5c8aec736848bda3f235 upstream.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org # v6.0+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1b017510bcaf7c4bdc2014ee21f7d028c1e6e3aa
Author: Helge Deller <deller@gmx.de>
Date:   Sun Oct 22 11:48:11 2023 +0200

    parisc/pdc: Add width field to struct pdc_model
    
    commit 6240553b52c475d9fc9674de0521b77e692f3764 upstream.
    
    PDC2.0 specifies the additional PSW-bit field.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cb07cb22f9792b47ac28a5cfed973b0129566203
Author: Helge Deller <deller@gmx.de>
Date:   Wed Oct 18 19:24:14 2023 +0200

    parisc/agp: Use 64-bit LE values in SBA IOMMU PDIR table
    
    commit 86bb854d134f4429feb35d2e05f55c6e036770d2 upstream.
    
    The PDIR table of the System Bus Adapter (SBA) I/O MMU uses 64-bit
    little-endian pointers.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org # v6.4+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2e9ae2196d7ed5f9887e312af18c36611a001da1
Author: Pengfei Li <pengfei.li_1@nxp.com>
Date:   Sat Oct 21 02:59:49 2023 +0800

    pmdomain: imx: Make imx pgc power domain also set the fwnode
    
    commit 374de39d38f97b0e58cfee88da590b2d056ccf7f upstream.
    
    Currently, The imx pgc power domain doesn't set the fwnode
    pointer, which results in supply regulator device can't get
    consumer imx pgc power domain device from fwnode when creating
    a link.
    
    This causes the driver core to instead try to create a link
    between the parent gpc device of imx pgc power domain device and
    supply regulator device. However, at this point, the gpc device
    has already been bound, and the link creation will fail. So adding
    the fwnode pointer to the imx pgc power domain device will fix
    this issue.
    
    Signed-off-by: Pengfei Li <pengfei.li_1@nxp.com>
    Tested-by: Emil Kronborg <emil.kronborg@protonmail.com>
    Fixes: 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231020185949.537083-1-pengfei.li_1@nxp.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e7c5f137e5aa8081b2d2c608da521b2f48a6dbc1
Author: Maria Yu <quic_aiquny@quicinc.com>
Date:   Tue Oct 24 09:09:54 2023 +0800

    arm64: module: Fix PLT counting when CONFIG_RANDOMIZE_BASE=n
    
    commit d35686444fc80950c731e33a2f6ad4a55822be9b upstream.
    
    The counting of module PLTs has been broken when CONFIG_RANDOMIZE_BASE=n
    since commit:
    
      3e35d303ab7d22c4 ("arm64: module: rework module VA range selection")
    
    Prior to that commit, when CONFIG_RANDOMIZE_BASE=n, the kernel image and
    all modules were placed within a 128M region, and no PLTs were necessary
    for B or BL. Hence count_plts() and partition_branch_plt_relas() skipped
    handling B and BL when CONFIG_RANDOMIZE_BASE=n.
    
    After that commit, modules can be placed anywhere within a 2G window
    regardless of CONFIG_RANDOMIZE_BASE, and hence PLTs may be necessary for
    B and BL even when CONFIG_RANDOMIZE_BASE=n. Unfortunately that commit
    failed to update count_plts() and partition_branch_plt_relas()
    accordingly.
    
    Due to this, module_emit_plt_entry() may fail if an insufficient number
    of PLT entries have been reserved, resulting in modules failing to load
    with -ENOEXEC.
    
    Fix this by counting PLTs regardless of CONFIG_RANDOMIZE_BASE in
    count_plts() and partition_branch_plt_relas().
    
    Fixes: 3e35d303ab7d ("arm64: module: rework module VA range selection")
    Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
    Cc: <stable@vger.kernel.org> # 6.5.x
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Fixes: 3e35d303ab7d ("arm64: module: rework module VA range selection")
    Reviewed-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20231024010954.6768-1-quic_aiquny@quicinc.com
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 69e619d2fd056fe1f5d0adf01584f2da669e0d28
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Wed Oct 25 10:21:28 2023 -0700

    arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer
    
    commit 146a15b873353f8ac28dc281c139ff611a3c4848 upstream.
    
    Prior to LLVM 15.0.0, LLVM's integrated assembler would incorrectly
    byte-swap NOP when compiling for big-endian, and the resulting series of
    bytes happened to match the encoding of FNMADD S21, S30, S0, S0.
    
    This went unnoticed until commit:
    
      34f66c4c4d5518c1 ("arm64: Use a positive cpucap for FP/SIMD")
    
    Prior to that commit, the kernel would always enable the use of FPSIMD
    early in boot when __cpu_setup() initialized CPACR_EL1, and so usage of
    FNMADD within the kernel was not detected, but could result in the
    corruption of user or kernel FPSIMD state.
    
    After that commit, the instructions happen to trap during boot prior to
    FPSIMD being detected and enabled, e.g.
    
    | Unhandled 64-bit el1h sync exception on CPU0, ESR 0x000000001fe00000 -- ASIMD
    | CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.0-rc3-00013-g34f66c4c4d55 #1
    | Hardware name: linux,dummy-virt (DT)
    | pstate: 400000c9 (nZcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    | pc : __pi_strcmp+0x1c/0x150
    | lr : populate_properties+0xe4/0x254
    | sp : ffffd014173d3ad0
    | x29: ffffd014173d3af0 x28: fffffbfffddffcb8 x27: 0000000000000000
    | x26: 0000000000000058 x25: fffffbfffddfe054 x24: 0000000000000008
    | x23: fffffbfffddfe000 x22: fffffbfffddfe000 x21: fffffbfffddfe044
    | x20: ffffd014173d3b70 x19: 0000000000000001 x18: 0000000000000005
    | x17: 0000000000000010 x16: 0000000000000000 x15: 00000000413e7000
    | x14: 0000000000000000 x13: 0000000000001bcc x12: 0000000000000000
    | x11: 00000000d00dfeed x10: ffffd414193f2cd0 x9 : 0000000000000000
    | x8 : 0101010101010101 x7 : ffffffffffffffc0 x6 : 0000000000000000
    | x5 : 0000000000000000 x4 : 0101010101010101 x3 : 000000000000002a
    | x2 : 0000000000000001 x1 : ffffd014171f2988 x0 : fffffbfffddffcb8
    | Kernel panic - not syncing: Unhandled exception
    | CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.0-rc3-00013-g34f66c4c4d55 #1
    | Hardware name: linux,dummy-virt (DT)
    | Call trace:
    |  dump_backtrace+0xec/0x108
    |  show_stack+0x18/0x2c
    |  dump_stack_lvl+0x50/0x68
    |  dump_stack+0x18/0x24
    |  panic+0x13c/0x340
    |  el1t_64_irq_handler+0x0/0x1c
    |  el1_abort+0x0/0x5c
    |  el1h_64_sync+0x64/0x68
    |  __pi_strcmp+0x1c/0x150
    |  unflatten_dt_nodes+0x1e8/0x2d8
    |  __unflatten_device_tree+0x5c/0x15c
    |  unflatten_device_tree+0x38/0x50
    |  setup_arch+0x164/0x1e0
    |  start_kernel+0x64/0x38c
    |  __primary_switched+0xbc/0xc4
    
    Restrict CONFIG_CPU_BIG_ENDIAN to a known good assembler, which is
    either GNU as or LLVM's IAS 15.0.0 and newer, which contains the linked
    commit.
    
    Closes: https://github.com/ClangBuiltLinux/linux/issues/1948
    Link: https://github.com/llvm/llvm-project/commit/1379b150991f70a5782e9a143c2ba5308da1161c
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Cc: stable@vger.kernel.org
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20231025-disable-arm64-be-ias-b4-llvm-15-v1-1-b25263ed8b23@kernel.org
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc14784cc5ba069f41aa16023dc10cab929935a2
Author: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Date:   Mon Oct 16 10:02:04 2023 +0200

    pmdomain: amlogic: Fix mask for the second NNA mem PD domain
    
    commit b131329b9bfbd1b4c0c5e088cb0c6ec03a12930f upstream.
    
    Without this change, the NPU hangs when the 8th NN core is used.
    
    It matches what the out-of-tree driver does.
    
    Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
    Fixes: 9a217b7e8953 ("soc: amlogic: meson-pwrc: Add NNA power domain for A311D")
    Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231016080205.41982-2-tomeu@tomeuvizoso.net
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b99a36afa2d93327cc3d7b8df6e99145ee234ae6
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Sun Oct 1 19:02:54 2023 +0200

    PCI: keystone: Don't discard .probe() callback
    
    commit 7994db905c0fd692cf04c527585f08a91b560144 upstream.
    
    The __init annotation makes the ks_pcie_probe() function disappear after
    booting completes. However a device can also be bound later. In that case,
    we try to call ks_pcie_probe(), but the backing memory is likely already
    overwritten.
    
    The right thing to do is do always have the probe callback available.  Note
    that the (wrong) __refdata annotation prevented this issue to be noticed by
    modpost.
    
    Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver")
    Link: https://lore.kernel.org/r/20231001170254.2506508-5-u.kleine-koenig@pengutronix.de
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10bec413b75f0e70f622a1b16c088c15a263b9ed
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Sun Oct 1 19:02:53 2023 +0200

    PCI: keystone: Don't discard .remove() callback
    
    commit 200bddbb3f5202bbce96444fdc416305de14f547 upstream.
    
    With CONFIG_PCIE_KEYSTONE=y and ks_pcie_remove() marked with __exit, the
    function is discarded from the driver. In this case a bound device can
    still get unbound, e.g via sysfs. Then no cleanup code is run resulting in
    resource leaks or worse.
    
    The right thing to do is do always have the remove callback available.
    Note that this driver cannot be compiled as a module, so ks_pcie_remove()
    was always discarded before this change and modpost couldn't warn about
    this issue. Furthermore the __ref annotation also prevents a warning.
    
    Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver")
    Link: https://lore.kernel.org/r/20231001170254.2506508-4-u.kleine-koenig@pengutronix.de
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f009347417a3d1188206b00991a78b1ac3736a6e
Author: Jarkko Sakkinen <jarkko@kernel.org>
Date:   Wed Oct 11 02:08:25 2023 +0300

    KEYS: trusted: Rollback init_trusted() consistently
    
    commit 31de287345f41bbfaec36a5c8cbdba035cf76442 upstream.
    
    Do bind neither static calls nor trusted_key_exit() before a successful
    init, in order to maintain a consistent state. In addition, depart the
    init_trusted() in the case of a real error (i.e. getting back something
    else than -ENODEV).
    
    Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
    Closes: https://lore.kernel.org/linux-integrity/CAHk-=whOPoLaWM8S8GgoOPT7a2+nMH5h3TLKtn=R_3w4R1_Uvg@mail.gmail.com/
    Cc: stable@vger.kernel.org # v5.13+
    Fixes: 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fe822ce87cb88b4af838506542c9e2080ac090f4
Author: Sumit Garg <sumit.garg@linaro.org>
Date:   Tue Aug 22 16:59:33 2023 +0530

    KEYS: trusted: tee: Refactor register SHM usage
    
    commit c745cd1718b7825d69315fe7127e2e289e617598 upstream.
    
    The OP-TEE driver using the old SMC based ABI permits overlapping shared
    buffers, but with the new FF-A based ABI each physical page may only
    be registered once.
    
    As the key and blob buffer are allocated adjancently, there is no need
    for redundant register shared memory invocation. Also, it is incompatibile
    with FF-A based ABI limitation. So refactor register shared memory
    implementation to use only single invocation to register both key and blob
    buffers.
    
    [jarkko: Added cc to stable.]
    Cc: stable@vger.kernel.org # v5.16+
    Fixes: 4615e5a34b95 ("optee: add FF-A support")
    Reported-by: Jens Wiklander <jens.wiklander@linaro.org>
    Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
    Tested-by: Jens Wiklander <jens.wiklander@linaro.org>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc6e70a26516cdef5bdd0abcef9582d6c95b42a5
Author: Maíra Canal <mcanal@igalia.com>
Date:   Tue Oct 24 07:10:40 2023 -0300

    pmdomain: bcm: bcm2835-power: check if the ASB register is equal to enable
    
    commit 2e75396f1df61e1f1d26d0d703fc7292c4ae4371 upstream.
    
    The commit c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
    refactored the ASB control by using a general function to handle both
    the enable and disable. But this patch introduced a subtle regression:
    we need to check if !!(readl(base + reg) & ASB_ACK) == enable, not just
    check if (readl(base + reg) & ASB_ACK) == true.
    
    Currently, this is causing an invalid register state in V3D when
    unloading and loading the driver, because `bcm2835_asb_disable()` will
    return -ETIMEDOUT and `bcm2835_asb_power_off()` will fail to disable the
    ASB slave for V3D.
    
    Fixes: c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control")
    Signed-off-by: Maíra Canal <mcanal@igalia.com>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231024101251.6357-2-mcanal@igalia.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bf5dd542721a4f5145b241cf51e92f3809855d27
Author: Hao Jia <jiahao.os@bytedance.com>
Date:   Thu Oct 12 17:00:03 2023 +0800

    sched/core: Fix RQCF_ACT_SKIP leak
    
    commit 5ebde09d91707a4a9bec1e3d213e3c12ffde348f upstream.
    
    Igor Raits and Bagas Sanjaya report a RQCF_ACT_SKIP leak warning.
    
    This warning may be triggered in the following situations:
    
        CPU0                                      CPU1
    
    __schedule()
      *rq->clock_update_flags <<= 1;*   unregister_fair_sched_group()
      pick_next_task_fair+0x4a/0x410      destroy_cfs_bandwidth()
        newidle_balance+0x115/0x3e0       for_each_possible_cpu(i) *i=0*
          rq_unpin_lock(this_rq, rf)      __cfsb_csd_unthrottle()
          raw_spin_rq_unlock(this_rq)
                                          rq_lock(*CPU0_rq*, &rf)
                                          rq_clock_start_loop_update()
                                          rq->clock_update_flags & RQCF_ACT_SKIP <--
          raw_spin_rq_lock(this_rq)
    
    The purpose of RQCF_ACT_SKIP is to skip the update rq clock,
    but the update is very early in __schedule(), but we clear
    RQCF_*_SKIP very late, causing it to span that gap above
    and triggering this warning.
    
    In __schedule() we can clear the RQCF_*_SKIP flag immediately
    after update_rq_clock() to avoid this RQCF_ACT_SKIP leak warning.
    And set rq->clock_update_flags to RQCF_UPDATED to avoid
    rq->clock_update_flags < RQCF_ACT_SKIP warning that may be triggered later.
    
    Fixes: ebb83d84e49b ("sched/core: Avoid multiple calling update_rq_clock() in __cfsb_csd_unthrottle()")
    Closes: https://lore.kernel.org/all/20230913082424.73252-1-jiahao.os@bytedance.com
    Reported-by: Igor Raits <igor.raits@gmail.com>
    Reported-by: Bagas Sanjaya <bagasdotme@gmail.com>
    Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Hao Jia <jiahao.os@bytedance.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/a5dd536d-041a-2ce9-f4b7-64d8d85c86dc@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c9400a9dba346177ba1d34ef0981fa8b1ee51001
Author: Herve Codina <herve.codina@bootlin.com>
Date:   Tue Oct 24 17:03:35 2023 +0200

    genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware
    
    commit 5e7afb2eb7b2a7c81e9f608cbdf74a07606fd1b5 upstream.
    
    irq_remove_generic_chip() calculates the Linux interrupt number for removing the
    handler and interrupt chip based on gc::irq_base as a linear function of
    the bit positions of set bits in the @msk argument.
    
    When the generic chip is present in an irq domain, i.e. created with a call
    to irq_alloc_domain_generic_chips(), gc::irq_base contains not the base
    Linux interrupt number.  It contains the base hardware interrupt for this
    chip. It is set to 0 for the first chip in the domain, 0 + N for the next
    chip, where $N is the number of hardware interrupts per chip.
    
    That means the Linux interrupt number cannot be calculated based on
    gc::irq_base for irqdomain based chips without a domain map lookup, which
    is currently missing.
    
    Rework the code to take the irqdomain case into account and calculate the
    Linux interrupt number by a irqdomain lookup of the domain specific
    hardware interrupt number.
    
    [ tglx: Massage changelog. Reshuffle the logic and add a proper comment. ]
    
    Fixes: cfefd21e693d ("genirq: Add chip suspend and resume callbacks")
    Signed-off-by: Herve Codina <herve.codina@bootlin.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231024150335.322282-1-herve.codina@bootlin.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d5b648567bfb6a1737fb5dda8a87bfde4916dd8c
Author: Rong Chen <rong.chen@amlogic.com>
Date:   Thu Oct 26 15:31:56 2023 +0800

    mmc: meson-gx: Remove setting of CMD_CFG_ERROR
    
    commit 57925e16c9f7d18012bcf45bfa658f92c087981a upstream.
    
    For the t7 and older SoC families, the CMD_CFG_ERROR has no effect.
    Starting from SoC family C3, setting this bit without SG LINK data
    address will cause the controller to generate an IRQ and stop working.
    
    To fix it, don't set the bit CMD_CFG_ERROR anymore.
    
    Fixes: 18f92bc02f17 ("mmc: meson-gx: make sure the descriptor is stopped on errors")
    Signed-off-by: Rong Chen <rong.chen@amlogic.com>
    Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231026073156.2868310-1-rong.chen@amlogic.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d7a5f7f76568e48869916d769e28b9f3ca70c78e
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Thu Oct 19 13:36:49 2023 +0200

    wifi: ath12k: fix dfs-radar and temperature event locking
    
    commit 69bd216e049349886405b1c87a55dce3d35d1ba7 upstream.
    
    The ath12k active pdevs are protected by RCU but the DFS-radar and
    temperature event handling code calling ath12k_mac_get_ar_by_pdev_id()
    was not marked as a read-side critical section.
    
    Mark the code in question as RCU read-side critical sections to avoid
    any potential use-after-free issues.
    
    Note that the temperature event handler looks like a place holder
    currently but would still trigger an RCU lockdep splat.
    
    Compile tested only.
    
    Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
    Cc: stable@vger.kernel.org      # v6.2
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20231019113650.9060-2-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit afd3425bd69610f318403084fe491e24a1357fb9
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Thu Oct 19 13:36:50 2023 +0200

    wifi: ath12k: fix htt mlo-offset event locking
    
    commit 6afc57ea315e0f660b1f870a681737bb7b71faef upstream.
    
    The ath12k active pdevs are protected by RCU but the htt mlo-offset
    event handling code calling ath12k_mac_get_ar_by_pdev_id() was not
    marked as a read-side critical section.
    
    Mark the code in question as an RCU read-side critical section to avoid
    any potential use-after-free issues.
    
    Compile tested only.
    
    Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
    Cc: stable@vger.kernel.org      # v6.2
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20231019113650.9060-3-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e83246ecd3b193f8d91fce778e8a5ba747fc7d8a
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Thu Oct 19 17:53:42 2023 +0200

    wifi: ath11k: fix gtk offload status event locking
    
    commit 1dea3c0720a146bd7193969f2847ccfed5be2221 upstream.
    
    The ath11k active pdevs are protected by RCU but the gtk offload status
    event handling code calling ath11k_mac_get_arvif_by_vdev_id() was not
    marked as a read-side critical section.
    
    Mark the code in question as an RCU read-side critical section to avoid
    any potential use-after-free issues.
    
    Compile tested only.
    
    Fixes: a16d9b50cfba ("ath11k: support GTK rekey offload")
    Cc: stable@vger.kernel.org      # 5.18
    Cc: Carl Huang <quic_cjhuang@quicinc.com>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20231019155342.31631-1-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 69cede2a5a5f60e3f5602b901b52cb64edd2ea6c
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Thu Oct 19 13:25:21 2023 +0200

    wifi: ath11k: fix htt pktlog locking
    
    commit 3f77c7d605b29df277d77e9ee75d96e7ad145d2d upstream.
    
    The ath11k active pdevs are protected by RCU but the htt pktlog handling
    code calling ath11k_mac_get_ar_by_pdev_id() was not marked as a
    read-side critical section.
    
    Mark the code in question as an RCU read-side critical section to avoid
    any potential use-after-free issues.
    
    Compile tested only.
    
    Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
    Cc: stable@vger.kernel.org      # 5.6
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20231019112521.2071-1-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 21ebb0aba580d347e12f01ce5f6e75044427b3d5
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Thu Oct 19 17:31:15 2023 +0200

    wifi: ath11k: fix dfs radar event locking
    
    commit 3b6c14833165f689cc5928574ebafe52bbce5f1e upstream.
    
    The ath11k active pdevs are protected by RCU but the DFS radar event
    handling code calling ath11k_mac_get_ar_by_pdev_id() was not marked as a
    read-side critical section.
    
    Mark the code in question as an RCU read-side critical section to avoid
    any potential use-after-free issues.
    
    Compile tested only.
    
    Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
    Cc: stable@vger.kernel.org      # 5.6
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20231019153115.26401-3-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c5b914528e55dd22fd616d1f7cb96a877aa54284
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Thu Oct 19 17:31:14 2023 +0200

    wifi: ath11k: fix temperature event locking
    
    commit 1a5352a81b4720ba43d9c899974e3bddf7ce0ce8 upstream.
    
    The ath11k active pdevs are protected by RCU but the temperature event
    handling code calling ath11k_mac_get_ar_by_pdev_id() was not marked as a
    read-side critical section as reported by RCU lockdep:
    
            =============================
            WARNING: suspicious RCU usage
            6.6.0-rc6 #7 Not tainted
            -----------------------------
            drivers/net/wireless/ath/ath11k/mac.c:638 suspicious rcu_dereference_check() usage!
    
            other info that might help us debug this:
    
            rcu_scheduler_active = 2, debug_locks = 1
            no locks held by swapper/0/0.
            ...
            Call trace:
            ...
             lockdep_rcu_suspicious+0x16c/0x22c
             ath11k_mac_get_ar_by_pdev_id+0x194/0x1b0 [ath11k]
             ath11k_wmi_tlv_op_rx+0xa84/0x2c1c [ath11k]
             ath11k_htc_rx_completion_handler+0x388/0x510 [ath11k]
    
    Mark the code in question as an RCU read-side critical section to avoid
    any potential use-after-free issues.
    
    Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
    
    Fixes: a41d10348b01 ("ath11k: add thermal sensor device support")
    Cc: stable@vger.kernel.org      # 5.7
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20231019153115.26401-2-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1985fab7f8520e4629c09eba8d40ebf57a862851
Author: Mark Brown <broonie@kernel.org>
Date:   Thu Oct 26 16:49:19 2023 +0100

    regmap: Ensure range selector registers are updated after cache sync
    
    commit 0ec7731655de196bc1e4af99e495b38778109d22 upstream.
    
    When we sync the register cache we do so with the cache bypassed in order
    to avoid overhead from writing the synced values back into the cache. If
    the regmap has ranges and the selector register for those ranges is in a
    register which is cached this has the unfortunate side effect of meaning
    that the physical and cached copies of the selector register can be out of
    sync after a cache sync. The cache will have whatever the selector was when
    the sync started and the hardware will have the selector for the register
    that was synced last.
    
    Fix this by rewriting all cached selector registers after every sync,
    ensuring that the hardware and cache have the same content. This will
    result in extra writes that wouldn't otherwise be needed but is simple
    so hopefully robust. We don't read from the hardware since not all
    devices have physical read support.
    
    Given that nobody noticed this until now it is likely that we are rarely if
    ever hitting this case.
    
    Reported-by: Hector Martin <marcan@marcan.st>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Link: https://lore.kernel.org/r/20231026-regmap-fix-selector-sync-v1-1-633ded82770d@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 52c96f442c192c4e1614ea3a801d7659af3a126b
Author: Werner Sembach <wse@tuxedocomputers.com>
Date:   Mon Oct 16 18:08:28 2023 +0200

    ACPI: resource: Do IRQ override on TongFang GMxXGxx
    
    commit 0da9eccde3270b832c059ad618bf66e510c75d33 upstream.
    
    The TongFang GMxXGxx/TUXEDO Stellaris/Pollaris Gen5 needs IRQ overriding
    for the keyboard to work.
    
    Adding an entry for this laptop to the override_table makes the internal
    keyboard functional.
    
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: All applicable <stable@vger.kernel.org>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3b5552b3a02215eaefab6b85e161cb25fe01c18
Author: John David Anglin <dave@parisc-linux.org>
Date:   Fri Oct 20 20:49:07 2023 +0000

    parisc: Add nop instructions after TLB inserts
    
    commit ad4aa06e1d92b06ed56c7240252927bd60632efe upstream.
    
    An excerpt from the PA8800 ERS states:
    
    * The PA8800 violates the seven instruction pipeline rule when performing
      TLB inserts or PxTLBE instructions with the PSW C bit on. The instruction
      will take effect by the 12th instruction after the insert or purge.
    
    I believe we have a problem with handling TLB misses. We don't fill
    the pipeline following TLB inserts. As a result, we likely fault again
    after returning from the interruption.
    
    The above statement indicates that we need at least seven instructions
    after the insert on pre PA8800 processors and we need 12 instructions
    on PA8800/PA8900 processors.
    
    Here we add macros and code to provide the required number instructions
    after a TLB insert.
    
    Signed-off-by: John David Anglin <dave.anglin@bell.net>
    Suggested-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 33edac1f26a4ae186aa4236608d4c20f7b19176d
Author: SeongJae Park <sj@kernel.org>
Date:   Mon Nov 6 23:34:06 2023 +0000

    mm/damon/sysfs: check error from damon_sysfs_update_target()
    
    commit b4936b544b08ed44949055b92bd25f77759ebafc upstream.
    
    Patch series "mm/damon/sysfs: fix unhandled return values".
    
    Some of DAMON sysfs interface code is not handling return values from some
    functions.  As a result, confusing user input handling or NULL-dereference
    is possible.  Check those properly.
    
    
    This patch (of 3):
    
    damon_sysfs_update_target() returns error code for failures, but its
    caller, damon_sysfs_set_targets() is ignoring that.  The update function
    seems making no critical change in case of such failures, but the behavior
    will look like DAMON sysfs is silently ignoring or only partially
    accepting the user input.  Fix it.
    
    Link: https://lkml.kernel.org/r/20231106233408.51159-1-sj@kernel.org
    Link: https://lkml.kernel.org/r/20231106233408.51159-2-sj@kernel.org
    Fixes: 19467a950b49 ("mm/damon/sysfs: remove requested targets when online-commit inputs")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org>    [5.19+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1777bb5c740d6d8837dbae61b4694ef90f363221
Author: Hyeongtak Ji <hyeongtak.ji@sk.com>
Date:   Fri Nov 10 14:37:09 2023 +0900

    mm/damon/core.c: avoid unintentional filtering out of schemes
    
    commit 13b2a4b22e98ff80b888a160a2acd92d81b05925 upstream.
    
    The function '__damos_filter_out()' causes DAMON to always filter out
    schemes whose filter type is anon or memcg if its matching value is set
    to false.
    
    This commit addresses the issue by ensuring that '__damos_filter_out()'
    no longer applies to filters whose type is 'anon' or 'memcg'.
    
    Link: https://lkml.kernel.org/r/1699594629-3816-1-git-send-email-hyeongtak.ji@gmail.com
    Fixes: ab9bda001b681 ("mm/damon/core: introduce address range type damos filter")
    Signed-off-by: Hyeongtak Ji <hyeongtak.ji@sk.com>
    Reviewed-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 76801f32d963e5854ea69fb9821d2d86b62790b9
Author: SeongJae Park <sj@kernel.org>
Date:   Mon Nov 6 23:34:07 2023 +0000

    mm/damon/sysfs-schemes: handle tried regions sysfs directory allocation failure
    
    commit 84055688b6bc075c92a88e2d6c3ad26ab93919f9 upstream.
    
    DAMOS tried regions sysfs directory allocation function
    (damon_sysfs_scheme_regions_alloc()) is not handling the memory allocation
    failure.  In the case, the code will dereference NULL pointer.  Handle the
    failure to avoid such invalid access.
    
    Link: https://lkml.kernel.org/r/20231106233408.51159-3-sj@kernel.org
    Fixes: 9277d0367ba1 ("mm/damon/sysfs-schemes: implement scheme region directory")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org>    [6.2+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0bf5055d5d33133c3a7cc5e4032eeb0ba7832c44
Author: SeongJae Park <sj@kernel.org>
Date:   Mon Nov 6 23:34:08 2023 +0000

    mm/damon/sysfs-schemes: handle tried region directory allocation failure
    
    commit ae636ae2bbfd9279f5681dbf320d1da817e52b68 upstream.
    
    DAMON sysfs interface's before_damos_apply callback
    (damon_sysfs_before_damos_apply()), which creates the DAMOS tried regions
    for each DAMOS action applied region, is not handling the allocation
    failure for the sysfs directory data.  As a result, NULL pointer
    derefeence is possible.  Fix it by handling the case.
    
    Link: https://lkml.kernel.org/r/20231106233408.51159-4-sj@kernel.org
    Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org>    [6.2+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 74ed10979060d089d813f65dc91b7a9f0a30fa06
Author: SeongJae Park <sj@kernel.org>
Date:   Thu Oct 19 19:49:21 2023 +0000

    mm/damon/core: avoid divide-by-zero during monitoring results update
    
    commit d35963bfb05877455228ecec6b194f624489f96a upstream.
    
    When monitoring attributes are changed, DAMON updates access rate of the
    monitoring results accordingly.  For that, it divides some values by the
    maximum nr_accesses.  However, due to the type of the related variables,
    simple division-based calculation of the divisor can return zero.  As a
    result, divide-by-zero is possible.  Fix it by using
    damon_max_nr_accesses(), which handles the case.
    
    Link: https://lkml.kernel.org/r/20231019194924.100347-3-sj@kernel.org
    Fixes: 2f5bef5a590b ("mm/damon/core: update monitoring results for new monitoring attributes")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Reported-by: Jakub Acs <acsjakub@amazon.de>
    Cc: <stable@vger.kernel.org>    [6.3+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 557547ad87599ad79536ac3216e1529d84ec21eb
Author: SeongJae Park <sj@kernel.org>
Date:   Thu Oct 19 19:49:20 2023 +0000

    mm/damon: implement a function for max nr_accesses safe calculation
    
    commit 35f5d94187a6a3a8df2cba54beccca1c2379edb8 upstream.
    
    Patch series "avoid divide-by-zero due to max_nr_accesses overflow".
    
    The maximum nr_accesses of given DAMON context can be calculated by
    dividing the aggregation interval by the sampling interval.  Some logics
    in DAMON uses the maximum nr_accesses as a divisor.  Hence, the value
    shouldn't be zero.  Such case is avoided since DAMON avoids setting the
    agregation interval as samller than the sampling interval.  However, since
    nr_accesses is unsigned int while the intervals are unsigned long, the
    maximum nr_accesses could be zero while casting.
    
    Avoid the divide-by-zero by implementing a function that handles the
    corner case (first patch), and replaces the vulnerable direct max
    nr_accesses calculations (remaining patches).
    
    Note that the patches for the replacements are divided for broken commits,
    to make backporting on required tres easier.  Especially, the last patch
    is for a patch that not yet merged into the mainline but in mm tree.
    
    
    This patch (of 4):
    
    The maximum nr_accesses of given DAMON context can be calculated by
    dividing the aggregation interval by the sampling interval.  Some logics
    in DAMON uses the maximum nr_accesses as a divisor.  Hence, the value
    shouldn't be zero.  Such case is avoided since DAMON avoids setting the
    agregation interval as samller than the sampling interval.  However, since
    nr_accesses is unsigned int while the intervals are unsigned long, the
    maximum nr_accesses could be zero while casting.  Implement a function
    that handles the corner case.
    
    Note that this commit is not fixing the real issue since this is only
    introducing the safe function that will replaces the problematic
    divisions.  The replacements will be made by followup commits, to make
    backporting on stable series easier.
    
    Link: https://lkml.kernel.org/r/20231019194924.100347-1-sj@kernel.org
    Link: https://lkml.kernel.org/r/20231019194924.100347-2-sj@kernel.org
    Fixes: 198f0f4c58b9 ("mm/damon/vaddr,paddr: support pageout prioritization")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Reported-by: Jakub Acs <acsjakub@amazon.de>
    Cc: <stable@vger.kernel.org>    [5.16+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10186f29f4f97955954b9e6a45639c5d12a4a11d
Author: SeongJae Park <sj@kernel.org>
Date:   Thu Oct 19 19:49:22 2023 +0000

    mm/damon/ops-common: avoid divide-by-zero during region hotness calculation
    
    commit 3bafc47d3c4a2fc4d3b382aeb3c087f8fc84d9fd upstream.
    
    When calculating the hotness of each region for the under-quota regions
    prioritization, DAMON divides some values by the maximum nr_accesses.
    However, due to the type of the related variables, simple division-based
    calculation of the divisor can return zero.  As a result, divide-by-zero
    is possible.  Fix it by using damon_max_nr_accesses(), which handles the
    case.
    
    Link: https://lkml.kernel.org/r/20231019194924.100347-4-sj@kernel.org
    Fixes: 198f0f4c58b9 ("mm/damon/vaddr,paddr: support pageout prioritization")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Reported-by: Jakub Acs <acsjakub@amazon.de>
    Cc: <stable@vger.kernel.org>    [5.16+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9e4b80adf560d2649a48c785ba8bbb9dac2492d2
Author: SeongJae Park <sj@kernel.org>
Date:   Thu Oct 19 19:49:23 2023 +0000

    mm/damon/lru_sort: avoid divide-by-zero in hot threshold calculation
    
    commit 44063f125af4bb4efd1d500d8091fa33a98af325 upstream.
    
    When calculating the hotness threshold for lru_prio scheme of
    DAMON_LRU_SORT, the module divides some values by the maximum nr_accesses.
    However, due to the type of the related variables, simple division-based
    calculation of the divisor can return zero.  As a result, divide-by-zero
    is possible.  Fix it by using damon_max_nr_accesses(), which handles the
    case.
    
    Link: https://lkml.kernel.org/r/20231019194924.100347-5-sj@kernel.org
    Fixes: 40e983cca927 ("mm/damon: introduce DAMON-based LRU-lists Sorting")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Reported-by: Jakub Acs <acsjakub@amazon.de>
    Cc: <stable@vger.kernel.org>    [6.0+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0b1f2f895470a4a663b471054ba25ce88ba86d09
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Tue Oct 31 19:12:54 2023 +0100

    dm crypt: account large pages in cc->n_allocated_pages
    
    commit 9793c269da6cd339757de6ba5b2c8681b54c99af upstream.
    
    The commit 5054e778fcd9c ("dm crypt: allocate compound pages if
    possible") changed dm-crypt to use compound pages to improve
    performance. Unfortunately, there was an oversight: the allocation of
    compound pages was not accounted at all. Normal pages are accounted in
    a percpu counter cc->n_allocated_pages and dm-crypt is limited to
    allocate at most 2% of memory. Because compound pages were not
    accounted at all, dm-crypt could allocate memory over the 2% limit.
    
    Fix this by adding the accounting of compound pages, so that memory
    consumption of dm-crypt is properly limited.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Fixes: 5054e778fcd9c ("dm crypt: allocate compound pages if possible")
    Cc: stable@vger.kernel.org      # v6.5+
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5cadd780883275cd7c1f968284e1a8cde4eb9426
Author: Helge Deller <deller@gmx.de>
Date:   Fri Oct 27 13:36:48 2023 +0200

    fbdev: stifb: Make the STI next font pointer a 32-bit signed offset
    
    commit 8a32aa17c1cd48df1ddaa78e45abcb8c7a2220d6 upstream.
    
    The pointer to the next STI font is actually a signed 32-bit
    offset. With this change the 64-bit kernel will correctly subract
    the (signed 32-bit) offset instead of adding a (unsigned 32-bit)
    offset. It has no effect on 32-bit kernels.
    
    This fixes the stifb driver with a 64-bit kernel on qemu.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fcb32111f01ddf3cbd04644cde1773428e31de6a
Author: Koichiro Den <den@valinux.co.jp>
Date:   Sat Oct 28 01:29:42 2023 +0900

    iommufd: Fix missing update of domains_itree after splitting iopt_area
    
    commit e7250ab7ca4998fe026f2149805b03e09dc32498 upstream.
    
    In iopt_area_split(), if the original iopt_area has filled a domain and is
    linked to domains_itree, pages_nodes have to be properly
    reinserted. Otherwise the domains_itree becomes corrupted and we will UAF.
    
    Fixes: 51fe6141f0f6 ("iommufd: Data structure to provide IOVA to PFN mapping")
    Link: https://lore.kernel.org/r/20231027162941.2864615-2-den@valinux.co.jp
    Cc: stable@vger.kernel.org
    Signed-off-by: Koichiro Den <den@valinux.co.jp>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dbfbac0f94a113611a8b2016eb126ceeabaa60c5
Author: Krister Johansen <kjlx@templeofstupid.com>
Date:   Fri Oct 27 14:46:53 2023 -0700

    watchdog: move softlockup_panic back to early_param
    
    commit 8b793bcda61f6c3ed4f5b2ded7530ef6749580cb upstream.
    
    Setting softlockup_panic from do_sysctl_args() causes it to take effect
    later in boot.  The lockup detector is enabled before SMP is brought
    online, but do_sysctl_args runs afterwards.  If a user wants to set
    softlockup_panic on boot and have it trigger should a softlockup occur
    during onlining of the non-boot processors, they could do this prior to
    commit f117955a2255 ("kernel/watchdog.c: convert {soft/hard}lockup boot
    parameters to sysctl aliases").  However, after this commit the value
    of softlockup_panic is set too late to be of help for this type of
    problem.  Restore the prior behavior.
    
    Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
    Cc: stable@vger.kernel.org
    Fixes: f117955a2255 ("kernel/watchdog.c: convert {soft/hard}lockup boot parameters to sysctl aliases")
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 938e5d28842afa842c48b0fdb15f9faff66c730e
Author: SeongJae Park <sj@kernel.org>
Date:   Tue Oct 31 17:01:31 2023 +0000

    mm/damon/sysfs: update monitoring target regions for online input commit
    
    commit 9732336006764e2ee61225387e3c70eae9139035 upstream.
    
    When user input is committed online, DAMON sysfs interface is ignoring the
    user input for the monitoring target regions.  Such request is valid and
    useful for fixed monitoring target regions-based monitoring ops like
    'paddr' or 'fvaddr'.
    
    Update the region boundaries as user specified, too.  Note that the
    monitoring results of the regions that overlap between the latest
    monitoring target regions and the new target regions are preserved.
    
    Treat empty monitoring target regions user request as a request to just
    make no change to the monitoring target regions.  Otherwise, users should
    set the monitoring target regions same to current one for every online
    input commit, and it could be challenging for dynamic monitoring target
    regions update DAMON ops like 'vaddr'.  If the user really need to remove
    all monitoring target regions, they can simply remove the target and then
    create the target again with empty target regions.
    
    Link: https://lkml.kernel.org/r/20231031170131.46972-1-sj@kernel.org
    Fixes: da87878010e5 ("mm/damon/sysfs: support online inputs update")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org>    [5.19+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1f8d1e4796a9e9e605495c0725a1a748af578b40
Author: SeongJae Park <sj@kernel.org>
Date:   Sun Oct 22 21:07:33 2023 +0000

    mm/damon/sysfs: remove requested targets when online-commit inputs
    
    commit 19467a950b49432a84bf6dbadbbb17bdf89418b7 upstream.
    
    damon_sysfs_set_targets(), which updates the targets of the context for
    online commitment, do not remove targets that removed from the
    corresponding sysfs files.  As a result, more than intended targets of the
    context can exist and hence consume memory and monitoring CPU resource
    more than expected.
    
    Fix it by removing all targets of the context and fill up again using the
    user input.  This could cause unnecessary memory dealloc and realloc
    operations, but this is not a hot code path.  Also, note that damon_target
    is stateless, and hence no data is lost.
    
    [sj@kernel.org: fix unnecessary monitoring results removal]
      Link: https://lkml.kernel.org/r/20231028213353.45397-1-sj@kernel.org
    Link: https://lkml.kernel.org/r/20231022210735.46409-2-sj@kernel.org
    Fixes: da87878010e5 ("mm/damon/sysfs: support online inputs update")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: Brendan Higgins <brendanhiggins@google.com>
    Cc: <stable@vger.kernel.org>    [5.19.x]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0763bcef474d2a520def66900455e950127b4eff
Author: Lukas Wunner <lukas@wunner.de>
Date:   Mon Sep 18 14:48:01 2023 +0200

    PCI/sysfs: Protect driver's D3cold preference from user space
    
    commit 70b70a4307cccebe91388337b1c85735ce4de6ff upstream.
    
    struct pci_dev contains two flags which govern whether the device may
    suspend to D3cold:
    
    * no_d3cold provides an opt-out for drivers (e.g. if a device is known
      to not wake from D3cold)
    
    * d3cold_allowed provides an opt-out for user space (default is true,
      user space may set to false)
    
    Since commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend"),
    the user space setting overwrites the driver setting.  Essentially user
    space is trusted to know better than the driver whether D3cold is
    working.
    
    That feels unsafe and wrong.  Assume that the change was introduced
    inadvertently and do not overwrite no_d3cold when d3cold_allowed is
    modified.  Instead, consider d3cold_allowed in addition to no_d3cold
    when choosing a suspend state for the device.
    
    That way, user space may opt out of D3cold if the driver hasn't, but it
    may no longer force an opt in if the driver has opted out.
    
    Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
    Link: https://lore.kernel.org/r/b8a7f4af2b73f6b506ad8ddee59d747cbf834606.1695025365.git.lukas@wunner.de
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
    Cc: stable@vger.kernel.org      # v4.8+
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 192e6eba4e72655571907dddcbf2ad61a373cea7
Author: David Woodhouse <dwmw@amazon.co.uk>
Date:   Fri Oct 20 17:15:27 2023 +0100

    hvc/xen: fix event channel handling for secondary consoles
    
    commit ef5dd8ec88ac11e8e353164407d55b73c988b369 upstream.
    
    The xencons_connect_backend() function allocates a local interdomain
    event channel with xenbus_alloc_evtchn(), then calls
    bind_interdomain_evtchn_to_irq_lateeoi() to bind to that port# on the
    *remote* domain.
    
    That doesn't work very well:
    
    (qemu) device_add xen-console,id=con1,chardev=pty0
    [   44.323872] xenconsole console-1: 2 xenbus_dev_probe on device/console/1
    [   44.323995] xenconsole: probe of console-1 failed with error -2
    
    Fix it to use bind_evtchn_to_irq_lateeoi(), which does the right thing
    by just binding that *local* event channel to an irq. The backend will
    do the interdomain binding.
    
    This didn't affect the primary console because the setup for that is
    special — the toolstack allocates the guest event channel and the guest
    discovers it with HVMOP_get_param.
    
    Fixes: fe415186b43d ("xen/console: harden hvc_xen against event channel storms")
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231020161529.355083-2-dwmw2@infradead.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 202f4d78d16b5fa920f0d28c22ed2c07f189879a
Author: David Woodhouse <dwmw@amazon.co.uk>
Date:   Fri Oct 20 17:15:28 2023 +0100

    hvc/xen: fix error path in xen_hvc_init() to always register frontend driver
    
    commit 2704c9a5593f4a47620c12dad78838ca62b52f48 upstream.
    
    The xen_hvc_init() function should always register the frontend driver,
    even when there's no primary console — as there may be secondary consoles.
    (Qemu can always add secondary consoles, but only the toolstack can add
    the primary because it's special.)
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231020161529.355083-3-dwmw2@infradead.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 11e5dac750de7fbaccd2023f144627c59897aead
Author: David Woodhouse <dwmw@amazon.co.uk>
Date:   Fri Oct 20 17:15:29 2023 +0100

    hvc/xen: fix console unplug
    
    commit a30badfd7c13fc8763a9e10c5a12ba7f81515a55 upstream.
    
    On unplug of a Xen console, xencons_disconnect_backend() unconditionally
    calls free_irq() via unbind_from_irqhandler(), causing a warning of
    freeing an already-free IRQ:
    
    (qemu) device_del con1
    [   32.050919] ------------[ cut here ]------------
    [   32.050942] Trying to free already-free IRQ 33
    [   32.050990] WARNING: CPU: 0 PID: 51 at kernel/irq/manage.c:1895 __free_irq+0x1d4/0x330
    
    It should be using evtchn_put() to tear down the event channel binding,
    and let the Linux IRQ side of it be handled by notifier_del_irq() through
    the HVC code.
    
    On which topic... xencons_disconnect_backend() should call hvc_remove()
    *first*, rather than tearing down the event channel and grant mapping
    while they are in use. And then the IRQ is guaranteed to be freed by
    the time it's torn down by evtchn_put().
    
    Since evtchn_put() also closes the actual event channel, avoid calling
    xenbus_free_evtchn() except in the failure path where the IRQ was not
    successfully set up.
    
    However, calling hvc_remove() at the start of xencons_disconnect_backend()
    still isn't early enough. An unplug request is indicated by the backend
    setting its state to XenbusStateClosing, which triggers a notification
    to xencons_backend_changed(), which... does nothing except set its own
    frontend state directly to XenbusStateClosed without *actually* tearing
    down the HVC device or, you know, making sure it isn't actively in use.
    
    So the backend sees the guest frontend set its state to XenbusStateClosed
    and stops servicing the interrupt... and the guest spins for ever in the
    domU_write_console() function waiting for the ring to drain.
    
    Fix that one by calling hvc_remove() from xencons_backend_changed() before
    signalling to the backend that it's OK to proceed with the removal.
    
    Tested with 'dd if=/dev/zero of=/dev/hvc1' while telling Qemu to remove
    the console device.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231020161529.355083-4-dwmw2@infradead.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 32ca78deedce610f28a85174a86429d66e1e0e02
Author: Roger Pau Monne <roger.pau@citrix.com>
Date:   Wed Nov 8 16:25:15 2023 -0500

    acpi/processor: sanitize _OSC/_PDC capabilities for Xen dom0
    
    commit bfa993b355d33a438a746523e7129391c8664e8a upstream.
    
    The Processor capability bits notify ACPI of the OS capabilities, and
    so ACPI can adjust the return of other Processor methods taking the OS
    capabilities into account.
    
    When Linux is running as a Xen dom0, the hypervisor is the entity
    in charge of processor power management, and hence Xen needs to make
    sure the capabilities reported by _OSC/_PDC match the capabilities of
    the driver in Xen.
    
    Introduce a small helper to sanitize the buffer when running as Xen
    dom0.
    
    When Xen supports HWP, this serves as the equivalent of commit
    a21211672c9a ("ACPI / processor: Request native thermal interrupt
    handling via _OSC") to avoid SMM crashes.  Xen will set bit
    ACPI_PROC_CAP_COLLAB_PROC_PERF (bit 12) in the capability bits and the
    _OSC/_PDC call will apply it.
    
    [ jandryuk: Mention Xen HWP's need.  Support _OSC & _PDC ]
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Michal Wilczynski <michal.wilczynski@intel.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Link: https://lore.kernel.org/r/20231108212517.72279-1-jandryuk@gmail.com
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 065ae2ec2b8af7c959fad1533620b83835d71c20
Author: Pavel Krasavin <pkrasavin@imaqliq.com>
Date:   Sat Oct 14 11:39:26 2023 +0000

    tty: serial: meson: fix hard LOCKUP on crtscts mode
    
    commit 2a1d728f20edeee7f26dc307ed9df4e0d23947ab upstream.
    
    There might be hard lockup if we set crtscts mode on port without RTS/CTS configured:
    
    # stty -F /dev/ttyAML6 crtscts; echo 1 > /dev/ttyAML6; echo 2 > /dev/ttyAML6
    [   95.890386] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
    [   95.890857] rcu:     3-...0: (201 ticks this GP) idle=e33c/1/0x4000000000000000 softirq=5844/5846 fqs=4984
    [   95.900212] rcu:     (detected by 2, t=21016 jiffies, g=7753, q=296 ncpus=4)
    [   95.906972] Task dump for CPU 3:
    [   95.910178] task:bash            state:R  running task     stack:0     pid:205   ppid:1      flags:0x00000202
    [   95.920059] Call trace:
    [   95.922485]  __switch_to+0xe4/0x168
    [   95.925951]  0xffffff8003477508
    [   95.974379] watchdog: Watchdog detected hard LOCKUP on cpu 3
    [   95.974424] Modules linked in: 88x2cs(O) rtc_meson_vrtc
    
    Possible solution would be to not allow to setup crtscts on such port.
    
    Tested on S905X3 based board.
    
    Fixes: ff7693d079e5 ("ARM: meson: serial: add MesonX SoC on-chip uart driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Pavel Krasavin <pkrasavin@imaqliq.com>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit aa267cfcfcdb0c2bbf541fcada4e0d7378ff1ec2
Author: Muhammad Usama Anjum <usama.anjum@collabora.com>
Date:   Mon Oct 9 21:20:20 2023 +0500

    tty/sysrq: replace smp_processor_id() with get_cpu()
    
    commit dd976a97d15b47656991e185a94ef42a0fa5cfd4 upstream.
    
    The smp_processor_id() shouldn't be called from preemptible code.
    Instead use get_cpu() and put_cpu() which disables preemption in
    addition to getting the processor id. Enable preemption back after
    calling schedule_work() to make sure that the work gets scheduled on all
    cores other than the current core. We want to avoid a scenario where
    current core's stack trace is printed multiple times and one core's
    stack trace isn't printed because of scheduling of current task.
    
    This fixes the following bug:
    
    [  119.143590] sysrq: Show backtrace of all active CPUs
    [  119.143902] BUG: using smp_processor_id() in preemptible [00000000] code: bash/873
    [  119.144586] caller is debug_smp_processor_id+0x20/0x30
    [  119.144827] CPU: 6 PID: 873 Comm: bash Not tainted 5.10.124-dirty #3
    [  119.144861] Hardware name: QEMU QEMU Virtual Machine, BIOS 2023.05-1 07/22/2023
    [  119.145053] Call trace:
    [  119.145093]  dump_backtrace+0x0/0x1a0
    [  119.145122]  show_stack+0x18/0x70
    [  119.145141]  dump_stack+0xc4/0x11c
    [  119.145159]  check_preemption_disabled+0x100/0x110
    [  119.145175]  debug_smp_processor_id+0x20/0x30
    [  119.145195]  sysrq_handle_showallcpus+0x20/0xc0
    [  119.145211]  __handle_sysrq+0x8c/0x1a0
    [  119.145227]  write_sysrq_trigger+0x94/0x12c
    [  119.145247]  proc_reg_write+0xa8/0xe4
    [  119.145266]  vfs_write+0xec/0x280
    [  119.145282]  ksys_write+0x6c/0x100
    [  119.145298]  __arm64_sys_write+0x20/0x30
    [  119.145315]  el0_svc_common.constprop.0+0x78/0x1e4
    [  119.145332]  do_el0_svc+0x24/0x8c
    [  119.145348]  el0_svc+0x10/0x20
    [  119.145364]  el0_sync_handler+0x134/0x140
    [  119.145381]  el0_sync+0x180/0x1c0
    
    Cc: jirislaby@kernel.org
    Cc: stable@vger.kernel.org
    Fixes: 47cab6a722d4 ("debug lockups: Improve lockup detection, fix generic arch fallback")
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Link: https://lore.kernel.org/r/20231009162021.3607632-1-usama.anjum@collabora.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2b1ee516b16a4174a906010d2d42bae5ce78ba04
Author: Krister Johansen <kjlx@templeofstupid.com>
Date:   Fri Oct 27 14:46:40 2023 -0700

    proc: sysctl: prevent aliased sysctls from getting passed to init
    
    commit 8001f49394e353f035306a45bcf504f06fca6355 upstream.
    
    The code that checks for unknown boot options is unaware of the sysctl
    alias facility, which maps bootparams to sysctl values.  If a user sets
    an old value that has a valid alias, a message about an invalid
    parameter will be printed during boot, and the parameter will get passed
    to init.  Fix by checking for the existence of aliased parameters in the
    unknown boot parameter code.  If an alias exists, don't return an error
    or pass the value to init.
    
    Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
    Cc: stable@vger.kernel.org
    Fixes: 0a477e1ae21b ("kernel/sysctl: support handling command line aliases")
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d567eb7366073d33c4b4254f0e2b28a7f13f1d1f
Author: Paul Moore <paul@paul-moore.com>
Date:   Tue Nov 14 17:25:48 2023 -0500

    audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare()
    
    commit 969d90ec212bae4b45bf9d21d7daa30aa6cf055e upstream.
    
    eBPF can end up calling into the audit code from some odd places, and
    some of these places don't have @current set properly so we end up
    tripping the `WARN_ON_ONCE(!current->mm)` near the top of
    `audit_exe_compare()`.  While the basic `!current->mm` check is good,
    the `WARN_ON_ONCE()` results in some scary console messages so let's
    drop that and just do the regular `!current->mm` check to avoid
    problems.
    
    Cc: <stable@vger.kernel.org>
    Fixes: 47846d51348d ("audit: don't take task_lock() in audit_exe_compare() code path")
    Reported-by: Artem Savkov <asavkov@redhat.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a2a2a2a51b6788bc044458bc3c331a6c2795b94d
Author: Paul Moore <paul@paul-moore.com>
Date:   Mon Oct 9 13:18:49 2023 -0400

    audit: don't take task_lock() in audit_exe_compare() code path
    
    commit 47846d51348dd62e5231a83be040981b17c955fa upstream.
    
    The get_task_exe_file() function locks the given task with task_lock()
    which when used inside audit_exe_compare() can cause deadlocks on
    systems that generate audit records when the task_lock() is held. We
    resolve this problem with two changes: ignoring those cases where the
    task being audited is not the current task, and changing our approach
    to obtaining the executable file struct to not require task_lock().
    
    With the intent of the audit exe filter being to filter on audit events
    generated by processes started by the specified executable, it makes
    sense that we would only want to use the exe filter on audit records
    associated with the currently executing process, e.g. @current.  If
    we are asked to filter records using a non-@current task_struct we can
    safely ignore the exe filter without negatively impacting the admin's
    expectations for the exe filter.
    
    Knowing that we only have to worry about filtering the currently
    executing task in audit_exe_compare() we can do away with the
    task_lock() and call get_mm_exe_file() with @current->mm directly.
    
    Cc: <stable@vger.kernel.org>
    Fixes: 5efc244346f9 ("audit: fix exe_file access in audit_exe_compare")
    Reported-by: Andreas Steinmetz <anstein99@googlemail.com>
    Reviewed-by: John Johansen <john.johanse@canonical.com>
    Reviewed-by: Mateusz Guzik <mjguzik@gmail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 04d2fea2b7fa7bf21a1bd7520a067e75e469c999
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Thu Oct 26 12:41:14 2023 -0400

    sched: psi: fix unprivileged polling against cgroups
    
    commit 8b39d20eceeda6c4eb23df1497f9ed2fffdc8f69 upstream.
    
    519fabc7aaba ("psi: remove 500ms min window size limitation for
    triggers") breaks unprivileged psi polling on cgroups.
    
    Historically, we had a privilege check for polling in the open() of a
    pressure file in /proc, but were erroneously missing it for the open()
    of cgroup pressure files.
    
    When unprivileged polling was introduced in d82caa273565 ("sched/psi:
    Allow unprivileged polling of N*2s period"), it needed to filter
    privileges depending on the exact polling parameters, and as such
    moved the CAP_SYS_RESOURCE check from the proc open() callback to
    psi_trigger_create(). Both the proc files as well as cgroup files go
    through this during write(). This implicitly added the missing check
    for privileges required for HT polling for cgroups.
    
    When 519fabc7aaba ("psi: remove 500ms min window size limitation for
    triggers") followed right after to remove further restrictions on the
    RT polling window, it incorrectly assumed the cgroup privilege check
    was still missing and added it to the cgroup open(), mirroring what we
    used to do for proc files in the past.
    
    As a result, unprivileged poll requests that would be supported now
    get rejected when opening the cgroup pressure file for writing.
    
    Remove the cgroup open() check. psi_trigger_create() handles it.
    
    Fixes: 519fabc7aaba ("psi: remove 500ms min window size limitation for triggers")
    Reported-by: Luca Boccassi <bluca@debian.org>
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Luca Boccassi <bluca@debian.org>
    Acked-by: Suren Baghdasaryan <surenb@google.com>
    Cc: stable@vger.kernel.org # 6.5+
    Link: https://lore.kernel.org/r/20231026164114.2488682-1-hannes@cmpxchg.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fcf890eca49364b24f6903f47b91abc0e3e6fc6a
Author: Victor Shih <victor.shih@genesyslogic.com.tw>
Date:   Tue Nov 7 17:57:41 2023 +0800

    mmc: sdhci-pci-gli: GL9755: Mask the replay timer timeout of AER
    
    commit 85dd3af64965c1c0eb7373b340a1b1f7773586b0 upstream.
    
    Due to a flaw in the hardware design, the GL9755 replay timer frequently
    times out when ASPM is enabled. As a result, the warning messages will
    often appear in the system log when the system accesses the GL9755
    PCI config. Therefore, the replay timer timeout must be masked.
    
    Fixes: 36ed2fd32b2c ("mmc: sdhci-pci-gli: A workaround to allow GL9755 to enter ASPM L1.2")
    Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Acked-by: Kai-Heng Feng <kai.heng.geng@canonical.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231107095741.8832-3-victorshihgli@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7de33b0fc98dc90f17416d9353b1faf514e93d18
Author: Haitao Shan <hshan@google.com>
Date:   Tue Sep 12 16:55:45 2023 -0700

    KVM: x86: Fix lapic timer interrupt lost after loading a snapshot.
    
    commit 9cfec6d097c607e36199cf0cfbb8cf5acbd8e9b2 upstream.
    
    When running android emulator (which is based on QEMU 2.12) on
    certain Intel hosts with kernel version 6.3-rc1 or above, guest
    will freeze after loading a snapshot. This is almost 100%
    reproducible. By default, the android emulator will use snapshot
    to speed up the next launching of the same android guest. So
    this breaks the android emulator badly.
    
    I tested QEMU 8.0.4 from Debian 12 with an Ubuntu 22.04 guest by
    running command "loadvm" after "savevm". The same issue is
    observed. At the same time, none of our AMD platforms is impacted.
    More experiments show that loading the KVM module with
    "enable_apicv=false" can workaround it.
    
    The issue started to show up after commit 8e6ed96cdd50 ("KVM: x86:
    fire timer when it is migrated and expired, and in oneshot mode").
    However, as is pointed out by Sean Christopherson, it is introduced
    by commit 967235d32032 ("KVM: vmx: clear pending interrupts on
    KVM_SET_LAPIC"). commit 8e6ed96cdd50 ("KVM: x86: fire timer when
    it is migrated and expired, and in oneshot mode") just makes it
    easier to hit the issue.
    
    Having both commits, the oneshot lapic timer gets fired immediately
    inside the KVM_SET_LAPIC call when loading the snapshot. On Intel
    platforms with APIC virtualization and posted interrupt processing,
    this eventually leads to setting the corresponding PIR bit. However,
    the whole PIR bits get cleared later in the same KVM_SET_LAPIC call
    by apicv_post_state_restore. This leads to timer interrupt lost.
    
    The fix is to move vmx_apicv_post_state_restore to the beginning of
    the KVM_SET_LAPIC call and rename to vmx_apicv_pre_state_restore.
    What vmx_apicv_post_state_restore does is actually clearing any
    former apicv state and this behavior is more suitable to carry out
    in the beginning.
    
    Fixes: 967235d32032 ("KVM: vmx: clear pending interrupts on KVM_SET_LAPIC")
    Cc: stable@vger.kernel.org
    Suggested-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Haitao Shan <hshan@google.com>
    Link: https://lore.kernel.org/r/20230913000215.478387-1-hshan@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fb05c7b93c67876fafff6bd6277f210d442171ee
Author: Tao Su <tao1.su@linux.intel.com>
Date:   Thu Sep 14 13:55:04 2023 +0800

    KVM: x86: Clear bit12 of ICR after APIC-write VM-exit
    
    commit 629d3698f6958ee6f8131ea324af794f973b12ac upstream.
    
    When IPI virtualization is enabled, a WARN is triggered if bit12 of ICR
    MSR is set after APIC-write VM-exit. The reason is kvm_apic_send_ipi()
    thinks the APIC_ICR_BUSY bit should be cleared because KVM has no delay,
    but kvm_apic_write_nodecode() doesn't clear the APIC_ICR_BUSY bit.
    
    Under the x2APIC section, regarding ICR, the SDM says:
    
      It remains readable only to aid in debugging; however, software should
      not assume the value returned by reading the ICR is the last written
      value.
    
    I.e. the guest is allowed to set bit 12.  However, the SDM also gives KVM
    free reign to do whatever it wants with the bit, so long as KVM's behavior
    doesn't confuse userspace or break KVM's ABI.
    
    Clear bit 12 so that it reads back as '0'. This approach is safer than
    "do nothing" and is consistent with the case where IPI virtualization is
    disabled or not supported, i.e.,
    
      handle_fastpath_set_x2apic_icr_irqoff() -> kvm_x2apic_icr_write()
    
    Opportunistically replace the TODO with a comment calling out that eating
    the write is likely faster than a conditional branch around the busy bit.
    
    Link: https://lore.kernel.org/all/ZPj6iF0Q7iynn62p@google.com/
    Fixes: 5413bcba7ed5 ("KVM: x86: Add support for vICR APIC-write VM-Exits in x2APIC mode")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tao Su <tao1.su@linux.intel.com>
    Tested-by: Yi Lai <yi1.lai@intel.com>
    Reviewed-by: Chao Gao <chao.gao@intel.com>
    Link: https://lore.kernel.org/r/20230914055504.151365-1-tao1.su@linux.intel.com
    [sean: tweak changelog, replace TODO with comment, drop local "val"]
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d3719df92e836f56a94f5fea12ff768a54b580cc
Author: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Date:   Thu Oct 19 18:06:57 2023 +0200

    KVM: x86: Ignore MSR_AMD64_TW_CFG access
    
    commit 2770d4722036d6bd24bcb78e9cd7f6e572077d03 upstream.
    
    Hyper-V enabled Windows Server 2022 KVM VM cannot be started on Zen1 Ryzen
    since it crashes at boot with SYSTEM_THREAD_EXCEPTION_NOT_HANDLED +
    STATUS_PRIVILEGED_INSTRUCTION (in other words, because of an unexpected #GP
    in the guest kernel).
    
    This is because Windows tries to set bit 8 in MSR_AMD64_TW_CFG and can't
    handle receiving a #GP when doing so.
    
    Give this MSR the same treatment that commit 2e32b7190641
    ("x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs") gave
    MSR_AMD64_BU_CFG2 under justification that this MSR is baremetal-relevant
    only.
    Although apparently it was then needed for Linux guests, not Windows as in
    this case.
    
    With this change, the aforementioned guest setup is able to finish booting
    successfully.
    
    This issue can be reproduced either on a Summit Ridge Ryzen (with
    just "-cpu host") or on a Naples EPYC (with "-cpu host,stepping=1" since
    EPYC is ordinarily stepping 2).
    
    Alternatively, userspace could solve the problem by using MSR filters, but
    forcing every userspace to define a filter isn't very friendly and doesn't
    add much, if any, value.  The only potential hiccup is if one of these
    "baremetal-only" MSRs ever requires actual emulation and/or has F/M/S
    specific behavior.  But if that happens, then KVM can still punt *that*
    handling to userspace since userspace MSR filters "win" over KVM's default
    handling.
    
    Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/1ce85d9c7c9e9632393816cf19c902e0a3f411f1.1697731406.git.maciej.szmigiero@oracle.com
    [sean: call out MSR filtering alternative]
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e0c63803d729cd2d81394d6d29b8601f09c262a2
Author: Nicolas Saenz Julienne <nsaenz@amazon.com>
Date:   Tue Oct 17 15:51:02 2023 +0000

    KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space
    
    commit d6800af51c76b6dae20e6023bbdc9b3da3ab5121 upstream.
    
    Don't apply the stimer's counter side effects when modifying its
    value from user-space, as this may trigger spurious interrupts.
    
    For example:
     - The stimer is configured in auto-enable mode.
     - The stimer's count is set and the timer enabled.
     - The stimer expires, an interrupt is injected.
     - The VM is live migrated.
     - The stimer config and count are deserialized, auto-enable is ON, the
       stimer is re-enabled.
     - The stimer expires right away, and injects an unwarranted interrupt.
    
    Cc: stable@vger.kernel.org
    Fixes: 1f4b34f825e8 ("kvm/x86: Hyper-V SynIC timers")
    Signed-off-by: Nicolas Saenz Julienne <nsaenz@amazon.com>
    Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    Link: https://lore.kernel.org/r/20231017155101.40677-1-nsaenz@amazon.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8e780a58c181539d3286f9d03fc945476c79cc6f
Author: Pu Wen <puwen@hygon.cn>
Date:   Mon Aug 14 10:18:26 2023 +0200

    x86/cpu/hygon: Fix the CPU topology evaluation for real
    
    commit ee545b94d39a00c93dc98b1dbcbcf731d2eadeb4 upstream.
    
    Hygon processors with a model ID > 3 have CPUID leaf 0xB correctly
    populated and don't need the fixed package ID shift workaround. The fixup
    is also incorrect when running in a guest.
    
    Fixes: e0ceeae708ce ("x86/CPU/hygon: Fix phys_proc_id calculation logic for multi-die processors")
    Signed-off-by: Pu Wen <puwen@hygon.cn>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/tencent_594804A808BD93A4EBF50A994F228E3A7F07@qq.com
    Link: https://lore.kernel.org/r/20230814085112.089607918@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 119f7373b0cba03c4b5a86a936c0384c074a8c94
Author: Koichiro Den <den@valinux.co.jp>
Date:   Thu Oct 26 12:20:36 2023 +0900

    x86/apic/msi: Fix misconfigured non-maskable MSI quirk
    
    commit b56ebe7c896dc78b5865ec2c4b1dae3c93537517 upstream.
    
    commit ef8dd01538ea ("genirq/msi: Make interrupt allocation less
    convoluted"), reworked the code so that the x86 specific quirk for affinity
    setting of non-maskable PCI/MSI interrupts is not longer activated if
    necessary.
    
    This could be solved by restoring the original logic in the core MSI code,
    but after a deeper analysis it turned out that the quirk flag is not
    required at all.
    
    The quirk is only required when the PCI/MSI device cannot mask the MSI
    interrupts, which in turn also prevents reservation mode from being enabled
    for the affected interrupt.
    
    This allows ot remove the NOMASK quirk bit completely as msi_set_affinity()
    can instead check whether reservation mode is enabled for the interrupt,
    which gives exactly the same answer.
    
    Even in the momentary non-existing case that the reservation mode would be
    not set for a maskable MSI interrupt this would not cause any harm as it
    just would cause msi_set_affinity() to go needlessly through the
    functionaly equivalent slow path, which works perfectly fine with maskable
    interrupts as well.
    
    Rework msi_set_affinity() to query the reservation mode and remove all
    NOMASK quirk logic from the core code.
    
    [ tglx: Massaged changelog ]
    
    Fixes: ef8dd01538ea ("genirq/msi: Make interrupt allocation less convoluted")
    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Koichiro Den <den@valinux.co.jp>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20231026032036.2462428-1-den@valinux.co.jp
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f6154cb2908228225ab92be51fe99ee30459864
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Wed Oct 4 09:49:59 2023 -0500

    x86/PCI: Avoid PME from D3hot/D3cold for AMD Rembrandt and Phoenix USB4
    
    commit 7d08f21f8c6307cb05cabb8d86e90ff6ccba57e9 upstream.
    
    Iain reports that USB devices can't be used to wake a Lenovo Z13 from
    suspend.  This occurs because on some AMD platforms, even though the Root
    Ports advertise PME_Support for D3hot and D3cold, wakeup events from
    devices on a USB4 controller don't result in wakeup interrupts from the
    Root Port when amd-pmc has put the platform in a hardware sleep state.
    
    If amd-pmc will be involved in the suspend, remove D3hot and D3cold from
    the PME_Support mask of Root Ports above USB4 controllers so we avoid those
    states if we need wakeups.
    
    Restore D3 support at resume so that it can be used by runtime suspend.
    
    This affects both AMD Rembrandt and Phoenix SoCs.
    
    "pm_suspend_target_state == PM_SUSPEND_ON" means we're doing runtime
    suspend, and amd-pmc will not be involved.  In that case PMEs work as
    advertised in D3hot/D3cold, so we don't need to do anything.
    
    Note that amd-pmc is technically optional, and there's no need for this
    quirk if it's not present, but we assume it's always present because power
    consumption is so high without it.
    
    Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
    Link: https://lore.kernel.org/r/20231004144959.158840-1-mario.limonciello@amd.com
    Reported-by: Iain Lane <iain@orangesquash.org.uk>
    Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    [bhelgaas: commit log, move to arch/x86/pci/fixup.c, add #includes]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 20b951fcdce135e2013e82e1e837d286872d8880
Author: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Date:   Fri Sep 15 12:23:25 2023 +0200

    crypto: x86/sha - load modules based on CPU features
    
    commit 1c43c0f1f84aa59dfc98ce66f0a67b2922aa7f9d upstream.
    
    x86 optimized crypto modules are built as modules rather than build-in and
    they are not loaded when the crypto API is initialized, resulting in the
    generic builtin module (sha1-generic) being used instead.
    
    It was discovered when creating a sha1/sha256 checksum of a 2Gb file by
    using kcapi-tools because it would take significantly longer than creating
    a sha512 checksum of the same file. trace-cmd showed that for sha1/256 the
    generic module was used, whereas for sha512 the optimized module was used
    instead.
    
    Add module aliases() for these x86 optimized crypto modules based on CPU
    feature bits so udev gets a chance to load them later in the boot
    process. This resulted in ~3x decrease in the real-time execution of
    kcapi-dsg.
    
    Fix is inspired from commit
    aa031b8f702e ("crypto: x86/sha512 - load based on CPU features")
    where a similar fix was done for sha512.
    
    Cc: stable@vger.kernel.org # 5.15+
    Suggested-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
    Suggested-by: Julian Andres Klode <julian.klode@canonical.com>
    Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4cb2be4c7305e90e1ffa50af4d6d34b4ba5181bc
Author: Rick Edgecombe <rick.p.edgecombe@intel.com>
Date:   Tue Nov 7 10:22:51 2023 -0800

    x86/shstk: Delay signal entry SSP write until after user accesses
    
    commit 31255e072b2e91f97645d792d25b2db744186dd1 upstream.
    
    When a signal is being delivered, the kernel needs to make accesses to
    userspace. These accesses could encounter an access error, in which case
    the signal delivery itself will trigger a segfault. Usually this would
    result in the kernel killing the process. But in the case of a SEGV signal
    handler being configured, the failure of the first signal delivery will
    result in *another* signal getting delivered. The second signal may
    succeed if another thread has resolved the issue that triggered the
    segfault (i.e. a well timed mprotect()/mmap()), or the second signal is
    being delivered to another stack (i.e. an alt stack).
    
    On x86, in the non-shadow stack case, all the accesses to userspace are
    done before changes to the registers (in pt_regs). The operation is
    aborted when an access error occurs, so although there may be writes done
    for the first signal, control flow changes for the signal (regs->ip,
    regs->sp, etc) are not committed until all the accesses have already
    completed successfully. This means that the second signal will be
    delivered as if it happened at the time of the first signal. It will
    effectively replace the first aborted signal, overwriting the half-written
    frame of the aborted signal. So on sigreturn from the second signal,
    control flow will resume happily from the point of control flow where the
    original signal was delivered.
    
    The problem is, when shadow stack is active, the shadow stack SSP
    register/MSR is updated *before* some of the userspace accesses. This
    means if the earlier accesses succeed and the later ones fail, the second
    signal will not be delivered at the same spot on the shadow stack as the
    first one. So on sigreturn from the second signal, the SSP will be
    pointing to the wrong location on the shadow stack (off by a frame).
    
    Pengfei privately reported that while using a shadow stack enabled glibc,
    the “signal06” test in the LTP test-suite hung. It turns out it is
    testing the above described double signal scenario. When this test was
    compiled with shadow stack, the first signal pushed a shadow stack
    sigframe, then the second pushed another. When the second signal was
    handled, the SSP was at the first shadow stack signal frame instead of
    the original location. The test then got stuck as the #CP from the twice
    incremented SSP was incorrect and generated segfaults in a loop.
    
    Fix this by adjusting the SSP register only after any userspace accesses,
    such that there can be no failures after the SSP is adjusted. Do this by
    moving the shadow stack sigframe push logic to happen after all other
    userspace accesses.
    
    Note, sigreturn (as opposed to the signal delivery dealt with in this
    patch) has ordering behavior that could lead to similar failures. The
    ordering issues there extend beyond shadow stack to include the alt stack
    restoration. Fixing that would require cross-arch changes, and the
    ordering today does not cause any known test or apps breakages. So leave
    it as is, for now.
    
    [ dhansen: minor changelog/subject tweak ]
    
    Fixes: 05e36022c054 ("x86/shstk: Handle signals for shadow stack")
    Reported-by: Pengfei Xu <pengfei.xu@intel.com>
    Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Tested-by: Pengfei Xu <pengfei.xu@intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20231107182251.91276-1-rick.p.edgecombe%40intel.com
    Link: https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/signal/signal06.c
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f84d461f33a6b27304d468d9cfb56c0cefdb4ee7
Author: Peter Wang <peter.wang@mediatek.com>
Date:   Mon Nov 6 15:51:17 2023 +0800

    scsi: ufs: core: Fix racing issue between ufshcd_mcq_abort() and ISR
    
    commit 27900d7119c464b43cd9eac69c85884d17bae240 upstream.
    
    If command timeout happens and cq complete IRQ is raised at the same time,
    ufshcd_mcq_abort clears lprb->cmd and a NULL pointer deref happens in the
    ISR. Error log:
    
    ufshcd_abort: Device abort task at tag 18
    Unable to handle kernel NULL pointer dereference at virtual address
    0000000000000108
    pc : [0xffffffe27ef867ac] scsi_dma_unmap+0xc/0x44
    lr : [0xffffffe27f1b898c] ufshcd_release_scsi_cmd+0x24/0x114
    
    Fixes: f1304d442077 ("scsi: ufs: mcq: Added ufshcd_mcq_abort()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Peter Wang <peter.wang@mediatek.com>
    Link: https://lore.kernel.org/r/20231106075117.8995-1-peter.wang@mediatek.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>

commit d03346d4ab4b68ca2bde66f5582d6f4e3433886d
Author: Quinn Tran <qutran@marvell.com>
Date:   Mon Oct 30 12:19:12 2023 +0530

    scsi: qla2xxx: Fix system crash due to bad pointer access
    
    commit 19597cad64d608aa8ac2f8aef50a50187a565223 upstream.
    
    User experiences system crash when running AER error injection.  The
    perturbation causes the abort-all-I/O path to trigger. The driver assumes
    all I/O on this path is FCP only. If there is both NVMe & FCP traffic, a
    system crash happens. Add additional check to see if I/O is FCP or not
    before access.
    
    PID: 999019  TASK: ff35d769f24722c0  CPU: 53  COMMAND: "kworker/53:1"
     0 [ff3f78b964847b58] machine_kexec at ffffffffae86973d
     1 [ff3f78b964847ba8] __crash_kexec at ffffffffae9be29d
     2 [ff3f78b964847c70] crash_kexec at ffffffffae9bf528
     3 [ff3f78b964847c78] oops_end at ffffffffae8282ab
     4 [ff3f78b964847c98] exc_page_fault at ffffffffaf2da502
     5 [ff3f78b964847cc0] asm_exc_page_fault at ffffffffaf400b62
       [exception RIP: qla2x00_abort_srb+444]
       RIP: ffffffffc07b5f8c  RSP: ff3f78b964847d78  RFLAGS: 00010046
       RAX: 0000000000000282  RBX: ff35d74a0195a200  RCX: ff35d76886fd03a0
       RDX: 0000000000000001  RSI: ffffffffc07c5ec8  RDI: ff35d74a0195a200
       RBP: ff35d76913d22080   R8: ff35d7694d103200   R9: ff35d7694d103200
       R10: 0000000100000000  R11: ffffffffb05d6630  R12: 0000000000010000
       R13: ff3f78b964847df8  R14: ff35d768d8754000  R15: ff35d768877248e0
       ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
     6 [ff3f78b964847d70] qla2x00_abort_srb at ffffffffc07b5f84 [qla2xxx]
     7 [ff3f78b964847de0] __qla2x00_abort_all_cmds at ffffffffc07b6238 [qla2xxx]
     8 [ff3f78b964847e38] qla2x00_abort_all_cmds at ffffffffc07ba635 [qla2xxx]
     9 [ff3f78b964847e58] qla2x00_terminate_rport_io at ffffffffc08145eb [qla2xxx]
    10 [ff3f78b964847e70] fc_terminate_rport_io at ffffffffc045987e [scsi_transport_fc]
    11 [ff3f78b964847e88] process_one_work at ffffffffae914f15
    12 [ff3f78b964847ed0] worker_thread at ffffffffae9154c0
    13 [ff3f78b964847f10] kthread at ffffffffae91c456
    14 [ff3f78b964847f50] ret_from_fork at ffffffffae8036ef
    
    Cc: stable@vger.kernel.org
    Fixes: f45bca8c5052 ("scsi: qla2xxx: Fix double scsi_done for abort path")
    Signed-off-by: Quinn Tran <qutran@marvell.com>
    Signed-off-by: Nilesh Javali <njavali@marvell.com>
    Link: https://lore.kernel.org/r/20231030064912.37912-1-njavali@marvell.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 98b3777034e39dfc10a9aff8a5888bd57a6fd2fd
Author: Manivannan Sadhasivam <mani@kernel.org>
Date:   Fri Sep 8 20:23:28 2023 +0530

    scsi: ufs: qcom: Update PHY settings only when scaling to higher gears
    
    commit fc88ca19ad0989dc0e4d4b126d5d0ba91f6cb616 upstream.
    
    The "hs_gear" variable is used to program the PHY settings (submode) during
    ufs_qcom_power_up_sequence(). Currently, it is being updated every time the
    agreed gear changes. Due to this, if the gear got downscaled before suspend
    (runtime/system), then while resuming, the PHY settings for the lower gear
    will be applied first and later when scaling to max gear with REINIT, the
    PHY settings for the max gear will be applied.
    
    This adds a latency while resuming and also really not needed as the PHY
    gear settings are backwards compatible i.e., we can continue using the PHY
    settings for max gear with lower gear speed.
    
    So let's update the "hs_gear" variable _only_ when the agreed gear is
    greater than the current one. This guarantees that the PHY settings will be
    changed only during probe time and fatal error condition.
    
    Due to this, UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH can now be skipped
    when the PM operation is in progress.
    
    Cc: stable@vger.kernel.org
    Fixes: 96a7141da332 ("scsi: ufs: core: Add support for reinitializing the UFS device")
    Reported-by: Can Guo <quic_cang@quicinc.com>
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Link: https://lore.kernel.org/r/20230908145329.154024-1-manivannan.sadhasivam@linaro.org
    Reviewed-by: Can Guo <quic_cang@quicinc.com>
    Tested-by: Can Guo <quic_cang@quicinc.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ad347c46384b9b95bf3403c4dd819700167a3754
Author: Chandrakanth patil <chandrakanth.patil@broadcom.com>
Date:   Tue Oct 3 16:30:18 2023 +0530

    scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for selected registers
    
    commit 8e3ed9e786511ad800c33605ed904b9de49323cf upstream.
    
    In BMC environments with concurrent access to multiple registers, certain
    registers occasionally yield a value of 0 even after 3 retries due to
    hardware errata. As a fix, we have extended the retry count from 3 to 30.
    
    The same errata applies to the mpt3sas driver, and a similar patch has
    been accepted. Please find more details in the mpt3sas patch reference
    link.
    
    Link: https://lore.kernel.org/r/20230829090020.5417-2-ranjan.kumar@broadcom.com
    Fixes: 272652fcbf1a ("scsi: megaraid_sas: add retry logic in megasas_readl")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chandrakanth patil <chandrakanth.patil@broadcom.com>
    Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
    Link: https://lore.kernel.org/r/20231003110021.168862-2-chandrakanth.patil@broadcom.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b6b6294f823983440e754bbecec9a674b081276c
Author: Ranjan Kumar <ranjan.kumar@broadcom.com>
Date:   Fri Oct 20 16:28:49 2023 +0530

    scsi: mpt3sas: Fix loop logic
    
    commit 3c978492c333f0c08248a8d51cecbe5eb5f617c9 upstream.
    
    The retry loop continues to iterate until the count reaches 30, even after
    receiving the correct value. Exit loop when a non-zero value is read.
    
    Fixes: 4ca10f3e3174 ("scsi: mpt3sas: Perform additional retries if doorbell read returns 0")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
    Link: https://lore.kernel.org/r/20231020105849.6350-1-ranjan.kumar@broadcom.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 226b46d53bb8e1d49fc541d7851c09ab04d782b9
Author: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Date:   Thu Nov 2 13:39:03 2023 +0800

    bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END
    
    commit 291d044fd51f8484066300ee42afecf8c8db7b3a upstream.
    
    BPF_END and BPF_NEG has a different specification for the source bit in
    the opcode compared to other ALU/ALU64 instructions, and is either
    reserved or use to specify the byte swap endianness. In both cases the
    source bit does not encode source operand location, and src_reg is a
    reserved field.
    
    backtrack_insn() currently does not differentiate BPF_END and BPF_NEG
    from other ALU/ALU64 instructions, which leads to r0 being incorrectly
    marked as precise when processing BPF_ALU | BPF_TO_BE | BPF_END
    instructions. This commit teaches backtrack_insn() to correctly mark
    precision for such case.
    
    While precise tracking of BPF_NEG and other BPF_END instructions are
    correct and does not need fixing, this commit opt to process all BPF_NEG
    and BPF_END instructions within the same if-clause to better align with
    current convention used in the verifier (e.g. check_alu_op).
    
    Fixes: b5dc0163d8fd ("bpf: precise scalar_value tracking")
    Cc: stable@vger.kernel.org
    Reported-by: Mohamed Mahmoud <mmahmoud@redhat.com>
    Closes: https://lore.kernel.org/r/87jzrrwptf.fsf@toke.dk
    Tested-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Tested-by: Tao Lyu <tao.lyu@epfl.ch>
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Link: https://lore.kernel.org/r/20231102053913.12004-2-shung-hsi.yu@suse.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 156a9b745653fc81e73e4bf086943eac549f6e42
Author: Hao Sun <sunhao.th@gmail.com>
Date:   Wed Nov 1 13:33:51 2023 +0100

    bpf: Fix check_stack_write_fixed_off() to correctly spill imm
    
    commit 811c363645b33e6e22658634329e95f383dfc705 upstream.
    
    In check_stack_write_fixed_off(), imm value is cast to u32 before being
    spilled to the stack. Therefore, the sign information is lost, and the
    range information is incorrect when load from the stack again.
    
    For the following prog:
    0: r2 = r10
    1: *(u64*)(r2 -40) = -44
    2: r0 = *(u64*)(r2 - 40)
    3: if r0 s<= 0xa goto +2
    4: r0 = 1
    5: exit
    6: r0  = 0
    7: exit
    
    The verifier gives:
    func#0 @0
    0: R1=ctx(off=0,imm=0) R10=fp0
    0: (bf) r2 = r10                      ; R2_w=fp0 R10=fp0
    1: (7a) *(u64 *)(r2 -40) = -44        ; R2_w=fp0 fp-40_w=4294967252
    2: (79) r0 = *(u64 *)(r2 -40)         ; R0_w=4294967252 R2_w=fp0
    fp-40_w=4294967252
    3: (c5) if r0 s< 0xa goto pc+2
    mark_precise: frame0: last_idx 3 first_idx 0 subseq_idx -1
    mark_precise: frame0: regs=r0 stack= before 2: (79) r0 = *(u64 *)(r2 -40)
    3: R0_w=4294967252
    4: (b7) r0 = 1                        ; R0_w=1
    5: (95) exit
    verification time 7971 usec
    stack depth 40
    processed 6 insns (limit 1000000) max_states_per_insn 0 total_states 0
    peak_states 0 mark_read 0
    
    So remove the incorrect cast, since imm field is declared as s32, and
    __mark_reg_known() takes u64, so imm would be correctly sign extended
    by compiler.
    
    Fixes: ecdf985d7615 ("bpf: track immediate values written to stack by BPF_ST instruction")
    Cc: stable@vger.kernel.org
    Signed-off-by: Hao Sun <sunhao.th@gmail.com>
    Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/r/20231101-fix-check-stack-write-v3-1-f05c2b1473d5@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 96474ea47dc67b0704392d59192b233c8197db0e
Author: Mark Hasemeyer <markhas@chromium.org>
Date:   Tue Nov 7 14:47:43 2023 -0700

    spi: Fix null dereference on suspend
    
    commit bef4a48f4ef798c4feddf045d49e53c8a97d5e37 upstream.
    
    A race condition exists where a synchronous (noqueue) transfer can be
    active during a system suspend. This can cause a null pointer
    dereference exception to occur when the system resumes.
    
    Example order of events leading to the exception:
    1. spi_sync() calls __spi_transfer_message_noqueue() which sets
       ctlr->cur_msg
    2. Spi transfer begins via spi_transfer_one_message()
    3. System is suspended interrupting the transfer context
    4. System is resumed
    6. spi_controller_resume() calls spi_start_queue() which resets cur_msg
       to NULL
    7. Spi transfer context resumes and spi_finalize_current_message() is
       called which dereferences cur_msg (which is now NULL)
    
    Wait for synchronous transfers to complete before suspending by
    acquiring the bus mutex and setting/checking a suspend flag.
    
    Signed-off-by: Mark Hasemeyer <markhas@chromium.org>
    Link: https://lore.kernel.org/r/20231107144743.v1.1.I7987f05f61901f567f7661763646cb7d7919b528@changeid
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 792473a4e0eb872443ff30bc96f2b7cd0d878619
Author: Kees Cook <keescook@chromium.org>
Date:   Fri Oct 6 21:09:28 2023 -0700

    randstruct: Fix gcc-plugin performance mode to stay in group
    
    commit 381fdb73d1e2a48244de7260550e453d1003bb8e upstream.
    
    The performance mode of the gcc-plugin randstruct was shuffling struct
    members outside of the cache-line groups. Limit the range to the
    specified group indexes.
    
    Cc: linux-hardening@vger.kernel.org
    Cc: stable@vger.kernel.org
    Reported-by: Lukas Loidolt <e1634039@student.tuwien.ac.at>
    Closes: https://lore.kernel.org/all/f3ca77f0-e414-4065-83a5-ae4c4d25545d@student.tuwien.ac.at
    Fixes: 313dd1b62921 ("gcc-plugins: Add the randstruct plugin")
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 63fe567a0668a893e8bb16faa8624e8c99c2dbd2
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Thu Oct 19 01:34:23 2023 +1000

    powerpc/perf: Fix disabling BHRB and instruction sampling
    
    commit ea142e590aec55ba40c5affb4d49e68c713c63dc upstream.
    
    When the PMU is disabled, MMCRA is not updated to disable BHRB and
    instruction sampling. This can lead to those features remaining enabled,
    which can slow down a real or emulated CPU.
    
    Fixes: 1cade527f6e9 ("powerpc/perf: BHRB control to disable BHRB logic when not used")
    Cc: stable@vger.kernel.org # v5.9+
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20231018153423.298373-1-npiggin@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ee534525baf87a8e82229fc4ad4a0743a5b431f5
Author: Adrian Hunter <adrian.hunter@intel.com>
Date:   Thu Sep 28 10:29:53 2023 +0300

    perf intel-pt: Fix async branch flags
    
    commit f2d87895cbc4af80649850dcf5da36de6b2ed3dd upstream.
    
    Ensure PERF_IP_FLAG_ASYNC is set always for asynchronous branches (i.e.
    interrupts etc).
    
    Fixes: 90e457f7be08 ("perf tools: Add Intel PT support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Acked-by: Namhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20230928072953.19369-1-adrian.hunter@intel.com
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 074aed64f345ae17287716b0f7ddd577b3153fb7
Author: Vikash Garodia <quic_vgarodia@quicinc.com>
Date:   Thu Aug 10 07:55:01 2023 +0530

    media: venus: hfi: add checks to perform sanity on queue pointers
    
    commit 5e538fce33589da6d7cb2de1445b84d3a8a692f7 upstream.
    
    Read and write pointers are used to track the packet index in the memory
    shared between video driver and firmware. There is a possibility of OOB
    access if the read or write pointer goes beyond the queue memory size.
    Add checks for the read and write pointer to avoid OOB access.
    
    Cc: stable@vger.kernel.org
    Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
    Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
    Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 45a0de41ec383c8b7c6d442734ba3852dd2fc4a7
Author: Alexandre Ghiti <alexghiti@rivosinc.com>
Date:   Thu Nov 9 09:21:28 2023 +0100

    drivers: perf: Check find_first_bit() return value
    
    commit c6e316ac05532febb0c966fa9b55f5258ed037be upstream.
    
    We must check the return value of find_first_bit() before using the
    return value as an index array since it happens to overflow the array
    and then panic:
    
    [  107.318430] Kernel BUG [#1]
    [  107.319434] CPU: 3 PID: 1238 Comm: kill Tainted: G            E      6.6.0-rc6ubuntu-defconfig #2
    [  107.319465] Hardware name: riscv-virtio,qemu (DT)
    [  107.319551] epc : pmu_sbi_ovf_handler+0x3a4/0x3ae
    [  107.319840]  ra : pmu_sbi_ovf_handler+0x52/0x3ae
    [  107.319868] epc : ffffffff80a0a77c ra : ffffffff80a0a42a sp : ffffaf83fecda350
    [  107.319884]  gp : ffffffff823961a8 tp : ffffaf8083db1dc0 t0 : ffffaf83fecda480
    [  107.319899]  t1 : ffffffff80cafe62 t2 : 000000000000ff00 s0 : ffffaf83fecda520
    [  107.319921]  s1 : ffffaf83fecda380 a0 : 00000018fca29df0 a1 : ffffffffffffffff
    [  107.319936]  a2 : 0000000001073734 a3 : 0000000000000004 a4 : 0000000000000000
    [  107.319951]  a5 : 0000000000000040 a6 : 000000001d1c8774 a7 : 0000000000504d55
    [  107.319965]  s2 : ffffffff82451f10 s3 : ffffffff82724e70 s4 : 000000000000003f
    [  107.319980]  s5 : 0000000000000011 s6 : ffffaf8083db27c0 s7 : 0000000000000000
    [  107.319995]  s8 : 0000000000000001 s9 : 00007fffb45d6558 s10: 00007fffb45d81a0
    [  107.320009]  s11: ffffaf7ffff60000 t3 : 0000000000000004 t4 : 0000000000000000
    [  107.320023]  t5 : ffffaf7f80000000 t6 : ffffaf8000000000
    [  107.320037] status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003
    [  107.320081] [<ffffffff80a0a77c>] pmu_sbi_ovf_handler+0x3a4/0x3ae
    [  107.320112] [<ffffffff800b42d0>] handle_percpu_devid_irq+0x9e/0x1a0
    [  107.320131] [<ffffffff800ad92c>] generic_handle_domain_irq+0x28/0x36
    [  107.320148] [<ffffffff8065f9f8>] riscv_intc_irq+0x36/0x4e
    [  107.320166] [<ffffffff80caf4a0>] handle_riscv_irq+0x54/0x86
    [  107.320189] [<ffffffff80cb0036>] do_irq+0x64/0x96
    [  107.320271] Code: 85a6 855e b097 ff7f 80e7 9220 b709 9002 4501 bbd9 (9002) 6097
    [  107.320585] ---[ end trace 0000000000000000 ]---
    [  107.320704] Kernel panic - not syncing: Fatal exception in interrupt
    [  107.320775] SMP: stopping secondary CPUs
    [  107.321219] Kernel Offset: 0x0 from 0xffffffff80000000
    [  107.333051] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
    
    Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support")
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Link: https://lore.kernel.org/r/20231109082128.40777-1-alexghiti@rivosinc.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1fd3a0b84f52b2591237a590d932af06ffeddc10
Author: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Date:   Thu Nov 2 17:16:54 2023 -0700

    perf: arm_cspmu: Reject events meant for other PMUs
    
    commit 15c7ef7341a2e54cfa12ac502c65d6fd2cce2b62 upstream.
    
    Coresight PMU driver didn't reject events meant for other PMUs.
    This caused some of the Core PMU events disappearing from
    the output of "perf list". In addition, trying to run e.g.
    
         $ perf stat -e r2 sleep 1
    
    made Coresight PMU driver to handle the event instead of letting
    Core PMU driver to deal with it.
    
    Cc: stable@vger.kernel.org
    Fixes: e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")
    Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
    Acked-by: Will Deacon <will@kernel.org>
    Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Link: https://lore.kernel.org/r/20231103001654.35565-1-ilkka@os.amperecomputing.com
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10f49cdfd5fb342a1a9641930dc040c570694e98
Author: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Date:   Fri Oct 27 10:28:22 2023 -0700

    i915/perf: Fix NULL deref bugs with drm_dbg() calls
    
    commit 471aa951bf1206d3c10d0daa67005b8e4db4ff83 upstream.
    
    When i915 perf interface is not available dereferencing it will lead to
    NULL dereferences.
    
    As returning -ENOTSUPP is pretty clear return when perf interface is not
    available.
    
    Fixes: 2fec539112e8 ("i915/perf: Replace DRM_DEBUG with driver specific drm_dbg call")
    Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: <stable@vger.kernel.org> # v6.0+
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231027172822.2753059-1-harshit.m.mogalapalli@oracle.com
    [tursulin: added stable tag]
    (cherry picked from commit 36f27350ff745bd228ab04d7845dfbffc177a889)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2635504d913f5c66d8853a12eb8eb852b5552824
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Fri Jun 9 12:34:46 2023 +0200

    perf/core: Fix cpuctx refcounting
    
    commit 889c58b3155ff4c8e8671c95daef63d6fabbb6b1 upstream.
    
    Audit of the refcounting turned up that perf_pmu_migrate_context()
    fails to migrate the ctx refcount.
    
    Fixes: bd2756811766 ("perf: Rewrite core context handling")
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lkml.kernel.org/r/20230612093539.085862001@infradead.org
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 35867052aa591b4b36982d643323c43a4764914e
Author: Ekaterina Esina <eesina@astralinux.ru>
Date:   Mon Nov 13 19:42:41 2023 +0300

    cifs: fix check of rc in function generate_smb3signingkey
    
    [ Upstream commit 181724fc72486dec2bec8803459be05b5162aaa8 ]
    
    Remove extra check after condition, add check after generating key
    for encryption. The check is needed to return non zero rc before
    rewriting it with generating key for decryption.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Fixes: d70e9fa55884 ("cifs: try opening channels after mounting")
    Signed-off-by: Ekaterina Esina <eesina@astralinux.ru>
    Co-developed-by: Anastasia Belova <abelova@astralinux.ru>
    Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6641ac164a0458988482250e3df83b9a238532d0
Author: Anastasia Belova <abelova@astralinux.ru>
Date:   Mon Nov 13 17:52:32 2023 +0300

    cifs: spnego: add ';' in HOST_KEY_LEN
    
    [ Upstream commit ff31ba19d732efb9aca3633935d71085e68d5076 ]
    
    "host=" should start with ';' (as in cifs_get_spnego_key)
    So its length should be 6.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
    Fixes: 7c9c3760b3a5 ("[CIFS] add constants for string lengths of keynames in SPNEGO upcall string")
    Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
    Co-developed-by: Ekaterina Esina <eesina@astralinux.ru>
    Signed-off-by: Ekaterina Esina <eesina@astralinux.ru>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6046c267323613bad832fd64b66d48ebae4533a0
Author: Naomi Chu <naomi.chu@mediatek.com>
Date:   Thu Nov 2 13:24:24 2023 +0800

    scsi: ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1
    
    [ Upstream commit defde5a50d91c74e1ce71a7f0bce7fb1ae311d84 ]
    
    The UFSHCI 4.0 specification mandates that there should always be at least
    one empty slot in each queue for distinguishing between full and empty
    states. Enlarge 'hwq->max_entries' to 'DeviceQueueDepth + 1' to allow
    UFSHCI 4.0 controllers to fully utilize MCQ queue slots.
    
    Fixes: 4682abfae2eb ("scsi: ufs: core: mcq: Allocate memory for MCQ mode")
    Signed-off-by: Naomi Chu <naomi.chu@mediatek.com>
    Link: https://lore.kernel.org/r/20231102052426.12006-2-naomi.chu@mediatek.com
    Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Peter Wang <peter.wang@mediatek.com>
    Reviewed-by: Chun-Hung <chun-hung.wu@mediatek.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9b523bf810041c35d8c8105bb32102278c194f45
Author: Chen Yu <yu.c.chen@intel.com>
Date:   Mon Mar 27 11:17:44 2023 +0800

    tools/power/turbostat: Enable the C-state Pre-wake printing
    
    [ Upstream commit b61b7d8c4c22c4298a50ae5d0ee88facb85ce665 ]
    
    Currently the C-state Pre-wake will not be printed due to the
    probe has not been invoked. Invoke the probe function accordingly.
    
    Fixes: aeb01e6d71ff ("tools/power turbostat: Print the C-state Pre-wake settings")
    Signed-off-by: Chen Yu <yu.c.chen@intel.com>
    Reviewed-by: Zhang Rui <rui.zhang@intel.com>
    Reviewed-by: Len Brown <len.brown@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b866371f9032a037ff861358782757ad1d765411
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Sat Mar 25 21:57:07 2023 +0800

    tools/power/turbostat: Fix a knl bug
    
    [ Upstream commit 137f01b3529d292a68d22e9681e2f903c768f790 ]
    
    MSR_KNL_CORE_C6_RESIDENCY should be evaluated only if
    1. this is KNL platform
    AND
    2. need to get C6 residency or need to calculate C1 residency
    
    Fix the broken logic introduced by commit 1e9042b9c8d4 ("tools/power
    turbostat: Fix CPU%C1 display value").
    
    Fixes: 1e9042b9c8d4 ("tools/power turbostat: Fix CPU%C1 display value")
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Reviewed-by: Len Brown <len.brown@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7bd48f8a91bf56b738cac568a1972baf1b8532f6
Author: Vlad Buslov <vladbu@nvidia.com>
Date:   Tue Nov 14 18:59:15 2023 +0100

    macvlan: Don't propagate promisc change to lower dev in passthru
    
    [ Upstream commit 7e1caeace0418381f36b3aa8403dfd82fc57fc53 ]
    
    Macvlan device in passthru mode sets its lower device promiscuous mode
    according to its MACVLAN_FLAG_NOPROMISC flag instead of synchronizing it to
    its own promiscuity setting. However, macvlan_change_rx_flags() function
    doesn't check the mode before propagating such changes to the lower device
    which can cause net_device->promiscuity counter overflow as illustrated by
    reproduction example [0] and resulting dmesg log [1]. Fix the issue by
    first verifying the mode in macvlan_change_rx_flags() function before
    propagating promiscuous mode change to the lower device.
    
    [0]:
    ip link add macvlan1 link enp8s0f0 type macvlan mode passthru
    ip link set macvlan1 promisc on
    ip l set dev macvlan1 up
    ip link set macvlan1 promisc off
    ip l set dev macvlan1 down
    ip l set dev macvlan1 up
    
    [1]:
    [ 5156.281724] macvlan1: entered promiscuous mode
    [ 5156.285467] mlx5_core 0000:08:00.0 enp8s0f0: entered promiscuous mode
    [ 5156.287639] macvlan1: left promiscuous mode
    [ 5156.288339] mlx5_core 0000:08:00.0 enp8s0f0: left promiscuous mode
    [ 5156.290907] mlx5_core 0000:08:00.0 enp8s0f0: entered promiscuous mode
    [ 5156.317197] mlx5_core 0000:08:00.0 enp8s0f0: promiscuity touches roof, set promiscuity failed. promiscuity feature of device might be broken.
    
    Fixes: efdbd2b30caa ("macvlan: Propagate promiscuity setting to lower devices.")
    Reviewed-by: Gal Pressman <gal@nvidia.com>
    Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Link: https://lore.kernel.org/r/20231114175915.1649154-1-vladbu@nvidia.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0a7c9d1f550612fe0325b3987c2cdb7ec0546c58
Author: Xin Long <lucien.xin@gmail.com>
Date:   Mon Nov 13 12:53:28 2023 -0500

    net: sched: do not offload flows with a helper in act_ct
    
    [ Upstream commit 7cd5af0e937a197295f3aa3721031f0fbae49cff ]
    
    There is no hardware supporting ct helper offload. However, prior to this
    patch, a flower filter with a helper in the ct action can be successfully
    set into the HW, for example (eth1 is a bnxt NIC):
    
      # tc qdisc add dev eth1 ingress_block 22 ingress
      # tc filter add block 22 proto ip flower skip_sw ip_proto tcp \
        dst_port 21 ct_state -trk action ct helper ipv4-tcp-ftp
      # tc filter show dev eth1 ingress
    
        filter block 22 protocol ip pref 49152 flower chain 0 handle 0x1
          eth_type ipv4
          ip_proto tcp
          dst_port 21
          ct_state -trk
          skip_sw
          in_hw in_hw_count 1   <----
            action order 1: ct zone 0 helper ipv4-tcp-ftp pipe
             index 2 ref 1 bind 1
            used_hw_stats delayed
    
    This might cause the flower filter not to work as expected in the HW.
    
    This patch avoids this problem by simply returning -EOPNOTSUPP in
    tcf_ct_offload_act_setup() to not allow to offload flows with a helper
    in act_ct.
    
    Fixes: a21b06e73191 ("net: sched: add helper support in act_ct")
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://lore.kernel.org/r/f8685ec7702c4a448a1371a8b34b43217b583b9d.1699898008.git.lucien.xin@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 98ddd5bfec2b32a99d92494f015765b8efb0394c
Author: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date:   Tue Nov 14 13:58:46 2023 -0800

    net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors
    
    [ Upstream commit 1b2bd0c0264febcd8d47209079a6671c38e6558b ]
    
    Treat the operation as an error case when the return value is equivalent to
    the size of the name buffer. Failed to write null terminator to the name
    buffer, making the string malformed and should not be used. Provide a
    string with only the firmware version when forming the string with the
    board id fails. This logic for representors is identical to normal flow
    with ethtool.
    
    Without check, will trigger -Wformat-truncation with W=1.
    
        drivers/net/ethernet/mellanox/mlx5/core/en_rep.c: In function 'mlx5e_rep_get_drvinfo':
        drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:78:31: warning: '%.16s' directive output may be truncated writing up to 16 bytes into a region of size between 13 and 22 [-Wformat-truncation=]
          78 |                  "%d.%d.%04d (%.16s)",
             |                               ^~~~~
        drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:77:9: note: 'snprintf' output between 12 and 37 bytes into a destination of size 32
          77 |         snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
             |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          78 |                  "%d.%d.%04d (%.16s)",
             |                  ~~~~~~~~~~~~~~~~~~~~~
          79 |                  fw_rev_maj(mdev), fw_rev_min(mdev),
             |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          80 |                  fw_rev_sub(mdev), mdev->board_id);
             |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fixes: cf83c8fdcd47 ("net/mlx5e: Add missing ethtool driver info for representors")
    Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6d4ab2e97dcfbcd748ae71761a9d8e5e41cc732c
    Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
    Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-16-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a97df7f5cd4798d96a67458d1a708aca6518d439
Author: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date:   Tue Nov 14 13:58:45 2023 -0800

    net/mlx5e: Check return value of snprintf writing to fw_version buffer
    
    [ Upstream commit 41e63c2baa11dc2aa71df5dd27a5bd87d11b6bbb ]
    
    Treat the operation as an error case when the return value is equivalent to
    the size of the name buffer. Failed to write null terminator to the name
    buffer, making the string malformed and should not be used. Provide a
    string with only the firmware version when forming the string with the
    board id fails.
    
    Without check, will trigger -Wformat-truncation with W=1.
    
        drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c: In function 'mlx5e_ethtool_get_drvinfo':
        drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:49:31: warning: '%.16s' directive output may be truncated writing up to 16 bytes into a region of size between 13 and 22 [-Wformat-truncation=]
          49 |                  "%d.%d.%04d (%.16s)",
             |                               ^~~~~
        drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c:48:9: note: 'snprintf' output between 12 and 37 bytes into a destination of size 32
          48 |         snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
             |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          49 |                  "%d.%d.%04d (%.16s)",
             |                  ~~~~~~~~~~~~~~~~~~~~~
          50 |                  fw_rev_maj(mdev), fw_rev_min(mdev), fw_rev_sub(mdev),
             |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          51 |                  mdev->board_id);
             |                  ~~~~~~~~~~~~~~~
    
    Fixes: 84e11edb71de ("net/mlx5e: Show board id in ethtool driver information")
    Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6d4ab2e97dcfbcd748ae71761a9d8e5e41cc732c
    Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
    Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f31ed885c6da81a5357c22c68ac4abf432189c23
Author: Saeed Mahameed <saeedm@nvidia.com>
Date:   Tue Nov 14 13:58:44 2023 -0800

    net/mlx5e: Reduce the size of icosq_str
    
    [ Upstream commit dce94142842e119b982c27c1b62bd20890c7fd21 ]
    
    icosq_str size is unnecessarily too long, and it causes a build warning
    -Wformat-truncation with W=1. Looking closely, It doesn't need to be 255B,
    hence this patch reduces the size to 32B which should be more than enough
    to host the string: "ICOSQ: 0x%x, ".
    
    While here, add a missing space in the formatted string.
    
    This fixes the following build warning:
    
    $ KCFLAGS='-Wall -Werror'
    $ make O=/tmp/kbuild/linux W=1 -s -j12 drivers/net/ethernet/mellanox/mlx5/core/
    
    drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c: In function 'mlx5e_reporter_rx_timeout':
    drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c:718:56:
    error: ', CQ: 0x' directive output may be truncated writing 8 bytes into a region of size between 0 and 255 [-Werror=format-truncation=]
      718 |                  "RX timeout on channel: %d, %sRQ: 0x%x, CQ: 0x%x",
          |                                                        ^~~~~~~~
    drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c:717:9: note: 'snprintf' output between 43 and 322 bytes into a destination of size 288
      717 |         snprintf(err_str, sizeof(err_str),
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      718 |                  "RX timeout on channel: %d, %sRQ: 0x%x, CQ: 0x%x",
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      719 |                  rq->ix, icosq_str, rq->rqn, rq->cq.mcq.cqn);
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fixes: 521f31af004a ("net/mlx5e: Allow RQ outside of channel context")
    Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6d4ab2e97dcfbcd748ae71761a9d8e5e41cc732c
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-14-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 13738ed8141c136512292ecc39684e37e162cd6b
Author: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date:   Tue Nov 14 13:58:43 2023 -0800

    net/mlx5: Increase size of irq name buffer
    
    [ Upstream commit 3338bebfc26a1e2cebbba82a1cf12c0159608e73 ]
    
    Without increased buffer size, will trigger -Wformat-truncation with W=1
    for the snprintf operation writing to the buffer.
    
        drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c: In function 'mlx5_irq_alloc':
        drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c:296:7: error: '@pci:' directive output may be truncated writing 5 bytes into a region of size between 1 and 32 [-Werror=format-truncation=]
          296 |    "%s@pci:%s", name, pci_name(dev->pdev));
              |       ^~~~~
        drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c:295:2: note: 'snprintf' output 6 or more bytes (assuming 37) into a destination of size 32
          295 |  snprintf(irq->name, MLX5_MAX_IRQ_NAME,
              |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          296 |    "%s@pci:%s", name, pci_name(dev->pdev));
              |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fixes: ada9f5d00797 ("IB/mlx5: Fix eq names to display nicely in /proc/interrupts")
    Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6d4ab2e97dcfbcd748ae71761a9d8e5e41cc732c
    Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
    Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-13-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e5d30f7da35720060299483e65fc372980a82dfb
Author: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date:   Tue Nov 14 13:58:42 2023 -0800

    net/mlx5e: Update doorbell for port timestamping CQ before the software counter
    
    [ Upstream commit 92214be5979c0961a471b7eaaaeacab41bdf456c ]
    
    Previously, mlx5e_ptp_poll_ts_cq would update the device doorbell with the
    incremented consumer index after the relevant software counters in the
    kernel were updated. In the mlx5e_sq_xmit_wqe context, this would lead to
    either overrunning the device CQ or exceeding the expected software buffer
    size in the device CQ if the device CQ size was greater than the software
    buffer size. Update the relevant software counter only after updating the
    device CQ consumer index in the port timestamping napi_poll context.
    
    Log:
        mlx5_core 0000:08:00.0: cq_err_event_notifier:517:(pid 0): CQ error on CQN 0x487, syndrome 0x1
        mlx5_core 0000:08:00.0 eth2: mlx5e_cq_error_event: cqn=0x000487 event=0x04
    
    Fixes: 1880bc4e4a96 ("net/mlx5e: Add TX port timestamp support")
    Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-12-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4d510506b46504664eacf8a44a9e8f3e54c137b8
Author: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date:   Tue Nov 14 13:58:41 2023 -0800

    net/mlx5e: Track xmit submission to PTP WQ after populating metadata map
    
    [ Upstream commit 7e3f3ba97e6cc6fce5bf62df2ca06c8e59040167 ]
    
    Ensure the skb is available in metadata mapping to skbs before tracking the
    metadata index for detecting undelivered CQEs. If the metadata index is put
    in the tracking list before putting the skb in the map, the metadata index
    might be used for detecting undelivered CQEs before the relevant skb is
    available in the map, which can lead to a null-ptr-deref.
    
    Log:
        general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] SMP KASAN
        KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
        CPU: 0 PID: 1243 Comm: kworker/0:2 Not tainted 6.6.0-rc4+ #108
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        Workqueue: events mlx5e_rx_dim_work [mlx5_core]
        RIP: 0010:mlx5e_ptp_napi_poll+0x9a4/0x2290 [mlx5_core]
        Code: 8c 24 38 cc ff ff 4c 8d 3c c1 4c 89 f9 48 c1 e9 03 42 80 3c 31 00 0f 85 97 0f 00 00 4d 8b 3f 49 8d 7f 28 48 89 f9 48 c1 e9 03 <42> 80 3c 31 00 0f 85 8b 0f 00 00 49 8b 47 28 48 85 c0 0f 84 05 07
        RSP: 0018:ffff8884d3c09c88 EFLAGS: 00010206
        RAX: 0000000000000069 RBX: ffff8881160349d8 RCX: 0000000000000005
        RDX: ffffed10218f48cf RSI: 0000000000000004 RDI: 0000000000000028
        RBP: ffff888122707700 R08: 0000000000000001 R09: ffffed109a781383
        R10: 0000000000000003 R11: 0000000000000003 R12: ffff88810c7a7a40
        R13: ffff888122707700 R14: dffffc0000000000 R15: 0000000000000000
        FS:  0000000000000000(0000) GS:ffff8884d3c00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f4f878dd6e0 CR3: 000000014d108002 CR4: 0000000000370eb0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
        <IRQ>
        ? die_addr+0x3c/0xa0
        ? exc_general_protection+0x144/0x210
        ? asm_exc_general_protection+0x22/0x30
        ? mlx5e_ptp_napi_poll+0x9a4/0x2290 [mlx5_core]
        ? mlx5e_ptp_napi_poll+0x8f6/0x2290 [mlx5_core]
        __napi_poll.constprop.0+0xa4/0x580
        net_rx_action+0x460/0xb80
        ? _raw_spin_unlock_irqrestore+0x32/0x60
        ? __napi_poll.constprop.0+0x580/0x580
        ? tasklet_action_common.isra.0+0x2ef/0x760
        __do_softirq+0x26c/0x827
        irq_exit_rcu+0xc2/0x100
        common_interrupt+0x7f/0xa0
        </IRQ>
        <TASK>
        asm_common_interrupt+0x22/0x40
        RIP: 0010:__kmem_cache_alloc_node+0xb/0x330
        Code: 41 5d 41 5e 41 5f c3 8b 44 24 14 8b 4c 24 10 09 c8 eb d5 e8 b7 43 ca 01 0f 1f 80 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 41 57 <41> 56 41 89 d6 41 55 41 89 f5 41 54 49 89 fc 53 48 83 e4 f0 48 83
        RSP: 0018:ffff88812c4079c0 EFLAGS: 00000246
        RAX: 1ffffffff083c7fe RBX: ffff888100042dc0 RCX: 0000000000000218
        RDX: 00000000ffffffff RSI: 0000000000000dc0 RDI: ffff888100042dc0
        RBP: ffff88812c4079c8 R08: ffffffffa0289f96 R09: ffffed1025880ea9
        R10: ffff888138839f80 R11: 0000000000000002 R12: 0000000000000dc0
        R13: 0000000000000100 R14: 000000000000008c R15: ffff8881271fc450
        ? cmd_exec+0x796/0x2200 [mlx5_core]
        kmalloc_trace+0x26/0xc0
        cmd_exec+0x796/0x2200 [mlx5_core]
        mlx5_cmd_do+0x22/0xc0 [mlx5_core]
        mlx5_cmd_exec+0x17/0x30 [mlx5_core]
        mlx5_core_modify_cq_moderation+0x139/0x1b0 [mlx5_core]
        ? mlx5_add_cq_to_tasklet+0x280/0x280 [mlx5_core]
        ? lockdep_set_lock_cmp_fn+0x190/0x190
        ? process_one_work+0x659/0x1220
        mlx5e_rx_dim_work+0x9d/0x100 [mlx5_core]
        process_one_work+0x730/0x1220
        ? lockdep_hardirqs_on_prepare+0x400/0x400
        ? max_active_store+0xf0/0xf0
        ? assign_work+0x168/0x240
        worker_thread+0x70f/0x12d0
        ? __kthread_parkme+0xd1/0x1d0
        ? process_one_work+0x1220/0x1220
        kthread+0x2d9/0x3b0
        ? kthread_complete_and_exit+0x20/0x20
        ret_from_fork+0x2d/0x70
        ? kthread_complete_and_exit+0x20/0x20
        ret_from_fork_asm+0x11/0x20
        </TASK>
        Modules linked in: xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay mlx5_ib ib_uverbs ib_core zram zsmalloc mlx5_core fuse
        ---[ end trace 0000000000000000 ]---
    
    Fixes: 3178308ad4ca ("net/mlx5e: Make tx_port_ts logic resilient to out-of-order CQEs")
    Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-11-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3bc1967ddaac54323be664649e50e3e2618baadb
Author: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date:   Tue Nov 14 13:58:40 2023 -0800

    net/mlx5e: Avoid referencing skb after free-ing in drop path of mlx5e_sq_xmit_wqe
    
    [ Upstream commit 64f14d16eef1f939000f2617b50c7c996b5117d4 ]
    
    When SQ is a port timestamping SQ for PTP, do not access tx flags of skb
    after free-ing the skb. Free the skb only after all references that depend
    on it have been handled in the dropped WQE path.
    
    Fixes: 3178308ad4ca ("net/mlx5e: Make tx_port_ts logic resilient to out-of-order CQEs")
    Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-10-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f676cc90ad0f08f7c959ea625a7e2143a36f5c66
Author: Jianbo Liu <jianbol@nvidia.com>
Date:   Tue Nov 14 13:58:39 2023 -0800

    net/mlx5e: Don't modify the peer sent-to-vport rules for IPSec offload
    
    [ Upstream commit bdf788cf224f61c20a01c58c00685d394d57887f ]
    
    As IPSec packet offload in switchdev mode is not supported with LAG,
    it's unnecessary to modify those sent-to-vport rules to the peer eswitch.
    
    Fixes: c6c2bf5db4ea ("net/mlx5e: Support IPsec packet offload for TX in switchdev mode")
    Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Reviewed-by: Roi Dayan <roid@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-9-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5091e4ae11de818f2c1e1c0c374ebf1c29df75c4
Author: Vlad Buslov <vladbu@nvidia.com>
Date:   Tue Nov 14 13:58:38 2023 -0800

    net/mlx5e: Fix pedit endianness
    
    [ Upstream commit 0c101a23ca7eaf00eef1328eefb04b3a93401cc8 ]
    
    Referenced commit addressed endianness issue in mlx5 pedit implementation
    in ad hoc manner instead of systematically treating integer values
    according to their types which left pedit fields of sizes not equal to 4
    and where the bytes being modified are not least significant ones broken on
    big endian machines since wrong bits will be consumed during parsing which
    leads to following example error when applying pedit to source and
    destination MAC addresses:
    
    [Wed Oct 18 12:52:42 2023] mlx5_core 0001:00:00.1 p1v3_r: attempt to offload an unsupported field (cmd 0)
    [Wed Oct 18 12:52:42 2023] mask: 00000000330c5b68: 00 00 00 00 ff ff 00 00 00 00 ff ff 00 00 00 00  ................
    [Wed Oct 18 12:52:42 2023] mask: 0000000017d22fd9: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    [Wed Oct 18 12:52:42 2023] mask: 000000008186d717: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    [Wed Oct 18 12:52:42 2023] mask: 0000000029eb6149: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    [Wed Oct 18 12:52:42 2023] mask: 000000007ed103e4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    [Wed Oct 18 12:52:42 2023] mask: 00000000db8101a6: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    [Wed Oct 18 12:52:42 2023] mask: 00000000ec3c08a9: 00 00 00 00 00 00 00 00 00 00 00 00              ............
    
    Treat masks and values of pedit and filter match as network byte order,
    refactor pointers to them to void pointers instead of confusing u32
    pointers and only cast to pointer-to-integer when reading a value from
    them. Treat pedit mlx5_fields->field_mask as host byte order according to
    its type u32, change the constants in fields array accordingly.
    
    Fixes: 82198d8bcdef ("net/mlx5e: Fix endianness when calculating pedit mask first bit")
    Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
    Reviewed-by: Gal Pressman <gal@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-8-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bf66a6fadbab1b003a5a5b4944ec5f563587003b
Author: Gavin Li <gavinl@nvidia.com>
Date:   Tue Nov 14 13:58:37 2023 -0800

    net/mlx5e: fix double free of encap_header in update funcs
    
    [ Upstream commit 3a4aa3cb83563df942be49d145ee3b7ddf17d6bb ]
    
    Follow up to the previous patch to fix the same issue for
    mlx5e_tc_tun_update_header_ipv4{6} when mlx5_packet_reformat_alloc()
    fails.
    
    When mlx5_packet_reformat_alloc() fails, the encap_header allocated in
    mlx5e_tc_tun_update_header_ipv4{6} will be released within it. However,
    e->encap_header is already set to the previously freed encap_header
    before mlx5_packet_reformat_alloc(). As a result, the later
    mlx5e_encap_put() will free e->encap_header again, causing a double free
    issue.
    
    mlx5e_encap_put()
         --> mlx5e_encap_dealloc()
             --> kfree(e->encap_header)
    
    This patch fix it by not setting e->encap_header until
    mlx5_packet_reformat_alloc() success.
    
    Fixes: a54e20b4fcae ("net/mlx5e: Add basic TC tunnel set action for SRIOV offloads")
    Signed-off-by: Gavin Li <gavinl@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-7-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3911ba305a4623248cfa8cea49e3be5583356f82
Author: Dust Li <dust.li@linux.alibaba.com>
Date:   Tue Nov 14 13:58:36 2023 -0800

    net/mlx5e: fix double free of encap_header
    
    [ Upstream commit 6f9b1a0731662648949a1c0587f6acb3b7f8acf1 ]
    
    When mlx5_packet_reformat_alloc() fails, the encap_header allocated in
    mlx5e_tc_tun_create_header_ipv4{6} will be released within it. However,
    e->encap_header is already set to the previously freed encap_header
    before mlx5_packet_reformat_alloc(). As a result, the later
    mlx5e_encap_put() will free e->encap_header again, causing a double free
    issue.
    
    mlx5e_encap_put()
        --> mlx5e_encap_dealloc()
            --> kfree(e->encap_header)
    
    This happens when cmd: MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT fail.
    
    This patch fix it by not setting e->encap_header until
    mlx5_packet_reformat_alloc() success.
    
    Fixes: d589e785baf5e ("net/mlx5e: Allow concurrent creation of encap entries")
    Reported-by: Cruz Zhao <cruzzhao@linux.alibaba.com>
    Reported-by: Tianchen Ding <dtcccc@linux.alibaba.com>
    Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2226665bfb192ed58853e6cd988f32da8da81dc8
Author: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date:   Tue Nov 14 13:58:35 2023 -0800

    net/mlx5: Decouple PHC .adjtime and .adjphase implementations
    
    [ Upstream commit fd64fd13c49a53012ce9170449dcd9eb71c11284 ]
    
    When running a phase adjustment operation, the free running clock should
    not be modified at all. The phase control keyword is intended to trigger an
    internal servo on the device that will converge to the provided delta. A
    free running counter cannot implement phase adjustment.
    
    Fixes: 8e11a68e2e8a ("net/mlx5: Add adjphase function to support hardware-only offset control")
    Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-5-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 35309b05bc7055a0083a91faffee54077926e585
Author: Maher Sanalla <msanalla@nvidia.com>
Date:   Tue Nov 14 13:58:33 2023 -0800

    net/mlx5: Free used cpus mask when an IRQ is released
    
    [ Upstream commit 7d2f74d1d4385a5bcf90618537f16a45121c30ae ]
    
    Each EQ table maintains a cpumask of the already used CPUs that are mapped
    to IRQs to ensure that each IRQ gets mapped to a unique CPU.
    
    However, on IRQ release, the said cpumask is not updated by clearing the
    CPU from the mask to allow future IRQ request, causing the following
    error when a SF is reloaded after it has utilized all CPUs for its IRQs:
    
    mlx5_irq_affinity_request:135:(pid 306010): Didn't find a matching IRQ.
    err = -28
    
    Thus, when releasing an IRQ, clear its mapped CPU from the used CPUs
    mask, to prevent the case described above.
    
    While at it, move the used cpumask update to the EQ layer as it is more
    fitting and preserves symmetricity of the IRQ request/release API.
    
    Fixes: a1772de78d73 ("net/mlx5: Refactor completion IRQ request/release API")
    Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
    Reviewed-by: Shay Drory <shayd@nvidia.com>
    Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-3-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ead487b374b9f29644a315cab72f6fd8957aeed3
Author: Itamar Gozlan <igozlan@nvidia.com>
Date:   Tue Nov 14 13:58:32 2023 -0800

    Revert "net/mlx5: DR, Supporting inline WQE when possible"
    
    [ Upstream commit df3aafe501853c92bc9e25b05dcb030fee072962 ]
    
    This reverts commit 95c337cce0e11d06a715da73e6796ade9216637f.
    The revert is required due to the suspicion it cause some tests
    fail and will be moved to further investigation.
    
    Fixes: 95c337cce0e1 ("net/mlx5: DR, Supporting inline WQE when possible")
    Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
    Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
    Link: https://lore.kernel.org/r/20231114215846.5902-2-saeed@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5753dbb32648d7bb3530b022d5fa360868a983b1
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue Nov 14 09:55:50 2023 -0700

    io_uring/fdinfo: remove need for sqpoll lock for thread/pid retrieval
    
    [ Upstream commit a0d45c3f596be53c1bd8822a1984532d14fdcea9 ]
    
    A previous commit added a trylock for getting the SQPOLL thread info via
    fdinfo, but this introduced a regression where we often fail to get it if
    the thread is busy. For that case, we end up not printing the current CPU
    and PID info.
    
    Rather than rely on this lock, just print the pid we already stored in
    the io_sq_data struct, and ensure we update the current CPU every time
    we've slept or potentially rescheduled. The latter won't potentially be
    100% accurate, but that wasn't the case before either as the task can
    get migrated at any time unless it has been pinned at creation time.
    
    We retain keeping the io_sq_data dereference inside the ctx->uring_lock,
    as it has always been, as destruction of the thread and data happen below
    that. We could make this RCU safe, but there's little point in doing that.
    
    With this, we always print the last valid information we had, rather than
    have spurious outputs with missing information.
    
    Fixes: 7644b1a1c9a7 ("io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ff33be9cecee28f021493369bddb826f068a1acb
Author: Ziwei Xiao <ziweixiao@google.com>
Date:   Mon Nov 13 16:41:44 2023 -0800

    gve: Fixes for napi_poll when budget is 0
    
    [ Upstream commit 278a370c1766060d2144d6cf0b06c101e1043b6d ]
    
    Netpoll will explicilty pass the polling call with a budget of 0 to
    indicate it's clearing the Tx path only. For the gve_rx_poll and
    gve_xdp_poll, they were mistakenly taking the 0 budget as the indication
    to do all the work. Add check to avoid the rx path and xdp path being
    called when budget is 0. And also avoid napi_complete_done being called
    when budget is 0 for netpoll.
    
    Fixes: f5cedc84a30d ("gve: Add transmit and receive support")
    Signed-off-by: Ziwei Xiao <ziweixiao@google.com>
    Link: https://lore.kernel.org/r/20231114004144.2022268-1-ziweixiao@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3409e3adb1b41a31ede1409d5288a9a1b5b1dead
Author: Shannon Nelson <shannon.nelson@amd.com>
Date:   Mon Nov 13 10:32:57 2023 -0800

    pds_core: fix up some format-truncation complaints
    
    [ Upstream commit 7c02f6ae676a954216a192612040f9a0cde3adf7 ]
    
    Our friendly kernel test robot pointed out a couple of potential
    string truncation issues.  None of which were we worried about,
    but can be relatively easily fixed to quiet the complaints.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202310211736.66syyDpp-lkp@intel.com/
    Fixes: 45d76f492938 ("pds_core: set up device and adminq")
    Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
    Link: https://lore.kernel.org/r/20231113183257.71110-3-shannon.nelson@amd.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f4cbba7e2f0aa0a8f69735a84b06e61156e85ded
Author: Shannon Nelson <shannon.nelson@amd.com>
Date:   Mon Nov 13 10:32:56 2023 -0800

    pds_core: use correct index to mask irq
    
    [ Upstream commit 09d4c14c6c5e6e781a3879fed7f8e116a18b8c65 ]
    
    Use the qcq's interrupt index, not the irq number, to mask
    the interrupt.  Since the irq number can be out of range from
    the number of possible interrupts, we can end up accessing
    and potentially scribbling on out-of-range and/or unmapped
    memory, making the kernel angry.
    
        [ 3116.039364] BUG: unable to handle page fault for address: ffffbeea1c3edf84
        [ 3116.047059] #PF: supervisor write access in kernel mode
        [ 3116.052895] #PF: error_code(0x0002) - not-present page
        [ 3116.058636] PGD 100000067 P4D 100000067 PUD 1001f2067 PMD 10f82e067 PTE 0
        [ 3116.066221] Oops: 0002 [#1] SMP NOPTI
        [ 3116.092948] RIP: 0010:iowrite32+0x9/0x76
        [ 3116.190452] Call Trace:
        [ 3116.193185]  <IRQ>
        [ 3116.195430]  ? show_trace_log_lvl+0x1d6/0x2f9
        [ 3116.200298]  ? show_trace_log_lvl+0x1d6/0x2f9
        [ 3116.205166]  ? pdsc_adminq_isr+0x43/0x55 [pds_core]
        [ 3116.210618]  ? __die_body.cold+0x8/0xa
        [ 3116.214806]  ? page_fault_oops+0x16d/0x1ac
        [ 3116.219382]  ? exc_page_fault+0xbe/0x13b
        [ 3116.223764]  ? asm_exc_page_fault+0x22/0x27
        [ 3116.228440]  ? iowrite32+0x9/0x76
        [ 3116.232143]  pdsc_adminq_isr+0x43/0x55 [pds_core]
        [ 3116.237627]  __handle_irq_event_percpu+0x3a/0x184
        [ 3116.243088]  handle_irq_event+0x57/0xb0
        [ 3116.247575]  handle_edge_irq+0x87/0x225
        [ 3116.252062]  __common_interrupt+0x3e/0xbc
        [ 3116.256740]  common_interrupt+0x7b/0x98
        [ 3116.261216]  </IRQ>
        [ 3116.263745]  <TASK>
        [ 3116.266268]  asm_common_interrupt+0x22/0x27
    
    Reported-by: Joao Martins <joao.m.martins@oracle.com>
    Fixes: 01ba61b55b20 ("pds_core: Add adminq processing and commands")
    Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
    Link: https://lore.kernel.org/r/20231113183257.71110-2-shannon.nelson@amd.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 779334e59850f863bf34665e0ff0b6faf126873b
Author: Baruch Siach <baruch@tkos.co.il>
Date:   Mon Nov 13 19:42:50 2023 +0200

    net: stmmac: avoid rx queue overrun
    
    [ Upstream commit b6cb4541853c7ee512111b0e7ddf3cb66c99c137 ]
    
    dma_rx_size can be set as low as 64. Rx budget might be higher than
    that. Make sure to not overrun allocated rx buffers when budget is
    larger.
    
    Leave one descriptor unused to avoid wrap around of 'dirty_rx' vs
    'cur_rx'.
    
    Signed-off-by: Baruch Siach <baruch@tkos.co.il>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Fixes: 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet controllers.")
    Link: https://lore.kernel.org/r/d95413e44c97d4692e72cec13a75f894abeb6998.1699897370.git.baruch@tkos.co.il
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e5d20035855eb6d62eb78a5e5f0ac0a33fbdea01
Author: Baruch Siach <baruch@tkos.co.il>
Date:   Mon Nov 13 19:42:49 2023 +0200

    net: stmmac: fix rx budget limit check
    
    [ Upstream commit fa02de9e75889915b554eda1964a631fd019973b ]
    
    The while loop condition verifies 'count < limit'. Neither value change
    before the 'count >= limit' check. As is this check is dead code. But
    code inspection reveals a code path that modifies 'count' and then goto
    'drain_data' and back to 'read_again'. So there is a need to verify
    count value sanity after 'read_again'.
    
    Move 'read_again' up to fix the count limit check.
    
    Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
    Signed-off-by: Baruch Siach <baruch@tkos.co.il>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Link: https://lore.kernel.org/r/d9486296c3b6b12ab3a0515fcd47d56447a07bfc.1699897370.git.baruch@tkos.co.il
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f603b616bafe242efd597dfaef42b22ae6ade0ce
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Mon Nov 13 20:34:56 2023 +0100

    netfilter: nf_tables: bogus ENOENT when destroying element which does not exist
    
    [ Upstream commit a7d5a955bfa854ac6b0c53aaf933394b4e6139e4 ]
    
    destroy element command bogusly reports ENOENT in case a set element
    does not exist. ENOENT errors are skipped, however, err is still set
    and propagated to userspace.
    
     # nft destroy element ip raw BLACKLIST { 1.2.3.4 }
     Error: Could not process rule: No such file or directory
     destroy element ip raw BLACKLIST { 1.2.3.4 }
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    Fixes: f80a612dd77c ("netfilter: nf_tables: add support to destroy operation")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 013deed31ab15ef287b0045e4e7bd8f250e75b94
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Fri Nov 3 09:42:51 2023 +0300

    netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval()
    
    [ Upstream commit c301f0981fdd3fd1ffac6836b423c4d7a8e0eb63 ]
    
    The problem is in nft_byteorder_eval() where we are iterating through a
    loop and writing to dst[0], dst[1], dst[2] and so on...  On each
    iteration we are writing 8 bytes.  But dst[] is an array of u32 so each
    element only has space for 4 bytes.  That means that every iteration
    overwrites part of the previous element.
    
    I spotted this bug while reviewing commit caf3ef7468f7 ("netfilter:
    nf_tables: prevent OOB access in nft_byteorder_eval") which is a related
    issue.  I think that the reason we have not detected this bug in testing
    is that most of time we only write one element.
    
    Fixes: ce1e7989d989 ("netfilter: nft_byteorder: provide 64bit le/be conversion")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5772b7309818c5c447d01d1f3eae9f93f2c64a6b
Author: Linkui Xiao <xiaolinkui@kylinos.cn>
Date:   Wed Nov 1 11:20:18 2023 +0800

    netfilter: nf_conntrack_bridge: initialize err to 0
    
    [ Upstream commit a44af08e3d4d7566eeea98d7a29fe06e7b9de944 ]
    
    K2CI reported a problem:
    
            consume_skb(skb);
            return err;
    [nf_br_ip_fragment() error]  uninitialized symbol 'err'.
    
    err is not initialized, because returning 0 is expected, initialize err
    to 0.
    
    Fixes: 3c171f496ef5 ("netfilter: bridge: add connection tracking system")
    Reported-by: k2ci <kernel-bot@kylinos.cn>
    Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 069a3ec329ff43e7869a3d94c62cd03203016bce
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon Nov 13 13:49:38 2023 +0000

    af_unix: fix use-after-free in unix_stream_read_actor()
    
    [ Upstream commit 4b7b492615cf3017190f55444f7016812b66611d ]
    
    syzbot reported the following crash [1]
    
    After releasing unix socket lock, u->oob_skb can be changed
    by another thread. We must temporarily increase skb refcount
    to make sure this other thread will not free the skb under us.
    
    [1]
    
    BUG: KASAN: slab-use-after-free in unix_stream_read_actor+0xa7/0xc0 net/unix/af_unix.c:2866
    Read of size 4 at addr ffff88801f3b9cc4 by task syz-executor107/5297
    
    CPU: 1 PID: 5297 Comm: syz-executor107 Not tainted 6.6.0-syzkaller-15910-gb8e3a87a627b #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
    Call Trace:
    <TASK>
    __dump_stack lib/dump_stack.c:88 [inline]
    dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
    print_address_description mm/kasan/report.c:364 [inline]
    print_report+0xc4/0x620 mm/kasan/report.c:475
    kasan_report+0xda/0x110 mm/kasan/report.c:588
    unix_stream_read_actor+0xa7/0xc0 net/unix/af_unix.c:2866
    unix_stream_recv_urg net/unix/af_unix.c:2587 [inline]
    unix_stream_read_generic+0x19a5/0x2480 net/unix/af_unix.c:2666
    unix_stream_recvmsg+0x189/0x1b0 net/unix/af_unix.c:2903
    sock_recvmsg_nosec net/socket.c:1044 [inline]
    sock_recvmsg+0xe2/0x170 net/socket.c:1066
    ____sys_recvmsg+0x21f/0x5c0 net/socket.c:2803
    ___sys_recvmsg+0x115/0x1a0 net/socket.c:2845
    __sys_recvmsg+0x114/0x1e0 net/socket.c:2875
    do_syscall_x64 arch/x86/entry/common.c:51 [inline]
    do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
    entry_SYSCALL_64_after_hwframe+0x63/0x6b
    RIP: 0033:0x7fc67492c559
    Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007fc6748ab228 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
    RAX: ffffffffffffffda RBX: 000000000000001c RCX: 00007fc67492c559
    RDX: 0000000040010083 RSI: 0000000020000140 RDI: 0000000000000004
    RBP: 00007fc6749b6348 R08: 00007fc6748ab6c0 R09: 00007fc6748ab6c0
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc6749b6340
    R13: 00007fc6749b634c R14: 00007ffe9fac52a0 R15: 00007ffe9fac5388
    </TASK>
    
    Allocated by task 5295:
    kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
    kasan_set_track+0x25/0x30 mm/kasan/common.c:52
    __kasan_slab_alloc+0x81/0x90 mm/kasan/common.c:328
    kasan_slab_alloc include/linux/kasan.h:188 [inline]
    slab_post_alloc_hook mm/slab.h:763 [inline]
    slab_alloc_node mm/slub.c:3478 [inline]
    kmem_cache_alloc_node+0x180/0x3c0 mm/slub.c:3523
    __alloc_skb+0x287/0x330 net/core/skbuff.c:641
    alloc_skb include/linux/skbuff.h:1286 [inline]
    alloc_skb_with_frags+0xe4/0x710 net/core/skbuff.c:6331
    sock_alloc_send_pskb+0x7e4/0x970 net/core/sock.c:2780
    sock_alloc_send_skb include/net/sock.h:1884 [inline]
    queue_oob net/unix/af_unix.c:2147 [inline]
    unix_stream_sendmsg+0xb5f/0x10a0 net/unix/af_unix.c:2301
    sock_sendmsg_nosec net/socket.c:730 [inline]
    __sock_sendmsg+0xd5/0x180 net/socket.c:745
    ____sys_sendmsg+0x6ac/0x940 net/socket.c:2584
    ___sys_sendmsg+0x135/0x1d0 net/socket.c:2638
    __sys_sendmsg+0x117/0x1e0 net/socket.c:2667
    do_syscall_x64 arch/x86/entry/common.c:51 [inline]
    do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
    entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Freed by task 5295:
    kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
    kasan_set_track+0x25/0x30 mm/kasan/common.c:52
    kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522
    ____kasan_slab_free mm/kasan/common.c:236 [inline]
    ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200
    kasan_slab_free include/linux/kasan.h:164 [inline]
    slab_free_hook mm/slub.c:1800 [inline]
    slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826
    slab_free mm/slub.c:3809 [inline]
    kmem_cache_free+0xf8/0x340 mm/slub.c:3831
    kfree_skbmem+0xef/0x1b0 net/core/skbuff.c:1015
    __kfree_skb net/core/skbuff.c:1073 [inline]
    consume_skb net/core/skbuff.c:1288 [inline]
    consume_skb+0xdf/0x170 net/core/skbuff.c:1282
    queue_oob net/unix/af_unix.c:2178 [inline]
    unix_stream_sendmsg+0xd49/0x10a0 net/unix/af_unix.c:2301
    sock_sendmsg_nosec net/socket.c:730 [inline]
    __sock_sendmsg+0xd5/0x180 net/socket.c:745
    ____sys_sendmsg+0x6ac/0x940 net/socket.c:2584
    ___sys_sendmsg+0x135/0x1d0 net/socket.c:2638
    __sys_sendmsg+0x117/0x1e0 net/socket.c:2667
    do_syscall_x64 arch/x86/entry/common.c:51 [inline]
    do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
    entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    The buggy address belongs to the object at ffff88801f3b9c80
    which belongs to the cache skbuff_head_cache of size 240
    The buggy address is located 68 bytes inside of
    freed 240-byte region [ffff88801f3b9c80, ffff88801f3b9d70)
    
    The buggy address belongs to the physical page:
    page:ffffea00007cee40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f3b9
    flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
    page_type: 0xffffffff()
    raw: 00fff00000000800 ffff888142a60640 dead000000000122 0000000000000000
    raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    page_owner tracks the page as allocated
    page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 5299, tgid 5283 (syz-executor107), ts 103803840339, free_ts 103600093431
    set_page_owner include/linux/page_owner.h:31 [inline]
    post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1537
    prep_new_page mm/page_alloc.c:1544 [inline]
    get_page_from_freelist+0xa25/0x36c0 mm/page_alloc.c:3312
    __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4568
    alloc_pages_mpol+0x258/0x5f0 mm/mempolicy.c:2133
    alloc_slab_page mm/slub.c:1870 [inline]
    allocate_slab+0x251/0x380 mm/slub.c:2017
    new_slab mm/slub.c:2070 [inline]
    ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223
    __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
    __slab_alloc_node mm/slub.c:3375 [inline]
    slab_alloc_node mm/slub.c:3468 [inline]
    kmem_cache_alloc_node+0x132/0x3c0 mm/slub.c:3523
    __alloc_skb+0x287/0x330 net/core/skbuff.c:641
    alloc_skb include/linux/skbuff.h:1286 [inline]
    alloc_skb_with_frags+0xe4/0x710 net/core/skbuff.c:6331
    sock_alloc_send_pskb+0x7e4/0x970 net/core/sock.c:2780
    sock_alloc_send_skb include/net/sock.h:1884 [inline]
    queue_oob net/unix/af_unix.c:2147 [inline]
    unix_stream_sendmsg+0xb5f/0x10a0 net/unix/af_unix.c:2301
    sock_sendmsg_nosec net/socket.c:730 [inline]
    __sock_sendmsg+0xd5/0x180 net/socket.c:745
    ____sys_sendmsg+0x6ac/0x940 net/socket.c:2584
    ___sys_sendmsg+0x135/0x1d0 net/socket.c:2638
    __sys_sendmsg+0x117/0x1e0 net/socket.c:2667
    page last free stack trace:
    reset_page_owner include/linux/page_owner.h:24 [inline]
    free_pages_prepare mm/page_alloc.c:1137 [inline]
    free_unref_page_prepare+0x4f8/0xa90 mm/page_alloc.c:2347
    free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487
    __unfreeze_partials+0x21d/0x240 mm/slub.c:2655
    qlink_free mm/kasan/quarantine.c:168 [inline]
    qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
    kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:294
    __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305
    kasan_slab_alloc include/linux/kasan.h:188 [inline]
    slab_post_alloc_hook mm/slab.h:763 [inline]
    slab_alloc_node mm/slub.c:3478 [inline]
    slab_alloc mm/slub.c:3486 [inline]
    __kmem_cache_alloc_lru mm/slub.c:3493 [inline]
    kmem_cache_alloc+0x15d/0x380 mm/slub.c:3502
    vm_area_dup+0x21/0x2f0 kernel/fork.c:500
    __split_vma+0x17d/0x1070 mm/mmap.c:2365
    split_vma mm/mmap.c:2437 [inline]
    vma_modify+0x25d/0x450 mm/mmap.c:2472
    vma_modify_flags include/linux/mm.h:3271 [inline]
    mprotect_fixup+0x228/0xc80 mm/mprotect.c:635
    do_mprotect_pkey+0x852/0xd60 mm/mprotect.c:809
    __do_sys_mprotect mm/mprotect.c:830 [inline]
    __se_sys_mprotect mm/mprotect.c:827 [inline]
    __x64_sys_mprotect+0x78/0xb0 mm/mprotect.c:827
    do_syscall_x64 arch/x86/entry/common.c:51 [inline]
    do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
    entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Memory state around the buggy address:
    ffff88801f3b9b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff88801f3b9c00: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
    >ffff88801f3b9c80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff88801f3b9d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
    ffff88801f3b9d80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
    
    Fixes: 876c14ad014d ("af_unix: fix holding spinlock in oob handling")
    Reported-and-tested-by: syzbot+7a2d546fa43e49315ed3@syzkaller.appspotmail.com
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Rao Shoaib <rao.shoaib@oracle.com>
    Reviewed-by: Rao shoaib <rao.shoaib@oracle.com>
    Link: https://lore.kernel.org/r/20231113134938.168151-1-edumazet@google.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2fcf4d7c1d2e18133733c0cba7b3a7b4b56135a3
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Thu Nov 9 10:03:14 2023 +0100

    net: ethernet: cortina: Fix MTU max setting
    
    [ Upstream commit dc6c0bfbaa947dd7976e30e8c29b10c868b6fa42 ]
    
    The RX max frame size is over 10000 for the Gemini ethernet,
    but the TX max frame size is actually just 2047 (0x7ff after
    checking the datasheet). Reflect this in what we offer to Linux,
    cap the MTU at the TX max frame minus ethernet headers.
    
    We delete the code disabling the hardware checksum for large
    MTUs as netdev->mtu can no longer be larger than
    netdev->max_mtu meaning the if()-clause in gmac_fix_features()
    is never true.
    
    Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Link: https://lore.kernel.org/r/20231109-gemini-largeframe-fix-v4-3-6e611528db08@linaro.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fdd624d1376f3e9f0ec0485f0bf4e3d860643def
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Thu Nov 9 10:03:13 2023 +0100

    net: ethernet: cortina: Handle large frames
    
    [ Upstream commit d4d0c5b4d279bfe3585fbd806efefd3e51c82afa ]
    
    The Gemini ethernet controller provides hardware checksumming
    for frames up to 1514 bytes including ethernet headers but not
    FCS.
    
    If we start sending bigger frames (after first bumping up the MTU
    on both interfaces sending and receiving the frames), truncated
    packets start to appear on the target such as in this tcpdump
    resulting from ping -s 1474:
    
    23:34:17.241983 14:d6:4d:a8:3c:4f (oui Unknown) > bc:ae:c5:6b:a8:3d (oui Unknown),
    ethertype IPv4 (0x0800), length 1514: truncated-ip - 2 bytes missing!
    (tos 0x0, ttl 64, id 32653, offset 0, flags [DF], proto ICMP (1), length 1502)
    OpenWrt.lan > Fecusia: ICMP echo request, id 1672, seq 50, length 1482
    
    If we bypass the hardware checksumming and provide a software
    fallback, everything starts working fine up to the max TX MTU
    of 2047 bytes, for example ping -s2000 192.168.1.2:
    
    00:44:29.587598 bc:ae:c5:6b:a8:3d (oui Unknown) > 14:d6:4d:a8:3c:4f (oui Unknown),
    ethertype IPv4 (0x0800), length 2042:
    (tos 0x0, ttl 64, id 51828, offset 0, flags [none], proto ICMP (1), length 2028)
    Fecusia > OpenWrt.lan: ICMP echo reply, id 1683, seq 4, length 2008
    
    The bit enabling to bypass hardware checksum (or any of the
    "TSS" bits) are undocumented in the hardware reference manual.
    The entire hardware checksum unit appears undocumented. The
    conclusion that we need to use the "bypass" bit was found by
    trial-and-error.
    
    Since no hardware checksum will happen, we slot in a software
    checksum fallback.
    
    Check for the condition where we need to compute checksum on the
    skb with either hardware or software using == CHECKSUM_PARTIAL instead
    of != CHECKSUM_NONE which is an incomplete check according to
    <linux/skbuff.h>.
    
    On the D-Link DIR-685 router this fixes a bug on the conduit
    interface to the RTL8366RB DSA switch: as the switch needs to add
    space for its tag it increases the MTU on the conduit interface
    to 1504 and that means that when the router sends packages
    of 1500 bytes these get an extra 4 bytes of DSA tag and the
    transfer fails because of the erroneous hardware checksumming,
    affecting such basic functionality as the LuCI web interface.
    
    Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Link: https://lore.kernel.org/r/20231109-gemini-largeframe-fix-v4-2-6e611528db08@linaro.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fa5fcabf5a25e3bad0fa5e432531d533b51b2ecd
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Thu Nov 9 10:03:12 2023 +0100

    net: ethernet: cortina: Fix max RX frame define
    
    [ Upstream commit 510e35fb931ffc3b100e5d5ae4595cd3beca9f1a ]
    
    Enumerator 3 is 1548 bytes according to the datasheet.
    Not 1542.
    
    Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Link: https://lore.kernel.org/r/20231109-gemini-largeframe-fix-v4-1-6e611528db08@linaro.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d98c91215a5748a0f536e7ccea26027005196859
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Nov 9 18:01:02 2023 +0000

    bonding: stop the device in bond_setup_by_slave()
    
    [ Upstream commit 3cffa2ddc4d3fcf70cde361236f5a614f81a09b2 ]
    
    Commit 9eed321cde22 ("net: lapbether: only support ethernet devices")
    has been able to keep syzbot away from net/lapb, until today.
    
    In the following splat [1], the issue is that a lapbether device has
    been created on a bonding device without members. Then adding a non
    ARPHRD_ETHER member forced the bonding master to change its type.
    
    The fix is to make sure we call dev_close() in bond_setup_by_slave()
    so that the potential linked lapbether devices (or any other devices
    having assumptions on the physical device) are removed.
    
    A similar bug has been addressed in commit 40baec225765
    ("bonding: fix panic on non-ARPHRD_ETHER enslave failure")
    
    [1]
    skbuff: skb_under_panic: text:ffff800089508810 len:44 put:40 head:ffff0000c78e7c00 data:ffff0000c78e7bea tail:0x16 end:0x140 dev:bond0
    kernel BUG at net/core/skbuff.c:192 !
    Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 0 PID: 6007 Comm: syz-executor383 Not tainted 6.6.0-rc3-syzkaller-gbf6547d8715b #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
    pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : skb_panic net/core/skbuff.c:188 [inline]
    pc : skb_under_panic+0x13c/0x140 net/core/skbuff.c:202
    lr : skb_panic net/core/skbuff.c:188 [inline]
    lr : skb_under_panic+0x13c/0x140 net/core/skbuff.c:202
    sp : ffff800096a06aa0
    x29: ffff800096a06ab0 x28: ffff800096a06ba0 x27: dfff800000000000
    x26: ffff0000ce9b9b50 x25: 0000000000000016 x24: ffff0000c78e7bea
    x23: ffff0000c78e7c00 x22: 000000000000002c x21: 0000000000000140
    x20: 0000000000000028 x19: ffff800089508810 x18: ffff800096a06100
    x17: 0000000000000000 x16: ffff80008a629a3c x15: 0000000000000001
    x14: 1fffe00036837a32 x13: 0000000000000000 x12: 0000000000000000
    x11: 0000000000000201 x10: 0000000000000000 x9 : cb50b496c519aa00
    x8 : cb50b496c519aa00 x7 : 0000000000000001 x6 : 0000000000000001
    x5 : ffff800096a063b8 x4 : ffff80008e280f80 x3 : ffff8000805ad11c
    x2 : 0000000000000001 x1 : 0000000100000201 x0 : 0000000000000086
    Call trace:
    skb_panic net/core/skbuff.c:188 [inline]
    skb_under_panic+0x13c/0x140 net/core/skbuff.c:202
    skb_push+0xf0/0x108 net/core/skbuff.c:2446
    ip6gre_header+0xbc/0x738 net/ipv6/ip6_gre.c:1384
    dev_hard_header include/linux/netdevice.h:3136 [inline]
    lapbeth_data_transmit+0x1c4/0x298 drivers/net/wan/lapbether.c:257
    lapb_data_transmit+0x8c/0xb0 net/lapb/lapb_iface.c:447
    lapb_transmit_buffer+0x178/0x204 net/lapb/lapb_out.c:149
    lapb_send_control+0x220/0x320 net/lapb/lapb_subr.c:251
    __lapb_disconnect_request+0x9c/0x17c net/lapb/lapb_iface.c:326
    lapb_device_event+0x288/0x4e0 net/lapb/lapb_iface.c:492
    notifier_call_chain+0x1a4/0x510 kernel/notifier.c:93
    raw_notifier_call_chain+0x3c/0x50 kernel/notifier.c:461
    call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
    call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
    call_netdevice_notifiers net/core/dev.c:2022 [inline]
    __dev_close_many+0x1b8/0x3c4 net/core/dev.c:1508
    dev_close_many+0x1e0/0x470 net/core/dev.c:1559
    dev_close+0x174/0x250 net/core/dev.c:1585
    lapbeth_device_event+0x2e4/0x958 drivers/net/wan/lapbether.c:466
    notifier_call_chain+0x1a4/0x510 kernel/notifier.c:93
    raw_notifier_call_chain+0x3c/0x50 kernel/notifier.c:461
    call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
    call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
    call_netdevice_notifiers net/core/dev.c:2022 [inline]
    __dev_close_many+0x1b8/0x3c4 net/core/dev.c:1508
    dev_close_many+0x1e0/0x470 net/core/dev.c:1559
    dev_close+0x174/0x250 net/core/dev.c:1585
    bond_enslave+0x2298/0x30cc drivers/net/bonding/bond_main.c:2332
    bond_do_ioctl+0x268/0xc64 drivers/net/bonding/bond_main.c:4539
    dev_ifsioc+0x754/0x9ac
    dev_ioctl+0x4d8/0xd34 net/core/dev_ioctl.c:786
    sock_do_ioctl+0x1d4/0x2d0 net/socket.c:1217
    sock_ioctl+0x4e8/0x834 net/socket.c:1322
    vfs_ioctl fs/ioctl.c:51 [inline]
    __do_sys_ioctl fs/ioctl.c:871 [inline]
    __se_sys_ioctl fs/ioctl.c:857 [inline]
    __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:857
    __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
    invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
    el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
    do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
    el0_svc+0x58/0x16c arch/arm64/kernel/entry-common.c:678
    el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
    el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
    Code: aa1803e6 aa1903e7 a90023f5 94785b8b (d4210000)
    
    Fixes: 872254dd6b1f ("net/bonding: Enable bonding to enslave non ARPHRD_ETHER")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
    Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
    Link: https://lore.kernel.org/r/20231109180102.4085183-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c86085585de15a2e73697e6adfc86b5baa891fff
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Nov 9 17:48:59 2023 +0000

    ptp: annotate data-race around q->head and q->tail
    
    [ Upstream commit 73bde5a3294853947252cd9092a3517c7cb0cd2d ]
    
    As I was working on a syzbot report, I found that KCSAN would
    probably complain that reading q->head or q->tail without
    barriers could lead to invalid results.
    
    Add corresponding READ_ONCE() and WRITE_ONCE() to avoid
    load-store tearing.
    
    Fixes: d94ba80ebbea ("ptp: Added a brand new class driver for ptp clocks.")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Richard Cochran <richardcochran@gmail.com>
    Link: https://lore.kernel.org/r/20231109174859.3995880-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b80056bd75a16e4550873ecefe12bc8fd190b1cf
Author: Christoph Hellwig <hch@infradead.org>
Date:   Mon Nov 13 11:52:31 2023 +0800

    blk-mq: make sure active queue usage is held for bio_integrity_prep()
    
    [ Upstream commit b0077e269f6c152e807fdac90b58caf012cdbaab ]
    
    blk_integrity_unregister() can come if queue usage counter isn't held
    for one bio with integrity prepared, so this request may be completed with
    calling profile->complete_fn, then kernel panic.
    
    Another constraint is that bio_integrity_prep() needs to be called
    before bio merge.
    
    Fix the issue by:
    
    - call bio_integrity_prep() with one queue usage counter grabbed reliably
    
    - call bio_integrity_prep() before bio merge
    
    Fixes: 900e080752025f00 ("block: move queue enter logic into blk_mq_submit_bio()")
    Reported-by: Yi Zhang <yi.zhang@redhat.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Tested-by: Yi Zhang <yi.zhang@redhat.com>
    Link: https://lore.kernel.org/r/20231113035231.2708053-1-ming.lei@redhat.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a7762cb2904603bf5e3001fa29f3ed6713b82daf
Author: Juergen Gross <jgross@suse.com>
Date:   Mon Sep 25 17:54:13 2023 +0200

    xen/events: fix delayed eoi list handling
    
    [ Upstream commit 47d970204054f859f35a2237baa75c2d84fcf436 ]
    
    When delaying eoi handling of events, the related elements are queued
    into the percpu lateeoi list. In case the list isn't empty, the
    elements should be sorted by the time when eoi handling is to happen.
    
    Unfortunately a new element will never be queued at the start of the
    list, even if it has a handling time lower than all other list
    elements.
    
    Fix that by handling that case the same way as for an empty list.
    
    Fixes: e99502f76271 ("xen/events: defer eoi in case of excessive number of events")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0735ea00b2711f49bc79d5705b2e1e006a32a056
Author: Willem de Bruijn <willemb@google.com>
Date:   Sun Nov 12 22:16:32 2023 -0500

    ppp: limit MRU to 64K
    
    [ Upstream commit c0a2a1b0d631fc460d830f52d06211838874d655 ]
    
    ppp_sync_ioctl allows setting device MRU, but does not sanity check
    this input.
    
    Limit to a sane upper bound of 64KB.
    
    No implementation I could find generates larger than 64KB frames.
    RFC 2823 mentions an upper bound of PPP over SDL of 64KB based on the
    16-bit length field. Other protocols will be smaller, such as PPPoE
    (9KB jumbo frame) and PPPoA (18190 maximum CPCS-SDU size, RFC 2364).
    PPTP and L2TP encapsulate in IP.
    
    Syzbot managed to trigger alloc warning in __alloc_pages:
    
            if (WARN_ON_ONCE_GFP(order > MAX_ORDER, gfp))
    
        WARNING: CPU: 1 PID: 37 at mm/page_alloc.c:4544 __alloc_pages+0x3ab/0x4a0 mm/page_alloc.c:4544
    
        __alloc_skb+0x12b/0x330 net/core/skbuff.c:651
        __netdev_alloc_skb+0x72/0x3f0 net/core/skbuff.c:715
        netdev_alloc_skb include/linux/skbuff.h:3225 [inline]
        dev_alloc_skb include/linux/skbuff.h:3238 [inline]
        ppp_sync_input drivers/net/ppp/ppp_synctty.c:669 [inline]
        ppp_sync_receive+0xff/0x680 drivers/net/ppp/ppp_synctty.c:334
        tty_ldisc_receive_buf+0x14c/0x180 drivers/tty/tty_buffer.c:390
        tty_port_default_receive_buf+0x70/0xb0 drivers/tty/tty_port.c:37
        receive_buf drivers/tty/tty_buffer.c:444 [inline]
        flush_to_ldisc+0x261/0x780 drivers/tty/tty_buffer.c:494
        process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
    
    With call
    
        ioctl$PPPIOCSMRU1(r1, 0x40047452, &(0x7f0000000100)=0x5e6417a8)
    
    Similar code exists in other drivers that implement ppp_channel_ops
    ioctl PPPIOCSMRU. Those might also be in scope. Notably excluded from
    this are pppol2tp_ioctl and pppoe_ioctl.
    
    This code goes back to the start of git history.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+6177e1f90d92583bcc58@syzkaller.appspotmail.com
    Signed-off-by: Willem de Bruijn <willemb@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2b0e99072654edd601d05c0061a20337af5008ba
Author: Sven Auhagen <sven.auhagen@voleatech.de>
Date:   Sat Nov 11 05:41:12 2023 +0100

    net: mvneta: fix calls to page_pool_get_stats
    
    [ Upstream commit ca8add922f9c7f6e2e3c71039da8e0dcc64b87ed ]
    
    Calling page_pool_get_stats in the mvneta driver without checks
    leads to kernel crashes.
    First the page pool is only available if the bm is not used.
    The page pool is also not allocated when the port is stopped.
    It can also be not allocated in case of errors.
    
    The current implementation leads to the following crash calling
    ethstats on a port that is down or when calling it at the wrong moment:
    
    ble to handle kernel NULL pointer dereference at virtual address 00000070
    [00000070] *pgd=00000000
    Internal error: Oops: 5 [#1] SMP ARM
    Hardware name: Marvell Armada 380/385 (Device Tree)
    PC is at page_pool_get_stats+0x18/0x1cc
    LR is at mvneta_ethtool_get_stats+0xa0/0xe0 [mvneta]
    pc : [<c0b413cc>]    lr : [<bf0a98d8>]    psr: a0000013
    sp : f1439d48  ip : f1439dc0  fp : 0000001d
    r10: 00000100  r9 : c4816b80  r8 : f0d75150
    r7 : bf0b400c  r6 : c238f000  r5 : 00000000  r4 : f1439d68
    r3 : c2091040  r2 : ffffffd8  r1 : f1439d68  r0 : 00000000
    Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
    Control: 10c5387d  Table: 066b004a  DAC: 00000051
    Register r0 information: NULL pointer
    Register r1 information: 2-page vmalloc region starting at 0xf1438000 allocated at kernel_clone+0x9c/0x390
    Register r2 information: non-paged memory
    Register r3 information: slab kmalloc-2k start c2091000 pointer offset 64 size 2048
    Register r4 information: 2-page vmalloc region starting at 0xf1438000 allocated at kernel_clone+0x9c/0x390
    Register r5 information: NULL pointer
    Register r6 information: slab kmalloc-cg-4k start c238f000 pointer offset 0 size 4096
    Register r7 information: 15-page vmalloc region starting at 0xbf0a8000 allocated at load_module+0xa30/0x219c
    Register r8 information: 1-page vmalloc region starting at 0xf0d75000 allocated at ethtool_get_stats+0x138/0x208
    Register r9 information: slab task_struct start c4816b80 pointer offset 0
    Register r10 information: non-paged memory
    Register r11 information: non-paged memory
    Register r12 information: 2-page vmalloc region starting at 0xf1438000 allocated at kernel_clone+0x9c/0x390
    Process snmpd (pid: 733, stack limit = 0x38de3a88)
    Stack: (0xf1439d48 to 0xf143a000)
    9d40:                   000000c0 00000001 c238f000 bf0b400c f0d75150 c4816b80
    9d60: 00000100 bf0a98d8 00000000 00000000 00000000 00000000 00000000 00000000
    9d80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    9da0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    9dc0: 00000dc0 5335509c 00000035 c238f000 bf0b2214 01067f50 f0d75000 c0b9b9c8
    9de0: 0000001d 00000035 c2212094 5335509c c4816b80 c238f000 c5ad6e00 01067f50
    9e00: c1b0be80 c4816b80 00014813 c0b9d7f0 00000000 00000000 0000001d 0000001d
    9e20: 00000000 00001200 00000000 00000000 c216ed90 c73943b8 00000000 00000000
    9e40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    9e60: 00000000 c0ad9034 00000000 00000000 00000000 00000000 00000000 00000000
    9e80: 00000000 00000000 00000000 5335509c c1b0be80 f1439ee4 00008946 c1b0be80
    9ea0: 01067f50 f1439ee3 00000000 00000046 b6d77ae0 c0b383f0 00008946 becc83e8
    9ec0: c1b0be80 00000051 0000000b c68ca480 c7172d00 c0ad8ff0 f1439ee3 cf600e40
    9ee0: 01600e40 32687465 00000000 00000000 00000000 01067f50 00000000 00000000
    9f00: 00000000 5335509c 00008946 00008946 00000000 c68ca480 becc83e8 c05e2de0
    9f20: f1439fb0 c03002f0 00000006 5ac3c35a c4816b80 00000006 b6d77ae0 c030caf0
    9f40: c4817350 00000014 f1439e1c 0000000c 00000000 00000051 01000000 00000014
    9f60: 00003fec f1439edc 00000001 c0372abc b6d77ae0 c0372abc cf600e40 5335509c
    9f80: c21e6800 01015c9c 0000000b 00008946 00000036 c03002f0 c4816b80 00000036
    9fa0: b6d77ae0 c03000c0 01015c9c 0000000b 0000000b 00008946 becc83e8 00000000
    9fc0: 01015c9c 0000000b 00008946 00000036 00000035 010678a0 b6d797ec b6d77ae0
    9fe0: b6dbf738 becc838c b6d186d7 b6baa858 40000030 0000000b 00000000 00000000
     page_pool_get_stats from mvneta_ethtool_get_stats+0xa0/0xe0 [mvneta]
     mvneta_ethtool_get_stats [mvneta] from ethtool_get_stats+0x154/0x208
     ethtool_get_stats from dev_ethtool+0xf48/0x2480
     dev_ethtool from dev_ioctl+0x538/0x63c
     dev_ioctl from sock_ioctl+0x49c/0x53c
     sock_ioctl from sys_ioctl+0x134/0xbd8
     sys_ioctl from ret_fast_syscall+0x0/0x1c
    Exception stack(0xf1439fa8 to 0xf1439ff0)
    9fa0:                   01015c9c 0000000b 0000000b 00008946 becc83e8 00000000
    9fc0: 01015c9c 0000000b 00008946 00000036 00000035 010678a0 b6d797ec b6d77ae0
    9fe0: b6dbf738 becc838c b6d186d7 b6baa858
    Code: e28dd004 e1a05000 e2514000 0a00006a (e5902070)
    
    This commit adds the proper checks before calling page_pool_get_stats.
    
    Fixes: b3fc79225f05 ("net: mvneta: add support for page_pool_get_stats")
    Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
    Reported-by: Paulo Da Silva <Paulo.DaSilva@kyberna.com>
    Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 927fff9bdbafa12b7e07d6538bfb0bb087c5f83e
Author: Shigeru Yoshida <syoshida@redhat.com>
Date:   Sat Nov 11 01:39:47 2023 +0900

    tipc: Fix kernel-infoleak due to uninitialized TLV value
    
    [ Upstream commit fb317eb23b5ee4c37b0656a9a52a3db58d9dd072 ]
    
    KMSAN reported the following kernel-infoleak issue:
    
    =====================================================
    BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
    BUG: KMSAN: kernel-infoleak in copy_to_user_iter lib/iov_iter.c:24 [inline]
    BUG: KMSAN: kernel-infoleak in iterate_ubuf include/linux/iov_iter.h:29 [inline]
    BUG: KMSAN: kernel-infoleak in iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
    BUG: KMSAN: kernel-infoleak in iterate_and_advance include/linux/iov_iter.h:271 [inline]
    BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x4ec/0x2bc0 lib/iov_iter.c:186
     instrument_copy_to_user include/linux/instrumented.h:114 [inline]
     copy_to_user_iter lib/iov_iter.c:24 [inline]
     iterate_ubuf include/linux/iov_iter.h:29 [inline]
     iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
     iterate_and_advance include/linux/iov_iter.h:271 [inline]
     _copy_to_iter+0x4ec/0x2bc0 lib/iov_iter.c:186
     copy_to_iter include/linux/uio.h:197 [inline]
     simple_copy_to_iter net/core/datagram.c:532 [inline]
     __skb_datagram_iter.5+0x148/0xe30 net/core/datagram.c:420
     skb_copy_datagram_iter+0x52/0x210 net/core/datagram.c:546
     skb_copy_datagram_msg include/linux/skbuff.h:3960 [inline]
     netlink_recvmsg+0x43d/0x1630 net/netlink/af_netlink.c:1967
     sock_recvmsg_nosec net/socket.c:1044 [inline]
     sock_recvmsg net/socket.c:1066 [inline]
     __sys_recvfrom+0x476/0x860 net/socket.c:2246
     __do_sys_recvfrom net/socket.c:2264 [inline]
     __se_sys_recvfrom net/socket.c:2260 [inline]
     __x64_sys_recvfrom+0x130/0x200 net/socket.c:2260
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
     entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Uninit was created at:
     slab_post_alloc_hook+0x103/0x9e0 mm/slab.h:768
     slab_alloc_node mm/slub.c:3478 [inline]
     kmem_cache_alloc_node+0x5f7/0xb50 mm/slub.c:3523
     kmalloc_reserve+0x13c/0x4a0 net/core/skbuff.c:560
     __alloc_skb+0x2fd/0x770 net/core/skbuff.c:651
     alloc_skb include/linux/skbuff.h:1286 [inline]
     tipc_tlv_alloc net/tipc/netlink_compat.c:156 [inline]
     tipc_get_err_tlv+0x90/0x5d0 net/tipc/netlink_compat.c:170
     tipc_nl_compat_recv+0x1042/0x15d0 net/tipc/netlink_compat.c:1324
     genl_family_rcv_msg_doit net/netlink/genetlink.c:972 [inline]
     genl_family_rcv_msg net/netlink/genetlink.c:1052 [inline]
     genl_rcv_msg+0x1220/0x12c0 net/netlink/genetlink.c:1067
     netlink_rcv_skb+0x4a4/0x6a0 net/netlink/af_netlink.c:2545
     genl_rcv+0x41/0x60 net/netlink/genetlink.c:1076
     netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
     netlink_unicast+0xf4b/0x1230 net/netlink/af_netlink.c:1368
     netlink_sendmsg+0x1242/0x1420 net/netlink/af_netlink.c:1910
     sock_sendmsg_nosec net/socket.c:730 [inline]
     __sock_sendmsg net/socket.c:745 [inline]
     ____sys_sendmsg+0x997/0xd60 net/socket.c:2588
     ___sys_sendmsg+0x271/0x3b0 net/socket.c:2642
     __sys_sendmsg net/socket.c:2671 [inline]
     __do_sys_sendmsg net/socket.c:2680 [inline]
     __se_sys_sendmsg net/socket.c:2678 [inline]
     __x64_sys_sendmsg+0x2fa/0x4a0 net/socket.c:2678
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
     entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Bytes 34-35 of 36 are uninitialized
    Memory access of size 36 starts at ffff88802d464a00
    Data copied to user address 00007ff55033c0a0
    
    CPU: 0 PID: 30322 Comm: syz-executor.0 Not tainted 6.6.0-14500-g1c41041124bd #10
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014
    =====================================================
    
    tipc_add_tlv() puts TLV descriptor and value onto `skb`. This size is
    calculated with TLV_SPACE() macro. It adds the size of struct tlv_desc and
    the length of TLV value passed as an argument, and aligns the result to a
    multiple of TLV_ALIGNTO, i.e., a multiple of 4 bytes.
    
    If the size of struct tlv_desc plus the length of TLV value is not aligned,
    the current implementation leaves the remaining bytes uninitialized. This
    is the cause of the above kernel-infoleak issue.
    
    This patch resolves this issue by clearing data up to an aligned size.
    
    Fixes: d0796d1ef63d ("tipc: convert legacy nl bearer dump to nl compat")
    Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d282ea0a7a00ca0c0c9cad8ce4a65078da50abb9
Author: Jijie Shao <shaojijie@huawei.com>
Date:   Fri Nov 10 17:37:13 2023 +0800

    net: hns3: fix VF wrong speed and duplex issue
    
    [ Upstream commit dff655e82faffc287d4a72a59f66fa120bf904e4 ]
    
    If PF is down, firmware will returns 10 Mbit/s rate and half-duplex mode
    when PF queries the port information from firmware.
    
    After imp reset command is executed, PF status changes to down,
    and PF will query link status and updates port information
    from firmware in a periodic scheduled task.
    
    However, there is a low probability that port information is updated
    when PF is down, and then PF link status changes to up.
    In this case, PF synchronizes incorrect rate and duplex mode to VF.
    
    This patch fixes it by updating port information before
    PF synchronizes the rate and duplex to the VF
    when PF changes to up.
    
    Fixes: 18b6e31f8bf4 ("net: hns3: PF add support for pushing link status to VFs")
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fbcad948c48625996d96c46fd81b9d2c586392c8
Author: Jijie Shao <shaojijie@huawei.com>
Date:   Fri Nov 10 17:37:12 2023 +0800

    net: hns3: fix VF reset fail issue
    
    [ Upstream commit 65e98bb56fa3ce2edb400930c05238c9b380500e ]
    
    Currently the reset process in hns3 and firmware watchdog init process is
    asynchronous. We think firmware watchdog initialization is completed
    before VF clear the interrupt source. However, firmware initialization
    may not complete early. So VF will receive multiple reset interrupts
    and fail to reset.
    
    So we add delay before VF interrupt source and 5 ms delay
    is enough to avoid second reset interrupt.
    
    Fixes: 427900d27d86 ("net: hns3: fix the timing issue of VF clearing interrupt sources")
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 43d85bdeac5acb831f5334a80404cfb46ca5870e
Author: Yonglong Liu <liuyonglong@huawei.com>
Date:   Fri Nov 10 17:37:11 2023 +0800

    net: hns3: fix variable may not initialized problem in hns3_init_mac_addr()
    
    [ Upstream commit dbd2f3b20c6ae425665b6975d766e3653d453e73 ]
    
    When a VF is calling hns3_init_mac_addr(), get_mac_addr() may
    return fail, then the value of mac_addr_temp is not initialized.
    
    Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
    Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f79d985c69060047426be68b7e4c1663d5d731b4
Author: Yonglong Liu <liuyonglong@huawei.com>
Date:   Fri Nov 10 17:37:10 2023 +0800

    net: hns3: fix out-of-bounds access may occur when coalesce info is read via debugfs
    
    [ Upstream commit 53aba458f23846112c0d44239580ff59bc5c36c3 ]
    
    The hns3 driver define an array of string to show the coalesce
    info, but if the kernel adds a new mode or a new state,
    out-of-bounds access may occur when coalesce info is read via
    debugfs, this patch fix the problem.
    
    Fixes: c99fead7cb07 ("net: hns3: add debugfs support for interrupt coalesce")
    Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ab31012867f28f9fb3fe6646b0943099b31163bd
Author: Jian Shen <shenjian15@huawei.com>
Date:   Fri Nov 10 17:37:09 2023 +0800

    net: hns3: fix incorrect capability bit display for copper port
    
    [ Upstream commit 75b247b57d8b71bcb679e4cb37d0db104848806c ]
    
    Currently, the FEC capability bit is default set for device version V2.
    It's incorrect for the copper port. Eventhough it doesn't make the nic
    work abnormal, but the capability information display in debugfs may
    confuse user. So clear it when driver get the port type inforamtion.
    
    Fixes: 433ccce83504 ("net: hns3: use FEC capability queried from firmware")
    Signed-off-by: Jian Shen <shenjian15@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fc6df8e99b38154ebb87a014286acd771ef6bcfe
Author: Yonglong Liu <liuyonglong@huawei.com>
Date:   Fri Nov 10 17:37:08 2023 +0800

    net: hns3: add barrier in vf mailbox reply process
    
    [ Upstream commit ac92c0a9a0603fb448e60f38e63302e4eebb8035 ]
    
    In hclgevf_mbx_handler() and hclgevf_get_mbx_resp() functions,
    there is a typical store-store and load-load scenario between
    received_resp and additional_info. This patch adds barrier
    to fix the problem.
    
    Fixes: 4671042f1ef0 ("net: hns3: add match_id to check mailbox response from PF to VF")
    Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 914424419264c667cbebf68eb00cc7e4598894c4
Author: Jian Shen <shenjian15@huawei.com>
Date:   Fri Nov 10 17:37:07 2023 +0800

    net: hns3: fix add VLAN fail issue
    
    [ Upstream commit 472a2ff63efb30234cbf6b2cdaf8117f21b4f8bc ]
    
    The hclge_sync_vlan_filter is called in periodic task,
    trying to remove VLAN from vlan_del_fail_bmap. It can
    be concurrence with VLAN adding operation from user.
    So once user failed to delete a VLAN id, and add it
    again soon, it may be removed by the periodic task,
    which may cause the software configuration being
    inconsistent with hardware. So add mutex handling
    to avoid this.
    
         user                        hns3 driver
    
                                               periodic task
                                                    │
      add vlan 10 ───── hns3_vlan_rx_add_vid        │
           │             (suppose success)          │
           │                                        │
      del vlan 10 ─────  hns3_vlan_rx_kill_vid      │
           │           (suppose fail,add to         │
           │             vlan_del_fail_bmap)        │
           │                                        │
      add vlan 10 ───── hns3_vlan_rx_add_vid        │
                         (suppose success)          │
                                           foreach vlan_del_fail_bmp
                                                del vlan 10
    
    Fixes: fe4144d47eef ("net: hns3: sync VLAN filter entries when kill VLAN ID failed")
    Signed-off-by: Jian Shen <shenjian15@huawei.com>
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1be00f836478b6f962605cc03006c3d0140541b0
Author: Juergen Gross <jgross@suse.com>
Date:   Tue Oct 24 13:51:36 2023 +0200

    xen/events: avoid using info_for_irq() in xen_send_IPI_one()
    
    [ Upstream commit e64e7c74b99ec9e439abca75f522f4b98f220bd1 ]
    
    xen_send_IPI_one() is being used by cpuhp_report_idle_dead() after
    it calls rcu_report_dead(), meaning that any RCU usage by
    xen_send_IPI_one() is a bad idea.
    
    Unfortunately xen_send_IPI_one() is using notify_remote_via_irq()
    today, which is using irq_get_chip_data() via info_for_irq(). And
    irq_get_chip_data() in turn is using a maple-tree lookup requiring
    RCU.
    
    Avoid this problem by caching the ipi event channels in another
    percpu variable, allowing the use notify_remote_via_evtchn() in
    xen_send_IPI_one().
    
    Fixes: 721255b9826b ("genirq: Use a maple tree for interrupt descriptor management")
    Reported-by: David Woodhouse <dwmw@amazon.co.uk>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Tested-by: David Woodhouse <dwmw@amazon.co.uk>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 920114bf3d63de03d46dc7545257f49bf883c5e7
Author: Jan Kiszka <jan.kiszka@siemens.com>
Date:   Fri Nov 10 17:13:08 2023 +0100

    net: ti: icssg-prueth: Fix error cleanup on failing pruss_request_mem_region
    
    [ Upstream commit 2bd5b559a1f391f05927bbb0b31381fa71c61e26 ]
    
    We were just continuing in this case, surely not desired.
    
    Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
    Reviewed-by: Roger Quadros <rogerq@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 70151949c97e0e5cbf8d1327df3a71ef47b2d0ac
Author: Jan Kiszka <jan.kiszka@siemens.com>
Date:   Fri Nov 10 17:13:02 2023 +0100

    net: ti: icssg-prueth: Add missing icss_iep_put to error path
    
    [ Upstream commit e409d7346648c9acff84c3cc8d291767ee2d5326 ]
    
    Analogously to prueth_remove, just also taking care for NULL'ing the
    iep pointers.
    
    Fixes: 186734c15886 ("net: ti: icssg-prueth: add packet timestamping and ptp support")
    Fixes: 443a2367ba3c ("net: ti: icssg-prueth: am65x SR2.0 add 10M full duplex support")
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
    Reviewed-by: MD Danish Anwar <danishanwar@ti.com>
    Reviewed-by: Roger Quadros <rogerq@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 30007a74cb41d75ce926fcef52bbbd074e116336
Author: Shigeru Yoshida <syoshida@redhat.com>
Date:   Thu Nov 9 00:44:20 2023 +0900

    tty: Fix uninit-value access in ppp_sync_receive()
    
    [ Upstream commit 719639853d88071dfdfd8d9971eca9c283ff314c ]
    
    KMSAN reported the following uninit-value access issue:
    
    =====================================================
    BUG: KMSAN: uninit-value in ppp_sync_input drivers/net/ppp/ppp_synctty.c:690 [inline]
    BUG: KMSAN: uninit-value in ppp_sync_receive+0xdc9/0xe70 drivers/net/ppp/ppp_synctty.c:334
     ppp_sync_input drivers/net/ppp/ppp_synctty.c:690 [inline]
     ppp_sync_receive+0xdc9/0xe70 drivers/net/ppp/ppp_synctty.c:334
     tiocsti+0x328/0x450 drivers/tty/tty_io.c:2295
     tty_ioctl+0x808/0x1920 drivers/tty/tty_io.c:2694
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:871 [inline]
     __se_sys_ioctl+0x211/0x400 fs/ioctl.c:857
     __x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:857
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
     entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Uninit was created at:
     __alloc_pages+0x75d/0xe80 mm/page_alloc.c:4591
     __alloc_pages_node include/linux/gfp.h:238 [inline]
     alloc_pages_node include/linux/gfp.h:261 [inline]
     __page_frag_cache_refill+0x9a/0x2c0 mm/page_alloc.c:4691
     page_frag_alloc_align+0x91/0x5d0 mm/page_alloc.c:4722
     page_frag_alloc include/linux/gfp.h:322 [inline]
     __netdev_alloc_skb+0x215/0x6d0 net/core/skbuff.c:728
     netdev_alloc_skb include/linux/skbuff.h:3225 [inline]
     dev_alloc_skb include/linux/skbuff.h:3238 [inline]
     ppp_sync_input drivers/net/ppp/ppp_synctty.c:669 [inline]
     ppp_sync_receive+0x237/0xe70 drivers/net/ppp/ppp_synctty.c:334
     tiocsti+0x328/0x450 drivers/tty/tty_io.c:2295
     tty_ioctl+0x808/0x1920 drivers/tty/tty_io.c:2694
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:871 [inline]
     __se_sys_ioctl+0x211/0x400 fs/ioctl.c:857
     __x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:857
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
     entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    CPU: 0 PID: 12950 Comm: syz-executor.1 Not tainted 6.6.0-14500-g1c41041124bd #10
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014
    =====================================================
    
    ppp_sync_input() checks the first 2 bytes of the data are PPP_ALLSTATIONS
    and PPP_UI. However, if the data length is 1 and the first byte is
    PPP_ALLSTATIONS, an access to an uninitialized value occurs when checking
    PPP_UI. This patch resolves this issue by checking the data length.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 03cddc4df8c6be47fd27c8f8b87e5f9a989e1458
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Nov 9 15:22:41 2023 +0000

    ipvlan: add ipvlan_route_v6_outbound() helper
    
    [ Upstream commit 18f039428c7df183b09c69ebf10ffd4e521035d2 ]
    
    Inspired by syzbot reports using a stack of multiple ipvlan devices.
    
    Reduce stack size needed in ipvlan_process_v6_outbound() by moving
    the flowi6 struct used for the route lookup in an non inlined
    helper. ipvlan_route_v6_outbound() needs 120 bytes on the stack,
    immediately reclaimed.
    
    Also make sure ipvlan_process_v4_outbound() is not inlined.
    
    We might also have to lower MAX_NEST_DEV, because only syzbot uses
    setups with more than four stacked devices.
    
    BUG: TASK stack guard page was hit at ffffc9000e803ff8 (stack is ffffc9000e804000..ffffc9000e808000)
    stack guard page: 0000 [#1] SMP KASAN
    CPU: 0 PID: 13442 Comm: syz-executor.4 Not tainted 6.1.52-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
    RIP: 0010:kasan_check_range+0x4/0x2a0 mm/kasan/generic.c:188
    Code: 48 01 c6 48 89 c7 e8 db 4e c1 03 31 c0 5d c3 cc 0f 0b eb 02 0f 0b b8 ea ff ff ff 5d c3 cc 00 00 cc cc 00 00 cc cc 55 48 89 e5 <41> 57 41 56 41 55 41 54 53 b0 01 48 85 f6 0f 84 a4 01 00 00 48 89
    RSP: 0018:ffffc9000e804000 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff817e5bf2
    RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffff887c6568
    RBP: ffffc9000e804000 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: dffffc0000000001 R12: 1ffff92001d0080c
    R13: dffffc0000000000 R14: ffffffff87e6b100 R15: 0000000000000000
    FS: 00007fd0c55826c0(0000) GS:ffff8881f6800000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffc9000e803ff8 CR3: 0000000170ef7000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <#DF>
    </#DF>
    <TASK>
    [<ffffffff81f281d1>] __kasan_check_read+0x11/0x20 mm/kasan/shadow.c:31
    [<ffffffff817e5bf2>] instrument_atomic_read include/linux/instrumented.h:72 [inline]
    [<ffffffff817e5bf2>] _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
    [<ffffffff817e5bf2>] cpumask_test_cpu include/linux/cpumask.h:506 [inline]
    [<ffffffff817e5bf2>] cpu_online include/linux/cpumask.h:1092 [inline]
    [<ffffffff817e5bf2>] trace_lock_acquire include/trace/events/lock.h:24 [inline]
    [<ffffffff817e5bf2>] lock_acquire+0xe2/0x590 kernel/locking/lockdep.c:5632
    [<ffffffff8563221e>] rcu_lock_acquire+0x2e/0x40 include/linux/rcupdate.h:306
    [<ffffffff8561464d>] rcu_read_lock include/linux/rcupdate.h:747 [inline]
    [<ffffffff8561464d>] ip6_pol_route+0x15d/0x1440 net/ipv6/route.c:2221
    [<ffffffff85618120>] ip6_pol_route_output+0x50/0x80 net/ipv6/route.c:2606
    [<ffffffff856f65b5>] pol_lookup_func include/net/ip6_fib.h:584 [inline]
    [<ffffffff856f65b5>] fib6_rule_lookup+0x265/0x620 net/ipv6/fib6_rules.c:116
    [<ffffffff85618009>] ip6_route_output_flags_noref+0x2d9/0x3a0 net/ipv6/route.c:2638
    [<ffffffff8561821a>] ip6_route_output_flags+0xca/0x340 net/ipv6/route.c:2651
    [<ffffffff838bd5a3>] ip6_route_output include/net/ip6_route.h:100 [inline]
    [<ffffffff838bd5a3>] ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:473 [inline]
    [<ffffffff838bd5a3>] ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:529 [inline]
    [<ffffffff838bd5a3>] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
    [<ffffffff838bd5a3>] ipvlan_queue_xmit+0xc33/0x1be0 drivers/net/ipvlan/ipvlan_core.c:677
    [<ffffffff838c2909>] ipvlan_start_xmit+0x49/0x100 drivers/net/ipvlan/ipvlan_main.c:229
    [<ffffffff84d03900>] netdev_start_xmit include/linux/netdevice.h:4966 [inline]
    [<ffffffff84d03900>] xmit_one net/core/dev.c:3644 [inline]
    [<ffffffff84d03900>] dev_hard_start_xmit+0x320/0x980 net/core/dev.c:3660
    [<ffffffff84d080e2>] __dev_queue_xmit+0x16b2/0x3370 net/core/dev.c:4324
    [<ffffffff855ce4cd>] dev_queue_xmit include/linux/netdevice.h:3067 [inline]
    [<ffffffff855ce4cd>] neigh_hh_output include/net/neighbour.h:529 [inline]
    [<ffffffff855ce4cd>] neigh_output include/net/neighbour.h:543 [inline]
    [<ffffffff855ce4cd>] ip6_finish_output2+0x160d/0x1ae0 net/ipv6/ip6_output.c:139
    [<ffffffff855b8616>] __ip6_finish_output net/ipv6/ip6_output.c:200 [inline]
    [<ffffffff855b8616>] ip6_finish_output+0x6c6/0xb10 net/ipv6/ip6_output.c:211
    [<ffffffff855b7e3c>] NF_HOOK_COND include/linux/netfilter.h:298 [inline]
    [<ffffffff855b7e3c>] ip6_output+0x2bc/0x3d0 net/ipv6/ip6_output.c:232
    [<ffffffff8575d27f>] dst_output include/net/dst.h:444 [inline]
    [<ffffffff8575d27f>] ip6_local_out+0x10f/0x140 net/ipv6/output_core.c:161
    [<ffffffff838bdae4>] ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:483 [inline]
    [<ffffffff838bdae4>] ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:529 [inline]
    [<ffffffff838bdae4>] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
    [<ffffffff838bdae4>] ipvlan_queue_xmit+0x1174/0x1be0 drivers/net/ipvlan/ipvlan_core.c:677
    [<ffffffff838c2909>] ipvlan_start_xmit+0x49/0x100 drivers/net/ipvlan/ipvlan_main.c:229
    [<ffffffff84d03900>] netdev_start_xmit include/linux/netdevice.h:4966 [inline]
    [<ffffffff84d03900>] xmit_one net/core/dev.c:3644 [inline]
    [<ffffffff84d03900>] dev_hard_start_xmit+0x320/0x980 net/core/dev.c:3660
    [<ffffffff84d080e2>] __dev_queue_xmit+0x16b2/0x3370 net/core/dev.c:4324
    [<ffffffff855ce4cd>] dev_queue_xmit include/linux/netdevice.h:3067 [inline]
    [<ffffffff855ce4cd>] neigh_hh_output include/net/neighbour.h:529 [inline]
    [<ffffffff855ce4cd>] neigh_output include/net/neighbour.h:543 [inline]
    [<ffffffff855ce4cd>] ip6_finish_output2+0x160d/0x1ae0 net/ipv6/ip6_output.c:139
    [<ffffffff855b8616>] __ip6_finish_output net/ipv6/ip6_output.c:200 [inline]
    [<ffffffff855b8616>] ip6_finish_output+0x6c6/0xb10 net/ipv6/ip6_output.c:211
    [<ffffffff855b7e3c>] NF_HOOK_COND include/linux/netfilter.h:298 [inline]
    [<ffffffff855b7e3c>] ip6_output+0x2bc/0x3d0 net/ipv6/ip6_output.c:232
    [<ffffffff8575d27f>] dst_output include/net/dst.h:444 [inline]
    [<ffffffff8575d27f>] ip6_local_out+0x10f/0x140 net/ipv6/output_core.c:161
    [<ffffffff838bdae4>] ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:483 [inline]
    [<ffffffff838bdae4>] ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:529 [inline]
    [<ffffffff838bdae4>] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
    [<ffffffff838bdae4>] ipvlan_queue_xmit+0x1174/0x1be0 drivers/net/ipvlan/ipvlan_core.c:677
    [<ffffffff838c2909>] ipvlan_start_xmit+0x49/0x100 drivers/net/ipvlan/ipvlan_main.c:229
    [<ffffffff84d03900>] netdev_start_xmit include/linux/netdevice.h:4966 [inline]
    [<ffffffff84d03900>] xmit_one net/core/dev.c:3644 [inline]
    [<ffffffff84d03900>] dev_hard_start_xmit+0x320/0x980 net/core/dev.c:3660
    [<ffffffff84d080e2>] __dev_queue_xmit+0x16b2/0x3370 net/core/dev.c:4324
    [<ffffffff855ce4cd>] dev_queue_xmit include/linux/netdevice.h:3067 [inline]
    [<ffffffff855ce4cd>] neigh_hh_output include/net/neighbour.h:529 [inline]
    [<ffffffff855ce4cd>] neigh_output include/net/neighbour.h:543 [inline]
    [<ffffffff855ce4cd>] ip6_finish_output2+0x160d/0x1ae0 net/ipv6/ip6_output.c:139
    [<ffffffff855b8616>] __ip6_finish_output net/ipv6/ip6_output.c:200 [inline]
    [<ffffffff855b8616>] ip6_finish_output+0x6c6/0xb10 net/ipv6/ip6_output.c:211
    [<ffffffff855b7e3c>] NF_HOOK_COND include/linux/netfilter.h:298 [inline]
    [<ffffffff855b7e3c>] ip6_output+0x2bc/0x3d0 net/ipv6/ip6_output.c:232
    [<ffffffff8575d27f>] dst_output include/net/dst.h:444 [inline]
    [<ffffffff8575d27f>] ip6_local_out+0x10f/0x140 net/ipv6/output_core.c:161
    [<ffffffff838bdae4>] ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:483 [inline]
    [<ffffffff838bdae4>] ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:529 [inline]
    [<ffffffff838bdae4>] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
    [<ffffffff838bdae4>] ipvlan_queue_xmit+0x1174/0x1be0 drivers/net/ipvlan/ipvlan_core.c:677
    [<ffffffff838c2909>] ipvlan_start_xmit+0x49/0x100 drivers/net/ipvlan/ipvlan_main.c:229
    [<ffffffff84d03900>] netdev_start_xmit include/linux/netdevice.h:4966 [inline]
    [<ffffffff84d03900>] xmit_one net/core/dev.c:3644 [inline]
    [<ffffffff84d03900>] dev_hard_start_xmit+0x320/0x980 net/core/dev.c:3660
    [<ffffffff84d080e2>] __dev_queue_xmit+0x16b2/0x3370 net/core/dev.c:4324
    [<ffffffff855ce4cd>] dev_queue_xmit include/linux/netdevice.h:3067 [inline]
    [<ffffffff855ce4cd>] neigh_hh_output include/net/neighbour.h:529 [inline]
    [<ffffffff855ce4cd>] neigh_output include/net/neighbour.h:543 [inline]
    [<ffffffff855ce4cd>] ip6_finish_output2+0x160d/0x1ae0 net/ipv6/ip6_output.c:139
    [<ffffffff855b8616>] __ip6_finish_output net/ipv6/ip6_output.c:200 [inline]
    [<ffffffff855b8616>] ip6_finish_output+0x6c6/0xb10 net/ipv6/ip6_output.c:211
    [<ffffffff855b7e3c>] NF_HOOK_COND include/linux/netfilter.h:298 [inline]
    [<ffffffff855b7e3c>] ip6_output+0x2bc/0x3d0 net/ipv6/ip6_output.c:232
    [<ffffffff8575d27f>] dst_output include/net/dst.h:444 [inline]
    [<ffffffff8575d27f>] ip6_local_out+0x10f/0x140 net/ipv6/output_core.c:161
    [<ffffffff838bdae4>] ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:483 [inline]
    [<ffffffff838bdae4>] ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:529 [inline]
    [<ffffffff838bdae4>] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
    [<ffffffff838bdae4>] ipvlan_queue_xmit+0x1174/0x1be0 drivers/net/ipvlan/ipvlan_core.c:677
    [<ffffffff838c2909>] ipvlan_start_xmit+0x49/0x100 drivers/net/ipvlan/ipvlan_main.c:229
    [<ffffffff84d03900>] netdev_start_xmit include/linux/netdevice.h:4966 [inline]
    [<ffffffff84d03900>] xmit_one net/core/dev.c:3644 [inline]
    [<ffffffff84d03900>] dev_hard_start_xmit+0x320/0x980 net/core/dev.c:3660
    [<ffffffff84d080e2>] __dev_queue_xmit+0x16b2/0x3370 net/core/dev.c:4324
    [<ffffffff84d4a65e>] dev_queue_xmit include/linux/netdevice.h:3067 [inline]
    [<ffffffff84d4a65e>] neigh_resolve_output+0x64e/0x750 net/core/neighbour.c:1560
    [<ffffffff855ce503>] neigh_output include/net/neighbour.h:545 [inline]
    [<ffffffff855ce503>] ip6_finish_output2+0x1643/0x1ae0 net/ipv6/ip6_output.c:139
    [<ffffffff855b8616>] __ip6_finish_output net/ipv6/ip6_output.c:200 [inline]
    [<ffffffff855b8616>] ip6_finish_output+0x6c6/0xb10 net/ipv6/ip6_output.c:211
    [<ffffffff855b7e3c>] NF_HOOK_COND include/linux/netfilter.h:298 [inline]
    [<ffffffff855b7e3c>] ip6_output+0x2bc/0x3d0 net/ipv6/ip6_output.c:232
    [<ffffffff855b9ce4>] dst_output include/net/dst.h:444 [inline]
    [<ffffffff855b9ce4>] NF_HOOK include/linux/netfilter.h:309 [inline]
    [<ffffffff855b9ce4>] ip6_xmit+0x11a4/0x1b20 net/ipv6/ip6_output.c:352
    [<ffffffff8597984e>] sctp_v6_xmit+0x9ae/0x1230 net/sctp/ipv6.c:250
    [<ffffffff8594623e>] sctp_packet_transmit+0x25de/0x2bc0 net/sctp/output.c:653
    [<ffffffff858f5142>] sctp_packet_singleton+0x202/0x310 net/sctp/outqueue.c:783
    [<ffffffff858ea411>] sctp_outq_flush_ctrl net/sctp/outqueue.c:914 [inline]
    [<ffffffff858ea411>] sctp_outq_flush+0x661/0x3d40 net/sctp/outqueue.c:1212
    [<ffffffff858f02f9>] sctp_outq_uncork+0x79/0xb0 net/sctp/outqueue.c:764
    [<ffffffff8589f060>] sctp_side_effects net/sctp/sm_sideeffect.c:1199 [inline]
    [<ffffffff8589f060>] sctp_do_sm+0x55c0/0x5c30 net/sctp/sm_sideeffect.c:1170
    [<ffffffff85941567>] sctp_primitive_ASSOCIATE+0x97/0xc0 net/sctp/primitive.c:73
    [<ffffffff859408b2>] sctp_sendmsg_to_asoc+0xf62/0x17b0 net/sctp/socket.c:1839
    [<ffffffff85910b5e>] sctp_sendmsg+0x212e/0x33b0 net/sctp/socket.c:2029
    [<ffffffff8544d559>] inet_sendmsg+0x149/0x310 net/ipv4/af_inet.c:849
    [<ffffffff84c6c4d2>] sock_sendmsg_nosec net/socket.c:716 [inline]
    [<ffffffff84c6c4d2>] sock_sendmsg net/socket.c:736 [inline]
    [<ffffffff84c6c4d2>] ____sys_sendmsg+0x572/0x8c0 net/socket.c:2504
    [<ffffffff84c6ca91>] ___sys_sendmsg net/socket.c:2558 [inline]
    [<ffffffff84c6ca91>] __sys_sendmsg+0x271/0x360 net/socket.c:2587
    [<ffffffff84c6cbff>] __do_sys_sendmsg net/socket.c:2596 [inline]
    [<ffffffff84c6cbff>] __se_sys_sendmsg net/socket.c:2594 [inline]
    [<ffffffff84c6cbff>] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2594
    [<ffffffff85b32553>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
    [<ffffffff85b32553>] do_syscall_64+0x53/0x80 arch/x86/entry/common.c:84
    [<ffffffff85c00087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Mahesh Bandewar <maheshb@google.com>
    Cc: Willem de Bruijn <willemb@google.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cf0453f3b42a966394738e285707cba80d3741ce
Author: Stanislav Fomichev <sdf@google.com>
Date:   Wed Nov 8 13:13:25 2023 -0800

    net: set SOCK_RCU_FREE before inserting socket into hashtable
    
    [ Upstream commit 871019b22d1bcc9fab2d1feba1b9a564acbb6e99 ]
    
    We've started to see the following kernel traces:
    
     WARNING: CPU: 83 PID: 0 at net/core/filter.c:6641 sk_lookup+0x1bd/0x1d0
    
     Call Trace:
      <IRQ>
      __bpf_skc_lookup+0x10d/0x120
      bpf_sk_lookup+0x48/0xd0
      bpf_sk_lookup_tcp+0x19/0x20
      bpf_prog_<redacted>+0x37c/0x16a3
      cls_bpf_classify+0x205/0x2e0
      tcf_classify+0x92/0x160
      __netif_receive_skb_core+0xe52/0xf10
      __netif_receive_skb_list_core+0x96/0x2b0
      napi_complete_done+0x7b5/0xb70
      <redacted>_poll+0x94/0xb0
      net_rx_action+0x163/0x1d70
      __do_softirq+0xdc/0x32e
      asm_call_irq_on_stack+0x12/0x20
      </IRQ>
      do_softirq_own_stack+0x36/0x50
      do_softirq+0x44/0x70
    
    __inet_hash can race with lockless (rcu) readers on the other cpus:
    
      __inet_hash
        __sk_nulls_add_node_rcu
        <- (bpf triggers here)
        sock_set_flag(SOCK_RCU_FREE)
    
    Let's move the SOCK_RCU_FREE part up a bit, before we are inserting
    the socket into hashtables. Note, that the race is really harmless;
    the bpf callers are handling this situation (where listener socket
    doesn't have SOCK_RCU_FREE set) correctly, so the only
    annoyance is a WARN_ONCE.
    
    More details from Eric regarding SOCK_RCU_FREE timeline:
    
    Commit 3b24d854cb35 ("tcp/dccp: do not touch listener sk_refcnt under
    synflood") added SOCK_RCU_FREE. At that time, the precise location of
    sock_set_flag(sk, SOCK_RCU_FREE) did not matter, because the thread calling
    __inet_hash() owns a reference on sk. SOCK_RCU_FREE was only tested
    at dismantle time.
    
    Commit 6acc9b432e67 ("bpf: Add helper to retrieve socket in BPF")
    started checking SOCK_RCU_FREE _after_ the lookup to infer whether
    the refcount has been taken care of.
    
    Fixes: 6acc9b432e67 ("bpf: Add helper to retrieve socket in BPF")
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Stanislav Fomichev <sdf@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>

commit 9549f53abc1fa1048f31fc279e109e430ef3324c
Author: Andrii Nakryiko <andrii@kernel.org>
Date:   Thu Nov 9 22:14:10 2023 -0800

    bpf: fix control-flow graph checking in privileged mode
    
    [ Upstream commit 10e14e9652bf9e8104151bfd9200433083deae3d ]
    
    When BPF program is verified in privileged mode, BPF verifier allows
    bounded loops. This means that from CFG point of view there are
    definitely some back-edges. Original commit adjusted check_cfg() logic
    to not detect back-edges in control flow graph if they are resulting
    from conditional jumps, which the idea that subsequent full BPF
    verification process will determine whether such loops are bounded or
    not, and either accept or reject the BPF program. At least that's my
    reading of the intent.
    
    Unfortunately, the implementation of this idea doesn't work correctly in
    all possible situations. Conditional jump might not result in immediate
    back-edge, but just a few unconditional instructions later we can arrive
    at back-edge. In such situations check_cfg() would reject BPF program
    even in privileged mode, despite it might be bounded loop. Next patch
    adds one simple program demonstrating such scenario.
    
    To keep things simple, instead of trying to detect back edges in
    privileged mode, just assume every back edge is valid and let subsequent
    BPF verification prove or reject bounded loops.
    
    Note a few test changes. For unknown reason, we have a few tests that
    are specified to detect a back-edge in a privileged mode, but looking at
    their code it seems like the right outcome is passing check_cfg() and
    letting subsequent verification to make a decision about bounded or not
    bounded looping.
    
    Bounded recursion case is also interesting. The example should pass, as
    recursion is limited to just a few levels and so we never reach maximum
    number of nested frames and never exhaust maximum stack depth. But the
    way that max stack depth logic works today it falsely detects this as
    exceeding max nested frame count. This patch series doesn't attempt to
    fix this orthogonal problem, so we just adjust expected verifier failure.
    
    Suggested-by: Alexei Starovoitov <ast@kernel.org>
    Fixes: 2589726d12a1 ("bpf: introduce bounded loops")
    Reported-by: Hao Sun <sunhao.th@gmail.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20231110061412.2995786-1-andrii@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2595f4eb3461fc72be1df129e4f71addc92f785f
Author: Andrii Nakryiko <andrii@kernel.org>
Date:   Thu Nov 9 16:26:37 2023 -0800

    bpf: fix precision backtracking instruction iteration
    
    [ Upstream commit 4bb7ea946a370707315ab774432963ce47291946 ]
    
    Fix an edge case in __mark_chain_precision() which prematurely stops
    backtracking instructions in a state if it happens that state's first
    and last instruction indexes are the same. This situations doesn't
    necessarily mean that there were no instructions simulated in a state,
    but rather that we starting from the instruction, jumped around a bit,
    and then ended up at the same instruction before checkpointing or
    marking precision.
    
    To distinguish between these two possible situations, we need to consult
    jump history. If it's empty or contain a single record "bridging" parent
    state and first instruction of processed state, then we indeed
    backtracked all instructions in this state. But if history is not empty,
    we are definitely not done yet.
    
    Move this logic inside get_prev_insn_idx() to contain it more nicely.
    Use -ENOENT return code to denote "we are out of instructions"
    situation.
    
    This bug was exposed by verifier_loop1.c's bounded_recursion subtest, once
    the next fix in this patch set is applied.
    
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Fixes: b5dc0163d8fd ("bpf: precise scalar_value tracking")
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20231110002638.4168352-3-andrii@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3c49b49d794b64000ef5f8d7364af19cb2876adf
Author: Andrii Nakryiko <andrii@kernel.org>
Date:   Thu Nov 9 16:26:36 2023 -0800

    bpf: handle ldimm64 properly in check_cfg()
    
    [ Upstream commit 3feb263bb516ee7e1da0acd22b15afbb9a7daa19 ]
    
    ldimm64 instructions are 16-byte long, and so have to be handled
    appropriately in check_cfg(), just like the rest of BPF verifier does.
    
    This has implications in three places:
      - when determining next instruction for non-jump instructions;
      - when determining next instruction for callback address ldimm64
        instructions (in visit_func_call_insn());
      - when checking for unreachable instructions, where second half of
        ldimm64 is expected to be unreachable;
    
    We take this also as an opportunity to report jump into the middle of
    ldimm64. And adjust few test_verifier tests accordingly.
    
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Reported-by: Hao Sun <sunhao.th@gmail.com>
    Fixes: 475fb78fbf48 ("bpf: verifier (add branch/goto checks)")
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20231110002638.4168352-2-andrii@kernel.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2e8b4e0992e16d7967095773040cd9919171d8db
Author: Kees Cook <keescook@chromium.org>
Date:   Sat Nov 4 13:43:37 2023 -0700

    gcc-plugins: randstruct: Only warn about true flexible arrays
    
    [ Upstream commit 1ee60356c2dca938362528404af95b8ef3e49b6a ]
    
    The randstruct GCC plugin tried to discover "fake" flexible arrays
    to issue warnings about them in randomized structs. In the future
    LSM overhead reduction series, it would be legal to have a randomized
    struct with a 1-element array, and this should _not_ be treated as a
    flexible array, especially since commit df8fc4e934c1 ("kbuild: Enable
    -fstrict-flex-arrays=3"). Disable the 0-sized and 1-element array
    discovery logic in the plugin, but keep the "true" flexible array check.
    
    Cc: KP Singh <kpsingh@kernel.org>
    Cc: linux-hardening@vger.kernel.org
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202311021532.iBwuZUZ0-lkp@intel.com/
    Fixes: df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3")
    Reviewed-by: Bill Wendling <morbo@google.com>
    Acked-by: "Gustavo A. R. Silva" <gustavoars@kernel.org>
    Link: https://lore.kernel.org/r/20231104204334.work.160-kees@kernel.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bf04132cd64ccde4e9e9765d489c83fe83c09b7f
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Fri Oct 27 15:12:54 2023 +0300

    vhost-vdpa: fix use after free in vhost_vdpa_probe()
    
    [ Upstream commit e07754e0a1ea2d63fb29574253d1fd7405607343 ]
    
    The put_device() calls vhost_vdpa_release_dev() which calls
    ida_simple_remove() and frees "v".  So this call to
    ida_simple_remove() is a use after free and a double free.
    
    Fixes: ebe6a354fa7e ("vhost-vdpa: Call ida_simple_remove() when failed")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Message-Id: <cf53cb61-0699-4e36-a980-94fd4268ff00@moroto.mountain>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 941fcbb0f06c2df81f65e1c79c44a2667247ae09
Author: Stefano Garzarella <sgarzare@redhat.com>
Date:   Tue Oct 31 15:43:39 2023 +0100

    vdpa_sim_blk: allocate the buffer zeroed
    
    [ Upstream commit 0d82410252ea324f0064e75b9865bb74cccc1dda ]
    
    Deleting and recreating a device can lead to having the same
    content as the old device, so let's always allocate buffers
    completely zeroed out.
    
    Fixes: abebb16254b3 ("vdpa_sim_blk: support shared backend")
    Suggested-by: Qing Wang <qinwang@redhat.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20231031144339.121453-1-sgarzare@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Eugenio Pérez <eperezma@redhat.com>
    Acked-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b4ad5617278afd485bcfe3f402539b19d8b42000
Author: Christoph Hellwig <hch@lst.de>
Date:   Sat Oct 28 17:51:01 2023 +0200

    riscv: split cache ops out of dma-noncoherent.c
    
    [ Upstream commit 946bb33d330251966223f770f64885c79448b1a1 ]
    
    The cache ops are also used by the pmem code which is unconditionally
    built into the kernel.  Move them into a separate file that is built
    based on the correct config option.
    
    Fixes: fd962781270e ("riscv: RISCV_NONSTANDARD_CACHE_OPS shouldn't depend on RISCV_DMA_NONCOHERENT")
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
    Tested-by: Conor Dooley <conor.dooley@microchip.com>
    Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> #
    Link: https://lore.kernel.org/r/20231028155101.1039049-1-hch@lst.de
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8ebe2d452fd0c7e6ac2583e3f41022f60e0f1fd1
Author: Nirmoy Das <nirmoy.das@intel.com>
Date:   Thu Oct 26 14:56:36 2023 +0200

    drm/i915/tc: Fix -Wformat-truncation in intel_tc_port_init
    
    [ Upstream commit 9506fba463fcbdf8c8b7af3ec9ee34360df843fe ]
    
    Fix below compiler warning:
    
    intel_tc.c:1879:11: error: ‘%d’ directive output may be truncated
    writing between 1 and 11 bytes into a region of size 3
    [-Werror=format-truncation=]
    "%c/TC#%d", port_name(port), tc_port + 1);
               ^~
    intel_tc.c:1878:2: note: ‘snprintf’ output between 7 and 17 bytes
    into a destination of size 8
      snprintf(tc->port_name, sizeof(tc->port_name),
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        "%c/TC#%d", port_name(port), tc_port + 1);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    v2: use kasprintf(Imre)
    v3: use const for port_name, and fix tc mem leak(Imre)
    
    Fixes: 3eafcddf766b ("drm/i915/tc: Move TC port fields to a new intel_tc_port struct")
    Cc: Mika Kahola <mika.kahola@intel.com>
    Cc: Imre Deak <imre.deak@intel.com>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
    Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
    Reviewed-by: Imre Deak <imre.deak@intel.com>
    Reviewed-by: Mika Kahola <mika.kahola@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231026125636.5080-1-nirmoy.das@intel.com
    (cherry picked from commit 70a3cbbe620ee66afb0c066624196077767e61b2)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c921e1ee70a5f6837df07c830b8e9285916d3a9a
Author: Andreas Gruenbacher <agruenba@redhat.com>
Date:   Mon Oct 30 22:06:05 2023 +0100

    gfs2: Silence "suspicious RCU usage in gfs2_permission" warning
    
    [ Upstream commit 074d7306a4fe22fcac0b53f699f92757ab1cee99 ]
    
    Commit 0abd1557e21c added rcu_dereference() for dereferencing ip->i_gl
    in gfs2_permission.  This now causes lockdep to complain when
    gfs2_permission is called in non-RCU context:
    
        WARNING: suspicious RCU usage in gfs2_permission
    
    Switch to rcu_dereference_check() and check for the MAY_NOT_BLOCK flag
    to shut up lockdep when we know that dereferencing ip->i_gl is safe.
    
    Fixes: 0abd1557e21c ("gfs2: fix an oops in gfs2_permission")
    Reported-by: syzbot+3e5130844b0c0e2b4948@syzkaller.appspotmail.com
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f9e1d36a66d539041f93065ae6851b9801305872
Author: Nam Cao <namcaov@gmail.com>
Date:   Tue Aug 29 10:36:15 2023 +0200

    riscv: provide riscv-specific is_trap_insn()
    
    [ Upstream commit b701f9e726f0a30a94ea6af596b74c1f07b95b6b ]
    
    uprobes expects is_trap_insn() to return true for any trap instructions,
    not just the one used for installing uprobe. The current default
    implementation only returns true for 16-bit c.ebreak if C extension is
    enabled. This can confuse uprobes if a 32-bit ebreak generates a trap
    exception from userspace: uprobes asks is_trap_insn() who says there is no
    trap, so uprobes assume a probe was there before but has been removed, and
    return to the trap instruction. This causes an infinite loop of entering
    and exiting trap handler.
    
    Instead of using the default implementation, implement this function
    speficially for riscv with checks for both ebreak and c.ebreak.
    
    Fixes: 74784081aac8 ("riscv: Add uprobes supported")
    Signed-off-by: Nam Cao <namcaov@gmail.com>
    Tested-by: Björn Töpel <bjorn@rivosinc.com>
    Reviewed-by: Guo Ren <guoren@kernel.org>
    Link: https://lore.kernel.org/r/20230829083614.117748-1-namcaov@gmail.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 81e25896ccf56f89be0a0e83a5f5def6873a014b
Author: Andrew Jones <ajones@ventanamicro.com>
Date:   Tue Oct 10 18:51:02 2023 +0200

    RISC-V: hwprobe: Fix vDSO SIGSEGV
    
    [ Upstream commit e1c05b3bf80f829ced464bdca90f1dfa96e8d251 ]
    
    A hwprobe pair key is signed, but the hwprobe vDSO function was
    only checking that the upper bound was valid. In order to help
    avoid this type of problem in the future, and in anticipation of
    this check becoming more complicated with sparse keys, introduce
    and use a "key is valid" predicate function for the check.
    
    Fixes: aa5af0aa90ba ("RISC-V: Add hwprobe vDSO function and data")
    Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
    Reviewed-by: Evan Green <evan@rivosinc.com>
    Link: https://lore.kernel.org/r/20231010165101.14942-2-ajones@ventanamicro.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cc2e7ebbeb1d0601f7f3c8d93b78fcc03a95e44a
Author: felix <fuzhen5@huawei.com>
Date:   Mon Oct 23 09:40:19 2023 +0800

    SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
    
    [ Upstream commit bfca5fb4e97c46503ddfc582335917b0cc228264 ]
    
    RPC client pipefs dentries cleanup is in separated rpc_remove_pipedir()
    workqueue,which takes care about pipefs superblock locking.
    In some special scenarios, when kernel frees the pipefs sb of the
    current client and immediately alloctes a new pipefs sb,
    rpc_remove_pipedir function would misjudge the existence of pipefs
    sb which is not the one it used to hold. As a result,
    the rpc_remove_pipedir would clean the released freed pipefs dentries.
    
    To fix this issue, rpc_remove_pipedir should check whether the
    current pipefs sb is consistent with the original pipefs sb.
    
    This error can be catched by KASAN:
    =========================================================
    [  250.497700] BUG: KASAN: slab-use-after-free in dget_parent+0x195/0x200
    [  250.498315] Read of size 4 at addr ffff88800a2ab804 by task kworker/0:18/106503
    [  250.500549] Workqueue: events rpc_free_client_work
    [  250.501001] Call Trace:
    [  250.502880]  kasan_report+0xb6/0xf0
    [  250.503209]  ? dget_parent+0x195/0x200
    [  250.503561]  dget_parent+0x195/0x200
    [  250.503897]  ? __pfx_rpc_clntdir_depopulate+0x10/0x10
    [  250.504384]  rpc_rmdir_depopulate+0x1b/0x90
    [  250.504781]  rpc_remove_client_dir+0xf5/0x150
    [  250.505195]  rpc_free_client_work+0xe4/0x230
    [  250.505598]  process_one_work+0x8ee/0x13b0
    ...
    [   22.039056] Allocated by task 244:
    [   22.039390]  kasan_save_stack+0x22/0x50
    [   22.039758]  kasan_set_track+0x25/0x30
    [   22.040109]  __kasan_slab_alloc+0x59/0x70
    [   22.040487]  kmem_cache_alloc_lru+0xf0/0x240
    [   22.040889]  __d_alloc+0x31/0x8e0
    [   22.041207]  d_alloc+0x44/0x1f0
    [   22.041514]  __rpc_lookup_create_exclusive+0x11c/0x140
    [   22.041987]  rpc_mkdir_populate.constprop.0+0x5f/0x110
    [   22.042459]  rpc_create_client_dir+0x34/0x150
    [   22.042874]  rpc_setup_pipedir_sb+0x102/0x1c0
    [   22.043284]  rpc_client_register+0x136/0x4e0
    [   22.043689]  rpc_new_client+0x911/0x1020
    [   22.044057]  rpc_create_xprt+0xcb/0x370
    [   22.044417]  rpc_create+0x36b/0x6c0
    ...
    [   22.049524] Freed by task 0:
    [   22.049803]  kasan_save_stack+0x22/0x50
    [   22.050165]  kasan_set_track+0x25/0x30
    [   22.050520]  kasan_save_free_info+0x2b/0x50
    [   22.050921]  __kasan_slab_free+0x10e/0x1a0
    [   22.051306]  kmem_cache_free+0xa5/0x390
    [   22.051667]  rcu_core+0x62c/0x1930
    [   22.051995]  __do_softirq+0x165/0x52a
    [   22.052347]
    [   22.052503] Last potentially related work creation:
    [   22.052952]  kasan_save_stack+0x22/0x50
    [   22.053313]  __kasan_record_aux_stack+0x8e/0xa0
    [   22.053739]  __call_rcu_common.constprop.0+0x6b/0x8b0
    [   22.054209]  dentry_free+0xb2/0x140
    [   22.054540]  __dentry_kill+0x3be/0x540
    [   22.054900]  shrink_dentry_list+0x199/0x510
    [   22.055293]  shrink_dcache_parent+0x190/0x240
    [   22.055703]  do_one_tree+0x11/0x40
    [   22.056028]  shrink_dcache_for_umount+0x61/0x140
    [   22.056461]  generic_shutdown_super+0x70/0x590
    [   22.056879]  kill_anon_super+0x3a/0x60
    [   22.057234]  rpc_kill_sb+0x121/0x200
    
    Fixes: 0157d021d23a ("SUNRPC: handle RPC client pipefs dentries by network namespace aware routines")
    Signed-off-by: felix <fuzhen5@huawei.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dfdd2663247e330210e58c32dd2fced421cc8bcf
Author: Olga Kornievskaia <kolga@netapp.com>
Date:   Fri Oct 13 11:04:10 2023 -0400

    NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO
    
    [ Upstream commit 5cc7688bae7f0757c39c1d3dfdd827b724061067 ]
    
    If the client is doing pnfs IO and Kerberos is configured and EXCHANGEID
    successfully negotiated SP4_MACH_CRED and WRITE/COMMIT are on the
    list of state protected operations, then we need to make sure to
    choose the DS's rpc_client structure instead of the MDS's one.
    
    Fixes: fb91fb0ee7b2 ("NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup()")
    Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4069da49f8ae9837ca0f47aff4b6a0d89f4d22e1
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed Oct 11 11:00:22 2023 +0300

    SUNRPC: Add an IS_ERR() check back to where it was
    
    [ Upstream commit 4f3ed837186fc0d2722ba8d2457a594322e9c2ef ]
    
    This IS_ERR() check was deleted during in a cleanup because, at the time,
    the rpcb_call_async() function could not return an error pointer.  That
    changed in commit 25cf32ad5dba ("SUNRPC: Handle allocation failure in
    rpc_new_task()") and now it can return an error pointer.  Put the check
    back.
    
    A related revert was done in commit 13bd90141804 ("Revert "SUNRPC:
    Remove unreachable error condition"").
    
    Fixes: 037e910b52b0 ("SUNRPC: Remove unreachable error condition in rpcb_getport_async()")
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ec809219077d5e7df5c152c7a73b444aef474a56
Author: Olga Kornievskaia <kolga@netapp.com>
Date:   Fri Sep 15 15:21:16 2023 -0400

    NFSv4.1: fix handling NFS4ERR_DELAY when testing for session trunking
    
    [ Upstream commit 6bd1a77dc72dea0b0d8b6014f231143984d18f6d ]
    
    Currently when client sends an EXCHANGE_ID for a possible trunked
    connection, for any error that happened, the trunk will be thrown
    out. However, an NFS4ERR_DELAY is a transient error that should be
    retried instead.
    
    Fixes: e818bd085baf ("NFSv4.1 remove xprt from xprt_switch if session trunking test fails")
    Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9b0cebc70d47ff3f13c2ec4948f4a198aa27ef0f
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Mon Oct 16 22:10:04 2023 +0200

    drm/i915/mtl: avoid stringop-overflow warning
    
    [ Upstream commit 390001d648ffa027b750b7dceb5d43f4c1d1a39e ]
    
    The newly added memset() causes a warning for some reason I could not
    figure out:
    
    In file included from arch/x86/include/asm/string.h:3,
                     from drivers/gpu/drm/i915/gt/intel_rc6.c:6:
    In function 'rc6_res_reg_init',
        inlined from 'intel_rc6_init' at drivers/gpu/drm/i915/gt/intel_rc6.c:610:2:
    arch/x86/include/asm/string_32.h:195:29: error: '__builtin_memset' writing 16 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
      195 | #define memset(s, c, count) __builtin_memset(s, c, count)
          |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/gpu/drm/i915/gt/intel_rc6.c:584:9: note: in expansion of macro 'memset'
      584 |         memset(rc6->res_reg, INVALID_MMIO_REG.reg, sizeof(rc6->res_reg));
          |         ^~~~~~
    In function 'intel_rc6_init':
    
    Change it to an normal initializer and an added memcpy() that does not have
    this problem.
    
    Fixes: 4bb9ca7ee074 ("drm/i915/mtl: C6 residency and C state type for MTL SAMedia")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231016201012.1022812-1-arnd@kernel.org
    (cherry picked from commit 0520b30b219053cd789909bca45b3c486ef3ee09)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4cdc83be3ab8513271fe2b62c448da458c4a222f
Author: Yi Yang <yiyang13@huawei.com>
Date:   Thu Oct 19 06:55:48 2023 +0000

    mtd: rawnand: meson: check return value of devm_kasprintf()
    
    [ Upstream commit 5a985960a4dd041c21dbe9956958c1633d2da706 ]
    
    devm_kasprintf() returns a pointer to dynamically allocated memory
    which can be NULL upon failure. Ensure the allocation was successful by
    checking the pointer validity.
    
    Fixes: 1e4d3ba66888 ("mtd: rawnand: meson: fix the clock")
    Signed-off-by: Yi Yang <yiyang13@huawei.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20231019065548.318443-1-yiyang13@huawei.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0338bb4363a640bf2797f140f6e9c97dda2f7c59
Author: Yi Yang <yiyang13@huawei.com>
Date:   Thu Oct 19 06:55:37 2023 +0000

    mtd: rawnand: intel: check return value of devm_kasprintf()
    
    [ Upstream commit 74ac5b5e2375f1e8ef797ac7770887e9969f2516 ]
    
    devm_kasprintf() returns a pointer to dynamically allocated memory
    which can be NULL upon failure. Ensure the allocation was successful by
    checking the pointer validity.
    
    Fixes: 0b1039f016e8 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
    Signed-off-by: Yi Yang <yiyang13@huawei.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20231019065537.318391-1-yiyang13@huawei.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d4f51690e6554c623b721552af09b14f4fa33b9f
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date:   Sun Sep 17 09:06:05 2023 -0400

    SUNRPC: ECONNRESET might require a rebind
    
    [ Upstream commit 4b09ca1508a60be30b2e3940264e93d7aeb5c97e ]
    
    If connect() is returning ECONNRESET, it usually means that nothing is
    listening on that port. If so, a rebind might be required in order to
    obtain the new port on which the RPC service is listening.
    
    Fixes: fd01b2597941 ("SUNRPC: ECONNREFUSED should cause a rebind.")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8159c843e4d2d3bd0d6d058a603610c40ce7c5df
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Thu Oct 5 11:32:46 2023 +0200

    dt-bindings: serial: fix regex pattern for matching serial node children
    
    [ Upstream commit 42851dfd4dbe38e34724a00063a9fad5cfc48dcd ]
    
    The regular expression pattern for matching serial node children should
    accept only nodes starting and ending with the set of words: bluetooth,
    gnss, gps or mcu.  Add missing brackets to enforce such matching.
    
    Fixes: 0c559bc8abfb ("dt-bindings: serial: restrict possible child node names")
    Reported-by: Andreas Kemnade <andreas@kemnade.info>
    Closes: https://lore.kernel.org/all/20231004170021.36b32465@aktux/
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Acked-by: Rob Herring <robh@kernel.org>
    Link: https://lore.kernel.org/r/20231005093247.128166-1-krzysztof.kozlowski@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit de4825a444560f8cb78b03dda3ba873fab88bc4f
Author: Jinghao Jia <jinghao@linux.ibm.com>
Date:   Sun Sep 17 16:42:20 2023 -0500

    samples/bpf: syscall_tp_user: Fix array out-of-bound access
    
    [ Upstream commit 9220c3ef6fefbf18f24aeedb1142a642b3de0596 ]
    
    Commit 06744f24696e ("samples/bpf: Add openat2() enter/exit tracepoint
    to syscall_tp sample") added two more eBPF programs to support the
    openat2() syscall. However, it did not increase the size of the array
    that holds the corresponding bpf_links. This leads to an out-of-bound
    access on that array in the bpf_object__for_each_program loop and could
    corrupt other variables on the stack. On our testing QEMU, it corrupts
    the map1_fds array and causes the sample to fail:
    
      # ./syscall_tp
      prog #0: map ids 4 5
      verify map:4 val: 5
      map_lookup failed: Bad file descriptor
    
    Dynamically allocate the array based on the number of programs reported
    by libbpf to prevent similar inconsistencies in the future
    
    Fixes: 06744f24696e ("samples/bpf: Add openat2() enter/exit tracepoint to syscall_tp sample")
    Signed-off-by: Jinghao Jia <jinghao@linux.ibm.com>
    Signed-off-by: Ruowen Qin <ruowenq2@illinois.edu>
    Signed-off-by: Jinghao Jia <jinghao7@illinois.edu>
    Link: https://lore.kernel.org/r/20230917214220.637721-4-jinghao7@illinois.edu
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 948189f679ac9820c57c7801d592442b7d122972
Author: Jinghao Jia <jinghao@linux.ibm.com>
Date:   Sun Sep 17 16:42:19 2023 -0500

    samples/bpf: syscall_tp_user: Rename num_progs into nr_tests
    
    [ Upstream commit 0ee352fe0d28015cab161b04d202fa3231c0ba3b ]
    
    The variable name num_progs causes confusion because that variable
    really controls the number of rounds the test should be executed.
    
    Rename num_progs into nr_tests for the sake of clarity.
    
    Signed-off-by: Jinghao Jia <jinghao@linux.ibm.com>
    Signed-off-by: Ruowen Qin <ruowenq2@illinois.edu>
    Signed-off-by: Jinghao Jia <jinghao7@illinois.edu>
    Link: https://lore.kernel.org/r/20230917214220.637721-3-jinghao7@illinois.edu
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Stable-dep-of: 9220c3ef6fef ("samples/bpf: syscall_tp_user: Fix array out-of-bound access")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bc13958889403b31cc0e92bbf69391b2df19e3ae
Author: Finn Thain <fthain@linux-m68k.org>
Date:   Fri Sep 15 15:47:11 2023 +1000

    sched/core: Optimize in_task() and in_interrupt() a bit
    
    [ Upstream commit 87c3a5893e865739ce78aa7192d36011022e0af7 ]
    
    Except on x86, preempt_count is always accessed with READ_ONCE().
    Repeated invocations in macros like irq_count() produce repeated loads.
    These redundant instructions appear in various fast paths. In the one
    shown below, for example, irq_count() is evaluated during kernel entry
    if !tick_nohz_full_cpu(smp_processor_id()).
    
    0001ed0a <irq_enter_rcu>:
       1ed0a:       4e56 0000       linkw %fp,#0
       1ed0e:       200f            movel %sp,%d0
       1ed10:       0280 ffff e000  andil #-8192,%d0
       1ed16:       2040            moveal %d0,%a0
       1ed18:       2028 0008       movel %a0@(8),%d0
       1ed1c:       0680 0001 0000  addil #65536,%d0
       1ed22:       2140 0008       movel %d0,%a0@(8)
       1ed26:       082a 0001 000f  btst #1,%a2@(15)
       1ed2c:       670c            beqs 1ed3a <irq_enter_rcu+0x30>
       1ed2e:       2028 0008       movel %a0@(8),%d0
       1ed32:       2028 0008       movel %a0@(8),%d0
       1ed36:       2028 0008       movel %a0@(8),%d0
       1ed3a:       4e5e            unlk %fp
       1ed3c:       4e75            rts
    
    This patch doesn't prevent the pointless btst and beqs instructions
    above, but it does eliminate 2 of the 3 pointless move instructions
    here and elsewhere.
    
    On x86, preempt_count is per-cpu data and the problem does not arise
    presumably because the compiler is free to optimize more effectively.
    
    This patch was tested on m68k and x86. I was expecting no changes
    to object code for x86 and mostly that's what I saw. However, there
    were a few places where code generation was perturbed for some reason.
    
    The performance issue addressed here is minor on uniprocessor m68k. I
    got a 0.01% improvement from this patch for a simple "find /sys -false"
    benchmark. For architectures and workloads susceptible to cache line bounce
    the improvement is expected to be larger. The only SMP architecture I have
    is x86, and as x86 unaffected I have not done any further measurements.
    
    Fixes: 15115830c887 ("preempt: Cleanup the macro maze a bit")
    Signed-off-by: Finn Thain <fthain@linux-m68k.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/0a403120a682a525e6db2d81d1a3ffcc137c3742.1694756831.git.fthain@linux-m68k.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a96ef1ffc60709d59527d5c9752ab8824e42ad47
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Wed Sep 13 14:56:45 2023 +0300

    wifi: iwlwifi: Use FW rate for non-data frames
    
    [ Upstream commit 499d02790495958506a64f37ceda7e97345a50a8 ]
    
    Currently we are setting the rate in the tx cmd for
    mgmt frames (e.g. during connection establishment).
    This was problematic when sending mgmt frames in eSR mode,
    as we don't know what link this frame will be sent on
    (This is decided by the FW), so we don't know what is the
    lowest rate.
    Fix this by not setting the rate in tx cmd and rely
    on FW to choose the right one.
    Set rate only for injected frames with fixed rate,
    or when no sta is given.
    Also set for important frames (EAPOL etc.) the High Priority flag.
    
    Fixes: 055b22e770dd ("iwlwifi: mvm: Set Tx rate and flags when there is not station")
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230913145231.6c7e59620ee0.I6eaed3ccdd6dd62b9e664facc484081fc5275843@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1e0bb46893483215481bcb1b48ed14a7be819b83
Author: Yi Yang <yiyang13@huawei.com>
Date:   Mon Aug 21 16:40:46 2023 +0800

    mtd: rawnand: tegra: add missing check for platform_get_irq()
    
    [ Upstream commit 0a1166c27d4e53186e6bf9147ea6db9cd1d65847 ]
    
    Add the missing check for platform_get_irq() and return error code
    if it fails.
    
    Fixes: d7d9f8ec77fe ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")
    Signed-off-by: Yi Yang <yiyang13@huawei.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20230821084046.217025-1-yiyang13@huawei.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 45d0a298e05adee521f6fe605d6a88341ba07edd
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Wed Oct 25 14:58:18 2023 +0300

    pwm: Fix double shift bug
    
    [ Upstream commit d27abbfd4888d79dd24baf50e774631046ac4732 ]
    
    These enums are passed to set/test_bit().  The set/test_bit() functions
    take a bit number instead of a shifted value.  Passing a shifted value
    is a double shift bug like doing BIT(BIT(1)).  The double shift bug
    doesn't cause a problem here because we are only checking 0 and 1 but
    if the value was 5 or above then it can lead to a buffer overflow.
    
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
    Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
    Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit de1c09598b8de52a0f0ee5fd9b1f22079f78330e
Author: Vitaly Prosyak <vitaly.prosyak@amd.com>
Date:   Wed Oct 11 19:31:48 2023 -0400

    drm/amdgpu: fix software pci_unplug on some chips
    
    [ Upstream commit 4638e0c29a3f2294d5de0d052a4b8c9f33ccb957 ]
    
    When software 'pci unplug' using IGT is executed we got a sysfs directory
    entry is NULL for differant ras blocks like hdp, umc, etc.
    Before call 'sysfs_remove_file_from_group' and 'sysfs_remove_group'
    check that 'sd' is  not NULL.
    
    [  +0.000001] RIP: 0010:sysfs_remove_group+0x83/0x90
    [  +0.000002] Code: 31 c0 31 d2 31 f6 31 ff e9 9a a8 b4 00 4c 89 e7 e8 f2 a2 ff ff eb c2 49 8b 55 00 48 8b 33 48 c7 c7 80 65 94 82 e8 cd 82 bb ff <0f> 0b eb cc 66 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90
    [  +0.000001] RSP: 0018:ffffc90002067c90 EFLAGS: 00010246
    [  +0.000002] RAX: 0000000000000000 RBX: ffffffff824ea180 RCX: 0000000000000000
    [  +0.000001] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
    [  +0.000001] RBP: ffffc90002067ca8 R08: 0000000000000000 R09: 0000000000000000
    [  +0.000001] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
    [  +0.000001] R13: ffff88810a395f48 R14: ffff888101aab0d0 R15: 0000000000000000
    [  +0.000001] FS:  00007f5ddaa43a00(0000) GS:ffff88841e800000(0000) knlGS:0000000000000000
    [  +0.000002] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  +0.000001] CR2: 00007f8ffa61ba50 CR3: 0000000106432000 CR4: 0000000000350ef0
    [  +0.000001] Call Trace:
    [  +0.000001]  <TASK>
    [  +0.000001]  ? show_regs+0x72/0x90
    [  +0.000002]  ? sysfs_remove_group+0x83/0x90
    [  +0.000002]  ? __warn+0x8d/0x160
    [  +0.000001]  ? sysfs_remove_group+0x83/0x90
    [  +0.000001]  ? report_bug+0x1bb/0x1d0
    [  +0.000003]  ? handle_bug+0x46/0x90
    [  +0.000001]  ? exc_invalid_op+0x19/0x80
    [  +0.000002]  ? asm_exc_invalid_op+0x1b/0x20
    [  +0.000003]  ? sysfs_remove_group+0x83/0x90
    [  +0.000001]  dpm_sysfs_remove+0x61/0x70
    [  +0.000002]  device_del+0xa3/0x3d0
    [  +0.000002]  ? ktime_get_mono_fast_ns+0x46/0xb0
    [  +0.000002]  device_unregister+0x18/0x70
    [  +0.000001]  i2c_del_adapter+0x26d/0x330
    [  +0.000002]  arcturus_i2c_control_fini+0x25/0x50 [amdgpu]
    [  +0.000236]  smu_sw_fini+0x38/0x260 [amdgpu]
    [  +0.000241]  amdgpu_device_fini_sw+0x116/0x670 [amdgpu]
    [  +0.000186]  ? mutex_lock+0x13/0x50
    [  +0.000003]  amdgpu_driver_release_kms+0x16/0x40 [amdgpu]
    [  +0.000192]  drm_minor_release+0x4f/0x80 [drm]
    [  +0.000025]  drm_release+0xfe/0x150 [drm]
    [  +0.000027]  __fput+0x9f/0x290
    [  +0.000002]  ____fput+0xe/0x20
    [  +0.000002]  task_work_run+0x61/0xa0
    [  +0.000002]  exit_to_user_mode_prepare+0x150/0x170
    [  +0.000002]  syscall_exit_to_user_mode+0x2a/0x50
    
    Cc: Hawking Zhang <hawking.zhang@amd.com>
    Cc: Luben Tuikov <luben.tuikov@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Christian Koenig <christian.koenig@amd.com>
    Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
    Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8d6c4d60f35286e806e6c11740019997cc68212f
Author: Alex Spataru <alex_spataru@outlook.com>
Date:   Sat Nov 4 16:01:52 2023 -0500

    ALSA: hda/realtek: Add quirk for ASUS UX7602ZM
    
    [ Upstream commit 26fd31ef9c02a5e91cdb8eea127b056bd7cf0b3b ]
    
    Enables the SPI-connected CSC35L41 audio amplifier for this
    laptop model.
    
    As of BIOS version 303 it's still necessary to
    modify the ACPI table to add the related _DSD properties:
    https://github.com/alex-spataru/asus_zenbook_ux7602zm_sound/
    
    Signed-off-by: Alex Spataru <alex_spataru@outlook.com>
    Link: https://lore.kernel.org/r/DS7PR07MB7621BB5BB14F5473D181624CE3A4A@DS7PR07MB7621.namprd07.prod.outlook.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 01834d420e27f2e51aa5ee8ae62926371654c5db
Author: Zongmin Zhou <zhouzongmin@kylinos.cn>
Date:   Tue Aug 1 10:53:09 2023 +0800

    drm/qxl: prevent memory leak
    
    [ Upstream commit 0e8b9f258baed25f1c5672613699247c76b007b5 ]
    
    The allocated memory for qdev->dumb_heads should be released
    in qxl_destroy_monitors_object before qxl suspend.
    otherwise,qxl_create_monitors_object will be called to
    reallocate memory for qdev->dumb_heads after qxl resume,
    it will cause memory leak.
    
    Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
    Link: https://lore.kernel.org/r/20230801025309.4049813-1-zhouzongmin@kylinos.cn
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Maxime Ripard <mripard@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dc0cbcba24a8c867bfa43ff11746019a4dc5b894
Author: Tony Lindgren <tony@atomide.com>
Date:   Mon Oct 30 07:23:38 2023 +0200

    ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings
    
    [ Upstream commit fbb74e56378d8306f214658e3d525a8b3f000c5a ]
    
    We need to check for an active device as otherwise we get warnings
    for some mcbsp instances for "Runtime PM usage count underflow!".
    
    Reported-by: Andreas Kemnade <andreas@kemnade.info>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Link: https://lore.kernel.org/r/20231030052340.13415-1-tony@atomide.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bef76b8544939518dafa3325bcd438b111136437
Author: Philipp Stanner <pstanner@redhat.com>
Date:   Thu Nov 2 20:26:13 2023 +0100

    i2c: dev: copy userspace array safely
    
    [ Upstream commit cc9c54232f04aef3a5d7f64a0ece7df00f1aaa3d ]
    
    i2c-dev.c utilizes memdup_user() to copy a userspace array. This is done
    without an overflow check.
    
    Use the new wrapper memdup_array_user() to copy the array more safely.
    
    Suggested-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Philipp Stanner <pstanner@redhat.com>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit eff53aea3855f71992c043cebb1c00988c17ee20
Author: Deepak Gupta <debug@rivosinc.com>
Date:   Wed Sep 27 22:47:59 2023 +0000

    riscv: VMAP_STACK overflow detection thread-safe
    
    [ Upstream commit be97d0db5f44c0674480cb79ac6f5b0529b84c76 ]
    
    commit 31da94c25aea ("riscv: add VMAP_STACK overflow detection") added
    support for CONFIG_VMAP_STACK. If overflow is detected, CPU switches to
    `shadow_stack` temporarily before switching finally to per-cpu
    `overflow_stack`.
    
    If two CPUs/harts are racing and end up in over flowing kernel stack, one
    or both will end up corrupting each other state because `shadow_stack` is
    not per-cpu. This patch optimizes per-cpu overflow stack switch by
    directly picking per-cpu `overflow_stack` and gets rid of `shadow_stack`.
    
    Following are the changes in this patch
    
     - Defines an asm macro to obtain per-cpu symbols in destination
       register.
     - In entry.S, when overflow is detected, per-cpu overflow stack is
       located using per-cpu asm macro. Computing per-cpu symbol requires
       a temporary register. x31 is saved away into CSR_SCRATCH
       (CSR_SCRATCH is anyways zero since we're in kernel).
    
    Please see Links for additional relevant disccussion and alternative
    solution.
    
    Tested by `echo EXHAUST_STACK > /sys/kernel/debug/provoke-crash/DIRECT`
    Kernel crash log below
    
     Insufficient stack space to handle exception!/debug/provoke-crash/DIRECT
     Task stack:     [0xff20000010a98000..0xff20000010a9c000]
     Overflow stack: [0xff600001f7d98370..0xff600001f7d99370]
     CPU: 1 PID: 205 Comm: bash Not tainted 6.1.0-rc2-00001-g328a1f96f7b9 #34
     Hardware name: riscv-virtio,qemu (DT)
     epc : __memset+0x60/0xfc
      ra : recursive_loop+0x48/0xc6 [lkdtm]
     epc : ffffffff808de0e4 ra : ffffffff0163a752 sp : ff20000010a97e80
      gp : ffffffff815c0330 tp : ff600000820ea280 t0 : ff20000010a97e88
      t1 : 000000000000002e t2 : 3233206874706564 s0 : ff20000010a982b0
      s1 : 0000000000000012 a0 : ff20000010a97e88 a1 : 0000000000000000
      a2 : 0000000000000400 a3 : ff20000010a98288 a4 : 0000000000000000
      a5 : 0000000000000000 a6 : fffffffffffe43f0 a7 : 00007fffffffffff
      s2 : ff20000010a97e88 s3 : ffffffff01644680 s4 : ff20000010a9be90
      s5 : ff600000842ba6c0 s6 : 00aaaaaac29e42b0 s7 : 00fffffff0aa3684
      s8 : 00aaaaaac2978040 s9 : 0000000000000065 s10: 00ffffff8a7cad10
      s11: 00ffffff8a76a4e0 t3 : ffffffff815dbaf4 t4 : ffffffff815dbaf4
      t5 : ffffffff815dbab8 t6 : ff20000010a9bb48
     status: 0000000200000120 badaddr: ff20000010a97e88 cause: 000000000000000f
     Kernel panic - not syncing: Kernel stack overflow
     CPU: 1 PID: 205 Comm: bash Not tainted 6.1.0-rc2-00001-g328a1f96f7b9 #34
     Hardware name: riscv-virtio,qemu (DT)
     Call Trace:
     [<ffffffff80006754>] dump_backtrace+0x30/0x38
     [<ffffffff808de798>] show_stack+0x40/0x4c
     [<ffffffff808ea2a8>] dump_stack_lvl+0x44/0x5c
     [<ffffffff808ea2d8>] dump_stack+0x18/0x20
     [<ffffffff808dec06>] panic+0x126/0x2fe
     [<ffffffff800065ea>] walk_stackframe+0x0/0xf0
     [<ffffffff0163a752>] recursive_loop+0x48/0xc6 [lkdtm]
     SMP: stopping secondary CPUs
     ---[ end Kernel panic - not syncing: Kernel stack overflow ]---
    
    Cc: Guo Ren <guoren@kernel.org>
    Cc: Jisheng Zhang <jszhang@kernel.org>
    Link: https://lore.kernel.org/linux-riscv/Y347B0x4VUNOd6V7@xhacker/T/#t
    Link: https://lore.kernel.org/lkml/20221124094845.1907443-1-debug@rivosinc.com/
    Signed-off-by: Deepak Gupta <debug@rivosinc.com>
    Co-developed-by: Sami Tolvanen <samitolvanen@google.com>
    Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
    Acked-by: Guo Ren <guoren@kernel.org>
    Tested-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20230927224757.1154247-9-samitolvanen@google.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ef4e484ab0136e5f8616c45ad13b2f67dc922998
Author: Douglas Anderson <dianders@chromium.org>
Date:   Tue Aug 22 13:19:46 2023 -0700

    kgdb: Flush console before entering kgdb on panic
    
    [ Upstream commit dd712d3d45807db9fcae28a522deee85c1f2fde6 ]
    
    When entering kdb/kgdb on a kernel panic, it was be observed that the
    console isn't flushed before the `kdb` prompt came up. Specifically,
    when using the buddy lockup detector on arm64 and running:
      echo HARDLOCKUP > /sys/kernel/debug/provoke-crash/DIRECT
    
    I could see:
      [   26.161099] lkdtm: Performing direct entry HARDLOCKUP
      [   32.499881] watchdog: Watchdog detected hard LOCKUP on cpu 6
      [   32.552865] Sending NMI from CPU 5 to CPUs 6:
      [   32.557359] NMI backtrace for cpu 6
      ... [backtrace for cpu 6] ...
      [   32.558353] NMI backtrace for cpu 5
      ... [backtrace for cpu 5] ...
      [   32.867471] Sending NMI from CPU 5 to CPUs 0-4,7:
      [   32.872321] NMI backtrace forP cpuANC: Hard LOCKUP
    
      Entering kdb (current=..., pid 0) on processor 5 due to Keyboard Entry
      [5]kdb>
    
    As you can see, backtraces for the other CPUs start printing and get
    interleaved with the kdb PANIC print.
    
    Let's replicate the commands to flush the console in the kdb panic
    entry point to avoid this.
    
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20230822131945.1.I5b460ae8f954e4c4f628a373d6e74713c06dd26f@changeid
    Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 08a28272faa750d4357ea2cb48d2baefd778ea81
Author: Juntong Deng <juntong.deng@outlook.com>
Date:   Mon Oct 30 05:10:06 2023 +0800

    gfs2: Fix slab-use-after-free in gfs2_qd_dealloc
    
    [ Upstream commit bdcb8aa434c6d36b5c215d02a9ef07551be25a37 ]
    
    In gfs2_put_super(), whether withdrawn or not, the quota should
    be cleaned up by gfs2_quota_cleanup().
    
    Otherwise, struct gfs2_sbd will be freed before gfs2_qd_dealloc (rcu
    callback) has run for all gfs2_quota_data objects, resulting in
    use-after-free.
    
    Also, gfs2_destroy_threads() and gfs2_quota_cleanup() is already called
    by gfs2_make_fs_ro(), so in gfs2_put_super(), after calling
    gfs2_make_fs_ro(), there is no need to call them again.
    
    Reported-by: syzbot+29c47e9e51895928698c@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=29c47e9e51895928698c
    Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit df8bc953eed72371e43ca407bd063507f760cf89
Author: Wayne Lin <wayne.lin@amd.com>
Date:   Fri Sep 8 10:14:49 2023 +0800

    drm/amd/display: Avoid NULL dereference of timing generator
    
    [ Upstream commit b1904ed480cee3f9f4036ea0e36d139cb5fee2d6 ]
    
    [Why & How]
    Check whether assigned timing generator is NULL or not before
    accessing its funcs to prevent NULL dereference.
    
    Reviewed-by: Jun Lei <jun.lei@amd.com>
    Acked-by: Hersen Wu <hersenxs.wu@amd.com>
    Signed-off-by: Wayne Lin <wayne.lin@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2a493a34bd6e496c55fabedd82b957193ace178f
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Sep 22 14:38:07 2023 +0200

    media: imon: fix access to invalid resource for the second interface
    
    [ Upstream commit a1766a4fd83befa0b34d932d532e7ebb7fab1fa7 ]
    
    imon driver probes two USB interfaces, and at the probe of the second
    interface, the driver assumes blindly that the first interface got
    bound with the same imon driver.  It's usually true, but it's still
    possible that the first interface is bound with another driver via a
    malformed descriptor.  Then it may lead to a memory corruption, as
    spotted by syzkaller; imon driver accesses the data from drvdata as
    struct imon_context object although it's a completely different one
    that was assigned by another driver.
    
    This patch adds a sanity check -- whether the first interface is
    really bound with the imon driver or not -- for avoiding the problem
    above at the probe time.
    
    Reported-by: syzbot+59875ffef5cb9c9b29e9@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/000000000000a838aa0603cc74d6@google.com/
    Tested-by: Ricardo B. Marliere <ricardo@marliere.net>
    Link: https://lore.kernel.org/r/20230922005152.163640-1-ricardo@marliere.net
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e943d65c3247d1824d0274b0a9fd1116afa335ed
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date:   Thu Aug 24 15:18:18 2023 +0300

    media: ccs: Fix driver quirk struct documentation
    
    [ Upstream commit 441b5c63d71ec9ec5453328f7e83384ecc1dddd9 ]
    
    Fix documentation for struct ccs_quirk, a device specific struct for
    managing deviations from the standard. The flags field was drifted away
    from where it should have been.
    
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 86e281fcdc6f8b23ce707488d0dd8af745866fe8
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Wed Sep 13 15:27:40 2023 +0300

    media: cobalt: Use FIELD_GET() to extract Link Width
    
    [ Upstream commit f301fedbeecfdce91cb898d6fa5e62f269801fee ]
    
    Use FIELD_GET() to extract PCIe Negotiated and Maximum Link Width fields
    instead of custom masking and shifting.
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 7f9b5e974cbb500ea88643b385913ab41cc6560b
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Mon Oct 2 03:33:44 2023 +0100

    gfs2: fix an oops in gfs2_permission
    
    [ Upstream commit 0abd1557e21c617bd13fc18f7725fc6363c05913 ]
    
    In RCU mode, we might race with gfs2_evict_inode(), which zeroes
    ->i_gl.  Freeing of the object it points to is RCU-delayed, so
    if we manage to fetch the pointer before it's been replaced with
    NULL, we are fine.  Check if we'd fetched NULL and treat that
    as "bail out and tell the caller to get out of RCU mode".
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 119565e566f91ff3588ffcd5812f0c8061586c6b
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Thu Sep 21 08:46:43 2023 -0500

    gfs2: ignore negated quota changes
    
    [ Upstream commit 4c6a08125f2249531ec01783a5f4317d7342add5 ]
    
    When lots of quota changes are made, there may be cases in which an
    inode's quota information is increased and then decreased, such as when
    blocks are added to a file, then deleted from it. If the timing is
    right, function do_qc can add pending quota changes to a transaction,
    then later, another call to do_qc can negate those changes, resulting
    in a net gain of 0. The quota_change information is recorded in the qc
    buffer (and qd element of the inode as well). The buffer is added to the
    transaction by the first call to do_qc, but a subsequent call changes
    the value from non-zero back to zero. At that point it's too late to
    remove the buffer_head from the transaction. Later, when the quota sync
    code is called, the zero-change qd element is discovered and flagged as
    an assert warning. If the fs is mounted with errors=panic, the kernel
    will panic.
    
    This is usually seen when files are truncated and the quota changes are
    negated by punch_hole/truncate which uses gfs2_quota_hold and
    gfs2_quota_unhold rather than block allocations that use gfs2_quota_lock
    and gfs2_quota_unlock which automatically do quota sync.
    
    This patch solves the problem by adding a check to qd_check_sync such
    that net-zero quota changes already added to the transaction are no
    longer deemed necessary to be synced, and skipped.
    
    In this case references are taken for the qd and the slot from do_qc
    so those need to be put. The normal sequence of events for a normal
    non-zero quota change is as follows:
    
    gfs2_quota_change
       do_qc
          qd_hold
          slot_hold
    
    Later, when the changes are to be synced:
    
    gfs2_quota_sync
       qd_fish
          qd_check_sync
             gets qd ref via lockref_get_not_dead
       do_sync
          do_qc(QC_SYNC)
             qd_put
                lockref_put_or_lock
       qd_unlock
          qd_put
             lockref_put_or_lock
    
    In the net-zero change case, we add a check to qd_check_sync so it puts
    the qd and slot references acquired in gfs2_quota_change and skip the
    unneeded sync.
    
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6985eb221b80b70445a834e20332fa41806856a5
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Sat Sep 23 17:20:49 2023 +0200

    media: ipu-bridge: increase sensor_name size
    
    [ Upstream commit 83d0d4cc1423194b580356966107379490edd02e ]
    
    Fixes this compiler warning:
    
    In file included from include/linux/property.h:14,
                     from include/linux/acpi.h:16,
                     from drivers/media/pci/intel/ipu-bridge.c:4:
    In function 'ipu_bridge_init_swnode_names',
        inlined from 'ipu_bridge_create_connection_swnodes' at drivers/media/pci/intel/ipu-bridge.c:445:2,
        inlined from 'ipu_bridge_connect_sensor' at drivers/media/pci/intel/ipu-bridge.c:656:3:
    include/linux/fwnode.h:81:49: warning: '%u' directive output may be truncated writing between 1 and 3 bytes into a region of size 2 [-Wformat-truncation=]
       81 | #define SWNODE_GRAPH_PORT_NAME_FMT              "port@%u"
          |                                                 ^~~~~~~~~
    drivers/media/pci/intel/ipu-bridge.c:384:18: note: in expansion of macro 'SWNODE_GRAPH_PORT_NAME_FMT'
      384 |                  SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
    include/linux/fwnode.h: In function 'ipu_bridge_connect_sensor':
    include/linux/fwnode.h:81:55: note: format string is defined here
       81 | #define SWNODE_GRAPH_PORT_NAME_FMT              "port@%u"
          |                                                       ^~
    In function 'ipu_bridge_init_swnode_names',
        inlined from 'ipu_bridge_create_connection_swnodes' at drivers/media/pci/intel/ipu-bridge.c:445:2,
        inlined from 'ipu_bridge_connect_sensor' at drivers/media/pci/intel/ipu-bridge.c:656:3:
    include/linux/fwnode.h:81:49: note: directive argument in the range [0, 255]
       81 | #define SWNODE_GRAPH_PORT_NAME_FMT              "port@%u"
          |                                                 ^~~~~~~~~
    drivers/media/pci/intel/ipu-bridge.c:384:18: note: in expansion of macro 'SWNODE_GRAPH_PORT_NAME_FMT'
      384 |                  SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/media/pci/intel/ipu-bridge.c:382:9: note: 'snprintf' output between 7 and 9 bytes into a destination of size 7
      382 |         snprintf(sensor->node_names.remote_port,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      383 |                  sizeof(sensor->node_names.remote_port),
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      384 |                  SWNODE_GRAPH_PORT_NAME_FMT, sensor->link);
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 92152c4c56cc07b160fc5774da27360ff0d8a0f6
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Sat Sep 23 17:20:48 2023 +0200

    media: vivid: avoid integer overflow
    
    [ Upstream commit 4567ebf8e8f9546b373e78e3b7d584cc30b62028 ]
    
    Fixes these compiler warnings:
    
    drivers/media/test-drivers/vivid/vivid-rds-gen.c: In function 'vivid_rds_gen_fill':
    drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:56: warning: '.' directive output may be truncated writing 1 byte into a region of size between 0 and 3 [-Wformat-truncation=]
      147 |         snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
          |                                                        ^
    drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:52: note: directive argument in the range [0, 9]
      147 |         snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
          |                                                    ^~~~~~~~~
    drivers/media/test-drivers/vivid/vivid-rds-gen.c:147:9: note: 'snprintf' output between 9 and 12 bytes into a destination of size 9
      147 |         snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d",
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      148 |                  freq / 16, ((freq & 0xf) * 10) / 16);
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e2d7149b913d14352c82624e723ce1c211ca06d3
Author: Rajeshwar R Shinde <coolrrsh@gmail.com>
Date:   Wed Aug 30 13:14:01 2023 +0530

    media: gspca: cpia1: shift-out-of-bounds in set_flicker
    
    [ Upstream commit 099be1822d1f095433f4b08af9cc9d6308ec1953 ]
    
    Syzkaller reported the following issue:
    UBSAN: shift-out-of-bounds in drivers/media/usb/gspca/cpia1.c:1031:27
    shift exponent 245 is too large for 32-bit type 'int'
    
    When the value of the variable "sd->params.exposure.gain" exceeds the
    number of bits in an integer, a shift-out-of-bounds error is reported. It
    is triggered because the variable "currentexp" cannot be left-shifted by
    more than the number of bits in an integer. In order to avoid invalid
    range during left-shift, the conditional expression is added.
    
    Reported-by: syzbot+e27f3dbdab04e43b9f73@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/20230818164522.12806-1-coolrrsh@gmail.com
    Link: https://syzkaller.appspot.com/bug?extid=e27f3dbdab04e43b9f73
    Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit eed74230435c61eeb58abaa275b1820e6a4b7f02
Author: Billy Tsai <billy_tsai@aspeedtech.com>
Date:   Mon Oct 23 16:02:37 2023 +0800

    i3c: master: mipi-i3c-hci: Fix a kernel panic for accessing DAT_data.
    
    [ Upstream commit b53e9758a31c683fc8615df930262192ed5f034b ]
    
    The `i3c_master_bus_init` function may attach the I2C devices before the
    I3C bus initialization. In this flow, the DAT `alloc_entry`` will be used
    before the DAT `init`. Additionally, if the `i3c_master_bus_init` fails,
    the DAT `cleanup` will execute before the device is detached, which will
    execue DAT `free_entry` function. The above scenario can cause the driver
    to use DAT_data when it is NULL.
    
    Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
    Link: https://lore.kernel.org/r/20231023080237.560936-1-billy_tsai@aspeedtech.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d667fe301dcbcb12d1d6494fc4b8abee2cb75d90
Author: zhenwei pi <pizhenwei@bytedance.com>
Date:   Mon Sep 4 14:10:45 2023 +0800

    virtio-blk: fix implicit overflow on virtio_max_dma_size
    
    [ Upstream commit fafb51a67fb883eb2dde352539df939a251851be ]
    
    The following codes have an implicit conversion from size_t to u32:
    (u32)max_size = (size_t)virtio_max_dma_size(vdev);
    
    This may lead overflow, Ex (size_t)4G -> (u32)0. Once
    virtio_max_dma_size() has a larger size than U32_MAX, use U32_MAX
    instead.
    
    Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
    Message-Id: <20230904061045.510460-1-pizhenwei@bytedance.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a5a583fbb002ae8115f53f8ec364f22c7aa40442
Author: Axel Lin <axel.lin@ingics.com>
Date:   Wed Apr 13 08:54:30 2016 +0800

    i2c: sun6i-p2wi: Prevent potential division by zero
    
    [ Upstream commit 5ac61d26b8baff5b2e5a9f3dc1ef63297e4b53e7 ]
    
    Make sure we don't OOPS in case clock-frequency is set to 0 in a DT. The
    variable set here is later used as a divisor.
    
    Signed-off-by: Axel Lin <axel.lin@ingics.com>
    Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bd62916b7a72c09fde12fcd0199906051fb9ed76
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date:   Fri Sep 29 11:19:52 2023 +0200

    i2c: fix memleak in i2c_new_client_device()
    
    [ Upstream commit 6af79f7fe748fe6a3c5c3a63d7f35981a82c2769 ]
    
    Yang Yingliang reported a memleak:
    ===
    
    I got memory leak as follows when doing fault injection test:
    
    unreferenced object 0xffff888014aec078 (size 8):
      comm "xrun", pid 356, jiffies 4294910619 (age 16.332s)
      hex dump (first 8 bytes):
        31 2d 30 30 31 63 00 00                          1-001c..
      backtrace:
        [<00000000eb56c0a9>] __kmalloc_track_caller+0x1a6/0x300
        [<000000000b220ea3>] kvasprintf+0xad/0x140
        [<00000000b83203e5>] kvasprintf_const+0x62/0x190
        [<000000002a5eab37>] kobject_set_name_vargs+0x56/0x140
        [<00000000300ac279>] dev_set_name+0xb0/0xe0
        [<00000000b66ebd6f>] i2c_new_client_device+0x7e4/0x9a0
    
    If device_register() returns error in i2c_new_client_device(),
    the name allocated by i2c_dev_set_name() need be freed. As
    comment of device_register() says, it should use put_device()
    to give up the reference in the error path.
    
    ===
    I think this solution is less intrusive and more robust than he
    originally proposed solutions, though.
    
    Reported-by: Yang Yingliang <yangyingliang@huawei.com>
    Closes: http://patchwork.ozlabs.org/project/linux-i2c/patch/20221124085448.3620240-1-yangyingliang@huawei.com/
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c001527728fa88e4be32958b004201ccb17d5e54
Author: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Date:   Mon Oct 2 11:28:04 2023 +0300

    i2c: i801: Add support for Intel Birch Stream SoC
    
    [ Upstream commit 8c56f9ef25a33e51f09a448d25cf863b61c9658d ]
    
    Add SMBus PCI ID on Intel Birch Stream SoC.
    
    Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
    Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
    Reviewed-by: Jean Delvare <jdelvare@suse.de>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4c86cb2321bd9c72d3b945ce7f747961beda8e65
Author: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Date:   Thu Sep 21 08:56:56 2023 +0300

    i3c: mipi-i3c-hci: Fix out of bounds access in hci_dma_irq_handler
    
    [ Upstream commit 45a832f989e520095429589d5b01b0c65da9b574 ]
    
    Do not loop over ring headers in hci_dma_irq_handler() that are not
    allocated and enabled in hci_dma_init(). Otherwise out of bounds access
    will occur from rings->headers[i] access when i >= number of allocated
    ring headers.
    
    Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
    Link: https://lore.kernel.org/r/20230921055704.1087277-5-jarkko.nikula@linux.intel.com
    Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 35663b6b49a30d2303ccef33bdd10cb1fcf4a101
Author: Dominique Martinet <asmadeus@codewreck.org>
Date:   Wed Oct 25 19:34:44 2023 +0900

    9p: v9fs_listxattr: fix %s null argument warning
    
    [ Upstream commit 9b5c6281838fc84683dd99b47302d81fce399918 ]
    
    W=1 warns about null argument to kprintf:
    In file included from fs/9p/xattr.c:12:
    In function ‘v9fs_xattr_get’,
        inlined from ‘v9fs_listxattr’ at fs/9p/xattr.c:142:9:
    include/net/9p/9p.h:55:2: error: ‘%s’ directive argument is null
    [-Werror=format-overflow=]
       55 |  _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Use an empty string instead of :
     - this is ok 9p-wise because p9pdu_vwritef serializes a null string
    and an empty string the same way (one '0' word for length)
     - since this degrades the print statements, add new single quotes for
    xattr's name delimter (Old: "file = (null)", new: "file = ''")
    
    Link: https://lore.kernel.org/r/20231008060138.517057-1-suhui@nfschina.com
    Suggested-by: Su Hui <suhui@nfschina.com>
    Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
    Acked-by: Christian Schoenebeck <linux_oss@crudebyte.com>
    Message-ID: <20231025103445.1248103-2-asmadeus@codewreck.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c575076ba448755c7acba688d8a6cd5c2d6a772c
Author: Marco Elver <elver@google.com>
Date:   Wed Oct 25 19:34:43 2023 +0900

    9p/trans_fd: Annotate data-racy writes to file::f_flags
    
    [ Upstream commit 355f074609dbf3042900ea9d30fcd2b0c323a365 ]
    
    syzbot reported:
    
     | BUG: KCSAN: data-race in p9_fd_create / p9_fd_create
     |
     | read-write to 0xffff888130fb3d48 of 4 bytes by task 15599 on cpu 0:
     |  p9_fd_open net/9p/trans_fd.c:842 [inline]
     |  p9_fd_create+0x210/0x250 net/9p/trans_fd.c:1092
     |  p9_client_create+0x595/0xa70 net/9p/client.c:1010
     |  v9fs_session_init+0xf9/0xd90 fs/9p/v9fs.c:410
     |  v9fs_mount+0x69/0x630 fs/9p/vfs_super.c:123
     |  legacy_get_tree+0x74/0xd0 fs/fs_context.c:611
     |  vfs_get_tree+0x51/0x190 fs/super.c:1519
     |  do_new_mount+0x203/0x660 fs/namespace.c:3335
     |  path_mount+0x496/0xb30 fs/namespace.c:3662
     |  do_mount fs/namespace.c:3675 [inline]
     |  __do_sys_mount fs/namespace.c:3884 [inline]
     |  [...]
     |
     | read-write to 0xffff888130fb3d48 of 4 bytes by task 15563 on cpu 1:
     |  p9_fd_open net/9p/trans_fd.c:842 [inline]
     |  p9_fd_create+0x210/0x250 net/9p/trans_fd.c:1092
     |  p9_client_create+0x595/0xa70 net/9p/client.c:1010
     |  v9fs_session_init+0xf9/0xd90 fs/9p/v9fs.c:410
     |  v9fs_mount+0x69/0x630 fs/9p/vfs_super.c:123
     |  legacy_get_tree+0x74/0xd0 fs/fs_context.c:611
     |  vfs_get_tree+0x51/0x190 fs/super.c:1519
     |  do_new_mount+0x203/0x660 fs/namespace.c:3335
     |  path_mount+0x496/0xb30 fs/namespace.c:3662
     |  do_mount fs/namespace.c:3675 [inline]
     |  __do_sys_mount fs/namespace.c:3884 [inline]
     |  [...]
     |
     | value changed: 0x00008002 -> 0x00008802
    
    Within p9_fd_open(), O_NONBLOCK is added to f_flags of the read and
    write files. This may happen concurrently if e.g. mounting process
    modifies the fd in another thread.
    
    Mark the plain read-modify-writes as intentional data-races, with the
    assumption that the result of executing the accesses concurrently will
    always result in the same result despite the accesses themselves not
    being atomic.
    
    Reported-by: syzbot+e441aeeb422763cc5511@syzkaller.appspotmail.com
    Signed-off-by: Marco Elver <elver@google.com>
    Link: https://lore.kernel.org/r/ZO38mqkS0TYUlpFp@elver.google.com
    Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
    Message-ID: <20231025103445.1248103-1-asmadeus@codewreck.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d2500cd63c887ebe10b688a735b8370227596e82
Author: Hardik Gajjar <hgajjar@de.adit-jv.com>
Date:   Fri Oct 20 17:33:24 2023 +0200

    usb: gadget: f_ncm: Always set current gadget in ncm_bind()
    
    [ Upstream commit a04224da1f3424b2c607b12a3bd1f0e302fb8231 ]
    
    Previously, gadget assignment to the net device occurred exclusively
    during the initial binding attempt.
    
    Nevertheless, the gadget pointer could change during bind/unbind
    cycles due to various conditions, including the unloading/loading
    of the UDC device driver or the detachment/reconnection of an
    OTG-capable USB hub device.
    
    This patch relocates the gether_set_gadget() function out from
    ncm_opts->bound condition check, ensuring that the correct gadget
    is assigned during each bind request.
    
    The provided logs demonstrate the consistency of ncm_opts throughout
    the power cycle, while the gadget may change.
    
    * OTG hub connected during boot up and assignment of gadget and
      ncm_opts pointer
    
    [    2.366301] usb 2-1.5: New USB device found, idVendor=2996, idProduct=0105
    [    2.366304] usb 2-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [    2.366306] usb 2-1.5: Product: H2H Bridge
    [    2.366308] usb 2-1.5: Manufacturer: Aptiv
    [    2.366309] usb 2-1.5: SerialNumber: 13FEB2021
    [    2.427989] usb 2-1.5: New USB device found, VID=2996, PID=0105
    [    2.428959] dabridge 2-1.5:1.0: dabridge 2-4 total endpoints=5, 0000000093a8d681
    [    2.429710] dabridge 2-1.5:1.0: P(0105) D(22.06.22) F(17.3.16) H(1.1) high-speed
    [    2.429714] dabridge 2-1.5:1.0: Hub 2-2 P(0151) V(06.87)
    [    2.429956] dabridge 2-1.5:1.0: All downstream ports in host mode
    
    [    2.430093] gadget 000000003c414d59 ------> gadget pointer
    
    * NCM opts and associated gadget pointer during First ncm_bind
    
    [   34.763929] NCM opts 00000000aa304ac9
    [   34.763930] NCM gadget 000000003c414d59
    
    * OTG capable hub disconnecte or assume driver unload.
    
    [   97.203114] usb 2-1: USB disconnect, device number 2
    [   97.203118] usb 2-1.1: USB disconnect, device number 3
    [   97.209217] usb 2-1.5: USB disconnect, device number 4
    [   97.230990] dabr_udc deleted
    
    * Reconnect the OTG hub or load driver assaign new gadget pointer.
    
    [  111.534035] usb 2-1.1: New USB device found, idVendor=2996, idProduct=0120, bcdDevice= 6.87
    [  111.534038] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  111.534040] usb 2-1.1: Product: Vendor
    [  111.534041] usb 2-1.1: Manufacturer: Aptiv
    [  111.534042] usb 2-1.1: SerialNumber: Superior
    [  111.535175] usb 2-1.1: New USB device found, VID=2996, PID=0120
    [  111.610995] usb 2-1.5: new high-speed USB device number 8 using xhci-hcd
    [  111.630052] usb 2-1.5: New USB device found, idVendor=2996, idProduct=0105, bcdDevice=21.02
    [  111.630055] usb 2-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  111.630057] usb 2-1.5: Product: H2H Bridge
    [  111.630058] usb 2-1.5: Manufacturer: Aptiv
    [  111.630059] usb 2-1.5: SerialNumber: 13FEB2021
    [  111.687464] usb 2-1.5: New USB device found, VID=2996, PID=0105
    [  111.690375] dabridge 2-1.5:1.0: dabridge 2-8 total endpoints=5, 000000000d87c961
    [  111.691172] dabridge 2-1.5:1.0: P(0105) D(22.06.22) F(17.3.16) H(1.1) high-speed
    [  111.691176] dabridge 2-1.5:1.0: Hub 2-6 P(0151) V(06.87)
    [  111.691646] dabridge 2-1.5:1.0: All downstream ports in host mode
    
    [  111.692298] gadget 00000000dc72f7a9 --------> new gadget ptr on connect
    
    * NCM opts and associated gadget pointer during second ncm_bind
    
    [  113.271786] NCM opts 00000000aa304ac9 -----> same opts ptr used during first bind
    [  113.271788] NCM gadget 00000000dc72f7a9 ----> however new gaget ptr, that will not set
                                                     in net_device due to ncm_opts->bound = true
    
    Signed-off-by: Hardik Gajjar <hgajjar@de.adit-jv.com>
    Link: https://lore.kernel.org/r/20231020153324.82794-1-hgajjar@de.adit-jv.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f83810e0ecda73bdad2c94d2db60f58c0a158e7a
Author: Wesley Cheng <quic_wcheng@quicinc.com>
Date:   Thu Oct 19 13:29:24 2023 +0300

    usb: host: xhci: Avoid XHCI resume delay if SSUSB device is not present
    
    [ Upstream commit 6add6dd345cb754ce18ff992c7264cabf31e59f6 ]
    
    There is a 120ms delay implemented for allowing the XHCI host controller to
    detect a U3 wakeup pulse.  The intention is to wait for the device to retry
    the wakeup event if the USB3 PORTSC doesn't reflect the RESUME link status
    by the time it is checked.  As per the USB3 specification:
    
      tU3WakeupRetryDelay ("Table 7-12. LTSSM State Transition Timeouts")
    
    This would allow the XHCI resume sequence to determine if the root hub
    needs to be also resumed.  However, in case there is no device connected,
    or if there is only a HSUSB device connected, this delay would still affect
    the overall resume timing.
    
    Since this delay is solely for detecting U3 wake events (USB3 specific)
    then ignore this delay for the disconnected case and the HSUSB connected
    only case.
    
    [skip helper function, rename usb3_connected variable -Mathias ]
    
    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20231019102924.2797346-20-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b7b01c7804775cb3586fed3c71bc8c38fcc77000
Author: Zhiguo Niu <zhiguo.niu@unisoc.com>
Date:   Wed Oct 18 14:51:02 2023 +0800

    f2fs: fix error handling of __get_node_page
    
    [ Upstream commit 9b4c8dd99fe48721410741651d426015e03a4b7a ]
    
    Use f2fs_handle_error to record inconsistent node block error
    and return -EFSCORRUPTED instead of -EINVAL.
    
    Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0237975d8e3ec10c07b8169e22a6cea35afd8475
Author: Zhiguo Niu <zhiguo.niu@unisoc.com>
Date:   Mon Oct 16 19:27:31 2023 +0800

    f2fs: fix error path of __f2fs_build_free_nids
    
    [ Upstream commit a5e80e18f268ea7c7a36bc4159de0deb3b5a2171 ]
    
    If NAT is corrupted, let scan_nat_page() return EFSCORRUPTED, so that,
    caller can set SBI_NEED_FSCK flag into checkpoint for later repair by
    fsck.
    
    Also, this patch introduces a new fscorrupted error flag, and in above
    scenario, it will persist the error flag into superblock synchronously
    to avoid it has no luck to trigger a checkpoint to record SBI_NEED_FSCK
    
    Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
    Signed-off-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e69ec2352087d9b6f5bcf31dbd4c14028b74671a
Author: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Date:   Fri Oct 13 09:08:33 2023 +0800

    soundwire: dmi-quirks: update HP Omen match
    
    [ Upstream commit 4ea2b6d3128ea4d502c4015df0dc16b7d1070954 ]
    
    New platforms have a slightly different DMI product name, remove
    trailing characters/digits to handle all cases
    
    Closes: https://github.com/thesofproject/linux/issues/4611
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Reviewed-by: Rander Wang <rander.wang@intel.com>
    Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Link: https://lore.kernel.org/r/20231013010833.114271-1-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 13db7f133c615d46d0fc29f02568e881c7eae568
Author: Neil Armstrong <neil.armstrong@linaro.org>
Date:   Mon Oct 2 12:20:22 2023 +0200

    usb: ucsi: glink: use the connector orientation GPIO to provide switch events
    
    [ Upstream commit c6165ed2f425c273244191930a47c8be23bc51bd ]
    
    On SM8550, the non-altmode orientation is not given anymore within
    altmode events, even with USB SVIDs events.
    
    On the other side, the Type-C connector orientation is correctly
    reported by a signal from the PMIC.
    
    Take this gpio signal when we detect some Type-C port activity
    to notify any Type-C switches tied to the Type-C port connectors.
    
    Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20231002-topic-sm8550-upstream-type-c-orientation-v2-2-125410d3ff95@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a9876332a1bdfe6c606cab957bd901b3bce57899
Author: Stanley Chang <stanley_chang@realtek.com>
Date:   Tue Sep 12 12:19:02 2023 +0800

    usb: dwc3: core: configure TX/RX threshold for DWC3_IP
    
    [ Upstream commit e72fc8d6a12af7ae8dd1b52cf68ed68569d29f80 ]
    
    In Synopsys's dwc3 data book:
    To avoid underrun and overrun during the burst, in a high-latency bus
    system (like USB), threshold and burst size control is provided through
    GTXTHRCFG and GRXTHRCFG registers.
    
    In Realtek DHC SoC, DWC3 USB 3.0 uses AHB system bus. When dwc3 is
    connected with USB 2.5G Ethernet, there will be overrun problem.
    Therefore, setting TX/RX thresholds can avoid this issue.
    
    Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20230912041904.30721-1-stanley_chang@realtek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 77f1450464558279a5c22b5ecb41b74a5812b001
Author: Konrad Dybcio <konrad.dybcio@linaro.org>
Date:   Wed Sep 13 11:53:25 2023 +0200

    phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs
    
    [ Upstream commit 99a517a582fc1272d1d3cf3b9e671a14d7db77b8 ]
    
    The vendor kernel zeroes out all tuning data outside the init sequence
    as part of initialization. Follow suit to avoid UB.
    
    Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230830-topic-eusb2_override-v2-3-7d8c893d93f6@linaro.org
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 36cc3bd88636f261eb383e31a36d0bf16e2470ad
Author: Konrad Dybcio <konrad.dybcio@linaro.org>
Date:   Wed Sep 13 11:53:24 2023 +0200

    phy: qualcomm: phy-qcom-eusb2-repeater: Use regmap_fields
    
    [ Upstream commit 4ba2e52718c0ce4ece6a269bec84319c355c030f ]
    
    Switch to regmap_fields, so that the values written into registers are
    sanitized by their explicit sizes and the different registers are
    structured in an iterable object to make external changes to the init
    sequence simpler.
    
    Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230830-topic-eusb2_override-v2-2-7d8c893d93f6@linaro.org
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit de77703a0a81368a611598c89d67eaafe8c0fa78
Author: Konrad Dybcio <konrad.dybcio@linaro.org>
Date:   Wed Sep 13 11:53:23 2023 +0200

    dt-bindings: phy: qcom,snps-eusb2-repeater: Add magic tuning overrides
    
    [ Upstream commit c20b59b2996c89c4f072c3312e6210528a298330 ]
    
    The EUSB2 repeater requires some alterations to its init sequence,
    depending on board design.
    
    Add support for making the necessary changes to that sequence to make USB
    functional on SM8550-based Xperia 1 V.
    
    They all have lackluster description due to lack of information.
    
    Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Acked-by: Rob Herring <robh@kernel.org>
    Link: https://lore.kernel.org/r/20230830-topic-eusb2_override-v2-1-7d8c893d93f6@linaro.org
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8f8771757b130383732195497e47fba2aba76d3a
Author: Yi Yang <yiyang13@huawei.com>
Date:   Mon Sep 4 11:52:20 2023 +0800

    tty: vcc: Add check for kstrdup() in vcc_probe()
    
    [ Upstream commit d81ffb87aaa75f842cd7aa57091810353755b3e6 ]
    
    Add check for the return value of kstrdup() and return the error, if it
    fails in order to avoid NULL pointer dereference.
    
    Signed-off-by: Yi Yang <yiyang13@huawei.com>
    Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20230904035220.48164-1-yiyang13@huawei.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3097a09f08f0b055e773e64af0232e668a0a6425
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date:   Fri Aug 25 10:10:35 2023 +0300

    thunderbolt: Apply USB 3.x bandwidth quirk only in software connection manager
    
    [ Upstream commit 0c35ac18256942e66d8dab6ca049185812e60c69 ]
    
    This is not needed when firmware connection manager is run so limit this
    to software connection manager.
    
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5b82e4240533bcd4691e50b64ec86d0d7fbd21b9
Author: Zhang Shurong <zhang_shurong@foxmail.com>
Date:   Sat Jul 15 23:55:50 2023 +0800

    iio: adc: stm32-adc: harden against NULL pointer deref in stm32_adc_probe()
    
    [ Upstream commit 3a23b384e7e3d64d5587ad10729a34d4f761517e ]
    
    of_match_device() may fail and returns a NULL pointer.
    
    In practice there is no known reasonable way to trigger this, but
    in case one is added in future, harden the code by adding the check
    
    Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
    Link: https://lore.kernel.org/r/tencent_994DA85912C937E3B5405BA960B31ED90A08@qq.com
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6b1e61f7d07044563c497ea7320eb5c7ec446860
Author: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Date:   Mon Oct 2 11:33:44 2023 +0300

    mfd: intel-lpss: Add Intel Lunar Lake-M PCI IDs
    
    [ Upstream commit e53b22b10c6e0de0cf2a03a92b18fdad70f266c7 ]
    
    Add Intel Lunar Lake-M SoC PCI IDs.
    
    Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
    Link: https://lore.kernel.org/r/20231002083344.75611-1-jarkko.nikula@linux.intel.com
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e835d150b1a437ed516f8add3142173403e9f27c
Author: Yuezhang Mo <Yuezhang.Mo@sony.com>
Date:   Thu Jul 20 14:23:08 2023 +0800

    exfat: support handle zero-size directory
    
    [ Upstream commit dab48b8f2fe7264d51ec9eed0adea0fe3c78830a ]
    
    After repairing a corrupted file system with exfatprogs' fsck.exfat,
    zero-size directories may result. It is also possible to create
    zero-size directories in other exFAT implementation, such as Paragon
    ufsd dirver.
    
    As described in the specification, the lower directory size limits
    is 0 bytes.
    
    Without this commit, sub-directories and files cannot be created
    under a zero-size directory, and it cannot be removed.
    
    Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
    Reviewed-by: Andy Wu <Andy.Wu@sony.com>
    Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 802785faf1e72ba8a063cc1a8a67c77a9c67f3db
Author: Jiri Kosina <jkosina@suse.cz>
Date:   Fri Oct 27 15:32:09 2023 +0200

    HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W
    
    [ Upstream commit 62cc9c3cb3ec1bf31cc116146185ed97b450836a ]
    
    This device needs ALWAYS_POLL quirk, otherwise it keeps reconnecting
    indefinitely.
    
    Reported-by: Robert Ayrapetyan <robert.ayrapetyan@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c7f514e2663e402dbd612f93e76d96be055d4b27
Author: Longfang Liu <liulongfang@huawei.com>
Date:   Fri Oct 20 17:35:58 2023 +0800

    crypto: hisilicon/qm - prevent soft lockup in receive loop
    
    [ Upstream commit 33fc506d2ac514be1072499a263c3bff8c7c95a0 ]
    
    In the scenario where the accelerator business is fully loaded.
    When the workqueue receiving messages and performing callback
    processing, there are a large number of messages that need to be
    received, and there are continuously messages that have been
    processed and need to be received.
    This will cause the receive loop here to be locked for a long time.
    This scenario will cause watchdog timeout problems on OS with kernel
    preemption turned off.
    
    The error logs:
    watchdog: BUG: soft lockup - CPU#23 stuck for 23s! [kworker/u262:1:1407]
    [ 1461.978428][   C23] Call trace:
    [ 1461.981890][   C23]  complete+0x8c/0xf0
    [ 1461.986031][   C23]  kcryptd_async_done+0x154/0x1f4 [dm_crypt]
    [ 1461.992154][   C23]  sec_skcipher_callback+0x7c/0xf4 [hisi_sec2]
    [ 1461.998446][   C23]  sec_req_cb+0x104/0x1f4 [hisi_sec2]
    [ 1462.003950][   C23]  qm_poll_req_cb+0xcc/0x150 [hisi_qm]
    [ 1462.009531][   C23]  qm_work_process+0x60/0xc0 [hisi_qm]
    [ 1462.015101][   C23]  process_one_work+0x1c4/0x470
    [ 1462.020052][   C23]  worker_thread+0x150/0x3c4
    [ 1462.024735][   C23]  kthread+0x108/0x13c
    [ 1462.028889][   C23]  ret_from_fork+0x10/0x18
    
    Therefore, it is necessary to add an actively scheduled operation in the
    while loop to prevent this problem.
    After adding it, no matter whether the OS turns on or off the kernel
    preemption function. Neither will cause watchdog timeout issues.
    
    Signed-off-by: Longfang Liu <liulongfang@huawei.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 80be0425eef9aac8995097e1810334689db865e0
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Sat Oct 21 23:15:28 2023 +0200

    ASoC: Intel: soc-acpi-cht: Add Lenovo Yoga Tab 3 Pro YT3-X90 quirk
    
    [ Upstream commit 2cb54788393134d8174ee594002baae3ce52c61e ]
    
    The Lenovo Yoga Tab 3 Pro YT3-X90 x86 tablet, which ships with Android with
    a custom kernel as factory OS, does not list the used WM5102 codec inside
    its DSDT.
    
    Workaround this with a new snd_soc_acpi_intel_baytrail_machines[] entry
    which matches on the SST id instead of the codec id like nocodec does,
    combined with using a machine_quirk callback which returns NULL on
    other machines to skip the new entry on other machines.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20231021211534.114991-1-hdegoede@redhat.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 58c91b699c807673ecafe7c4ab10a727310970d5
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Tue Oct 10 15:44:28 2023 -0500

    PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk
    
    [ Upstream commit 04e82fa5951ca66495d7b05665eff673aa3852b4 ]
    
    Use FIELD_GET() to remove dependences on the field position, i.e., the
    shift value.  No functional change intended.
    
    Separate because this isn't as trivial as the other FIELD_GET() changes.
    
    See 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT
    Pulse")
    
    Link: https://lore.kernel.org/r/20231010204436.1000644-3-helgaas@kernel.org
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Cc: Nirmoy Das <nirmoy.das@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f22145b55283cea2096a3c91614668354380820f
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date:   Wed Oct 18 17:56:31 2023 +0900

    misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller
    
    [ Upstream commit 6c4b39937f4e65688ea294725ae432b2565821ff ]
    
    Add Renesas R8A779F0 in pci_device_id table so that pci-epf-test
    can be used for testing PCIe EP on R-Car S4-8.
    
    Link: https://lore.kernel.org/linux-pci/20231018085631.1121289-16-yoshihiro.shimoda.uh@renesas.com
    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Acked-by: Manivannan Sadhasivam <mani@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f3dda1cf33b481c22412002e5ee361aa6dbcbd75
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date:   Wed Oct 18 17:56:19 2023 +0900

    PCI: dwc: Add missing PCI_EXP_LNKCAP_MLW handling
    
    [ Upstream commit 89db0793c9f2da265ecb6c1681f899d9af157f37 ]
    
    Update dw_pcie_link_set_max_link_width() to set PCI_EXP_LNKCAP_MLW.
    
    In accordance with the DW PCIe RC/EP HW manuals [1,2,3,...] aside with
    the PORT_LINK_CTRL_OFF.LINK_CAPABLE and GEN2_CTRL_OFF.NUM_OF_LANES[8:0]
    field there is another one which needs to be updated.
    
    It's LINK_CAPABILITIES_REG.PCIE_CAP_MAX_LINK_WIDTH. If it isn't done at
    the very least the maximum link-width capability CSR won't expose the
    actual maximum capability.
    
    [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
        Version 4.60a, March 2015, p.1032
    [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
        Version 4.70a, March 2016, p.1065
    [3] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
        Version 4.90a, March 2016, p.1057
    ...
    [X] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint,
          Version 5.40a, March 2019, p.1396
    [X+1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
          Version 5.40a, March 2019, p.1266
    
    Suggested-by: Serge Semin <fancer.lancer@gmail.com>
    Link: https://lore.kernel.org/linux-pci/20231018085631.1121289-4-yoshihiro.shimoda.uh@renesas.com
    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e8bde5eb103c062a4cd195a5039b854bd2e210e9
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date:   Wed Oct 18 17:56:18 2023 +0900

    PCI: dwc: Add dw_pcie_link_set_max_link_width()
    
    [ Upstream commit a9a1bcba90254975d4adbcca53f720318cf81c0c ]
    
    This is a preparation before adding the Max-Link-width capability
    setup which would in its turn complete the max-link-width setup
    procedure defined by Synopsys in the HW-manual.
    
    Seeing there is a max-link-speed setup method defined in the DW PCIe
    core driver it would be good to have a similar function for the link
    width setup.
    
    That's why we need to define a dedicated function first from already
    implemented but incomplete link-width setting up code.
    
    Link: https://lore.kernel.org/linux-pci/20231018085631.1121289-3-yoshihiro.shimoda.uh@renesas.com
    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1edfc5bfdefa69a8a6d32314e2014398bbc034b9
Author: Bartosz Pawlowski <bartosz.pawlowski@intel.com>
Date:   Fri Sep 8 14:36:06 2023 +0000

    PCI: Disable ATS for specific Intel IPU E2000 devices
    
    [ Upstream commit a18615b1cfc04f00548c60eb9a77e0ce56e848fd ]
    
    Due to a hardware issue in A and B steppings of Intel IPU E2000, it expects
    wrong endianness in ATS invalidation message body. This problem can lead to
    outdated translations being returned as valid and finally cause system
    instability.
    
    To prevent such issues, add quirk_intel_e2000_no_ats() to disable ATS for
    vulnerable IPU E2000 devices.
    
    Link: https://lore.kernel.org/r/20230908143606.685930-3-bartosz.pawlowski@intel.com
    Signed-off-by: Bartosz Pawlowski <bartosz.pawlowski@intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d3ca6149eecc76000dbbc2c7ea32fae842a9cdb2
Author: Bartosz Pawlowski <bartosz.pawlowski@intel.com>
Date:   Fri Sep 8 14:36:05 2023 +0000

    PCI: Extract ATS disabling to a helper function
    
    [ Upstream commit f18b1137d38c091cc8c16365219f0a1d4a30b3d1 ]
    
    Introduce quirk_no_ats() helper function to provide a standard way to
    disable ATS capability in PCI quirks.
    
    Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20230908143606.685930-2-bartosz.pawlowski@intel.com
    Signed-off-by: Bartosz Pawlowski <bartosz.pawlowski@intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d4c5d6fc2b9cced824f3237d3df5534dae708dcc
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Tue Sep 19 15:56:46 2023 +0300

    PCI: Use FIELD_GET() to extract Link Width
    
    [ Upstream commit d1f9b39da4a5347150246871325190018cda8cb3 ]
    
    Use FIELD_GET() to extract PCIe Negotiated and Maximum Link Width fields
    instead of custom masking and shifting.
    
    Link: https://lore.kernel.org/r/20230919125648.1920-7-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    [bhelgaas: drop duplicate include of <linux/bitfield.h>]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6b9ecf4e1032e645873933e5b43cbb84cac19106
Author: Wenchao Hao <haowenchao2@huawei.com>
Date:   Wed Oct 11 21:03:50 2023 +0800

    scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()
    
    [ Upstream commit 4df105f0ce9f6f30cda4e99f577150d23f0c9c5f ]
    
    fc_lport_ptp_setup() did not check the return value of fc_rport_create()
    which can return NULL and would cause a NULL pointer dereference. Address
    this issue by checking return value of fc_rport_create() and log error
    message on fc_rport_create() failed.
    
    Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
    Link: https://lore.kernel.org/r/20231011130350.819571-1-haowenchao2@huawei.com
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit eaea9f7b44e1da79aaf1a651499b40b651a587b8
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Sep 11 15:53:52 2023 +0300

    PCI: Do error check on own line to split long "if" conditions
    
    [ Upstream commit d15f18053e5cc5576af9e7eef0b2a91169b6326d ]
    
    Placing PCI error code check inside "if" condition usually results in need
    to split lines. Combined with additional conditions the "if" condition
    becomes messy.
    
    Convert to the usual error handling pattern with an additional variable to
    improve code readability. In addition, reverse the logic in
    pci_find_vsec_capability() to get rid of &&.
    
    No functional changes intended.
    
    Link: https://lore.kernel.org/r/20230911125354.25501-5-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    [bhelgaas: PCI_POSSIBLE_ERROR()]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 142d999e660b0d27ceda485070123c69559b6eac
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Sep 11 15:53:51 2023 +0300

    atm: iphase: Do PCI error checks on own line
    
    [ Upstream commit c28742447ca9879b52fbaf022ad844f0ffcd749c ]
    
    In get_esi() PCI errors are checked inside line-split "if" conditions (in
    addition to the file not following the coding style). To make the code in
    get_esi() more readable, fix the coding style and use the usual error
    handling pattern with a separate variable.
    
    In addition, initialization of 'error' variable at declaration is not
    needed.
    
    No functional changes intended.
    
    Link: https://lore.kernel.org/r/20230911125354.25501-4-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 163a0a8b6fb5954ee06112034a796d39ef871613
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Tue Sep 19 15:56:45 2023 +0300

    PCI: mvebu: Use FIELD_PREP() with Link Width
    
    [ Upstream commit 408599ec561ad5862cda4f107626009f6fa97a74 ]
    
    mvebu_pcie_setup_hw() setups the Maximum Link Width field in the Link
    Capabilities registers using an open-coded variant of FIELD_PREP() with
    a literal in shift. Improve readability by using
    FIELD_PREP(PCI_EXP_LNKCAP_MLW, ...).
    
    Link: https://lore.kernel.org/r/20230919125648.1920-6-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b92d2f5ea852d740c577e01176d290171bc58b4a
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Tue Sep 19 15:56:44 2023 +0300

    PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields
    
    [ Upstream commit 759574abd78e3b47ec45bbd31a64e8832cf73f97 ]
    
    Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of
    custom masking and shifting.
    
    Similarly, change custom code that misleadingly used
    PCI_EXP_LNKSTA_NLW_SHIFT to prepare value for PCI_EXP_LNKCAP write
    to use FIELD_PREP() with correct field define (PCI_EXP_LNKCAP_MLW).
    
    Link: https://lore.kernel.org/r/20230919125648.1920-5-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b7d773ea9b202ff1038978f13c10425cd34bc560
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Fri Oct 6 15:46:24 2023 +0200

    gpiolib: of: Add quirk for mt2701-cs42448 ASoC sound
    
    [ Upstream commit 9e189e80dcb68528dea9e061d9704993f98cb84f ]
    
    These gpio names are due to old DT bindings not following the
    "-gpio"/"-gpios" conventions. Handle it using a quirk so the
    driver can just look up the GPIOs.
    
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/20231006-descriptors-asoc-mediatek-v1-1-07fe79f337f5@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a320da7f7cbdab2098b103c47f45d5061f42edd
Author: Cezary Rojewski <cezary.rojewski@intel.com>
Date:   Fri Oct 6 12:28:55 2023 +0200

    ALSA: hda: Fix possible null-ptr-deref when assigning a stream
    
    [ Upstream commit f93dc90c2e8ed664985e366aa6459ac83cdab236 ]
    
    While AudioDSP drivers assign streams exclusively of HOST or LINK type,
    nothing blocks a user to attempt to assign a COUPLED stream. As
    supplied substream instance may be a stub, what is the case when
    code-loading, such scenario ends with null-ptr-deref.
    
    Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
    Link: https://lore.kernel.org/r/20231006102857.749143-2-cezary.rojewski@intel.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b39764d0d2d6bc0384f7d9c8012551897032beb1
Author: Vincent Whitchurch <vincent.whitchurch@axis.com>
Date:   Mon Aug 21 08:45:21 2023 +0100

    ARM: 9320/1: fix stack depot IRQ stack filter
    
    [ Upstream commit b0150014878c32197cfa66e3e2f79e57f66babc0 ]
    
    Place IRQ handlers such as gic_handle_irq() in the irqentry section even
    if FUNCTION_GRAPH_TRACER is not enabled.  Without this, the stack
    depot's filter_irq_stacks() does not correctly filter out IRQ stacks in
    those configurations, which hampers deduplication and eventually leads
    to "Stack depot reached limit capacity" splats with KASAN.
    
    A similar fix was done for arm64 in commit f6794950f0e5ba37e3bbed
    ("arm64: set __exception_irq_entry with __irq_entry as a default").
    
    Link: https://lore.kernel.org/r/20230803-arm-irqentry-v1-1-8aad8e260b1c@axis.com
    
    Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 69f2af4db703f3332ba5a96f6eec3f3975dc3570
Author: Mikhail Khvainitski <me@khvoinitsky.org>
Date:   Sun Sep 24 01:58:30 2023 +0300

    HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround
    
    [ Upstream commit 46a0a2c96f0f47628190f122c2e3d879e590bcbe ]
    
    Built-in firmware of cptkbd handles scrolling by itself (when middle
    button is pressed) but with issues: it does not support horizontal and
    hi-res scrolling and upon middle button release it sends middle button
    click even if there was a scrolling event. Commit 3cb5ff0220e3 ("HID:
    lenovo: Hide middle-button press until release") workarounds last
    issue but it's impossible to workaround scrolling-related issues
    without firmware modification.
    
    Likely, Dennis Schneider has reverse engineered the firmware and
    provided an instruction on how to patch it [1]. However,
    aforementioned workaround prevents userspace (libinput) from knowing
    exact moment when middle button has been pressed down and performing
    "On-Button scrolling". This commit detects correctly-behaving patched
    firmware if cursor movement events has been received during middle
    button being pressed and stops applying workaround for this device.
    
    Link: https://hohlerde.org/rauch/en/elektronik/projekte/tpkbd-fix/ [1]
    
    Signed-off-by: Mikhail Khvainitski <me@khvoinitsky.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1708d0a9917fea579cc9da3d87b154285abd2cd8
Author: Manas Ghandat <ghandatmanas@gmail.com>
Date:   Wed Oct 4 13:10:40 2023 +0530

    jfs: fix array-index-out-of-bounds in diAlloc
    
    [ Upstream commit 05d9ea1ceb62a55af6727a69269a4fd310edf483 ]
    
    Currently there is not check against the agno of the iag while
    allocating new inodes to avoid fragmentation problem. Added the check
    which is required.
    
    Reported-by: syzbot+79d792676d8ac050949f@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=79d792676d8ac050949f
    Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 87c681ab49e99039ff2dd3e71852417381b13878
Author: Manas Ghandat <ghandatmanas@gmail.com>
Date:   Wed Oct 4 11:17:18 2023 +0530

    jfs: fix array-index-out-of-bounds in dbFindLeaf
    
    [ Upstream commit 22cad8bc1d36547cdae0eef316c47d917ce3147c ]
    
    Currently while searching for dmtree_t for sufficient free blocks there
    is an array out of bounds while getting element in tp->dm_stree. To add
    the required check for out of bound we first need to determine the type
    of dmtree. Thus added an extra parameter to dbFindLeaf so that the type
    of tree can be determined and the required check can be applied.
    
    Reported-by: syzbot+aea1ad91e854d0a83e04@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=aea1ad91e854d0a83e04
    Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2323de34a3ae61a9f9b544c18583f71cea86721f
Author: Juntong Deng <juntong.deng@outlook.com>
Date:   Wed Oct 4 02:06:41 2023 +0800

    fs/jfs: Add validity check for db_maxag and db_agpref
    
    [ Upstream commit 64933ab7b04881c6c18b21ff206c12278341c72e ]
    
    Both db_maxag and db_agpref are used as the index of the
    db_agfree array, but there is currently no validity check for
    db_maxag and db_agpref, which can lead to errors.
    
    The following is related bug reported by Syzbot:
    
    UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:639:20
    index 7936 is out of range for type 'atomic_t[128]'
    
    Add checking that the values of db_maxag and db_agpref are valid
    indexes for the db_agfree array.
    
    Reported-by: syzbot+38e876a8aa44b7115c76@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=38e876a8aa44b7115c76
    Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1a7c53fdea1d189087544d9a606d249e93c4934b
Author: Juntong Deng <juntong.deng@outlook.com>
Date:   Mon Oct 2 17:56:58 2023 +0800

    fs/jfs: Add check for negative db_l2nbperpage
    
    [ Upstream commit 525b861a008143048535011f3816d407940f4bfa ]
    
    l2nbperpage is log2(number of blks per page), and the minimum legal
    value should be 0, not negative.
    
    In the case of l2nbperpage being negative, an error will occur
    when subsequently used as shift exponent.
    
    Syzbot reported this bug:
    
    UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:799:12
    shift exponent -16777216 is negative
    
    Reported-by: syzbot+debee9ab7ae2b34b0307@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=debee9ab7ae2b34b0307
    Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8bbe784c2ff28d56ca0c548aaf3e584edc77052d
Author: Tyrel Datwyler <tyreld@linux.ibm.com>
Date:   Thu Sep 21 17:54:25 2023 -0500

    scsi: ibmvfc: Remove BUG_ON in the case of an empty event pool
    
    [ Upstream commit b39f2d10b86d0af353ea339e5815820026bca48f ]
    
    In practice the driver should never send more commands than are allocated
    to a queue's event pool. In the unlikely event that this happens, the code
    asserts a BUG_ON, and in the case that the kernel is not configured to
    crash on panic returns a junk event pointer from the empty event list
    causing things to spiral from there. This BUG_ON is a historical artifact
    of the ibmvfc driver first being upstreamed, and it is well known now that
    the use of BUG_ON is bad practice except in the most unrecoverable
    scenario. There is nothing about this scenario that prevents the driver
    from recovering and carrying on.
    
    Remove the BUG_ON in question from ibmvfc_get_event() and return a NULL
    pointer in the case of an empty event pool. Update all call sites to
    ibmvfc_get_event() to check for a NULL pointer and perfrom the appropriate
    failure or recovery action.
    
    Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
    Link: https://lore.kernel.org/r/20230921225435.3537728-2-tyreld@linux.ibm.com
    Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b4465009e7d60c6111946db4c8f1e50d401ed7be
Author: Yihang Li <liyihang9@huawei.com>
Date:   Wed Sep 13 10:15:25 2023 +0800

    scsi: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs
    
    [ Upstream commit 6de426f9276c448e2db7238911c97fb157cb23be ]
    
    If init debugfs failed during device registration due to memory allocation
    failure, debugfs_remove_recursive() is called, after which debugfs_dir is
    not set to NULL. debugfs_remove_recursive() will be called again during
    device removal. As a result, illegal pointer is accessed.
    
    [ 1665.467244] hisi_sas_v3_hw 0000:b4:02.0: failed to init debugfs!
    ...
    [ 1669.836708] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000a0
    [ 1669.872669] pc : down_write+0x24/0x70
    [ 1669.876315] lr : down_write+0x1c/0x70
    [ 1669.879961] sp : ffff000036f53a30
    [ 1669.883260] x29: ffff000036f53a30 x28: ffffa027c31549f8
    [ 1669.888547] x27: ffffa027c3140000 x26: 0000000000000000
    [ 1669.893834] x25: ffffa027bf37c270 x24: ffffa027bf37c270
    [ 1669.899122] x23: ffff0000095406b8 x22: ffff0000095406a8
    [ 1669.904408] x21: 0000000000000000 x20: ffffa027bf37c310
    [ 1669.909695] x19: 00000000000000a0 x18: ffff8027dcd86f10
    [ 1669.914982] x17: 0000000000000000 x16: 0000000000000000
    [ 1669.920268] x15: 0000000000000000 x14: ffffa0274014f870
    [ 1669.925555] x13: 0000000000000040 x12: 0000000000000228
    [ 1669.930842] x11: 0000000000000020 x10: 0000000000000bb0
    [ 1669.936129] x9 : ffff000036f537f0 x8 : ffff80273088ca10
    [ 1669.941416] x7 : 000000000000001d x6 : 00000000ffffffff
    [ 1669.946702] x5 : ffff000008a36310 x4 : ffff80273088be00
    [ 1669.951989] x3 : ffff000009513e90 x2 : 0000000000000000
    [ 1669.957276] x1 : 00000000000000a0 x0 : ffffffff00000001
    [ 1669.962563] Call trace:
    [ 1669.965000]  down_write+0x24/0x70
    [ 1669.968301]  debugfs_remove_recursive+0x5c/0x1b0
    [ 1669.972905]  hisi_sas_debugfs_exit+0x24/0x30 [hisi_sas_main]
    [ 1669.978541]  hisi_sas_v3_remove+0x130/0x150 [hisi_sas_v3_hw]
    [ 1669.984175]  pci_device_remove+0x48/0xd8
    [ 1669.988082]  device_release_driver_internal+0x1b4/0x250
    [ 1669.993282]  device_release_driver+0x28/0x38
    [ 1669.997534]  pci_stop_bus_device+0x84/0xb8
    [ 1670.001611]  pci_stop_and_remove_bus_device_locked+0x24/0x40
    [ 1670.007244]  remove_store+0xfc/0x140
    [ 1670.010802]  dev_attr_store+0x44/0x60
    [ 1670.014448]  sysfs_kf_write+0x58/0x80
    [ 1670.018095]  kernfs_fop_write+0xe8/0x1f0
    [ 1670.022000]  __vfs_write+0x60/0x190
    [ 1670.025472]  vfs_write+0xac/0x1c0
    [ 1670.028771]  ksys_write+0x6c/0xd8
    [ 1670.032071]  __arm64_sys_write+0x24/0x30
    [ 1670.035977]  el0_svc_common+0x78/0x130
    [ 1670.039710]  el0_svc_handler+0x38/0x78
    [ 1670.043442]  el0_svc+0x8/0xc
    
    To fix this, set debugfs_dir to NULL after debugfs_remove_recursive().
    
    Signed-off-by: Yihang Li <liyihang9@huawei.com>
    Signed-off-by: Xingui Yang <yangxingui@huawei.com>
    Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
    Link: https://lore.kernel.org/r/1694571327-78697-2-git-send-email-chenxiang66@hisilicon.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 69319be69f13c4b758a0cde1cb6d77f3fde190b5
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Tue Sep 19 15:56:41 2023 +0300

    RDMA/hfi1: Use FIELD_GET() to extract Link Width
    
    [ Upstream commit 8bf7187d978610b9e327a3d92728c8864a575ebd ]
    
    Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of
    custom masking and shifting, and remove extract_width() which only
    wraps that FIELD_GET().
    
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919125648.1920-2-ilpo.jarvinen@linux.intel.com
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Dean Luick <dean.luick@cornelisnetworks.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 424a8ca3c21ce16b551b7100eccd2e7eab7940e8
Author: Rander Wang <rander.wang@intel.com>
Date:   Tue Sep 19 12:24:16 2023 +0300

    ASoC: SOF: ipc4: handle EXCEPTION_CAUGHT notification from firmware
    
    [ Upstream commit c1c48fd6bbe788458e3685fea74bdb3cb148ff93 ]
    
    Driver will receive exception IPC message and process it by
    snd_sof_dsp_panic.
    
    Signed-off-by: Rander Wang <rander.wang@intel.com>
    Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919092416.4137-10-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 372636debe852913529b1716f44addd94fff2d28
Author: Lu Jialin <lujialin4@huawei.com>
Date:   Mon Sep 4 13:33:41 2023 +0000

    crypto: pcrypt - Fix hungtask for PADATA_RESET
    
    [ Upstream commit 8f4f68e788c3a7a696546291258bfa5fdb215523 ]
    
    We found a hungtask bug in test_aead_vec_cfg as follows:
    
    INFO: task cryptomgr_test:391009 blocked for more than 120 seconds.
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    Call trace:
     __switch_to+0x98/0xe0
     __schedule+0x6c4/0xf40
     schedule+0xd8/0x1b4
     schedule_timeout+0x474/0x560
     wait_for_common+0x368/0x4e0
     wait_for_completion+0x20/0x30
     wait_for_completion+0x20/0x30
     test_aead_vec_cfg+0xab4/0xd50
     test_aead+0x144/0x1f0
     alg_test_aead+0xd8/0x1e0
     alg_test+0x634/0x890
     cryptomgr_test+0x40/0x70
     kthread+0x1e0/0x220
     ret_from_fork+0x10/0x18
     Kernel panic - not syncing: hung_task: blocked tasks
    
    For padata_do_parallel, when the return err is 0 or -EBUSY, it will call
    wait_for_completion(&wait->completion) in test_aead_vec_cfg. In normal
    case, aead_request_complete() will be called in pcrypt_aead_serial and the
    return err is 0 for padata_do_parallel. But, when pinst->flags is
    PADATA_RESET, the return err is -EBUSY for padata_do_parallel, and it
    won't call aead_request_complete(). Therefore, test_aead_vec_cfg will
    hung at wait_for_completion(&wait->completion), which will cause
    hungtask.
    
    The problem comes as following:
    (padata_do_parallel)                 |
        rcu_read_lock_bh();              |
        err = -EINVAL;                   |   (padata_replace)
                                         |     pinst->flags |= PADATA_RESET;
        err = -EBUSY                     |
        if (pinst->flags & PADATA_RESET) |
            rcu_read_unlock_bh()         |
            return err
    
    In order to resolve the problem, we replace the return err -EBUSY with
    -EAGAIN, which means parallel_data is changing, and the caller should call
    it again.
    
    v3:
    remove retry and just change the return err.
    v2:
    introduce padata_try_do_parallel() in pcrypt_aead_encrypt and
    pcrypt_aead_decrypt to solve the hungtask.
    
    Signed-off-by: Lu Jialin <lujialin4@huawei.com>
    Signed-off-by: Guo Zihua <guozihua@huawei.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 66a492c7667e5abbd4e21e93b991a523d9735813
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Tue Sep 12 17:32:07 2023 +0100

    ASoC: cs35l56: Use PCI SSID as the firmware UID
    
    [ Upstream commit 1a1c3d794ef65ef2978c5e65e1aed3fe6f014e90 ]
    
    If the driver properties do not define a cirrus,firmware-uid try to get the
    PCI SSID as the UID.
    
    On PCI-based systems the PCI SSID is used to uniquely identify the specific
    sound hardware. This is the standard mechanism for x86 systems and is the
    way to get a unique system identifier for systems that use the CS35L56 on
    SoundWire.
    
    For non-SoundWire systems there is no Windows equivalent of the ASoC driver
    in I2C/SPI mode. These would be:
    
    1. HDA systems, which are handled by the HDA subsystem.
    2. Linux-specific systems.
    3. Composite devices where the cs35l56 is not present in ACPI and is
       configured using software nodes.
    
    Case 2 can use the firmware-uid property, though the PCI SSID is supported
    as an alternative, as it is the standard PCI mechanism.
    
    Case 3 is a SoundWire system where some other codec is the SoundWire bridge
    device and CS35L56 is not listed in ACPI. As these are SoundWire systems
    they will normally use the PCI SSID.
    
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230912163207.3498161-5-rf@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e9083128b156209d0d18e26b88adf680d069c60b
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Tue Sep 12 17:32:06 2023 +0100

    ASoC: Intel: sof_sdw: Copy PCI SSID to struct snd_soc_card
    
    [ Upstream commit d8b387544ff4d02eda1d1839a0c601de4b037c33 ]
    
    If the PCI SSID has been set in the struct snd_soc_acpi_mach_params,
    copy this to struct snd_soc_card so that it can be used by other
    ASoC components.
    
    This is important for components that must apply system-specific
    configuration.
    
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230912163207.3498161-4-rf@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 17560515ae9204a2fccc3b5c1e8a9cb3d3ca369a
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Tue Sep 12 17:32:05 2023 +0100

    ASoC: SOF: Pass PCI SSID to machine driver
    
    [ Upstream commit ba2de401d32625fe538d3f2c00ca73740dd2d516 ]
    
    Pass the PCI SSID of the audio interface through to the machine driver.
    This allows the machine driver to use the SSID to uniquely identify the
    specific hardware configuration and apply any platform-specific
    configuration.
    
    struct snd_sof_pdata is passed around inside the SOF code, but it then
    passes configuration information to the machine driver through
    struct snd_soc_acpi_mach and struct snd_soc_acpi_mach_params. So SSID
    information has been added to both snd_sof_pdata and
    snd_soc_acpi_mach_params.
    
    PCI does not define 0x0000 as an invalid value so we can't use zero to
    indicate that the struct member was not written. Instead a flag is
    included to indicate that a value has been written to the
    subsystem_vendor and subsystem_device members.
    
    sof_pci_probe() creates the struct snd_sof_pdata. It is passed a struct
    pci_dev so it can fill in the SSID value.
    
    sof_machine_check() finds the appropriate struct snd_soc_acpi_mach. It
    copies the SSID information across to the struct snd_soc_acpi_mach_params.
    This done before calling any custom set_mach_params() so that it could be
    used by the set_mach_params() callback to apply variant params.
    
    The machine driver receives the struct snd_soc_acpi_mach as its
    platform_data.
    
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230912163207.3498161-3-rf@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c766264e0e9e9a2f0f57b65ed0c98bab67cfdf2f
Author: Richard Fitzgerald <rf@opensource.cirrus.com>
Date:   Tue Sep 12 17:32:04 2023 +0100

    ASoC: soc-card: Add storage for PCI SSID
    
    [ Upstream commit 47f56e38a199bd45514b8e0142399cba4feeaf1a ]
    
    Add members to struct snd_soc_card to store the PCI subsystem ID (SSID)
    of the soundcard.
    
    The PCI specification provides two registers to store a vendor-specific
    SSID that can be read by drivers to uniquely identify a particular
    "soundcard". This is defined in the PCI specification to distinguish
    products that use the same silicon (and therefore have the same silicon
    ID) so that product-specific differences can be applied.
    
    PCI only defines 0xFFFF as an invalid value. 0x0000 is not defined as
    invalid. So the usual pattern of zero-filling the struct and then
    assuming a zero value unset will not work. A flag is included to
    indicate when the SSID information has been filled in.
    
    Unlike DMI information, which has a free-format entirely up to the vendor,
    the PCI SSID has a strictly defined format and a registry of vendor IDs.
    
    It is usual in Windows drivers that the SSID is used as the sole identifier
    of the specific end-product and the Windows driver contains tables mapping
    that to information about the hardware setup, rather than using ACPI
    properties.
    
    This SSID is important information for ASoC components that need to apply
    hardware-specific configuration on PCI-based systems.
    
    As the SSID is a generic part of the PCI specification and is treated as
    identifying the "soundcard", it is reasonable to include this information
    in struct snd_soc_card, instead of components inventing their own custom
    ways to pass this information around.
    
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230912163207.3498161-2-rf@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a3e98ceff6e9ee7e6f012e704f51af4cdfafc41a
Author: Trevor Wu <trevor.wu@mediatek.com>
Date:   Fri Aug 25 10:49:33 2023 +0800

    ASoC: mediatek: mt8188-mt6359: support dynamic pinctrl
    
    [ Upstream commit d601bb78f06b9e3cbb52e6b87b88add9920a11b6 ]
    
    To avoid power leakage, it is recommended to replace the default pinctrl
    state with dynamic pinctrl since certain audio pinmux functions can
    remain in a HIGH state even when audio is disabled. Linking pinctrl with
    DAPM using SND_SOC_DAPM_PINCTRL will ensure that audio pins remain in
    GPIO mode by default and only switch to an audio function when necessary.
    
    Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/20230825024935.10878-2-trevor.wu@mediatek.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 87215fbda37d5eceff83fa0e0003cd677cfda2fb
Author: zhujun2 <zhujun2@cmss.chinamobile.com>
Date:   Tue Oct 17 18:59:21 2023 -0700

    selftests/efivarfs: create-read: fix a resource leak
    
    [ Upstream commit 3f6f8a8c5e11a9b384a36df4f40f0c9a653b6975 ]
    
    The opened file should be closed in main(), otherwise resource
    leak will occur that this problem was discovered by code reading
    
    Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6b9b8904474dbc4774477e8caa2dac07c87ed994
Author: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Date:   Mon Sep 25 18:10:15 2023 +0300

    arm64: dts: ls208xa: use a pseudo-bus to constrain usb dma size
    
    [ Upstream commit b39d5016456871a88f5cd141914a5043591b46f3 ]
    
    Wrap the usb controllers in an intermediate simple-bus and use it to
    constrain the dma address size of these usb controllers to the 40b
    that they generate toward the interconnect. This is required because
    the SoC uses 48b address sizes and this mismatch would lead to smmu
    context faults [1] because the usb generates 40b addresses while the
    smmu page tables are populated with 48b wide addresses.
    
    [1]
    xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
    xhci-hcd xhci-hcd.0.auto: hcc params 0x0220f66d hci version 0x100 quirks 0x0000000002000010
    xhci-hcd xhci-hcd.0.auto: irq 108, io mem 0x03100000
    xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
    xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
    arm-smmu 5000000.iommu: Unhandled context fault: fsr=0x402, iova=0xffffffb000, fsynr=0x0, cbfrsynra=0xc01, cb=3
    
    Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e93c90f25fcee99881f902c9a98544feef2d5beb
Author: John Clark <inindev@gmail.com>
Date:   Wed Sep 6 01:23:05 2023 +0000

    arm64: dts: rockchip: Add NanoPC T6 PCIe e-key support
    
    [ Upstream commit ac76b786cc370b000c76f3115a5d2ee76ff05c08 ]
    
    before
    ~~~~
    0000:00:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
    0002:20:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
    0002:21:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
    0004:40:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
    0004:41:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
    
    after
    ~~~
    0000:00:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
    0002:20:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
    0002:21:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
    0003:30:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
    0003:31:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8822CE 802.11ac PCIe Wireless Network Adapter
    0004:40:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
    0004:41:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
    
    Signed-off-by: John Clark <inindev@gmail.com>
    Link: https://lore.kernel.org/r/20230906012305.7113-1-inindev@gmail.com
    Signed-off-by: Heiko Stuebner <heiko@sntech.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bce7b184f2698a2bdf73156d0256bf8cef36a4ed
Author: Lu Hongfei <luhongfei@vivo.com>
Date:   Mon Jun 12 21:34:52 2023 +0800

    soc: qcom: pmic: Fix resource leaks in a device_for_each_child_node() loop
    
    [ Upstream commit 5692aeea5bcb9331e956628c3bc8fc9afcc9765d ]
    
    The device_for_each_child_node loop should call fwnode_handle_put()
    before return in the error cases, to avoid resource leaks.
    
    Let's fix this bug in pmic_glink_altmode_probe().
    
    Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
    Link: https://lore.kernel.org/r/20230612133452.47315-1-luhongfei@vivo.com
    [bjorn: Rebased patch, moved fw_handle_put() from jump target into the loop]
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 09f617219fe9ccd8d7b65dc3e879b5889f663b5a
Author: Lin.Cao <lincao12@amd.com>
Date:   Wed Oct 25 11:32:41 2023 +0800

    drm/amd: check num of link levels when update pcie param
    
    [ Upstream commit 406e8845356d18bdf3d3a23b347faf67706472ec ]
    
    In SR-IOV environment, the value of pcie_table->num_of_link_levels will
    be 0, and num_of_levels - 1 will cause array index out of bounds
    
    Signed-off-by: Lin.Cao <lincao12@amd.com>
    Acked-by: Jingwen Chen <Jingwen.Chen2@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b58ace0e8c981ab884d5014369aea9f3d611d5e4
Author: Samson Tam <samson.tam@amd.com>
Date:   Thu Oct 5 01:31:12 2023 -0400

    drm/amd/display: fix num_ways overflow error
    
    [ Upstream commit 79f3f1b66753b3a3a269d73676bf50987921f267 ]
    
    [Why]
    Helper function calculates num_ways using 32-bit.  But is
     returned as 8-bit.  If num_ways exceeds 8-bit, then it
     reports back the incorrect num_ways and erroneously
     uses MALL when it should not
    
    [How]
    Make returned value 32-bit and convert after it checks
     against caps.cache_num_ways, which is under 8-bit
    
    Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
    Acked-by: Roman Li <roman.li@amd.com>
    Signed-off-by: Samson Tam <samson.tam@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 745682e634ca92b3704991ae7b5abb0798e1571e
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Mon Oct 23 15:42:00 2023 -0500

    drm/amd: Disable PP_PCIE_DPM_MASK when dynamic speed switching not supported
    
    [ Upstream commit fbf1035b033a51eee48d5f42e781b02fff272ca0 ]
    
    Rather than individual ASICs checking for the quirk, set the quirk at the
    driver level.
    
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ba3c0796d292de84f2932cc5bbb0f771fc720996
Author: Qu Huang <qu.huang@linux.dev>
Date:   Mon Oct 23 12:56:37 2023 +0000

    drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
    
    [ Upstream commit 5104fdf50d326db2c1a994f8b35dcd46e63ae4ad ]
    
    In certain types of chips, such as VEGA20, reading the amdgpu_regs_smc file could result in an abnormal null pointer access when the smc_rreg pointer is NULL. Below are the steps to reproduce this issue and the corresponding exception log:
    
    1. Navigate to the directory: /sys/kernel/debug/dri/0
    2. Execute command: cat amdgpu_regs_smc
    3. Exception Log::
    [4005007.702554] BUG: kernel NULL pointer dereference, address: 0000000000000000
    [4005007.702562] #PF: supervisor instruction fetch in kernel mode
    [4005007.702567] #PF: error_code(0x0010) - not-present page
    [4005007.702570] PGD 0 P4D 0
    [4005007.702576] Oops: 0010 [#1] SMP NOPTI
    [4005007.702581] CPU: 4 PID: 62563 Comm: cat Tainted: G           OE     5.15.0-43-generic #46-Ubunt       u
    [4005007.702590] RIP: 0010:0x0
    [4005007.702598] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
    [4005007.702600] RSP: 0018:ffffa82b46d27da0 EFLAGS: 00010206
    [4005007.702605] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffa82b46d27e68
    [4005007.702609] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff9940656e0000
    [4005007.702612] RBP: ffffa82b46d27dd8 R08: 0000000000000000 R09: ffff994060c07980
    [4005007.702615] R10: 0000000000020000 R11: 0000000000000000 R12: 00007f5e06753000
    [4005007.702618] R13: ffff9940656e0000 R14: ffffa82b46d27e68 R15: 00007f5e06753000
    [4005007.702622] FS:  00007f5e0755b740(0000) GS:ffff99479d300000(0000) knlGS:0000000000000000
    [4005007.702626] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [4005007.702629] CR2: ffffffffffffffd6 CR3: 00000003253fc000 CR4: 00000000003506e0
    [4005007.702633] Call Trace:
    [4005007.702636]  <TASK>
    [4005007.702640]  amdgpu_debugfs_regs_smc_read+0xb0/0x120 [amdgpu]
    [4005007.703002]  full_proxy_read+0x5c/0x80
    [4005007.703011]  vfs_read+0x9f/0x1a0
    [4005007.703019]  ksys_read+0x67/0xe0
    [4005007.703023]  __x64_sys_read+0x19/0x20
    [4005007.703028]  do_syscall_64+0x5c/0xc0
    [4005007.703034]  ? do_user_addr_fault+0x1e3/0x670
    [4005007.703040]  ? exit_to_user_mode_prepare+0x37/0xb0
    [4005007.703047]  ? irqentry_exit_to_user_mode+0x9/0x20
    [4005007.703052]  ? irqentry_exit+0x19/0x30
    [4005007.703057]  ? exc_page_fault+0x89/0x160
    [4005007.703062]  ? asm_exc_page_fault+0x8/0x30
    [4005007.703068]  entry_SYSCALL_64_after_hwframe+0x44/0xae
    [4005007.703075] RIP: 0033:0x7f5e07672992
    [4005007.703079] Code: c0 e9 b2 fe ff ff 50 48 8d 3d fa b2 0c 00 e8 c5 1d 02 00 0f 1f 44 00 00 f3 0f        1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 e       c 28 48 89 54 24
    [4005007.703083] RSP: 002b:00007ffe03097898 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
    [4005007.703088] RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007f5e07672992
    [4005007.703091] RDX: 0000000000020000 RSI: 00007f5e06753000 RDI: 0000000000000003
    [4005007.703094] RBP: 00007f5e06753000 R08: 00007f5e06752010 R09: 00007f5e06752010
    [4005007.703096] R10: 0000000000000022 R11: 0000000000000246 R12: 0000000000022000
    [4005007.703099] R13: 0000000000000003 R14: 0000000000020000 R15: 0000000000020000
    [4005007.703105]  </TASK>
    [4005007.703107] Modules linked in: nf_tables libcrc32c nfnetlink algif_hash af_alg binfmt_misc nls_       iso8859_1 ipmi_ssif ast intel_rapl_msr intel_rapl_common drm_vram_helper drm_ttm_helper amd64_edac t       tm edac_mce_amd kvm_amd ccp mac_hid k10temp kvm acpi_ipmi ipmi_si rapl sch_fq_codel ipmi_devintf ipm       i_msghandler msr parport_pc ppdev lp parport mtd pstore_blk efi_pstore ramoops pstore_zone reed_solo       mon ip_tables x_tables autofs4 ib_uverbs ib_core amdgpu(OE) amddrm_ttm_helper(OE) amdttm(OE) iommu_v       2 amd_sched(OE) amdkcl(OE) drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec rc_core        drm igb ahci xhci_pci libahci i2c_piix4 i2c_algo_bit xhci_pci_renesas dca
    [4005007.703184] CR2: 0000000000000000
    [4005007.703188] ---[ end trace ac65a538d240da39 ]---
    [4005007.800865] RIP: 0010:0x0
    [4005007.800871] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
    [4005007.800874] RSP: 0018:ffffa82b46d27da0 EFLAGS: 00010206
    [4005007.800878] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffa82b46d27e68
    [4005007.800881] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff9940656e0000
    [4005007.800883] RBP: ffffa82b46d27dd8 R08: 0000000000000000 R09: ffff994060c07980
    [4005007.800886] R10: 0000000000020000 R11: 0000000000000000 R12: 00007f5e06753000
    [4005007.800888] R13: ffff9940656e0000 R14: ffffa82b46d27e68 R15: 00007f5e06753000
    [4005007.800891] FS:  00007f5e0755b740(0000) GS:ffff99479d300000(0000) knlGS:0000000000000000
    [4005007.800895] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [4005007.800898] CR2: ffffffffffffffd6 CR3: 00000003253fc000 CR4: 00000000003506e0
    
    Signed-off-by: Qu Huang <qu.huang@linux.dev>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 56649c43d40ce0147465a2d5756d300e87f9ee1c
Author: Jesse Zhang <jesse.zhang@amd.com>
Date:   Fri Oct 20 09:43:51 2023 +0800

    drm/amdkfd: Fix shift out-of-bounds issue
    
    [ Upstream commit 282c1d793076c2edac6c3db51b7e8ed2b41d60a5 ]
    
    [  567.613292] shift exponent 255 is too large for 64-bit type 'long unsigned int'
    [  567.614498] CPU: 5 PID: 238 Comm: kworker/5:1 Tainted: G           OE      6.2.0-34-generic #34~22.04.1-Ubuntu
    [  567.614502] Hardware name: AMD Splinter/Splinter-RPL, BIOS WS43927N_871 09/25/2023
    [  567.614504] Workqueue: events send_exception_work_handler [amdgpu]
    [  567.614748] Call Trace:
    [  567.614750]  <TASK>
    [  567.614753]  dump_stack_lvl+0x48/0x70
    [  567.614761]  dump_stack+0x10/0x20
    [  567.614763]  __ubsan_handle_shift_out_of_bounds+0x156/0x310
    [  567.614769]  ? srso_alias_return_thunk+0x5/0x7f
    [  567.614773]  ? update_sd_lb_stats.constprop.0+0xf2/0x3c0
    [  567.614780]  svm_range_split_by_granularity.cold+0x2b/0x34 [amdgpu]
    [  567.615047]  ? srso_alias_return_thunk+0x5/0x7f
    [  567.615052]  svm_migrate_to_ram+0x185/0x4d0 [amdgpu]
    [  567.615286]  do_swap_page+0x7b6/0xa30
    [  567.615291]  ? srso_alias_return_thunk+0x5/0x7f
    [  567.615294]  ? __free_pages+0x119/0x130
    [  567.615299]  handle_pte_fault+0x227/0x280
    [  567.615303]  __handle_mm_fault+0x3c0/0x720
    [  567.615311]  handle_mm_fault+0x119/0x330
    [  567.615314]  ? lock_mm_and_find_vma+0x44/0x250
    [  567.615318]  do_user_addr_fault+0x1a9/0x640
    [  567.615323]  exc_page_fault+0x81/0x1b0
    [  567.615328]  asm_exc_page_fault+0x27/0x30
    [  567.615332] RIP: 0010:__get_user_8+0x1c/0x30
    
    Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
    Suggested-by: Philip Yang <Philip.Yang@amd.com>
    Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 1afe397315a8cbdfde070bf815c67dd5c4e6ee77
Author: Ondrej Jirman <megi@xff.cz>
Date:   Sat Feb 11 18:17:48 2023 +0100

    drm/panel: st7703: Pick different reset sequence
    
    [ Upstream commit d12d635bb03c7cb4830acb641eb176ee9ff2aa89 ]
    
    Switching to a different reset sequence, enabling IOVCC before enabling
    VCC.
    
    There also needs to be a delay after enabling the supplies and before
    deasserting the reset. The datasheet specifies 1ms after the supplies
    reach the required voltage. Use 10-20ms to also give the power supplies
    some time to reach the required voltage, too.
    
    This fixes intermittent panel initialization failures and screen
    corruption during resume from sleep on panel xingbangda,xbd599 (e.g.
    used in PinePhone).
    
    Signed-off-by: Ondrej Jirman <megi@xff.cz>
    Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
    Reported-by: Samuel Holland <samuel@sholland.org>
    Reviewed-by: Guido Günther <agx@sigxcpu.org>
    Tested-by: Guido Günther <agx@sigxcpu.org>
    Signed-off-by: Guido Günther <agx@sigxcpu.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230211171748.36692-2-frank@oltmanns.dev
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 70f831f21155c692bb336c434936fd6f24f3f81a
Author: Ma Ke <make_ruc2021@163.com>
Date:   Fri Oct 13 09:53:43 2023 +0800

    drm/amdgpu/vkms: fix a possible null pointer dereference
    
    [ Upstream commit cd90511557fdfb394bb4ac4c3b539b007383914c ]
    
    In amdgpu_vkms_conn_get_modes(), the return value of drm_cvt_mode()
    is assigned to mode, which will lead to a NULL pointer dereference
    on failure of drm_cvt_mode(). Add a check to avoid null pointer
    dereference.
    
    Signed-off-by: Ma Ke <make_ruc2021@163.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c0fe7aacc32e482d78b5e1eb30e3b6270c47298b
Author: Ma Ke <make_ruc2021@163.com>
Date:   Wed Oct 11 09:21:43 2023 +0800

    drm/radeon: fix a possible null pointer dereference
    
    [ Upstream commit 2c1fe3c480f9e1deefd50d4b18be4a046011ee1f ]
    
    In radeon_tv_get_modes(), the return value of drm_cvt_mode()
    is assigned to mode, which will lead to a NULL pointer
    dereference on failure of drm_cvt_mode(). Add a check to
    avoid null point dereference.
    
    Signed-off-by: Ma Ke <make_ruc2021@163.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit eaede6900c0961b072669d6bd97fe8f90ed1900f
Author: Ma Ke <make_ruc2021@163.com>
Date:   Mon Oct 9 17:04:46 2023 +0800

    drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference
    
    [ Upstream commit f22def5970c423ea7f87d5247bd0ef91416b0658 ]
    
    In tpg110_get_modes(), the return value of drm_mode_duplicate() is
    assigned to mode, which will lead to a NULL pointer dereference on
    failure of drm_mode_duplicate(). Add a check to avoid npd.
    
    Signed-off-by: Ma Ke <make_ruc2021@163.com>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://lore.kernel.org/r/20231009090446.4043798-1-make_ruc2021@163.com
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231009090446.4043798-1-make_ruc2021@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8a9dd36fcb4f3906982b82593393578db4479992
Author: Ma Ke <make_ruc2021@163.com>
Date:   Sat Oct 7 11:31:05 2023 +0800

    drm/panel: fix a possible null pointer dereference
    
    [ Upstream commit 924e5814d1f84e6fa5cb19c6eceb69f066225229 ]
    
    In versatile_panel_get_modes(), the return value of drm_mode_duplicate()
    is assigned to mode, which will lead to a NULL pointer dereference
    on failure of drm_mode_duplicate(). Add a check to avoid npd.
    
    Signed-off-by: Ma Ke <make_ruc2021@163.com>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://lore.kernel.org/r/20231007033105.3997998-1-make_ruc2021@163.com
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231007033105.3997998-1-make_ruc2021@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit da46e63482fdc5e35c008865c22ac64027f6f0c2
Author: Stanley.Yang <Stanley.Yang@amd.com>
Date:   Wed Sep 27 16:22:29 2023 +0800

    drm/amdgpu: Fix potential null pointer derefernce
    
    [ Upstream commit 80285ae1ec8717b597b20de38866c29d84d321a1 ]
    
    The amdgpu_ras_get_context may return NULL if device
    not support ras feature, so add check before using.
    
    Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
    Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b3b8b7c040cf069da7afe11c5bd73b870b8f3d18
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Wed Oct 4 15:46:44 2023 -0500

    drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga
    
    [ Upstream commit 0f0e59075b5c22f1e871fbd508d6e4f495048356 ]
    
    For pptable structs that use flexible array sizes, use flexible arrays.
    
    Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2036742
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 92a775e7c9707aed28782bafe636bf87675f5a97
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Wed Oct 4 15:22:52 2023 -0500

    drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7
    
    [ Upstream commit 760efbca74a405dc439a013a5efaa9fadc95a8c3 ]
    
    For pptable structs that use flexible array sizes, use flexible arrays.
    
    Suggested-by: Felix Held <felix.held@amd.com>
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2874
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ea1e7d6fdc5e4452e78f73bd59fdad24e0b452b1
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Fri Sep 1 17:20:34 2023 +0300

    drm/msm/dp: skip validity check for DP CTS EDID checksum
    
    [ Upstream commit a251c9d8e30833b260101edb9383b176ee2b7cb1 ]
    
    The DP CTS test for EDID last block checksum expects the checksum for
    the last block, invalid or not. Skip the validity check.
    
    For the most part (*), the EDIDs returned by drm_get_edid() will be
    valid anyway, and there's the CTS workaround to get the checksum for
    completely invalid EDIDs. See commit 7948fe12d47a ("drm/msm/dp: return
    correct edid checksum after corrupted edid checksum read").
    
    This lets us remove one user of drm_edid_block_valid() with hopes the
    function can be removed altogether in the future.
    
    (*) drm_get_edid() ignores checksum errors on CTA extensions.
    
    Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Cc: Kuogee Hsieh <khsieh@codeaurora.org>
    Cc: Marijn Suijten <marijn.suijten@somainline.org>
    Cc: Rob Clark <robdclark@gmail.com>
    Cc: Sean Paul <sean@poorly.run>
    Cc: Stephen Boyd <swboyd@chromium.org>
    Cc: linux-arm-msm@vger.kernel.org
    Cc: freedreno@lists.freedesktop.org
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
    Patchwork: https://patchwork.freedesktop.org/patch/555361/
    Link: https://lore.kernel.org/r/20230901142034.580802-1-jani.nikula@intel.com
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 21e29f1437b7c36c76efa908589578eaf0f50900
Author: Philipp Stanner <pstanner@redhat.com>
Date:   Wed Sep 20 14:36:13 2023 +0200

    drm: vmwgfx_surface.c: copy user-array safely
    
    [ Upstream commit 06ab64a0d836ac430c5f94669710a78aa43942cb ]
    
    Currently, there is no overflow-check with memdup_user().
    
    Use the new function memdup_array_user() instead of memdup_user() for
    duplicating the user-space array safely.
    
    Suggested-by: David Airlie <airlied@redhat.com>
    Signed-off-by: Philipp Stanner <pstanner@redhat.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Zack Rusin <zackr@vmware.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230920123612.16914-7-pstanner@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ea42bc330723644a0bd01d7124a601ab60b27747
Author: Philipp Stanner <pstanner@redhat.com>
Date:   Wed Sep 20 14:36:12 2023 +0200

    drm_lease.c: copy user-array safely
    
    [ Upstream commit f37d63e219c39199a59b8b8a211412ff27192830 ]
    
    Currently, there is no overflow-check with memdup_user().
    
    Use the new function memdup_array_user() instead of memdup_user() for
    duplicating the user-space array safely.
    
    Suggested-by: David Airlie <airlied@redhat.com>
    Signed-off-by: Philipp Stanner <pstanner@redhat.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Zack Rusin <zackr@vmware.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230920123612.16914-6-pstanner@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0f403ebad98e6151aaa9c96c9aae5549aa4d87cd
Author: Philipp Stanner <pstanner@redhat.com>
Date:   Wed Sep 20 14:36:11 2023 +0200

    kernel: watch_queue: copy user-array safely
    
    [ Upstream commit ca0776571d3163bd03b3e8c9e3da936abfaecbf6 ]
    
    Currently, there is no overflow-check with memdup_user().
    
    Use the new function memdup_array_user() instead of memdup_user() for
    duplicating the user-space array safely.
    
    Suggested-by: David Airlie <airlied@redhat.com>
    Signed-off-by: Philipp Stanner <pstanner@redhat.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Zack Rusin <zackr@vmware.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230920123612.16914-5-pstanner@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4fc857cc5cb9b7ce6940898857d773564973a584
Author: Philipp Stanner <pstanner@redhat.com>
Date:   Wed Sep 20 14:36:10 2023 +0200

    kernel: kexec: copy user-array safely
    
    [ Upstream commit 569c8d82f95eb5993c84fb61a649a9c4ddd208b3 ]
    
    Currently, there is no overflow-check with memdup_user().
    
    Use the new function memdup_array_user() instead of memdup_user() for
    duplicating the user-space array safely.
    
    Suggested-by: David Airlie <airlied@redhat.com>
    Signed-off-by: Philipp Stanner <pstanner@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Zack Rusin <zackr@vmware.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230920123612.16914-4-pstanner@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b105ed9c92df9f940de61492e97191a5f71edb4e
Author: Philipp Stanner <pstanner@redhat.com>
Date:   Wed Sep 20 14:36:09 2023 +0200

    string.h: add array-wrappers for (v)memdup_user()
    
    [ Upstream commit 313ebe47d75558511aa1237b6e35c663b5c0ec6f ]
    
    Currently, user array duplications are sometimes done without an
    overflow check. Sometimes the checks are done manually; sometimes the
    array size is calculated with array_size() and sometimes by calculating
    n * size directly in code.
    
    Introduce wrappers for arrays for memdup_user() and vmemdup_user() to
    provide a standardized and safe way for duplicating user arrays.
    
    This is both for new code as well as replacing usage of (v)memdup_user()
    in existing code that uses, e.g., n * size to calculate array sizes.
    
    Suggested-by: David Airlie <airlied@redhat.com>
    Signed-off-by: Philipp Stanner <pstanner@redhat.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Zack Rusin <zackr@vmware.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230920123612.16914-3-pstanner@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit dec0a70e528256084c5c6cd1384e309531b631a6
Author: Wenjing Liu <wenjing.liu@amd.com>
Date:   Thu Sep 21 14:43:21 2023 -0400

    drm/amd/display: use full update for clip size increase of large plane source
    
    [ Upstream commit 05b78277ef0efc1deebc8a22384fffec29a3676e ]
    
    [why]
    Clip size increase will increase viewport, which could cause us to
    switch  to MPC combine.
    If we skip full update, we are not able to change to MPC combine in
    fast update. This will cause corruption showing on the video plane.
    
    [how]
    treat clip size increase of a surface larger than 5k as a full update.
    
    Reviewed-by: Jun Lei <jun.lei@amd.com>
    Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 82c4cf2c0596ffd5fe59f713906691df325ca916
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Fri Sep 29 22:12:18 2023 -0500

    drm/amd: Update `update_pcie_parameters` functions to use uint8_t arguments
    
    [ Upstream commit 7752ccf85b929a22e658ec145283e8f31232f4bb ]
    
    The matching values for `pcie_gen_cap` and `pcie_width_cap` when
    fetched from powerplay tables are 1 byte, so narrow the arguments
    to match to ensure min() and max() comparisons without casts.
    
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Acked-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b39f1303b9596039a90da419b7057e607d54ac46
Author: Tao Zhou <tao.zhou1@amd.com>
Date:   Wed Sep 27 18:02:29 2023 +0800

    drm/amdgpu: update retry times for psp vmbx wait
    
    [ Upstream commit fc598890715669ff794b253fdf387cd02b9396f8 ]
    
    Increase the retry loops and replace the constant number with macro.
    
    Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
    Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fc0210720127cc6302e6d6f3de48f49c3fcf5659
Author: Xiaogang Chen <xiaogang.chen@amd.com>
Date:   Wed Sep 27 11:20:28 2023 -0500

    drm/amdkfd: Fix a race condition of vram buffer unref in svm code
    
    [ Upstream commit 709c348261618da7ed89d6c303e2ceb9e453ba74 ]
    
    prange->svm_bo unref can happen in both mmu callback and a callback after
    migrate to system ram. Both are async call in different tasks. Sync svm_bo
    unref operation to avoid random "use-after-free".
    
    Signed-off-by: Xiaogang Chen <xiaogang.chen@amd.com>
    Reviewed-by: Philip Yang <Philip.Yang@amd.com>
    Reviewed-by: Jesse Zhang <Jesse.Zhang@amd.com>
    Tested-by: Jesse Zhang <Jesse.Zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0a810a3fc67ed4122c0d087af93db57049140636
Author: David (Ming Qiang) Wu <David.Wu3@amd.com>
Date:   Thu Sep 14 16:34:08 2023 -0400

    drm/amdgpu: not to save bo in the case of RAS err_event_athub
    
    [ Upstream commit fa1f1cc09d588a90c8ce3f507c47df257461d148 ]
    
    err_event_athub will corrupt VCPU buffer and not good to
    be restored in amdgpu_vcn_resume() and in this case
    the VCPU buffer needs to be cleared for VCN firmware to
    work properly.
    
    Acked-by: Leo Liu <leo.liu@amd.com>
    Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 20c2d2c323bcdcd3c1e9fbf67a0f5e77cb094a14
Author: Yu Kuai <yukuai3@huawei.com>
Date:   Fri Aug 25 11:09:52 2023 +0800

    md: don't rely on 'mddev->pers' to be set in mddev_suspend()
    
    [ Upstream commit b721e7885eb242aa2459ee66bb42ceef1bcf0f0c ]
    
    'active_io' used to be initialized while the array is running, and
    'mddev->pers' is set while the array is running as well. Hence caller
    must hold 'reconfig_mutex' and guarantee 'mddev->pers' is set before
    calling mddev_suspend().
    
    Now that 'active_io' is initialized when mddev is allocated, such
    restriction doesn't exist anymore. In the meantime, follow up patches
    will refactor mddev_suspend(), hence add checking for 'mddev->pers' to
    prevent null-ptr-deref.
    
    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    Signed-off-by: Song Liu <song@kernel.org>
    Link: https://lore.kernel.org/r/20230825030956.1527023-4-yukuai1@huaweicloud.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d78c4efaeb2d9ad53545e28460adda0685d80ae4
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Thu Sep 21 00:19:33 2023 +0300

    drm/edid: Fixup h/vsync_end instead of h/vtotal
    
    [ Upstream commit 2682768bde745b10ae126a322cdcaf532cf88851 ]
    
    There are some weird EDIDs floating around that have the sync
    pulse extending beyond the end of the blanking period.
    
    On the currently problemtic machine (HP Omni 120) EDID reports
    the following mode:
    "1600x900": 60 108000 1600 1780 1860 1800 900 910 913 1000 0x40 0x5
    which is then "corrected" to have htotal=1861 by the current drm_edid.c
    code.
    
    The fixup code was originally added in commit 7064fef56369 ("drm: work
    around EDIDs with bad htotal/vtotal values"). Googling around we end up in
    https://bugs.launchpad.net/ubuntu/hardy/+source/xserver-xorg-video-intel/+bug/297245
    where we find an EDID for a Dell Studio 15, which reports:
    (II) VESA(0): clock: 65.0 MHz   Image Size:  331 x 207 mm
    (II) VESA(0): h_active: 1280  h_sync: 1328  h_sync_end 1360 h_blank_end 1337 h_border: 0
    (II) VESA(0): v_active: 800  v_sync: 803  v_sync_end 809 v_blanking: 810 v_border: 0
    
    Note that if we use the hblank size (as opposed of the hsync_end)
    from the DTD to determine htotal we get exactly 60Hz refresh rate in
    both cases, whereas using hsync_end to determine htotal we get a
    slightly lower refresh rates. This makes me believe the using the
    hblank size is what was intended even in those cases.
    
    Also note that in case of the HP Onmi 120 the VBIOS boots with these:
      crtc timings: 108000 1600 1780 1860 1800 900 910 913 1000, type: 0x40 flags: 0x5
    ie. it just blindly stuffs the bogus hsync_end and htotal from the DTD
    into the transcoder timing registers, and the display works. I believe
    the (at least more modern) hardware will automagically terminate the hsync
    pulse when the timing generator reaches htotal, which again points that we
    should use the hblank size to determine htotal. Unfortunatley the old bug
    reports for the Dell machines are extremely lacking in useful details so
    we have no idea what kind of timings the VBIOS programmed into the
    hardware :(
    
    Let's just flip this quirk around and reduce the length of the sync
    pulse instead of extending the blanking period. This at least seems
    to be the correct thing to do on more modern hardware. And if any
    issues crop up on older hardware we need to debug them properly.
    
    v2: Add debug message breadcrumbs (Jani)
    
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8895
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230920211934.14920-1-ville.syrjala@linux.intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ea971fd05f39b2029c16a4d18def097442a97c27
Author: Wenjing Liu <wenjing.liu@amd.com>
Date:   Thu Aug 24 17:08:48 2023 -0400

    drm/amd/display: add seamless pipe topology transition check
    
    [ Upstream commit 15c6798ae26d5c7a7776f4f7d0c1fa8c462688a2 ]
    
    [why]
    We have a few cases where we need to perform update topology update
    in dc update interface. However some of the updates are not seamless
    This could cause user noticible glitches. To enforce seamless transition
    we are adding a checking condition and error logging so the corruption
    as result of non seamless transition can be easily spotted.
    
    Reviewed-by: Dillon Varone <dillon.varone@amd.com>
    Acked-by: Stylon Wang <stylon.wang@amd.com>
    Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f95d571bb53b7cd119b272320ca263c06652e0c3
Author: Alvin Lee <alvin.lee2@amd.com>
Date:   Wed Aug 23 10:18:36 2023 -0400

    drm/amd/display: Don't lock phantom pipe on disabling
    
    [ Upstream commit cbb4c9bc55427774ca4d819933e1b5fa38a6fb44 ]
    
    [Description]
    - When disabling a phantom pipe, we first enable the phantom
      OTG so the double buffer update can successfully take place
    - However, want to avoid locking the phantom otherwise setting
      DPG_EN=1 for the phantom pipe is blocked (without this we could
      hit underflow due to phantom HUBP being blanked by default)
    
    Reviewed-by: Samson Tam <samson.tam@amd.com>
    Acked-by: Stylon Wang <stylon.wang@amd.com>
    Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 67af2e23e2a77769bb53cd65e576cc231bdff83b
Author: Alvin Lee <Alvin.Lee2@amd.com>
Date:   Tue Aug 8 13:21:58 2023 -0400

    drm/amd/display: Blank phantom OTG before enabling
    
    [ Upstream commit e87a6c5b7780b5f423797351eb586ed96cc6d151 ]
    
    [Description]
    Before enabling the phantom OTG for an update we
    must enable DPG to avoid underflow.
    
    Reviewed-by: Samson Tam <samson.tam@amd.com>
    Acked-by: Stylon Wang <stylon.wang@amd.com>
    Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
    Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aa359db88213c25b7a8743979726e577bcceb3bc
Author: baozhu.liu <lucas.liu@siengine.com>
Date:   Fri Aug 4 10:05:53 2023 +0800

    drm/komeda: drop all currently held locks if deadlock happens
    
    [ Upstream commit 19ecbe8325a2a7ffda5ff4790955b84eaccba49f ]
    
    If komeda_pipeline_unbound_components() returns -EDEADLK,
    it means that a deadlock happened in the locking context.
    Currently, komeda is not dealing with the deadlock properly,producing the
    following output when CONFIG_DEBUG_WW_MUTEX_SLOWPATH is enabled:
    
     ------------[ cut here ]------------
    [   26.103984] WARNING: CPU: 2 PID: 345 at drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c:1248
                   komeda_release_unclaimed_resources+0x13c/0x170
    [   26.117453] Modules linked in:
    [   26.120511] CPU: 2 PID: 345 Comm: composer@2.1-se Kdump: loaded Tainted: G   W  5.10.110-SE-SDK1.8-dirty #16
    [   26.131374] Hardware name: Siengine Se1000 Evaluation board (DT)
    [   26.137379] pstate: 20400009 (nzCv daif +PAN -UAO -TCO BTYPE=--)
    [   26.143385] pc : komeda_release_unclaimed_resources+0x13c/0x170
    [   26.149301] lr : komeda_release_unclaimed_resources+0xbc/0x170
    [   26.155130] sp : ffff800017b8b8d0
    [   26.158442] pmr_save: 000000e0
    [   26.161493] x29: ffff800017b8b8d0 x28: ffff000cf2f96200
    [   26.166805] x27: ffff000c8f5a8800 x26: 0000000000000000
    [   26.172116] x25: 0000000000000038 x24: ffff8000116a0140
    [   26.177428] x23: 0000000000000038 x22: ffff000cf2f96200
    [   26.182739] x21: ffff000cfc300300 x20: ffff000c8ab77080
    [   26.188051] x19: 0000000000000003 x18: 0000000000000000
    [   26.193362] x17: 0000000000000000 x16: 0000000000000000
    [   26.198672] x15: b400e638f738ba38 x14: 0000000000000000
    [   26.203983] x13: 0000000106400a00 x12: 0000000000000000
    [   26.209294] x11: 0000000000000000 x10: 0000000000000000
    [   26.214604] x9 : ffff800012f80000 x8 : ffff000ca3308000
    [   26.219915] x7 : 0000000ff3000000 x6 : ffff80001084034c
    [   26.225226] x5 : ffff800017b8bc40 x4 : 000000000000000f
    [   26.230536] x3 : ffff000ca3308000 x2 : 0000000000000000
    [   26.235847] x1 : 0000000000000000 x0 : ffffffffffffffdd
    [   26.241158] Call trace:
    [   26.243604] komeda_release_unclaimed_resources+0x13c/0x170
    [   26.249175] komeda_crtc_atomic_check+0x68/0xf0
    [   26.253706] drm_atomic_helper_check_planes+0x138/0x1f4
    [   26.258929] komeda_kms_check+0x284/0x36c
    [   26.262939] drm_atomic_check_only+0x40c/0x714
    [   26.267381] drm_atomic_nonblocking_commit+0x1c/0x60
    [   26.272344] drm_mode_atomic_ioctl+0xa3c/0xb8c
    [   26.276787] drm_ioctl_kernel+0xc4/0x120
    [   26.280708] drm_ioctl+0x268/0x534
    [   26.284109] __arm64_sys_ioctl+0xa8/0xf0
    [   26.288030] el0_svc_common.constprop.0+0x80/0x240
    [   26.292817] do_el0_svc+0x24/0x90
    [   26.296132] el0_svc+0x20/0x30
    [   26.299185] el0_sync_handler+0xe8/0xf0
    [   26.303018] el0_sync+0x1a4/0x1c0
    [   26.306330] irq event stamp: 0
    [   26.309384] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
    [   26.315650] hardirqs last disabled at (0): [<ffff800010056d34>] copy_process+0x5d0/0x183c
    [   26.323825] softirqs last  enabled at (0): [<ffff800010056d34>] copy_process+0x5d0/0x183c
    [   26.331997] softirqs last disabled at (0): [<0000000000000000>] 0x0
    [   26.338261] ---[ end trace 20ae984fa860184a ]---
    [   26.343021] ------------[ cut here ]------------
    [   26.347646] WARNING: CPU: 3 PID: 345 at drivers/gpu/drm/drm_modeset_lock.c:228 drm_modeset_drop_locks+0x84/0x90
    [   26.357727] Modules linked in:
    [   26.360783] CPU: 3 PID: 345 Comm: composer@2.1-se Kdump: loaded Tainted: G   W  5.10.110-SE-SDK1.8-dirty #16
    [   26.371645] Hardware name: Siengine Se1000 Evaluation board (DT)
    [   26.377647] pstate: 20400009 (nzCv daif +PAN -UAO -TCO BTYPE=--)
    [   26.383649] pc : drm_modeset_drop_locks+0x84/0x90
    [   26.388351] lr : drm_mode_atomic_ioctl+0x860/0xb8c
    [   26.393137] sp : ffff800017b8bb10
    [   26.396447] pmr_save: 000000e0
    [   26.399497] x29: ffff800017b8bb10 x28: 0000000000000001
    [   26.404807] x27: 0000000000000038 x26: 0000000000000002
    [   26.410115] x25: ffff000cecbefa00 x24: ffff000cf2f96200
    [   26.415423] x23: 0000000000000001 x22: 0000000000000018
    [   26.420731] x21: 0000000000000001 x20: ffff800017b8bc10
    [   26.426039] x19: 0000000000000000 x18: 0000000000000000
    [   26.431347] x17: 0000000002e8bf2c x16: 0000000002e94c6b
    [   26.436655] x15: 0000000002ea48b9 x14: ffff8000121f0300
    [   26.441963] x13: 0000000002ee2ca8 x12: ffff80001129cae0
    [   26.447272] x11: ffff800012435000 x10: ffff000ed46b5e88
    [   26.452580] x9 : ffff000c9935e600 x8 : 0000000000000000
    [   26.457888] x7 : 000000008020001e x6 : 000000008020001f
    [   26.463196] x5 : ffff80001085fbe0 x4 : fffffe0033a59f20
    [   26.468504] x3 : 000000008020001e x2 : 0000000000000000
    [   26.473813] x1 : 0000000000000000 x0 : ffff000c8f596090
    [   26.479122] Call trace:
    [   26.481566] drm_modeset_drop_locks+0x84/0x90
    [   26.485918] drm_mode_atomic_ioctl+0x860/0xb8c
    [   26.490359] drm_ioctl_kernel+0xc4/0x120
    [   26.494278] drm_ioctl+0x268/0x534
    [   26.497677] __arm64_sys_ioctl+0xa8/0xf0
    [   26.501598] el0_svc_common.constprop.0+0x80/0x240
    [   26.506384] do_el0_svc+0x24/0x90
    [   26.509697] el0_svc+0x20/0x30
    [   26.512748] el0_sync_handler+0xe8/0xf0
    [   26.516580] el0_sync+0x1a4/0x1c0
    [   26.519891] irq event stamp: 0
    [   26.522943] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
    [   26.529207] hardirqs last disabled at (0): [<ffff800010056d34>] copy_process+0x5d0/0x183c
    [   26.537379] softirqs last  enabled at (0): [<ffff800010056d34>] copy_process+0x5d0/0x183c
    [   26.545550] softirqs last disabled at (0): [<0000000000000000>] 0x0
    [   26.551812] ---[ end trace 20ae984fa860184b ]---
    
    According to the call trace information,it can be located to be
    WARN_ON(IS_ERR(c_st)) in the komeda_pipeline_unbound_components function;
    Then follow the function.
    komeda_pipeline_unbound_components
    -> komeda_component_get_state_and_set_user
      -> komeda_pipeline_get_state_and_set_crtc
        -> komeda_pipeline_get_state
          ->drm_atomic_get_private_obj_state
            -> drm_atomic_get_private_obj_state
              -> drm_modeset_lock
    
    komeda_pipeline_unbound_components
    -> komeda_component_get_state_and_set_user
      -> komeda_component_get_state
        -> drm_atomic_get_private_obj_state
         -> drm_modeset_lock
    
    ret = drm_modeset_lock(&obj->lock, state->acquire_ctx); if (ret)
            return ERR_PTR(ret);
    Here it return -EDEADLK.
    
    deal with the deadlock as suggested by [1], using the
    function drm_modeset_backoff().
    [1] https://docs.kernel.org/gpu/drm-kms.html?highlight=kms#kms-locking
    
    Therefore, handling this problem can be solved
    by adding return -EDEADLK back to the drm_modeset_backoff processing flow
    in the drm_mode_atomic_ioctl function.
    
    Signed-off-by: baozhu.liu <lucas.liu@siengine.com>
    Signed-off-by: menghui.huang <menghui.huang@siengine.com>
    Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
    Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230804013117.6870-1-menghui.huang@siengine.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit de1ce1081b7881044c46012ca27c1f2d5bb27f2d
Author: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Date:   Thu Aug 10 12:10:57 2023 -0400

    drm/amdkfd: ratelimited SQ interrupt messages
    
    [ Upstream commit 37fb87910724f21a1f27a75743d4f9accdee77fb ]
    
    No functional change. Use ratelimited version of pr_ to avoid
    overflowing of dmesg buffer
    
    Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
    Reviewed-by: Philip Yang <philip.yang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit bc2808a28139230726806e059bcba1447366b542
Author: Sui Jingfeng <suijingfeng@loongson.cn>
Date:   Fri Jul 28 02:58:55 2023 +0800

    drm/gma500: Fix call trace when psb_gem_mm_init() fails
    
    [ Upstream commit da596080b2b400c50fe9f8f237bcaf09fed06af8 ]
    
    Because the gma_irq_install() is call after psb_gem_mm_init() function,
    when psb_gem_mm_init() fails, the interrupt line haven't been allocated.
    Yet the gma_irq_uninstall() is called in the psb_driver_unload() function
    without checking if checking the irq is registered or not.
    
    The calltrace is appended as following:
    
    [   20.539253] ioremap memtype_reserve failed -16
    [   20.543895] gma500 0000:00:02.0: Failure to map stolen base.
    [   20.565049] ------------[ cut here ]------------
    [   20.565066] Trying to free already-free IRQ 16
    [   20.565087] WARNING: CPU: 1 PID: 381 at kernel/irq/manage.c:1893 free_irq+0x209/0x370
    [   20.565316] CPU: 1 PID: 381 Comm: systemd-udevd Tainted: G         C         6.5.0-rc1+ #368
    [   20.565329] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./IMB-140D Plus, BIOS P1.10 11/18/2013
    [   20.565338] RIP: 0010:free_irq+0x209/0x370
    [   20.565357] Code: 41 5d 41 5e 41 5f 5d 31 d2 89 d1 89 d6 89 d7 41 89 d1 c3 cc cc cc cc 8b 75 d0 48 c7 c7 e0 77 12 9f 4c 89 4d c8 e8 57 fe f4 ff <0f> 0b 48 8b 75 c8 4c 89 f7 e8 29 f3 f1 00 49 8b 47 40 48 8b 40 78
    [   20.565369] RSP: 0018:ffffae3b40733808 EFLAGS: 00010046
    [   20.565382] RAX: 0000000000000000 RBX: ffff9f8082bfe000 RCX: 0000000000000000
    [   20.565390] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
    [   20.565397] RBP: ffffae3b40733840 R08: 0000000000000000 R09: 0000000000000000
    [   20.565405] R10: 0000000000000000 R11: 0000000000000000 R12: ffff9f80871c3100
    [   20.565413] R13: ffff9f80835d3360 R14: ffff9f80835d32a4 R15: ffff9f80835d3200
    [   20.565424] FS:  00007f13d36458c0(0000) GS:ffff9f8138880000(0000) knlGS:0000000000000000
    [   20.565434] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [   20.565441] CR2: 00007f0d046f3f20 CR3: 0000000006c8c000 CR4: 00000000000006e0
    [   20.565450] Call Trace:
    [   20.565458]  <TASK>
    [   20.565470]  ? show_regs+0x72/0x90
    [   20.565488]  ? free_irq+0x209/0x370
    [   20.565504]  ? __warn+0x8d/0x160
    [   20.565520]  ? free_irq+0x209/0x370
    [   20.565536]  ? report_bug+0x1bb/0x1d0
    [   20.565555]  ? handle_bug+0x46/0x90
    [   20.565572]  ? exc_invalid_op+0x19/0x80
    [   20.565587]  ? asm_exc_invalid_op+0x1b/0x20
    [   20.565607]  ? free_irq+0x209/0x370
    [   20.565625]  ? free_irq+0x209/0x370
    [   20.565644]  gma_irq_uninstall+0x15b/0x1e0 [gma500_gfx]
    [   20.565728]  psb_driver_unload+0x27/0x190 [gma500_gfx]
    [   20.565800]  psb_pci_probe+0x5d2/0x790 [gma500_gfx]
    [   20.565873]  local_pci_probe+0x48/0xb0
    [   20.565892]  pci_device_probe+0xc8/0x280
    [   20.565912]  really_probe+0x1d2/0x440
    [   20.565929]  __driver_probe_device+0x8a/0x190
    [   20.565944]  driver_probe_device+0x23/0xd0
    [   20.565957]  __driver_attach+0x10f/0x220
    [   20.565971]  ? __pfx___driver_attach+0x10/0x10
    [   20.565984]  bus_for_each_dev+0x7a/0xe0
    [   20.566002]  driver_attach+0x1e/0x30
    [   20.566014]  bus_add_driver+0x127/0x240
    [   20.566029]  driver_register+0x64/0x140
    [   20.566043]  ? __pfx_psb_init+0x10/0x10 [gma500_gfx]
    [   20.566111]  __pci_register_driver+0x68/0x80
    [   20.566128]  psb_init+0x2c/0xff0 [gma500_gfx]
    [   20.566194]  do_one_initcall+0x46/0x330
    [   20.566214]  ? kmalloc_trace+0x2a/0xb0
    [   20.566233]  do_init_module+0x6a/0x270
    [   20.566250]  load_module+0x207f/0x23a0
    [   20.566278]  init_module_from_file+0x9c/0xf0
    [   20.566293]  ? init_module_from_file+0x9c/0xf0
    [   20.566315]  idempotent_init_module+0x184/0x240
    [   20.566335]  __x64_sys_finit_module+0x64/0xd0
    [   20.566352]  do_syscall_64+0x59/0x90
    [   20.566366]  ? ksys_mmap_pgoff+0x123/0x270
    [   20.566378]  ? __secure_computing+0x9b/0x110
    [   20.566392]  ? exit_to_user_mode_prepare+0x39/0x190
    [   20.566406]  ? syscall_exit_to_user_mode+0x2a/0x50
    [   20.566420]  ? do_syscall_64+0x69/0x90
    [   20.566433]  ? do_syscall_64+0x69/0x90
    [   20.566445]  ? do_syscall_64+0x69/0x90
    [   20.566458]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    [   20.566472] RIP: 0033:0x7f13d351ea3d
    [   20.566485] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 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 8b 0d c3 a3 0f 00 f7 d8 64 89 01 48
    [   20.566496] RSP: 002b:00007ffe566c1fd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    [   20.566510] RAX: ffffffffffffffda RBX: 000055e66806eec0 RCX: 00007f13d351ea3d
    [   20.566519] RDX: 0000000000000000 RSI: 00007f13d36d9441 RDI: 0000000000000010
    [   20.566527] RBP: 0000000000020000 R08: 0000000000000000 R09: 0000000000000002
    [   20.566535] R10: 0000000000000010 R11: 0000000000000246 R12: 00007f13d36d9441
    [   20.566543] R13: 000055e6681108c0 R14: 000055e66805ba70 R15: 000055e66819a9c0
    [   20.566559]  </TASK>
    [   20.566566] ---[ end trace 0000000000000000 ]---
    
    Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
    Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230727185855.713318-1-suijingfeng@loongson.cn
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 9d43c83cd8621322442b2da084243f442f21a273
Author: Olli Asikainen <olli.asikainen@gmail.com>
Date:   Tue Oct 24 22:09:21 2023 +0300

    platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e
    
    [ Upstream commit 916646758aea81a143ce89103910f715ed923346 ]
    
    Thinkpad X120e also needs this battery quirk.
    
    Signed-off-by: Olli Asikainen <olli.asikainen@gmail.com>
    Link: https://lore.kernel.org/r/20231024190922.2742-1-olli.asikainen@gmail.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 76e2b215ea0941ec79a8bf9abb74b847b8fe0c14
Author: Herve Codina <herve.codina@bootlin.com>
Date:   Tue Oct 17 13:02:16 2023 +0200

    of: address: Fix address translation when address-size is greater than 2
    
    [ Upstream commit 42604f8eb7ba04b589375049cc76282dad4677d2 ]
    
    With the recent addition of of_pci_prop_ranges() in commit 407d1a51921e
    ("PCI: Create device tree node for bridge"), the ranges property can
    have a 3 cells child address, a 3 cells parent address and a 2 cells
    child size.
    
    A range item property for a PCI device is filled as follow:
      <BAR_nbr> 0 0 <phys.hi> <phys.mid> <phys.low> <BAR_sizeh> <BAR_sizel>
      <-- Child --> <-- Parent (PCI definition) --> <- BAR size (64bit) -->
    
    This allow to translate BAR addresses from the DT. For instance:
    pci@0,0 {
      #address-cells = <0x03>;
      #size-cells = <0x02>;
      device_type = "pci";
      compatible = "pci11ab,100", "pciclass,060400", "pciclass,0604";
      ranges = <0x82000000 0x00 0xe8000000
                0x82000000 0x00 0xe8000000
                0x00 0x4400000>;
      ...
      dev@0,0 {
        #address-cells = <0x03>;
        #size-cells = <0x02>;
        compatible = "pci1055,9660", "pciclass,020000", "pciclass,0200";
        /* Translations for BAR0 to BAR5 */
        ranges = <0x00 0x00 0x00 0x82010000 0x00 0xe8000000 0x00 0x2000000
                  0x01 0x00 0x00 0x82010000 0x00 0xea000000 0x00 0x1000000
                  0x02 0x00 0x00 0x82010000 0x00 0xeb000000 0x00 0x800000
                  0x03 0x00 0x00 0x82010000 0x00 0xeb800000 0x00 0x800000
                  0x04 0x00 0x00 0x82010000 0x00 0xec000000 0x00 0x20000
                  0x05 0x00 0x00 0x82010000 0x00 0xec020000 0x00 0x2000>;
        ...
        pci-ep-bus@0 {
          #address-cells = <0x01>;
          #size-cells = <0x01>;
          compatible = "simple-bus";
          /* Translate 0xe2000000 to BAR0 and 0xe0000000 to BAR1 */
          ranges = <0xe2000000 0x00 0x00 0x00 0x2000000
                    0xe0000000 0x01 0x00 0x00 0x1000000>;
          ...
        };
      };
    };
    
    During the translation process, the "default-flags" map() function is
    used to select the matching item in the ranges table and determine the
    address offset from this matching item.
    This map() function simply calls of_read_number() and when address-size
    is greater than 2, the map() function skips the extra high address part
    (ie part over 64bit). This lead to a wrong matching item and a wrong
    offset computation.
    Also during the translation itself, the extra high part related to the
    parent address is not present in the translated address.
    
    Fix the "default-flags" map() and translate() in order to take into
    account the child extra high address part in map() and the parent extra
    high address part in translate() and so having a correct address
    translation for ranges patterns such as the one given in the example
    above.
    
    Signed-off-by: Herve Codina <herve.codina@bootlin.com>
    Link: https://lore.kernel.org/r/20231017110221.189299-2-herve.codina@bootlin.com
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 20bcab576168792c4127105b8f54d2e9484448e7
Author: Tzung-Bi Shih <tzungbi@kernel.org>
Date:   Tue Oct 3 08:05:04 2023 +0000

    platform/chrome: kunit: initialize lock for fake ec_dev
    
    [ Upstream commit e410b4ade83d06a046f6e32b5085997502ba0559 ]
    
    cros_ec_cmd_xfer() uses ec_dev->lock.  Initialize it.
    
    Otherwise, dmesg shows the following:
    > DEBUG_LOCKS_WARN_ON(lock->magic != lock)
    > ...
    > Call Trace:
    >  ? __mutex_lock
    >  ? __warn
    >  ? __mutex_lock
    >  ...
    >  ? cros_ec_cmd_xfer
    
    Reviewed-by: Guenter Roeck <groeck@chromium.org>
    Link: https://lore.kernel.org/r/20231003080504.4011337-1-tzungbi@kernel.org
    Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 30d8ff067f87775aefce1ff7c037d186587822d7
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Sat Sep 9 16:18:10 2023 +0200

    gpiolib: acpi: Add a ignore interrupt quirk for Peaq C1010
    
    [ Upstream commit 6cc64f6173751d212c9833bde39e856b4f585a3e ]
    
    On the Peaq C1010 2-in-1 INT33FC:00 pin 3 is connected to
    a "dolby" button. At the ACPI level an _AEI event-handler
    is connected which sets an ACPI variable to 1 on both
    edges. This variable can be polled + cleared to 0 using WMI.
    
    Since the variable is set on both edges the WMI interface is pretty
    useless even when polling. So instead of writing a custom WMI
    driver for this the x86-android-tablets code instantiates
    a gpio-keys platform device for the "dolby" button.
    
    Add an ignore_interrupt quirk for INT33FC:00 pin 3 on the Peaq C1010,
    so that it is not seen as busy when the gpio-keys driver requests it.
    
    Note this replaces a hack in x86-android-tablets where it would
    call acpi_gpiochip_free_interrupts() on the INT33FC:00 GPIO
    controller. acpi_gpiochip_free_interrupts() is considered private
    (internal) gpiolib API so x86-android-tablets should stop using it.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Acked-by: Linus Walleij <linus.walleij@linaro.org>
    Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Link: https://lore.kernel.org/r/20230909141816.58358-3-hdegoede@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6bb50965e3fc52d54d25d3ad7081530d584c30da
Author: Gerhard Engleder <gerhard@engleder-embedded.com>
Date:   Mon Oct 23 20:38:56 2023 +0200

    tsnep: Fix tsnep_request_irq() format-overflow warning
    
    [ Upstream commit 00e984cb986b31e9313745e51daceaa1e1eb7351 ]
    
    Compiler warns about a possible format-overflow in tsnep_request_irq():
    drivers/net/ethernet/engleder/tsnep_main.c:884:55: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
                             sprintf(queue->name, "%s-rx-%d", name,
                                                           ^
    drivers/net/ethernet/engleder/tsnep_main.c:881:55: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
                             sprintf(queue->name, "%s-tx-%d", name,
                                                           ^
    drivers/net/ethernet/engleder/tsnep_main.c:878:49: warning: '-txrx-' directive writing 6 bytes into a region of size between 5 and 25 [-Wformat-overflow=]
                             sprintf(queue->name, "%s-txrx-%d", name,
                                                     ^~~~~~
    
    Actually overflow cannot happen. Name is limited to IFNAMSIZ, because
    netdev_name() is called during ndo_open(). queue_index is single char,
    because less than 10 queues are supported.
    
    Fix warning with snprintf(). Additionally increase buffer to 32 bytes,
    because those 7 additional bytes were unused anyway.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202310182028.vmDthIUa-lkp@intel.com/
    Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://lore.kernel.org/r/20231023183856.58373-1-gerhard@engleder-embedded.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2deacc5c6bc528b68bf84524258066d9f8cddd0d
Author: Jonathan Denose <jdenose@chromium.org>
Date:   Tue Oct 24 09:13:36 2023 -0500

    ACPI: EC: Add quirk for HP 250 G7 Notebook PC
    
    [ Upstream commit 891ddc03e2f4395e24795596e032f57d5ab37fe7 ]
    
    Add GPE quirk entry for HP 250 G7 Notebook PC.
    
    This change allows the lid switch to be identified as the lid switch
    and not a keyboard button. With the lid switch properly identified, the
    device triggers suspend correctly on lid close.
    
    Signed-off-by: Jonathan Denose <jdenose@google.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 56a4fdde95ed98d864611155f6728983e199e198
Author: ZhengHan Wang <wzhmmmmm@gmail.com>
Date:   Wed Oct 18 12:30:55 2023 +0200

    Bluetooth: Fix double free in hci_conn_cleanup
    
    [ Upstream commit a85fb91e3d728bdfc80833167e8162cce8bc7004 ]
    
    syzbot reports a slab use-after-free in hci_conn_hash_flush [1].
    After releasing an object using hci_conn_del_sysfs in the
    hci_conn_cleanup function, releasing the same object again
    using the hci_dev_put and hci_conn_put functions causes a double free.
    Here's a simplified flow:
    
    hci_conn_del_sysfs:
      hci_dev_put
        put_device
          kobject_put
            kref_put
              kobject_release
                kobject_cleanup
                  kfree_const
                    kfree(name)
    
    hci_dev_put:
      ...
        kfree(name)
    
    hci_conn_put:
      put_device
        ...
          kfree(name)
    
    This patch drop the hci_dev_put and hci_conn_put function
    call in hci_conn_cleanup function, because the object is
    freed in hci_conn_del_sysfs function.
    
    This patch also fixes the refcounting in hci_conn_add_sysfs() and
    hci_conn_del_sysfs() to take into account device_add() failures.
    
    This fixes CVE-2023-28464.
    
    Link: https://syzkaller.appspot.com/bug?id=1bb51491ca5df96a5f724899d1dbb87afda61419 [1]
    
    Signed-off-by: ZhengHan Wang <wzhmmmmm@gmail.com>
    Co-developed-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 13b1ebad4c175e6a9b0748acbf133c21a15d282a
Author: youwan Wang <wangyouwan@126.com>
Date:   Wed Oct 11 13:14:47 2023 +0800

    Bluetooth: btusb: Add date->evt_skb is NULL check
    
    [ Upstream commit 624820f7c8826dd010e8b1963303c145f99816e9 ]
    
    fix crash because of null pointers
    
    [ 6104.969662] BUG: kernel NULL pointer dereference, address: 00000000000000c8
    [ 6104.969667] #PF: supervisor read access in kernel mode
    [ 6104.969668] #PF: error_code(0x0000) - not-present page
    [ 6104.969670] PGD 0 P4D 0
    [ 6104.969673] Oops: 0000 [#1] SMP NOPTI
    [ 6104.969684] RIP: 0010:btusb_mtk_hci_wmt_sync+0x144/0x220 [btusb]
    [ 6104.969688] RSP: 0018:ffffb8d681533d48 EFLAGS: 00010246
    [ 6104.969689] RAX: 0000000000000000 RBX: ffff8ad560bb2000 RCX: 0000000000000006
    [ 6104.969691] RDX: 0000000000000000 RSI: ffffb8d681533d08 RDI: 0000000000000000
    [ 6104.969692] RBP: ffffb8d681533d70 R08: 0000000000000001 R09: 0000000000000001
    [ 6104.969694] R10: 0000000000000001 R11: 00000000fa83b2da R12: ffff8ad461d1d7c0
    [ 6104.969695] R13: 0000000000000000 R14: ffff8ad459618c18 R15: ffffb8d681533d90
    [ 6104.969697] FS:  00007f5a1cab9d40(0000) GS:ffff8ad578200000(0000) knlGS:00000
    [ 6104.969699] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 6104.969700] CR2: 00000000000000c8 CR3: 000000018620c001 CR4: 0000000000760ef0
    [ 6104.969701] PKRU: 55555554
    [ 6104.969702] Call Trace:
    [ 6104.969708]  btusb_mtk_shutdown+0x44/0x80 [btusb]
    [ 6104.969732]  hci_dev_do_close+0x470/0x5c0 [bluetooth]
    [ 6104.969748]  hci_rfkill_set_block+0x56/0xa0 [bluetooth]
    [ 6104.969753]  rfkill_set_block+0x92/0x160
    [ 6104.969755]  rfkill_fop_write+0x136/0x1e0
    [ 6104.969759]  __vfs_write+0x18/0x40
    [ 6104.969761]  vfs_write+0xdf/0x1c0
    [ 6104.969763]  ksys_write+0xb1/0xe0
    [ 6104.969765]  __x64_sys_write+0x1a/0x20
    [ 6104.969769]  do_syscall_64+0x51/0x180
    [ 6104.969771]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 6104.969773] RIP: 0033:0x7f5a21f18fef
    [ 6104.9] RSP: 002b:00007ffeefe39010 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
    [ 6104.969780] RAX: ffffffffffffffda RBX: 000055c10a7560a0 RCX: 00007f5a21f18fef
    [ 6104.969781] RDX: 0000000000000008 RSI: 00007ffeefe39060 RDI: 0000000000000012
    [ 6104.969782] RBP: 00007ffeefe39060 R08: 0000000000000000 R09: 0000000000000017
    [ 6104.969784] R10: 00007ffeefe38d97 R11: 0000000000000293 R12: 0000000000000002
    [ 6104.969785] R13: 00007ffeefe39220 R14: 00007ffeefe391a0 R15: 000055c10a72acf0
    
    Signed-off-by: youwan Wang <wangyouwan@126.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d09d246f6abdb151d19f8ff73121f9b13c518770
Author: Gregory Greenman <gregory.greenman@intel.com>
Date:   Tue Oct 17 12:16:44 2023 +0300

    wifi: iwlwifi: mvm: fix size check for fw_link_id
    
    [ Upstream commit e25bd1853cc8308158d97e5b3696ea3689fa0840 ]
    
    Check that fw_link_id does not exceed the size of link_id_to_link_conf
    array. There's no any codepath that can cause that, but it's still
    safer to verify in case fw_link_id gets corrupted.
    
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20231017115047.3385bd11f423.I2d30fdb464f951c648217553c47901857a0046c7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aa4dd55adeb6db7939aa2ad218c39a91a8913737
Author: Andrii Nakryiko <andrii@kernel.org>
Date:   Wed Oct 11 15:37:28 2023 -0700

    bpf: Ensure proper register state printing for cond jumps
    
    [ Upstream commit 1a8a315f008a58f54fecb012b928aa6a494435b3 ]
    
    Verifier emits relevant register state involved in any given instruction
    next to it after `;` to the right, if possible. Or, worst case, on the
    separate line repeating instruction index.
    
    E.g., a nice and simple case would be:
    
      2: (d5) if r0 s<= 0x0 goto pc+1       ; R0_w=0
    
    But if there is some intervening extra output (e.g., precision
    backtracking log) involved, we are supposed to see the state after the
    precision backtrack log:
    
      4: (75) if r0 s>= 0x0 goto pc+1
      mark_precise: frame0: last_idx 4 first_idx 0 subseq_idx -1
      mark_precise: frame0: regs=r0 stack= before 2: (d5) if r0 s<= 0x0 goto pc+1
      mark_precise: frame0: regs=r0 stack= before 1: (b7) r0 = 0
      6: R0_w=0
    
    First off, note that in `6: R0_w=0` instruction index corresponds to the
    next instruction, not to the conditional jump instruction itself, which
    is wrong and we'll get to that.
    
    But besides that, the above is a happy case that does work today. Yet,
    if it so happens that precision backtracking had to traverse some of the
    parent states, this `6: R0_w=0` state output would be missing.
    
    This is due to a quirk of print_verifier_state() routine, which performs
    mark_verifier_state_clean(env) at the end. This marks all registers as
    "non-scratched", which means that subsequent logic to print *relevant*
    registers (that is, "scratched ones") fails and doesn't see anything
    relevant to print and skips the output altogether.
    
    print_verifier_state() is used both to print instruction context, but
    also to print an **entire** verifier state indiscriminately, e.g.,
    during precision backtracking (and in a few other situations, like
    during entering or exiting subprogram).  Which means if we have to print
    entire parent state before getting to printing instruction context
    state, instruction context is marked as clean and is omitted.
    
    Long story short, this is definitely not intentional. So we fix this
    behavior in this patch by teaching print_verifier_state() to clear
    scratch state only if it was used to print instruction state, not the
    parent/callback state. This is determined by print_all option, so if
    it's not set, we don't clear scratch state. This fixes missing
    instruction state for these cases.
    
    As for the mismatched instruction index, we fix that by making sure we
    call print_insn_state() early inside check_cond_jmp_op() before we
    adjusted insn_idx based on jump branch taken logic. And with that we get
    desired correct information:
    
      9: (16) if w4 == 0x1 goto pc+9
      mark_precise: frame0: last_idx 9 first_idx 9 subseq_idx -1
      mark_precise: frame0: parent state regs=r4 stack=: R2_w=1944 R4_rw=P1 R10=fp0
      mark_precise: frame0: last_idx 8 first_idx 0 subseq_idx 9
      mark_precise: frame0: regs=r4 stack= before 8: (66) if w4 s> 0x3 goto pc+5
      mark_precise: frame0: regs=r4 stack= before 7: (b7) r4 = 1
      9: R4=1
    
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/bpf/20231011223728.3188086-6-andrii@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d55a40a6fbeda6e0b96acce4729a88a98cb74106
Author: Arseniy Krasnov <avkrasnov@salutedevices.com>
Date:   Tue Oct 10 22:15:14 2023 +0300

    vsock: read from socket's error queue
    
    [ Upstream commit 49dbe25adac42d3e06f65d1420946bec65896222 ]
    
    This adds handling of MSG_ERRQUEUE input flag in receive call. This flag
    is used to read socket's error queue instead of data queue. Possible
    scenario of error queue usage is receiving completions for transmission
    with MSG_ZEROCOPY flag. This patch also adds new defines: 'SOL_VSOCK'
    and 'VSOCK_RECVERR'.
    
    Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0570c9fd1609da5d981a181892fa74bbd1ca860a
Author: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Date:   Mon Sep 25 13:30:59 2023 +0530

    net: sfp: add quirk for FS's 2.5G copper SFP
    
    [ Upstream commit e27aca3760c08b7b05aea71068bd609aa93e7b35 ]
    
    Add a quirk for a copper SFP that identifies itself as "FS" "SFP-2.5G-T".
    This module's PHY is inaccessible, and can only run at 2500base-X with the
    host without negotiation. Add a quirk to enable the 2500base-X interface mode
    with 2500base-T support and disable auto negotiation.
    
    Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
    Link: https://lore.kernel.org/r/20230925080059.266240-1-Raju.Lakkaraju@microchip.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a48cb9c6adfa8c1f309755a54b458c6cf4390c29
Author: Douglas Anderson <dianders@chromium.org>
Date:   Sat Sep 30 07:54:48 2023 +0300

    wifi: ath10k: Don't touch the CE interrupt registers after power up
    
    [ Upstream commit 170c75d43a77dc937c58f07ecf847ba1b42ab74e ]
    
    As talked about in commit d66d24ac300c ("ath10k: Keep track of which
    interrupts fired, don't poll them"), if we access the copy engine
    register at a bad time then ath10k can go boom. However, it's not
    necessarily easy to know when it's safe to access them.
    
    The ChromeOS test labs saw a crash that looked like this at
    shutdown/reboot time (on a chromeos-5.15 kernel, but likely the
    problem could also reproduce upstream):
    
    Internal error: synchronous external abort: 96000010 [#1] PREEMPT SMP
    ...
    CPU: 4 PID: 6168 Comm: reboot Not tainted 5.15.111-lockdep-19350-g1d624fe6758f #1 010b9b233ab055c27c6dc88efb0be2f4e9e86f51
    Hardware name: Google Kingoftown (DT)
    ...
    pc : ath10k_snoc_read32+0x50/0x74 [ath10k_snoc]
    lr : ath10k_snoc_read32+0x24/0x74 [ath10k_snoc]
    ...
    Call trace:
    ath10k_snoc_read32+0x50/0x74 [ath10k_snoc ...]
    ath10k_ce_disable_interrupt+0x190/0x65c [ath10k_core ...]
    ath10k_ce_disable_interrupts+0x8c/0x120 [ath10k_core ...]
    ath10k_snoc_hif_stop+0x78/0x660 [ath10k_snoc ...]
    ath10k_core_stop+0x13c/0x1ec [ath10k_core ...]
    ath10k_halt+0x398/0x5b0 [ath10k_core ...]
    ath10k_stop+0xfc/0x1a8 [ath10k_core ...]
    drv_stop+0x148/0x6b4 [mac80211 ...]
    ieee80211_stop_device+0x70/0x80 [mac80211 ...]
    ieee80211_do_stop+0x10d8/0x15b0 [mac80211 ...]
    ieee80211_stop+0x144/0x1a0 [mac80211 ...]
    __dev_close_many+0x1e8/0x2c0
    dev_close_many+0x198/0x33c
    dev_close+0x140/0x210
    cfg80211_shutdown_all_interfaces+0xc8/0x1e0 [cfg80211 ...]
    ieee80211_remove_interfaces+0x118/0x5c4 [mac80211 ...]
    ieee80211_unregister_hw+0x64/0x1f4 [mac80211 ...]
    ath10k_mac_unregister+0x4c/0xf0 [ath10k_core ...]
    ath10k_core_unregister+0x80/0xb0 [ath10k_core ...]
    ath10k_snoc_free_resources+0xb8/0x1ec [ath10k_snoc ...]
    ath10k_snoc_shutdown+0x98/0xd0 [ath10k_snoc ...]
    platform_shutdown+0x7c/0xa0
    device_shutdown+0x3e0/0x58c
    kernel_restart_prepare+0x68/0xa0
    kernel_restart+0x28/0x7c
    
    Though there's no known way to reproduce the problem, it makes sense
    that it would be the same issue where we're trying to access copy
    engine registers when it's not allowed.
    
    Let's fix this by changing how we "disable" the interrupts. Instead of
    tweaking the copy engine registers we'll just use disable_irq() and
    enable_irq(). Then we'll configure the interrupts once at power up
    time.
    
    Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2.c10-00754-QCAHLSWMTPL-1
    
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20230630151842.1.If764ede23c4e09a43a842771c2ddf99608f25f8e@changeid
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8175a9f662f7a2742a2c37735e76a39c036df00b
Author: Ma Ke <make_ruc2021@163.com>
Date:   Sat Sep 30 07:54:47 2023 +0300

    wifi: ath12k: mhi: fix potential memory leak in ath12k_mhi_register()
    
    [ Upstream commit 47c27aa7ded4b8ead19b3487cc42a6185b762903 ]
    
    mhi_alloc_controller() allocates a memory space for mhi_ctrl. When some
    errors occur, mhi_ctrl should be freed by mhi_free_controller() and set
    ab_pci->mhi_ctrl = NULL.
    
    We can fix it by calling mhi_free_controller() when the failure happens
    and set ab_pci->mhi_ctrl = NULL in all of the places where we call
    mhi_free_controller().
    
    Signed-off-by: Ma Ke <make_ruc2021@163.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20230922021036.3604157-1-make_ruc2021@163.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 87324a50b4e833289bbe22339eccbc42e4d0578a
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Sep 21 20:28:18 2023 +0000

    net: annotate data-races around sk->sk_dst_pending_confirm
    
    [ Upstream commit eb44ad4e635132754bfbcb18103f1dcb7058aedd ]
    
    This field can be read or written without socket lock being held.
    
    Add annotations to avoid load-store tearing.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 224f68c507b1eb6af1421af4a23680df6849c710
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Sep 21 20:28:17 2023 +0000

    net: annotate data-races around sk->sk_tx_queue_mapping
    
    [ Upstream commit 0bb4d124d34044179b42a769a0c76f389ae973b6 ]
    
    This field can be read or written without socket lock being held.
    
    Add annotations to avoid load-store tearing.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b521d90864c073fef2a19df097fc1eb60752b78e
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Tue Aug 29 12:43:49 2023 +0300

    wifi: mt76: fix clang-specific fortify warnings
    
    [ Upstream commit 03f0e11da7fb26db4f27e6b83a223512db9f7ca5 ]
    
    When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've
    noticed the following (somewhat confusing due to absence of an actual
    source code location):
    
    In file included from drivers/net/wireless/mediatek/mt76/mt792x_core.c:4:
    In file included from ./include/linux/module.h:13:
    In file included from ./include/linux/stat.h:19:
    In file included from ./include/linux/time.h:60:
    In file included from ./include/linux/time32.h:13:
    In file included from ./include/linux/timex.h:67:
    In file included from ./arch/x86/include/asm/timex.h:5:
    In file included from ./arch/x86/include/asm/processor.h:23:
    In file included from ./arch/x86/include/asm/msr.h:11:
    In file included from ./arch/x86/include/asm/cpumask.h:5:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    In file included from drivers/net/wireless/mediatek/mt76/mt7915/main.c:4:
    In file included from ./include/linux/etherdevice.h:20:
    In file included from ./include/linux/if_ether.h:19:
    In file included from ./include/linux/skbuff.h:15:
    In file included from ./include/linux/time.h:60:
    In file included from ./include/linux/time32.h:13:
    In file included from ./include/linux/timex.h:67:
    In file included from ./arch/x86/include/asm/timex.h:5:
    In file included from ./arch/x86/include/asm/processor.h:23:
    In file included from ./arch/x86/include/asm/msr.h:11:
    In file included from ./arch/x86/include/asm/cpumask.h:5:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    In file included from drivers/net/wireless/mediatek/mt76/mt7996/main.c:6:
    In file included from drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h:9:
    In file included from ./include/linux/interrupt.h:8:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    The compiler actually complains on 'mt7915_get_et_strings()',
    'mt792x_get_et_strings()' and 'mt7996_get_et_strings()' due to the same
    reason: fortification logic inteprets call to 'memcpy()' as an attempt
    to copy the whole array from its first member and so issues an overread
    warning. These warnings may be silenced by passing an address of the whole
    array and not the first member to 'memcpy()'.
    
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8943a6d1790471fe6571fdb4caa79daddb4dda5b
Author: Ingo Rohloff <lundril@gmx.de>
Date:   Sat Aug 26 22:02:41 2023 +0200

    wifi: mt76: mt7921e: Support MT7992 IP in Xiaomi Redmibook 15 Pro (2023)
    
    [ Upstream commit fce9c967820a72f600abbf061d7077861685a14d ]
    
    In the Xiaomi Redmibook 15 Pro (2023) laptop I have got, a wifi chip is
    used, which according to its PCI Vendor ID is from "ITTIM Technology".
    
    This chip works flawlessly with the mt7921e module.  The driver doesn't
    bind to this PCI device, because the Vendor ID from "ITTIM Technology" is
    not recognized.
    
    This patch adds the PCI Vendor ID from "ITTIM Technology" to the list of
    PCI Vendor IDs and lets the mt7921e driver bind to the mentioned wifi
    chip.
    
    Signed-off-by: Ingo Rohloff <lundril@gmx.de>
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 994f77f35ebb657124fba402e5e05e77eff7db28
Author: Christian Marangi <ansuelsmth@gmail.com>
Date:   Tue Sep 19 14:47:20 2023 +0200

    net: sfp: add quirk for Fiberstone GPON-ONU-34-20BI
    
    [ Upstream commit d387e34fec407f881fdf165b5d7ec128ebff362f ]
    
    Fiberstone GPON-ONU-34-20B can operate at 2500base-X, but report 1.2GBd
    NRZ in their EEPROM.
    
    The module also require the ignore tx fault fixup similar to Huawei MA5671A
    as it gets disabled on error messages with serial redirection enabled.
    
    Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
    Link: https://lore.kernel.org/r/20230919124720.8210-1-ansuelsmth@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b7765b0a034553018f0d815e27f3e9d4178a31a5
Author: Shiju Jose <shiju.jose@huawei.com>
Date:   Thu Sep 21 02:03:36 2023 +0800

    ACPI: APEI: Fix AER info corruption when error status data has multiple sections
    
    [ Upstream commit e2abc47a5a1a9f641e7cacdca643fdd40729bf6e ]
    
    ghes_handle_aer() passes AER data to the PCI core for logging and
    recovery by calling aer_recover_queue() with a pointer to struct
    aer_capability_regs.
    
    The problem was that aer_recover_queue() queues the pointer directly
    without copying the aer_capability_regs data.  The pointer was to
    the ghes->estatus buffer, which could be reused before
    aer_recover_work_func() reads the data.
    
    To avoid this problem, allocate a new aer_capability_regs structure
    from the ghes_estatus_pool, copy the AER data from the ghes->estatus
    buffer into it, pass a pointer to the new struct to
    aer_recover_queue(), and free it after aer_recover_work_func() has
    processed it.
    
    Reported-by: Bjorn Helgaas <helgaas@kernel.org>
    Acked-by: Bjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
    [ rjw: Subject edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4dd0547e8b45faf6f95373be5436b66cde326c0e
Author: Baochen Qiang <quic_bqiang@quicinc.com>
Date:   Wed Sep 20 16:43:42 2023 +0300

    wifi: ath12k: fix possible out-of-bound write in ath12k_wmi_ext_hal_reg_caps()
    
    [ Upstream commit b302dce3d9edea5b93d1902a541684a967f3c63c ]
    
    reg_cap.phy_id is extracted from WMI event and could be an unexpected value
    in case some errors happen. As a result out-of-bound write may occur to
    soc->hal_reg_cap. Fix it by validating reg_cap.phy_id before using it.
    
    This is found during code review.
    
    Compile tested only.
    
    Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20230830020716.5420-1-quic_bqiang@quicinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e310aff779eb71f27ae9716ce73a041e86cc4368
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Tue Aug 29 12:36:02 2023 +0300

    wifi: ath10k: fix clang-specific fortify warning
    
    [ Upstream commit cb4c132ebfeac5962f7258ffc831caa0c4dada1a ]
    
    When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've
    noticed the following (somewhat confusing due to absence of an actual
    source code location):
    
    In file included from drivers/net/wireless/ath/ath10k/debug.c:8:
    In file included from ./include/linux/module.h:13:
    In file included from ./include/linux/stat.h:19:
    In file included from ./include/linux/time.h:60:
    In file included from ./include/linux/time32.h:13:
    In file included from ./include/linux/timex.h:67:
    In file included from ./arch/x86/include/asm/timex.h:5:
    In file included from ./arch/x86/include/asm/processor.h:23:
    In file included from ./arch/x86/include/asm/msr.h:11:
    In file included from ./arch/x86/include/asm/cpumask.h:5:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    The compiler actually complains on 'ath10k_debug_get_et_strings()' where
    fortification logic inteprets call to 'memcpy()' as an attempt to copy
    the whole 'ath10k_gstrings_stats' array from it's first member and so
    issues an overread warning. This warning may be silenced by passing
    an address of the whole array and not the first member to 'memcpy()'.
    
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20230829093652.234537-1-dmantipov@yandex.ru
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c9e44111da221246efb2e623ae1be40a5cf6542c
Author: Baochen Qiang <quic_bqiang@quicinc.com>
Date:   Fri Sep 1 09:56:02 2023 +0800

    wifi: ath12k: fix possible out-of-bound read in ath12k_htt_pull_ppdu_stats()
    
    [ Upstream commit 1bc44a505a229bb1dd4957e11aa594edeea3690e ]
    
    len is extracted from HTT message and could be an unexpected value in
    case errors happen, so add validation before using to avoid possible
    out-of-bound read in the following message iteration and parsing.
    
    The same issue also applies to ppdu_info->ppdu_stats.common.num_users,
    so validate it before using too.
    
    These are found during code review.
    
    Compile test only.
    
    Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
    Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20230901015602.45112-1-quic_bqiang@quicinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8954a159d137b3135a97e09934f220ad1576da17
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Tue Aug 29 12:38:12 2023 +0300

    wifi: ath9k: fix clang-specific fortify warnings
    
    [ Upstream commit 95f97fe0ac974467ab4da215985a32b2fdf48af0 ]
    
    When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've
    noticed the following (somewhat confusing due to absence of an actual
    source code location):
    
    In file included from drivers/net/wireless/ath/ath9k/debug.c:17:
    In file included from ./include/linux/slab.h:16:
    In file included from ./include/linux/gfp.h:7:
    In file included from ./include/linux/mmzone.h:8:
    In file included from ./include/linux/spinlock.h:56:
    In file included from ./include/linux/preempt.h:79:
    In file included from ./arch/x86/include/asm/preempt.h:9:
    In file included from ./include/linux/thread_info.h:60:
    In file included from ./arch/x86/include/asm/thread_info.h:53:
    In file included from ./arch/x86/include/asm/cpufeature.h:5:
    In file included from ./arch/x86/include/asm/processor.h:23:
    In file included from ./arch/x86/include/asm/msr.h:11:
    In file included from ./arch/x86/include/asm/cpumask.h:5:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    In file included from drivers/net/wireless/ath/ath9k/htc_drv_debug.c:17:
    In file included from drivers/net/wireless/ath/ath9k/htc.h:20:
    In file included from ./include/linux/module.h:13:
    In file included from ./include/linux/stat.h:19:
    In file included from ./include/linux/time.h:60:
    In file included from ./include/linux/time32.h:13:
    In file included from ./include/linux/timex.h:67:
    In file included from ./arch/x86/include/asm/timex.h:5:
    In file included from ./arch/x86/include/asm/processor.h:23:
    In file included from ./arch/x86/include/asm/msr.h:11:
    In file included from ./arch/x86/include/asm/cpumask.h:5:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    The compiler actually complains on 'ath9k_get_et_strings()' and
    'ath9k_htc_get_et_strings()' due to the same reason: fortification logic
    inteprets call to 'memcpy()' as an attempt to copy the whole array from
    it's first member and so issues an overread warning. These warnings may
    be silenced by passing an address of the whole array and not the first
    member to 'memcpy()'.
    
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20230829093856.234584-1-dmantipov@yandex.ru
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 821a7e4143af115b840ec199eb179537e18af922
Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Date:   Wed Sep 13 01:32:08 2023 +0200

    bpf: Detect IP == ksym.end as part of BPF program
    
    [ Upstream commit 66d9111f3517f85ef2af0337ece02683ce0faf21 ]
    
    Now that bpf_throw kfunc is the first such call instruction that has
    noreturn semantics within the verifier, this also kicks in dead code
    elimination in unprecedented ways. For one, any instruction following
    a bpf_throw call will never be marked as seen. Moreover, if a callchain
    ends up throwing, any instructions after the call instruction to the
    eventually throwing subprog in callers will also never be marked as
    seen.
    
    The tempting way to fix this would be to emit extra 'int3' instructions
    which bump the jited_len of a program, and ensure that during runtime
    when a program throws, we can discover its boundaries even if the call
    instruction to bpf_throw (or to subprogs that always throw) is emitted
    as the final instruction in the program.
    
    An example of such a program would be this:
    
    do_something():
            ...
            r0 = 0
            exit
    
    foo():
            r1 = 0
            call bpf_throw
            r0 = 0
            exit
    
    bar(cond):
            if r1 != 0 goto pc+2
            call do_something
            exit
            call foo
            r0 = 0  // Never seen by verifier
            exit    //
    
    main(ctx):
            r1 = ...
            call bar
            r0 = 0
            exit
    
    Here, if we do end up throwing, the stacktrace would be the following:
    
    bpf_throw
    foo
    bar
    main
    
    In bar, the final instruction emitted will be the call to foo, as such,
    the return address will be the subsequent instruction (which the JIT
    emits as int3 on x86). This will end up lying outside the jited_len of
    the program, thus, when unwinding, we will fail to discover the return
    address as belonging to any program and end up in a panic due to the
    unreliable stack unwinding of BPF programs that we never expect.
    
    To remedy this case, make bpf_prog_ksym_find treat IP == ksym.end as
    part of the BPF program, so that is_bpf_text_address returns true when
    such a case occurs, and we are able to unwind reliably when the final
    instruction ends up being a call instruction.
    
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Link: https://lore.kernel.org/r/20230912233214.1518551-12-memxor@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 32f08b7b430ee01ec47d730f961a3306c1c7b6fb
Author: Sieng-Piaw Liew <liew.s.piaw@gmail.com>
Date:   Tue Sep 12 09:07:11 2023 +0800

    atl1c: Work around the DMA RX overflow issue
    
    [ Upstream commit 86565682e9053e5deb128193ea9e88531bbae9cf ]
    
    This is based on alx driver commit 881d0327db37 ("net: alx: Work around
    the DMA RX overflow issue").
    
    The alx and atl1c drivers had RX overflow error which was why a custom
    allocator was created to avoid certain addresses. The simpler workaround
    then created for alx driver, but not for atl1c due to lack of tester.
    
    Instead of using a custom allocator, check the allocated skb address and
    use skb_reserve() to move away from problematic 0x...fc0 address.
    
    Tested on AR8131 on Acer 4540.
    
    Signed-off-by: Sieng-Piaw Liew <liew.s.piaw@gmail.com>
    Link: https://lore.kernel.org/r/20230912010711.12036-1-liew.s.piaw@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 5a94cffe90e20e8fade0b9abd4370bd671fe87c7
Author: Ping-Ke Shih <pkshih@realtek.com>
Date:   Fri Feb 3 10:36:36 2023 +0800

    wifi: mac80211: don't return unset power in ieee80211_get_tx_power()
    
    [ Upstream commit e160ab85166e77347d0cbe5149045cb25e83937f ]
    
    We can get a UBSAN warning if ieee80211_get_tx_power() returns the
    INT_MIN value mac80211 internally uses for "unset power level".
    
     UBSAN: signed-integer-overflow in net/wireless/nl80211.c:3816:5
     -2147483648 * 100 cannot be represented in type 'int'
     CPU: 0 PID: 20433 Comm: insmod Tainted: G        WC OE
     Call Trace:
      dump_stack+0x74/0x92
      ubsan_epilogue+0x9/0x50
      handle_overflow+0x8d/0xd0
      __ubsan_handle_mul_overflow+0xe/0x10
      nl80211_send_iface+0x688/0x6b0 [cfg80211]
      [...]
      cfg80211_register_wdev+0x78/0xb0 [cfg80211]
      cfg80211_netdev_notifier_call+0x200/0x620 [cfg80211]
      [...]
      ieee80211_if_add+0x60e/0x8f0 [mac80211]
      ieee80211_register_hw+0xda5/0x1170 [mac80211]
    
    In this case, simply return an error instead, to indicate
    that no data is available.
    
    Cc: Zong-Zhe Yang <kevin_yang@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://lore.kernel.org/r/20230203023636.4418-1-pkshih@realtek.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 90e7d2ad8d91a50e138ecbfcdebeef874dc46ee5
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Tue Aug 29 12:41:01 2023 +0300

    wifi: mac80211_hwsim: fix clang-specific fortify warning
    
    [ Upstream commit cbaccdc42483c65016f1bae89128c08dc17cfb2a ]
    
    When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've
    noticed the following (somewhat confusing due to absence of an actual
    source code location):
    
    In file included from drivers/net/wireless/virtual/mac80211_hwsim.c:18:
    In file included from ./include/linux/slab.h:16:
    In file included from ./include/linux/gfp.h:7:
    In file included from ./include/linux/mmzone.h:8:
    In file included from ./include/linux/spinlock.h:56:
    In file included from ./include/linux/preempt.h:79:
    In file included from ./arch/x86/include/asm/preempt.h:9:
    In file included from ./include/linux/thread_info.h:60:
    In file included from ./arch/x86/include/asm/thread_info.h:53:
    In file included from ./arch/x86/include/asm/cpufeature.h:5:
    In file included from ./arch/x86/include/asm/processor.h:23:
    In file included from ./arch/x86/include/asm/msr.h:11:
    In file included from ./arch/x86/include/asm/cpumask.h:5:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    The compiler actually complains on 'mac80211_hwsim_get_et_strings()' where
    fortification logic inteprets call to 'memcpy()' as an attempt to copy the
    whole 'mac80211_hwsim_gstrings_stats' array from its first member and so
    issues an overread warning. This warning may be silenced by passing
    an address of the whole array and not the first member to 'memcpy()'.
    
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Link: https://lore.kernel.org/r/20230829094140.234636-1-dmantipov@yandex.ru
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 499aafa2ceef1e2269360c3c039a12688c6a2e7b
Author: Harshitha Prem <quic_hprem@quicinc.com>
Date:   Sat Aug 26 08:42:43 2023 +0300

    wifi: ath12k: Ignore fragments from uninitialized peer in dp
    
    [ Upstream commit bbc86757ca62423c3b6bd8f7176da1ff43450769 ]
    
    When max virtual ap interfaces are configured in all the bands with
    ACS and hostapd restart is done every 60s, a crash is observed at
    random times.
    
    In the above scenario, a fragmented packet is received for self peer,
    for which rx_tid and rx_frags are not initialized in datapath.
    While handling this fragment, crash is observed as the rx_frag list
    is uninitialized and when we walk in ath12k_dp_rx_h_sort_frags,
    skb null leads to exception.
    
    To address this, before processing received fragments we check
    dp_setup_done flag is set to ensure that peer has completed its
    dp peer setup for fragment queue, else ignore processing the
    fragments.
    
    Call trace:
        PC points to "ath12k_dp_process_rx_err+0x4e8/0xfcc [ath12k]"
        LR points to "ath12k_dp_process_rx_err+0x480/0xfcc [ath12k]".
        The Backtrace obtained is as follows:
        ath12k_dp_process_rx_err+0x4e8/0xfcc [ath12k]
        ath12k_dp_service_srng+0x78/0x260 [ath12k]
        ath12k_pci_write32+0x990/0xb0c [ath12k]
        __napi_poll+0x30/0xa4
        net_rx_action+0x118/0x270
        __do_softirq+0x10c/0x244
        irq_exit+0x64/0xb4
        __handle_domain_irq+0x88/0xac
        gic_handle_irq+0x74/0xbc
        el1_irq+0xf0/0x1c0
        arch_cpu_idle+0x10/0x18
        do_idle+0x104/0x248
        cpu_startup_entry+0x20/0x64
        rest_init+0xd0/0xdc
        arch_call_rest_init+0xc/0x14
    
    Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
    
    Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
    Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20230821130343.29495-2-quic_hprem@quicinc.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 03f9498afa52493decd0514fe899f8da9d812552
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Tue Aug 29 12:45:31 2023 +0300

    wifi: plfxlc: fix clang-specific fortify warning
    
    [ Upstream commit a763e92c78615ea838f5b9a841398b1d4adb968e ]
    
    When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've
    noticed the following (somewhat confusing due to absence of an actual
    source code location):
    
    In file included from drivers/net/wireless/purelifi/plfxlc/mac.c:6:
    In file included from ./include/linux/netdevice.h:24:
    In file included from ./include/linux/timer.h:6:
    In file included from ./include/linux/ktime.h:24:
    In file included from ./include/linux/time.h:60:
    In file included from ./include/linux/time32.h:13:
    In file included from ./include/linux/timex.h:67:
    In file included from ./arch/x86/include/asm/timex.h:5:
    In file included from ./arch/x86/include/asm/processor.h:23:
    In file included from ./arch/x86/include/asm/msr.h:11:
    In file included from ./arch/x86/include/asm/cpumask.h:5:
    In file included from ./include/linux/cpumask.h:12:
    In file included from ./include/linux/bitmap.h:11:
    In file included from ./include/linux/string.h:254:
    ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
    declared with 'warning' attribute: detected read beyond size of field (2nd
    parameter); maybe use struct_group()? [-Wattribute-warning]
                            __read_overflow2_field(q_size_field, size);
    
    The compiler actually complains on 'plfxlc_get_et_strings()' where
    fortification logic inteprets call to 'memcpy()' as an attempt to copy
    the whole 'et_strings' array from its first member and so issues an
    overread warning. This warning may be silenced by passing an address
    of the whole array and not the first member to 'memcpy()'.
    
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20230829094541.234751-1-dmantipov@yandex.ru
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0f32b0b2bdadda65d23e09dc56067a38c2f224db
Author: Mike Rapoport (IBM) <rppt@kernel.org>
Date:   Wed Oct 18 12:42:50 2023 +0200

    x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size
    
    [ Upstream commit a1e2b8b36820d8c91275f207e77e91645b7c6836 ]
    
    Qi Zheng reported crashes in a production environment and provided a
    simplified example as a reproducer:
    
     |  For example, if we use Qemu to start a two NUMA node kernel,
     |  one of the nodes has 2M memory (less than NODE_MIN_SIZE),
     |  and the other node has 2G, then we will encounter the
     |  following panic:
     |
     |    BUG: kernel NULL pointer dereference, address: 0000000000000000
     |    <...>
     |    RIP: 0010:_raw_spin_lock_irqsave+0x22/0x40
     |    <...>
     |    Call Trace:
     |      <TASK>
     |      deactivate_slab()
     |      bootstrap()
     |      kmem_cache_init()
     |      start_kernel()
     |      secondary_startup_64_no_verify()
    
    The crashes happen because of inconsistency between the nodemask that
    has nodes with less than 4MB as memoryless, and the actual memory fed
    into the core mm.
    
    The commit:
    
      9391a3f9c7f1 ("[PATCH] x86_64: Clear more state when ignoring empty node in SRAT parsing")
    
    ... that introduced minimal size of a NUMA node does not explain why
    a node size cannot be less than 4MB and what boot failures this
    restriction might fix.
    
    Fixes have been submitted to the core MM code to tighten up the
    memory topologies it accepts and to not crash on weird input:
    
      mm: page_alloc: skip memoryless nodes entirely
      mm: memory_hotplug: drop memoryless node from fallback lists
    
    Andrew has accepted them into the -mm tree, but there are no
    stable SHA1's yet.
    
    This patch drops the limitation for minimal node size on x86:
    
      - which works around the crash without the fixes to the core MM.
      - makes x86 topologies less weird,
      - removes an arbitrary and undocumented limitation on NUMA topologies.
    
    [ mingo: Improved changelog clarity. ]
    
    Reported-by: Qi Zheng <zhengqi.arch@bytedance.com>
    Tested-by: Mario Casquero <mcasquer@redhat.com>
    Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Acked-by: David Hildenbrand <david@redhat.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Rik van Riel <riel@surriel.com>
    Link: https://lore.kernel.org/r/ZS+2qqjEO5/867br@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit be2355b7763cee677b76e962aa98ba294c5402f2
Author: Frederic Weisbecker <frederic@kernel.org>
Date:   Sun Sep 24 17:07:02 2023 +0200

    workqueue: Provide one lock class key per work_on_cpu() callsite
    
    [ Upstream commit 265f3ed077036f053981f5eea0b5b43e7c5b39ff ]
    
    All callers of work_on_cpu() share the same lock class key for all the
    functions queued. As a result the workqueue related locking scenario for
    a function A may be spuriously accounted as an inversion against the
    locking scenario of function B such as in the following model:
    
            long A(void *arg)
            {
                    mutex_lock(&mutex);
                    mutex_unlock(&mutex);
            }
    
            long B(void *arg)
            {
            }
    
            void launchA(void)
            {
                    work_on_cpu(0, A, NULL);
            }
    
            void launchB(void)
            {
                    mutex_lock(&mutex);
                    work_on_cpu(1, B, NULL);
                    mutex_unlock(&mutex);
            }
    
    launchA and launchB running concurrently have no chance to deadlock.
    However the above can be reported by lockdep as a possible locking
    inversion because the works containing A() and B() are treated as
    belonging to the same locking class.
    
    The following shows an existing example of such a spurious lockdep splat:
    
             ======================================================
             WARNING: possible circular locking dependency detected
             6.6.0-rc1-00065-g934ebd6e5359 #35409 Not tainted
             ------------------------------------------------------
             kworker/0:1/9 is trying to acquire lock:
             ffffffff9bc72f30 (cpu_hotplug_lock){++++}-{0:0}, at: _cpu_down+0x57/0x2b0
    
             but task is already holding lock:
             ffff9e3bc0057e60 ((work_completion)(&wfc.work)){+.+.}-{0:0}, at: process_scheduled_works+0x216/0x500
    
             which lock already depends on the new lock.
    
             the existing dependency chain (in reverse order) is:
    
             -> #2 ((work_completion)(&wfc.work)){+.+.}-{0:0}:
                            __flush_work+0x83/0x4e0
                            work_on_cpu+0x97/0xc0
                            rcu_nocb_cpu_offload+0x62/0xb0
                            rcu_nocb_toggle+0xd0/0x1d0
                            kthread+0xe6/0x120
                            ret_from_fork+0x2f/0x40
                            ret_from_fork_asm+0x1b/0x30
    
             -> #1 (rcu_state.barrier_mutex){+.+.}-{3:3}:
                            __mutex_lock+0x81/0xc80
                            rcu_nocb_cpu_deoffload+0x38/0xb0
                            rcu_nocb_toggle+0x144/0x1d0
                            kthread+0xe6/0x120
                            ret_from_fork+0x2f/0x40
                            ret_from_fork_asm+0x1b/0x30
    
             -> #0 (cpu_hotplug_lock){++++}-{0:0}:
                            __lock_acquire+0x1538/0x2500
                            lock_acquire+0xbf/0x2a0
                            percpu_down_write+0x31/0x200
                            _cpu_down+0x57/0x2b0
                            __cpu_down_maps_locked+0x10/0x20
                            work_for_cpu_fn+0x15/0x20
                            process_scheduled_works+0x2a7/0x500
                            worker_thread+0x173/0x330
                            kthread+0xe6/0x120
                            ret_from_fork+0x2f/0x40
                            ret_from_fork_asm+0x1b/0x30
    
             other info that might help us debug this:
    
             Chain exists of:
               cpu_hotplug_lock --> rcu_state.barrier_mutex --> (work_completion)(&wfc.work)
    
              Possible unsafe locking scenario:
    
                            CPU0                    CPU1
                            ----                    ----
               lock((work_completion)(&wfc.work));
                                                                            lock(rcu_state.barrier_mutex);
                                                                            lock((work_completion)(&wfc.work));
               lock(cpu_hotplug_lock);
    
              *** DEADLOCK ***
    
             2 locks held by kworker/0:1/9:
              #0: ffff900481068b38 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x212/0x500
              #1: ffff9e3bc0057e60 ((work_completion)(&wfc.work)){+.+.}-{0:0}, at: process_scheduled_works+0x216/0x500
    
             stack backtrace:
             CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.6.0-rc1-00065-g934ebd6e5359 #35409
             Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
             Workqueue: events work_for_cpu_fn
             Call Trace:
             rcu-torture: rcu_torture_read_exit: Start of episode
              <TASK>
              dump_stack_lvl+0x4a/0x80
              check_noncircular+0x132/0x150
              __lock_acquire+0x1538/0x2500
              lock_acquire+0xbf/0x2a0
              ? _cpu_down+0x57/0x2b0
              percpu_down_write+0x31/0x200
              ? _cpu_down+0x57/0x2b0
              _cpu_down+0x57/0x2b0
              __cpu_down_maps_locked+0x10/0x20
              work_for_cpu_fn+0x15/0x20
              process_scheduled_works+0x2a7/0x500
              worker_thread+0x173/0x330
              ? __pfx_worker_thread+0x10/0x10
              kthread+0xe6/0x120
              ? __pfx_kthread+0x10/0x10
              ret_from_fork+0x2f/0x40
              ? __pfx_kthread+0x10/0x10
              ret_from_fork_asm+0x1b/0x30
              </TASK
    
    Fix this with providing one lock class key per work_on_cpu() caller.
    
    Reported-and-tested-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3073f6df783d9d75f7f69f73e16c7ef85d6cfb63
Author: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Date:   Tue Oct 17 17:09:53 2023 +0800

    cpu/hotplug: Don't offline the last non-isolated CPU
    
    [ Upstream commit 38685e2a0476127db766f81b1c06019ddc4c9ffa ]
    
    If a system has isolated CPUs via the "isolcpus=" command line parameter,
    then an attempt to offline the last housekeeping CPU will result in a
    WARN_ON() when rebuilding the scheduler domains and a subsequent panic due
    to and unhandled empty CPU mas in partition_sched_domains_locked().
    
    cpuset_hotplug_workfn()
      rebuild_sched_domains_locked()
        ndoms = generate_sched_domains(&doms, &attr);
          cpumask_and(doms[0], top_cpuset.effective_cpus, housekeeping_cpumask(HK_FLAG_DOMAIN));
    
    Thus results in an empty CPU mask which triggers the warning and then the
    subsequent crash:
    
    WARNING: CPU: 4 PID: 80 at kernel/sched/topology.c:2366 build_sched_domains+0x120c/0x1408
    Call trace:
     build_sched_domains+0x120c/0x1408
     partition_sched_domains_locked+0x234/0x880
     rebuild_sched_domains_locked+0x37c/0x798
     rebuild_sched_domains+0x30/0x58
     cpuset_hotplug_workfn+0x2a8/0x930
    
    Unable to handle kernel paging request at virtual address fffe80027ab37080
     partition_sched_domains_locked+0x318/0x880
     rebuild_sched_domains_locked+0x37c/0x798
    
    Aside of the resulting crash, it does not make any sense to offline the last
    last housekeeping CPU.
    
    Prevent this by masking out the non-housekeeping CPUs when selecting a
    target CPU for initiating the CPU unplug operation via the work queue.
    
    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/202310171709530660462@zte.com.cn
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f6cc3d85cb80d79578b9616e3fc6ab8e8d9aaa55
Author: Rik van Riel <riel@surriel.com>
Date:   Mon Aug 21 16:04:09 2023 -0400

    smp,csd: Throw an error if a CSD lock is stuck for too long
    
    [ Upstream commit 94b3f0b5af2c7af69e3d6e0cdd9b0ea535f22186 ]
    
    The CSD lock seems to get stuck in 2 "modes". When it gets stuck
    temporarily, it usually gets released in a few seconds, and sometimes
    up to one or two minutes.
    
    If the CSD lock stays stuck for more than several minutes, it never
    seems to get unstuck, and gradually more and more things in the system
    end up also getting stuck.
    
    In the latter case, we should just give up, so the system can dump out
    a little more information about what went wrong, and, with panic_on_oops
    and a kdump kernel loaded, dump a whole bunch more information about what
    might have gone wrong.  In addition, there is an smp.panic_on_ipistall
    kernel boot parameter that by default retains the old behavior, but when
    set enables the panic after the CSD lock has been stuck for more than
    the specified number of milliseconds, as in 300,000 for five minutes.
    
    [ paulmck: Apply Imran Khan feedback. ]
    [ paulmck: Apply Leonardo Bras feedback. ]
    
    Link: https://lore.kernel.org/lkml/bc7cc8b0-f587-4451-8bcd-0daae627bcc7@paulmck-laptop/
    Signed-off-by: Rik van Riel <riel@surriel.com>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Reviewed-by: Imran Khan <imran.f.khan@oracle.com>
    Reviewed-by: Leonardo Bras <leobras@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Valentin Schneider <vschneid@redhat.com>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f62c43d64d5a1673b7b99161c2a324928d1f68db
Author: Frederic Weisbecker <frederic@kernel.org>
Date:   Wed Oct 4 01:29:00 2023 +0200

    srcu: Only accelerate on enqueue time
    
    [ Upstream commit 8a77f38bcd28d3c22ab7dd8eff3f299d43c00411 ]
    
    Acceleration in SRCU happens on enqueue time for each new callback. This
    operation is expected not to fail and therefore any similar attempt
    from other places shouldn't find any remaining callbacks to accelerate.
    
    Moreover accelerations performed beyond enqueue time are error prone
    because rcu_seq_snap() then may return the snapshot for a new grace
    period that is not going to be started.
    
    Remove these dangerous and needless accelerations and introduce instead
    assertions reporting leaking unaccelerated callbacks beyond enqueue
    time.
    
    Co-developed-by: Yong He <alexyonghe@tencent.com>
    Signed-off-by: Yong He <alexyonghe@tencent.com>
    Co-developed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Co-developed-by: Neeraj upadhyay <Neeraj.Upadhyay@amd.com>
    Signed-off-by: Neeraj upadhyay <Neeraj.Upadhyay@amd.com>
    Reviewed-by: Like Xu <likexu@tencent.com>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b3b5c2730458c6d9b4a0ce634659284ec94f0441
Author: Ronald Wahl <ronald.wahl@raritan.com>
Date:   Sat Oct 7 18:17:13 2023 +0200

    clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware
    
    [ Upstream commit 6d3bc4c02d59996d1d3180d8ed409a9d7d5900e0 ]
    
    On SAM9 hardware two cascaded 16 bit timers are used to form a 32 bit
    high resolution timer that is used as scheduler clock when the kernel
    has been configured that way (CONFIG_ATMEL_CLOCKSOURCE_TCB).
    
    The driver initially triggers a reset-to-zero of the two timers but this
    reset is only performed on the next rising clock. For the first timer
    this is ok - it will be in the next 60ns (16MHz clock). For the chained
    second timer this will only happen after the first timer overflows, i.e.
    after 2^16 clocks (~4ms with a 16MHz clock). So with other words the
    scheduler clock resets to 0 after the first 2^16 clock cycles.
    
    It looks like that the scheduler does not like this and behaves wrongly
    over its lifetime, e.g. some tasks are scheduled with a long delay. Why
    that is and if there are additional requirements for this behaviour has
    not been further analysed.
    
    There is a simple fix for resetting the second timer as well when the
    first timer is reset and this is to set the ATMEL_TC_ASWTRG_SET bit in
    the Channel Mode register (CMR) of the first timer. This will also rise
    the TIOA line (clock input of the second timer) when a software trigger
    respective SYNC is issued.
    
    Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
    Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Link: https://lore.kernel.org/r/20231007161803.31342-1-rwahl@gmx.de
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 07a2284773c9afe0644dc235f8523b88ea2789f3
Author: Jacky Bai <ping.bai@nxp.com>
Date:   Mon Oct 9 16:39:22 2023 +0800

    clocksource/drivers/timer-imx-gpt: Fix potential memory leak
    
    [ Upstream commit 8051a993ce222a5158bccc6ac22ace9253dd71cb ]
    
    Fix coverity Issue CID 250382:  Resource leak (RESOURCE_LEAK).
    Add kfree when error return.
    
    Signed-off-by: Jacky Bai <ping.bai@nxp.com>
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Link: https://lore.kernel.org/r/20231009083922.1942971-1-ping.bai@nxp.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2a79a7e8b6417d58e803b2c0005dac40a45d3637
Author: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Date:   Wed Aug 2 08:32:52 2023 +0200

    selftests/lkdtm: Disable CONFIG_UBSAN_TRAP in test config
    
    [ Upstream commit cf77bf698887c3b9ebed76dea492b07a3c2c7632 ]
    
    The lkdtm selftest config fragment enables CONFIG_UBSAN_TRAP to make the
    ARRAY_BOUNDS test kill the calling process when an out-of-bound access
    is detected by UBSAN. However, after this [1] commit, UBSAN is triggered
    under many new scenarios that weren't detected before, such as in struct
    definitions with fixed-size trailing arrays used as flexible arrays. As
    a result, CONFIG_UBSAN_TRAP=y has become a very aggressive option to
    enable except for specific situations.
    
    `make kselftest-merge` applies CONFIG_UBSAN_TRAP=y to the kernel config
    for all selftests, which makes many of them fail because of system hangs
    during boot.
    
    This change removes the config option from the lkdtm kselftest and
    configures the ARRAY_BOUNDS test to look for UBSAN reports rather than
    relying on the calling process being killed.
    
    [1] commit 2d47c6956ab3 ("ubsan: Tighten UBSAN_BOUNDS on GCC")'
    
    Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/20230802063252.1917997-1-ricardo.canuelo@collabora.com
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 74f6aedbe6f80eb13feda356d6bd962c6296d5b7
Author: Denis Arefev <arefev@swemel.ru>
Date:   Mon Sep 4 15:21:14 2023 +0300

    srcu: Fix srcu_struct node grpmask overflow on 64-bit systems
    
    [ Upstream commit d8d5b7bf6f2105883bbd91bbd4d5b67e4e3dff71 ]
    
    The value of a bitwise expression 1 << (cpu - sdp->mynode->grplo)
    is subject to overflow due to a failure to cast operands to a larger
    data type before performing the bitwise operation.
    
    The maximum result of this subtraction is defined by the RCU_FANOUT_LEAF
    Kconfig option, which on 64-bit systems defaults to 16 (resulting in a
    maximum shift of 15), but which can be set up as high as 64 (resulting
    in a maximum shift of 63).  A value of 31 can result in sign extension,
    resulting in 0xffffffff80000000 instead of the desired 0x80000000.
    A value of 32 or greater triggers undefined behavior per the C standard.
    
    This bug has not been known to cause issues because almost all kernels
    take the default CONFIG_RCU_FANOUT_LEAF=16.  Furthermore, as long as a
    given compiler gives a deterministic non-zero result for 1<<N for N>=32,
    the code correctly invokes all SRCU callbacks, albeit wasting CPU time
    along the way.
    
    This commit therefore substitutes the correct 1UL for the buggy 1.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Signed-off-by: Denis Arefev <arefev@swemel.ru>
    Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
    Cc: David Laight <David.Laight@aculab.com>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 2e905e608e38cf7f8dcddcf8a6036e91a78444cb
Author: Shuai Xue <xueshuai@linux.alibaba.com>
Date:   Thu Sep 7 08:43:07 2023 +0800

    perf/core: Bail out early if the request AUX area is out of bound
    
    [ Upstream commit 54aee5f15b83437f23b2b2469bcf21bdd9823916 ]
    
    When perf-record with a large AUX area, e.g 4GB, it fails with:
    
        #perf record -C 0 -m ,4G -e arm_spe_0// -- sleep 1
        failed to mmap with 12 (Cannot allocate memory)
    
    and it reveals a WARNING with __alloc_pages():
    
            ------------[ cut here ]------------
            WARNING: CPU: 44 PID: 17573 at mm/page_alloc.c:5568 __alloc_pages+0x1ec/0x248
            Call trace:
             __alloc_pages+0x1ec/0x248
             __kmalloc_large_node+0xc0/0x1f8
             __kmalloc_node+0x134/0x1e8
             rb_alloc_aux+0xe0/0x298
             perf_mmap+0x440/0x660
             mmap_region+0x308/0x8a8
             do_mmap+0x3c0/0x528
             vm_mmap_pgoff+0xf4/0x1b8
             ksys_mmap_pgoff+0x18c/0x218
             __arm64_sys_mmap+0x38/0x58
             invoke_syscall+0x50/0x128
             el0_svc_common.constprop.0+0x58/0x188
             do_el0_svc+0x34/0x50
             el0_svc+0x34/0x108
             el0t_64_sync_handler+0xb8/0xc0
             el0t_64_sync+0x1a4/0x1a8
    
    'rb->aux_pages' allocated by kcalloc() is a pointer array which is used to
    maintains AUX trace pages. The allocated page for this array is physically
    contiguous (and virtually contiguous) with an order of 0..MAX_ORDER. If the
    size of pointer array crosses the limitation set by MAX_ORDER, it reveals a
    WARNING.
    
    So bail out early with -ENOMEM if the request AUX area is out of bound,
    e.g.:
    
        #perf record -C 0 -m ,4G -e arm_spe_0// -- sleep 1
        failed to mmap with 12 (Cannot allocate memory)
    
    Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e2d8abf5afc6957ee89704f5f33b9faa844fcf94
Author: Josh Poimboeuf <jpoimboe@kernel.org>
Date:   Tue Oct 17 09:59:46 2023 -0700

    x86/retpoline: Make sure there are no unconverted return thunks due to KCSAN
    
    [ Upstream commit 2d7ce49f58dc95495b3e22e45d2be7de909b2c63 ]
    
    Enabling CONFIG_KCSAN leads to unconverted, default return thunks to
    remain after patching.
    
    As David Kaplan describes in his debugging of the issue, it is caused by
    a couple of KCSAN-generated constructors which aren't processed by
    objtool:
    
      "When KCSAN is enabled, GCC generates lots of constructor functions
      named _sub_I_00099_0 which call __tsan_init and then return.  The
      returns in these are generally annotated normally by objtool and fixed
      up at runtime.  But objtool runs on vmlinux.o and vmlinux.o does not
      include a couple of object files that are in vmlinux, like
      init/version-timestamp.o and .vmlinux.export.o, both of which contain
      _sub_I_00099_0 functions.  As a result, the returns in these functions
      are not annotated, and the panic occurs when we call one of them in
      do_ctors and it uses the default return thunk.
    
      This difference can be seen by counting the number of these functions in the object files:
      $ objdump -d vmlinux.o|grep -c "<_sub_I_00099_0>:"
      2601
      $ objdump -d vmlinux|grep -c "<_sub_I_00099_0>:"
      2603
    
      If these functions are only run during kernel boot, there is no
      speculation concern."
    
    Fix it by disabling KCSAN on version-timestamp.o and .vmlinux.export.o
    so the extra functions don't get generated.  KASAN and GCOV are already
    disabled for those files.
    
      [ bp: Massage commit message. ]
    
    Closes: https://lore.kernel.org/lkml/20231016214810.GA3942238@dev-arch.thelio-3990X/
    Reported-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
    Acked-by: Marco Elver <elver@google.com>
    Tested-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20231017165946.v4i2d4exyqwqq3bx@treble
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit aa7f1827953100cdde0795289a80c6c077bfe437
Author: Kent Overstreet <kent.overstreet@gmail.com>
Date:   Fri Feb 12 20:11:25 2021 -0500

    lib/generic-radix-tree.c: Don't overflow in peek()
    
    [ Upstream commit 9492261ff2460252cf2d8de89cdf854c7e2b28a0 ]
    
    When we started spreading new inode numbers throughout most of the 64
    bit inode space, that triggered some corner case bugs, in particular
    some integer overflows related to the radix tree code. Oops.
    
    Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d5e09e385e8abfdbbd9af3e2c83e4e8ca854f2ef
Author: Filipe Manana <fdmanana@suse.com>
Date:   Tue Sep 12 13:04:29 2023 +0100

    btrfs: abort transaction on generation mismatch when marking eb as dirty
    
    [ Upstream commit 50564b651d01c19ce732819c5b3c3fd60707188e ]
    
    When marking an extent buffer as dirty, at btrfs_mark_buffer_dirty(),
    we check if its generation matches the running transaction and if not we
    just print a warning. Such mismatch is an indicator that something really
    went wrong and only printing a warning message (and stack trace) is not
    enough to prevent a corruption. Allowing a transaction to commit with such
    an extent buffer will trigger an error if we ever try to read it from disk
    due to a generation mismatch with its parent generation.
    
    So abort the current transaction with -EUCLEAN if we notice a generation
    mismatch. For this we need to pass a transaction handle to
    btrfs_mark_buffer_dirty() which is always available except in test code,
    in which case we can pass NULL since it operates on dummy extent buffers
    and all test roots have a single node/leaf (root node at level 0).
    
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 304a2c4aad0fff887ce493e4197bf9cbaf394479
Author: John Stultz <jstultz@google.com>
Date:   Fri Sep 22 04:36:00 2023 +0000

    locking/ww_mutex/test: Fix potential workqueue corruption
    
    [ Upstream commit bccdd808902f8c677317cec47c306e42b93b849e ]
    
    In some cases running with the test-ww_mutex code, I was seeing
    odd behavior where sometimes it seemed flush_workqueue was
    returning before all the work threads were finished.
    
    Often this would cause strange crashes as the mutexes would be
    freed while they were being used.
    
    Looking at the code, there is a lifetime problem as the
    controlling thread that spawns the work allocates the
    "struct stress" structures that are passed to the workqueue
    threads. Then when the workqueue threads are finished,
    they free the stress struct that was passed to them.
    
    Unfortunately the workqueue work_struct node is in the stress
    struct. Which means the work_struct is freed before the work
    thread returns and while flush_workqueue is waiting.
    
    It seems like a better idea to have the controlling thread
    both allocate and free the stress structures, so that we can
    be sure we don't corrupt the workqueue by freeing the structure
    prematurely.
    
    So this patch reworks the test to do so, and with this change
    I no longer see the early flush_workqueue returns.
    
    Signed-off-by: John Stultz <jstultz@google.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20230922043616.19282-3-jstultz@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>