óÐÉÓÏË ÉÚÍÅÎÅÎÉÊ × Linux 5.10.202

 
9p/trans_fd: Annotate data-racy writes to file::f_flags [+ + +]
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>

 
ACPI: resource: Do IRQ override on TongFang GMxXGxx [+ + +]
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>

 
ALSA: hda/realtek - Add Dell ALC295 to pin fall back table [+ + +]
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>

ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC [+ + +]
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>

ALSA: hda: Fix possible null-ptr-deref when assigning a stream [+ + +]
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>

ALSA: info: Fix potential deadlock at disconnection [+ + +]
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>

 
arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM [+ + +]
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>

arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size [+ + +]
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
    
    [ Upstream commit 72fc3d58b87b0d622039c6299b89024fbb7b420f ]
    
    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: Sasha Levin <sashal@kernel.org>

arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO [+ + +]
Author: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date:   Fri Sep 9 11:20:31 2022 +0200

    arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO
    
    [ Upstream commit f5e303aefc06b7508d7a490f9a2d80e4dc134c70 ]
    
    The TCSR mutex bindings allow device to be described only with address
    space (so it uses MMIO, not syscon regmap).  This seems reasonable as
    TCSR mutex is actually a dedicated IO address space and it also fixes DT
    schema checks:
    
      qcom/ipq6018-cp01-c1.dtb: hwlock: 'reg' is a required property
      qcom/ipq6018-cp01-c1.dtb: hwlock: 'syscon' does not match any of the regexes: 'pinctrl-[0-9]+'
    
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/20220909092035.223915-12-krzysztof.kozlowski@linaro.org
    Stable-dep-of: 72fc3d58b87b ("arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer [+ + +]
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>

 
ARM: 9320/1: fix stack depot IRQ stack filter [+ + +]
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>

 
ASoC: soc-card: Add storage for PCI SSID [+ + +]
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>

ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings [+ + +]
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>

 
atm: iphase: Do PCI error checks on own line [+ + +]
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>

 
audit: don't take task_lock() in audit_exe_compare() code path [+ + +]
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>

audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare() [+ + +]
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>

 
bluetooth: Add device 0bda:887b to device tables [+ + +]
Author: Larry Finger <Larry.Finger@lwfinger.net>
Date:   Wed Mar 22 19:52:02 2023 -0500

    bluetooth: Add device 0bda:887b to device tables
    
    [ Upstream commit 730a1d1a93a3e30c3723f87af97a8517334b2203 ]
    
    This device is part of a Realtek RTW8852BE chip.
    
    The device table entry is as follows:
    
    T:  Bus=03 Lev=01 Prnt=01 Port=12 Cnt=02 Dev#=  3 Spd=12   MxCh= 0
    D:  Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0bda ProdID=887b 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: Larry Finger <Larry.Finger@lwfinger.net>
    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>

bluetooth: Add device 13d3:3571 to device tables [+ + +]
Author: Larry Finger <Larry.Finger@lwfinger.net>
Date:   Wed Mar 22 19:52:03 2023 -0500

    bluetooth: Add device 13d3:3571 to device tables
    
    [ Upstream commit 069f534247bb6db4f8c2c2ea8e9155abf495c37e ]
    
    This device is part of a Realtek RTW8852BE chip. The device table is as follows:
    
    T:  Bus=03 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=13d3 ProdID=3571 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: Larry Finger <Larry.Finger@lwfinger.net>
    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>

 
Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE [+ + +]
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>

Bluetooth: btusb: Add date->evt_skb is NULL check [+ + +]
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>

Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559 [+ + +]
Author: Artem Lukyanov <dukzcry@ya.ru>
Date:   Wed Nov 23 11:10:05 2022 +0300

    Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559
    
    [ Upstream commit 393b4916b7b5b94faf5c6a7c68df1c62d17e4f38 ]
    
    Add the support ID(0x0cb8, 0xc559) to usb_device_id table for
    Realtek RTL8852BE.
    
    The device info from /sys/kernel/debug/usb/devices as below.
    
    T:  Bus=03 Lev=01 Prnt=01 Port=02 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=0cb8 ProdID=c559 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: Artem Lukyanov <dukzcry@ya.ru>
    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>

Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables [+ + +]
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>

Bluetooth: Fix double free in hci_conn_cleanup [+ + +]
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>

 
bonding: stop the device in bond_setup_by_slave() [+ + +]
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>

 
bpf: Detect IP == ksym.end as part of BPF program [+ + +]
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>

bpf: Fix check_stack_write_fixed_off() to correctly spill imm [+ + +]
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>

bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END [+ + +]
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>

 
btrfs: don't arbitrarily slow down delalloc if we're committing [+ + +]
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>

 
cifs: fix check of rc in function generate_smb3signingkey [+ + +]
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>

cifs: spnego: add ';' in HOST_KEY_LEN [+ + +]
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>

 
clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks [+ + +]
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>

clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks [+ + +]
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>

 
clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware [+ + +]
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>

 
clocksource/drivers/timer-imx-gpt: Fix potential memory leak [+ + +]
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>

 
cpufreq: stats: Fix buffer overflow detection in trans_stats() [+ + +]
Author: Christian Marangi <ansuelsmth@gmail.com>
Date:   Tue Oct 24 20:30:14 2023 +0200

    cpufreq: stats: Fix buffer overflow detection in trans_stats()
    
    [ Upstream commit ea167a7fc2426f7685c3735e104921c1a20a6d3f ]
    
    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: Sasha Levin <sashal@kernel.org>

 
crypto: pcrypt - Fix hungtask for PADATA_RESET [+ + +]
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>

 
dmaengine: stm32-mdma: correct desc prep when channel running [+ + +]
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>

 
drm/amd/display: Avoid NULL dereference of timing generator [+ + +]
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>

drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox [+ + +]
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>

 
drm/amd/pm: Handle non-terminated overdrive commands. [+ + +]
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>

 
drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga [+ + +]
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>

drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7 [+ + +]
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>

 
drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL [+ + +]
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>

drm/amdgpu: fix error handling in amdgpu_bo_list_get() [+ + +]
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>

drm/amdgpu: Fix potential null pointer derefernce [+ + +]
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>

drm/amdgpu: fix software pci_unplug on some chips [+ + +]
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>

 
drm/komeda: drop all currently held locks if deadlock happens [+ + +]
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>

 
drm/msm/dp: skip validity check for DP CTS EDID checksum [+ + +]
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>

 
drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference [+ + +]
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>

 
drm/panel: fix a possible null pointer dereference [+ + +]
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>

drm/panel: st7703: Pick different reset sequence [+ + +]
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>

 
exfat: support handle zero-size directory [+ + +]
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>

 
ext4: apply umask if ACL support is disabled [+ + +]
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>

ext4: correct offset of gdb backup in non meta_bg group to update_backups [+ + +]
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>

ext4: correct return value of ext4_convert_meta_bg [+ + +]
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>

ext4: correct the start block of counting reserved clusters [+ + +]
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>

ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks [+ + +]
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>

 
f2fs: avoid format-overflow warning [+ + +]
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>

 
firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit [+ + +]
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>

 
fs/jfs: Add check for negative db_l2nbperpage [+ + +]
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>

fs/jfs: Add validity check for db_maxag and db_agpref [+ + +]
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>

 
genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware [+ + +]
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>

 
gfs2: fix an oops in gfs2_permission [+ + +]
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>

gfs2: ignore negated quota changes [+ + +]
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>

gfs2: Silence "suspicious RCU usage in gfs2_permission" warning [+ + +]
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>

 
HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W [+ + +]
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>

HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround [+ + +]
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>

 
hvc/xen: fix console unplug [+ + +]
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>

hvc/xen: fix error path in xen_hvc_init() to always register frontend driver [+ + +]
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>

 
i2c: core: Run atomic i2c xfer when !preemptible [+ + +]
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>

i2c: designware: Disable TX_EMPTY irq while waiting for block length byte [+ + +]
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>

i2c: i801: fix potential race in i801_block_transaction_byte_by_byte [+ + +]
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>

i2c: sun6i-p2wi: Prevent potential division by zero [+ + +]
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>

 
i3c: master: cdns: Fix reading status register [+ + +]
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>

 
ima: detect changes to the backing overlay file [+ + +]
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>

 
interconnect: qcom: Add support for mask-based BCMs [+ + +]
Author: Mike Tipton <quic_mdtipton@quicinc.com>
Date:   Fri Jun 23 14:50:42 2023 +0200

    interconnect: qcom: Add support for mask-based BCMs
    
    commit d8630f050d3fd2079f8617dd6c00c6509109c755 upstream.
    
    Some BCMs aren't directly associated with the data path (i.e. ACV) and
    therefore don't communicate using BW. Instead, they are simply
    enabled/disabled with a simple bit mask. Add support for these.
    
    Origin commit retrieved from:
    https://git.codelinaro.org/clo/la/kernel/msm-5.15/-/commit/2d1573e0206998151b342e6b52a4c0f7234d7e36
    
    Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
    [narmstrong: removed copyright change from original commit]
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Link: https://lore.kernel.org/r/20230619-topic-sm8550-upstream-interconnect-mask-vote-v2-1-709474b151cc@linaro.org
    Fixes: fafc114a468e ("interconnect: qcom: Add SM8450 interconnect provider driver")
    Signed-off-by: Georgi Djakov <djakov@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid [+ + +]
Author: Jens Axboe <axboe@kernel.dk>
Date:   Sat Oct 21 12:30:29 2023 -0600

    io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid
    
    commit 7644b1a1c9a7ae8ab99175989bfc8676055edb46 upstream.
    
    We could race with SQ thread exit, and if we do, we'll hit a NULL pointer
    dereference when the thread is cleared. Grab the SQPOLL data lock before
    attempting to get the task cpu and pid for fdinfo, this ensures we have a
    stable view of it.
    
    Cc: stable@vger.kernel.org
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=218032
    Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: He Gao <hegao@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipvlan: add ipvlan_route_v6_outbound() helper [+ + +]
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>

 
jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev [+ + +]
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>

 
jfs: fix array-index-out-of-bounds in dbFindLeaf [+ + +]
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>

jfs: fix array-index-out-of-bounds in diAlloc [+ + +]
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>

 
kernel/reboot: emergency_restart: Set correct system_state [+ + +]
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>

 
kgdb: Flush console before entering kgdb on panic [+ + +]
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>

 
KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space [+ + +]
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>

KVM: x86: Ignore MSR_AMD64_TW_CFG access [+ + +]
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>

 
Linux: Linux 5.10.202 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Nov 28 16:55:02 2023 +0000

    Linux 5.10.202
    
    Link: https://lore.kernel.org/r/20231124171947.127438872@linuxfoundation.org
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Link: https://lore.kernel.org/r/20231125163116.998338186@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Link: https://lore.kernel.org/r/20231126154335.643804657@linuxfoundation.org
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
locking/ww_mutex/test: Fix potential workqueue corruption [+ + +]
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>
 
lsm: fix default return value for inode_getsecctx [+ + +]
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>

lsm: fix default return value for vm_enough_memory [+ + +]
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>

 
macvlan: Don't propagate promisc change to lower dev in passthru [+ + +]
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>

 
mcb: fix error handling for different scenarios when parsing [+ + +]
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>

 
media: cobalt: Use FIELD_GET() to extract Link Width [+ + +]
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>

media: gspca: cpia1: shift-out-of-bounds in set_flicker [+ + +]
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>

media: imon: fix access to invalid resource for the second interface [+ + +]
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>

media: lirc: drop trailing space from scancode transmit [+ + +]
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>

media: qcom: camss: Fix vfe_get() error jump [+ + +]
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>

media: sharp: fix sharp encoding [+ + +]
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>

media: venus: hfi: add checks to handle capabilities from firmware [+ + +]
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>

media: venus: hfi: add checks to perform sanity on queue pointers [+ + +]
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>

media: venus: hfi: fix the check to handle session buffer requirement [+ + +]
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>

media: venus: hfi_parser: Add check to keep the number of codecs within range [+ + +]
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>

media: vivid: avoid integer overflow [+ + +]
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>

 
misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller [+ + +]
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>

 
mm/cma: use nth_page() in place of direct struct page manipulation [+ + +]
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>

 
mm/memory_hotplug: use pfn math in place of direct struct page manipulation [+ + +]
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>

 
mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors [+ + +]
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>

 
mmc: meson-gx: Remove setting of CMD_CFG_ERROR [+ + +]
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>

mmc: sdhci_am654: fix start loop index for TAP value parsing [+ + +]
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>

mmc: vub300: fix an error code [+ + +]
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>

 
mtd: cfi_cmdset_0001: Byte swap OTP info [+ + +]
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>

 
net/mlx5_core: Clean driver version and name [+ + +]
Author: Leon Romanovsky <leon@kernel.org>
Date:   Sun Oct 4 14:30:58 2020 +0300

    net/mlx5_core: Clean driver version and name
    
    [ Upstream commit 17a7612b99e66d2539341ab4f888f970c2c7f76d ]
    
    Remove exposed driver version as it was done in other drivers,
    so module version will work correctly by displaying the kernel
    version for which it is compiled.
    
    And move mlx5_core module name to general include, so auxiliary drivers
    will be able to use it as a basis for a name in their device ID tables.
    
    Reviewed-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Roi Dayan <roid@nvidia.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Stable-dep-of: 1b2bd0c0264f ("net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors [+ + +]
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>

net/mlx5e: fix double free of encap_header [+ + +]
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>

 
net: annotate data-races around sk->sk_dst_pending_confirm [+ + +]
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>

net: annotate data-races around sk->sk_tx_queue_mapping [+ + +]
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>

net: dsa: lan9303: consequently nested-lock physical MDIO [+ + +]
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>

net: ethernet: cortina: Fix max RX frame define [+ + +]
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>

net: ethernet: cortina: Fix MTU max setting [+ + +]
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>

net: ethernet: cortina: Handle large frames [+ + +]
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>

net: hns3: fix variable may not initialized problem in hns3_init_mac_addr() [+ + +]
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>

net: hns3: fix VF reset fail issue [+ + +]
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>

net: phylink: initialize carrier state at creation [+ + +]
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>

net: stmmac: fix rx budget limit check [+ + +]
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>

 
netfilter: nf_conntrack_bridge: initialize err to 0 [+ + +]
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>

netfilter: nf_tables: disable toggling dormant table state more than once [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Nov 21 13:13:32 2023 +0100

    netfilter: nf_tables: disable toggling dormant table state more than once
    
    commit c9bd26513b3a11b3adb3c2ed8a31a01a87173ff1 upstream.
    
    nft -f -<<EOF
    add table ip t
    add table ip t { flags dormant; }
    add chain ip t c { type filter hook input priority 0; }
    add table ip t
    EOF
    
    Triggers a splat from nf core on next table delete because we lose
    track of right hook register state:
    
    WARNING: CPU: 2 PID: 1597 at net/netfilter/core.c:501 __nf_unregister_net_hook
    RIP: 0010:__nf_unregister_net_hook+0x41b/0x570
     nf_unregister_net_hook+0xb4/0xf0
     __nf_tables_unregister_hook+0x160/0x1d0
    [..]
    
    The above should have table in *active* state, but in fact no
    hooks were registered.
    
    Reject on/off/on games rather than attempting to fix this.
    
    Fixes: 179d9ba5559a ("netfilter: nf_tables: fix table flag updates")
    Reported-by: "Lee, Cherie-Anne" <cherie.lee@starlabs.sg>
    Cc: Bing-Jhong Billy Jheng <billy@starlabs.sg>
    Cc: info@starlabs.sg
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: nf_tables: fix table flag updates [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Nov 21 13:13:31 2023 +0100

    netfilter: nf_tables: fix table flag updates
    
    commit 179d9ba5559a756f4322583388b3213fe4e391b0 upstream.
    
    The dormant flag need to be updated from the preparation phase,
    otherwise, two consecutive requests to dorm a table in the same batch
    might try to remove the same hooks twice, resulting in the following
    warning:
    
     hook not found, pf 3 num 0
     WARNING: CPU: 0 PID: 334 at net/netfilter/core.c:480 __nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480
     Modules linked in:
     CPU: 0 PID: 334 Comm: kworker/u4:5 Not tainted 5.12.0-syzkaller #0
     Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
     Workqueue: netns cleanup_net
     RIP: 0010:__nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480
    
    This patch is a partial revert of 0ce7cf4127f1 ("netfilter: nftables:
    update table flags from the commit phase") to restore the previous
    behaviour.
    
    However, there is still another problem: A batch containing a series of
    dorm-wakeup-dorm table and vice-versa also trigger the warning above
    since hook unregistration happens from the preparation phase, while hook
    registration occurs from the commit phase.
    
    To fix this problem, this patch adds two internal flags to annotate the
    original dormant flag status which are __NFT_TABLE_F_WAS_DORMANT and
    __NFT_TABLE_F_WAS_AWAKEN, to restore it from the abort path.
    
    The __NFT_TABLE_F_UPDATE bitmask allows to handle the dormant flag update
    with one single transaction.
    
    Reported-by: syzbot+7ad5cd1615f2d89c6e7e@syzkaller.appspotmail.com
    Fixes: 0ce7cf4127f1 ("netfilter: nftables: update table flags from the commit phase")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: nftables: update table flags from the commit phase [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Nov 21 13:13:30 2023 +0100

    netfilter: nftables: update table flags from the commit phase
    
    commit 0ce7cf4127f14078ca598ba9700d813178a59409 upstream.
    
    Do not update table flags from the preparation phase. Store the flags
    update into the transaction, then update the flags from the commit
    phase.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nfsd: fix file memleak on client_opens_release [+ + +]
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>

 
NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO [+ + +]
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>

 
parisc/pdc: Add width field to struct pdc_model [+ + +]
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>

 
parisc/pgtable: Do not drop upper 5 address bits of physical address [+ + +]
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>

 
parisc: Prevent booting 64-bit kernels on PA1.x machines [+ + +]
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>

 
PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() [+ + +]
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>

 
PCI/sysfs: Protect driver's D3cold preference from user space [+ + +]
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>

 
PCI: exynos: Don't discard .remove() callback [+ + +]
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
    
    [ Upstream commit 83a939f0fdc208ff3639dd3d42ac9b3c35607fd2 ]
    
    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: Sasha Levin <sashal@kernel.org>

PCI: keystone: Don't discard .probe() callback [+ + +]
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>

PCI: keystone: Don't discard .remove() callback [+ + +]
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>

PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields [+ + +]
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>

 
perf/core: Bail out early if the request AUX area is out of bound [+ + +]
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>

 
platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e [+ + +]
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>

 
PM: hibernate: Clean up sync_read handling in snapshot_write_next() [+ + +]
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>

PM: hibernate: Use __get_safe_page() rather than touching the list [+ + +]
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>

 
powerpc/perf: Fix disabling BHRB and instruction sampling [+ + +]
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>

 
ppp: limit MRU to 64K [+ + +]
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>

 
ptp: annotate data-race around q->head and q->tail [+ + +]
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>

 
pwm: Fix double shift bug [+ + +]
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>

 
quota: explicitly forbid quota files from being encrypted [+ + +]
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>

 
randstruct: Fix gcc-plugin performance mode to stay in group [+ + +]
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>

 
rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects [+ + +]
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>

 
RDMA/hfi1: Use FIELD_GET() to extract Link Width [+ + +]
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>

 
Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E" [+ + +]
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>

 
Revert ncsi: Propagate carrier gain/loss events to the NCSI controller [+ + +]
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>

 
scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup() [+ + +]
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>

scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for selected registers [+ + +]
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>

scsi: mpt3sas: Fix loop logic [+ + +]
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>

 
selftests/efivarfs: create-read: fix a resource leak [+ + +]
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>

 
serial: meson: remove redundant initialization of variable id [+ + +]
Author: Colin Ian King <colin.i.king@gmail.com>
Date:   Mon Apr 26 11:11:06 2021 +0100

    serial: meson: remove redundant initialization of variable id
    
    [ Upstream commit 021212f5335229ed12e3d31f9b7d30bd3bb66f7d ]
    
    The variable id being initialized with a value that is never read
    and it is being updated later with a new value. The initialization is
    redundant and can be removed. Since id is just being used in a for-loop
    inside a local scope, move the declaration of id to that scope.
    
    Reviewed-by: Kevin Hilman <khilman@baylibre.com>
    Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Addresses-Coverity: ("Unused value")
    Link: https://lore.kernel.org/r/20210426101106.9122-1-colin.king@canonical.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 2a1d728f20ed ("tty: serial: meson: fix hard LOCKUP on crtscts mode")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

serial: meson: Use platform_get_irq() to get the interrupt [+ + +]
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Date:   Fri Dec 24 14:29:10 2021 +0000

    serial: meson: Use platform_get_irq() to get the interrupt
    
    [ Upstream commit 5b68061983471470d4109bac776145245f06bc09 ]
    
    platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.
    
    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq().
    
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211224142917.6966-5-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 2a1d728f20ed ("tty: serial: meson: fix hard LOCKUP on crtscts mode")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
SUNRPC: Add an IS_ERR() check back to where it was [+ + +]
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>

SUNRPC: ECONNRESET might require a rebind [+ + +]
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>

SUNRPC: Fix RPC client cleaned up the freed pipefs dentries [+ + +]
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>

 
tipc: Fix kernel-infoleak due to uninitialized TLV value [+ + +]
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>

 
tools/power/turbostat: Fix a knl bug [+ + +]
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>

 
tracing: Have trace_event_file have ref counters [+ + +]
Author: Steven Rostedt (Google) <rostedt@goodmis.org>
Date:   Tue Oct 31 12:24:53 2023 -0400

    tracing: Have trace_event_file have ref counters
    
    commit bb32500fb9b78215e4ef6ee8b4345c5f5d7eafb4 upstream.
    
    The following can crash the kernel:
    
     # cd /sys/kernel/tracing
     # echo 'p:sched schedule' > kprobe_events
     # exec 5>>events/kprobes/sched/enable
     # > kprobe_events
     # exec 5>&-
    
    The above commands:
    
     1. Change directory to the tracefs directory
     2. Create a kprobe event (doesn't matter what one)
     3. Open bash file descriptor 5 on the enable file of the kprobe event
     4. Delete the kprobe event (removes the files too)
     5. Close the bash file descriptor 5
    
    The above causes a crash!
    
     BUG: kernel NULL pointer dereference, address: 0000000000000028
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     PGD 0 P4D 0
     Oops: 0000 [#1] PREEMPT SMP PTI
     CPU: 6 PID: 877 Comm: bash Not tainted 6.5.0-rc4-test-00008-g2c6b6b1029d4-dirty #186
     Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
     RIP: 0010:tracing_release_file_tr+0xc/0x50
    
    What happens here is that the kprobe event creates a trace_event_file
    "file" descriptor that represents the file in tracefs to the event. It
    maintains state of the event (is it enabled for the given instance?).
    Opening the "enable" file gets a reference to the event "file" descriptor
    via the open file descriptor. When the kprobe event is deleted, the file is
    also deleted from the tracefs system which also frees the event "file"
    descriptor.
    
    But as the tracefs file is still opened by user space, it will not be
    totally removed until the final dput() is called on it. But this is not
    true with the event "file" descriptor that is already freed. If the user
    does a write to or simply closes the file descriptor it will reference the
    event "file" descriptor that was just freed, causing a use-after-free bug.
    
    To solve this, add a ref count to the event "file" descriptor as well as a
    new flag called "FREED". The "file" will not be freed until the last
    reference is released. But the FREE flag will be set when the event is
    removed to prevent any more modifications to that event from happening,
    even if there's still a reference to the event "file" descriptor.
    
    Link: https://lore.kernel.org/linux-trace-kernel/20231031000031.1e705592@gandalf.local.home/
    Link: https://lore.kernel.org/linux-trace-kernel/20231031122453.7a48b923@gandalf.local.home
    
    Cc: stable@vger.kernel.org
    Cc: Mark Rutland <mark.rutland@arm.com>
    Fixes: f5ca233e2e66d ("tracing: Increase trace array ref count on enable and filter files")
    Reported-by: Beau Belgrave <beaub@linux.microsoft.com>
    Tested-by: Beau Belgrave <beaub@linux.microsoft.com>
    Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tty/sysrq: replace smp_processor_id() with get_cpu() [+ + +]
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>

 
tty: Fix uninit-value access in ppp_sync_receive() [+ + +]
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>

tty: serial: meson: fix hard LOCKUP on crtscts mode [+ + +]
Author: Pavel Krasavin <pkrasavin@imaqliq.com>
Date:   Sat Oct 14 11:39:26 2023 +0000

    tty: serial: meson: fix hard LOCKUP on crtscts mode
    
    [ Upstream commit 2a1d728f20edeee7f26dc307ed9df4e0d23947ab ]
    
    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>
    
    v6: stable tag added
    v5: https://lore.kernel.org/lkml/OF43DA36FF.2BD3BB21-ON00258A47.005A8125-00258A47.005A9513@gdc.ru/
    added missed Reviewed-by tags, Fixes tag added according to Dmitry and Neil notes
    v4: https://lore.kernel.org/lkml/OF55521400.7512350F-ON00258A47.003F7254-00258A47.0040E15C@gdc.ru/
    More correct patch subject according to Jiri's note
    v3: https://lore.kernel.org/lkml/OF6CF5FFA0.CCFD0E8E-ON00258A46.00549EDF-00258A46.0054BB62@gdc.ru/
    "From:" line added to the mail
    v2: https://lore.kernel.org/lkml/OF950BEF72.7F425944-ON00258A46.00488A76-00258A46.00497D44@gdc.ru/
    braces for single statement removed according to Dmitry's note
    v1: https://lore.kernel.org/lkml/OF28B2B8C9.5BC0CD28-ON00258A46.0037688F-00258A46.0039155B@gdc.ru/
    Link: https://lore.kernel.org/r/OF66360032.51C36182-ON00258A48.003F656B-00258A48.0040092C@gdc.ru
    
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tty: serial: meson: retrieve port FIFO size from DT [+ + +]
Author: Neil Armstrong <neil.armstrong@linaro.org>
Date:   Tue May 18 09:58:32 2021 +0200

    tty: serial: meson: retrieve port FIFO size from DT
    
    [ Upstream commit 27d44e05d7b85d9d4cfe0a3c0663ea49752ece93 ]
    
    Now the DT bindings has a property to get the FIFO size for a particular port,
    retrieve it and use to setup the FIFO interrupts threshold.
    
    Reviewed-by: Kevin Hilman <khilman@baylibre.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    Link: https://lore.kernel.org/r/20210518075833.3736038-3-narmstrong@baylibre.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 2a1d728f20ed ("tty: serial: meson: fix hard LOCKUP on crtscts mode")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tty: vcc: Add check for kstrdup() in vcc_probe() [+ + +]
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>

 
usb: gadget: f_ncm: Always set current gadget in ncm_bind() [+ + +]
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>

 
watchdog: move softlockup_panic back to early_param [+ + +]
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>

 
wifi: ath10k: Don't touch the CE interrupt registers after power up [+ + +]
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>

wifi: ath10k: fix clang-specific fortify warning [+ + +]
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>

wifi: ath11k: fix dfs radar event locking [+ + +]
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>

wifi: ath11k: fix htt pktlog locking [+ + +]
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>

wifi: ath11k: fix temperature event locking [+ + +]
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>

wifi: ath9k: fix clang-specific fortify warnings [+ + +]
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>

wifi: iwlwifi: Use FW rate for non-data frames [+ + +]
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>

wifi: mac80211: don't return unset power in ieee80211_get_tx_power() [+ + +]
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>

wifi: mac80211_hwsim: fix clang-specific fortify warning [+ + +]
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>

 
x86/cpu/hygon: Fix the CPU topology evaluation for real [+ + +]
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>

 
x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size [+ + +]
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>

 
xen/events: fix delayed eoi list handling [+ + +]
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>

 
xhci: Enable RPM on controllers that support low-power states [+ + +]
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>

xhci: turn cancelled td cleanup to its own function [+ + +]
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Fri Jan 29 15:00:36 2021 +0200

    xhci: turn cancelled td cleanup to its own function
    
    [ Upstream commit 4db356924a50f72a00834ae04f11202d9703faeb ]
    
    Refactor handler for stop endpoint command completion. Yank out the part
    that invalidates cancelled TDs and turn it into a separate function.
    
    Invalidating cancelled TDs should be done while the ring is stopped,
    but not exclusively in the stop endpoint command completeion handler.
    
    We will need to invalidate TDs after resetting endpoints as well.
    
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20210129130044.206855-20-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: a5f928db5951 ("usb: host: xhci-plat: fix possible kernel oops while resuming")
    Signed-off-by: Sasha Levin <sashal@kernel.org>