Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel: Merge Linux 6.6.58 Update #2

Closed
wants to merge 337 commits into from

Conversation

qaz6750
Copy link
Owner

@qaz6750 qaz6750 commented Nov 1, 2024

No description provided.

Xu Yang and others added 30 commits October 17, 2024 15:24
[ Upstream commit e4fdcc1 ]

Currently, suspend interrupt is enabled before pullup enable operation.
This will cause a suspend interrupt assert right after pullup DP. This
suspend interrupt is meaningless, so this will ignore such interrupt
by enable it after usb reset completed.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20240823073832.1702135-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…the Crashkernel Scenario

[ Upstream commit 4058c39 ]

The issue is that before entering the crash kernel, the DWC USB controller
did not perform operations such as resetting the interrupt mask bits.
After entering the crash kernel,before the USB interrupt handler
registration was completed while loading the DWC USB driver,an GINTSTS_SOF
interrupt was received.This triggered the misroute_irq process within the
GIC handling framework,ultimately leading to the misrouting of the
interrupt,causing it to be handled by the wrong interrupt handler
and resulting in the issue.

Summary:In a scenario where the kernel triggers a panic and enters
the crash kernel,it is necessary to ensure that the interrupt mask
bit is not enabled before the interrupt registration is complete.
If an interrupt reaches the CPU at this moment,it will certainly
not be handled correctly,especially in cases where this interrupt
is reported frequently.

Please refer to the Crashkernel dmesg information as follows
(the message on line 3 was added before devm_request_irq is
called by the dwc2_driver_probe function):
[    5.866837][    T1] dwc2 JMIC0010:01: supply vusb_d not found, using dummy regulator
[    5.874588][    T1] dwc2 JMIC0010:01: supply vusb_a not found, using dummy regulator
[    5.882335][    T1] dwc2 JMIC0010:01: before devm_request_irq  irq: [71], gintmsk[0xf300080e], gintsts[0x04200009]
[    5.892686][    C0] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-jmnd1.2_RC #18
[    5.900327][    C0] Hardware name: CMSS HyperCard4-25G/HyperCard4-25G, BIOS 1.6.4 Jul  8 2024
[    5.908836][    C0] Call trace:
[    5.911965][    C0]  dump_backtrace+0x0/0x1f0
[    5.916308][    C0]  show_stack+0x20/0x30
[    5.920304][    C0]  dump_stack+0xd8/0x140
[    5.924387][    C0]  pcie_xxx_handler+0x3c/0x1d8
[    5.930121][    C0]  __handle_irq_event_percpu+0x64/0x1e0
[    5.935506][    C0]  handle_irq_event+0x80/0x1d0
[    5.940109][    C0]  try_one_irq+0x138/0x174
[    5.944365][    C0]  misrouted_irq+0x134/0x140
[    5.948795][    C0]  note_interrupt+0x1d0/0x30c
[    5.953311][    C0]  handle_irq_event+0x13c/0x1d0
[    5.958001][    C0]  handle_fasteoi_irq+0xd4/0x260
[    5.962779][    C0]  __handle_domain_irq+0x88/0xf0
[    5.967555][    C0]  gic_handle_irq+0x9c/0x2f0
[    5.971985][    C0]  el1_irq+0xb8/0x140
[    5.975807][    C0]  __setup_irq+0x3dc/0x7cc
[    5.980064][    C0]  request_threaded_irq+0xf4/0x1b4
[    5.985015][    C0]  devm_request_threaded_irq+0x80/0x100
[    5.990400][    C0]  dwc2_driver_probe+0x1b8/0x6b0
[    5.995178][    C0]  platform_drv_probe+0x5c/0xb0
[    5.999868][    C0]  really_probe+0xf8/0x51c
[    6.004125][    C0]  driver_probe_device+0xfc/0x170
[    6.008989][    C0]  device_driver_attach+0xc8/0xd0
[    6.013853][    C0]  __driver_attach+0xe8/0x1b0
[    6.018369][    C0]  bus_for_each_dev+0x7c/0xdc
[    6.022886][    C0]  driver_attach+0x2c/0x3c
[    6.027143][    C0]  bus_add_driver+0xdc/0x240
[    6.031573][    C0]  driver_register+0x80/0x13c
[    6.036090][    C0]  __platform_driver_register+0x50/0x5c
[    6.041476][    C0]  dwc2_platform_driver_init+0x24/0x30
[    6.046774][    C0]  do_one_initcall+0x50/0x25c
[    6.051291][    C0]  do_initcall_level+0xe4/0xfc
[    6.055894][    C0]  do_initcalls+0x80/0xa4
[    6.060064][    C0]  kernel_init_freeable+0x198/0x240
[    6.065102][    C0]  kernel_init+0x1c/0x12c

Signed-off-by: Shawn Shao <shawn.shao@jaguarmicro.com>
Link: https://lore.kernel.org/r/20240830031709.134-1-shawn.shao@jaguarmicro.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 5baeb15 ]

- After fopen check NULL before using the file pointer use

Signed-off-by: Ruffalo Lavoisier <RuffaloLavoisier@gmail.com>
Link: https://lore.kernel.org/r/20240906203025.89588-1-RuffaloLavoisier@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 5016c3a ]

Add kfree(root_ops) in this case to avoid memleak of root_ops,
leaks when pci_find_bus() != 0.

Signed-off-by: Yuli Wang <wangyuli@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
… dir clash

[ Upstream commit d8f84a9 ]

A conntrack entry can be inserted to the connection tracking table if there
is no existing entry with an identical tuple in either direction.

Example:
INITIATOR -> NAT/PAT -> RESPONDER

Initiator passes through NAT/PAT ("us") and SNAT is done (saddr rewrite).
Then, later, NAT/PAT machine itself also wants to connect to RESPONDER.

This will not work if the SNAT done earlier has same IP:PORT source pair.

Conntrack table has:
ORIGINAL: $IP_INITATOR:$SPORT -> $IP_RESPONDER:$DPORT
REPLY:    $IP_RESPONDER:$DPORT -> $IP_NAT:$SPORT

and new locally originating connection wants:
ORIGINAL: $IP_NAT:$SPORT -> $IP_RESPONDER:$DPORT
REPLY:    $IP_RESPONDER:$DPORT -> $IP_NAT:$SPORT

This is handled by the NAT engine which will do a source port reallocation
for the locally originating connection that is colliding with an existing
tuple by attempting a source port rewrite.

This is done even if this new connection attempt did not go through a
masquerade/snat rule.

There is a rare race condition with connection-less protocols like UDP,
where we do the port reallocation even though its not needed.

This happens when new packets from the same, pre-existing flow are received
in both directions at the exact same time on different CPUs after the
conntrack table was flushed (or conntrack becomes active for first time).

With strict ordering/single cpu, the first packet creates new ct entry and
second packet is resolved as established reply packet.

With parallel processing, both packets are picked up as new and both get
their own ct entry.

In this case, the 'reply' packet (picked up as ORIGINAL) can be mangled by
NAT engine because a port collision is detected.

This change isn't enough to prevent a packet drop later during
nf_conntrack_confirm(), the existing clash resolution strategy will not
detect such reverse clash case.  This is resolved by a followup patch.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit fc56878 ]

If CONFIG_BRIDGE_NETFILTER is not enabled, which is the case for x86_64
defconfig, then building nf_reject_ipv4.c and nf_reject_ipv6.c with W=1
using gcc-14 results in the following warnings, which are treated as
errors:

net/ipv4/netfilter/nf_reject_ipv4.c: In function 'nf_send_reset':
net/ipv4/netfilter/nf_reject_ipv4.c:243:23: error: variable 'niph' set but not used [-Werror=unused-but-set-variable]
  243 |         struct iphdr *niph;
      |                       ^~~~
cc1: all warnings being treated as errors
net/ipv6/netfilter/nf_reject_ipv6.c: In function 'nf_send_reset6':
net/ipv6/netfilter/nf_reject_ipv6.c:286:25: error: variable 'ip6h' set but not used [-Werror=unused-but-set-variable]
  286 |         struct ipv6hdr *ip6h;
      |                         ^~~~
cc1: all warnings being treated as errors

Address this by reducing the scope of these local variables to where
they are used, which is code only compiled when CONFIG_BRIDGE_NETFILTER
enabled.

Compile tested and run through netfilter selftests.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Closes: https://lore.kernel.org/netfilter-devel/20240906145513.567781-1-andriy.shevchenko@linux.intel.com/
Signed-off-by: Simon Horman <horms@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit e25fbcd ]

If a pmem device is in a bad status, the driver side could wait for
host ack forever in virtio_pmem_flush(), causing the system to hang.

So add a status check in the beginning of virtio_pmem_flush() to return
early if the device is not activated.

Signed-off-by: Philip Chen <philipchen@chromium.org>
Message-Id: <20240826215313.2673566-1-philipchen@chromium.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 3c6b818 ]

Added a check to handle memory allocation failure for `trigger_name`
and return `-ENOMEM`.

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20240828093129.3040-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit a8a8b54 ]

The geoid is a module parameter that allows users to hardcode the slot number.
A bound check for geoid was added in the probe function because only values
between 0 and less than VME_MAX_SLOT are valid.

Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20240827125604.42771-2-riyandhiman14@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit bfa54a7 ]

For bus_register(), any error which happens after kset_register() will
cause that @priv are freed twice, fixed by setting @priv with NULL after
the first free.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20240727-bus_register_fix-v1-1-fed8dd0dba7a@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…s attribute

[ Upstream commit c0fd973 ]

Return -EIO instead of 0 for below erroneous bus attribute operations:
 - read a bus attribute without show().
 - write a bus attribute without store().

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20240724-bus_fix-v2-1-5adbafc698fb@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…flush_cmd()

[ Upstream commit 93bcc5f ]

During HBA stress testing, a spam of received PLOGIs exposes a resource
recovery bug causing leakage of lpfc_sqlq entries from the global
phba->sli4_hba.lpfc_els_sgl_list.

The issue is in lpfc_els_flush_cmd(), where the driver attempts to recover
outstanding ELS sgls when walking the txcmplq.  Only CMD_ELS_REQUEST64_CRs
and CMD_GEN_REQUEST64_CRs are added to the abort and cancel lists.  A check
for CMD_XMIT_ELS_RSP64_WQE is missing in order to recover LS_ACC usages of
the phba->sli4_hba.lpfc_els_sgl_list too.

Fix by adding CMD_XMIT_ELS_RSP64_WQE as part of the txcmplq walk when
adding WQEs to the abort and cancel list in lpfc_els_flush_cmd().  Also,
update naming convention from CRs to WQEs.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20240912232447.45607-2-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
…instance

[ Upstream commit 0a3c84f ]

Deleting an NPIV instance requires all fabric ndlps to be released before
an NPIV's resources can be torn down.  Failure to release fabric ndlps
beforehand opens kref imbalance race conditions.  Fix by forcing the DA_ID
to complete synchronously with usage of wait_queue.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20240912232447.45607-6-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit ff599ef ]

[WHAT & HOW]
se is null checked previously in the same function, indicating
it might be null; therefore, it must be checked when used again.

This fixes 1 FORWARD_NULL issue reported by Coverity.

Acked-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@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>
[ Upstream commit 5b97eeb ]

syzbot has found a NULL pointer dereference bug in fbcon.
Here is the simplified C reproducer:

struct param {
	uint8_t type;
	struct tiocl_selection ts;
};

int main()
{
	struct fb_con2fbmap con2fb;
	struct param param;

	int fd = open("/dev/fb1", 0, 0);

	con2fb.console = 0x19;
	con2fb.framebuffer = 0;
	ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb);

	param.type = 2;
	param.ts.xs = 0; param.ts.ys = 0;
	param.ts.xe = 0; param.ts.ye = 0;
	param.ts.sel_mode = 0;

	int fd1 = open("/dev/tty1", O_RDWR, 0);
	ioctl(fd1, TIOCLINUX, &param);

	con2fb.console = 1;
	con2fb.framebuffer = 0;
	ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb);

	return 0;
}

After calling ioctl(fd1, TIOCLINUX, &param), the subsequent ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb)
causes the kernel to follow a different execution path:

 set_con2fb_map
  -> con2fb_init_display
   -> fbcon_set_disp
    -> redraw_screen
     -> hide_cursor
      -> clear_selection
       -> highlight
        -> invert_screen
         -> do_update_region
          -> fbcon_putcs
           -> ops->putcs

Since ops->putcs is a NULL pointer, this leads to a kernel panic.
To prevent this, we need to call set_blitting_type() within set_con2fb_map()
to properly initialize ops->putcs.

Reported-by: syzbot+3d613ae53c031502687a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3d613ae53c031502687a
Tested-by: syzbot+3d613ae53c031502687a@syzkaller.appspotmail.com
Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit b0abcd6 ]

Doing an async decryption (large read) crashes with a
slab-use-after-free way down in the crypto API.

Reproducer:
    # mount.cifs -o ...,seal,esize=1 //srv/share /mnt
    # dd if=/mnt/largefile of=/dev/null
    ...
    [  194.196391] ==================================================================
    [  194.196844] BUG: KASAN: slab-use-after-free in gf128mul_4k_lle+0xc1/0x110
    [  194.197269] Read of size 8 at addr ffff888112bd0448 by task kworker/u77:2/899
    [  194.197707]
    [  194.197818] CPU: 12 UID: 0 PID: 899 Comm: kworker/u77:2 Not tainted 6.11.0-lku-00028-gfca3ca14a17a-dirty #43
    [  194.198400] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-3-gd478f380-prebuilt.qemu.org 04/01/2014
    [  194.199046] Workqueue: smb3decryptd smb2_decrypt_offload [cifs]
    [  194.200032] Call Trace:
    [  194.200191]  <TASK>
    [  194.200327]  dump_stack_lvl+0x4e/0x70
    [  194.200558]  ? gf128mul_4k_lle+0xc1/0x110
    [  194.200809]  print_report+0x174/0x505
    [  194.201040]  ? __pfx__raw_spin_lock_irqsave+0x10/0x10
    [  194.201352]  ? srso_return_thunk+0x5/0x5f
    [  194.201604]  ? __virt_addr_valid+0xdf/0x1c0
    [  194.201868]  ? gf128mul_4k_lle+0xc1/0x110
    [  194.202128]  kasan_report+0xc8/0x150
    [  194.202361]  ? gf128mul_4k_lle+0xc1/0x110
    [  194.202616]  gf128mul_4k_lle+0xc1/0x110
    [  194.202863]  ghash_update+0x184/0x210
    [  194.203103]  shash_ahash_update+0x184/0x2a0
    [  194.203377]  ? __pfx_shash_ahash_update+0x10/0x10
    [  194.203651]  ? srso_return_thunk+0x5/0x5f
    [  194.203877]  ? crypto_gcm_init_common+0x1ba/0x340
    [  194.204142]  gcm_hash_assoc_remain_continue+0x10a/0x140
    [  194.204434]  crypt_message+0xec1/0x10a0 [cifs]
    [  194.206489]  ? __pfx_crypt_message+0x10/0x10 [cifs]
    [  194.208507]  ? srso_return_thunk+0x5/0x5f
    [  194.209205]  ? srso_return_thunk+0x5/0x5f
    [  194.209925]  ? srso_return_thunk+0x5/0x5f
    [  194.210443]  ? srso_return_thunk+0x5/0x5f
    [  194.211037]  decrypt_raw_data+0x15f/0x250 [cifs]
    [  194.212906]  ? __pfx_decrypt_raw_data+0x10/0x10 [cifs]
    [  194.214670]  ? srso_return_thunk+0x5/0x5f
    [  194.215193]  smb2_decrypt_offload+0x12a/0x6c0 [cifs]

This is because TFM is being used in parallel.

Fix this by allocating a new AEAD TFM for async decryption, but keep
the existing one for synchronous READ cases (similar to what is done
in smb3_calc_signature()).

Also remove the calls to aead_request_set_callback() and
crypto_wait_req() since it's always going to be a synchronous operation.

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 9cf14f5 ]

The values of the variables xres and yres are placed in strbuf.
These variables are obtained from strbuf1.
The strbuf1 array contains digit characters
and a space if the array contains non-digit characters.
Then, when executing sprintf(strbuf, "%ux%ux8", xres, yres);
more than 16 bytes will be written to strbuf.
It is suggested to increase the size of the strbuf array to 24.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Shumilin <shum.sdl@nppct.ru>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 0e640f0 ]

Add the new PCI Device IDs to the MISC IDs list to support new
generation of AMD 1Ah family 70h Models of processors.

  [ bp: Massage commit message. ]

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240510111829.969501-1-Shyam-sundar.S-k@amd.com
Stable-dep-of: 59c3400 ("x86/amd_nb: Add new PCI IDs for AMD family 1Ah model 60h")
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 59c3400 ]

Add new PCI device IDs into the root IDs and miscellaneous IDs lists to
provide support for the latest generation of AMD 1Ah family 60h processor
models.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Link: https://lore.kernel.org/r/20240722092801.3480266-1-Shyam-sundar.S-k@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit dc0d0f8 ]

NeilBrown says:
> The handling of NFSD_FILE_CACHE_UP is strange.  nfsd_file_cache_init()
> sets it, but doesn't clear it on failure.  So if nfsd_file_cache_init()
> fails for some reason, nfsd_file_cache_shutdown() would still try to
> clean up if it was called.

Reported-by: NeilBrown <neilb@suse.de>
Fixes: c7b824c ("NFSD: Replace the "init once" mechanism")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 839e3f9 ]

The filters set that will reproduce the problem:
$ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \
	skip_sw dst_mac ff:ff:ff:ff:ff:ff action mirred egress \
	redirect dev $PF0
$ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \
	skip_sw dst_mac ff:ff:ff:ff:ff:ff src_mac 52:54:00:00:00:10 \
	action mirred egress mirror dev $VF1_PR

Expected behaviour is to set all broadcast from VF0 to the LAN. If the
src_mac match the value from filters, send packet to LAN and to VF1.

In this case both LAN_EN and LB_EN flags in switch is set in case of
packet matching both filters. As dst VSI for the only LAN enable bit is
PF VSI, the packet is being seen on PF. To fix this change dst VSI to
the source VSI. It will block receiving any packet even when LB_EN is
set by switch, because local loopback is clear on VF VSI during normal
operation.

Side note: if the second filters action is redirect instead of mirror
LAN_EN is clear, because switch is AND-ing LAN_EN from each matched
filters and OR-ing LB_EN.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Fixes: 73b483b ("ice: Manage act flags for switchdev offloads")
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 0eae2c1 ]

There is a bug currently when there are more than one VLAN defined
and any reset that affects the PF is initiated, after the reset rebuild
no traffic will pass on any VLAN but the last one created.

This is caused by the iteration though the VLANs during replay each
clearing the vsi_map bitmap of the VSI that is being replayed.  The
problem is that during rhe replay, the pointer to the vsi_map bitmap
is used by each successive vlan to determine if it should be replayed
on this VSI.

The logic was that the replay of the VLAN would replace the bit in the map
before the next VLAN would iterate through.  But, since the replay copies
the old bitmap pointer to filt_replay_rules and creates a new one for the
recreated VLANS, it does not do this, and leaves the old bitmap broken
to be used to replay the remaining VLANs.

Since the old bitmap will be cleaned up in post replay cleanup, there is
no need to alter it and break following VLAN replay, so don't clear the
bit.

Fixes: 334cb06 ("ice: Implement VSI replay framework")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 6dbf1f3 ]

The math in "rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t)" could have an
integer overflow.  Add bounds checking on rc_list->rcl_nrefcalls to fix
that.

Fixes: 4aece6a ("nfs41: cb_sequence xdr implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit a848c29 ]

On the node of an NFS client, some files saved in the mountpoint of the
NFS server were copied to another location of the same NFS server.
Accidentally, the nfs42_complete_copies() got a NULL-pointer dereference
crash with the following syslog:

[232064.838881] NFSv4: state recovery failed for open file nfs/pvc-12b5200d-cd0f-46a3-b9f0-af8f4fe0ef64.qcow2, error = -116
[232064.839360] NFSv4: state recovery failed for open file nfs/pvc-12b5200d-cd0f-46a3-b9f0-af8f4fe0ef64.qcow2, error = -116
[232066.588183] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000058
[232066.588586] Mem abort info:
[232066.588701]   ESR = 0x0000000096000007
[232066.588862]   EC = 0x25: DABT (current EL), IL = 32 bits
[232066.589084]   SET = 0, FnV = 0
[232066.589216]   EA = 0, S1PTW = 0
[232066.589340]   FSC = 0x07: level 3 translation fault
[232066.589559] Data abort info:
[232066.589683]   ISV = 0, ISS = 0x00000007
[232066.589842]   CM = 0, WnR = 0
[232066.589967] user pgtable: 64k pages, 48-bit VAs, pgdp=00002000956ff400
[232066.590231] [0000000000000058] pgd=08001100ae100003, p4d=08001100ae100003, pud=08001100ae100003, pmd=08001100b3c00003, pte=0000000000000000
[232066.590757] Internal error: Oops: 96000007 [#1] SMP
[232066.590958] Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm vhost_net vhost vhost_iotlb tap tun ipt_rpfilter xt_multiport ip_set_hash_ip ip_set_hash_net xfrm_interface xfrm6_tunnel tunnel4 tunnel6 esp4 ah4 wireguard libcurve25519_generic veth xt_addrtype xt_set nf_conntrack_netlink ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_bitmap_port ip_set_hash_ipport dummy ip_set ip_vs_sh ip_vs_wrr ip_vs_rr ip_vs iptable_filter sch_ingress nfnetlink_cttimeout vport_gre ip_gre ip_tunnel gre vport_geneve geneve vport_vxlan vxlan ip6_udp_tunnel udp_tunnel openvswitch nf_conncount dm_round_robin dm_service_time dm_multipath xt_nat xt_MASQUERADE nft_chain_nat nf_nat xt_mark xt_conntrack xt_comment nft_compat nft_counter nf_tables nfnetlink ocfs2 ocfs2_nodemanager ocfs2_stackglue iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ipmi_ssif nbd overlay 8021q garp mrp bonding tls rfkill sunrpc ext4 mbcache jbd2
[232066.591052]  vfat fat cas_cache cas_disk ses enclosure scsi_transport_sas sg acpi_ipmi ipmi_si ipmi_devintf ipmi_msghandler ip_tables vfio_pci vfio_pci_core vfio_virqfd vfio_iommu_type1 vfio dm_mirror dm_region_hash dm_log dm_mod nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter bridge stp llc fuse xfs libcrc32c ast drm_vram_helper qla2xxx drm_kms_helper syscopyarea crct10dif_ce sysfillrect ghash_ce sysimgblt sha2_ce fb_sys_fops cec sha256_arm64 sha1_ce drm_ttm_helper ttm nvme_fc igb sbsa_gwdt nvme_fabrics drm nvme_core i2c_algo_bit i40e scsi_transport_fc megaraid_sas aes_neon_bs
[232066.596953] CPU: 6 PID: 4124696 Comm: 10.253.166.125- Kdump: loaded Not tainted 5.15.131-9.cl9_ocfs2.aarch64 #1
[232066.597356] Hardware name: Great Wall .\x93\x8e...RF6260 V5/GWMSSE2GL1T, BIOS T656FBE_V3.0.18 2024-01-06
[232066.597721] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[232066.598034] pc : nfs4_reclaim_open_state+0x220/0x800 [nfsv4]
[232066.598327] lr : nfs4_reclaim_open_state+0x12c/0x800 [nfsv4]
[232066.598595] sp : ffff8000f568fc70
[232066.598731] x29: ffff8000f568fc70 x28: 0000000000001000 x27: ffff21003db33000
[232066.599030] x26: ffff800005521ae0 x25: ffff0100f98fa3f0 x24: 0000000000000001
[232066.599319] x23: ffff800009920008 x22: ffff21003db33040 x21: ffff21003db33050
[232066.599628] x20: ffff410172fe9e40 x19: ffff410172fe9e00 x18: 0000000000000000
[232066.599914] x17: 0000000000000000 x16: 0000000000000004 x15: 0000000000000000
[232066.600195] x14: 0000000000000000 x13: ffff800008e685a8 x12: 00000000eac0c6e6
[232066.600498] x11: 0000000000000000 x10: 0000000000000008 x9 : ffff8000054e5828
[232066.600784] x8 : 00000000ffffffbf x7 : 0000000000000001 x6 : 000000000a9eb14a
[232066.601062] x5 : 0000000000000000 x4 : ffff70ff8a14a800 x3 : 0000000000000058
[232066.601348] x2 : 0000000000000001 x1 : 54dce46366daa6c6 x0 : 0000000000000000
[232066.601636] Call trace:
[232066.601749]  nfs4_reclaim_open_state+0x220/0x800 [nfsv4]
[232066.601998]  nfs4_do_reclaim+0x1b8/0x28c [nfsv4]
[232066.602218]  nfs4_state_manager+0x928/0x10f0 [nfsv4]
[232066.602455]  nfs4_run_state_manager+0x78/0x1b0 [nfsv4]
[232066.602690]  kthread+0x110/0x114
[232066.602830]  ret_from_fork+0x10/0x20
[232066.602985] Code: 1400000d f9403f20 f9402e61 91016003 (f9402c00)
[232066.603284] SMP: stopping secondary CPUs
[232066.606936] Starting crashdump kernel...
[232066.607146] Bye!

Analysing the vmcore, we know that nfs4_copy_state listed by destination
nfs_server->ss_copies was added by the field copies in handle_async_copy(),
and we found a waiting copy process with the stack as:
PID: 3511963  TASK: ffff710028b47e00  CPU: 0   COMMAND: "cp"
 #0 [ffff8001116ef740] __switch_to at ffff8000081b92f4
 #1 [ffff8001116ef760] __schedule at ffff800008dd0650
 #2 [ffff8001116ef7c0] schedule at ffff800008dd0a00
 #3 [ffff8001116ef7e0] schedule_timeout at ffff800008dd6aa0
 #4 [ffff8001116ef860] __wait_for_common at ffff800008dd166c
 #5 [ffff8001116ef8e0] wait_for_completion_interruptible at ffff800008dd1898
 #6 [ffff8001116ef8f0] handle_async_copy at ffff8000055142f4 [nfsv4]
 #7 [ffff8001116ef970] _nfs42_proc_copy at ffff8000055147c8 [nfsv4]
 #8 [ffff8001116efa80] nfs42_proc_copy at ffff800005514cf0 [nfsv4]
 #9 [ffff8001116efc50] __nfs4_copy_file_range.constprop.0 at ffff8000054ed694 [nfsv4]

The NULL-pointer dereference was due to nfs42_complete_copies() listed
the nfs_server->ss_copies by the field ss_copies of nfs4_copy_state.
So the nfs4_copy_state address ffff0100f98fa3f0 was offset by 0x10 and
the data accessed through this pointer was also incorrect. Generally,
the ordered list nfs4_state_owner->so_states indicate open(O_RDWR) or
open(O_WRITE) states are reclaimed firstly by nfs4_reclaim_open_state().
When destination state reclaim is failed with NFS_STATE_RECOVERY_FAILED
and copies are not deleted in nfs_server->ss_copies, the source state
may be passed to the nfs42_complete_copies() process earlier, resulting
in this crash scene finally. To solve this issue, we add a list_head
nfs_server->ss_src_copies for a server-to-server copy specially.

Fixes: 0e65a32 ("NFS: handle source server reboot")
Signed-off-by: Yanjun Zhang <zhangyanjun@cestc.cn>
Reviewed-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit a842e44 ]

When configuring the fiber port, the DP83869 PHY driver incorrectly
calls linkmode_set_bit() with a bit mask (1 << 10) rather than a bit
number (10). This corrupts some other memory location -- in case of
arm64 the priv pointer in the same structure.

Since the advertising flags are updated from supported at the end of the
function the incorrect line isn't needed at all and can be removed.

Fixes: a29de52 ("net: dp83869: Add ability to advertise Fiber connection")
Signed-off-by: Ingo van Lil <inguin@gmx.de>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241002161807.440378-1-inguin@gmx.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit e37ab73 ]

Fix the TCP loss recovery undo logic in tcp_packet_delayed() so that
it can trigger undo even if TSQ prevents a fast recovery episode from
reaching tcp_retransmit_skb().

Geumhwan Yu <geumhwan.yu@samsung.com> recently reported that after
this commit from 2019:

commit bc9f38c ("tcp: avoid unconditional congestion window undo
on SYN retransmit")

...and before this fix we could have buggy scenarios like the
following:

+ Due to reordering, a TCP connection receives some SACKs and enters a
  spurious fast recovery.

+ TSQ prevents all invocations of tcp_retransmit_skb(), because many
  skbs are queued in lower layers of the sending machine's network
  stack; thus tp->retrans_stamp remains 0.

+ The connection receives a TCP timestamp ECR value echoing a
  timestamp before the fast recovery, indicating that the fast
  recovery was spurious.

+ The connection fails to undo the spurious fast recovery because
  tp->retrans_stamp is 0, and thus tcp_packet_delayed() returns false,
  due to the new logic in the 2019 commit: commit bc9f38c ("tcp:
  avoid unconditional congestion window undo on SYN retransmit")

This fix tweaks the logic to be more similar to the
tcp_packet_delayed() logic before bc9f38c, except that we take
care not to be fooled by the FLAG_SYN_ACKED code path zeroing out
tp->retrans_stamp (the bug noted and fixed by Yuchung in
bc9f38c).

Note that this returns the high-level behavior of tcp_packet_delayed()
to again match the comment for the function, which says: "Nothing was
retransmitted or returned timestamp is less than timestamp of the
first retransmission." Note that this comment is in the original
2005-04-16 Linux git commit, so this is evidently long-standing
behavior.

Fixes: bc9f38c ("tcp: avoid unconditional congestion window undo on SYN retransmit")
Reported-by: Geumhwan Yu <geumhwan.yu@samsung.com>
Diagnosed-by: Geumhwan Yu <geumhwan.yu@samsung.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241001200517.2756803-2-ncardwell.sw@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit b41b4cb ]

Fix tcp_enter_recovery() so that if there are no retransmits out then
we zero retrans_stamp when entering fast recovery. This is necessary
to fix two buggy behaviors.

Currently a non-zero retrans_stamp value can persist across multiple
back-to-back loss recovery episodes. This is because we generally only
clears retrans_stamp if we are completely done with loss recoveries,
and get to tcp_try_to_open() and find !tcp_any_retrans_done(sk). This
behavior causes two bugs:

(1) When a loss recovery episode (CA_Loss or CA_Recovery) is followed
immediately by a new CA_Recovery, the retrans_stamp value can persist
and can be a time before this new CA_Recovery episode starts. That
means that timestamp-based undo will be using the wrong retrans_stamp
(a value that is too old) when comparing incoming TS ecr values to
retrans_stamp to see if the current fast recovery episode can be
undone.

(2) If there is a roughly minutes-long sequence of back-to-back fast
recovery episodes, one after another (e.g. in a shallow-buffered or
policed bottleneck), where each fast recovery successfully makes
forward progress and recovers one window of sequence space (but leaves
at least one retransmit in flight at the end of the recovery),
followed by several RTOs, then the ETIMEDOUT check may be using the
wrong retrans_stamp (a value set at the start of the first fast
recovery in the sequence). This can cause a very premature ETIMEDOUT,
killing the connection prematurely.

This commit changes the code to zero retrans_stamp when entering fast
recovery, when this is known to be safe (no retransmits are out in the
network). That ensures that when starting a fast recovery episode, and
it is safe to do so, retrans_stamp is set when we send the fast
retransmit packet. That addresses both bug (1) and bug (2) by ensuring
that (if no retransmits are out when we start a fast recovery) we use
the initial fast retransmit of this fast recovery as the time value
for undo and ETIMEDOUT calculations.

This makes intuitive sense, since the start of a new fast recovery
episode (in a scenario where no lost packets are out in the network)
means that the connection has made forward progress since the last RTO
or fast recovery, and we should thus "restart the clock" used for both
undo and ETIMEDOUT logic.

Note that if when we start fast recovery there *are* retransmits out
in the network, there can still be undesirable (1)/(2) issues. For
example, after this patch we can still have the (1) and (2) problems
in cases like this:

+ round 1: sender sends flight 1

+ round 2: sender receives SACKs and enters fast recovery 1,
  retransmits some packets in flight 1 and then sends some new data as
  flight 2

+ round 3: sender receives some SACKs for flight 2, notes losses, and
  retransmits some packets to fill the holes in flight 2

+ fast recovery has some lost retransmits in flight 1 and continues
  for one or more rounds sending retransmits for flight 1 and flight 2

+ fast recovery 1 completes when snd_una reaches high_seq at end of
  flight 1

+ there are still holes in the SACK scoreboard in flight 2, so we
  enter fast recovery 2, but some retransmits in the flight 2 sequence
  range are still in flight (retrans_out > 0), so we can't execute the
  new retrans_stamp=0 added here to clear retrans_stamp

It's not yet clear how to fix these remaining (1)/(2) issues in an
efficient way without breaking undo behavior, given that retrans_stamp
is currently used for undo and ETIMEDOUT. Perhaps the optimal (but
expensive) strategy would be to set retrans_stamp to the timestamp of
the earliest outstanding retransmit when entering fast recovery. But
at least this commit makes things better.

Note that this does not change the semantics of retrans_stamp; it
simply makes retrans_stamp accurate in some cases where it was not
before:

(1) Some loss recovery, followed by an immediate entry into a fast
recovery, where there are no retransmits out when entering the fast
recovery.

(2) When a TFO server has a SYNACK retransmit that sets retrans_stamp,
and then the ACK that completes the 3-way handshake has SACK blocks
that trigger a fast recovery. In this case when entering fast recovery
we want to zero out the retrans_stamp from the TFO SYNACK retransmit,
and set the retrans_stamp based on the timestamp of the fast recovery.

We introduce a tcp_retrans_stamp_cleanup() helper, because this
two-line sequence already appears in 3 places and is about to appear
in 2 more as a result of this bug fix patch series. Once this bug fix
patches series in the net branch makes it into the net-next branch
we'll update the 3 other call sites to use the new helper.

This is a long-standing issue. The Fixes tag below is chosen to be the
oldest commit at which the patch will apply cleanly, which is from
Linux v3.5 in 2012.

Fixes: 1fbc340 ("tcp: early retransmit: tcp_enter_recovery()")
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241001200517.2756803-3-ncardwell.sw@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 3868ab0 ]

The 2023 SIGCOMM paper "Improving Network Availability with Protective
ReRoute" has indicated Linux TCP's RTO-triggered txhash rehashing can
effectively reduce application disruption during outages. To better
measure the efficacy of this feature, this patch adds three more
detailed stats during RTO recovery and exports via TCP_INFO.
Applications and monitoring systems can leverage this data to measure
the network path diversity and end-to-end repair latency during network
outages to improve their network infrastructure.

The following counters are added to tcp_sock in order to track RTO
events over the lifetime of a TCP socket.

1. u16 total_rto - Counts the total number of RTO timeouts.
2. u16 total_rto_recoveries - Counts the total number of RTO recoveries.
3. u32 total_rto_time - Counts the total time spent (ms) in RTO
                        recoveries. (time spent in CA_Loss and
                        CA_Recovery states)

To compute total_rto_time, we add a new u32 rto_stamp field to
tcp_sock. rto_stamp records the start timestamp (ms) of the last RTO
recovery (CA_Loss).

Corresponding fields are also added to the tcp_info struct.

Signed-off-by: Aananth V <aananthv@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: 27c80ef ("tcp: fix TFO SYN_RECV to not zero retrans_stamp with retransmits out")
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 27c80ef ]

Fix tcp_rcv_synrecv_state_fastopen() to not zero retrans_stamp
if retransmits are outstanding.

tcp_fastopen_synack_timer() sets retrans_stamp, so typically we'll
need to zero retrans_stamp here to prevent spurious
retransmits_timed_out(). The logic to zero retrans_stamp is from this
2019 commit:

commit cd736d8 ("tcp: fix retrans timestamp on passive Fast Open")

However, in the corner case where the ACK of our TFO SYNACK carried
some SACK blocks that caused us to enter TCP_CA_Recovery then that
non-zero retrans_stamp corresponds to the active fast recovery, and we
need to leave retrans_stamp with its current non-zero value, for
correct ETIMEDOUT and undo behavior.

Fixes: cd736d8 ("tcp: fix retrans timestamp on passive Fast Open")
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241001200517.2756803-4-ncardwell.sw@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[ Upstream commit 7a310f8 ]

Fix the uninitialised txb variable in rxrpc_send_data() by moving the code
that loads it above all the jumps to maybe_error, txb being stored back
into call->tx_pending right before the normal return.

Fixes: b0f571e ("rxrpc: Fix locking in rxrpc's sendmsg")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lists.infradead.org/pipermail/linux-afs/2024-October/008896.html
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20241001132702.3122709-3-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
@qaz6750 qaz6750 reopened this Nov 1, 2024
qaz6750 added a commit that referenced this pull request Nov 1, 2024
commit 18916a684a8b836957df88438f9bca590799d04c
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Oct 22 15:46:36 2024 +0200

    Linux 6.6.58

    Link: https://lore.kernel.org/r/20241021102256.706334758@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fd6e2af79a947e909c72b09f1ce3175f381067ef
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Wed Oct 16 11:07:13 2024 +0300

    ALSA: hda/conexant - Use cached pin control for Node 0x1d on HP EliteOne 1000 G2

    commit 164cd0e077a18d6208523c82b102c98c77fdd51f upstream.

    The cached version avoids redundant commands to the codec, improving
    stability and reducing unnecessary operations. This change ensures
    better power management and reliable restoration of pin configurations,
    especially after hibernation (S4) and other power transitions.

    Fixes: 9988844c457f ("ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2")
    Suggested-by: Kai-Heng Feng <kaihengf@nvidia.com>
    Suggested-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Link: https://patch.msgid.link/20241016080713.46801-1-kovalev@altlinux.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9698088ac7704e260f492d9c254e29ed7dd8729a
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 4 12:35:31 2024 +0900

    nilfs2: propagate directory read errors from nilfs_find_entry()

    commit 08cfa12adf888db98879dbd735bc741360a34168 upstream.

    Syzbot reported that a task hang occurs in vcs_open() during a fuzzing
    test for nilfs2.

    The root cause of this problem is that in nilfs_find_entry(), which
    searches for directory entries, ignores errors when loading a directory
    page/folio via nilfs_get_folio() fails.

    If the filesystem images is corrupted, and the i_size of the directory
    inode is large, and the directory page/folio is successfully read but
    fails the sanity check, for example when it is zero-filled,
    nilfs_check_folio() may continue to spit out error messages in bursts.

    Fix this issue by propagating the error to the callers when loading a
    page/folio fails in nilfs_find_entry().

    The current interface of nilfs_find_entry() and its callers is outdated
    and cannot propagate error codes such as -EIO and -ENOMEM returned via
    nilfs_find_entry(), so fix it together.

    Link: https://lkml.kernel.org/r/20241004033640.6841-1-konishi.ryusuke@gmail.com
    Fixes: 2ba466d74ed7 ("nilfs2: directory entry operations")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: Lizhi Xu <lizhi.xu@windriver.com>
    Closes: https://lkml.kernel.org/r/20240927013806.3577931-1-lizhi.xu@windriver.com
    Reported-by: syzbot+8a192e8d090fa9a31135@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=8a192e8d090fa9a31135
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87cb3f6e0c047f9320889e68140f46b1f4ca9eca
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Fri Oct 18 17:57:39 2024 +0200

    selftests: mptcp: remove duplicated variables

    A few week ago, there were some backport issues in MPTCP selftests,
    because some patches have been applied twice, but with versions handling
    conflicts differently [1].

    Patches fixing these issues have been sent [2] and applied, but it looks
    like quilt was still confused with the removal of some patches, and
    commit a417ef47a665 ("selftests: mptcp: join: validate event numbers")
    duplicated some variables, not present in the original patch [3].

    Anyway, Bash was complaining, but that was not causing any tests to
    fail. Also, that's easy to fix by simply removing the duplicated ones.

    Link: https://lore.kernel.org/fc21db4a-508d-41db-aa45-e3bc06d18ce7@kernel.org [1]
    Link: https://lore.kernel.org/20240905144306.1192409-5-matttbe@kernel.org [2]
    Link: https://lore.kernel.org/20240905144306.1192409-7-matttbe@kernel.org [3]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec0d0fcbd5d8645fdfb75717d70270f59254d04d
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:38 2024 +0200

    selftests: mptcp: join: test for prohibited MPC to port-based endp

    commit 5afca7e996c42aed1b4a42d4712817601ba42aff upstream.

    Explicitly verify that MPC connection attempts towards a port-based
    signal endpoint fail with a reset.

    Note that this new test is a bit different from the other ones, not
    using 'run_tests'. It is then needed to add the capture capability, and
    the picking the right port which have been extracted into three new
    helpers. The info about the capture can also be printed from a single
    point, which simplifies the exit paths in do_transfer().

    The 'Fixes' tag here below is the same as the one from the previous
    commit: this patch here is not fixing anything wrong in the selftests,
    but it validates the previous fix for an issue introduced by this commit
    ID.

    Fixes: 1729cf186d8a ("mptcp: create the listening socket for new port")
    Cc: stable@vger.kernel.org
    Co-developed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241014-net-mptcp-mpc-port-endp-v2-2-7faea8e6b6ae@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflicts in mptcp_join.sh, because commit 0bd962dd86b2 ("selftests:
      mptcp: join: check CURRESTAB counters"), and commit 9e6a39ecb9a1
      ("selftests: mptcp: export TEST_COUNTER variable") are linked to new
      features, not available in this version. Resolving the conflicts is
      easy, simply adding the new helpers before do_transfer(), and rename
      MPTCP_LIB_TEST_COUNTER to TEST_COUNT that was used before. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d46b96f0a4892580757d3bbb546d2971dbe83361
Author: Geliang Tang <tanggeliang@kylinos.cn>
Date:   Fri Oct 18 17:57:37 2024 +0200

    selftests: mptcp: join: change capture/checksum as bool

    commit 8c6f6b4bb53a904f922dfb90d566391d3feee32c upstream.

    To maintain consistency with other scripts, this patch changes vars
    'capture' and 'checksum' as bool vars in mptcp_join.

    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-next-20240223-misc-improvements-v1-7-b6c8a10396bd@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 5afca7e996c4 ("selftests: mptcp: join: test for prohibited MPC to port-based endp")
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 229dfdc36f31a8d47433438bc0e6e1662c4ab404
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:36 2024 +0200

    tcp: fix mptcp DSS corruption due to large pmtu xmit

    commit 4dabcdf581217e60690467a37c956a5b8dbc6bd9 upstream.

    Syzkaller was able to trigger a DSS corruption:

      TCP: request_sock_subflow_v4: Possible SYN flooding on port [::]:20002. Sending cookies.
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 5227 at net/mptcp/protocol.c:695 __mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Modules linked in:
      CPU: 0 UID: 0 PID: 5227 Comm: syz-executor350 Not tainted 6.11.0-syzkaller-08829-gaf9c191ac2a0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
      RIP: 0010:__mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Code: 0f b6 dc 31 ff 89 de e8 b5 dd ea f5 89 d8 48 81 c4 50 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 98 da ea f5 90 <0f> 0b 90 e9 47 ff ff ff e8 8a da ea f5 90 0f 0b 90 e9 99 e0 ff ff
      RSP: 0018:ffffc90000006db8 EFLAGS: 00010246
      RAX: ffffffff8ba9df18 RBX: 00000000000055f0 RCX: ffff888030023c00
      RDX: 0000000000000100 RSI: 00000000000081e5 RDI: 00000000000055f0
      RBP: 1ffff110062bf1ae R08: ffffffff8ba9cf12 R09: 1ffff110062bf1b8
      R10: dffffc0000000000 R11: ffffed10062bf1b9 R12: 0000000000000000
      R13: dffffc0000000000 R14: 00000000700cec61 R15: 00000000000081e5
      FS:  000055556679c380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020287000 CR3: 0000000077892000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <IRQ>
       move_skbs_to_msk net/mptcp/protocol.c:811 [inline]
       mptcp_data_ready+0x29c/0xa90 net/mptcp/protocol.c:854
       subflow_data_ready+0x34a/0x920 net/mptcp/subflow.c:1490
       tcp_data_queue+0x20fd/0x76c0 net/ipv4/tcp_input.c:5283
       tcp_rcv_established+0xfba/0x2020 net/ipv4/tcp_input.c:6237
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       tcp_v4_rcv+0x2dc0/0x37f0 net/ipv4/tcp_ipv4.c:2350
       ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205
       ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       __netif_receive_skb_one_core net/core/dev.c:5662 [inline]
       __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775
       process_backlog+0x662/0x15b0 net/core/dev.c:6107
       __napi_poll+0xcb/0x490 net/core/dev.c:6771
       napi_poll net/core/dev.c:6840 [inline]
       net_rx_action+0x89b/0x1240 net/core/dev.c:6962
       handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
       do_softirq+0x11b/0x1e0 kernel/softirq.c:455
       </IRQ>
       <TASK>
       __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
       local_bh_enable include/linux/bottom_half.h:33 [inline]
       rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline]
       __dev_queue_xmit+0x1764/0x3e80 net/core/dev.c:4451
       dev_queue_xmit include/linux/netdevice.h:3094 [inline]
       neigh_hh_output include/net/neighbour.h:526 [inline]
       neigh_output include/net/neighbour.h:540 [inline]
       ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:236
       ip_local_out net/ipv4/ip_output.c:130 [inline]
       __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:536
       __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466
       tcp_transmit_skb net/ipv4/tcp_output.c:1484 [inline]
       tcp_mtu_probe net/ipv4/tcp_output.c:2547 [inline]
       tcp_write_xmit+0x641d/0x6bf0 net/ipv4/tcp_output.c:2752
       __tcp_push_pending_frames+0x9b/0x360 net/ipv4/tcp_output.c:3015
       tcp_push_pending_frames include/net/tcp.h:2107 [inline]
       tcp_data_snd_check net/ipv4/tcp_input.c:5714 [inline]
       tcp_rcv_established+0x1026/0x2020 net/ipv4/tcp_input.c:6239
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       sk_backlog_rcv include/net/sock.h:1113 [inline]
       __release_sock+0x214/0x350 net/core/sock.c:3072
       release_sock+0x61/0x1f0 net/core/sock.c:3626
       mptcp_push_release net/mptcp/protocol.c:1486 [inline]
       __mptcp_push_pending+0x6b5/0x9f0 net/mptcp/protocol.c:1625
       mptcp_sendmsg+0x10bb/0x1b10 net/mptcp/protocol.c:1903
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg+0x1a6/0x270 net/socket.c:745
       ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2603
       ___sys_sendmsg net/socket.c:2657 [inline]
       __sys_sendmsg+0x2aa/0x390 net/socket.c:2686
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7fb06e9317f9
      Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffe2cfd4f98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007fb06e97f468 RCX: 00007fb06e9317f9
      RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000005
      RBP: 00007fb06e97f446 R08: 0000555500000000 R09: 0000555500000000
      R10: 0000555500000000 R11: 0000000000000246 R12: 00007fb06e97f406
      R13: 0000000000000001 R14: 00007ffe2cfd4fe0 R15: 0000000000000003
       </TASK>

    Additionally syzkaller provided a nice reproducer. The repro enables
    pmtu on the loopback device, leading to tcp_mtu_probe() generating
    very large probe packets.

    tcp_can_coalesce_send_queue_head() currently does not check for
    mptcp-level invariants, and allowed the creation of cross-DSS probes,
    leading to the mentioned corruption.

    Address the issue teaching tcp_can_coalesce_send_queue_head() about
    mptcp using the tcp_skb_can_collapse(), also reducing the code
    duplication.

    Fixes: 85712484110d ("tcp: coalesce/collapse must respect MPTCP extensions")
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+d1bff73460e33101f0e7@syzkaller.appspotmail.com
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/513
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241008-net-mptcp-fallback-fixes-v1-2-c6fb8e93e551@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflict in tcp_output.c, because the commit 65249feb6b3d ("net: add
      support for skbs with unreadable frags") is not in this version. This
      commit is linked to a new feature (Devmem TCP) and introduces a new
      condition which causes the conflicts. Resolving this is easy: we can
      ignore the missing new condition, and use tcp_skb_can_collapse() like
      in the original patch. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 647cd4494cc301f019267b901ab5cf71f3e54d57
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:06 2024 +0200

    serial: qcom-geni: fix receiver enable

    commit fa103d2599e11e802c818684cff821baefe7f206 upstream.

    The receiver is supposed to be enabled in the startup() callback and not
    in set_termios() which is called also during console setup.

    This specifically avoids accepting input before the port has been opened
    (and interrupts enabled), something which can also break the GENI
    firmware (cancel fails and after abort, the "stale" counter handling
    appears to be broken so that later input is not processed until twelve
    chars have been received).

    There also does not appear to be any need to keep the receiver disabled
    while updating the port settings.

    Since commit 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during
    console writes") the calls to manipulate the secondary interrupts, which
    were done without holding the port lock, can also lead to the receiver
    being left disabled when set_termios() races with the console code (e.g.
    when init opens the tty during boot). This can manifest itself as a
    serial getty not accepting input.

    The calls to stop and start rx in set_termios() can similarly race with
    DMA completion and, for example, cause the DMA buffer to be unmapped
    twice or the mapping to be leaked.

    Fix this by only enabling the receiver during startup and while holding
    the port lock to avoid racing with the console code.

    Fixes: 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during console writes")
    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-6-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 61c8f746ed831c4e8753bfbf0ccd08c20b13f83a
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:05 2024 +0200

    serial: qcom-geni: fix dma rx cancellation

    commit 23ee4a25661c33e6381d41e848a9060ed6d72845 upstream.

    Make sure to wait for the DMA transfer to complete when cancelling the
    rx command on stop_rx(). This specifically prevents the DMA completion
    interrupt from firing after rx has been restarted, something which can
    lead to an IOMMU fault and hosed rx when the interrupt handler unmaps
    the DMA buffer for the new command:

    	qcom_geni_serial 988000.serial: serial engine reports 0 RX bytes in!
    	arm-smmu 15000000.iommu: FSR    = 00000402 [Format=2 TF], SID=0x563
    	arm-smmu 15000000.iommu: FSYNR0 = 00210013 [S1CBNDX=33 WNR PLVL=3]
    	Bluetooth: hci0: command 0xfc00 tx timeout
    	Bluetooth: hci0: Reading QCA version information failed (-110)

    Also add the missing state machine reset which is needed in case
    cancellation fails.

    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-5-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7176aee5a1b20ae4da1082d6fc59a3b58383f079
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:03 2024 +0200

    serial: qcom-geni: revert broken hibernation support

    commit 19df76662a33d2f2fc41a66607cb8285fc02d6ec upstream.

    This reverts commit 35781d8356a2eecaa6074ceeb80ee22e252fcdae.

    Hibernation is not supported on Qualcomm platforms with mainline
    kernels yet a broken vendor implementation for the GENI serial driver
    made it upstream.

    This is effectively dead code that cannot be tested and should just be
    removed, but if these paths were ever hit for an open non-console port
    they would crash the machine as the driver would fail to enable clocks
    during restore() (i.e. all ports would have to be closed by drivers and
    user space before hibernating the system to avoid this as a comment in
    the code hinted at).

    The broken implementation also added a random call to enable the
    receiver in the port setup code where it does not belong and which
    enables the receiver prematurely for console ports.

    Fixes: 35781d8356a2 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature")
    Cc: stable@vger.kernel.org	# 6.2
    Cc: Aniket Randive <quic_arandive@quicinc.com>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-3-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90e3f819e6aacfcf5b297d4769744f42b5a749c8
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:02 2024 +0200

    serial: qcom-geni: fix polled console initialisation

    commit 4bef7c6f299910f19876ad8e7f5897514855f1d2 upstream.

    The polled console (KGDB/KDB) implementation must not call port setup
    unconditionally as the port may already be in use by the console or a
    getty.

    Only make sure that the receiver is enabled, but do not enable any
    device interrupts.

    Fixes: d8851a96ba25 ("tty: serial: qcom-geni-serial: Add a poll_init() function")
    Cc: stable@vger.kernel.org	# 6.4
    Cc: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-2-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6acd19ad3aaf270b19e704b5cff14808766fca84
Author: Nam Cao <namcao@linutronix.de>
Date:   Thu Oct 3 10:41:52 2024 +0200

    irqchip/sifive-plic: Unmask interrupt in plic_irq_enable()

    commit 6b1e0651e9ce8ce418ad4ff360e7b9925dc5da79 upstream.

    It is possible that an interrupt is disabled and masked at the same time.
    When the interrupt is enabled again by enable_irq(), only plic_irq_enable()
    is called, not plic_irq_unmask(). The interrupt remains masked and never
    raises.

    An example where interrupt is both disabled and masked is when
    handle_fasteoi_irq() is the handler, and IRQS_ONESHOT is set. The interrupt
    handler:

      1. Mask the interrupt
      2. Handle the interrupt
      3. Check if interrupt is still enabled, and unmask it (see
         cond_unmask_eoi_irq())

    If another task disables the interrupt in the middle of the above steps,
    the interrupt will not get unmasked, and will remain masked when it is
    enabled in the future.

    The problem is occasionally observed when PREEMPT_RT is enabled, because
    PREEMPT_RT adds the IRQS_ONESHOT flag. But PREEMPT_RT only makes the problem
    more likely to appear, the bug has been around since commit a1706a1c5062
    ("irqchip/sifive-plic: Separate the enable and mask operations").

    Fix it by unmasking interrupt in plic_irq_enable().

    Fixes: a1706a1c5062 ("irqchip/sifive-plic: Separate the enable and mask operations")
    Signed-off-by: Nam Cao <namcao@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241003084152.2422969-1-namcao@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 01282ab5182f85e42234df2ff42f0ce790f465ff
Author: Marc Zyngier <maz@kernel.org>
Date:   Wed Oct 2 21:49:59 2024 +0100

    irqchip/gic-v4: Don't allow a VMOVP on a dying VPE

    commit 1442ee0011983f0c5c4b92380e6853afb513841a upstream.

    Kunkun Jiang reported that there is a small window of opportunity for
    userspace to force a change of affinity for a VPE while the VPE has already
    been unmapped, but the corresponding doorbell interrupt still visible in
    /proc/irq/.

    Plug the race by checking the value of vmapp_count, which tracks whether
    the VPE is mapped ot not, and returning an error in this case.

    This involves making vmapp_count common to both GICv4.1 and its v4.0
    ancestor.

    Fixes: 64edfaa9a234 ("irqchip/gic-v4.1: Implement the v4.1 flavour of VMAPP")
    Reported-by: Kunkun Jiang <jiangkunkun@huawei.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/c182ece6-2ba0-ce4f-3404-dba7a3ab6c52@huawei.com
    Link: https://lore.kernel.org/all/20241002204959.2051709-1-maz@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fad940e2dd789155f99ecafa71a7baf6f96530bc
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Thu Sep 5 10:09:17 2024 +0800

    pinctrl: apple: check devm_kasprintf() returned value

    commit 665a58fe663ac7a9ea618dc0b29881649324b116 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/20240905020917.356534-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3b36bb1fca2b87f6292ca2a8593f297c5e9fab41
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Fri Sep 6 18:03:26 2024 +0800

    pinctrl: stm32: check devm_kasprintf() returned value

    commit b0f0e3f0552a566def55c844b0d44250c58e4df6 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: 32c170ff15b0 ("pinctrl: stm32: set default gpio line names using pin names")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Link: https://lore.kernel.org/20240906100326.624445-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 20728e86289ab463b99b7ab4425515bd26aba417
Author: Sergey Matsievskiy <matsievskiysv@gmail.com>
Date:   Sat Oct 12 13:57:43 2024 +0300

    pinctrl: ocelot: fix system hang on level based interrupts

    commit 93b8ddc54507a227087c60a0013ed833b6ae7d3c upstream.

    The current implementation only calls chained_irq_enter() and
    chained_irq_exit() if it detects pending interrupts.

    ```
    for (i = 0; i < info->stride; i++) {
    	uregmap_read(info->map, id_reg + 4 * i, &reg);
    	if (!reg)
    		continue;

    	chained_irq_enter(parent_chip, desc);
    ```

    However, in case of GPIO pin configured in level mode and the parent
    controller configured in edge mode, GPIO interrupt might be lowered by the
    hardware. In the result, if the interrupt is short enough, the parent
    interrupt is still pending while the GPIO interrupt is cleared;
    chained_irq_enter() never gets called and the system hangs trying to
    service the parent interrupt.

    Moving chained_irq_enter() and chained_irq_exit() outside the for loop
    ensures that they are called even when GPIO interrupt is lowered by the
    hardware.

    The similar code with chained_irq_enter() / chained_irq_exit() functions
    wrapping interrupt checking loop may be found in many other drivers:
    ```
    grep -r -A 10 chained_irq_enter drivers/pinctrl
    ```

    Cc: stable@vger.kernel.org
    Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
    Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Link: https://lore.kernel.org/20241012105743.12450-2-matsievskiysv@gmail.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 481b477ab63c7245715a3e57ba79eb87c2dc0d02
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Sep 26 09:10:31 2024 -0700

    x86/bugs: Use code segment selector for VERW operand

    commit e4d2102018542e3ae5e297bc6e229303abff8a0f upstream.

    Robert Gill reported below #GP in 32-bit mode when dosemu software was
    executing vm86() system call:

      general protection fault: 0000 [#1] PREEMPT SMP
      CPU: 4 PID: 4610 Comm: dosemu.bin Not tainted 6.6.21-gentoo-x86 #1
      Hardware name: Dell Inc. PowerEdge 1950/0H723K, BIOS 2.7.0 10/30/2010
      EIP: restore_all_switch_stack+0xbe/0xcf
      EAX: 00000000 EBX: 00000000 ECX: 00000000 EDX: 00000000
      ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: ff8affdc
      DS: 0000 ES: 0000 FS: 0000 GS: 0033 SS: 0068 EFLAGS: 00010046
      CR0: 80050033 CR2: 00c2101c CR3: 04b6d000 CR4: 000406d0
      Call Trace:
       show_regs+0x70/0x78
       die_addr+0x29/0x70
       exc_general_protection+0x13c/0x348
       exc_bounds+0x98/0x98
       handle_exception+0x14d/0x14d
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf

    This only happens in 32-bit mode when VERW based mitigations like MDS/RFDS
    are enabled. This is because segment registers with an arbitrary user value
    can result in #GP when executing VERW. Intel SDM vol. 2C documents the
    following behavior for VERW instruction:

      #GP(0) - If a memory operand effective address is outside the CS, DS, ES,
    	   FS, or GS segment limit.

    CLEAR_CPU_BUFFERS macro executes VERW instruction before returning to user
    space. Use %cs selector to reference VERW operand. This ensures VERW will
    not #GP for an arbitrary user %ds.

    [ mingo: Fixed the SOB chain. ]

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Robert Gill <rtgill82@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com
    Cc: stable@vger.kernel.org # 5.10+
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218707
    Closes: https://lore.kernel.org/all/8c77ccfd-d561-45a1-8ed5-6b75212c7a58@leemhuis.info/
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Suggested-by: Brian Gerst <brgerst@gmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c29f192e0d44cc1cbaf698fa1ff198f63556691a
Author: Longlong Xia <xialonglong@kylinos.cn>
Date:   Thu Sep 26 21:02:13 2024 +0800

    tty: n_gsm: Fix use-after-free in gsm_cleanup_mux

    commit 9462f4ca56e7d2430fdb6dcc8498244acbfc4489 upstream.

    BUG: KASAN: slab-use-after-free in gsm_cleanup_mux+0x77b/0x7b0
    drivers/tty/n_gsm.c:3160 [n_gsm]
    Read of size 8 at addr ffff88815fe99c00 by task poc/3379
    CPU: 0 UID: 0 PID: 3379 Comm: poc Not tainted 6.11.0+ #56
    Hardware name: VMware, Inc. VMware Virtual Platform/440BX
    Desktop Reference Platform, BIOS 6.00 11/12/2020
    Call Trace:
     <TASK>
     gsm_cleanup_mux+0x77b/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     __pfx_gsm_cleanup_mux+0x10/0x10 drivers/tty/n_gsm.c:3124 [n_gsm]
     __pfx_sched_clock_cpu+0x10/0x10 kernel/sched/clock.c:389
     update_load_avg+0x1c1/0x27b0 kernel/sched/fair.c:4500
     __pfx_min_vruntime_cb_rotate+0x10/0x10 kernel/sched/fair.c:846
     __rb_insert_augmented+0x492/0xbf0 lib/rbtree.c:161
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     _raw_spin_lock_irqsave+0x92/0xf0 arch/x86/include/asm/atomic.h:107
     __pfx_gsmld_ioctl+0x10/0x10 drivers/tty/n_gsm.c:3822 [n_gsm]
     ktime_get+0x5e/0x140 kernel/time/timekeeping.c:195
     ldsem_down_read+0x94/0x4e0 arch/x86/include/asm/atomic64_64.h:79
     __pfx_ldsem_down_read+0x10/0x10 drivers/tty/tty_ldsem.c:338
     __pfx_do_vfs_ioctl+0x10/0x10 fs/ioctl.c:805
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    Allocated by task 65:
     gsm_data_alloc.constprop.0+0x27/0x190 drivers/tty/n_gsm.c:926 [n_gsm]
     gsm_send+0x2c/0x580 drivers/tty/n_gsm.c:819 [n_gsm]
     gsm1_receive+0x547/0xad0 drivers/tty/n_gsm.c:3038 [n_gsm]
     gsmld_receive_buf+0x176/0x280 drivers/tty/n_gsm.c:3609 [n_gsm]
     tty_ldisc_receive_buf+0x101/0x1e0 drivers/tty/tty_buffer.c:391
     tty_port_default_receive_buf+0x61/0xa0 drivers/tty/tty_port.c:39
     flush_to_ldisc+0x1b0/0x750 drivers/tty/tty_buffer.c:445
     process_scheduled_works+0x2b0/0x10d0 kernel/workqueue.c:3229
     worker_thread+0x3dc/0x950 kernel/workqueue.c:3391
     kthread+0x2a3/0x370 kernel/kthread.c:389
     ret_from_fork+0x2d/0x70 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:257

    Freed by task 3367:
     kfree+0x126/0x420 mm/slub.c:4580
     gsm_cleanup_mux+0x36c/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    [Analysis]
    gsm_msg on the tx_ctrl_list or tx_data_list of gsm_mux
    can be freed by multi threads through ioctl,which leads
    to the occurrence of uaf. Protect it by gsm tx lock.

    Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>
    Cc: stable <stable@kernel.org>
    Suggested-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20240926130213.531959-1-xialonglong@kylinos.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 227358e89703c344008119be7e8ffa3fdb5b92de
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:44 2024 -0700

    x86/entry_32: Clear CPU buffers after register restore in NMI return

    commit 48a2440d0f20c826b884e04377ccc1e4696c84e9 upstream.

    CPU buffers are currently cleared after call to exc_nmi, but before
    register state is restored. This may be okay for MDS mitigation but not for
    RDFS. Because RDFS mitigation requires CPU buffers to be cleared when
    registers don't have any sensitive data.

    Move CLEAR_CPU_BUFFERS after RESTORE_ALL_NMI.

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-2-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c6a7e2c6012cee8273f2b7c1a335a609f8a73b7
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:38 2024 -0700

    x86/entry_32: Do not clobber user EFLAGS.ZF

    commit 2e2e5143d4868163d6756c8c6a4d28cbfa5245e5 upstream.

    Opportunistic SYSEXIT executes VERW to clear CPU buffers after user EFLAGS
    are restored. This can clobber user EFLAGS.ZF.

    Move CLEAR_CPU_BUFFERS before the user EFLAGS are restored. This ensures
    that the user EFLAGS.ZF is not clobbered.

    Closes: https://lore.kernel.org/lkml/yVXwe8gvgmPADpRB6lXlicS2fcHoV5OHHxyuFbB_MEleRPD7-KhGe5VtORejtPe-KCkT8Uhcg5d7-IBw4Ojb4H7z5LQxoZylSmJ8KNL3A8o=@protonmail.com/
    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Jari Ruusu <jariruusu@protonmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-1-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c8170b5ddc411201f8de0a654901f204a2cdd415
Author: John Allen <john.allen@amd.com>
Date:   Mon Sep 23 16:44:04 2024 +0000

    x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load

    commit ee4d4e8d2c3bec6ee652599ab31991055a72c322 upstream.

    Commit

      f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")

    causes a bit in the DE_CFG MSR to get set erroneously after a microcode late
    load.

    The microcode late load path calls into amd_check_microcode() and subsequently
    zen2_zenbleed_check(). Since the above commit removes the cpu_has_amd_erratum()
    call from zen2_zenbleed_check(), this will cause all non-Zen2 CPUs to go
    through the function and set the bit in the DE_CFG MSR.

    Call into the Zenbleed fix path on Zen2 CPUs only.

      [ bp: Massage commit message, use cpu_feature_enabled(). ]

    Fixes: f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")
    Signed-off-by: John Allen <john.allen@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20240923164404.27227-1-john.allen@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6663f0c658857e9ebb87ed6b98c0126bbaa2bf46
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Tue Oct 15 14:15:22 2024 +0800

    x86/apic: Always explicitly disarm TSC-deadline timer

    commit ffd95846c6ec6cf1f93da411ea10d504036cab42 upstream.

    New processors have become pickier about the local APIC timer state
    before entering low power modes. These low power modes are used (for
    example) when you close your laptop lid and suspend. If you put your
    laptop in a bag and it is not in this low power mode, it is likely
    to get quite toasty while it quickly sucks the battery dry.

    The problem boils down to some CPUs' inability to power down until the
    CPU recognizes that the local APIC timer is shut down. The current
    kernel code works in one-shot and periodic modes but does not work for
    deadline mode. Deadline mode has been the supported and preferred mode
    on Intel CPUs for over a decade and uses an MSR to drive the timer
    instead of an APIC register.

    Disable the TSC Deadline timer in lapic_timer_shutdown() by writing to
    MSR_IA32_TSC_DEADLINE when in TSC-deadline mode. Also avoid writing
    to the initial-count register (APIC_TMICT) which is ignored in
    TSC-deadline mode.

    Note: The APIC_LVTT|=APIC_LVT_MASKED operation should theoretically be
    enough to tell the hardware that the timer will not fire in any of the
    timer modes. But mitigating AMD erratum 411[1] also requires clearing
    out APIC_TMICT. Solely setting APIC_LVT_MASKED is also ineffective in
    practice on Intel Lunar Lake systems, which is the motivation for this
    change.

    1. 411 Processor May Exit Message-Triggered C1E State Without an Interrupt if Local APIC Timer Reaches Zero - https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/revision-guides/41322_10h_Rev_Gd.pdf

    Fixes: 279f1461432c ("x86: apic: Use tsc deadline for oneshot when available")
    Suggested-by: Dave Hansen <dave.hansen@intel.com>
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Tested-by: Todd Brandt <todd.e.brandt@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241015061522.25288-1-rui.zhang%40intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 16d7d35f1c1e2a3a5cb14c91fe0f1922068942c9
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Sep 17 09:02:53 2024 -0700

    x86/resctrl: Annotate get_mem_config() functions as __init

    commit d5fd042bf4cfb557981d65628e1779a492cd8cfa upstream.

    After a recent LLVM change [1] that deduces __cold on functions that only call
    cold code (such as __init functions), there is a section mismatch warning from
    __get_mem_config_intel(), which got moved to .text.unlikely. as a result of
    that optimization:

      WARNING: modpost: vmlinux: section mismatch in reference: \
      __get_mem_config_intel+0x77 (section: .text.unlikely.) -> thread_throttle_mode_init (section: .init.text)

    Mark __get_mem_config_intel() as __init as well since it is only called
    from __init code, which clears up the warning.

    While __rdt_get_mem_config_amd() does not exhibit a warning because it
    does not call any __init code, it is a similar function that is only
    called from __init code like __get_mem_config_intel(), so mark it __init
    as well to keep the code symmetrical.

    CONFIG_SECTION_MISMATCH_WARN_ONLY=n would turn this into a fatal error.

    Fixes: 05b93417ce5b ("x86/intel_rdt/mba: Add primary support for Memory Bandwidth Allocation (MBA)")
    Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature")
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Cc: <stable@kernel.org>
    Link: https://github.com/llvm/llvm-project/commit/6b11573b8c5e3d36beee099dbe7347c2a007bf53 [1]
    Link: https://lore.kernel.org/r/20240917-x86-restctrl-get_mem_config_intel-init-v3-1-10d521256284@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 66029078fee00646e2e9dbb8f41ff7819f8e7569
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Sep 20 12:32:19 2024 +0200

    parport: Proper fix for array out-of-bounds access

    commit 02ac3a9ef3a18b58d8f3ea2b6e46de657bf6c4f9 upstream.

    The recent fix for array out-of-bounds accesses replaced sprintf()
    calls blindly with snprintf().  However, since snprintf() returns the
    would-be-printed size, not the actually output size, the length
    calculation can still go over the given limit.

    Use scnprintf() instead of snprintf(), which returns the actually
    output letters, for addressing the potential out-of-bounds access
    properly.

    Fixes: ab11dac93d2d ("dev/parport: fix the array out-of-bounds risk")
    Cc: stable@vger.kernel.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://lore.kernel.org/r/20240920103318.19271-1-tiwai@suse.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c895d48c843dee8baf5327dee33ce786760c9d44
Author: Marek Vasut <marex@denx.de>
Date:   Wed Oct 2 20:40:38 2024 +0200

    serial: imx: Update mctrl old_status on RTSD interrupt

    commit 40d7903386df4d18f04d90510ba90eedee260085 upstream.

    When sending data using DMA at high baudrate (4 Mbdps in local test case) to
    a device with small RX buffer which keeps asserting RTS after every received
    byte, it is possible that the iMX UART driver would not recognize the falling
    edge of RTS input signal and get stuck, unable to transmit any more data.

    This condition happens when the following sequence of events occur:
    - imx_uart_mctrl_check() is called at some point and takes a snapshot of UART
      control signal status into sport->old_status using imx_uart_get_hwmctrl().
      The RTSS/TIOCM_CTS bit is of interest here (*).
    - DMA transfer occurs, the remote device asserts RTS signal after each byte.
      The i.MX UART driver recognizes each such RTS signal change, raises an
      interrupt with USR1 register RTSD bit set, which leads to invocation of
      __imx_uart_rtsint(), which calls uart_handle_cts_change().
      - If the RTS signal is deasserted, uart_handle_cts_change() clears
        port->hw_stopped and unblocks the port for further data transfers.
      - If the RTS is asserted, uart_handle_cts_change() sets port->hw_stopped
        and blocks the port for further data transfers. This may occur as the
        last interrupt of a transfer, which means port->hw_stopped remains set
        and the port remains blocked (**).
    - Any further data transfer attempts will trigger imx_uart_mctrl_check(),
      which will read current status of UART control signals by calling
      imx_uart_get_hwmctrl() (***) and compare it with sport->old_status .
      - If current status differs from sport->old_status for RTS signal,
        uart_handle_cts_change() is called and possibly unblocks the port
        by clearing port->hw_stopped .
      - If current status does not differ from sport->old_status for RTS
        signal, no action occurs. This may occur in case prior snapshot (*)
        was taken before any transfer so the RTS is deasserted, current
        snapshot (***) was taken after a transfer and therefore RTS is
        deasserted again, which means current status and sport->old_status
        are identical. In case (**) triggered when RTS got asserted, and
        made port->hw_stopped set, the port->hw_stopped will remain set
        because no change on RTS line is recognized by this driver and
        uart_handle_cts_change() is not called from here to unblock the
        port->hw_stopped.

    Update sport->old_status in __imx_uart_rtsint() accordingly to make
    imx_uart_mctrl_check() detect such RTS change. Note that TIOCM_CAR
    and TIOCM_RI bits in sport->old_status do not suffer from this problem.

    Fixes: ceca629e0b48 ("[ARM] 2971/1: i.MX uart handle rts irq")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Esben Haabendal <esben@geanix.com>
    Signed-off-by: Marek Vasut <marex@denx.de>
    Link: https://lore.kernel.org/r/20241002184133.19427-1-marex@denx.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 245bee12a52d55312aa3948ddae6887788566893
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:22 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for OTP device

    commit 2471787c1f0dae6721f60ab44be37460635d3732 upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 0969001569e4 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-2-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 78df42183e824d368e5d45169c6b7c506d81f690
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:20 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for EEPROM device

    commit 3c2d73de49be528276474c1a53f78b38ee11c1fa upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 9ab5465349c0 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX EEPROM via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-1-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3d3501cf896cd6b75f9b018d59247322ac5a4eb
Author: Prashanth K <quic_prashk@quicinc.com>
Date:   Tue Sep 24 15:02:08 2024 +0530

    usb: dwc3: Wait for EndXfer completion before restoring GUSB2PHYCFG

    commit c96e31252110a84dcc44412e8a7b456b33c3e298 upstream.

    DWC3 programming guide mentions that when operating in USB2.0 speeds,
    if GUSB2PHYCFG[6] or GUSB2PHYCFG[8] is set, it must be cleared prior
    to issuing commands and may be set again  after the command completes.
    But currently while issuing EndXfer command without CmdIOC set, we
    wait for 1ms after GUSB2PHYCFG is restored. This results in cases
    where EndXfer command doesn't get completed and causes SMMU faults
    since requests are unmapped afterwards. Hence restore GUSB2PHYCFG
    after waiting for EndXfer command completion.

    Cc: stable@vger.kernel.org
    Fixes: 1d26ba0944d3 ("usb: dwc3: Wait unconditionally after issuing EndXfer command")
    Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20240924093208.2524531-1-quic_prashk@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 479830f6c15b1a3e3c1488762a8a3bcf93e2b94f
Author: Jonathan Marek <jonathan@marek.ca>
Date:   Sat Oct 5 10:41:46 2024 -0400

    usb: typec: qcom-pmic-typec: fix sink status being overwritten with RP_DEF

    commit ffe85c24d7ca5de7d57690c0ab194b3838674935 upstream.

    This line is overwriting the result of the above switch-case.

    This fixes the tcpm driver getting stuck in a "Sink TX No Go" loop.

    Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jonathan Marek <jonathan@marek.ca>
    Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20241005144146.2345-1-jonathan@marek.ca
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 86c68aa714d0e5082ccee8f0679cb69821cf8339
Author: Daniele Palmas <dnlplm@gmail.com>
Date:   Thu Oct 3 11:38:08 2024 +0200

    USB: serial: option: add Telit FN920C04 MBIM compositions

    commit 6d951576ee16430822a8dee1e5c54d160e1de87d upstream.

    Add the following Telit FN920C04 compositions:

    0x10a2: MBIM + tty (AT/NMEA) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 17 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a2 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10a7: MBIM + tty (AT) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 18 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a7 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10aa: MBIM + tty (AT) + tty (diag) + DPL (data packet logging) + adb
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 15 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10aa Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90a5c64279ae5b906604cfb3809a25fb2d91d674
Author: Benjamin B. Frost <benjamin@geanix.com>
Date:   Wed Sep 11 10:54:05 2024 +0200

    USB: serial: option: add support for Quectel EG916Q-GL

    commit 540eff5d7faf0c9330ec762da49df453263f7676 upstream.

    Add Quectel EM916Q-GL with product ID 0x6007

    T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=6007 Rev= 2.00
    S:  Manufacturer=Quectel
    S:  Product=EG916Q-GL
    C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=200mA
    A:  FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=84(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=86(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=88(I) Atr=03(Int.) MxPS=  32 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    I:* If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    MI_00 Quectel USB Diag Port
    MI_01 Quectel USB NMEA Port
    MI_02 Quectel USB AT Port
    MI_03 Quectel USB Modem Port
    MI_04 Quectel USB Net Port

    Signed-off-by: Benjamin B. Frost <benjamin@geanix.com>
    Reviewed-by: Lars Melin <larsm17@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 53cd1bb1f8ebf961a7be197734465893a8930a58
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:58 2024 +0300

    xhci: Mitigate failed set dequeue pointer commands

    commit fe49df60cdb7c2975aa743dc295f8786e4b7db10 upstream.

    Avoid xHC host from processing a cancelled URB by always turning
    cancelled URB TDs into no-op TRBs before queuing a 'Set TR Deq' command.

    If the command fails then xHC will start processing the cancelled TD
    instead of skipping it once endpoint is restarted, causing issues like
    Babble error.

    This is not a complete solution as a failed 'Set TR Deq' command does not
    guarantee xHC TRB caches are cleared.

    Fixes: 4db356924a50 ("xhci: turn cancelled td cleanup to its own function")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-3-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc7b7050996ac46a7236864a3c86adfd69829a14
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:57 2024 +0300

    xhci: Fix incorrect stream context type macro

    commit 6599b6a6fa8060145046d0744456b6abdb3122a7 upstream.

    The stream contex type (SCT) bitfield is used both in the stream context
    data structure,  and in the 'Set TR Dequeue pointer' command TRB.
    In both cases it uses bits 3:1

    The SCT_FOR_TRB(p) macro used to set the stream context type (SCT) field
    for the 'Set TR Dequeue pointer' command TRB incorrectly shifts the value
    1 bit left before masking the three bits.

    Fix this by first masking and rshifting, just like the similar
    SCT_FOR_CTX(p) macro does

    This issue has not been visibile as the lost bit 3 is only used with
    secondary stream arrays (SSA). Xhci driver currently only supports using
    a primary stream array with Linear stream addressing.

    Fixes: 95241dbdf828 ("xhci: Set SCT field for Set TR dequeue on streams")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9c696bf4ab54c7cec81221887564305f0ceeac0a
Author: Henry Lin <henryl@nvidia.com>
Date:   Mon Oct 14 12:21:34 2024 +0800

    xhci: tegra: fix checked USB2 port number

    commit 7d381137cb6ecf558ef6698c7730ddd482d4c8f2 upstream.

    If USB virtualizatoin is enabled, USB2 ports are shared between all
    Virtual Functions. The USB2 port number owned by an USB2 root hub in
    a Virtual Function may be less than total USB2 phy number supported
    by the Tegra XUSB controller.

    Using total USB2 phy number as port number to check all PORTSC values
    would cause invalid memory access.

    [  116.923438] Unable to handle kernel paging request at virtual address 006c622f7665642f
    ...
    [  117.213640] Call trace:
    [  117.216783]  tegra_xusb_enter_elpg+0x23c/0x658
    [  117.222021]  tegra_xusb_runtime_suspend+0x40/0x68
    [  117.227260]  pm_generic_runtime_suspend+0x30/0x50
    [  117.232847]  __rpm_callback+0x84/0x3c0
    [  117.237038]  rpm_suspend+0x2dc/0x740
    [  117.241229] pm_runtime_work+0xa0/0xb8
    [  117.245769]  process_scheduled_works+0x24c/0x478
    [  117.251007]  worker_thread+0x23c/0x328
    [  117.255547]  kthread+0x104/0x1b0
    [  117.259389]  ret_from_fork+0x10/0x20
    [  117.263582] Code: 54000222 f9461ae8 f8747908 b4ffff48 (f9400100)

    Cc: stable@vger.kernel.org # v6.3+
    Fixes: a30951d31b25 ("xhci: tegra: USB2 pad power controls")
    Signed-off-by: Henry Lin <henryl@nvidia.com>
    Link: https://lore.kernel.org/r/20241014042134.27664-1-henryl@nvidia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc2d5f02636c7587bdd6d1f60fc59c55860b00a4
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Fri Oct 11 02:46:19 2024 +0900

    vt: prevent kernel-infoleak in con_font_get()

    commit f956052e00de211b5c9ebaa1958366c23f82ee9e upstream.

    font.data may not initialize all memory spaces depending on the implementation
    of vc->vc_sw->con_font_get. This may cause info-leak, so to prevent this, it
    is safest to modify it to initialize the allocated memory space to 0, and it
    generally does not affect the overall performance of the system.

    Cc: stable@vger.kernel.org
    Reported-by: syzbot+955da2d57931604ee691@syzkaller.appspotmail.com
    Fixes: 05e2600cb0a4 ("VT: Bump font size limitation to 64x128 pixels")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Link: https://lore.kernel.org/r/20241010174619.59662-1-aha310510@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 885f8c873fedf3393c76827c4821071bf5fd16b1
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Oct 16 11:47:00 2024 -0400

    Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001

    commit 2c1dda2acc4192d826e84008d963b528e24d12bc upstream.

    Fake CSR controllers don't seem to handle short-transfer properly which
    cause command to time out:

    kernel: usb 1-1: new full-speed USB device number 19 using xhci_hcd
    kernel: usb 1-1: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
    kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    kernel: usb 1-1: Product: BT DONGLE10
    ...
    Bluetooth: hci1: Opcode 0x1004 failed: -110
    kernel: Bluetooth: hci1: command 0x1004 tx timeout

    According to USB Spec 2.0 Section 5.7.3 Interrupt Transfer Packet Size
    Constraints a interrupt transfer is considered complete when the size is 0
    (ZPL) or < wMaxPacketSize:

     'When an interrupt transfer involves more data than can fit in one
     data payload of the currently established maximum size, all data
     payloads are required to be maximum-sized except for the last data
     payload, which will contain the remaining data. An interrupt transfer
     is complete when the endpoint does one of the following:

     • Has transferred exactly the amount of data expected
     • Transfers a packet with a payload size less than wMaxPacketSize or
     transfers a zero-length packet'

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=219365
    Fixes: 7b05933340f4 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8fb8e912afb4c47dec12ea9a5853e7a8db95816f
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:08 2024 +0000

    Bluetooth: ISO: Fix multiple init when debugfs is disabled

    commit a9b7b535ba192c6b77e6c15a4c82d853163eab8c upstream.

    If bt_debugfs is not created successfully, which happens if either
    CONFIG_DEBUG_FS or CONFIG_DEBUG_FS_ALLOW_ALL is unset, then iso_init()
    returns early and does not set iso_inited to true. This means that a
    subsequent call to iso_init() will result in duplicate calls to
    proto_register(), bt_sock_register(), etc.

    With CONFIG_LIST_HARDENED and CONFIG_BUG_ON_DATA_CORRUPTION enabled, the
    duplicate call to proto_register() triggers this BUG():

      list_add double add: new=ffffffffc0b280d0, prev=ffffffffbab56250,
        next=ffffffffc0b280d0.
      ------------[ cut here ]------------
      kernel BUG at lib/list_debug.c:35!
      Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI
      CPU: 2 PID: 887 Comm: bluetoothd Not tainted 6.10.11-1-ao-desktop #1
      RIP: 0010:__list_add_valid_or_report+0x9a/0xa0
      ...
        __list_add_valid_or_report+0x9a/0xa0
        proto_register+0x2b5/0x340
        iso_init+0x23/0x150 [bluetooth]
        set_iso_socket_func+0x68/0x1b0 [bluetooth]
        kmem_cache_free+0x308/0x330
        hci_sock_sendmsg+0x990/0x9e0 [bluetooth]
        __sock_sendmsg+0x7b/0x80
        sock_write_iter+0x9a/0x110
        do_iter_readv_writev+0x11d/0x220
        vfs_writev+0x180/0x3e0
        do_writev+0xca/0x100
      ...

    This change removes the early return. The check for iso_debugfs being
    NULL was unnecessary, it is always NULL when iso_inited is false.

    Cc: stable@vger.kernel.org
    Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
    Signed-off-by: Aaron Thompson <dev@aaront.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 59bd80df4b88e28e37524105b3ec1853bae32713
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:10 2024 +0000

    Bluetooth: Remove debugfs directory on module init failure

    commit 1db4564f101b47188c1b71696bd342ef09172b22 upstream.

    If bt_init() fails, the debugfs directory currently is not removed. If
    the module is loaded again after that, the debugfs directory is not set
    up properly due to the existing directory.

      # modprobe bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:26 ./
      drwx------ 31 root root 0 Sep 27 14:25 ../
      -r--r--r--  1 root root 0 Sep 27 14:26 l2cap
      -r--r--r--  1 root root 0 Sep 27 14:26 sco
      # modprobe -r bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      ls: cannot access '/sys/kernel/debug/bluetooth': No such file or directory
      #

      # modprobe bluetooth
      modprobe: ERROR: could not insert 'bluetooth': Invalid argument
      # dmesg | tail -n 6
      Bluetooth: Core ver 2.22
      NET: Registered PF_BLUETOOTH protocol family
      Bluetooth: HCI device and connection manager initialized
      Bluetooth: HCI socket layer initialized
      Bluetooth: Faking l2cap_init() failure for testing
      NET: Unregistered PF_BLUETOOTH protocol family
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:31 ./
      drwx------ 31 root roo…
@qaz6750 qaz6750 closed this Nov 1, 2024
qaz6750 added a commit that referenced this pull request Nov 1, 2024
commit 18916a684a8b836957df88438f9bca590799d04c
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Oct 22 15:46:36 2024 +0200

    Linux 6.6.58

    Link: https://lore.kernel.org/r/20241021102256.706334758@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fd6e2af79a947e909c72b09f1ce3175f381067ef
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Wed Oct 16 11:07:13 2024 +0300

    ALSA: hda/conexant - Use cached pin control for Node 0x1d on HP EliteOne 1000 G2

    commit 164cd0e077a18d6208523c82b102c98c77fdd51f upstream.

    The cached version avoids redundant commands to the codec, improving
    stability and reducing unnecessary operations. This change ensures
    better power management and reliable restoration of pin configurations,
    especially after hibernation (S4) and other power transitions.

    Fixes: 9988844c457f ("ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2")
    Suggested-by: Kai-Heng Feng <kaihengf@nvidia.com>
    Suggested-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Link: https://patch.msgid.link/20241016080713.46801-1-kovalev@altlinux.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9698088ac7704e260f492d9c254e29ed7dd8729a
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 4 12:35:31 2024 +0900

    nilfs2: propagate directory read errors from nilfs_find_entry()

    commit 08cfa12adf888db98879dbd735bc741360a34168 upstream.

    Syzbot reported that a task hang occurs in vcs_open() during a fuzzing
    test for nilfs2.

    The root cause of this problem is that in nilfs_find_entry(), which
    searches for directory entries, ignores errors when loading a directory
    page/folio via nilfs_get_folio() fails.

    If the filesystem images is corrupted, and the i_size of the directory
    inode is large, and the directory page/folio is successfully read but
    fails the sanity check, for example when it is zero-filled,
    nilfs_check_folio() may continue to spit out error messages in bursts.

    Fix this issue by propagating the error to the callers when loading a
    page/folio fails in nilfs_find_entry().

    The current interface of nilfs_find_entry() and its callers is outdated
    and cannot propagate error codes such as -EIO and -ENOMEM returned via
    nilfs_find_entry(), so fix it together.

    Link: https://lkml.kernel.org/r/20241004033640.6841-1-konishi.ryusuke@gmail.com
    Fixes: 2ba466d74ed7 ("nilfs2: directory entry operations")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: Lizhi Xu <lizhi.xu@windriver.com>
    Closes: https://lkml.kernel.org/r/20240927013806.3577931-1-lizhi.xu@windriver.com
    Reported-by: syzbot+8a192e8d090fa9a31135@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=8a192e8d090fa9a31135
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87cb3f6e0c047f9320889e68140f46b1f4ca9eca
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Fri Oct 18 17:57:39 2024 +0200

    selftests: mptcp: remove duplicated variables

    A few week ago, there were some backport issues in MPTCP selftests,
    because some patches have been applied twice, but with versions handling
    conflicts differently [1].

    Patches fixing these issues have been sent [2] and applied, but it looks
    like quilt was still confused with the removal of some patches, and
    commit a417ef47a665 ("selftests: mptcp: join: validate event numbers")
    duplicated some variables, not present in the original patch [3].

    Anyway, Bash was complaining, but that was not causing any tests to
    fail. Also, that's easy to fix by simply removing the duplicated ones.

    Link: https://lore.kernel.org/fc21db4a-508d-41db-aa45-e3bc06d18ce7@kernel.org [1]
    Link: https://lore.kernel.org/20240905144306.1192409-5-matttbe@kernel.org [2]
    Link: https://lore.kernel.org/20240905144306.1192409-7-matttbe@kernel.org [3]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec0d0fcbd5d8645fdfb75717d70270f59254d04d
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:38 2024 +0200

    selftests: mptcp: join: test for prohibited MPC to port-based endp

    commit 5afca7e996c42aed1b4a42d4712817601ba42aff upstream.

    Explicitly verify that MPC connection attempts towards a port-based
    signal endpoint fail with a reset.

    Note that this new test is a bit different from the other ones, not
    using 'run_tests'. It is then needed to add the capture capability, and
    the picking the right port which have been extracted into three new
    helpers. The info about the capture can also be printed from a single
    point, which simplifies the exit paths in do_transfer().

    The 'Fixes' tag here below is the same as the one from the previous
    commit: this patch here is not fixing anything wrong in the selftests,
    but it validates the previous fix for an issue introduced by this commit
    ID.

    Fixes: 1729cf186d8a ("mptcp: create the listening socket for new port")
    Cc: stable@vger.kernel.org
    Co-developed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241014-net-mptcp-mpc-port-endp-v2-2-7faea8e6b6ae@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflicts in mptcp_join.sh, because commit 0bd962dd86b2 ("selftests:
      mptcp: join: check CURRESTAB counters"), and commit 9e6a39ecb9a1
      ("selftests: mptcp: export TEST_COUNTER variable") are linked to new
      features, not available in this version. Resolving the conflicts is
      easy, simply adding the new helpers before do_transfer(), and rename
      MPTCP_LIB_TEST_COUNTER to TEST_COUNT that was used before. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d46b96f0a4892580757d3bbb546d2971dbe83361
Author: Geliang Tang <tanggeliang@kylinos.cn>
Date:   Fri Oct 18 17:57:37 2024 +0200

    selftests: mptcp: join: change capture/checksum as bool

    commit 8c6f6b4bb53a904f922dfb90d566391d3feee32c upstream.

    To maintain consistency with other scripts, this patch changes vars
    'capture' and 'checksum' as bool vars in mptcp_join.

    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-next-20240223-misc-improvements-v1-7-b6c8a10396bd@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 5afca7e996c4 ("selftests: mptcp: join: test for prohibited MPC to port-based endp")
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 229dfdc36f31a8d47433438bc0e6e1662c4ab404
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:36 2024 +0200

    tcp: fix mptcp DSS corruption due to large pmtu xmit

    commit 4dabcdf581217e60690467a37c956a5b8dbc6bd9 upstream.

    Syzkaller was able to trigger a DSS corruption:

      TCP: request_sock_subflow_v4: Possible SYN flooding on port [::]:20002. Sending cookies.
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 5227 at net/mptcp/protocol.c:695 __mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Modules linked in:
      CPU: 0 UID: 0 PID: 5227 Comm: syz-executor350 Not tainted 6.11.0-syzkaller-08829-gaf9c191ac2a0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
      RIP: 0010:__mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Code: 0f b6 dc 31 ff 89 de e8 b5 dd ea f5 89 d8 48 81 c4 50 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 98 da ea f5 90 <0f> 0b 90 e9 47 ff ff ff e8 8a da ea f5 90 0f 0b 90 e9 99 e0 ff ff
      RSP: 0018:ffffc90000006db8 EFLAGS: 00010246
      RAX: ffffffff8ba9df18 RBX: 00000000000055f0 RCX: ffff888030023c00
      RDX: 0000000000000100 RSI: 00000000000081e5 RDI: 00000000000055f0
      RBP: 1ffff110062bf1ae R08: ffffffff8ba9cf12 R09: 1ffff110062bf1b8
      R10: dffffc0000000000 R11: ffffed10062bf1b9 R12: 0000000000000000
      R13: dffffc0000000000 R14: 00000000700cec61 R15: 00000000000081e5
      FS:  000055556679c380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020287000 CR3: 0000000077892000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <IRQ>
       move_skbs_to_msk net/mptcp/protocol.c:811 [inline]
       mptcp_data_ready+0x29c/0xa90 net/mptcp/protocol.c:854
       subflow_data_ready+0x34a/0x920 net/mptcp/subflow.c:1490
       tcp_data_queue+0x20fd/0x76c0 net/ipv4/tcp_input.c:5283
       tcp_rcv_established+0xfba/0x2020 net/ipv4/tcp_input.c:6237
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       tcp_v4_rcv+0x2dc0/0x37f0 net/ipv4/tcp_ipv4.c:2350
       ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205
       ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       __netif_receive_skb_one_core net/core/dev.c:5662 [inline]
       __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775
       process_backlog+0x662/0x15b0 net/core/dev.c:6107
       __napi_poll+0xcb/0x490 net/core/dev.c:6771
       napi_poll net/core/dev.c:6840 [inline]
       net_rx_action+0x89b/0x1240 net/core/dev.c:6962
       handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
       do_softirq+0x11b/0x1e0 kernel/softirq.c:455
       </IRQ>
       <TASK>
       __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
       local_bh_enable include/linux/bottom_half.h:33 [inline]
       rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline]
       __dev_queue_xmit+0x1764/0x3e80 net/core/dev.c:4451
       dev_queue_xmit include/linux/netdevice.h:3094 [inline]
       neigh_hh_output include/net/neighbour.h:526 [inline]
       neigh_output include/net/neighbour.h:540 [inline]
       ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:236
       ip_local_out net/ipv4/ip_output.c:130 [inline]
       __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:536
       __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466
       tcp_transmit_skb net/ipv4/tcp_output.c:1484 [inline]
       tcp_mtu_probe net/ipv4/tcp_output.c:2547 [inline]
       tcp_write_xmit+0x641d/0x6bf0 net/ipv4/tcp_output.c:2752
       __tcp_push_pending_frames+0x9b/0x360 net/ipv4/tcp_output.c:3015
       tcp_push_pending_frames include/net/tcp.h:2107 [inline]
       tcp_data_snd_check net/ipv4/tcp_input.c:5714 [inline]
       tcp_rcv_established+0x1026/0x2020 net/ipv4/tcp_input.c:6239
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       sk_backlog_rcv include/net/sock.h:1113 [inline]
       __release_sock+0x214/0x350 net/core/sock.c:3072
       release_sock+0x61/0x1f0 net/core/sock.c:3626
       mptcp_push_release net/mptcp/protocol.c:1486 [inline]
       __mptcp_push_pending+0x6b5/0x9f0 net/mptcp/protocol.c:1625
       mptcp_sendmsg+0x10bb/0x1b10 net/mptcp/protocol.c:1903
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg+0x1a6/0x270 net/socket.c:745
       ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2603
       ___sys_sendmsg net/socket.c:2657 [inline]
       __sys_sendmsg+0x2aa/0x390 net/socket.c:2686
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7fb06e9317f9
      Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffe2cfd4f98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007fb06e97f468 RCX: 00007fb06e9317f9
      RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000005
      RBP: 00007fb06e97f446 R08: 0000555500000000 R09: 0000555500000000
      R10: 0000555500000000 R11: 0000000000000246 R12: 00007fb06e97f406
      R13: 0000000000000001 R14: 00007ffe2cfd4fe0 R15: 0000000000000003
       </TASK>

    Additionally syzkaller provided a nice reproducer. The repro enables
    pmtu on the loopback device, leading to tcp_mtu_probe() generating
    very large probe packets.

    tcp_can_coalesce_send_queue_head() currently does not check for
    mptcp-level invariants, and allowed the creation of cross-DSS probes,
    leading to the mentioned corruption.

    Address the issue teaching tcp_can_coalesce_send_queue_head() about
    mptcp using the tcp_skb_can_collapse(), also reducing the code
    duplication.

    Fixes: 85712484110d ("tcp: coalesce/collapse must respect MPTCP extensions")
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+d1bff73460e33101f0e7@syzkaller.appspotmail.com
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/513
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241008-net-mptcp-fallback-fixes-v1-2-c6fb8e93e551@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflict in tcp_output.c, because the commit 65249feb6b3d ("net: add
      support for skbs with unreadable frags") is not in this version. This
      commit is linked to a new feature (Devmem TCP) and introduces a new
      condition which causes the conflicts. Resolving this is easy: we can
      ignore the missing new condition, and use tcp_skb_can_collapse() like
      in the original patch. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 647cd4494cc301f019267b901ab5cf71f3e54d57
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:06 2024 +0200

    serial: qcom-geni: fix receiver enable

    commit fa103d2599e11e802c818684cff821baefe7f206 upstream.

    The receiver is supposed to be enabled in the startup() callback and not
    in set_termios() which is called also during console setup.

    This specifically avoids accepting input before the port has been opened
    (and interrupts enabled), something which can also break the GENI
    firmware (cancel fails and after abort, the "stale" counter handling
    appears to be broken so that later input is not processed until twelve
    chars have been received).

    There also does not appear to be any need to keep the receiver disabled
    while updating the port settings.

    Since commit 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during
    console writes") the calls to manipulate the secondary interrupts, which
    were done without holding the port lock, can also lead to the receiver
    being left disabled when set_termios() races with the console code (e.g.
    when init opens the tty during boot). This can manifest itself as a
    serial getty not accepting input.

    The calls to stop and start rx in set_termios() can similarly race with
    DMA completion and, for example, cause the DMA buffer to be unmapped
    twice or the mapping to be leaked.

    Fix this by only enabling the receiver during startup and while holding
    the port lock to avoid racing with the console code.

    Fixes: 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during console writes")
    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-6-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 61c8f746ed831c4e8753bfbf0ccd08c20b13f83a
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:05 2024 +0200

    serial: qcom-geni: fix dma rx cancellation

    commit 23ee4a25661c33e6381d41e848a9060ed6d72845 upstream.

    Make sure to wait for the DMA transfer to complete when cancelling the
    rx command on stop_rx(). This specifically prevents the DMA completion
    interrupt from firing after rx has been restarted, something which can
    lead to an IOMMU fault and hosed rx when the interrupt handler unmaps
    the DMA buffer for the new command:

    	qcom_geni_serial 988000.serial: serial engine reports 0 RX bytes in!
    	arm-smmu 15000000.iommu: FSR    = 00000402 [Format=2 TF], SID=0x563
    	arm-smmu 15000000.iommu: FSYNR0 = 00210013 [S1CBNDX=33 WNR PLVL=3]
    	Bluetooth: hci0: command 0xfc00 tx timeout
    	Bluetooth: hci0: Reading QCA version information failed (-110)

    Also add the missing state machine reset which is needed in case
    cancellation fails.

    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-5-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7176aee5a1b20ae4da1082d6fc59a3b58383f079
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:03 2024 +0200

    serial: qcom-geni: revert broken hibernation support

    commit 19df76662a33d2f2fc41a66607cb8285fc02d6ec upstream.

    This reverts commit 35781d8356a2eecaa6074ceeb80ee22e252fcdae.

    Hibernation is not supported on Qualcomm platforms with mainline
    kernels yet a broken vendor implementation for the GENI serial driver
    made it upstream.

    This is effectively dead code that cannot be tested and should just be
    removed, but if these paths were ever hit for an open non-console port
    they would crash the machine as the driver would fail to enable clocks
    during restore() (i.e. all ports would have to be closed by drivers and
    user space before hibernating the system to avoid this as a comment in
    the code hinted at).

    The broken implementation also added a random call to enable the
    receiver in the port setup code where it does not belong and which
    enables the receiver prematurely for console ports.

    Fixes: 35781d8356a2 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature")
    Cc: stable@vger.kernel.org	# 6.2
    Cc: Aniket Randive <quic_arandive@quicinc.com>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-3-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90e3f819e6aacfcf5b297d4769744f42b5a749c8
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:02 2024 +0200

    serial: qcom-geni: fix polled console initialisation

    commit 4bef7c6f299910f19876ad8e7f5897514855f1d2 upstream.

    The polled console (KGDB/KDB) implementation must not call port setup
    unconditionally as the port may already be in use by the console or a
    getty.

    Only make sure that the receiver is enabled, but do not enable any
    device interrupts.

    Fixes: d8851a96ba25 ("tty: serial: qcom-geni-serial: Add a poll_init() function")
    Cc: stable@vger.kernel.org	# 6.4
    Cc: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-2-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6acd19ad3aaf270b19e704b5cff14808766fca84
Author: Nam Cao <namcao@linutronix.de>
Date:   Thu Oct 3 10:41:52 2024 +0200

    irqchip/sifive-plic: Unmask interrupt in plic_irq_enable()

    commit 6b1e0651e9ce8ce418ad4ff360e7b9925dc5da79 upstream.

    It is possible that an interrupt is disabled and masked at the same time.
    When the interrupt is enabled again by enable_irq(), only plic_irq_enable()
    is called, not plic_irq_unmask(). The interrupt remains masked and never
    raises.

    An example where interrupt is both disabled and masked is when
    handle_fasteoi_irq() is the handler, and IRQS_ONESHOT is set. The interrupt
    handler:

      1. Mask the interrupt
      2. Handle the interrupt
      3. Check if interrupt is still enabled, and unmask it (see
         cond_unmask_eoi_irq())

    If another task disables the interrupt in the middle of the above steps,
    the interrupt will not get unmasked, and will remain masked when it is
    enabled in the future.

    The problem is occasionally observed when PREEMPT_RT is enabled, because
    PREEMPT_RT adds the IRQS_ONESHOT flag. But PREEMPT_RT only makes the problem
    more likely to appear, the bug has been around since commit a1706a1c5062
    ("irqchip/sifive-plic: Separate the enable and mask operations").

    Fix it by unmasking interrupt in plic_irq_enable().

    Fixes: a1706a1c5062 ("irqchip/sifive-plic: Separate the enable and mask operations")
    Signed-off-by: Nam Cao <namcao@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241003084152.2422969-1-namcao@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 01282ab5182f85e42234df2ff42f0ce790f465ff
Author: Marc Zyngier <maz@kernel.org>
Date:   Wed Oct 2 21:49:59 2024 +0100

    irqchip/gic-v4: Don't allow a VMOVP on a dying VPE

    commit 1442ee0011983f0c5c4b92380e6853afb513841a upstream.

    Kunkun Jiang reported that there is a small window of opportunity for
    userspace to force a change of affinity for a VPE while the VPE has already
    been unmapped, but the corresponding doorbell interrupt still visible in
    /proc/irq/.

    Plug the race by checking the value of vmapp_count, which tracks whether
    the VPE is mapped ot not, and returning an error in this case.

    This involves making vmapp_count common to both GICv4.1 and its v4.0
    ancestor.

    Fixes: 64edfaa9a234 ("irqchip/gic-v4.1: Implement the v4.1 flavour of VMAPP")
    Reported-by: Kunkun Jiang <jiangkunkun@huawei.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/c182ece6-2ba0-ce4f-3404-dba7a3ab6c52@huawei.com
    Link: https://lore.kernel.org/all/20241002204959.2051709-1-maz@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fad940e2dd789155f99ecafa71a7baf6f96530bc
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Thu Sep 5 10:09:17 2024 +0800

    pinctrl: apple: check devm_kasprintf() returned value

    commit 665a58fe663ac7a9ea618dc0b29881649324b116 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/20240905020917.356534-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3b36bb1fca2b87f6292ca2a8593f297c5e9fab41
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Fri Sep 6 18:03:26 2024 +0800

    pinctrl: stm32: check devm_kasprintf() returned value

    commit b0f0e3f0552a566def55c844b0d44250c58e4df6 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: 32c170ff15b0 ("pinctrl: stm32: set default gpio line names using pin names")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Link: https://lore.kernel.org/20240906100326.624445-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 20728e86289ab463b99b7ab4425515bd26aba417
Author: Sergey Matsievskiy <matsievskiysv@gmail.com>
Date:   Sat Oct 12 13:57:43 2024 +0300

    pinctrl: ocelot: fix system hang on level based interrupts

    commit 93b8ddc54507a227087c60a0013ed833b6ae7d3c upstream.

    The current implementation only calls chained_irq_enter() and
    chained_irq_exit() if it detects pending interrupts.

    ```
    for (i = 0; i < info->stride; i++) {
    	uregmap_read(info->map, id_reg + 4 * i, &reg);
    	if (!reg)
    		continue;

    	chained_irq_enter(parent_chip, desc);
    ```

    However, in case of GPIO pin configured in level mode and the parent
    controller configured in edge mode, GPIO interrupt might be lowered by the
    hardware. In the result, if the interrupt is short enough, the parent
    interrupt is still pending while the GPIO interrupt is cleared;
    chained_irq_enter() never gets called and the system hangs trying to
    service the parent interrupt.

    Moving chained_irq_enter() and chained_irq_exit() outside the for loop
    ensures that they are called even when GPIO interrupt is lowered by the
    hardware.

    The similar code with chained_irq_enter() / chained_irq_exit() functions
    wrapping interrupt checking loop may be found in many other drivers:
    ```
    grep -r -A 10 chained_irq_enter drivers/pinctrl
    ```

    Cc: stable@vger.kernel.org
    Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
    Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Link: https://lore.kernel.org/20241012105743.12450-2-matsievskiysv@gmail.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 481b477ab63c7245715a3e57ba79eb87c2dc0d02
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Sep 26 09:10:31 2024 -0700

    x86/bugs: Use code segment selector for VERW operand

    commit e4d2102018542e3ae5e297bc6e229303abff8a0f upstream.

    Robert Gill reported below #GP in 32-bit mode when dosemu software was
    executing vm86() system call:

      general protection fault: 0000 [#1] PREEMPT SMP
      CPU: 4 PID: 4610 Comm: dosemu.bin Not tainted 6.6.21-gentoo-x86 #1
      Hardware name: Dell Inc. PowerEdge 1950/0H723K, BIOS 2.7.0 10/30/2010
      EIP: restore_all_switch_stack+0xbe/0xcf
      EAX: 00000000 EBX: 00000000 ECX: 00000000 EDX: 00000000
      ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: ff8affdc
      DS: 0000 ES: 0000 FS: 0000 GS: 0033 SS: 0068 EFLAGS: 00010046
      CR0: 80050033 CR2: 00c2101c CR3: 04b6d000 CR4: 000406d0
      Call Trace:
       show_regs+0x70/0x78
       die_addr+0x29/0x70
       exc_general_protection+0x13c/0x348
       exc_bounds+0x98/0x98
       handle_exception+0x14d/0x14d
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf

    This only happens in 32-bit mode when VERW based mitigations like MDS/RFDS
    are enabled. This is because segment registers with an arbitrary user value
    can result in #GP when executing VERW. Intel SDM vol. 2C documents the
    following behavior for VERW instruction:

      #GP(0) - If a memory operand effective address is outside the CS, DS, ES,
    	   FS, or GS segment limit.

    CLEAR_CPU_BUFFERS macro executes VERW instruction before returning to user
    space. Use %cs selector to reference VERW operand. This ensures VERW will
    not #GP for an arbitrary user %ds.

    [ mingo: Fixed the SOB chain. ]

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Robert Gill <rtgill82@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com
    Cc: stable@vger.kernel.org # 5.10+
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218707
    Closes: https://lore.kernel.org/all/8c77ccfd-d561-45a1-8ed5-6b75212c7a58@leemhuis.info/
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Suggested-by: Brian Gerst <brgerst@gmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c29f192e0d44cc1cbaf698fa1ff198f63556691a
Author: Longlong Xia <xialonglong@kylinos.cn>
Date:   Thu Sep 26 21:02:13 2024 +0800

    tty: n_gsm: Fix use-after-free in gsm_cleanup_mux

    commit 9462f4ca56e7d2430fdb6dcc8498244acbfc4489 upstream.

    BUG: KASAN: slab-use-after-free in gsm_cleanup_mux+0x77b/0x7b0
    drivers/tty/n_gsm.c:3160 [n_gsm]
    Read of size 8 at addr ffff88815fe99c00 by task poc/3379
    CPU: 0 UID: 0 PID: 3379 Comm: poc Not tainted 6.11.0+ #56
    Hardware name: VMware, Inc. VMware Virtual Platform/440BX
    Desktop Reference Platform, BIOS 6.00 11/12/2020
    Call Trace:
     <TASK>
     gsm_cleanup_mux+0x77b/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     __pfx_gsm_cleanup_mux+0x10/0x10 drivers/tty/n_gsm.c:3124 [n_gsm]
     __pfx_sched_clock_cpu+0x10/0x10 kernel/sched/clock.c:389
     update_load_avg+0x1c1/0x27b0 kernel/sched/fair.c:4500
     __pfx_min_vruntime_cb_rotate+0x10/0x10 kernel/sched/fair.c:846
     __rb_insert_augmented+0x492/0xbf0 lib/rbtree.c:161
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     _raw_spin_lock_irqsave+0x92/0xf0 arch/x86/include/asm/atomic.h:107
     __pfx_gsmld_ioctl+0x10/0x10 drivers/tty/n_gsm.c:3822 [n_gsm]
     ktime_get+0x5e/0x140 kernel/time/timekeeping.c:195
     ldsem_down_read+0x94/0x4e0 arch/x86/include/asm/atomic64_64.h:79
     __pfx_ldsem_down_read+0x10/0x10 drivers/tty/tty_ldsem.c:338
     __pfx_do_vfs_ioctl+0x10/0x10 fs/ioctl.c:805
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    Allocated by task 65:
     gsm_data_alloc.constprop.0+0x27/0x190 drivers/tty/n_gsm.c:926 [n_gsm]
     gsm_send+0x2c/0x580 drivers/tty/n_gsm.c:819 [n_gsm]
     gsm1_receive+0x547/0xad0 drivers/tty/n_gsm.c:3038 [n_gsm]
     gsmld_receive_buf+0x176/0x280 drivers/tty/n_gsm.c:3609 [n_gsm]
     tty_ldisc_receive_buf+0x101/0x1e0 drivers/tty/tty_buffer.c:391
     tty_port_default_receive_buf+0x61/0xa0 drivers/tty/tty_port.c:39
     flush_to_ldisc+0x1b0/0x750 drivers/tty/tty_buffer.c:445
     process_scheduled_works+0x2b0/0x10d0 kernel/workqueue.c:3229
     worker_thread+0x3dc/0x950 kernel/workqueue.c:3391
     kthread+0x2a3/0x370 kernel/kthread.c:389
     ret_from_fork+0x2d/0x70 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:257

    Freed by task 3367:
     kfree+0x126/0x420 mm/slub.c:4580
     gsm_cleanup_mux+0x36c/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    [Analysis]
    gsm_msg on the tx_ctrl_list or tx_data_list of gsm_mux
    can be freed by multi threads through ioctl,which leads
    to the occurrence of uaf. Protect it by gsm tx lock.

    Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>
    Cc: stable <stable@kernel.org>
    Suggested-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20240926130213.531959-1-xialonglong@kylinos.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 227358e89703c344008119be7e8ffa3fdb5b92de
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:44 2024 -0700

    x86/entry_32: Clear CPU buffers after register restore in NMI return

    commit 48a2440d0f20c826b884e04377ccc1e4696c84e9 upstream.

    CPU buffers are currently cleared after call to exc_nmi, but before
    register state is restored. This may be okay for MDS mitigation but not for
    RDFS. Because RDFS mitigation requires CPU buffers to be cleared when
    registers don't have any sensitive data.

    Move CLEAR_CPU_BUFFERS after RESTORE_ALL_NMI.

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-2-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c6a7e2c6012cee8273f2b7c1a335a609f8a73b7
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:38 2024 -0700

    x86/entry_32: Do not clobber user EFLAGS.ZF

    commit 2e2e5143d4868163d6756c8c6a4d28cbfa5245e5 upstream.

    Opportunistic SYSEXIT executes VERW to clear CPU buffers after user EFLAGS
    are restored. This can clobber user EFLAGS.ZF.

    Move CLEAR_CPU_BUFFERS before the user EFLAGS are restored. This ensures
    that the user EFLAGS.ZF is not clobbered.

    Closes: https://lore.kernel.org/lkml/yVXwe8gvgmPADpRB6lXlicS2fcHoV5OHHxyuFbB_MEleRPD7-KhGe5VtORejtPe-KCkT8Uhcg5d7-IBw4Ojb4H7z5LQxoZylSmJ8KNL3A8o=@protonmail.com/
    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Jari Ruusu <jariruusu@protonmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-1-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c8170b5ddc411201f8de0a654901f204a2cdd415
Author: John Allen <john.allen@amd.com>
Date:   Mon Sep 23 16:44:04 2024 +0000

    x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load

    commit ee4d4e8d2c3bec6ee652599ab31991055a72c322 upstream.

    Commit

      f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")

    causes a bit in the DE_CFG MSR to get set erroneously after a microcode late
    load.

    The microcode late load path calls into amd_check_microcode() and subsequently
    zen2_zenbleed_check(). Since the above commit removes the cpu_has_amd_erratum()
    call from zen2_zenbleed_check(), this will cause all non-Zen2 CPUs to go
    through the function and set the bit in the DE_CFG MSR.

    Call into the Zenbleed fix path on Zen2 CPUs only.

      [ bp: Massage commit message, use cpu_feature_enabled(). ]

    Fixes: f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")
    Signed-off-by: John Allen <john.allen@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20240923164404.27227-1-john.allen@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6663f0c658857e9ebb87ed6b98c0126bbaa2bf46
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Tue Oct 15 14:15:22 2024 +0800

    x86/apic: Always explicitly disarm TSC-deadline timer

    commit ffd95846c6ec6cf1f93da411ea10d504036cab42 upstream.

    New processors have become pickier about the local APIC timer state
    before entering low power modes. These low power modes are used (for
    example) when you close your laptop lid and suspend. If you put your
    laptop in a bag and it is not in this low power mode, it is likely
    to get quite toasty while it quickly sucks the battery dry.

    The problem boils down to some CPUs' inability to power down until the
    CPU recognizes that the local APIC timer is shut down. The current
    kernel code works in one-shot and periodic modes but does not work for
    deadline mode. Deadline mode has been the supported and preferred mode
    on Intel CPUs for over a decade and uses an MSR to drive the timer
    instead of an APIC register.

    Disable the TSC Deadline timer in lapic_timer_shutdown() by writing to
    MSR_IA32_TSC_DEADLINE when in TSC-deadline mode. Also avoid writing
    to the initial-count register (APIC_TMICT) which is ignored in
    TSC-deadline mode.

    Note: The APIC_LVTT|=APIC_LVT_MASKED operation should theoretically be
    enough to tell the hardware that the timer will not fire in any of the
    timer modes. But mitigating AMD erratum 411[1] also requires clearing
    out APIC_TMICT. Solely setting APIC_LVT_MASKED is also ineffective in
    practice on Intel Lunar Lake systems, which is the motivation for this
    change.

    1. 411 Processor May Exit Message-Triggered C1E State Without an Interrupt if Local APIC Timer Reaches Zero - https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/revision-guides/41322_10h_Rev_Gd.pdf

    Fixes: 279f1461432c ("x86: apic: Use tsc deadline for oneshot when available")
    Suggested-by: Dave Hansen <dave.hansen@intel.com>
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Tested-by: Todd Brandt <todd.e.brandt@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241015061522.25288-1-rui.zhang%40intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 16d7d35f1c1e2a3a5cb14c91fe0f1922068942c9
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Sep 17 09:02:53 2024 -0700

    x86/resctrl: Annotate get_mem_config() functions as __init

    commit d5fd042bf4cfb557981d65628e1779a492cd8cfa upstream.

    After a recent LLVM change [1] that deduces __cold on functions that only call
    cold code (such as __init functions), there is a section mismatch warning from
    __get_mem_config_intel(), which got moved to .text.unlikely. as a result of
    that optimization:

      WARNING: modpost: vmlinux: section mismatch in reference: \
      __get_mem_config_intel+0x77 (section: .text.unlikely.) -> thread_throttle_mode_init (section: .init.text)

    Mark __get_mem_config_intel() as __init as well since it is only called
    from __init code, which clears up the warning.

    While __rdt_get_mem_config_amd() does not exhibit a warning because it
    does not call any __init code, it is a similar function that is only
    called from __init code like __get_mem_config_intel(), so mark it __init
    as well to keep the code symmetrical.

    CONFIG_SECTION_MISMATCH_WARN_ONLY=n would turn this into a fatal error.

    Fixes: 05b93417ce5b ("x86/intel_rdt/mba: Add primary support for Memory Bandwidth Allocation (MBA)")
    Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature")
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Cc: <stable@kernel.org>
    Link: https://github.com/llvm/llvm-project/commit/6b11573b8c5e3d36beee099dbe7347c2a007bf53 [1]
    Link: https://lore.kernel.org/r/20240917-x86-restctrl-get_mem_config_intel-init-v3-1-10d521256284@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 66029078fee00646e2e9dbb8f41ff7819f8e7569
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Sep 20 12:32:19 2024 +0200

    parport: Proper fix for array out-of-bounds access

    commit 02ac3a9ef3a18b58d8f3ea2b6e46de657bf6c4f9 upstream.

    The recent fix for array out-of-bounds accesses replaced sprintf()
    calls blindly with snprintf().  However, since snprintf() returns the
    would-be-printed size, not the actually output size, the length
    calculation can still go over the given limit.

    Use scnprintf() instead of snprintf(), which returns the actually
    output letters, for addressing the potential out-of-bounds access
    properly.

    Fixes: ab11dac93d2d ("dev/parport: fix the array out-of-bounds risk")
    Cc: stable@vger.kernel.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://lore.kernel.org/r/20240920103318.19271-1-tiwai@suse.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c895d48c843dee8baf5327dee33ce786760c9d44
Author: Marek Vasut <marex@denx.de>
Date:   Wed Oct 2 20:40:38 2024 +0200

    serial: imx: Update mctrl old_status on RTSD interrupt

    commit 40d7903386df4d18f04d90510ba90eedee260085 upstream.

    When sending data using DMA at high baudrate (4 Mbdps in local test case) to
    a device with small RX buffer which keeps asserting RTS after every received
    byte, it is possible that the iMX UART driver would not recognize the falling
    edge of RTS input signal and get stuck, unable to transmit any more data.

    This condition happens when the following sequence of events occur:
    - imx_uart_mctrl_check() is called at some point and takes a snapshot of UART
      control signal status into sport->old_status using imx_uart_get_hwmctrl().
      The RTSS/TIOCM_CTS bit is of interest here (*).
    - DMA transfer occurs, the remote device asserts RTS signal after each byte.
      The i.MX UART driver recognizes each such RTS signal change, raises an
      interrupt with USR1 register RTSD bit set, which leads to invocation of
      __imx_uart_rtsint(), which calls uart_handle_cts_change().
      - If the RTS signal is deasserted, uart_handle_cts_change() clears
        port->hw_stopped and unblocks the port for further data transfers.
      - If the RTS is asserted, uart_handle_cts_change() sets port->hw_stopped
        and blocks the port for further data transfers. This may occur as the
        last interrupt of a transfer, which means port->hw_stopped remains set
        and the port remains blocked (**).
    - Any further data transfer attempts will trigger imx_uart_mctrl_check(),
      which will read current status of UART control signals by calling
      imx_uart_get_hwmctrl() (***) and compare it with sport->old_status .
      - If current status differs from sport->old_status for RTS signal,
        uart_handle_cts_change() is called and possibly unblocks the port
        by clearing port->hw_stopped .
      - If current status does not differ from sport->old_status for RTS
        signal, no action occurs. This may occur in case prior snapshot (*)
        was taken before any transfer so the RTS is deasserted, current
        snapshot (***) was taken after a transfer and therefore RTS is
        deasserted again, which means current status and sport->old_status
        are identical. In case (**) triggered when RTS got asserted, and
        made port->hw_stopped set, the port->hw_stopped will remain set
        because no change on RTS line is recognized by this driver and
        uart_handle_cts_change() is not called from here to unblock the
        port->hw_stopped.

    Update sport->old_status in __imx_uart_rtsint() accordingly to make
    imx_uart_mctrl_check() detect such RTS change. Note that TIOCM_CAR
    and TIOCM_RI bits in sport->old_status do not suffer from this problem.

    Fixes: ceca629e0b48 ("[ARM] 2971/1: i.MX uart handle rts irq")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Esben Haabendal <esben@geanix.com>
    Signed-off-by: Marek Vasut <marex@denx.de>
    Link: https://lore.kernel.org/r/20241002184133.19427-1-marex@denx.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 245bee12a52d55312aa3948ddae6887788566893
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:22 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for OTP device

    commit 2471787c1f0dae6721f60ab44be37460635d3732 upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 0969001569e4 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-2-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 78df42183e824d368e5d45169c6b7c506d81f690
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:20 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for EEPROM device

    commit 3c2d73de49be528276474c1a53f78b38ee11c1fa upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 9ab5465349c0 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX EEPROM via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-1-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3d3501cf896cd6b75f9b018d59247322ac5a4eb
Author: Prashanth K <quic_prashk@quicinc.com>
Date:   Tue Sep 24 15:02:08 2024 +0530

    usb: dwc3: Wait for EndXfer completion before restoring GUSB2PHYCFG

    commit c96e31252110a84dcc44412e8a7b456b33c3e298 upstream.

    DWC3 programming guide mentions that when operating in USB2.0 speeds,
    if GUSB2PHYCFG[6] or GUSB2PHYCFG[8] is set, it must be cleared prior
    to issuing commands and may be set again  after the command completes.
    But currently while issuing EndXfer command without CmdIOC set, we
    wait for 1ms after GUSB2PHYCFG is restored. This results in cases
    where EndXfer command doesn't get completed and causes SMMU faults
    since requests are unmapped afterwards. Hence restore GUSB2PHYCFG
    after waiting for EndXfer command completion.

    Cc: stable@vger.kernel.org
    Fixes: 1d26ba0944d3 ("usb: dwc3: Wait unconditionally after issuing EndXfer command")
    Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20240924093208.2524531-1-quic_prashk@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 479830f6c15b1a3e3c1488762a8a3bcf93e2b94f
Author: Jonathan Marek <jonathan@marek.ca>
Date:   Sat Oct 5 10:41:46 2024 -0400

    usb: typec: qcom-pmic-typec: fix sink status being overwritten with RP_DEF

    commit ffe85c24d7ca5de7d57690c0ab194b3838674935 upstream.

    This line is overwriting the result of the above switch-case.

    This fixes the tcpm driver getting stuck in a "Sink TX No Go" loop.

    Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jonathan Marek <jonathan@marek.ca>
    Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20241005144146.2345-1-jonathan@marek.ca
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 86c68aa714d0e5082ccee8f0679cb69821cf8339
Author: Daniele Palmas <dnlplm@gmail.com>
Date:   Thu Oct 3 11:38:08 2024 +0200

    USB: serial: option: add Telit FN920C04 MBIM compositions

    commit 6d951576ee16430822a8dee1e5c54d160e1de87d upstream.

    Add the following Telit FN920C04 compositions:

    0x10a2: MBIM + tty (AT/NMEA) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 17 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a2 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10a7: MBIM + tty (AT) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 18 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a7 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10aa: MBIM + tty (AT) + tty (diag) + DPL (data packet logging) + adb
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 15 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10aa Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90a5c64279ae5b906604cfb3809a25fb2d91d674
Author: Benjamin B. Frost <benjamin@geanix.com>
Date:   Wed Sep 11 10:54:05 2024 +0200

    USB: serial: option: add support for Quectel EG916Q-GL

    commit 540eff5d7faf0c9330ec762da49df453263f7676 upstream.

    Add Quectel EM916Q-GL with product ID 0x6007

    T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=6007 Rev= 2.00
    S:  Manufacturer=Quectel
    S:  Product=EG916Q-GL
    C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=200mA
    A:  FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=84(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=86(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=88(I) Atr=03(Int.) MxPS=  32 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    I:* If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    MI_00 Quectel USB Diag Port
    MI_01 Quectel USB NMEA Port
    MI_02 Quectel USB AT Port
    MI_03 Quectel USB Modem Port
    MI_04 Quectel USB Net Port

    Signed-off-by: Benjamin B. Frost <benjamin@geanix.com>
    Reviewed-by: Lars Melin <larsm17@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 53cd1bb1f8ebf961a7be197734465893a8930a58
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:58 2024 +0300

    xhci: Mitigate failed set dequeue pointer commands

    commit fe49df60cdb7c2975aa743dc295f8786e4b7db10 upstream.

    Avoid xHC host from processing a cancelled URB by always turning
    cancelled URB TDs into no-op TRBs before queuing a 'Set TR Deq' command.

    If the command fails then xHC will start processing the cancelled TD
    instead of skipping it once endpoint is restarted, causing issues like
    Babble error.

    This is not a complete solution as a failed 'Set TR Deq' command does not
    guarantee xHC TRB caches are cleared.

    Fixes: 4db356924a50 ("xhci: turn cancelled td cleanup to its own function")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-3-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc7b7050996ac46a7236864a3c86adfd69829a14
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:57 2024 +0300

    xhci: Fix incorrect stream context type macro

    commit 6599b6a6fa8060145046d0744456b6abdb3122a7 upstream.

    The stream contex type (SCT) bitfield is used both in the stream context
    data structure,  and in the 'Set TR Dequeue pointer' command TRB.
    In both cases it uses bits 3:1

    The SCT_FOR_TRB(p) macro used to set the stream context type (SCT) field
    for the 'Set TR Dequeue pointer' command TRB incorrectly shifts the value
    1 bit left before masking the three bits.

    Fix this by first masking and rshifting, just like the similar
    SCT_FOR_CTX(p) macro does

    This issue has not been visibile as the lost bit 3 is only used with
    secondary stream arrays (SSA). Xhci driver currently only supports using
    a primary stream array with Linear stream addressing.

    Fixes: 95241dbdf828 ("xhci: Set SCT field for Set TR dequeue on streams")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9c696bf4ab54c7cec81221887564305f0ceeac0a
Author: Henry Lin <henryl@nvidia.com>
Date:   Mon Oct 14 12:21:34 2024 +0800

    xhci: tegra: fix checked USB2 port number

    commit 7d381137cb6ecf558ef6698c7730ddd482d4c8f2 upstream.

    If USB virtualizatoin is enabled, USB2 ports are shared between all
    Virtual Functions. The USB2 port number owned by an USB2 root hub in
    a Virtual Function may be less than total USB2 phy number supported
    by the Tegra XUSB controller.

    Using total USB2 phy number as port number to check all PORTSC values
    would cause invalid memory access.

    [  116.923438] Unable to handle kernel paging request at virtual address 006c622f7665642f
    ...
    [  117.213640] Call trace:
    [  117.216783]  tegra_xusb_enter_elpg+0x23c/0x658
    [  117.222021]  tegra_xusb_runtime_suspend+0x40/0x68
    [  117.227260]  pm_generic_runtime_suspend+0x30/0x50
    [  117.232847]  __rpm_callback+0x84/0x3c0
    [  117.237038]  rpm_suspend+0x2dc/0x740
    [  117.241229] pm_runtime_work+0xa0/0xb8
    [  117.245769]  process_scheduled_works+0x24c/0x478
    [  117.251007]  worker_thread+0x23c/0x328
    [  117.255547]  kthread+0x104/0x1b0
    [  117.259389]  ret_from_fork+0x10/0x20
    [  117.263582] Code: 54000222 f9461ae8 f8747908 b4ffff48 (f9400100)

    Cc: stable@vger.kernel.org # v6.3+
    Fixes: a30951d31b25 ("xhci: tegra: USB2 pad power controls")
    Signed-off-by: Henry Lin <henryl@nvidia.com>
    Link: https://lore.kernel.org/r/20241014042134.27664-1-henryl@nvidia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc2d5f02636c7587bdd6d1f60fc59c55860b00a4
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Fri Oct 11 02:46:19 2024 +0900

    vt: prevent kernel-infoleak in con_font_get()

    commit f956052e00de211b5c9ebaa1958366c23f82ee9e upstream.

    font.data may not initialize all memory spaces depending on the implementation
    of vc->vc_sw->con_font_get. This may cause info-leak, so to prevent this, it
    is safest to modify it to initialize the allocated memory space to 0, and it
    generally does not affect the overall performance of the system.

    Cc: stable@vger.kernel.org
    Reported-by: syzbot+955da2d57931604ee691@syzkaller.appspotmail.com
    Fixes: 05e2600cb0a4 ("VT: Bump font size limitation to 64x128 pixels")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Link: https://lore.kernel.org/r/20241010174619.59662-1-aha310510@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 885f8c873fedf3393c76827c4821071bf5fd16b1
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Oct 16 11:47:00 2024 -0400

    Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001

    commit 2c1dda2acc4192d826e84008d963b528e24d12bc upstream.

    Fake CSR controllers don't seem to handle short-transfer properly which
    cause command to time out:

    kernel: usb 1-1: new full-speed USB device number 19 using xhci_hcd
    kernel: usb 1-1: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
    kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    kernel: usb 1-1: Product: BT DONGLE10
    ...
    Bluetooth: hci1: Opcode 0x1004 failed: -110
    kernel: Bluetooth: hci1: command 0x1004 tx timeout

    According to USB Spec 2.0 Section 5.7.3 Interrupt Transfer Packet Size
    Constraints a interrupt transfer is considered complete when the size is 0
    (ZPL) or < wMaxPacketSize:

     'When an interrupt transfer involves more data than can fit in one
     data payload of the currently established maximum size, all data
     payloads are required to be maximum-sized except for the last data
     payload, which will contain the remaining data. An interrupt transfer
     is complete when the endpoint does one of the following:

     • Has transferred exactly the amount of data expected
     • Transfers a packet with a payload size less than wMaxPacketSize or
     transfers a zero-length packet'

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=219365
    Fixes: 7b05933340f4 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8fb8e912afb4c47dec12ea9a5853e7a8db95816f
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:08 2024 +0000

    Bluetooth: ISO: Fix multiple init when debugfs is disabled

    commit a9b7b535ba192c6b77e6c15a4c82d853163eab8c upstream.

    If bt_debugfs is not created successfully, which happens if either
    CONFIG_DEBUG_FS or CONFIG_DEBUG_FS_ALLOW_ALL is unset, then iso_init()
    returns early and does not set iso_inited to true. This means that a
    subsequent call to iso_init() will result in duplicate calls to
    proto_register(), bt_sock_register(), etc.

    With CONFIG_LIST_HARDENED and CONFIG_BUG_ON_DATA_CORRUPTION enabled, the
    duplicate call to proto_register() triggers this BUG():

      list_add double add: new=ffffffffc0b280d0, prev=ffffffffbab56250,
        next=ffffffffc0b280d0.
      ------------[ cut here ]------------
      kernel BUG at lib/list_debug.c:35!
      Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI
      CPU: 2 PID: 887 Comm: bluetoothd Not tainted 6.10.11-1-ao-desktop #1
      RIP: 0010:__list_add_valid_or_report+0x9a/0xa0
      ...
        __list_add_valid_or_report+0x9a/0xa0
        proto_register+0x2b5/0x340
        iso_init+0x23/0x150 [bluetooth]
        set_iso_socket_func+0x68/0x1b0 [bluetooth]
        kmem_cache_free+0x308/0x330
        hci_sock_sendmsg+0x990/0x9e0 [bluetooth]
        __sock_sendmsg+0x7b/0x80
        sock_write_iter+0x9a/0x110
        do_iter_readv_writev+0x11d/0x220
        vfs_writev+0x180/0x3e0
        do_writev+0xca/0x100
      ...

    This change removes the early return. The check for iso_debugfs being
    NULL was unnecessary, it is always NULL when iso_inited is false.

    Cc: stable@vger.kernel.org
    Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
    Signed-off-by: Aaron Thompson <dev@aaront.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 59bd80df4b88e28e37524105b3ec1853bae32713
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:10 2024 +0000

    Bluetooth: Remove debugfs directory on module init failure

    commit 1db4564f101b47188c1b71696bd342ef09172b22 upstream.

    If bt_init() fails, the debugfs directory currently is not removed. If
    the module is loaded again after that, the debugfs directory is not set
    up properly due to the existing directory.

      # modprobe bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:26 ./
      drwx------ 31 root root 0 Sep 27 14:25 ../
      -r--r--r--  1 root root 0 Sep 27 14:26 l2cap
      -r--r--r--  1 root root 0 Sep 27 14:26 sco
      # modprobe -r bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      ls: cannot access '/sys/kernel/debug/bluetooth': No such file or directory
      #

      # modprobe bluetooth
      modprobe: ERROR: could not insert 'bluetooth': Invalid argument
      # dmesg | tail -n 6
      Bluetooth: Core ver 2.22
      NET: Registered PF_BLUETOOTH protocol family
      Bluetooth: HCI device and connection manager initialized
      Bluetooth: HCI socket layer initialized
      Bluetooth: Faking l2cap_init() failure for testing
      NET: Unregistered PF_BLUETOOTH protocol family
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:31 ./
      drwx------ 31 root roo…
qaz6750 pushed a commit that referenced this pull request Nov 1, 2024
commit 3d04139 upstream.

Syzkaller reported a lockdep splat:

  ============================================
  WARNING: possible recursive locking detected
  6.11.0-rc6-syzkaller-00019-g67784a74e258 #0 Not tainted
  --------------------------------------------
  syz-executor364/5113 is trying to acquire lock:
  ffff8880449f1958 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
  ffff8880449f1958 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328

  but task is already holding lock:
  ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
  ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328

  other info that might help us debug this:
   Possible unsafe locking scenario:

         CPU0
         ----
    lock(k-slock-AF_INET);
    lock(k-slock-AF_INET);

   *** DEADLOCK ***

   May be due to missing lock nesting notation

  7 locks held by syz-executor364/5113:
   #0: ffff8880449f0e18 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1607 [inline]
   #0: ffff8880449f0e18 (sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_sendmsg+0x153/0x1b10 net/mptcp/protocol.c:1806
   #1: ffff88803fe39ad8 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1607 [inline]
   #1: ffff88803fe39ad8 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_sendmsg_fastopen+0x11f/0x530 net/mptcp/protocol.c:1727
   #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
   #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
   #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: __ip_queue_xmit+0x5f/0x1b80 net/ipv4/ip_output.c:470
   #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
   #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
   #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ip_finish_output2+0x45f/0x1390 net/ipv4/ip_output.c:228
   #4: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: local_lock_acquire include/linux/local_lock_internal.h:29 [inline]
   #4: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: process_backlog+0x33b/0x15b0 net/core/dev.c:6104
   #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
   #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
   #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ip_local_deliver_finish+0x230/0x5f0 net/ipv4/ip_input.c:232
   #6: ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
   #6: ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328

  stack backtrace:
  CPU: 0 UID: 0 PID: 5113 Comm: syz-executor364 Not tainted 6.11.0-rc6-syzkaller-00019-g67784a74e258 #0
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
  Call Trace:
   <IRQ>
   __dump_stack lib/dump_stack.c:93 [inline]
   dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
   check_deadlock kernel/locking/lockdep.c:3061 [inline]
   validate_chain+0x15d3/0x5900 kernel/locking/lockdep.c:3855
   __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
   __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
   _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
   spin_lock include/linux/spinlock.h:351 [inline]
   sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328
   mptcp_sk_clone_init+0x32/0x13c0 net/mptcp/protocol.c:3279
   subflow_syn_recv_sock+0x931/0x1920 net/mptcp/subflow.c:874
   tcp_check_req+0xfe4/0x1a20 net/ipv4/tcp_minisocks.c:853
   tcp_v4_rcv+0x1c3e/0x37f0 net/ipv4/tcp_ipv4.c:2267
   ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205
   ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233
   NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
   NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
   __netif_receive_skb_one_core net/core/dev.c:5661 [inline]
   __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775
   process_backlog+0x662/0x15b0 net/core/dev.c:6108
   __napi_poll+0xcb/0x490 net/core/dev.c:6772
   napi_poll net/core/dev.c:6841 [inline]
   net_rx_action+0x89b/0x1240 net/core/dev.c:6963
   handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
   do_softirq+0x11b/0x1e0 kernel/softirq.c:455
   </IRQ>
   <TASK>
   __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
   local_bh_enable include/linux/bottom_half.h:33 [inline]
   rcu_read_unlock_bh include/linux/rcupdate.h:908 [inline]
   __dev_queue_xmit+0x1763/0x3e90 net/core/dev.c:4450
   dev_queue_xmit include/linux/netdevice.h:3105 [inline]
   neigh_hh_output include/net/neighbour.h:526 [inline]
   neigh_output include/net/neighbour.h:540 [inline]
   ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:235
   ip_local_out net/ipv4/ip_output.c:129 [inline]
   __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:535
   __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466
   tcp_rcv_synsent_state_process net/ipv4/tcp_input.c:6542 [inline]
   tcp_rcv_state_process+0x2c32/0x4570 net/ipv4/tcp_input.c:6729
   tcp_v4_do_rcv+0x77d/0xc70 net/ipv4/tcp_ipv4.c:1934
   sk_backlog_rcv include/net/sock.h:1111 [inline]
   __release_sock+0x214/0x350 net/core/sock.c:3004
   release_sock+0x61/0x1f0 net/core/sock.c:3558
   mptcp_sendmsg_fastopen+0x1ad/0x530 net/mptcp/protocol.c:1733
   mptcp_sendmsg+0x1884/0x1b10 net/mptcp/protocol.c:1812
   sock_sendmsg_nosec net/socket.c:730 [inline]
   __sock_sendmsg+0x1a6/0x270 net/socket.c:745
   ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
   ___sys_sendmsg net/socket.c:2651 [inline]
   __sys_sendmmsg+0x3b2/0x740 net/socket.c:2737
   __do_sys_sendmmsg net/socket.c:2766 [inline]
   __se_sys_sendmmsg net/socket.c:2763 [inline]
   __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2763
   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
   entry_SYSCALL_64_after_hwframe+0x77/0x7f
  RIP: 0033:0x7f04fb13a6b9
  Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
  RSP: 002b:00007ffd651f42d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
  RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f04fb13a6b9
  RDX: 0000000000000001 RSI: 0000000020000d00 RDI: 0000000000000004
  RBP: 00007ffd651f4310 R08: 0000000000000001 R09: 0000000000000001
  R10: 0000000020000080 R11: 0000000000000246 R12: 00000000000f4240
  R13: 00007f04fb187449 R14: 00007ffd651f42f4 R15: 00007ffd651f4300
   </TASK>

As noted by Cong Wang, the splat is false positive, but the code
path leading to the report is an unexpected one: a client is
attempting an MPC handshake towards the in-kernel listener created
by the in-kernel PM for a port based signal endpoint.

Such connection will be never accepted; many of them can make the
listener queue full and preventing the creation of MPJ subflow via
such listener - its intended role.

Explicitly detect this scenario at initial-syn time and drop the
incoming MPC request.

Fixes: 1729cf1 ("mptcp: create the listening socket for new port")
Cc: stable@vger.kernel.org
Reported-by: syzbot+f4aacdfef2c6a6529c3e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f4aacdfef2c6a6529c3e
Cc: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20241014-net-mptcp-mpc-port-endp-v2-1-7faea8e6b6ae@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Conflicts in mib.[ch], because commit 6982826 ("mptcp: fallback
  to TCP after SYN+MPC drops"), and commit 27069e7 ("mptcp: disable
  active MPTCP in case of blackhole") are linked to new features, not
  available in this version. Resolving the conflicts is easy, simply
  adding the new lines declaring the new "endpoint attempt" MIB entry.
  Also a conflict in protocol.h, because commit fce68b0 ("mptcp:
  add scheduled in mptcp_subflow_context") is not in this version, and
  changes the context by introducing 'scheduled' variable just before.
  Also a conflict in pm_netlink.c, because commit 3aa3624 ("mptcp:
  avoid ssock usage in mptcp_pm_nl_create_listen_socket()") is not in
  this version, and refactor the function: that's fine, we can still set
  pm_listener before doing the 'listen()', taking 'ssock->sk' as 'ssk'
  is not defined before this refactoring. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
qaz6750 pushed a commit that referenced this pull request Nov 1, 2024
commit 3d04139 upstream.

Syzkaller reported a lockdep splat:

  ============================================
  WARNING: possible recursive locking detected
  6.11.0-rc6-syzkaller-00019-g67784a74e258 #0 Not tainted
  --------------------------------------------
  syz-executor364/5113 is trying to acquire lock:
  ffff8880449f1958 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
  ffff8880449f1958 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328

  but task is already holding lock:
  ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
  ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328

  other info that might help us debug this:
   Possible unsafe locking scenario:

         CPU0
         ----
    lock(k-slock-AF_INET);
    lock(k-slock-AF_INET);

   *** DEADLOCK ***

   May be due to missing lock nesting notation

  7 locks held by syz-executor364/5113:
   #0: ffff8880449f0e18 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1607 [inline]
   #0: ffff8880449f0e18 (sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_sendmsg+0x153/0x1b10 net/mptcp/protocol.c:1806
   #1: ffff88803fe39ad8 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1607 [inline]
   #1: ffff88803fe39ad8 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_sendmsg_fastopen+0x11f/0x530 net/mptcp/protocol.c:1727
   #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
   #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
   #2: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: __ip_queue_xmit+0x5f/0x1b80 net/ipv4/ip_output.c:470
   #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
   #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
   #3: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ip_finish_output2+0x45f/0x1390 net/ipv4/ip_output.c:228
   #4: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: local_lock_acquire include/linux/local_lock_internal.h:29 [inline]
   #4: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: process_backlog+0x33b/0x15b0 net/core/dev.c:6104
   #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
   #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
   #5: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ip_local_deliver_finish+0x230/0x5f0 net/ipv4/ip_input.c:232
   #6: ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
   #6: ffff88803fe3cb58 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328

  stack backtrace:
  CPU: 0 UID: 0 PID: 5113 Comm: syz-executor364 Not tainted 6.11.0-rc6-syzkaller-00019-g67784a74e258 #0
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
  Call Trace:
   <IRQ>
   __dump_stack lib/dump_stack.c:93 [inline]
   dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
   check_deadlock kernel/locking/lockdep.c:3061 [inline]
   validate_chain+0x15d3/0x5900 kernel/locking/lockdep.c:3855
   __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
   __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
   _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
   spin_lock include/linux/spinlock.h:351 [inline]
   sk_clone_lock+0x2cd/0xf40 net/core/sock.c:2328
   mptcp_sk_clone_init+0x32/0x13c0 net/mptcp/protocol.c:3279
   subflow_syn_recv_sock+0x931/0x1920 net/mptcp/subflow.c:874
   tcp_check_req+0xfe4/0x1a20 net/ipv4/tcp_minisocks.c:853
   tcp_v4_rcv+0x1c3e/0x37f0 net/ipv4/tcp_ipv4.c:2267
   ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205
   ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233
   NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
   NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
   __netif_receive_skb_one_core net/core/dev.c:5661 [inline]
   __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775
   process_backlog+0x662/0x15b0 net/core/dev.c:6108
   __napi_poll+0xcb/0x490 net/core/dev.c:6772
   napi_poll net/core/dev.c:6841 [inline]
   net_rx_action+0x89b/0x1240 net/core/dev.c:6963
   handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
   do_softirq+0x11b/0x1e0 kernel/softirq.c:455
   </IRQ>
   <TASK>
   __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
   local_bh_enable include/linux/bottom_half.h:33 [inline]
   rcu_read_unlock_bh include/linux/rcupdate.h:908 [inline]
   __dev_queue_xmit+0x1763/0x3e90 net/core/dev.c:4450
   dev_queue_xmit include/linux/netdevice.h:3105 [inline]
   neigh_hh_output include/net/neighbour.h:526 [inline]
   neigh_output include/net/neighbour.h:540 [inline]
   ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:235
   ip_local_out net/ipv4/ip_output.c:129 [inline]
   __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:535
   __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466
   tcp_rcv_synsent_state_process net/ipv4/tcp_input.c:6542 [inline]
   tcp_rcv_state_process+0x2c32/0x4570 net/ipv4/tcp_input.c:6729
   tcp_v4_do_rcv+0x77d/0xc70 net/ipv4/tcp_ipv4.c:1934
   sk_backlog_rcv include/net/sock.h:1111 [inline]
   __release_sock+0x214/0x350 net/core/sock.c:3004
   release_sock+0x61/0x1f0 net/core/sock.c:3558
   mptcp_sendmsg_fastopen+0x1ad/0x530 net/mptcp/protocol.c:1733
   mptcp_sendmsg+0x1884/0x1b10 net/mptcp/protocol.c:1812
   sock_sendmsg_nosec net/socket.c:730 [inline]
   __sock_sendmsg+0x1a6/0x270 net/socket.c:745
   ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
   ___sys_sendmsg net/socket.c:2651 [inline]
   __sys_sendmmsg+0x3b2/0x740 net/socket.c:2737
   __do_sys_sendmmsg net/socket.c:2766 [inline]
   __se_sys_sendmmsg net/socket.c:2763 [inline]
   __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2763
   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
   entry_SYSCALL_64_after_hwframe+0x77/0x7f
  RIP: 0033:0x7f04fb13a6b9
  Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
  RSP: 002b:00007ffd651f42d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
  RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f04fb13a6b9
  RDX: 0000000000000001 RSI: 0000000020000d00 RDI: 0000000000000004
  RBP: 00007ffd651f4310 R08: 0000000000000001 R09: 0000000000000001
  R10: 0000000020000080 R11: 0000000000000246 R12: 00000000000f4240
  R13: 00007f04fb187449 R14: 00007ffd651f42f4 R15: 00007ffd651f4300
   </TASK>

As noted by Cong Wang, the splat is false positive, but the code
path leading to the report is an unexpected one: a client is
attempting an MPC handshake towards the in-kernel listener created
by the in-kernel PM for a port based signal endpoint.

Such connection will be never accepted; many of them can make the
listener queue full and preventing the creation of MPJ subflow via
such listener - its intended role.

Explicitly detect this scenario at initial-syn time and drop the
incoming MPC request.

Fixes: 1729cf1 ("mptcp: create the listening socket for new port")
Cc: stable@vger.kernel.org
Reported-by: syzbot+f4aacdfef2c6a6529c3e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f4aacdfef2c6a6529c3e
Cc: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20241014-net-mptcp-mpc-port-endp-v2-1-7faea8e6b6ae@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Conflicts in mib.[ch], because commit 6982826 ("mptcp: fallback
  to TCP after SYN+MPC drops"), and commit 27069e7 ("mptcp: disable
  active MPTCP in case of blackhole") are linked to new features, not
  available in this version. Resolving the conflicts is easy, simply
  adding the new lines declaring the new "endpoint attempt" MIB entry.
  Also a conflict in protocol.h, because commit fce68b0 ("mptcp:
  add scheduled in mptcp_subflow_context") is not in this version, and
  changes the context by introducing 'scheduled' variable just before.
  Also a conflict in pm_netlink.c, because commit 3aa3624 ("mptcp:
  avoid ssock usage in mptcp_pm_nl_create_listen_socket()") is not in
  this version, and refactor the function: that's fine, we can still set
  pm_listener before doing the 'listen()', taking 'ssock->sk' as 'ssk'
  is not defined before this refactoring. There is also a conflict
  because the context has been changed later in commit 69925a3
  ("mptcp: ensure listener is unhashed before updating the sk status"). ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
qaz6750 added a commit that referenced this pull request Nov 16, 2024
commit 9b5aad3a7498c261116a0251fe57f14ba9c4c6cf
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Nov 8 16:28:28 2024 +0100

    Linux 6.6.60

    Link: https://lore.kernel.org/r/20241106120308.841299741@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Hardik Garg <hargar@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc082e50375a29596153fc3f1f8fc85ad1b0b5b9
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date:   Thu Sep 5 15:03:48 2024 +0300

    fs/ntfs3: Sequential field availability check in mi_enum_attr()

    commit 090f612756a9720ec18b0b130e28be49839d7cb5 upstream.

    The code is slightly reformatted to consistently check field availability
    without duplication.

    Fixes: 556bdf27c2dd ("ntfs3: Add bounds checking to mi_enum_attr()")
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10c20d79d59cadfe572480d98cec271a89ffb024
Author: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Date:   Mon May 27 20:15:21 2024 +0530

    drm/amd/display: Add null checks for 'stream' and 'plane' before dereferencing

    commit 15c2990e0f0108b9c3752d7072a97d45d4283aea upstream.

    This commit adds null checks for the 'stream' and 'plane' variables in
    the dcn30_apply_idle_power_optimizations function. These variables were
    previously assumed to be null at line 922, but they were used later in
    the code without checking if they were null. This could potentially lead
    to a null pointer dereference, which would cause a crash.

    The null checks ensure that 'stream' and 'plane' are not null before
    they are used, preventing potential crashes.

    Fixes the below static smatch checker:
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:938 dcn30_apply_idle_power_optimizations() error: we previously assumed 'stream' could be null (see line 922)
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:940 dcn30_apply_idle_power_optimizations() error: we previously assumed 'plane' could be null (see line 922)

    Cc: Tom Chung <chiahsuan.chung@amd.com>
    Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
    Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Cc: Roman Li <roman.li@amd.com>
    Cc: Hersen Wu <hersenxs.wu@amd.com>
    Cc: Alex Hung <alex.hung@amd.com>
    Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Cc: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    [Xiangyu: Modified file path to backport this commit]
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e979a6a626abf1358a5bb79219eea82ac160d3d3
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:15 2023 +0300

    ASoC: SOF: ipc4-control: Add support for ALSA enum control

    commit 07a866a41982c896dc46476f57d209a200602946 upstream.

    Enum controls use generic param_id and a generic struct where the data
    is passed to the firmware.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-4-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3facc0417d3d7b3ba5822e74155bcb1267ce62c1
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:14 2023 +0300

    ASoC: SOF: ipc4-control: Add support for ALSA switch control

    commit 4a2fd607b7ca6128ee3532161505da7624197f55 upstream.

    Volume controls with a max value of 1 are switches.
    Switch controls use generic param_id and a generic struct where the data
    is passed to the firmware.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-3-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f01d8fc623711046e1efee00827bff6d5882cdfd
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:13 2023 +0300

    ASoC: SOF: ipc4-topology: Add definition for generic switch/enum control

    commit 060a07cd9bc69eba2da33ed96b1fa69ead60bab1 upstream.

    Currently IPC4 has no notion of a switch or enum type of control which is
    a generic concept in ALSA.

    The generic support for these control types will be as follows:
    - large config is used to send the channel-value par array
    - param_id of a SWITCH type is 200
    - param_id of an ENUM type is 201

    Each module need to support a switch or/and enum must handle these
    universal param_ids.
    The message payload is described by struct sof_ipc4_control_msg_payload.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-2-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d54afaef6570c277070c3cafe1ed73dcdc129e0a
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Tue Sep 19 11:35:15 2023 -0400

    SUNRPC: Remove BUG_ON call sites

    commit 789ce196a31dd13276076762204bee87df893e53 upstream.

    There is no need to take down the whole system for these assertions.

    I'd rather not attempt a heroic save here, as some bug has occurred
    that has left the transport data structures in an unknown state.
    Just warn and then leak the left-over resources.

    Acked-by: Christian Brauner <brauner@kernel.org>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27a58a19bd20a7afe369da2ce6d4ebea70768acd
Author: Michael Walle <mwalle@kernel.org>
Date:   Fri Jun 21 14:09:29 2024 +0200

    mtd: spi-nor: winbond: fix w25q128 regression

    commit d35df77707bf5ae1221b5ba1c8a88cf4fcdd4901 upstream.

    Commit 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128")
    removed the flags for non-SFDP devices. It was assumed that it wasn't in
    use anymore. This wasn't true. Add the no_sfdp_flags as well as the size
    again.

    We add the additional flags for dual and quad read because they have
    been reported to work properly by Hartmut using both older and newer
    versions of this flash, the similar flashes with 64Mbit and 256Mbit
    already have these flags and because it will (luckily) trigger our
    legacy SFDP parsing, so newer versions with SFDP support will still get
    the parameters from the SFDP tables.

    Reported-by: Hartmut Birr <e9hack@gmail.com>
    Closes: https://lore.kernel.org/r/CALxbwRo_-9CaJmt7r7ELgu+vOcgk=xZcGHobnKf=oT2=u4d4aA@mail.gmail.com/
    Fixes: 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128")
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Michael Walle <mwalle@kernel.org>
    Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Reviewed-by: Esben Haabendal <esben@geanix.com>
    Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
    Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
    Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org
    Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org
    [Backported to v6.6 - vastly different due to upstream changes]
    Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3d544942c0010feedc048b048ee0c35d2d921100
Author: David Hildenbrand <david@redhat.com>
Date:   Fri Oct 11 12:24:45 2024 +0200

    mm: don't install PMD mappings when THPs are disabled by the hw/process/vma

    commit 2b0f922323ccfa76219bcaacd35cd50aeaa13592 upstream.

    We (or rather, readahead logic :) ) might be allocating a THP in the
    pagecache and then try mapping it into a process that explicitly disabled
    THP: we might end up installing PMD mappings.

    This is a problem for s390x KVM, which explicitly remaps all PMD-mapped
    THPs to be PTE-mapped in s390_enable_sie()->thp_split_mm(), before
    starting the VM.

    For example, starting a VM backed on a file system with large folios
    supported makes the VM crash when the VM tries accessing such a mapping
    using KVM.

    Is it also a problem when the HW disabled THP using
    TRANSPARENT_HUGEPAGE_UNSUPPORTED?  At least on x86 this would be the case
    without X86_FEATURE_PSE.

    In the future, we might be able to do better on s390x and only disallow
    PMD mappings -- what s390x and likely TRANSPARENT_HUGEPAGE_UNSUPPORTED
    really wants.  For now, fix it by essentially performing the same check as
    would be done in __thp_vma_allowable_orders() or in shmem code, where this
    works as expected, and disallow PMD mappings, making us fallback to PTE
    mappings.

    Link: https://lkml.kernel.org/r/20241011102445.934409-3-david@redhat.com
    Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reported-by: Leo Fu <bfu@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Cc: Thomas Huth <thuth@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Janosch Frank <frankja@linux.ibm.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 02ec4b3bba49e8d3abb25a3feba6875cae12da92
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
Date:   Fri Oct 11 12:24:44 2024 +0200

    mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw()

    commit 963756aac1f011d904ddd9548ae82286d3a91f96 upstream.

    Patch series "mm: don't install PMD mappings when THPs are disabled by the
    hw/process/vma".

    During testing, it was found that we can get PMD mappings in processes
    where THP (and more precisely, PMD mappings) are supposed to be disabled.
    While it works as expected for anon+shmem, the pagecache is the
    problematic bit.

    For s390 KVM this currently means that a VM backed by a file located on
    filesystem with large folio support can crash when KVM tries accessing the
    problematic page, because the readahead logic might decide to use a
    PMD-sized THP and faulting it into the page tables will install a PMD
    mapping, something that s390 KVM cannot tolerate.

    This might also be a problem with HW that does not support PMD mappings,
    but I did not try reproducing it.

    Fix it by respecting the ways to disable THPs when deciding whether we can
    install a PMD mapping.  khugepaged should already be taking care of not
    collapsing if THPs are effectively disabled for the hw/process/vma.

    This patch (of 2):

    Add vma_thp_disabled() and thp_disabled_by_hw() helpers to be shared by
    shmem_allowable_huge_orders() and __thp_vma_allowable_orders().

    [david@redhat.com: rename to vma_thp_disabled(), split out thp_disabled_by_hw() ]
    Link: https://lkml.kernel.org/r/20241011102445.934409-2-david@redhat.com
    Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reported-by: Leo Fu <bfu@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Boqiao Fu <bfu@redhat.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Janosch Frank <frankja@linux.ibm.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc621e7a043de346c33bd7ae7e2e0c651d6152ef
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Oct 23 09:17:44 2024 +0200

    wifi: iwlwifi: mvm: fix 6 GHz scan construction

    commit 7245012f0f496162dd95d888ed2ceb5a35170f1a upstream.

    If more than 255 colocated APs exist for the set of all
    APs found during 2.4/5 GHz scanning, then the 6 GHz scan
    construction will loop forever since the loop variable
    has type u8, which can never reach the number found when
    that's bigger than 255, and is stored in a u32 variable.
    Also move it into the loops to have a smaller scope.

    Using a u32 there is fine, we limit the number of APs in
    the scan list and each has a limit on the number of RNR
    entries due to the frame size. With a limit of 1000 scan
    results, a frame size upper bound of 4096 (really it's
    more like ~2300) and a TBTT entry size of at least 11,
    we get an upper bound for the number of ~372k, well in
    the bounds of a u32.

    Cc: stable@vger.kernel.org
    Fixes: eae94cf82d74 ("iwlwifi: mvm: add support for 6GHz")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219375
    Link: https://patch.msgid.link/20241023091744.f4baed5c08a1.I8b417148bbc8c5d11c101e1b8f5bf372e17bf2a7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f2f1fa446676c21edb777e6d2bc4fa8f956fab68
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 18 04:33:10 2024 +0900

    nilfs2: fix kernel bug due to missing clearing of checked flag

    commit 41e192ad2779cae0102879612dfe46726e4396aa upstream.

    Syzbot reported that in directory operations after nilfs2 detects
    filesystem corruption and degrades to read-only,
    __block_write_begin_int(), which is called to prepare block writes, may
    fail the BUG_ON check for accesses exceeding the folio/page size,
    triggering a kernel bug.

    This was found to be because the "checked" flag of a page/folio was not
    cleared when it was discarded by nilfs2's own routine, which causes the
    sanity check of directory entries to be skipped when the directory
    page/folio is reloaded.  So, fix that.

    This was necessary when the use of nilfs2's own page discard routine was
    applied to more than just metadata files.

    Link: https://lkml.kernel.org/r/20241017193359.5051-1-konishi.ryusuke@gmail.com
    Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a53c2d847627b790fb3bd8b00e02c247941b17e0
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
Date:   Mon Jun 17 19:52:17 2024 +0800

    wifi: mac80211: fix NULL dereference at band check in starting tx ba session

    commit 021d53a3d87eeb9dbba524ac515651242a2a7e3b upstream.

    In MLD connection, link_data/link_conf are dynamically allocated. They
    don't point to vif->bss_conf. So, there will be no chanreq assigned to
    vif->bss_conf and then the chan will be NULL. Tweak the code to check
    ht_supported/vht_supported/has_he/has_eht on sta deflink.

    Crash log (with rtw89 version under MLO development):
    [ 9890.526087] BUG: kernel NULL pointer dereference, address: 0000000000000000
    [ 9890.526102] #PF: supervisor read access in kernel mode
    [ 9890.526105] #PF: error_code(0x0000) - not-present page
    [ 9890.526109] PGD 0 P4D 0
    [ 9890.526114] Oops: 0000 [#1] PREEMPT SMP PTI
    [ 9890.526119] CPU: 2 PID: 6367 Comm: kworker/u16:2 Kdump: loaded Tainted: G           OE      6.9.0 #1
    [ 9890.526123] Hardware name: LENOVO 2356AD1/2356AD1, BIOS G7ETB3WW (2.73 ) 11/28/2018
    [ 9890.526126] Workqueue: phy2 rtw89_core_ba_work [rtw89_core]
    [ 9890.526203] RIP: 0010:ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211
    [ 9890.526279] Code: f7 e8 d5 93 3e ea 48 83 c4 28 89 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 49 8b 84 24 e0 f1 ff ff 48 8b 80 90 1b 00 00 <83> 38 03 0f 84 37 fe ff ff bb ea ff ff ff eb cc 49 8b 84 24 10 f3
    All code
    ========
       0:	f7 e8                	imul   %eax
       2:	d5                   	(bad)
       3:	93                   	xchg   %eax,%ebx
       4:	3e ea                	ds (bad)
       6:	48 83 c4 28          	add    $0x28,%rsp
       a:	89 d8                	mov    %ebx,%eax
       c:	5b                   	pop    %rbx
       d:	41 5c                	pop    %r12
       f:	41 5d                	pop    %r13
      11:	41 5e                	pop    %r14
      13:	41 5f                	pop    %r15
      15:	5d                   	pop    %rbp
      16:	c3                   	retq
      17:	cc                   	int3
      18:	cc                   	int3
      19:	cc                   	int3
      1a:	cc                   	int3
      1b:	49 8b 84 24 e0 f1 ff 	mov    -0xe20(%r12),%rax
      22:	ff
      23:	48 8b 80 90 1b 00 00 	mov    0x1b90(%rax),%rax
      2a:*	83 38 03             	cmpl   $0x3,(%rax)		<-- trapping instruction
      2d:	0f 84 37 fe ff ff    	je     0xfffffffffffffe6a
      33:	bb ea ff ff ff       	mov    $0xffffffea,%ebx
      38:	eb cc                	jmp    0x6
      3a:	49                   	rex.WB
      3b:	8b                   	.byte 0x8b
      3c:	84 24 10             	test   %ah,(%rax,%rdx,1)
      3f:	f3                   	repz

    Code starting with the faulting instruction
    ===========================================
       0:	83 38 03             	cmpl   $0x3,(%rax)
       3:	0f 84 37 fe ff ff    	je     0xfffffffffffffe40
       9:	bb ea ff ff ff       	mov    $0xffffffea,%ebx
       e:	eb cc                	jmp    0xffffffffffffffdc
      10:	49                   	rex.WB
      11:	8b                   	.byte 0x8b
      12:	84 24 10             	test   %ah,(%rax,%rdx,1)
      15:	f3                   	repz
    [ 9890.526285] RSP: 0018:ffffb8db09013d68 EFLAGS: 00010246
    [ 9890.526291] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff9308e0d656c8
    [ 9890.526295] RDX: 0000000000000000 RSI: ffffffffab99460b RDI: ffffffffab9a7685
    [ 9890.526300] RBP: ffffb8db09013db8 R08: 0000000000000000 R09: 0000000000000873
    [ 9890.526304] R10: ffff9308e0d64800 R11: 0000000000000002 R12: ffff9308e5ff6e70
    [ 9890.526308] R13: ffff930952500e20 R14: ffff9309192a8c00 R15: 0000000000000000
    [ 9890.526313] FS:  0000000000000000(0000) GS:ffff930b4e700000(0000) knlGS:0000000000000000
    [ 9890.526316] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 9890.526318] CR2: 0000000000000000 CR3: 0000000391c58005 CR4: 00000000001706f0
    [ 9890.526321] Call Trace:
    [ 9890.526324]  <TASK>
    [ 9890.526327] ? show_regs (arch/x86/kernel/dumpstack.c:479)
    [ 9890.526335] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434)
    [ 9890.526340] ? page_fault_oops (arch/x86/mm/fault.c:713)
    [ 9890.526347] ? search_module_extables (kernel/module/main.c:3256 (discriminator 3))
    [ 9890.526353] ? ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211

    Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
    Link: https://patch.msgid.link/20240617115217.22344-1-kevin_yang@realtek.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a91a5816b289018e0b42a25444c0b4f8c637dca
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Apr 10 02:26:54 2024 +0100

    io_uring: always lock __io_cqring_overflow_flush

    commit 8d09a88ef9d3cb7d21d45c39b7b7c31298d23998 upstream.

    Conditional locking is never great, in case of
    __io_cqring_overflow_flush(), which is a slow path, it's not justified.
    Don't handle IOPOLL separately, always grab uring_lock for overflow
    flushing.

    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/162947df299aa12693ac4b305dacedab32ec7976.1712708261.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e3fb0e6afcc399660770428a35162b4880e2e14e
Author: Haibo Chen <haibo.chen@nxp.com>
Date:   Thu Sep 5 17:43:38 2024 +0800

    arm64: dts: imx8ulp: correct the flexspi compatible string

    commit 409dc5196d5b6eb67468a06bf4d2d07d7225a67b upstream.

    The flexspi on imx8ulp only has 16 LUTs, and imx8mm flexspi has
    32 LUTs, so correct the compatible string here, otherwise will
    meet below error:

    [    1.119072] ------------[ cut here ]------------
    [    1.123926] WARNING: CPU: 0 PID: 1 at drivers/spi/spi-nxp-fspi.c:855 nxp_fspi_exec_op+0xb04/0xb64
    [    1.133239] Modules linked in:
    [    1.136448] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc6-next-20240902-00001-g131bf9439dd9 #69
    [    1.146821] Hardware name: NXP i.MX8ULP EVK (DT)
    [    1.151647] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    1.158931] pc : nxp_fspi_exec_op+0xb04/0xb64
    [    1.163496] lr : nxp_fspi_exec_op+0xa34/0xb64
    [    1.168060] sp : ffff80008002b2a0
    [    1.171526] x29: ffff80008002b2d0 x28: 0000000000000000 x27: 0000000000000000
    [    1.179002] x26: ffff2eb645542580 x25: ffff800080610014 x24: ffff800080610000
    [    1.186480] x23: ffff2eb645548080 x22: 0000000000000006 x21: ffff2eb6455425e0
    [    1.193956] x20: 0000000000000000 x19: ffff80008002b5e0 x18: ffffffffffffffff
    [    1.201432] x17: ffff2eb644467508 x16: 0000000000000138 x15: 0000000000000002
    [    1.208907] x14: 0000000000000000 x13: ffff2eb6400d8080 x12: 00000000ffffff00
    [    1.216378] x11: 0000000000000000 x10: ffff2eb6400d8080 x9 : ffff2eb697adca80
    [    1.223850] x8 : ffff2eb697ad3cc0 x7 : 0000000100000000 x6 : 0000000000000001
    [    1.231324] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000000007a6
    [    1.238795] x2 : 0000000000000000 x1 : 00000000000001ce x0 : 00000000ffffff92
    [    1.246267] Call trace:
    [    1.248824]  nxp_fspi_exec_op+0xb04/0xb64
    [    1.253031]  spi_mem_exec_op+0x3a0/0x430
    [    1.257139]  spi_nor_read_id+0x80/0xcc
    [    1.261065]  spi_nor_scan+0x1ec/0xf10
    [    1.264901]  spi_nor_probe+0x108/0x2fc
    [    1.268828]  spi_mem_probe+0x6c/0xbc
    [    1.272574]  spi_probe+0x84/0xe4
    [    1.275958]  really_probe+0xbc/0x29c
    [    1.279713]  __driver_probe_device+0x78/0x12c
    [    1.284277]  driver_probe_device+0xd8/0x15c
    [    1.288660]  __device_attach_driver+0xb8/0x134
    [    1.293316]  bus_for_each_drv+0x88/0xe8
    [    1.297337]  __device_attach+0xa0/0x190
    [    1.301353]  device_initial_probe+0x14/0x20
    [    1.305734]  bus_probe_device+0xac/0xb0
    [    1.309752]  device_add+0x5d0/0x790
    [    1.313408]  __spi_add_device+0x134/0x204
    [    1.317606]  of_register_spi_device+0x3b4/0x590
    [    1.322348]  spi_register_controller+0x47c/0x754
    [    1.327181]  devm_spi_register_controller+0x4c/0xa4
    [    1.332289]  nxp_fspi_probe+0x1cc/0x2b0
    [    1.336307]  platform_probe+0x68/0xc4
    [    1.340145]  really_probe+0xbc/0x29c
    [    1.343893]  __driver_probe_device+0x78/0x12c
    [    1.348457]  driver_probe_device+0xd8/0x15c
    [    1.352838]  __driver_attach+0x90/0x19c
    [    1.356857]  bus_for_each_dev+0x7c/0xdc
    [    1.360877]  driver_attach+0x24/0x30
    [    1.364624]  bus_add_driver+0xe4/0x208
    [    1.368552]  driver_register+0x5c/0x124
    [    1.372573]  __platform_driver_register+0x28/0x34
    [    1.377497]  nxp_fspi_driver_init+0x1c/0x28
    [    1.381888]  do_one_initcall+0x80/0x1c8
    [    1.385908]  kernel_init_freeable+0x1c4/0x28c
    [    1.390472]  kernel_init+0x20/0x1d8
    [    1.394138]  ret_from_fork+0x10/0x20
    [    1.397885] ---[ end trace 0000000000000000 ]---
    [    1.407908] ------------[ cut here ]------------

    Fixes: ef89fd56bdfc ("arm64: dts: imx8ulp: add flexspi node")
    Cc: stable@kernel.org
    Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a49b96c51063d38be296a0c1537928a06f02d6e
Author: Gregory Price <gourry@gourry.net>
Date:   Fri Oct 25 10:17:24 2024 -0400

    vmscan,migrate: fix page count imbalance on node stats when demoting pages

    [ Upstream commit 35e41024c4c2b02ef8207f61b9004f6956cf037b ]

    When numa balancing is enabled with demotion, vmscan will call
    migrate_pages when shrinking LRUs.  migrate_pages will decrement the
    the node's isolated page count, leading to an imbalanced count when
    invoked from (MG)LRU code.

    The result is dmesg output like such:

    $ cat /proc/sys/vm/stat_refresh

    [77383.088417] vmstat_refresh: nr_isolated_anon -103212
    [77383.088417] vmstat_refresh: nr_isolated_file -899642

    This negative value may impact compaction and reclaim throttling.

    The following path produces the decrement:

    shrink_folio_list
      demote_folio_list
        migrate_pages
          migrate_pages_batch
            migrate_folio_move
              migrate_folio_done
                mod_node_page_state(-ve) <- decrement

    This path happens for SUCCESSFUL migrations, not failures.  Typically
    callers to migrate_pages are required to handle putback/accounting for
    failures, but this is already handled in the shrink code.

    When accounting for migrations, instead do not decrement the count when
    the migration reason is MR_DEMOTION.  As of v6.11, this demotion logic
    is the only source of MR_DEMOTION.

    Link: https://lkml.kernel.org/r/20241025141724.17927-1-gourry@gourry.net
    Fixes: 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
    Signed-off-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Yang Shi <shy828301@gmail.com>
    Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
    Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
    Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Wei Xu <weixugc@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 003d2996964c03dfd34860500428f4cdf1f5879e
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Oct 31 08:05:44 2024 -0600

    io_uring/rw: fix missing NOWAIT check for O_DIRECT start write

    [ Upstream commit 1d60d74e852647255bd8e76f5a22dc42531e4389 ]

    When io_uring starts a write, it'll call kiocb_start_write() to bump the
    super block rwsem, preventing any freezes from happening while that
    write is in-flight. The freeze side will grab that rwsem for writing,
    excluding any new writers from happening and waiting for existing writes
    to finish. But io_uring unconditionally uses kiocb_start_write(), which
    will block if someone is currently attempting to freeze the mount point.
    This causes a deadlock where freeze is waiting for previous writes to
    complete, but the previous writes cannot complete, as the task that is
    supposed to complete them is blocked waiting on starting a new write.
    This results in the following stuck trace showing that dependency with
    the write blocked starting a new write:

    task:fio             state:D stack:0     pid:886   tgid:886   ppid:876
    Call trace:
     __switch_to+0x1d8/0x348
     __schedule+0x8e8/0x2248
     schedule+0x110/0x3f0
     percpu_rwsem_wait+0x1e8/0x3f8
     __percpu_down_read+0xe8/0x500
     io_write+0xbb8/0xff8
     io_issue_sqe+0x10c/0x1020
     io_submit_sqes+0x614/0x2110
     __arm64_sys_io_uring_enter+0x524/0x1038
     invoke_syscall+0x74/0x268
     el0_svc_common.constprop.0+0x160/0x238
     do_el0_svc+0x44/0x60
     el0_svc+0x44/0xb0
     el0t_64_sync_handler+0x118/0x128
     el0t_64_sync+0x168/0x170
    INFO: task fsfreeze:7364 blocked for more than 15 seconds.
          Not tainted 6.12.0-rc5-00063-g76aaf945701c #7963

    with the attempting freezer stuck trying to grab the rwsem:

    task:fsfreeze        state:D stack:0     pid:7364  tgid:7364  ppid:995
    Call trace:
     __switch_to+0x1d8/0x348
     __schedule+0x8e8/0x2248
     schedule+0x110/0x3f0
     percpu_down_write+0x2b0/0x680
     freeze_super+0x248/0x8a8
     do_vfs_ioctl+0x149c/0x1b18
     __arm64_sys_ioctl+0xd0/0x1a0
     invoke_syscall+0x74/0x268
     el0_svc_common.constprop.0+0x160/0x238
     do_el0_svc+0x44/0x60
     el0_svc+0x44/0xb0
     el0t_64_sync_handler+0x118/0x128
     el0t_64_sync+0x168/0x170

    Fix this by having the io_uring side honor IOCB_NOWAIT, and only attempt a
    blocking grab of the super block rwsem if it isn't set. For normal issue
    where IOCB_NOWAIT would always be set, this returns -EAGAIN which will
    have io_uring core issue a blocking attempt of the write. That will in
    turn also get completions run, ensuring forward progress.

    Since freezing requires CAP_SYS_ADMIN in the first place, this isn't
    something that can be triggered by a regular user.

    Cc: stable@vger.kernel.org # 5.10+
    Reported-by: Peter Mann <peter.mann@sh.cz>
    Link: https://lore.kernel.org/io-uring/38c94aec-81c9-4f62-b44e-1d87f5597644@sh.cz
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 70bbe8d0a949413df1bb6532fd6b19fbf0f88feb
Author: Andrey Konovalov <andreyknvl@gmail.com>
Date:   Tue Oct 22 18:07:06 2024 +0200

    kasan: remove vmalloc_percpu test

    [ Upstream commit 330d8df81f3673d6fb74550bbc9bb159d81b35f7 ]

    Commit 1a2473f0cbc0 ("kasan: improve vmalloc tests") added the
    vmalloc_percpu KASAN test with the assumption that __alloc_percpu always
    uses vmalloc internally, which is tagged by KASAN.

    However, __alloc_percpu might allocate memory from the first per-CPU
    chunk, which is not allocated via vmalloc().  As a result, the test might
    fail.

    Remove the test until proper KASAN annotation for the per-CPU allocated
    are added; tracked in https://bugzilla.kernel.org/show_bug.cgi?id=215019.

    Link: https://lkml.kernel.org/r/20241022160706.38943-1-andrey.konovalov@linux.dev
    Fixes: 1a2473f0cbc0 ("kasan: improve vmalloc tests")
    Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
    Reported-by: Samuel Holland <samuel.holland@sifive.com>
    Link: https://lore.kernel.org/all/4a245fff-cc46-44d1-a5f9-fd2f1c3764ae@sifive.com/
    Reported-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Link: https://lore.kernel.org/all/CACzwLxiWzNqPBp4C1VkaXZ2wDwvY3yZeetCi1TLGFipKW77drA@mail.gmail.com/
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Marco Elver <elver@google.com>
    Cc: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c60af16e1d6cc2237d58336546d6adfc067b6b8f
Author: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
Date:   Mon Sep 16 22:41:37 2024 +0500

    nvmet-auth: assign dh_key to NULL after kfree_sensitive

    [ Upstream commit d2f551b1f72b4c508ab9298419f6feadc3b5d791 ]

    ctrl->dh_key might be used across multiple calls to nvmet_setup_dhgroup()
    for the same controller. So it's better to nullify it after release on
    error path in order to avoid double free later in nvmet_destroy_auth().

    Found by Linux Verification Center (linuxtesting.org) with Svace.

    Fixes: 7a277c37d352 ("nvmet-auth: Diffie-Hellman key exchange support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a39320977f9c665faa37efaa8093b8e82dd8c41
Author: Christoffer Sandberg <cs@tuxedo.de>
Date:   Tue Oct 29 16:16:53 2024 +0100

    ALSA: hda/realtek: Fix headset mic on TUXEDO Stellaris 16 Gen6 mb1

    [ Upstream commit e49370d769e71456db3fbd982e95bab8c69f73e8 ]

    Quirk is needed to enable headset microphone on missing pin 0x19.

    Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20241029151653.80726-2-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b42adef85aca72b51eab1a812a79913ff5aeb584
Author: Christoffer Sandberg <cs@tuxedo.de>
Date:   Tue Oct 29 16:16:52 2024 +0100

    ALSA: hda/realtek: Fix headset mic on TUXEDO Gemini 17 Gen3

    [ Upstream commit 0b04fbe886b4274c8e5855011233aaa69fec6e75 ]

    Quirk is needed to enable headset microphone on missing pin 0x19.

    Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20241029151653.80726-1-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 77ddc732416b017180893cbb2356e9f0a414c575
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Oct 23 15:37:22 2024 +0200

    xfs: fix finding a last resort AG in xfs_filestream_pick_ag

    [ Upstream commit dc60992ce76fbc2f71c2674f435ff6bde2108028 ]

    When the main loop in xfs_filestream_pick_ag fails to find a suitable
    AG it tries to just pick the online AG.  But the loop for that uses
    args->pag as loop iterator while the later code expects pag to be
    set.  Fix this by reusing the max_pag case for this last resort, and
    also add a check for impossible case of no AG just to make sure that
    the uninitialized pag doesn't even escape in theory.

    Reported-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
    Fixes: f8f1ed1ab3baba ("xfs: return a referenced perag from filestreams allocator")
    Cc: <stable@vger.kernel.org> # v6.3
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8e886e44397ba89f6e8da8471386112b4f5b67b7
Author: Matt Johnston <matt@codeconstruct.com.au>
Date:   Tue Oct 22 18:25:14 2024 +0800

    mctp i2c: handle NULL header address

    [ Upstream commit 01e215975fd80af81b5b79f009d49ddd35976c13 ]

    daddr can be NULL if there is no neighbour table entry present,
    in that case the tx packet should be dropped.

    saddr will usually be set by MCTP core, but check for NULL in case a
    packet is transmitted by a different protocol.

    Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
    Cc: stable@vger.kernel.org
    Reported-by: Dung Cao <dung@os.amperecomputing.com>
    Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241022-mctp-i2c-null-dest-v3-1-e929709956c5@codeconstruct.com.au
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 88f97a4b5843ce21c1286e082c02a5fb4d8eb473
Author: Edward Adam Davis <eadavis@qq.com>
Date:   Wed Oct 16 19:43:47 2024 +0800

    ocfs2: pass u64 to ocfs2_truncate_inline maybe overflow

    [ Upstream commit bc0a2f3a73fcdac651fca64df39306d1e5ebe3b0 ]

    Syzbot reported a kernel BUG in ocfs2_truncate_inline.  There are two
    reasons for this: first, the parameter value passed is greater than
    ocfs2_max_inline_data_with_xattr, second, the start and end parameters of
    ocfs2_truncate_inline are "unsigned int".

    So, we need to add a sanity check for byte_start and byte_len right before
    ocfs2_truncate_inline() in ocfs2_remove_inode_range(), if they are greater
    than ocfs2_max_inline_data_with_xattr return -EINVAL.

    Link: https://lkml.kernel.org/r/tencent_D48DB5122ADDAEDDD11918CFB68D93258C07@qq.com
    Fixes: 1afc32b95233 ("ocfs2: Write support for inline data")
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Reported-by: syzbot+81092778aac03460d6b7@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=81092778aac03460d6b7
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Gang He <ghe@suse.com>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c117a980185ee3812612e7e453e356a6a4f05305
Author: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Date:   Wed Oct 16 20:24:07 2024 +0500

    x86/traps: move kmsan check after instrumentation_begin

    [ Upstream commit 1db272864ff250b5e607283eaec819e1186c8e26 ]

    During x86_64 kernel build with CONFIG_KMSAN, the objtool warns following:

      AR      built-in.a
      AR      vmlinux.a
      LD      vmlinux.o
    vmlinux.o: warning: objtool: handle_bug+0x4: call to
        kmsan_unpoison_entry_regs() leaves .noinstr.text section
      OBJCOPY modules.builtin.modinfo
      GEN     modules.builtin
      MODPOST Module.symvers
      CC      .vmlinux.export.o

    Moving kmsan_unpoison_entry_regs() _after_ instrumentation_begin() fixes
    the warning.

    There is decode_bug(regs->ip, &imm) is left before KMSAN unpoisoining, but
    it has the return condition and if we include it after
    instrumentation_begin() it results the warning "return with
    instrumentation enabled", hence, I'm concerned that regs will not be KMSAN
    unpoisoned if `ud_type == BUG_NONE` is true.

    Link: https://lkml.kernel.org/r/20241016152407.3149001-1-snovitoll@gmail.com
    Fixes: ba54d194f8da ("x86/traps: avoid KMSAN bugs originating from handle_bug()")
    Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Reviewed-by: Alexander Potapenko <glider@google.com>
    Cc: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 86ee1845cbbf52eff6d41ce438d5f7e9ab6f4602
Author: Gatlin Newhouse <gatlin.newhouse@gmail.com>
Date:   Wed Jul 24 00:01:55 2024 +0000

    x86/traps: Enable UBSAN traps on x86

    [ Upstream commit 7424fc6b86c8980a87169e005f5cd4438d18efe6 ]

    Currently ARM64 extracts which specific sanitizer has caused a trap via
    encoded data in the trap instruction. Clang on x86 currently encodes the
    same data in the UD1 instruction but x86 handle_bug() and
    is_valid_bugaddr() currently only look at UD2.

    Bring x86 to parity with ARM64, similar to commit 25b84002afb9 ("arm64:
    Support Clang UBSAN trap codes for better reporting"). See the llvm
    links for information about the code generation.

    Enable the reporting of UBSAN sanitizer details on x86 compiled with clang
    when CONFIG_UBSAN_TRAP=y by analysing UD1 and retrieving the type immediate
    which is encoded by the compiler after the UD1.

    [ tglx: Simplified it by moving the printk() into handle_bug() ]

    Signed-off-by: Gatlin Newhouse <gatlin.newhouse@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/all/20240724000206.451425-1-gatlin.newhouse@gmail.com
    Link: https://github.com/llvm/llvm-project/commit/c5978f42ec8e9#diff-bb68d7cd885f41cfc35843998b0f9f534adb60b415f647109e597ce448e92d9f
    Link: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/X86/X86InstrSystem.td#L27
    Stable-dep-of: 1db272864ff2 ("x86/traps: move kmsan check after instrumentation_begin")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b958948ae1cb3e39c48e9f805436fd652103c71e
Author: Matt Fleming <mfleming@cloudflare.com>
Date:   Fri Oct 11 13:07:37 2024 +0100

    mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves

    [ Upstream commit 281dd25c1a018261a04d1b8bf41a0674000bfe38 ]

    Under memory pressure it's possible for GFP_ATOMIC order-0 allocations to
    fail even though free pages are available in the highatomic reserves.
    GFP_ATOMIC allocations cannot trigger unreserve_highatomic_pageblock()
    since it's only run from reclaim.

    Given that such allocations will pass the watermarks in
    __zone_watermark_unusable_free(), it makes sense to fallback to highatomic
    reserves the same way that ALLOC_OOM can.

    This fixes order-0 page allocation failures observed on Cloudflare's fleet
    when handling network packets:

      kswapd1: page allocation failure: order:0, mode:0x820(GFP_ATOMIC),
      nodemask=(null),cpuset=/,mems_allowed=0-7
      CPU: 10 PID: 696 Comm: kswapd1 Kdump: loaded Tainted: G           O 6.6.43-CUSTOM #1
      Hardware name: MACHINE
      Call Trace:
       <IRQ>
       dump_stack_lvl+0x3c/0x50
       warn_alloc+0x13a/0x1c0
       __alloc_pages_slowpath.constprop.0+0xc9d/0xd10
       __alloc_pages+0x327/0x340
       __napi_alloc_skb+0x16d/0x1f0
       bnxt_rx_page_skb+0x96/0x1b0 [bnxt_en]
       bnxt_rx_pkt+0x201/0x15e0 [bnxt_en]
       __bnxt_poll_work+0x156/0x2b0 [bnxt_en]
       bnxt_poll+0xd9/0x1c0 [bnxt_en]
       __napi_poll+0x2b/0x1b0
       bpf_trampoline_6442524138+0x7d/0x1000
       __napi_poll+0x5/0x1b0
       net_rx_action+0x342/0x740
       handle_softirqs+0xcf/0x2b0
       irq_exit_rcu+0x6c/0x90
       sysvec_apic_timer_interrupt+0x72/0x90
       </IRQ>

    [mfleming@cloudflare.com: update comment]
      Link: https://lkml.kernel.org/r/20241015125158.3597702-1-matt@readmodwrite.com
    Link: https://lkml.kernel.org/r/20241011120737.3300370-1-matt@readmodwrite.com
    Link: https://lore.kernel.org/all/CAGis_TWzSu=P7QJmjD58WWiu3zjMTVKSzdOwWE8ORaGytzWJwQ@mail.gmail.com/
    Fixes: 1d91df85f399 ("mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs")
    Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
    Suggested-by: Vlastimil Babka <vbabka@suse.cz>
    Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4882a352b5df897c30f9d64fba340a219a6604d0
Author: Alexander Usyskin <alexander.usyskin@intel.com>
Date:   Tue Oct 15 15:31:57 2024 +0300

    mei: use kvmalloc for read buffer

    [ Upstream commit 4adf613e01bf99e1739f6ff3e162ad5b7d578d1a ]

    Read buffer is allocated according to max message size, reported by
    the firmware and may reach 64K in systems with pxp client.
    Contiguous 64k allocation may fail under memory pressure.
    Read buffer is used as in-driver message storage and not required
    to be contiguous.
    Use kvmalloc to allow kernel to allocate non-contiguous memory.

    Fixes: 3030dc056459 ("mei: add wrapper for queuing control commands.")
    Cc: stable <stable@kernel.org>
    Reported-by: Rohit Agarwal <rohiagar@chromium.org>
    Closes: https://lore.kernel.org/all/20240813084542.2921300-1-rohiagar@chromium.org/
    Tested-by: Brian Geffon <bgeffon@google.com>
    Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
    Acked-by: Tomas Winkler <tomasw@gmail.com>
    Link: https://lore.kernel.org/r/20241015123157.2337026-1-alexander.usyskin@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cb8b81ad3e893a6d18dcdd3754cc2ea2a42c0136
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Mon Oct 21 12:25:26 2024 +0200

    mptcp: init: protect sched with rcu_read_lock

    [ Upstream commit 3deb12c788c385e17142ce6ec50f769852fcec65 ]

    Enabling CONFIG_PROVE_RCU_LIST with its dependence CONFIG_RCU_EXPERT
    creates this splat when an MPTCP socket is created:

      =============================
      WARNING: suspicious RCU usage
      6.12.0-rc2+ #11 Not tainted
      -----------------------------
      net/mptcp/sched.c:44 RCU-list traversed in non-reader section!!

      other info that might help us debug this:

      rcu_scheduler_active = 2, debug_locks = 1
      no locks held by mptcp_connect/176.

      stack backtrace:
      CPU: 0 UID: 0 PID: 176 Comm: mptcp_connect Not tainted 6.12.0-rc2+ #11
      Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      Call Trace:
       <TASK>
       dump_stack_lvl (lib/dump_stack.c:123)
       lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822)
       mptcp_sched_find (net/mptcp/sched.c:44 (discriminator 7))
       mptcp_init_sock (net/mptcp/protocol.c:2867 (discriminator 1))
       ? sock_init_data_uid (arch/x86/include/asm/atomic.h:28)
       inet_create.part.0.constprop.0 (net/ipv4/af_inet.c:386)
       ? __sock_create (include/linux/rcupdate.h:347 (discriminator 1))
       __sock_create (net/socket.c:1576)
       __sys_socket (net/socket.c:1671)
       ? __pfx___sys_socket (net/socket.c:1712)
       ? do_user_addr_fault (arch/x86/mm/fault.c:1419 (discriminator 1))
       __x64_sys_socket (net/socket.c:1728)
       do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1))
       entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)

    That's because when the socket is initialised, rcu_read_lock() is not
    used despite the explicit comment written above the declaration of
    mptcp_sched_find() in sched.c. Adding the missing lock/unlock avoids the
    warning.

    Fixes: 1730b2b2c5a5 ("mptcp: add sched in mptcp_sock")
    Cc: stable@vger.kernel.org
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/523
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241021-net-mptcp-sched-lock-v1-1-637759cf061c@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4f7ffa83fa79dd52efbaef366c850aaaae06a469
Author: Hugh Dickins <hughd@google.com>
Date:   Sun Oct 27 15:23:23 2024 -0700

    iov_iter: fix copy_page_from_iter_atomic() if KMAP_LOCAL_FORCE_MAP

    [ Upstream commit c749d9b7ebbc5716af7a95f7768634b30d9446ec ]

    generic/077 on x86_32 CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y with highmem,
    on huge=always tmpfs, issues a warning and then hangs (interruptibly):

    WARNING: CPU: 5 PID: 3517 at mm/highmem.c:622 kunmap_local_indexed+0x62/0xc9
    CPU: 5 UID: 0 PID: 3517 Comm: cp Not tainted 6.12.0-rc4 #2
    ...
    copy_page_from_iter_atomic+0xa6/0x5ec
    generic_perform_write+0xf6/0x1b4
    shmem_file_write_iter+0x54/0x67

    Fix copy_page_from_iter_atomic() by limiting it in that case
    (include/linux/skbuff.h skb_frag_must_loop() does similar).

    But going forward, perhaps CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP is too
    surprising, has outlived its usefulness, and should just be removed?

    Fixes: 908a1ad89466 ("iov_iter: Handle compound highmem pages in copy_page_from_iter_atomic()")
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Link: https://lore.kernel.org/r/dd5f0c89-186e-18e1-4f43-19a60f5a9774@google.com
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ade91f6e9848b370add44d89c976e070ccb492ef
Author: Shawn Wang <shawnwang@linux.alibaba.com>
Date:   Fri Oct 25 10:22:08 2024 +0800

    sched/numa: Fix the potential null pointer dereference in task_numa_work()

    [ Upstream commit 9c70b2a33cd2aa6a5a59c5523ef053bd42265209 ]

    When running stress-ng-vm-segv test, we found a null pointer dereference
    error in task_numa_work(). Here is the backtrace:

      [323676.066985] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
      ......
      [323676.067108] CPU: 35 PID: 2694524 Comm: stress-ng-vm-se
      ......
      [323676.067113] pstate: 23401009 (nzCv daif +PAN -UAO +TCO +DIT +SSBS BTYPE=--)
      [323676.067115] pc : vma_migratable+0x1c/0xd0
      [323676.067122] lr : task_numa_work+0x1ec/0x4e0
      [323676.067127] sp : ffff8000ada73d20
      [323676.067128] x29: ffff8000ada73d20 x28: 0000000000000000 x27: 000000003e89f010
      [323676.067130] x26: 0000000000080000 x25: ffff800081b5c0d8 x24: ffff800081b27000
      [323676.067133] x23: 0000000000010000 x22: 0000000104d18cc0 x21: ffff0009f7158000
      [323676.067135] x20: 0000000000000000 x19: 0000000000000000 x18: ffff8000ada73db8
      [323676.067138] x17: 0001400000000000 x16: ffff800080df40b0 x15: 0000000000000035
      [323676.067140] x14: ffff8000ada73cc8 x13: 1fffe0017cc72001 x12: ffff8000ada73cc8
      [323676.067142] x11: ffff80008001160c x10: ffff000be639000c x9 : ffff8000800f4ba4
      [323676.067145] x8 : ffff000810375000 x7 : ffff8000ada73974 x6 : 0000000000000001
      [323676.067147] x5 : 0068000b33e26707 x4 : 0000000000000001 x3 : ffff0009f7158000
      [323676.067149] x2 : 0000000000000041 x1 : 0000000000004400 x0 : 0000000000000000
      [323676.067152] Call trace:
      [323676.067153]  vma_migratable+0x1c/0xd0
      [323676.067155]  task_numa_work+0x1ec/0x4e0
      [323676.067157]  task_work_run+0x78/0xd8
      [323676.067161]  do_notify_resume+0x1ec/0x290
      [323676.067163]  el0_svc+0x150/0x160
      [323676.067167]  el0t_64_sync_handler+0xf8/0x128
      [323676.067170]  el0t_64_sync+0x17c/0x180
      [323676.067173] Code: d2888001 910003fd f9000bf3 aa0003f3 (f9401000)
      [323676.067177] SMP: stopping secondary CPUs
      [323676.070184] Starting crashdump kernel...

    stress-ng-vm-segv in stress-ng is used to stress test the SIGSEGV error
    handling function of the system, which tries to cause a SIGSEGV error on
    return from unmapping the whole address space of the child process.

    Normally this program will not cause kernel crashes. But before the
    munmap system call returns to user mode, a potential task_numa_work()
    for numa balancing could be added and executed. In this scenario, since the
    child process has no vma after munmap, the vma_next() in task_numa_work()
    will return a null pointer even if the vma iterator restarts from 0.

    Recheck the vma pointer before dereferencing it in task_numa_work().

    Fixes: 214dbc428137 ("sched: convert to vma iterator")
    Signed-off-by: Shawn Wang <shawnwang@linux.alibaba.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org # v6.2+
    Link: https://lkml.kernel.org/r/20241025022208.125527-1-shawnwang@linux.alibaba.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8c9a1ec39c698cbc38f4efa9113185f885137f8b
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Tue Oct 22 18:43:40 2024 -0700

    cxl/acpi: Ensure ports ready at cxl_acpi_probe() return

    [ Upstream commit 48f62d38a07d464a499fa834638afcfd2b68f852 ]

    In order to ensure root CXL ports are enabled upon cxl_acpi_probe()
    when the 'cxl_port' driver is built as a module, arrange for the
    module to be pre-loaded or built-in.

    The "Fixes:" but no "Cc: stable" on this patch reflects that the issue
    is merely by inspection since the bug that triggered the discovery of
    this potential problem [1] is fixed by other means. However, a stable
    backport should do no harm.

    Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver")
    Link: http://lore.kernel.org/20241004212504.1246-1-gourry@gourry.net [1]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Tested-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Link: https://patch.msgid.link/172964781969.81806.17276352414854540808.stgit@dwillia2-xfh.jf.intel.com
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a9ed67f39f888bb6e5729112ad45f15d9c5a3ef8
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Tue Oct 22 18:43:32 2024 -0700

    cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices()

    [ Upstream commit 3d6ebf16438de5d712030fefbb4182b46373d677 ]

    It turns out since its original introduction, pre-2.6.12,
    bus_rescan_devices() has skipped devices that might be in the process of
    attaching or detaching from their driver. For CXL this behavior is
    unwanted and expects that cxl_bus_rescan() is a probe barrier.

    That behavior is simple enough to achieve with bus_for_each_dev() paired
    with call to device_attach(), and it is unclear why bus_rescan_devices()
    took the position of lockless consumption of dev->driver which is racy.

    The "Fixes:" but no "Cc: stable" on this patch reflects that the issue
    is merely by inspection since the bug that triggered the discovery of
    this potential problem [1] is fixed by other means.  However, a stable
    backport should do no harm.

    Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver")
    Link: http://lore.kernel.org/20241004212504.1246-1-gourry@gourry.net [1]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Tested-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Link: https://patch.msgid.link/172964781104.81806.4277549800082443769.stgit@dwillia2-xfh.jf.intel.com
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d210bc87cc4fdde62f757002530a08c3d109d94a
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:39 2024 +0800

    riscv: Remove duplicated GET_RM

    [ Upstream commit 164f66de6bb6ef454893f193c898dc8f1da6d18b ]

    The macro GET_RM defined twice in this file, one can be removed.

    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Fixes: 956d705dd279 ("riscv: Unaligned load/store handling for M_MODE")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241008094141.549248-3-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6d84e1b2e5ac04511e68bcf5577fc8369e73f4ed
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:38 2024 +0800

    riscv: Remove unused GENERATING_ASM_OFFSETS

    [ Upstream commit 46d4e5ac6f2f801f97bcd0ec82365969197dc9b1 ]

    The macro is not used in the current version of kernel, it looks like
    can be removed to avoid a build warning:

    ../arch/riscv/kernel/asm-offsets.c: At top level:
    ../arch/riscv/kernel/asm-offsets.c:7: warning: macro "GENERATING_ASM_OFFSETS" is not used [-Wunused-macros]
        7 | #define GENERATING_ASM_OFFSETS

    Fixes: 9639a44394b9 ("RISC-V: Provide a cleaner raw_smp_processor_id()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Link: https://lore.kernel.org/r/20241008094141.549248-2-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a63ba17207c50da91b19150b6cde09d199b34c2c
Author: WangYuli <wangyuli@uniontech.com>
Date:   Thu Oct 17 11:20:10 2024 +0800

    riscv: Use '%u' to format the output of 'cpu'

    [ Upstream commit e0872ab72630dada3ae055bfa410bf463ff1d1e0 ]

    'cpu' is an unsigned integer, so its conversion specifier should
    be %u, not %d.

    Suggested-by: Wentao Guan <guanwentao@uniontech.com>
    Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Link: https://lore.kernel.org/all/alpine.DEB.2.21.2409122309090.40372@angie.orcam.me.uk/
    Signed-off-by: WangYuli <wangyuli@uniontech.com>
    Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
    Tested-by: Charlie Jenkins <charlie@rivosinc.com>
    Fixes: f1e58583b9c7 ("RISC-V: Support cpu hotplug")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/4C127DEECDA287C8+20241017032010.96772-1-wangyuli@uniontech.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 909e71f28e9615410f52fca1b54acfd3d61c61c2
Author: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date:   Sun Sep 29 16:02:33 2024 +0200

    riscv: efi: Set NX compat flag in PE/COFF header

    [ Upstream commit d41373a4b910961df5a5e3527d7bde6ad45ca438 ]

    The IMAGE_DLLCHARACTERISTICS_NX_COMPAT informs the firmware that the
    EFI binary does not rely on pages that are both executable and
    writable.

    The flag is used by some distro versions of GRUB to decide if the EFI
    binary may be executed.

    As the Linux kernel neither has RWX sections nor needs RWX pages for
    relocation we should set the flag.

    Cc: Ard Biesheuvel <ardb@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
    Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
    Fixes: cb7d2dd5612a ("RISC-V: Add PE/COFF header for EFI stub")
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://lore.kernel.org/r/20240929140233.211800-1-heinrich.schuchardt@canonical.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 58e78589ade880330e359587bb50b1474f43aa12
Author: Kailang Yang <kailang@realtek.com>
Date:   Fri Oct 18 13:53:24 2024 +0800

    ALSA: hda/realtek: Limit internal Mic boost on Dell platform

    [ Upstream commit 78e7be018784934081afec77f96d49a2483f9188 ]

    Dell want to limit internal Mic boost on all Dell platform.

    Signed-off-by: Kailang Yang <kailang@realtek.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/561fc5f5eff04b6cbd79ed173cd1c1db@realtek.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ceec8ad09135c27890cdee5a9bb0bf5f58c23720
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Fri Oct 18 17:17:48 2024 -0700

    Input: edt-ft5x06 - fix regmap leak when probe fails

    [ Upstream commit bffdf9d7e51a7be8eeaac2ccf9e54a5fde01ff65 ]

    The driver neglects to free the instance of I2C regmap constructed at
    the beginning of the edt_ft5x06_ts_probe() method when probe fails.
    Additionally edt_ft5x06_ts_remove() is freeing the regmap too early,
    before the rest of the device resources that are managed by devm are
    released.

    Fix this by installing a custom devm action that will ensure that the
    regmap is released at the right time during normal teardown as well as
    in case of probe failure.

    Note that devm_regmap_init_i2c() could not be used because the driver
    may replace the original regmap with a regmap specific for M06 devices
    in the middle of the probe, and using devm_regmap_init_i2c() would
    result in releasing the M06 regmap too early.

    Reported-by: Li Zetao <lizetao1@huawei.com>
    Fixes: 9dfd9708ffba ("Input: edt-ft5x06 - convert to use regmap API")
    Cc: stable@vger.kernel.org
    Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com>
    Link: https://lore.kernel.org/r/ZxL6rIlVlgsAu-Jv@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c19a0c171d37f86ab7267c638d475321fd9f0b77
Author: Alexandre Ghiti <alexghiti@rivosinc.com>
Date:   Wed Oct 16 10:36:24 2024 +0200

    riscv: vdso: Prevent the compiler from inserting calls to memset()

    [ Upstream commit bf40167d54d55d4b54d0103713d86a8638fb9290 ]

    The compiler is smart enough to insert a call to memset() in
    riscv_vdso_get_cpus(), which generates a dynamic relocation.

    So prevent this by using -fno-builtin option.

    Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Guo Ren <guoren@kernel.org>
    Link: https://lore.kernel.org/r/20241016083625.136311-2-alexghiti@rivosinc.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e79c1f1c9100b4adc91c6512985db2cc961aafaa
Author: Frank Li <Frank.Li@nxp.com>
Date:   Wed Oct 23 16:30:32 2024 -0400

    spi: spi-fsl-dspi: Fix crash when not using GPIO chip select

    [ Upstream commit 25f00a13dccf8e45441265768de46c8bf58e08f6 ]

    Add check for the return value of spi_get_csgpiod() to avoid passing a NULL
    pointer to gpiod_direction_output(), preventing a crash when GPIO chip
    select is not used.

    Fix below crash:
    [    4.251960] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [    4.260762] Mem abort info:
    [    4.263556]   ESR = 0x0000000096000004
    [    4.267308]   EC = 0x25: DABT (current EL), IL = 32 bits
    [    4.272624]   SET = 0, FnV = 0
    [    4.275681]   EA = 0, S1PTW = 0
    [    4.278822]   FSC = 0x04: level 0 translation fault
    [    4.283704] Data abort info:
    [    4.286583]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [    4.292074]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [    4.297130]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [    4.302445] [0000000000000000] user address but active_mm is swapper
    [    4.308805] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
    [    4.315072] Modules linked in:
    [    4.318124] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc4-next-20241023-00008-ga20ec42c5fc1 #359
    [    4.328130] Hardware name: LS1046A QDS Board (DT)
    [    4.332832] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    4.339794] pc : gpiod_direction_output+0x34/0x5c
    [    4.344505] lr : gpiod_direction_output+0x18/0x5c
    [    4.349208] sp : ffff80008003b8f0
    [    4.352517] x29: ffff80008003b8f0 x28: 0000000000000000 x27: ffffc96bcc7e9068
    [    4.359659] x26: ffffc96bcc6e00b0 x25: ffffc96bcc598398 x24: ffff447400132810
    [    4.366800] x23: 0000000000000000 x22: 0000000011e1a300 x21: 0000000000020002
    [    4.373940] x20: 0000000000000000 x19: 0000000000000000 x18: ffffffffffffffff
    [    4.381081] x17: ffff44740016e600 x16: 0000000500000003 x15: 0000000000000007
    [    4.388221] x14: 0000000000989680 x13: 0000000000020000 x12: 000000000000001e
    [    4.395362] x11: 0044b82fa09b5a53 x10: 0000000000000019 x9 : 0000000000000008
    [    4.402502] x8 : 0000000000000002 x7 : 0000000000000007 …
qaz6750 added a commit that referenced this pull request Nov 24, 2024
commit 18916a684a8b836957df88438f9bca590799d04c
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Oct 22 15:46:36 2024 +0200

    Linux 6.6.58

    Link: https://lore.kernel.org/r/20241021102256.706334758@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fd6e2af79a947e909c72b09f1ce3175f381067ef
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Wed Oct 16 11:07:13 2024 +0300

    ALSA: hda/conexant - Use cached pin control for Node 0x1d on HP EliteOne 1000 G2

    commit 164cd0e077a18d6208523c82b102c98c77fdd51f upstream.

    The cached version avoids redundant commands to the codec, improving
    stability and reducing unnecessary operations. This change ensures
    better power management and reliable restoration of pin configurations,
    especially after hibernation (S4) and other power transitions.

    Fixes: 9988844c457f ("ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2")
    Suggested-by: Kai-Heng Feng <kaihengf@nvidia.com>
    Suggested-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Link: https://patch.msgid.link/20241016080713.46801-1-kovalev@altlinux.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9698088ac7704e260f492d9c254e29ed7dd8729a
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 4 12:35:31 2024 +0900

    nilfs2: propagate directory read errors from nilfs_find_entry()

    commit 08cfa12adf888db98879dbd735bc741360a34168 upstream.

    Syzbot reported that a task hang occurs in vcs_open() during a fuzzing
    test for nilfs2.

    The root cause of this problem is that in nilfs_find_entry(), which
    searches for directory entries, ignores errors when loading a directory
    page/folio via nilfs_get_folio() fails.

    If the filesystem images is corrupted, and the i_size of the directory
    inode is large, and the directory page/folio is successfully read but
    fails the sanity check, for example when it is zero-filled,
    nilfs_check_folio() may continue to spit out error messages in bursts.

    Fix this issue by propagating the error to the callers when loading a
    page/folio fails in nilfs_find_entry().

    The current interface of nilfs_find_entry() and its callers is outdated
    and cannot propagate error codes such as -EIO and -ENOMEM returned via
    nilfs_find_entry(), so fix it together.

    Link: https://lkml.kernel.org/r/20241004033640.6841-1-konishi.ryusuke@gmail.com
    Fixes: 2ba466d74ed7 ("nilfs2: directory entry operations")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: Lizhi Xu <lizhi.xu@windriver.com>
    Closes: https://lkml.kernel.org/r/20240927013806.3577931-1-lizhi.xu@windriver.com
    Reported-by: syzbot+8a192e8d090fa9a31135@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=8a192e8d090fa9a31135
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87cb3f6e0c047f9320889e68140f46b1f4ca9eca
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Fri Oct 18 17:57:39 2024 +0200

    selftests: mptcp: remove duplicated variables

    A few week ago, there were some backport issues in MPTCP selftests,
    because some patches have been applied twice, but with versions handling
    conflicts differently [1].

    Patches fixing these issues have been sent [2] and applied, but it looks
    like quilt was still confused with the removal of some patches, and
    commit a417ef47a665 ("selftests: mptcp: join: validate event numbers")
    duplicated some variables, not present in the original patch [3].

    Anyway, Bash was complaining, but that was not causing any tests to
    fail. Also, that's easy to fix by simply removing the duplicated ones.

    Link: https://lore.kernel.org/fc21db4a-508d-41db-aa45-e3bc06d18ce7@kernel.org [1]
    Link: https://lore.kernel.org/20240905144306.1192409-5-matttbe@kernel.org [2]
    Link: https://lore.kernel.org/20240905144306.1192409-7-matttbe@kernel.org [3]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec0d0fcbd5d8645fdfb75717d70270f59254d04d
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:38 2024 +0200

    selftests: mptcp: join: test for prohibited MPC to port-based endp

    commit 5afca7e996c42aed1b4a42d4712817601ba42aff upstream.

    Explicitly verify that MPC connection attempts towards a port-based
    signal endpoint fail with a reset.

    Note that this new test is a bit different from the other ones, not
    using 'run_tests'. It is then needed to add the capture capability, and
    the picking the right port which have been extracted into three new
    helpers. The info about the capture can also be printed from a single
    point, which simplifies the exit paths in do_transfer().

    The 'Fixes' tag here below is the same as the one from the previous
    commit: this patch here is not fixing anything wrong in the selftests,
    but it validates the previous fix for an issue introduced by this commit
    ID.

    Fixes: 1729cf186d8a ("mptcp: create the listening socket for new port")
    Cc: stable@vger.kernel.org
    Co-developed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241014-net-mptcp-mpc-port-endp-v2-2-7faea8e6b6ae@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflicts in mptcp_join.sh, because commit 0bd962dd86b2 ("selftests:
      mptcp: join: check CURRESTAB counters"), and commit 9e6a39ecb9a1
      ("selftests: mptcp: export TEST_COUNTER variable") are linked to new
      features, not available in this version. Resolving the conflicts is
      easy, simply adding the new helpers before do_transfer(), and rename
      MPTCP_LIB_TEST_COUNTER to TEST_COUNT that was used before. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d46b96f0a4892580757d3bbb546d2971dbe83361
Author: Geliang Tang <tanggeliang@kylinos.cn>
Date:   Fri Oct 18 17:57:37 2024 +0200

    selftests: mptcp: join: change capture/checksum as bool

    commit 8c6f6b4bb53a904f922dfb90d566391d3feee32c upstream.

    To maintain consistency with other scripts, this patch changes vars
    'capture' and 'checksum' as bool vars in mptcp_join.

    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-next-20240223-misc-improvements-v1-7-b6c8a10396bd@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 5afca7e996c4 ("selftests: mptcp: join: test for prohibited MPC to port-based endp")
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 229dfdc36f31a8d47433438bc0e6e1662c4ab404
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:36 2024 +0200

    tcp: fix mptcp DSS corruption due to large pmtu xmit

    commit 4dabcdf581217e60690467a37c956a5b8dbc6bd9 upstream.

    Syzkaller was able to trigger a DSS corruption:

      TCP: request_sock_subflow_v4: Possible SYN flooding on port [::]:20002. Sending cookies.
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 5227 at net/mptcp/protocol.c:695 __mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Modules linked in:
      CPU: 0 UID: 0 PID: 5227 Comm: syz-executor350 Not tainted 6.11.0-syzkaller-08829-gaf9c191ac2a0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
      RIP: 0010:__mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Code: 0f b6 dc 31 ff 89 de e8 b5 dd ea f5 89 d8 48 81 c4 50 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 98 da ea f5 90 <0f> 0b 90 e9 47 ff ff ff e8 8a da ea f5 90 0f 0b 90 e9 99 e0 ff ff
      RSP: 0018:ffffc90000006db8 EFLAGS: 00010246
      RAX: ffffffff8ba9df18 RBX: 00000000000055f0 RCX: ffff888030023c00
      RDX: 0000000000000100 RSI: 00000000000081e5 RDI: 00000000000055f0
      RBP: 1ffff110062bf1ae R08: ffffffff8ba9cf12 R09: 1ffff110062bf1b8
      R10: dffffc0000000000 R11: ffffed10062bf1b9 R12: 0000000000000000
      R13: dffffc0000000000 R14: 00000000700cec61 R15: 00000000000081e5
      FS:  000055556679c380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020287000 CR3: 0000000077892000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <IRQ>
       move_skbs_to_msk net/mptcp/protocol.c:811 [inline]
       mptcp_data_ready+0x29c/0xa90 net/mptcp/protocol.c:854
       subflow_data_ready+0x34a/0x920 net/mptcp/subflow.c:1490
       tcp_data_queue+0x20fd/0x76c0 net/ipv4/tcp_input.c:5283
       tcp_rcv_established+0xfba/0x2020 net/ipv4/tcp_input.c:6237
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       tcp_v4_rcv+0x2dc0/0x37f0 net/ipv4/tcp_ipv4.c:2350
       ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205
       ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       __netif_receive_skb_one_core net/core/dev.c:5662 [inline]
       __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775
       process_backlog+0x662/0x15b0 net/core/dev.c:6107
       __napi_poll+0xcb/0x490 net/core/dev.c:6771
       napi_poll net/core/dev.c:6840 [inline]
       net_rx_action+0x89b/0x1240 net/core/dev.c:6962
       handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
       do_softirq+0x11b/0x1e0 kernel/softirq.c:455
       </IRQ>
       <TASK>
       __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
       local_bh_enable include/linux/bottom_half.h:33 [inline]
       rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline]
       __dev_queue_xmit+0x1764/0x3e80 net/core/dev.c:4451
       dev_queue_xmit include/linux/netdevice.h:3094 [inline]
       neigh_hh_output include/net/neighbour.h:526 [inline]
       neigh_output include/net/neighbour.h:540 [inline]
       ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:236
       ip_local_out net/ipv4/ip_output.c:130 [inline]
       __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:536
       __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466
       tcp_transmit_skb net/ipv4/tcp_output.c:1484 [inline]
       tcp_mtu_probe net/ipv4/tcp_output.c:2547 [inline]
       tcp_write_xmit+0x641d/0x6bf0 net/ipv4/tcp_output.c:2752
       __tcp_push_pending_frames+0x9b/0x360 net/ipv4/tcp_output.c:3015
       tcp_push_pending_frames include/net/tcp.h:2107 [inline]
       tcp_data_snd_check net/ipv4/tcp_input.c:5714 [inline]
       tcp_rcv_established+0x1026/0x2020 net/ipv4/tcp_input.c:6239
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       sk_backlog_rcv include/net/sock.h:1113 [inline]
       __release_sock+0x214/0x350 net/core/sock.c:3072
       release_sock+0x61/0x1f0 net/core/sock.c:3626
       mptcp_push_release net/mptcp/protocol.c:1486 [inline]
       __mptcp_push_pending+0x6b5/0x9f0 net/mptcp/protocol.c:1625
       mptcp_sendmsg+0x10bb/0x1b10 net/mptcp/protocol.c:1903
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg+0x1a6/0x270 net/socket.c:745
       ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2603
       ___sys_sendmsg net/socket.c:2657 [inline]
       __sys_sendmsg+0x2aa/0x390 net/socket.c:2686
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7fb06e9317f9
      Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffe2cfd4f98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007fb06e97f468 RCX: 00007fb06e9317f9
      RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000005
      RBP: 00007fb06e97f446 R08: 0000555500000000 R09: 0000555500000000
      R10: 0000555500000000 R11: 0000000000000246 R12: 00007fb06e97f406
      R13: 0000000000000001 R14: 00007ffe2cfd4fe0 R15: 0000000000000003
       </TASK>

    Additionally syzkaller provided a nice reproducer. The repro enables
    pmtu on the loopback device, leading to tcp_mtu_probe() generating
    very large probe packets.

    tcp_can_coalesce_send_queue_head() currently does not check for
    mptcp-level invariants, and allowed the creation of cross-DSS probes,
    leading to the mentioned corruption.

    Address the issue teaching tcp_can_coalesce_send_queue_head() about
    mptcp using the tcp_skb_can_collapse(), also reducing the code
    duplication.

    Fixes: 85712484110d ("tcp: coalesce/collapse must respect MPTCP extensions")
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+d1bff73460e33101f0e7@syzkaller.appspotmail.com
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/513
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241008-net-mptcp-fallback-fixes-v1-2-c6fb8e93e551@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflict in tcp_output.c, because the commit 65249feb6b3d ("net: add
      support for skbs with unreadable frags") is not in this version. This
      commit is linked to a new feature (Devmem TCP) and introduces a new
      condition which causes the conflicts. Resolving this is easy: we can
      ignore the missing new condition, and use tcp_skb_can_collapse() like
      in the original patch. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 647cd4494cc301f019267b901ab5cf71f3e54d57
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:06 2024 +0200

    serial: qcom-geni: fix receiver enable

    commit fa103d2599e11e802c818684cff821baefe7f206 upstream.

    The receiver is supposed to be enabled in the startup() callback and not
    in set_termios() which is called also during console setup.

    This specifically avoids accepting input before the port has been opened
    (and interrupts enabled), something which can also break the GENI
    firmware (cancel fails and after abort, the "stale" counter handling
    appears to be broken so that later input is not processed until twelve
    chars have been received).

    There also does not appear to be any need to keep the receiver disabled
    while updating the port settings.

    Since commit 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during
    console writes") the calls to manipulate the secondary interrupts, which
    were done without holding the port lock, can also lead to the receiver
    being left disabled when set_termios() races with the console code (e.g.
    when init opens the tty during boot). This can manifest itself as a
    serial getty not accepting input.

    The calls to stop and start rx in set_termios() can similarly race with
    DMA completion and, for example, cause the DMA buffer to be unmapped
    twice or the mapping to be leaked.

    Fix this by only enabling the receiver during startup and while holding
    the port lock to avoid racing with the console code.

    Fixes: 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during console writes")
    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-6-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 61c8f746ed831c4e8753bfbf0ccd08c20b13f83a
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:05 2024 +0200

    serial: qcom-geni: fix dma rx cancellation

    commit 23ee4a25661c33e6381d41e848a9060ed6d72845 upstream.

    Make sure to wait for the DMA transfer to complete when cancelling the
    rx command on stop_rx(). This specifically prevents the DMA completion
    interrupt from firing after rx has been restarted, something which can
    lead to an IOMMU fault and hosed rx when the interrupt handler unmaps
    the DMA buffer for the new command:

    	qcom_geni_serial 988000.serial: serial engine reports 0 RX bytes in!
    	arm-smmu 15000000.iommu: FSR    = 00000402 [Format=2 TF], SID=0x563
    	arm-smmu 15000000.iommu: FSYNR0 = 00210013 [S1CBNDX=33 WNR PLVL=3]
    	Bluetooth: hci0: command 0xfc00 tx timeout
    	Bluetooth: hci0: Reading QCA version information failed (-110)

    Also add the missing state machine reset which is needed in case
    cancellation fails.

    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-5-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7176aee5a1b20ae4da1082d6fc59a3b58383f079
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:03 2024 +0200

    serial: qcom-geni: revert broken hibernation support

    commit 19df76662a33d2f2fc41a66607cb8285fc02d6ec upstream.

    This reverts commit 35781d8356a2eecaa6074ceeb80ee22e252fcdae.

    Hibernation is not supported on Qualcomm platforms with mainline
    kernels yet a broken vendor implementation for the GENI serial driver
    made it upstream.

    This is effectively dead code that cannot be tested and should just be
    removed, but if these paths were ever hit for an open non-console port
    they would crash the machine as the driver would fail to enable clocks
    during restore() (i.e. all ports would have to be closed by drivers and
    user space before hibernating the system to avoid this as a comment in
    the code hinted at).

    The broken implementation also added a random call to enable the
    receiver in the port setup code where it does not belong and which
    enables the receiver prematurely for console ports.

    Fixes: 35781d8356a2 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature")
    Cc: stable@vger.kernel.org	# 6.2
    Cc: Aniket Randive <quic_arandive@quicinc.com>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-3-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90e3f819e6aacfcf5b297d4769744f42b5a749c8
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:02 2024 +0200

    serial: qcom-geni: fix polled console initialisation

    commit 4bef7c6f299910f19876ad8e7f5897514855f1d2 upstream.

    The polled console (KGDB/KDB) implementation must not call port setup
    unconditionally as the port may already be in use by the console or a
    getty.

    Only make sure that the receiver is enabled, but do not enable any
    device interrupts.

    Fixes: d8851a96ba25 ("tty: serial: qcom-geni-serial: Add a poll_init() function")
    Cc: stable@vger.kernel.org	# 6.4
    Cc: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-2-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6acd19ad3aaf270b19e704b5cff14808766fca84
Author: Nam Cao <namcao@linutronix.de>
Date:   Thu Oct 3 10:41:52 2024 +0200

    irqchip/sifive-plic: Unmask interrupt in plic_irq_enable()

    commit 6b1e0651e9ce8ce418ad4ff360e7b9925dc5da79 upstream.

    It is possible that an interrupt is disabled and masked at the same time.
    When the interrupt is enabled again by enable_irq(), only plic_irq_enable()
    is called, not plic_irq_unmask(). The interrupt remains masked and never
    raises.

    An example where interrupt is both disabled and masked is when
    handle_fasteoi_irq() is the handler, and IRQS_ONESHOT is set. The interrupt
    handler:

      1. Mask the interrupt
      2. Handle the interrupt
      3. Check if interrupt is still enabled, and unmask it (see
         cond_unmask_eoi_irq())

    If another task disables the interrupt in the middle of the above steps,
    the interrupt will not get unmasked, and will remain masked when it is
    enabled in the future.

    The problem is occasionally observed when PREEMPT_RT is enabled, because
    PREEMPT_RT adds the IRQS_ONESHOT flag. But PREEMPT_RT only makes the problem
    more likely to appear, the bug has been around since commit a1706a1c5062
    ("irqchip/sifive-plic: Separate the enable and mask operations").

    Fix it by unmasking interrupt in plic_irq_enable().

    Fixes: a1706a1c5062 ("irqchip/sifive-plic: Separate the enable and mask operations")
    Signed-off-by: Nam Cao <namcao@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241003084152.2422969-1-namcao@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 01282ab5182f85e42234df2ff42f0ce790f465ff
Author: Marc Zyngier <maz@kernel.org>
Date:   Wed Oct 2 21:49:59 2024 +0100

    irqchip/gic-v4: Don't allow a VMOVP on a dying VPE

    commit 1442ee0011983f0c5c4b92380e6853afb513841a upstream.

    Kunkun Jiang reported that there is a small window of opportunity for
    userspace to force a change of affinity for a VPE while the VPE has already
    been unmapped, but the corresponding doorbell interrupt still visible in
    /proc/irq/.

    Plug the race by checking the value of vmapp_count, which tracks whether
    the VPE is mapped ot not, and returning an error in this case.

    This involves making vmapp_count common to both GICv4.1 and its v4.0
    ancestor.

    Fixes: 64edfaa9a234 ("irqchip/gic-v4.1: Implement the v4.1 flavour of VMAPP")
    Reported-by: Kunkun Jiang <jiangkunkun@huawei.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/c182ece6-2ba0-ce4f-3404-dba7a3ab6c52@huawei.com
    Link: https://lore.kernel.org/all/20241002204959.2051709-1-maz@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fad940e2dd789155f99ecafa71a7baf6f96530bc
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Thu Sep 5 10:09:17 2024 +0800

    pinctrl: apple: check devm_kasprintf() returned value

    commit 665a58fe663ac7a9ea618dc0b29881649324b116 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/20240905020917.356534-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3b36bb1fca2b87f6292ca2a8593f297c5e9fab41
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Fri Sep 6 18:03:26 2024 +0800

    pinctrl: stm32: check devm_kasprintf() returned value

    commit b0f0e3f0552a566def55c844b0d44250c58e4df6 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: 32c170ff15b0 ("pinctrl: stm32: set default gpio line names using pin names")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Link: https://lore.kernel.org/20240906100326.624445-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 20728e86289ab463b99b7ab4425515bd26aba417
Author: Sergey Matsievskiy <matsievskiysv@gmail.com>
Date:   Sat Oct 12 13:57:43 2024 +0300

    pinctrl: ocelot: fix system hang on level based interrupts

    commit 93b8ddc54507a227087c60a0013ed833b6ae7d3c upstream.

    The current implementation only calls chained_irq_enter() and
    chained_irq_exit() if it detects pending interrupts.

    ```
    for (i = 0; i < info->stride; i++) {
    	uregmap_read(info->map, id_reg + 4 * i, &reg);
    	if (!reg)
    		continue;

    	chained_irq_enter(parent_chip, desc);
    ```

    However, in case of GPIO pin configured in level mode and the parent
    controller configured in edge mode, GPIO interrupt might be lowered by the
    hardware. In the result, if the interrupt is short enough, the parent
    interrupt is still pending while the GPIO interrupt is cleared;
    chained_irq_enter() never gets called and the system hangs trying to
    service the parent interrupt.

    Moving chained_irq_enter() and chained_irq_exit() outside the for loop
    ensures that they are called even when GPIO interrupt is lowered by the
    hardware.

    The similar code with chained_irq_enter() / chained_irq_exit() functions
    wrapping interrupt checking loop may be found in many other drivers:
    ```
    grep -r -A 10 chained_irq_enter drivers/pinctrl
    ```

    Cc: stable@vger.kernel.org
    Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
    Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Link: https://lore.kernel.org/20241012105743.12450-2-matsievskiysv@gmail.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 481b477ab63c7245715a3e57ba79eb87c2dc0d02
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Sep 26 09:10:31 2024 -0700

    x86/bugs: Use code segment selector for VERW operand

    commit e4d2102018542e3ae5e297bc6e229303abff8a0f upstream.

    Robert Gill reported below #GP in 32-bit mode when dosemu software was
    executing vm86() system call:

      general protection fault: 0000 [#1] PREEMPT SMP
      CPU: 4 PID: 4610 Comm: dosemu.bin Not tainted 6.6.21-gentoo-x86 #1
      Hardware name: Dell Inc. PowerEdge 1950/0H723K, BIOS 2.7.0 10/30/2010
      EIP: restore_all_switch_stack+0xbe/0xcf
      EAX: 00000000 EBX: 00000000 ECX: 00000000 EDX: 00000000
      ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: ff8affdc
      DS: 0000 ES: 0000 FS: 0000 GS: 0033 SS: 0068 EFLAGS: 00010046
      CR0: 80050033 CR2: 00c2101c CR3: 04b6d000 CR4: 000406d0
      Call Trace:
       show_regs+0x70/0x78
       die_addr+0x29/0x70
       exc_general_protection+0x13c/0x348
       exc_bounds+0x98/0x98
       handle_exception+0x14d/0x14d
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf

    This only happens in 32-bit mode when VERW based mitigations like MDS/RFDS
    are enabled. This is because segment registers with an arbitrary user value
    can result in #GP when executing VERW. Intel SDM vol. 2C documents the
    following behavior for VERW instruction:

      #GP(0) - If a memory operand effective address is outside the CS, DS, ES,
    	   FS, or GS segment limit.

    CLEAR_CPU_BUFFERS macro executes VERW instruction before returning to user
    space. Use %cs selector to reference VERW operand. This ensures VERW will
    not #GP for an arbitrary user %ds.

    [ mingo: Fixed the SOB chain. ]

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Robert Gill <rtgill82@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com
    Cc: stable@vger.kernel.org # 5.10+
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218707
    Closes: https://lore.kernel.org/all/8c77ccfd-d561-45a1-8ed5-6b75212c7a58@leemhuis.info/
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Suggested-by: Brian Gerst <brgerst@gmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c29f192e0d44cc1cbaf698fa1ff198f63556691a
Author: Longlong Xia <xialonglong@kylinos.cn>
Date:   Thu Sep 26 21:02:13 2024 +0800

    tty: n_gsm: Fix use-after-free in gsm_cleanup_mux

    commit 9462f4ca56e7d2430fdb6dcc8498244acbfc4489 upstream.

    BUG: KASAN: slab-use-after-free in gsm_cleanup_mux+0x77b/0x7b0
    drivers/tty/n_gsm.c:3160 [n_gsm]
    Read of size 8 at addr ffff88815fe99c00 by task poc/3379
    CPU: 0 UID: 0 PID: 3379 Comm: poc Not tainted 6.11.0+ #56
    Hardware name: VMware, Inc. VMware Virtual Platform/440BX
    Desktop Reference Platform, BIOS 6.00 11/12/2020
    Call Trace:
     <TASK>
     gsm_cleanup_mux+0x77b/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     __pfx_gsm_cleanup_mux+0x10/0x10 drivers/tty/n_gsm.c:3124 [n_gsm]
     __pfx_sched_clock_cpu+0x10/0x10 kernel/sched/clock.c:389
     update_load_avg+0x1c1/0x27b0 kernel/sched/fair.c:4500
     __pfx_min_vruntime_cb_rotate+0x10/0x10 kernel/sched/fair.c:846
     __rb_insert_augmented+0x492/0xbf0 lib/rbtree.c:161
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     _raw_spin_lock_irqsave+0x92/0xf0 arch/x86/include/asm/atomic.h:107
     __pfx_gsmld_ioctl+0x10/0x10 drivers/tty/n_gsm.c:3822 [n_gsm]
     ktime_get+0x5e/0x140 kernel/time/timekeeping.c:195
     ldsem_down_read+0x94/0x4e0 arch/x86/include/asm/atomic64_64.h:79
     __pfx_ldsem_down_read+0x10/0x10 drivers/tty/tty_ldsem.c:338
     __pfx_do_vfs_ioctl+0x10/0x10 fs/ioctl.c:805
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    Allocated by task 65:
     gsm_data_alloc.constprop.0+0x27/0x190 drivers/tty/n_gsm.c:926 [n_gsm]
     gsm_send+0x2c/0x580 drivers/tty/n_gsm.c:819 [n_gsm]
     gsm1_receive+0x547/0xad0 drivers/tty/n_gsm.c:3038 [n_gsm]
     gsmld_receive_buf+0x176/0x280 drivers/tty/n_gsm.c:3609 [n_gsm]
     tty_ldisc_receive_buf+0x101/0x1e0 drivers/tty/tty_buffer.c:391
     tty_port_default_receive_buf+0x61/0xa0 drivers/tty/tty_port.c:39
     flush_to_ldisc+0x1b0/0x750 drivers/tty/tty_buffer.c:445
     process_scheduled_works+0x2b0/0x10d0 kernel/workqueue.c:3229
     worker_thread+0x3dc/0x950 kernel/workqueue.c:3391
     kthread+0x2a3/0x370 kernel/kthread.c:389
     ret_from_fork+0x2d/0x70 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:257

    Freed by task 3367:
     kfree+0x126/0x420 mm/slub.c:4580
     gsm_cleanup_mux+0x36c/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    [Analysis]
    gsm_msg on the tx_ctrl_list or tx_data_list of gsm_mux
    can be freed by multi threads through ioctl,which leads
    to the occurrence of uaf. Protect it by gsm tx lock.

    Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>
    Cc: stable <stable@kernel.org>
    Suggested-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20240926130213.531959-1-xialonglong@kylinos.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 227358e89703c344008119be7e8ffa3fdb5b92de
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:44 2024 -0700

    x86/entry_32: Clear CPU buffers after register restore in NMI return

    commit 48a2440d0f20c826b884e04377ccc1e4696c84e9 upstream.

    CPU buffers are currently cleared after call to exc_nmi, but before
    register state is restored. This may be okay for MDS mitigation but not for
    RDFS. Because RDFS mitigation requires CPU buffers to be cleared when
    registers don't have any sensitive data.

    Move CLEAR_CPU_BUFFERS after RESTORE_ALL_NMI.

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-2-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c6a7e2c6012cee8273f2b7c1a335a609f8a73b7
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:38 2024 -0700

    x86/entry_32: Do not clobber user EFLAGS.ZF

    commit 2e2e5143d4868163d6756c8c6a4d28cbfa5245e5 upstream.

    Opportunistic SYSEXIT executes VERW to clear CPU buffers after user EFLAGS
    are restored. This can clobber user EFLAGS.ZF.

    Move CLEAR_CPU_BUFFERS before the user EFLAGS are restored. This ensures
    that the user EFLAGS.ZF is not clobbered.

    Closes: https://lore.kernel.org/lkml/yVXwe8gvgmPADpRB6lXlicS2fcHoV5OHHxyuFbB_MEleRPD7-KhGe5VtORejtPe-KCkT8Uhcg5d7-IBw4Ojb4H7z5LQxoZylSmJ8KNL3A8o=@protonmail.com/
    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Jari Ruusu <jariruusu@protonmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-1-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c8170b5ddc411201f8de0a654901f204a2cdd415
Author: John Allen <john.allen@amd.com>
Date:   Mon Sep 23 16:44:04 2024 +0000

    x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load

    commit ee4d4e8d2c3bec6ee652599ab31991055a72c322 upstream.

    Commit

      f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")

    causes a bit in the DE_CFG MSR to get set erroneously after a microcode late
    load.

    The microcode late load path calls into amd_check_microcode() and subsequently
    zen2_zenbleed_check(). Since the above commit removes the cpu_has_amd_erratum()
    call from zen2_zenbleed_check(), this will cause all non-Zen2 CPUs to go
    through the function and set the bit in the DE_CFG MSR.

    Call into the Zenbleed fix path on Zen2 CPUs only.

      [ bp: Massage commit message, use cpu_feature_enabled(). ]

    Fixes: f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")
    Signed-off-by: John Allen <john.allen@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20240923164404.27227-1-john.allen@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6663f0c658857e9ebb87ed6b98c0126bbaa2bf46
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Tue Oct 15 14:15:22 2024 +0800

    x86/apic: Always explicitly disarm TSC-deadline timer

    commit ffd95846c6ec6cf1f93da411ea10d504036cab42 upstream.

    New processors have become pickier about the local APIC timer state
    before entering low power modes. These low power modes are used (for
    example) when you close your laptop lid and suspend. If you put your
    laptop in a bag and it is not in this low power mode, it is likely
    to get quite toasty while it quickly sucks the battery dry.

    The problem boils down to some CPUs' inability to power down until the
    CPU recognizes that the local APIC timer is shut down. The current
    kernel code works in one-shot and periodic modes but does not work for
    deadline mode. Deadline mode has been the supported and preferred mode
    on Intel CPUs for over a decade and uses an MSR to drive the timer
    instead of an APIC register.

    Disable the TSC Deadline timer in lapic_timer_shutdown() by writing to
    MSR_IA32_TSC_DEADLINE when in TSC-deadline mode. Also avoid writing
    to the initial-count register (APIC_TMICT) which is ignored in
    TSC-deadline mode.

    Note: The APIC_LVTT|=APIC_LVT_MASKED operation should theoretically be
    enough to tell the hardware that the timer will not fire in any of the
    timer modes. But mitigating AMD erratum 411[1] also requires clearing
    out APIC_TMICT. Solely setting APIC_LVT_MASKED is also ineffective in
    practice on Intel Lunar Lake systems, which is the motivation for this
    change.

    1. 411 Processor May Exit Message-Triggered C1E State Without an Interrupt if Local APIC Timer Reaches Zero - https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/revision-guides/41322_10h_Rev_Gd.pdf

    Fixes: 279f1461432c ("x86: apic: Use tsc deadline for oneshot when available")
    Suggested-by: Dave Hansen <dave.hansen@intel.com>
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Tested-by: Todd Brandt <todd.e.brandt@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241015061522.25288-1-rui.zhang%40intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 16d7d35f1c1e2a3a5cb14c91fe0f1922068942c9
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Sep 17 09:02:53 2024 -0700

    x86/resctrl: Annotate get_mem_config() functions as __init

    commit d5fd042bf4cfb557981d65628e1779a492cd8cfa upstream.

    After a recent LLVM change [1] that deduces __cold on functions that only call
    cold code (such as __init functions), there is a section mismatch warning from
    __get_mem_config_intel(), which got moved to .text.unlikely. as a result of
    that optimization:

      WARNING: modpost: vmlinux: section mismatch in reference: \
      __get_mem_config_intel+0x77 (section: .text.unlikely.) -> thread_throttle_mode_init (section: .init.text)

    Mark __get_mem_config_intel() as __init as well since it is only called
    from __init code, which clears up the warning.

    While __rdt_get_mem_config_amd() does not exhibit a warning because it
    does not call any __init code, it is a similar function that is only
    called from __init code like __get_mem_config_intel(), so mark it __init
    as well to keep the code symmetrical.

    CONFIG_SECTION_MISMATCH_WARN_ONLY=n would turn this into a fatal error.

    Fixes: 05b93417ce5b ("x86/intel_rdt/mba: Add primary support for Memory Bandwidth Allocation (MBA)")
    Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature")
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Cc: <stable@kernel.org>
    Link: https://github.com/llvm/llvm-project/commit/6b11573b8c5e3d36beee099dbe7347c2a007bf53 [1]
    Link: https://lore.kernel.org/r/20240917-x86-restctrl-get_mem_config_intel-init-v3-1-10d521256284@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 66029078fee00646e2e9dbb8f41ff7819f8e7569
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Sep 20 12:32:19 2024 +0200

    parport: Proper fix for array out-of-bounds access

    commit 02ac3a9ef3a18b58d8f3ea2b6e46de657bf6c4f9 upstream.

    The recent fix for array out-of-bounds accesses replaced sprintf()
    calls blindly with snprintf().  However, since snprintf() returns the
    would-be-printed size, not the actually output size, the length
    calculation can still go over the given limit.

    Use scnprintf() instead of snprintf(), which returns the actually
    output letters, for addressing the potential out-of-bounds access
    properly.

    Fixes: ab11dac93d2d ("dev/parport: fix the array out-of-bounds risk")
    Cc: stable@vger.kernel.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://lore.kernel.org/r/20240920103318.19271-1-tiwai@suse.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c895d48c843dee8baf5327dee33ce786760c9d44
Author: Marek Vasut <marex@denx.de>
Date:   Wed Oct 2 20:40:38 2024 +0200

    serial: imx: Update mctrl old_status on RTSD interrupt

    commit 40d7903386df4d18f04d90510ba90eedee260085 upstream.

    When sending data using DMA at high baudrate (4 Mbdps in local test case) to
    a device with small RX buffer which keeps asserting RTS after every received
    byte, it is possible that the iMX UART driver would not recognize the falling
    edge of RTS input signal and get stuck, unable to transmit any more data.

    This condition happens when the following sequence of events occur:
    - imx_uart_mctrl_check() is called at some point and takes a snapshot of UART
      control signal status into sport->old_status using imx_uart_get_hwmctrl().
      The RTSS/TIOCM_CTS bit is of interest here (*).
    - DMA transfer occurs, the remote device asserts RTS signal after each byte.
      The i.MX UART driver recognizes each such RTS signal change, raises an
      interrupt with USR1 register RTSD bit set, which leads to invocation of
      __imx_uart_rtsint(), which calls uart_handle_cts_change().
      - If the RTS signal is deasserted, uart_handle_cts_change() clears
        port->hw_stopped and unblocks the port for further data transfers.
      - If the RTS is asserted, uart_handle_cts_change() sets port->hw_stopped
        and blocks the port for further data transfers. This may occur as the
        last interrupt of a transfer, which means port->hw_stopped remains set
        and the port remains blocked (**).
    - Any further data transfer attempts will trigger imx_uart_mctrl_check(),
      which will read current status of UART control signals by calling
      imx_uart_get_hwmctrl() (***) and compare it with sport->old_status .
      - If current status differs from sport->old_status for RTS signal,
        uart_handle_cts_change() is called and possibly unblocks the port
        by clearing port->hw_stopped .
      - If current status does not differ from sport->old_status for RTS
        signal, no action occurs. This may occur in case prior snapshot (*)
        was taken before any transfer so the RTS is deasserted, current
        snapshot (***) was taken after a transfer and therefore RTS is
        deasserted again, which means current status and sport->old_status
        are identical. In case (**) triggered when RTS got asserted, and
        made port->hw_stopped set, the port->hw_stopped will remain set
        because no change on RTS line is recognized by this driver and
        uart_handle_cts_change() is not called from here to unblock the
        port->hw_stopped.

    Update sport->old_status in __imx_uart_rtsint() accordingly to make
    imx_uart_mctrl_check() detect such RTS change. Note that TIOCM_CAR
    and TIOCM_RI bits in sport->old_status do not suffer from this problem.

    Fixes: ceca629e0b48 ("[ARM] 2971/1: i.MX uart handle rts irq")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Esben Haabendal <esben@geanix.com>
    Signed-off-by: Marek Vasut <marex@denx.de>
    Link: https://lore.kernel.org/r/20241002184133.19427-1-marex@denx.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 245bee12a52d55312aa3948ddae6887788566893
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:22 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for OTP device

    commit 2471787c1f0dae6721f60ab44be37460635d3732 upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 0969001569e4 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-2-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 78df42183e824d368e5d45169c6b7c506d81f690
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:20 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for EEPROM device

    commit 3c2d73de49be528276474c1a53f78b38ee11c1fa upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 9ab5465349c0 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX EEPROM via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-1-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3d3501cf896cd6b75f9b018d59247322ac5a4eb
Author: Prashanth K <quic_prashk@quicinc.com>
Date:   Tue Sep 24 15:02:08 2024 +0530

    usb: dwc3: Wait for EndXfer completion before restoring GUSB2PHYCFG

    commit c96e31252110a84dcc44412e8a7b456b33c3e298 upstream.

    DWC3 programming guide mentions that when operating in USB2.0 speeds,
    if GUSB2PHYCFG[6] or GUSB2PHYCFG[8] is set, it must be cleared prior
    to issuing commands and may be set again  after the command completes.
    But currently while issuing EndXfer command without CmdIOC set, we
    wait for 1ms after GUSB2PHYCFG is restored. This results in cases
    where EndXfer command doesn't get completed and causes SMMU faults
    since requests are unmapped afterwards. Hence restore GUSB2PHYCFG
    after waiting for EndXfer command completion.

    Cc: stable@vger.kernel.org
    Fixes: 1d26ba0944d3 ("usb: dwc3: Wait unconditionally after issuing EndXfer command")
    Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20240924093208.2524531-1-quic_prashk@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 479830f6c15b1a3e3c1488762a8a3bcf93e2b94f
Author: Jonathan Marek <jonathan@marek.ca>
Date:   Sat Oct 5 10:41:46 2024 -0400

    usb: typec: qcom-pmic-typec: fix sink status being overwritten with RP_DEF

    commit ffe85c24d7ca5de7d57690c0ab194b3838674935 upstream.

    This line is overwriting the result of the above switch-case.

    This fixes the tcpm driver getting stuck in a "Sink TX No Go" loop.

    Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jonathan Marek <jonathan@marek.ca>
    Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20241005144146.2345-1-jonathan@marek.ca
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 86c68aa714d0e5082ccee8f0679cb69821cf8339
Author: Daniele Palmas <dnlplm@gmail.com>
Date:   Thu Oct 3 11:38:08 2024 +0200

    USB: serial: option: add Telit FN920C04 MBIM compositions

    commit 6d951576ee16430822a8dee1e5c54d160e1de87d upstream.

    Add the following Telit FN920C04 compositions:

    0x10a2: MBIM + tty (AT/NMEA) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 17 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a2 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10a7: MBIM + tty (AT) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 18 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a7 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10aa: MBIM + tty (AT) + tty (diag) + DPL (data packet logging) + adb
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 15 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10aa Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90a5c64279ae5b906604cfb3809a25fb2d91d674
Author: Benjamin B. Frost <benjamin@geanix.com>
Date:   Wed Sep 11 10:54:05 2024 +0200

    USB: serial: option: add support for Quectel EG916Q-GL

    commit 540eff5d7faf0c9330ec762da49df453263f7676 upstream.

    Add Quectel EM916Q-GL with product ID 0x6007

    T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=6007 Rev= 2.00
    S:  Manufacturer=Quectel
    S:  Product=EG916Q-GL
    C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=200mA
    A:  FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=84(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=86(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=88(I) Atr=03(Int.) MxPS=  32 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    I:* If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    MI_00 Quectel USB Diag Port
    MI_01 Quectel USB NMEA Port
    MI_02 Quectel USB AT Port
    MI_03 Quectel USB Modem Port
    MI_04 Quectel USB Net Port

    Signed-off-by: Benjamin B. Frost <benjamin@geanix.com>
    Reviewed-by: Lars Melin <larsm17@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 53cd1bb1f8ebf961a7be197734465893a8930a58
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:58 2024 +0300

    xhci: Mitigate failed set dequeue pointer commands

    commit fe49df60cdb7c2975aa743dc295f8786e4b7db10 upstream.

    Avoid xHC host from processing a cancelled URB by always turning
    cancelled URB TDs into no-op TRBs before queuing a 'Set TR Deq' command.

    If the command fails then xHC will start processing the cancelled TD
    instead of skipping it once endpoint is restarted, causing issues like
    Babble error.

    This is not a complete solution as a failed 'Set TR Deq' command does not
    guarantee xHC TRB caches are cleared.

    Fixes: 4db356924a50 ("xhci: turn cancelled td cleanup to its own function")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-3-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc7b7050996ac46a7236864a3c86adfd69829a14
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:57 2024 +0300

    xhci: Fix incorrect stream context type macro

    commit 6599b6a6fa8060145046d0744456b6abdb3122a7 upstream.

    The stream contex type (SCT) bitfield is used both in the stream context
    data structure,  and in the 'Set TR Dequeue pointer' command TRB.
    In both cases it uses bits 3:1

    The SCT_FOR_TRB(p) macro used to set the stream context type (SCT) field
    for the 'Set TR Dequeue pointer' command TRB incorrectly shifts the value
    1 bit left before masking the three bits.

    Fix this by first masking and rshifting, just like the similar
    SCT_FOR_CTX(p) macro does

    This issue has not been visibile as the lost bit 3 is only used with
    secondary stream arrays (SSA). Xhci driver currently only supports using
    a primary stream array with Linear stream addressing.

    Fixes: 95241dbdf828 ("xhci: Set SCT field for Set TR dequeue on streams")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9c696bf4ab54c7cec81221887564305f0ceeac0a
Author: Henry Lin <henryl@nvidia.com>
Date:   Mon Oct 14 12:21:34 2024 +0800

    xhci: tegra: fix checked USB2 port number

    commit 7d381137cb6ecf558ef6698c7730ddd482d4c8f2 upstream.

    If USB virtualizatoin is enabled, USB2 ports are shared between all
    Virtual Functions. The USB2 port number owned by an USB2 root hub in
    a Virtual Function may be less than total USB2 phy number supported
    by the Tegra XUSB controller.

    Using total USB2 phy number as port number to check all PORTSC values
    would cause invalid memory access.

    [  116.923438] Unable to handle kernel paging request at virtual address 006c622f7665642f
    ...
    [  117.213640] Call trace:
    [  117.216783]  tegra_xusb_enter_elpg+0x23c/0x658
    [  117.222021]  tegra_xusb_runtime_suspend+0x40/0x68
    [  117.227260]  pm_generic_runtime_suspend+0x30/0x50
    [  117.232847]  __rpm_callback+0x84/0x3c0
    [  117.237038]  rpm_suspend+0x2dc/0x740
    [  117.241229] pm_runtime_work+0xa0/0xb8
    [  117.245769]  process_scheduled_works+0x24c/0x478
    [  117.251007]  worker_thread+0x23c/0x328
    [  117.255547]  kthread+0x104/0x1b0
    [  117.259389]  ret_from_fork+0x10/0x20
    [  117.263582] Code: 54000222 f9461ae8 f8747908 b4ffff48 (f9400100)

    Cc: stable@vger.kernel.org # v6.3+
    Fixes: a30951d31b25 ("xhci: tegra: USB2 pad power controls")
    Signed-off-by: Henry Lin <henryl@nvidia.com>
    Link: https://lore.kernel.org/r/20241014042134.27664-1-henryl@nvidia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc2d5f02636c7587bdd6d1f60fc59c55860b00a4
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Fri Oct 11 02:46:19 2024 +0900

    vt: prevent kernel-infoleak in con_font_get()

    commit f956052e00de211b5c9ebaa1958366c23f82ee9e upstream.

    font.data may not initialize all memory spaces depending on the implementation
    of vc->vc_sw->con_font_get. This may cause info-leak, so to prevent this, it
    is safest to modify it to initialize the allocated memory space to 0, and it
    generally does not affect the overall performance of the system.

    Cc: stable@vger.kernel.org
    Reported-by: syzbot+955da2d57931604ee691@syzkaller.appspotmail.com
    Fixes: 05e2600cb0a4 ("VT: Bump font size limitation to 64x128 pixels")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Link: https://lore.kernel.org/r/20241010174619.59662-1-aha310510@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 885f8c873fedf3393c76827c4821071bf5fd16b1
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Oct 16 11:47:00 2024 -0400

    Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001

    commit 2c1dda2acc4192d826e84008d963b528e24d12bc upstream.

    Fake CSR controllers don't seem to handle short-transfer properly which
    cause command to time out:

    kernel: usb 1-1: new full-speed USB device number 19 using xhci_hcd
    kernel: usb 1-1: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
    kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    kernel: usb 1-1: Product: BT DONGLE10
    ...
    Bluetooth: hci1: Opcode 0x1004 failed: -110
    kernel: Bluetooth: hci1: command 0x1004 tx timeout

    According to USB Spec 2.0 Section 5.7.3 Interrupt Transfer Packet Size
    Constraints a interrupt transfer is considered complete when the size is 0
    (ZPL) or < wMaxPacketSize:

     'When an interrupt transfer involves more data than can fit in one
     data payload of the currently established maximum size, all data
     payloads are required to be maximum-sized except for the last data
     payload, which will contain the remaining data. An interrupt transfer
     is complete when the endpoint does one of the following:

     • Has transferred exactly the amount of data expected
     • Transfers a packet with a payload size less than wMaxPacketSize or
     transfers a zero-length packet'

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=219365
    Fixes: 7b05933340f4 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8fb8e912afb4c47dec12ea9a5853e7a8db95816f
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:08 2024 +0000

    Bluetooth: ISO: Fix multiple init when debugfs is disabled

    commit a9b7b535ba192c6b77e6c15a4c82d853163eab8c upstream.

    If bt_debugfs is not created successfully, which happens if either
    CONFIG_DEBUG_FS or CONFIG_DEBUG_FS_ALLOW_ALL is unset, then iso_init()
    returns early and does not set iso_inited to true. This means that a
    subsequent call to iso_init() will result in duplicate calls to
    proto_register(), bt_sock_register(), etc.

    With CONFIG_LIST_HARDENED and CONFIG_BUG_ON_DATA_CORRUPTION enabled, the
    duplicate call to proto_register() triggers this BUG():

      list_add double add: new=ffffffffc0b280d0, prev=ffffffffbab56250,
        next=ffffffffc0b280d0.
      ------------[ cut here ]------------
      kernel BUG at lib/list_debug.c:35!
      Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI
      CPU: 2 PID: 887 Comm: bluetoothd Not tainted 6.10.11-1-ao-desktop #1
      RIP: 0010:__list_add_valid_or_report+0x9a/0xa0
      ...
        __list_add_valid_or_report+0x9a/0xa0
        proto_register+0x2b5/0x340
        iso_init+0x23/0x150 [bluetooth]
        set_iso_socket_func+0x68/0x1b0 [bluetooth]
        kmem_cache_free+0x308/0x330
        hci_sock_sendmsg+0x990/0x9e0 [bluetooth]
        __sock_sendmsg+0x7b/0x80
        sock_write_iter+0x9a/0x110
        do_iter_readv_writev+0x11d/0x220
        vfs_writev+0x180/0x3e0
        do_writev+0xca/0x100
      ...

    This change removes the early return. The check for iso_debugfs being
    NULL was unnecessary, it is always NULL when iso_inited is false.

    Cc: stable@vger.kernel.org
    Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
    Signed-off-by: Aaron Thompson <dev@aaront.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 59bd80df4b88e28e37524105b3ec1853bae32713
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:10 2024 +0000

    Bluetooth: Remove debugfs directory on module init failure

    commit 1db4564f101b47188c1b71696bd342ef09172b22 upstream.

    If bt_init() fails, the debugfs directory currently is not removed. If
    the module is loaded again after that, the debugfs directory is not set
    up properly due to the existing directory.

      # modprobe bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:26 ./
      drwx------ 31 root root 0 Sep 27 14:25 ../
      -r--r--r--  1 root root 0 Sep 27 14:26 l2cap
      -r--r--r--  1 root root 0 Sep 27 14:26 sco
      # modprobe -r bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      ls: cannot access '/sys/kernel/debug/bluetooth': No such file or directory
      #

      # modprobe bluetooth
      modprobe: ERROR: could not insert 'bluetooth': Invalid argument
      # dmesg | tail -n 6
      Bluetooth: Core ver 2.22
      NET: Registered PF_BLUETOOTH protocol family
      Bluetooth: HCI device and connection manager initialized
      Bluetooth: HCI socket layer initialized
      Bluetooth: Faking l2cap_init() failure for testing
      NET: Unregistered PF_BLUETOOTH protocol family
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:31 ./
      drwx------ 31 root roo…
qaz6750 added a commit that referenced this pull request Nov 24, 2024
commit 9b5aad3a7498c261116a0251fe57f14ba9c4c6cf
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Nov 8 16:28:28 2024 +0100

    Linux 6.6.60

    Link: https://lore.kernel.org/r/20241106120308.841299741@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Hardik Garg <hargar@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc082e50375a29596153fc3f1f8fc85ad1b0b5b9
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date:   Thu Sep 5 15:03:48 2024 +0300

    fs/ntfs3: Sequential field availability check in mi_enum_attr()

    commit 090f612756a9720ec18b0b130e28be49839d7cb5 upstream.

    The code is slightly reformatted to consistently check field availability
    without duplication.

    Fixes: 556bdf27c2dd ("ntfs3: Add bounds checking to mi_enum_attr()")
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10c20d79d59cadfe572480d98cec271a89ffb024
Author: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Date:   Mon May 27 20:15:21 2024 +0530

    drm/amd/display: Add null checks for 'stream' and 'plane' before dereferencing

    commit 15c2990e0f0108b9c3752d7072a97d45d4283aea upstream.

    This commit adds null checks for the 'stream' and 'plane' variables in
    the dcn30_apply_idle_power_optimizations function. These variables were
    previously assumed to be null at line 922, but they were used later in
    the code without checking if they were null. This could potentially lead
    to a null pointer dereference, which would cause a crash.

    The null checks ensure that 'stream' and 'plane' are not null before
    they are used, preventing potential crashes.

    Fixes the below static smatch checker:
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:938 dcn30_apply_idle_power_optimizations() error: we previously assumed 'stream' could be null (see line 922)
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:940 dcn30_apply_idle_power_optimizations() error: we previously assumed 'plane' could be null (see line 922)

    Cc: Tom Chung <chiahsuan.chung@amd.com>
    Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
    Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Cc: Roman Li <roman.li@amd.com>
    Cc: Hersen Wu <hersenxs.wu@amd.com>
    Cc: Alex Hung <alex.hung@amd.com>
    Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Cc: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    [Xiangyu: Modified file path to backport this commit]
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e979a6a626abf1358a5bb79219eea82ac160d3d3
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:15 2023 +0300

    ASoC: SOF: ipc4-control: Add support for ALSA enum control

    commit 07a866a41982c896dc46476f57d209a200602946 upstream.

    Enum controls use generic param_id and a generic struct where the data
    is passed to the firmware.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-4-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3facc0417d3d7b3ba5822e74155bcb1267ce62c1
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:14 2023 +0300

    ASoC: SOF: ipc4-control: Add support for ALSA switch control

    commit 4a2fd607b7ca6128ee3532161505da7624197f55 upstream.

    Volume controls with a max value of 1 are switches.
    Switch controls use generic param_id and a generic struct where the data
    is passed to the firmware.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-3-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f01d8fc623711046e1efee00827bff6d5882cdfd
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:13 2023 +0300

    ASoC: SOF: ipc4-topology: Add definition for generic switch/enum control

    commit 060a07cd9bc69eba2da33ed96b1fa69ead60bab1 upstream.

    Currently IPC4 has no notion of a switch or enum type of control which is
    a generic concept in ALSA.

    The generic support for these control types will be as follows:
    - large config is used to send the channel-value par array
    - param_id of a SWITCH type is 200
    - param_id of an ENUM type is 201

    Each module need to support a switch or/and enum must handle these
    universal param_ids.
    The message payload is described by struct sof_ipc4_control_msg_payload.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-2-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d54afaef6570c277070c3cafe1ed73dcdc129e0a
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Tue Sep 19 11:35:15 2023 -0400

    SUNRPC: Remove BUG_ON call sites

    commit 789ce196a31dd13276076762204bee87df893e53 upstream.

    There is no need to take down the whole system for these assertions.

    I'd rather not attempt a heroic save here, as some bug has occurred
    that has left the transport data structures in an unknown state.
    Just warn and then leak the left-over resources.

    Acked-by: Christian Brauner <brauner@kernel.org>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27a58a19bd20a7afe369da2ce6d4ebea70768acd
Author: Michael Walle <mwalle@kernel.org>
Date:   Fri Jun 21 14:09:29 2024 +0200

    mtd: spi-nor: winbond: fix w25q128 regression

    commit d35df77707bf5ae1221b5ba1c8a88cf4fcdd4901 upstream.

    Commit 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128")
    removed the flags for non-SFDP devices. It was assumed that it wasn't in
    use anymore. This wasn't true. Add the no_sfdp_flags as well as the size
    again.

    We add the additional flags for dual and quad read because they have
    been reported to work properly by Hartmut using both older and newer
    versions of this flash, the similar flashes with 64Mbit and 256Mbit
    already have these flags and because it will (luckily) trigger our
    legacy SFDP parsing, so newer versions with SFDP support will still get
    the parameters from the SFDP tables.

    Reported-by: Hartmut Birr <e9hack@gmail.com>
    Closes: https://lore.kernel.org/r/CALxbwRo_-9CaJmt7r7ELgu+vOcgk=xZcGHobnKf=oT2=u4d4aA@mail.gmail.com/
    Fixes: 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128")
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Michael Walle <mwalle@kernel.org>
    Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Reviewed-by: Esben Haabendal <esben@geanix.com>
    Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
    Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
    Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org
    Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org
    [Backported to v6.6 - vastly different due to upstream changes]
    Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3d544942c0010feedc048b048ee0c35d2d921100
Author: David Hildenbrand <david@redhat.com>
Date:   Fri Oct 11 12:24:45 2024 +0200

    mm: don't install PMD mappings when THPs are disabled by the hw/process/vma

    commit 2b0f922323ccfa76219bcaacd35cd50aeaa13592 upstream.

    We (or rather, readahead logic :) ) might be allocating a THP in the
    pagecache and then try mapping it into a process that explicitly disabled
    THP: we might end up installing PMD mappings.

    This is a problem for s390x KVM, which explicitly remaps all PMD-mapped
    THPs to be PTE-mapped in s390_enable_sie()->thp_split_mm(), before
    starting the VM.

    For example, starting a VM backed on a file system with large folios
    supported makes the VM crash when the VM tries accessing such a mapping
    using KVM.

    Is it also a problem when the HW disabled THP using
    TRANSPARENT_HUGEPAGE_UNSUPPORTED?  At least on x86 this would be the case
    without X86_FEATURE_PSE.

    In the future, we might be able to do better on s390x and only disallow
    PMD mappings -- what s390x and likely TRANSPARENT_HUGEPAGE_UNSUPPORTED
    really wants.  For now, fix it by essentially performing the same check as
    would be done in __thp_vma_allowable_orders() or in shmem code, where this
    works as expected, and disallow PMD mappings, making us fallback to PTE
    mappings.

    Link: https://lkml.kernel.org/r/20241011102445.934409-3-david@redhat.com
    Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reported-by: Leo Fu <bfu@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Cc: Thomas Huth <thuth@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Janosch Frank <frankja@linux.ibm.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 02ec4b3bba49e8d3abb25a3feba6875cae12da92
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
Date:   Fri Oct 11 12:24:44 2024 +0200

    mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw()

    commit 963756aac1f011d904ddd9548ae82286d3a91f96 upstream.

    Patch series "mm: don't install PMD mappings when THPs are disabled by the
    hw/process/vma".

    During testing, it was found that we can get PMD mappings in processes
    where THP (and more precisely, PMD mappings) are supposed to be disabled.
    While it works as expected for anon+shmem, the pagecache is the
    problematic bit.

    For s390 KVM this currently means that a VM backed by a file located on
    filesystem with large folio support can crash when KVM tries accessing the
    problematic page, because the readahead logic might decide to use a
    PMD-sized THP and faulting it into the page tables will install a PMD
    mapping, something that s390 KVM cannot tolerate.

    This might also be a problem with HW that does not support PMD mappings,
    but I did not try reproducing it.

    Fix it by respecting the ways to disable THPs when deciding whether we can
    install a PMD mapping.  khugepaged should already be taking care of not
    collapsing if THPs are effectively disabled for the hw/process/vma.

    This patch (of 2):

    Add vma_thp_disabled() and thp_disabled_by_hw() helpers to be shared by
    shmem_allowable_huge_orders() and __thp_vma_allowable_orders().

    [david@redhat.com: rename to vma_thp_disabled(), split out thp_disabled_by_hw() ]
    Link: https://lkml.kernel.org/r/20241011102445.934409-2-david@redhat.com
    Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reported-by: Leo Fu <bfu@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Boqiao Fu <bfu@redhat.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Janosch Frank <frankja@linux.ibm.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc621e7a043de346c33bd7ae7e2e0c651d6152ef
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Oct 23 09:17:44 2024 +0200

    wifi: iwlwifi: mvm: fix 6 GHz scan construction

    commit 7245012f0f496162dd95d888ed2ceb5a35170f1a upstream.

    If more than 255 colocated APs exist for the set of all
    APs found during 2.4/5 GHz scanning, then the 6 GHz scan
    construction will loop forever since the loop variable
    has type u8, which can never reach the number found when
    that's bigger than 255, and is stored in a u32 variable.
    Also move it into the loops to have a smaller scope.

    Using a u32 there is fine, we limit the number of APs in
    the scan list and each has a limit on the number of RNR
    entries due to the frame size. With a limit of 1000 scan
    results, a frame size upper bound of 4096 (really it's
    more like ~2300) and a TBTT entry size of at least 11,
    we get an upper bound for the number of ~372k, well in
    the bounds of a u32.

    Cc: stable@vger.kernel.org
    Fixes: eae94cf82d74 ("iwlwifi: mvm: add support for 6GHz")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219375
    Link: https://patch.msgid.link/20241023091744.f4baed5c08a1.I8b417148bbc8c5d11c101e1b8f5bf372e17bf2a7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f2f1fa446676c21edb777e6d2bc4fa8f956fab68
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 18 04:33:10 2024 +0900

    nilfs2: fix kernel bug due to missing clearing of checked flag

    commit 41e192ad2779cae0102879612dfe46726e4396aa upstream.

    Syzbot reported that in directory operations after nilfs2 detects
    filesystem corruption and degrades to read-only,
    __block_write_begin_int(), which is called to prepare block writes, may
    fail the BUG_ON check for accesses exceeding the folio/page size,
    triggering a kernel bug.

    This was found to be because the "checked" flag of a page/folio was not
    cleared when it was discarded by nilfs2's own routine, which causes the
    sanity check of directory entries to be skipped when the directory
    page/folio is reloaded.  So, fix that.

    This was necessary when the use of nilfs2's own page discard routine was
    applied to more than just metadata files.

    Link: https://lkml.kernel.org/r/20241017193359.5051-1-konishi.ryusuke@gmail.com
    Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a53c2d847627b790fb3bd8b00e02c247941b17e0
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
Date:   Mon Jun 17 19:52:17 2024 +0800

    wifi: mac80211: fix NULL dereference at band check in starting tx ba session

    commit 021d53a3d87eeb9dbba524ac515651242a2a7e3b upstream.

    In MLD connection, link_data/link_conf are dynamically allocated. They
    don't point to vif->bss_conf. So, there will be no chanreq assigned to
    vif->bss_conf and then the chan will be NULL. Tweak the code to check
    ht_supported/vht_supported/has_he/has_eht on sta deflink.

    Crash log (with rtw89 version under MLO development):
    [ 9890.526087] BUG: kernel NULL pointer dereference, address: 0000000000000000
    [ 9890.526102] #PF: supervisor read access in kernel mode
    [ 9890.526105] #PF: error_code(0x0000) - not-present page
    [ 9890.526109] PGD 0 P4D 0
    [ 9890.526114] Oops: 0000 [#1] PREEMPT SMP PTI
    [ 9890.526119] CPU: 2 PID: 6367 Comm: kworker/u16:2 Kdump: loaded Tainted: G           OE      6.9.0 #1
    [ 9890.526123] Hardware name: LENOVO 2356AD1/2356AD1, BIOS G7ETB3WW (2.73 ) 11/28/2018
    [ 9890.526126] Workqueue: phy2 rtw89_core_ba_work [rtw89_core]
    [ 9890.526203] RIP: 0010:ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211
    [ 9890.526279] Code: f7 e8 d5 93 3e ea 48 83 c4 28 89 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 49 8b 84 24 e0 f1 ff ff 48 8b 80 90 1b 00 00 <83> 38 03 0f 84 37 fe ff ff bb ea ff ff ff eb cc 49 8b 84 24 10 f3
    All code
    ========
       0:	f7 e8                	imul   %eax
       2:	d5                   	(bad)
       3:	93                   	xchg   %eax,%ebx
       4:	3e ea                	ds (bad)
       6:	48 83 c4 28          	add    $0x28,%rsp
       a:	89 d8                	mov    %ebx,%eax
       c:	5b                   	pop    %rbx
       d:	41 5c                	pop    %r12
       f:	41 5d                	pop    %r13
      11:	41 5e                	pop    %r14
      13:	41 5f                	pop    %r15
      15:	5d                   	pop    %rbp
      16:	c3                   	retq
      17:	cc                   	int3
      18:	cc                   	int3
      19:	cc                   	int3
      1a:	cc                   	int3
      1b:	49 8b 84 24 e0 f1 ff 	mov    -0xe20(%r12),%rax
      22:	ff
      23:	48 8b 80 90 1b 00 00 	mov    0x1b90(%rax),%rax
      2a:*	83 38 03             	cmpl   $0x3,(%rax)		<-- trapping instruction
      2d:	0f 84 37 fe ff ff    	je     0xfffffffffffffe6a
      33:	bb ea ff ff ff       	mov    $0xffffffea,%ebx
      38:	eb cc                	jmp    0x6
      3a:	49                   	rex.WB
      3b:	8b                   	.byte 0x8b
      3c:	84 24 10             	test   %ah,(%rax,%rdx,1)
      3f:	f3                   	repz

    Code starting with the faulting instruction
    ===========================================
       0:	83 38 03             	cmpl   $0x3,(%rax)
       3:	0f 84 37 fe ff ff    	je     0xfffffffffffffe40
       9:	bb ea ff ff ff       	mov    $0xffffffea,%ebx
       e:	eb cc                	jmp    0xffffffffffffffdc
      10:	49                   	rex.WB
      11:	8b                   	.byte 0x8b
      12:	84 24 10             	test   %ah,(%rax,%rdx,1)
      15:	f3                   	repz
    [ 9890.526285] RSP: 0018:ffffb8db09013d68 EFLAGS: 00010246
    [ 9890.526291] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff9308e0d656c8
    [ 9890.526295] RDX: 0000000000000000 RSI: ffffffffab99460b RDI: ffffffffab9a7685
    [ 9890.526300] RBP: ffffb8db09013db8 R08: 0000000000000000 R09: 0000000000000873
    [ 9890.526304] R10: ffff9308e0d64800 R11: 0000000000000002 R12: ffff9308e5ff6e70
    [ 9890.526308] R13: ffff930952500e20 R14: ffff9309192a8c00 R15: 0000000000000000
    [ 9890.526313] FS:  0000000000000000(0000) GS:ffff930b4e700000(0000) knlGS:0000000000000000
    [ 9890.526316] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 9890.526318] CR2: 0000000000000000 CR3: 0000000391c58005 CR4: 00000000001706f0
    [ 9890.526321] Call Trace:
    [ 9890.526324]  <TASK>
    [ 9890.526327] ? show_regs (arch/x86/kernel/dumpstack.c:479)
    [ 9890.526335] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434)
    [ 9890.526340] ? page_fault_oops (arch/x86/mm/fault.c:713)
    [ 9890.526347] ? search_module_extables (kernel/module/main.c:3256 (discriminator 3))
    [ 9890.526353] ? ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211

    Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
    Link: https://patch.msgid.link/20240617115217.22344-1-kevin_yang@realtek.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a91a5816b289018e0b42a25444c0b4f8c637dca
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Apr 10 02:26:54 2024 +0100

    io_uring: always lock __io_cqring_overflow_flush

    commit 8d09a88ef9d3cb7d21d45c39b7b7c31298d23998 upstream.

    Conditional locking is never great, in case of
    __io_cqring_overflow_flush(), which is a slow path, it's not justified.
    Don't handle IOPOLL separately, always grab uring_lock for overflow
    flushing.

    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/162947df299aa12693ac4b305dacedab32ec7976.1712708261.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e3fb0e6afcc399660770428a35162b4880e2e14e
Author: Haibo Chen <haibo.chen@nxp.com>
Date:   Thu Sep 5 17:43:38 2024 +0800

    arm64: dts: imx8ulp: correct the flexspi compatible string

    commit 409dc5196d5b6eb67468a06bf4d2d07d7225a67b upstream.

    The flexspi on imx8ulp only has 16 LUTs, and imx8mm flexspi has
    32 LUTs, so correct the compatible string here, otherwise will
    meet below error:

    [    1.119072] ------------[ cut here ]------------
    [    1.123926] WARNING: CPU: 0 PID: 1 at drivers/spi/spi-nxp-fspi.c:855 nxp_fspi_exec_op+0xb04/0xb64
    [    1.133239] Modules linked in:
    [    1.136448] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc6-next-20240902-00001-g131bf9439dd9 #69
    [    1.146821] Hardware name: NXP i.MX8ULP EVK (DT)
    [    1.151647] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    1.158931] pc : nxp_fspi_exec_op+0xb04/0xb64
    [    1.163496] lr : nxp_fspi_exec_op+0xa34/0xb64
    [    1.168060] sp : ffff80008002b2a0
    [    1.171526] x29: ffff80008002b2d0 x28: 0000000000000000 x27: 0000000000000000
    [    1.179002] x26: ffff2eb645542580 x25: ffff800080610014 x24: ffff800080610000
    [    1.186480] x23: ffff2eb645548080 x22: 0000000000000006 x21: ffff2eb6455425e0
    [    1.193956] x20: 0000000000000000 x19: ffff80008002b5e0 x18: ffffffffffffffff
    [    1.201432] x17: ffff2eb644467508 x16: 0000000000000138 x15: 0000000000000002
    [    1.208907] x14: 0000000000000000 x13: ffff2eb6400d8080 x12: 00000000ffffff00
    [    1.216378] x11: 0000000000000000 x10: ffff2eb6400d8080 x9 : ffff2eb697adca80
    [    1.223850] x8 : ffff2eb697ad3cc0 x7 : 0000000100000000 x6 : 0000000000000001
    [    1.231324] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000000007a6
    [    1.238795] x2 : 0000000000000000 x1 : 00000000000001ce x0 : 00000000ffffff92
    [    1.246267] Call trace:
    [    1.248824]  nxp_fspi_exec_op+0xb04/0xb64
    [    1.253031]  spi_mem_exec_op+0x3a0/0x430
    [    1.257139]  spi_nor_read_id+0x80/0xcc
    [    1.261065]  spi_nor_scan+0x1ec/0xf10
    [    1.264901]  spi_nor_probe+0x108/0x2fc
    [    1.268828]  spi_mem_probe+0x6c/0xbc
    [    1.272574]  spi_probe+0x84/0xe4
    [    1.275958]  really_probe+0xbc/0x29c
    [    1.279713]  __driver_probe_device+0x78/0x12c
    [    1.284277]  driver_probe_device+0xd8/0x15c
    [    1.288660]  __device_attach_driver+0xb8/0x134
    [    1.293316]  bus_for_each_drv+0x88/0xe8
    [    1.297337]  __device_attach+0xa0/0x190
    [    1.301353]  device_initial_probe+0x14/0x20
    [    1.305734]  bus_probe_device+0xac/0xb0
    [    1.309752]  device_add+0x5d0/0x790
    [    1.313408]  __spi_add_device+0x134/0x204
    [    1.317606]  of_register_spi_device+0x3b4/0x590
    [    1.322348]  spi_register_controller+0x47c/0x754
    [    1.327181]  devm_spi_register_controller+0x4c/0xa4
    [    1.332289]  nxp_fspi_probe+0x1cc/0x2b0
    [    1.336307]  platform_probe+0x68/0xc4
    [    1.340145]  really_probe+0xbc/0x29c
    [    1.343893]  __driver_probe_device+0x78/0x12c
    [    1.348457]  driver_probe_device+0xd8/0x15c
    [    1.352838]  __driver_attach+0x90/0x19c
    [    1.356857]  bus_for_each_dev+0x7c/0xdc
    [    1.360877]  driver_attach+0x24/0x30
    [    1.364624]  bus_add_driver+0xe4/0x208
    [    1.368552]  driver_register+0x5c/0x124
    [    1.372573]  __platform_driver_register+0x28/0x34
    [    1.377497]  nxp_fspi_driver_init+0x1c/0x28
    [    1.381888]  do_one_initcall+0x80/0x1c8
    [    1.385908]  kernel_init_freeable+0x1c4/0x28c
    [    1.390472]  kernel_init+0x20/0x1d8
    [    1.394138]  ret_from_fork+0x10/0x20
    [    1.397885] ---[ end trace 0000000000000000 ]---
    [    1.407908] ------------[ cut here ]------------

    Fixes: ef89fd56bdfc ("arm64: dts: imx8ulp: add flexspi node")
    Cc: stable@kernel.org
    Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a49b96c51063d38be296a0c1537928a06f02d6e
Author: Gregory Price <gourry@gourry.net>
Date:   Fri Oct 25 10:17:24 2024 -0400

    vmscan,migrate: fix page count imbalance on node stats when demoting pages

    [ Upstream commit 35e41024c4c2b02ef8207f61b9004f6956cf037b ]

    When numa balancing is enabled with demotion, vmscan will call
    migrate_pages when shrinking LRUs.  migrate_pages will decrement the
    the node's isolated page count, leading to an imbalanced count when
    invoked from (MG)LRU code.

    The result is dmesg output like such:

    $ cat /proc/sys/vm/stat_refresh

    [77383.088417] vmstat_refresh: nr_isolated_anon -103212
    [77383.088417] vmstat_refresh: nr_isolated_file -899642

    This negative value may impact compaction and reclaim throttling.

    The following path produces the decrement:

    shrink_folio_list
      demote_folio_list
        migrate_pages
          migrate_pages_batch
            migrate_folio_move
              migrate_folio_done
                mod_node_page_state(-ve) <- decrement

    This path happens for SUCCESSFUL migrations, not failures.  Typically
    callers to migrate_pages are required to handle putback/accounting for
    failures, but this is already handled in the shrink code.

    When accounting for migrations, instead do not decrement the count when
    the migration reason is MR_DEMOTION.  As of v6.11, this demotion logic
    is the only source of MR_DEMOTION.

    Link: https://lkml.kernel.org/r/20241025141724.17927-1-gourry@gourry.net
    Fixes: 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
    Signed-off-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Yang Shi <shy828301@gmail.com>
    Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
    Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
    Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Wei Xu <weixugc@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 003d2996964c03dfd34860500428f4cdf1f5879e
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Oct 31 08:05:44 2024 -0600

    io_uring/rw: fix missing NOWAIT check for O_DIRECT start write

    [ Upstream commit 1d60d74e852647255bd8e76f5a22dc42531e4389 ]

    When io_uring starts a write, it'll call kiocb_start_write() to bump the
    super block rwsem, preventing any freezes from happening while that
    write is in-flight. The freeze side will grab that rwsem for writing,
    excluding any new writers from happening and waiting for existing writes
    to finish. But io_uring unconditionally uses kiocb_start_write(), which
    will block if someone is currently attempting to freeze the mount point.
    This causes a deadlock where freeze is waiting for previous writes to
    complete, but the previous writes cannot complete, as the task that is
    supposed to complete them is blocked waiting on starting a new write.
    This results in the following stuck trace showing that dependency with
    the write blocked starting a new write:

    task:fio             state:D stack:0     pid:886   tgid:886   ppid:876
    Call trace:
     __switch_to+0x1d8/0x348
     __schedule+0x8e8/0x2248
     schedule+0x110/0x3f0
     percpu_rwsem_wait+0x1e8/0x3f8
     __percpu_down_read+0xe8/0x500
     io_write+0xbb8/0xff8
     io_issue_sqe+0x10c/0x1020
     io_submit_sqes+0x614/0x2110
     __arm64_sys_io_uring_enter+0x524/0x1038
     invoke_syscall+0x74/0x268
     el0_svc_common.constprop.0+0x160/0x238
     do_el0_svc+0x44/0x60
     el0_svc+0x44/0xb0
     el0t_64_sync_handler+0x118/0x128
     el0t_64_sync+0x168/0x170
    INFO: task fsfreeze:7364 blocked for more than 15 seconds.
          Not tainted 6.12.0-rc5-00063-g76aaf945701c #7963

    with the attempting freezer stuck trying to grab the rwsem:

    task:fsfreeze        state:D stack:0     pid:7364  tgid:7364  ppid:995
    Call trace:
     __switch_to+0x1d8/0x348
     __schedule+0x8e8/0x2248
     schedule+0x110/0x3f0
     percpu_down_write+0x2b0/0x680
     freeze_super+0x248/0x8a8
     do_vfs_ioctl+0x149c/0x1b18
     __arm64_sys_ioctl+0xd0/0x1a0
     invoke_syscall+0x74/0x268
     el0_svc_common.constprop.0+0x160/0x238
     do_el0_svc+0x44/0x60
     el0_svc+0x44/0xb0
     el0t_64_sync_handler+0x118/0x128
     el0t_64_sync+0x168/0x170

    Fix this by having the io_uring side honor IOCB_NOWAIT, and only attempt a
    blocking grab of the super block rwsem if it isn't set. For normal issue
    where IOCB_NOWAIT would always be set, this returns -EAGAIN which will
    have io_uring core issue a blocking attempt of the write. That will in
    turn also get completions run, ensuring forward progress.

    Since freezing requires CAP_SYS_ADMIN in the first place, this isn't
    something that can be triggered by a regular user.

    Cc: stable@vger.kernel.org # 5.10+
    Reported-by: Peter Mann <peter.mann@sh.cz>
    Link: https://lore.kernel.org/io-uring/38c94aec-81c9-4f62-b44e-1d87f5597644@sh.cz
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 70bbe8d0a949413df1bb6532fd6b19fbf0f88feb
Author: Andrey Konovalov <andreyknvl@gmail.com>
Date:   Tue Oct 22 18:07:06 2024 +0200

    kasan: remove vmalloc_percpu test

    [ Upstream commit 330d8df81f3673d6fb74550bbc9bb159d81b35f7 ]

    Commit 1a2473f0cbc0 ("kasan: improve vmalloc tests") added the
    vmalloc_percpu KASAN test with the assumption that __alloc_percpu always
    uses vmalloc internally, which is tagged by KASAN.

    However, __alloc_percpu might allocate memory from the first per-CPU
    chunk, which is not allocated via vmalloc().  As a result, the test might
    fail.

    Remove the test until proper KASAN annotation for the per-CPU allocated
    are added; tracked in https://bugzilla.kernel.org/show_bug.cgi?id=215019.

    Link: https://lkml.kernel.org/r/20241022160706.38943-1-andrey.konovalov@linux.dev
    Fixes: 1a2473f0cbc0 ("kasan: improve vmalloc tests")
    Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
    Reported-by: Samuel Holland <samuel.holland@sifive.com>
    Link: https://lore.kernel.org/all/4a245fff-cc46-44d1-a5f9-fd2f1c3764ae@sifive.com/
    Reported-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Link: https://lore.kernel.org/all/CACzwLxiWzNqPBp4C1VkaXZ2wDwvY3yZeetCi1TLGFipKW77drA@mail.gmail.com/
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Marco Elver <elver@google.com>
    Cc: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c60af16e1d6cc2237d58336546d6adfc067b6b8f
Author: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
Date:   Mon Sep 16 22:41:37 2024 +0500

    nvmet-auth: assign dh_key to NULL after kfree_sensitive

    [ Upstream commit d2f551b1f72b4c508ab9298419f6feadc3b5d791 ]

    ctrl->dh_key might be used across multiple calls to nvmet_setup_dhgroup()
    for the same controller. So it's better to nullify it after release on
    error path in order to avoid double free later in nvmet_destroy_auth().

    Found by Linux Verification Center (linuxtesting.org) with Svace.

    Fixes: 7a277c37d352 ("nvmet-auth: Diffie-Hellman key exchange support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a39320977f9c665faa37efaa8093b8e82dd8c41
Author: Christoffer Sandberg <cs@tuxedo.de>
Date:   Tue Oct 29 16:16:53 2024 +0100

    ALSA: hda/realtek: Fix headset mic on TUXEDO Stellaris 16 Gen6 mb1

    [ Upstream commit e49370d769e71456db3fbd982e95bab8c69f73e8 ]

    Quirk is needed to enable headset microphone on missing pin 0x19.

    Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20241029151653.80726-2-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b42adef85aca72b51eab1a812a79913ff5aeb584
Author: Christoffer Sandberg <cs@tuxedo.de>
Date:   Tue Oct 29 16:16:52 2024 +0100

    ALSA: hda/realtek: Fix headset mic on TUXEDO Gemini 17 Gen3

    [ Upstream commit 0b04fbe886b4274c8e5855011233aaa69fec6e75 ]

    Quirk is needed to enable headset microphone on missing pin 0x19.

    Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20241029151653.80726-1-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 77ddc732416b017180893cbb2356e9f0a414c575
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Oct 23 15:37:22 2024 +0200

    xfs: fix finding a last resort AG in xfs_filestream_pick_ag

    [ Upstream commit dc60992ce76fbc2f71c2674f435ff6bde2108028 ]

    When the main loop in xfs_filestream_pick_ag fails to find a suitable
    AG it tries to just pick the online AG.  But the loop for that uses
    args->pag as loop iterator while the later code expects pag to be
    set.  Fix this by reusing the max_pag case for this last resort, and
    also add a check for impossible case of no AG just to make sure that
    the uninitialized pag doesn't even escape in theory.

    Reported-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
    Fixes: f8f1ed1ab3baba ("xfs: return a referenced perag from filestreams allocator")
    Cc: <stable@vger.kernel.org> # v6.3
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8e886e44397ba89f6e8da8471386112b4f5b67b7
Author: Matt Johnston <matt@codeconstruct.com.au>
Date:   Tue Oct 22 18:25:14 2024 +0800

    mctp i2c: handle NULL header address

    [ Upstream commit 01e215975fd80af81b5b79f009d49ddd35976c13 ]

    daddr can be NULL if there is no neighbour table entry present,
    in that case the tx packet should be dropped.

    saddr will usually be set by MCTP core, but check for NULL in case a
    packet is transmitted by a different protocol.

    Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
    Cc: stable@vger.kernel.org
    Reported-by: Dung Cao <dung@os.amperecomputing.com>
    Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241022-mctp-i2c-null-dest-v3-1-e929709956c5@codeconstruct.com.au
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 88f97a4b5843ce21c1286e082c02a5fb4d8eb473
Author: Edward Adam Davis <eadavis@qq.com>
Date:   Wed Oct 16 19:43:47 2024 +0800

    ocfs2: pass u64 to ocfs2_truncate_inline maybe overflow

    [ Upstream commit bc0a2f3a73fcdac651fca64df39306d1e5ebe3b0 ]

    Syzbot reported a kernel BUG in ocfs2_truncate_inline.  There are two
    reasons for this: first, the parameter value passed is greater than
    ocfs2_max_inline_data_with_xattr, second, the start and end parameters of
    ocfs2_truncate_inline are "unsigned int".

    So, we need to add a sanity check for byte_start and byte_len right before
    ocfs2_truncate_inline() in ocfs2_remove_inode_range(), if they are greater
    than ocfs2_max_inline_data_with_xattr return -EINVAL.

    Link: https://lkml.kernel.org/r/tencent_D48DB5122ADDAEDDD11918CFB68D93258C07@qq.com
    Fixes: 1afc32b95233 ("ocfs2: Write support for inline data")
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Reported-by: syzbot+81092778aac03460d6b7@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=81092778aac03460d6b7
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Gang He <ghe@suse.com>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c117a980185ee3812612e7e453e356a6a4f05305
Author: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Date:   Wed Oct 16 20:24:07 2024 +0500

    x86/traps: move kmsan check after instrumentation_begin

    [ Upstream commit 1db272864ff250b5e607283eaec819e1186c8e26 ]

    During x86_64 kernel build with CONFIG_KMSAN, the objtool warns following:

      AR      built-in.a
      AR      vmlinux.a
      LD      vmlinux.o
    vmlinux.o: warning: objtool: handle_bug+0x4: call to
        kmsan_unpoison_entry_regs() leaves .noinstr.text section
      OBJCOPY modules.builtin.modinfo
      GEN     modules.builtin
      MODPOST Module.symvers
      CC      .vmlinux.export.o

    Moving kmsan_unpoison_entry_regs() _after_ instrumentation_begin() fixes
    the warning.

    There is decode_bug(regs->ip, &imm) is left before KMSAN unpoisoining, but
    it has the return condition and if we include it after
    instrumentation_begin() it results the warning "return with
    instrumentation enabled", hence, I'm concerned that regs will not be KMSAN
    unpoisoned if `ud_type == BUG_NONE` is true.

    Link: https://lkml.kernel.org/r/20241016152407.3149001-1-snovitoll@gmail.com
    Fixes: ba54d194f8da ("x86/traps: avoid KMSAN bugs originating from handle_bug()")
    Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Reviewed-by: Alexander Potapenko <glider@google.com>
    Cc: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 86ee1845cbbf52eff6d41ce438d5f7e9ab6f4602
Author: Gatlin Newhouse <gatlin.newhouse@gmail.com>
Date:   Wed Jul 24 00:01:55 2024 +0000

    x86/traps: Enable UBSAN traps on x86

    [ Upstream commit 7424fc6b86c8980a87169e005f5cd4438d18efe6 ]

    Currently ARM64 extracts which specific sanitizer has caused a trap via
    encoded data in the trap instruction. Clang on x86 currently encodes the
    same data in the UD1 instruction but x86 handle_bug() and
    is_valid_bugaddr() currently only look at UD2.

    Bring x86 to parity with ARM64, similar to commit 25b84002afb9 ("arm64:
    Support Clang UBSAN trap codes for better reporting"). See the llvm
    links for information about the code generation.

    Enable the reporting of UBSAN sanitizer details on x86 compiled with clang
    when CONFIG_UBSAN_TRAP=y by analysing UD1 and retrieving the type immediate
    which is encoded by the compiler after the UD1.

    [ tglx: Simplified it by moving the printk() into handle_bug() ]

    Signed-off-by: Gatlin Newhouse <gatlin.newhouse@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/all/20240724000206.451425-1-gatlin.newhouse@gmail.com
    Link: https://github.com/llvm/llvm-project/commit/c5978f42ec8e9#diff-bb68d7cd885f41cfc35843998b0f9f534adb60b415f647109e597ce448e92d9f
    Link: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/X86/X86InstrSystem.td#L27
    Stable-dep-of: 1db272864ff2 ("x86/traps: move kmsan check after instrumentation_begin")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b958948ae1cb3e39c48e9f805436fd652103c71e
Author: Matt Fleming <mfleming@cloudflare.com>
Date:   Fri Oct 11 13:07:37 2024 +0100

    mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves

    [ Upstream commit 281dd25c1a018261a04d1b8bf41a0674000bfe38 ]

    Under memory pressure it's possible for GFP_ATOMIC order-0 allocations to
    fail even though free pages are available in the highatomic reserves.
    GFP_ATOMIC allocations cannot trigger unreserve_highatomic_pageblock()
    since it's only run from reclaim.

    Given that such allocations will pass the watermarks in
    __zone_watermark_unusable_free(), it makes sense to fallback to highatomic
    reserves the same way that ALLOC_OOM can.

    This fixes order-0 page allocation failures observed on Cloudflare's fleet
    when handling network packets:

      kswapd1: page allocation failure: order:0, mode:0x820(GFP_ATOMIC),
      nodemask=(null),cpuset=/,mems_allowed=0-7
      CPU: 10 PID: 696 Comm: kswapd1 Kdump: loaded Tainted: G           O 6.6.43-CUSTOM #1
      Hardware name: MACHINE
      Call Trace:
       <IRQ>
       dump_stack_lvl+0x3c/0x50
       warn_alloc+0x13a/0x1c0
       __alloc_pages_slowpath.constprop.0+0xc9d/0xd10
       __alloc_pages+0x327/0x340
       __napi_alloc_skb+0x16d/0x1f0
       bnxt_rx_page_skb+0x96/0x1b0 [bnxt_en]
       bnxt_rx_pkt+0x201/0x15e0 [bnxt_en]
       __bnxt_poll_work+0x156/0x2b0 [bnxt_en]
       bnxt_poll+0xd9/0x1c0 [bnxt_en]
       __napi_poll+0x2b/0x1b0
       bpf_trampoline_6442524138+0x7d/0x1000
       __napi_poll+0x5/0x1b0
       net_rx_action+0x342/0x740
       handle_softirqs+0xcf/0x2b0
       irq_exit_rcu+0x6c/0x90
       sysvec_apic_timer_interrupt+0x72/0x90
       </IRQ>

    [mfleming@cloudflare.com: update comment]
      Link: https://lkml.kernel.org/r/20241015125158.3597702-1-matt@readmodwrite.com
    Link: https://lkml.kernel.org/r/20241011120737.3300370-1-matt@readmodwrite.com
    Link: https://lore.kernel.org/all/CAGis_TWzSu=P7QJmjD58WWiu3zjMTVKSzdOwWE8ORaGytzWJwQ@mail.gmail.com/
    Fixes: 1d91df85f399 ("mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs")
    Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
    Suggested-by: Vlastimil Babka <vbabka@suse.cz>
    Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4882a352b5df897c30f9d64fba340a219a6604d0
Author: Alexander Usyskin <alexander.usyskin@intel.com>
Date:   Tue Oct 15 15:31:57 2024 +0300

    mei: use kvmalloc for read buffer

    [ Upstream commit 4adf613e01bf99e1739f6ff3e162ad5b7d578d1a ]

    Read buffer is allocated according to max message size, reported by
    the firmware and may reach 64K in systems with pxp client.
    Contiguous 64k allocation may fail under memory pressure.
    Read buffer is used as in-driver message storage and not required
    to be contiguous.
    Use kvmalloc to allow kernel to allocate non-contiguous memory.

    Fixes: 3030dc056459 ("mei: add wrapper for queuing control commands.")
    Cc: stable <stable@kernel.org>
    Reported-by: Rohit Agarwal <rohiagar@chromium.org>
    Closes: https://lore.kernel.org/all/20240813084542.2921300-1-rohiagar@chromium.org/
    Tested-by: Brian Geffon <bgeffon@google.com>
    Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
    Acked-by: Tomas Winkler <tomasw@gmail.com>
    Link: https://lore.kernel.org/r/20241015123157.2337026-1-alexander.usyskin@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cb8b81ad3e893a6d18dcdd3754cc2ea2a42c0136
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Mon Oct 21 12:25:26 2024 +0200

    mptcp: init: protect sched with rcu_read_lock

    [ Upstream commit 3deb12c788c385e17142ce6ec50f769852fcec65 ]

    Enabling CONFIG_PROVE_RCU_LIST with its dependence CONFIG_RCU_EXPERT
    creates this splat when an MPTCP socket is created:

      =============================
      WARNING: suspicious RCU usage
      6.12.0-rc2+ #11 Not tainted
      -----------------------------
      net/mptcp/sched.c:44 RCU-list traversed in non-reader section!!

      other info that might help us debug this:

      rcu_scheduler_active = 2, debug_locks = 1
      no locks held by mptcp_connect/176.

      stack backtrace:
      CPU: 0 UID: 0 PID: 176 Comm: mptcp_connect Not tainted 6.12.0-rc2+ #11
      Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      Call Trace:
       <TASK>
       dump_stack_lvl (lib/dump_stack.c:123)
       lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822)
       mptcp_sched_find (net/mptcp/sched.c:44 (discriminator 7))
       mptcp_init_sock (net/mptcp/protocol.c:2867 (discriminator 1))
       ? sock_init_data_uid (arch/x86/include/asm/atomic.h:28)
       inet_create.part.0.constprop.0 (net/ipv4/af_inet.c:386)
       ? __sock_create (include/linux/rcupdate.h:347 (discriminator 1))
       __sock_create (net/socket.c:1576)
       __sys_socket (net/socket.c:1671)
       ? __pfx___sys_socket (net/socket.c:1712)
       ? do_user_addr_fault (arch/x86/mm/fault.c:1419 (discriminator 1))
       __x64_sys_socket (net/socket.c:1728)
       do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1))
       entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)

    That's because when the socket is initialised, rcu_read_lock() is not
    used despite the explicit comment written above the declaration of
    mptcp_sched_find() in sched.c. Adding the missing lock/unlock avoids the
    warning.

    Fixes: 1730b2b2c5a5 ("mptcp: add sched in mptcp_sock")
    Cc: stable@vger.kernel.org
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/523
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241021-net-mptcp-sched-lock-v1-1-637759cf061c@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4f7ffa83fa79dd52efbaef366c850aaaae06a469
Author: Hugh Dickins <hughd@google.com>
Date:   Sun Oct 27 15:23:23 2024 -0700

    iov_iter: fix copy_page_from_iter_atomic() if KMAP_LOCAL_FORCE_MAP

    [ Upstream commit c749d9b7ebbc5716af7a95f7768634b30d9446ec ]

    generic/077 on x86_32 CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y with highmem,
    on huge=always tmpfs, issues a warning and then hangs (interruptibly):

    WARNING: CPU: 5 PID: 3517 at mm/highmem.c:622 kunmap_local_indexed+0x62/0xc9
    CPU: 5 UID: 0 PID: 3517 Comm: cp Not tainted 6.12.0-rc4 #2
    ...
    copy_page_from_iter_atomic+0xa6/0x5ec
    generic_perform_write+0xf6/0x1b4
    shmem_file_write_iter+0x54/0x67

    Fix copy_page_from_iter_atomic() by limiting it in that case
    (include/linux/skbuff.h skb_frag_must_loop() does similar).

    But going forward, perhaps CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP is too
    surprising, has outlived its usefulness, and should just be removed?

    Fixes: 908a1ad89466 ("iov_iter: Handle compound highmem pages in copy_page_from_iter_atomic()")
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Link: https://lore.kernel.org/r/dd5f0c89-186e-18e1-4f43-19a60f5a9774@google.com
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ade91f6e9848b370add44d89c976e070ccb492ef
Author: Shawn Wang <shawnwang@linux.alibaba.com>
Date:   Fri Oct 25 10:22:08 2024 +0800

    sched/numa: Fix the potential null pointer dereference in task_numa_work()

    [ Upstream commit 9c70b2a33cd2aa6a5a59c5523ef053bd42265209 ]

    When running stress-ng-vm-segv test, we found a null pointer dereference
    error in task_numa_work(). Here is the backtrace:

      [323676.066985] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
      ......
      [323676.067108] CPU: 35 PID: 2694524 Comm: stress-ng-vm-se
      ......
      [323676.067113] pstate: 23401009 (nzCv daif +PAN -UAO +TCO +DIT +SSBS BTYPE=--)
      [323676.067115] pc : vma_migratable+0x1c/0xd0
      [323676.067122] lr : task_numa_work+0x1ec/0x4e0
      [323676.067127] sp : ffff8000ada73d20
      [323676.067128] x29: ffff8000ada73d20 x28: 0000000000000000 x27: 000000003e89f010
      [323676.067130] x26: 0000000000080000 x25: ffff800081b5c0d8 x24: ffff800081b27000
      [323676.067133] x23: 0000000000010000 x22: 0000000104d18cc0 x21: ffff0009f7158000
      [323676.067135] x20: 0000000000000000 x19: 0000000000000000 x18: ffff8000ada73db8
      [323676.067138] x17: 0001400000000000 x16: ffff800080df40b0 x15: 0000000000000035
      [323676.067140] x14: ffff8000ada73cc8 x13: 1fffe0017cc72001 x12: ffff8000ada73cc8
      [323676.067142] x11: ffff80008001160c x10: ffff000be639000c x9 : ffff8000800f4ba4
      [323676.067145] x8 : ffff000810375000 x7 : ffff8000ada73974 x6 : 0000000000000001
      [323676.067147] x5 : 0068000b33e26707 x4 : 0000000000000001 x3 : ffff0009f7158000
      [323676.067149] x2 : 0000000000000041 x1 : 0000000000004400 x0 : 0000000000000000
      [323676.067152] Call trace:
      [323676.067153]  vma_migratable+0x1c/0xd0
      [323676.067155]  task_numa_work+0x1ec/0x4e0
      [323676.067157]  task_work_run+0x78/0xd8
      [323676.067161]  do_notify_resume+0x1ec/0x290
      [323676.067163]  el0_svc+0x150/0x160
      [323676.067167]  el0t_64_sync_handler+0xf8/0x128
      [323676.067170]  el0t_64_sync+0x17c/0x180
      [323676.067173] Code: d2888001 910003fd f9000bf3 aa0003f3 (f9401000)
      [323676.067177] SMP: stopping secondary CPUs
      [323676.070184] Starting crashdump kernel...

    stress-ng-vm-segv in stress-ng is used to stress test the SIGSEGV error
    handling function of the system, which tries to cause a SIGSEGV error on
    return from unmapping the whole address space of the child process.

    Normally this program will not cause kernel crashes. But before the
    munmap system call returns to user mode, a potential task_numa_work()
    for numa balancing could be added and executed. In this scenario, since the
    child process has no vma after munmap, the vma_next() in task_numa_work()
    will return a null pointer even if the vma iterator restarts from 0.

    Recheck the vma pointer before dereferencing it in task_numa_work().

    Fixes: 214dbc428137 ("sched: convert to vma iterator")
    Signed-off-by: Shawn Wang <shawnwang@linux.alibaba.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org # v6.2+
    Link: https://lkml.kernel.org/r/20241025022208.125527-1-shawnwang@linux.alibaba.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8c9a1ec39c698cbc38f4efa9113185f885137f8b
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Tue Oct 22 18:43:40 2024 -0700

    cxl/acpi: Ensure ports ready at cxl_acpi_probe() return

    [ Upstream commit 48f62d38a07d464a499fa834638afcfd2b68f852 ]

    In order to ensure root CXL ports are enabled upon cxl_acpi_probe()
    when the 'cxl_port' driver is built as a module, arrange for the
    module to be pre-loaded or built-in.

    The "Fixes:" but no "Cc: stable" on this patch reflects that the issue
    is merely by inspection since the bug that triggered the discovery of
    this potential problem [1] is fixed by other means. However, a stable
    backport should do no harm.

    Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver")
    Link: http://lore.kernel.org/20241004212504.1246-1-gourry@gourry.net [1]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Tested-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Link: https://patch.msgid.link/172964781969.81806.17276352414854540808.stgit@dwillia2-xfh.jf.intel.com
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a9ed67f39f888bb6e5729112ad45f15d9c5a3ef8
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Tue Oct 22 18:43:32 2024 -0700

    cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices()

    [ Upstream commit 3d6ebf16438de5d712030fefbb4182b46373d677 ]

    It turns out since its original introduction, pre-2.6.12,
    bus_rescan_devices() has skipped devices that might be in the process of
    attaching or detaching from their driver. For CXL this behavior is
    unwanted and expects that cxl_bus_rescan() is a probe barrier.

    That behavior is simple enough to achieve with bus_for_each_dev() paired
    with call to device_attach(), and it is unclear why bus_rescan_devices()
    took the position of lockless consumption of dev->driver which is racy.

    The "Fixes:" but no "Cc: stable" on this patch reflects that the issue
    is merely by inspection since the bug that triggered the discovery of
    this potential problem [1] is fixed by other means.  However, a stable
    backport should do no harm.

    Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver")
    Link: http://lore.kernel.org/20241004212504.1246-1-gourry@gourry.net [1]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Tested-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Link: https://patch.msgid.link/172964781104.81806.4277549800082443769.stgit@dwillia2-xfh.jf.intel.com
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d210bc87cc4fdde62f757002530a08c3d109d94a
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:39 2024 +0800

    riscv: Remove duplicated GET_RM

    [ Upstream commit 164f66de6bb6ef454893f193c898dc8f1da6d18b ]

    The macro GET_RM defined twice in this file, one can be removed.

    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Fixes: 956d705dd279 ("riscv: Unaligned load/store handling for M_MODE")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241008094141.549248-3-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6d84e1b2e5ac04511e68bcf5577fc8369e73f4ed
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:38 2024 +0800

    riscv: Remove unused GENERATING_ASM_OFFSETS

    [ Upstream commit 46d4e5ac6f2f801f97bcd0ec82365969197dc9b1 ]

    The macro is not used in the current version of kernel, it looks like
    can be removed to avoid a build warning:

    ../arch/riscv/kernel/asm-offsets.c: At top level:
    ../arch/riscv/kernel/asm-offsets.c:7: warning: macro "GENERATING_ASM_OFFSETS" is not used [-Wunused-macros]
        7 | #define GENERATING_ASM_OFFSETS

    Fixes: 9639a44394b9 ("RISC-V: Provide a cleaner raw_smp_processor_id()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Link: https://lore.kernel.org/r/20241008094141.549248-2-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a63ba17207c50da91b19150b6cde09d199b34c2c
Author: WangYuli <wangyuli@uniontech.com>
Date:   Thu Oct 17 11:20:10 2024 +0800

    riscv: Use '%u' to format the output of 'cpu'

    [ Upstream commit e0872ab72630dada3ae055bfa410bf463ff1d1e0 ]

    'cpu' is an unsigned integer, so its conversion specifier should
    be %u, not %d.

    Suggested-by: Wentao Guan <guanwentao@uniontech.com>
    Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Link: https://lore.kernel.org/all/alpine.DEB.2.21.2409122309090.40372@angie.orcam.me.uk/
    Signed-off-by: WangYuli <wangyuli@uniontech.com>
    Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
    Tested-by: Charlie Jenkins <charlie@rivosinc.com>
    Fixes: f1e58583b9c7 ("RISC-V: Support cpu hotplug")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/4C127DEECDA287C8+20241017032010.96772-1-wangyuli@uniontech.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 909e71f28e9615410f52fca1b54acfd3d61c61c2
Author: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date:   Sun Sep 29 16:02:33 2024 +0200

    riscv: efi: Set NX compat flag in PE/COFF header

    [ Upstream commit d41373a4b910961df5a5e3527d7bde6ad45ca438 ]

    The IMAGE_DLLCHARACTERISTICS_NX_COMPAT informs the firmware that the
    EFI binary does not rely on pages that are both executable and
    writable.

    The flag is used by some distro versions of GRUB to decide if the EFI
    binary may be executed.

    As the Linux kernel neither has RWX sections nor needs RWX pages for
    relocation we should set the flag.

    Cc: Ard Biesheuvel <ardb@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
    Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
    Fixes: cb7d2dd5612a ("RISC-V: Add PE/COFF header for EFI stub")
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://lore.kernel.org/r/20240929140233.211800-1-heinrich.schuchardt@canonical.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 58e78589ade880330e359587bb50b1474f43aa12
Author: Kailang Yang <kailang@realtek.com>
Date:   Fri Oct 18 13:53:24 2024 +0800

    ALSA: hda/realtek: Limit internal Mic boost on Dell platform

    [ Upstream commit 78e7be018784934081afec77f96d49a2483f9188 ]

    Dell want to limit internal Mic boost on all Dell platform.

    Signed-off-by: Kailang Yang <kailang@realtek.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/561fc5f5eff04b6cbd79ed173cd1c1db@realtek.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ceec8ad09135c27890cdee5a9bb0bf5f58c23720
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Fri Oct 18 17:17:48 2024 -0700

    Input: edt-ft5x06 - fix regmap leak when probe fails

    [ Upstream commit bffdf9d7e51a7be8eeaac2ccf9e54a5fde01ff65 ]

    The driver neglects to free the instance of I2C regmap constructed at
    the beginning of the edt_ft5x06_ts_probe() method when probe fails.
    Additionally edt_ft5x06_ts_remove() is freeing the regmap too early,
    before the rest of the device resources that are managed by devm are
    released.

    Fix this by installing a custom devm action that will ensure that the
    regmap is released at the right time during normal teardown as well as
    in case of probe failure.

    Note that devm_regmap_init_i2c() could not be used because the driver
    may replace the original regmap with a regmap specific for M06 devices
    in the middle of the probe, and using devm_regmap_init_i2c() would
    result in releasing the M06 regmap too early.

    Reported-by: Li Zetao <lizetao1@huawei.com>
    Fixes: 9dfd9708ffba ("Input: edt-ft5x06 - convert to use regmap API")
    Cc: stable@vger.kernel.org
    Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com>
    Link: https://lore.kernel.org/r/ZxL6rIlVlgsAu-Jv@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c19a0c171d37f86ab7267c638d475321fd9f0b77
Author: Alexandre Ghiti <alexghiti@rivosinc.com>
Date:   Wed Oct 16 10:36:24 2024 +0200

    riscv: vdso: Prevent the compiler from inserting calls to memset()

    [ Upstream commit bf40167d54d55d4b54d0103713d86a8638fb9290 ]

    The compiler is smart enough to insert a call to memset() in
    riscv_vdso_get_cpus(), which generates a dynamic relocation.

    So prevent this by using -fno-builtin option.

    Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Guo Ren <guoren@kernel.org>
    Link: https://lore.kernel.org/r/20241016083625.136311-2-alexghiti@rivosinc.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e79c1f1c9100b4adc91c6512985db2cc961aafaa
Author: Frank Li <Frank.Li@nxp.com>
Date:   Wed Oct 23 16:30:32 2024 -0400

    spi: spi-fsl-dspi: Fix crash when not using GPIO chip select

    [ Upstream commit 25f00a13dccf8e45441265768de46c8bf58e08f6 ]

    Add check for the return value of spi_get_csgpiod() to avoid passing a NULL
    pointer to gpiod_direction_output(), preventing a crash when GPIO chip
    select is not used.

    Fix below crash:
    [    4.251960] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [    4.260762] Mem abort info:
    [    4.263556]   ESR = 0x0000000096000004
    [    4.267308]   EC = 0x25: DABT (current EL), IL = 32 bits
    [    4.272624]   SET = 0, FnV = 0
    [    4.275681]   EA = 0, S1PTW = 0
    [    4.278822]   FSC = 0x04: level 0 translation fault
    [    4.283704] Data abort info:
    [    4.286583]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [    4.292074]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [    4.297130]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [    4.302445] [0000000000000000] user address but active_mm is swapper
    [    4.308805] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
    [    4.315072] Modules linked in:
    [    4.318124] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc4-next-20241023-00008-ga20ec42c5fc1 #359
    [    4.328130] Hardware name: LS1046A QDS Board (DT)
    [    4.332832] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    4.339794] pc : gpiod_direction_output+0x34/0x5c
    [    4.344505] lr : gpiod_direction_output+0x18/0x5c
    [    4.349208] sp : ffff80008003b8f0
    [    4.352517] x29: ffff80008003b8f0 x28: 0000000000000000 x27: ffffc96bcc7e9068
    [    4.359659] x26: ffffc96bcc6e00b0 x25: ffffc96bcc598398 x24: ffff447400132810
    [    4.366800] x23: 0000000000000000 x22: 0000000011e1a300 x21: 0000000000020002
    [    4.373940] x20: 0000000000000000 x19: 0000000000000000 x18: ffffffffffffffff
    [    4.381081] x17: ffff44740016e600 x16: 0000000500000003 x15: 0000000000000007
    [    4.388221] x14: 0000000000989680 x13: 0000000000020000 x12: 000000000000001e
    [    4.395362] x11: 0044b82fa09b5a53 x10: 0000000000000019 x9 : 0000000000000008
    [    4.402502] x8 : 0000000000000002 x7 : 0000000000000007 …
qaz6750 added a commit that referenced this pull request Nov 30, 2024
commit 18916a684a8b836957df88438f9bca590799d04c
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Oct 22 15:46:36 2024 +0200

    Linux 6.6.58

    Link: https://lore.kernel.org/r/20241021102256.706334758@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fd6e2af79a947e909c72b09f1ce3175f381067ef
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Wed Oct 16 11:07:13 2024 +0300

    ALSA: hda/conexant - Use cached pin control for Node 0x1d on HP EliteOne 1000 G2

    commit 164cd0e077a18d6208523c82b102c98c77fdd51f upstream.

    The cached version avoids redundant commands to the codec, improving
    stability and reducing unnecessary operations. This change ensures
    better power management and reliable restoration of pin configurations,
    especially after hibernation (S4) and other power transitions.

    Fixes: 9988844c457f ("ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2")
    Suggested-by: Kai-Heng Feng <kaihengf@nvidia.com>
    Suggested-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Link: https://patch.msgid.link/20241016080713.46801-1-kovalev@altlinux.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9698088ac7704e260f492d9c254e29ed7dd8729a
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 4 12:35:31 2024 +0900

    nilfs2: propagate directory read errors from nilfs_find_entry()

    commit 08cfa12adf888db98879dbd735bc741360a34168 upstream.

    Syzbot reported that a task hang occurs in vcs_open() during a fuzzing
    test for nilfs2.

    The root cause of this problem is that in nilfs_find_entry(), which
    searches for directory entries, ignores errors when loading a directory
    page/folio via nilfs_get_folio() fails.

    If the filesystem images is corrupted, and the i_size of the directory
    inode is large, and the directory page/folio is successfully read but
    fails the sanity check, for example when it is zero-filled,
    nilfs_check_folio() may continue to spit out error messages in bursts.

    Fix this issue by propagating the error to the callers when loading a
    page/folio fails in nilfs_find_entry().

    The current interface of nilfs_find_entry() and its callers is outdated
    and cannot propagate error codes such as -EIO and -ENOMEM returned via
    nilfs_find_entry(), so fix it together.

    Link: https://lkml.kernel.org/r/20241004033640.6841-1-konishi.ryusuke@gmail.com
    Fixes: 2ba466d74ed7 ("nilfs2: directory entry operations")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: Lizhi Xu <lizhi.xu@windriver.com>
    Closes: https://lkml.kernel.org/r/20240927013806.3577931-1-lizhi.xu@windriver.com
    Reported-by: syzbot+8a192e8d090fa9a31135@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=8a192e8d090fa9a31135
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87cb3f6e0c047f9320889e68140f46b1f4ca9eca
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Fri Oct 18 17:57:39 2024 +0200

    selftests: mptcp: remove duplicated variables

    A few week ago, there were some backport issues in MPTCP selftests,
    because some patches have been applied twice, but with versions handling
    conflicts differently [1].

    Patches fixing these issues have been sent [2] and applied, but it looks
    like quilt was still confused with the removal of some patches, and
    commit a417ef47a665 ("selftests: mptcp: join: validate event numbers")
    duplicated some variables, not present in the original patch [3].

    Anyway, Bash was complaining, but that was not causing any tests to
    fail. Also, that's easy to fix by simply removing the duplicated ones.

    Link: https://lore.kernel.org/fc21db4a-508d-41db-aa45-e3bc06d18ce7@kernel.org [1]
    Link: https://lore.kernel.org/20240905144306.1192409-5-matttbe@kernel.org [2]
    Link: https://lore.kernel.org/20240905144306.1192409-7-matttbe@kernel.org [3]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ec0d0fcbd5d8645fdfb75717d70270f59254d04d
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:38 2024 +0200

    selftests: mptcp: join: test for prohibited MPC to port-based endp

    commit 5afca7e996c42aed1b4a42d4712817601ba42aff upstream.

    Explicitly verify that MPC connection attempts towards a port-based
    signal endpoint fail with a reset.

    Note that this new test is a bit different from the other ones, not
    using 'run_tests'. It is then needed to add the capture capability, and
    the picking the right port which have been extracted into three new
    helpers. The info about the capture can also be printed from a single
    point, which simplifies the exit paths in do_transfer().

    The 'Fixes' tag here below is the same as the one from the previous
    commit: this patch here is not fixing anything wrong in the selftests,
    but it validates the previous fix for an issue introduced by this commit
    ID.

    Fixes: 1729cf186d8a ("mptcp: create the listening socket for new port")
    Cc: stable@vger.kernel.org
    Co-developed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241014-net-mptcp-mpc-port-endp-v2-2-7faea8e6b6ae@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflicts in mptcp_join.sh, because commit 0bd962dd86b2 ("selftests:
      mptcp: join: check CURRESTAB counters"), and commit 9e6a39ecb9a1
      ("selftests: mptcp: export TEST_COUNTER variable") are linked to new
      features, not available in this version. Resolving the conflicts is
      easy, simply adding the new helpers before do_transfer(), and rename
      MPTCP_LIB_TEST_COUNTER to TEST_COUNT that was used before. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d46b96f0a4892580757d3bbb546d2971dbe83361
Author: Geliang Tang <tanggeliang@kylinos.cn>
Date:   Fri Oct 18 17:57:37 2024 +0200

    selftests: mptcp: join: change capture/checksum as bool

    commit 8c6f6b4bb53a904f922dfb90d566391d3feee32c upstream.

    To maintain consistency with other scripts, this patch changes vars
    'capture' and 'checksum' as bool vars in mptcp_join.

    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-next-20240223-misc-improvements-v1-7-b6c8a10396bd@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 5afca7e996c4 ("selftests: mptcp: join: test for prohibited MPC to port-based endp")
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 229dfdc36f31a8d47433438bc0e6e1662c4ab404
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Oct 18 17:57:36 2024 +0200

    tcp: fix mptcp DSS corruption due to large pmtu xmit

    commit 4dabcdf581217e60690467a37c956a5b8dbc6bd9 upstream.

    Syzkaller was able to trigger a DSS corruption:

      TCP: request_sock_subflow_v4: Possible SYN flooding on port [::]:20002. Sending cookies.
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 5227 at net/mptcp/protocol.c:695 __mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Modules linked in:
      CPU: 0 UID: 0 PID: 5227 Comm: syz-executor350 Not tainted 6.11.0-syzkaller-08829-gaf9c191ac2a0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
      RIP: 0010:__mptcp_move_skbs_from_subflow+0x20a9/0x21f0 net/mptcp/protocol.c:695
      Code: 0f b6 dc 31 ff 89 de e8 b5 dd ea f5 89 d8 48 81 c4 50 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 98 da ea f5 90 <0f> 0b 90 e9 47 ff ff ff e8 8a da ea f5 90 0f 0b 90 e9 99 e0 ff ff
      RSP: 0018:ffffc90000006db8 EFLAGS: 00010246
      RAX: ffffffff8ba9df18 RBX: 00000000000055f0 RCX: ffff888030023c00
      RDX: 0000000000000100 RSI: 00000000000081e5 RDI: 00000000000055f0
      RBP: 1ffff110062bf1ae R08: ffffffff8ba9cf12 R09: 1ffff110062bf1b8
      R10: dffffc0000000000 R11: ffffed10062bf1b9 R12: 0000000000000000
      R13: dffffc0000000000 R14: 00000000700cec61 R15: 00000000000081e5
      FS:  000055556679c380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020287000 CR3: 0000000077892000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <IRQ>
       move_skbs_to_msk net/mptcp/protocol.c:811 [inline]
       mptcp_data_ready+0x29c/0xa90 net/mptcp/protocol.c:854
       subflow_data_ready+0x34a/0x920 net/mptcp/subflow.c:1490
       tcp_data_queue+0x20fd/0x76c0 net/ipv4/tcp_input.c:5283
       tcp_rcv_established+0xfba/0x2020 net/ipv4/tcp_input.c:6237
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       tcp_v4_rcv+0x2dc0/0x37f0 net/ipv4/tcp_ipv4.c:2350
       ip_protocol_deliver_rcu+0x22e/0x440 net/ipv4/ip_input.c:205
       ip_local_deliver_finish+0x341/0x5f0 net/ipv4/ip_input.c:233
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       NF_HOOK+0x3a4/0x450 include/linux/netfilter.h:314
       __netif_receive_skb_one_core net/core/dev.c:5662 [inline]
       __netif_receive_skb+0x2bf/0x650 net/core/dev.c:5775
       process_backlog+0x662/0x15b0 net/core/dev.c:6107
       __napi_poll+0xcb/0x490 net/core/dev.c:6771
       napi_poll net/core/dev.c:6840 [inline]
       net_rx_action+0x89b/0x1240 net/core/dev.c:6962
       handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
       do_softirq+0x11b/0x1e0 kernel/softirq.c:455
       </IRQ>
       <TASK>
       __local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
       local_bh_enable include/linux/bottom_half.h:33 [inline]
       rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline]
       __dev_queue_xmit+0x1764/0x3e80 net/core/dev.c:4451
       dev_queue_xmit include/linux/netdevice.h:3094 [inline]
       neigh_hh_output include/net/neighbour.h:526 [inline]
       neigh_output include/net/neighbour.h:540 [inline]
       ip_finish_output2+0xd41/0x1390 net/ipv4/ip_output.c:236
       ip_local_out net/ipv4/ip_output.c:130 [inline]
       __ip_queue_xmit+0x118c/0x1b80 net/ipv4/ip_output.c:536
       __tcp_transmit_skb+0x2544/0x3b30 net/ipv4/tcp_output.c:1466
       tcp_transmit_skb net/ipv4/tcp_output.c:1484 [inline]
       tcp_mtu_probe net/ipv4/tcp_output.c:2547 [inline]
       tcp_write_xmit+0x641d/0x6bf0 net/ipv4/tcp_output.c:2752
       __tcp_push_pending_frames+0x9b/0x360 net/ipv4/tcp_output.c:3015
       tcp_push_pending_frames include/net/tcp.h:2107 [inline]
       tcp_data_snd_check net/ipv4/tcp_input.c:5714 [inline]
       tcp_rcv_established+0x1026/0x2020 net/ipv4/tcp_input.c:6239
       tcp_v4_do_rcv+0x96d/0xc70 net/ipv4/tcp_ipv4.c:1915
       sk_backlog_rcv include/net/sock.h:1113 [inline]
       __release_sock+0x214/0x350 net/core/sock.c:3072
       release_sock+0x61/0x1f0 net/core/sock.c:3626
       mptcp_push_release net/mptcp/protocol.c:1486 [inline]
       __mptcp_push_pending+0x6b5/0x9f0 net/mptcp/protocol.c:1625
       mptcp_sendmsg+0x10bb/0x1b10 net/mptcp/protocol.c:1903
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg+0x1a6/0x270 net/socket.c:745
       ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2603
       ___sys_sendmsg net/socket.c:2657 [inline]
       __sys_sendmsg+0x2aa/0x390 net/socket.c:2686
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7fb06e9317f9
      Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffe2cfd4f98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007fb06e97f468 RCX: 00007fb06e9317f9
      RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000005
      RBP: 00007fb06e97f446 R08: 0000555500000000 R09: 0000555500000000
      R10: 0000555500000000 R11: 0000000000000246 R12: 00007fb06e97f406
      R13: 0000000000000001 R14: 00007ffe2cfd4fe0 R15: 0000000000000003
       </TASK>

    Additionally syzkaller provided a nice reproducer. The repro enables
    pmtu on the loopback device, leading to tcp_mtu_probe() generating
    very large probe packets.

    tcp_can_coalesce_send_queue_head() currently does not check for
    mptcp-level invariants, and allowed the creation of cross-DSS probes,
    leading to the mentioned corruption.

    Address the issue teaching tcp_can_coalesce_send_queue_head() about
    mptcp using the tcp_skb_can_collapse(), also reducing the code
    duplication.

    Fixes: 85712484110d ("tcp: coalesce/collapse must respect MPTCP extensions")
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+d1bff73460e33101f0e7@syzkaller.appspotmail.com
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/513
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20241008-net-mptcp-fallback-fixes-v1-2-c6fb8e93e551@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ Conflict in tcp_output.c, because the commit 65249feb6b3d ("net: add
      support for skbs with unreadable frags") is not in this version. This
      commit is linked to a new feature (Devmem TCP) and introduces a new
      condition which causes the conflicts. Resolving this is easy: we can
      ignore the missing new condition, and use tcp_skb_can_collapse() like
      in the original patch. ]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 647cd4494cc301f019267b901ab5cf71f3e54d57
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:06 2024 +0200

    serial: qcom-geni: fix receiver enable

    commit fa103d2599e11e802c818684cff821baefe7f206 upstream.

    The receiver is supposed to be enabled in the startup() callback and not
    in set_termios() which is called also during console setup.

    This specifically avoids accepting input before the port has been opened
    (and interrupts enabled), something which can also break the GENI
    firmware (cancel fails and after abort, the "stale" counter handling
    appears to be broken so that later input is not processed until twelve
    chars have been received).

    There also does not appear to be any need to keep the receiver disabled
    while updating the port settings.

    Since commit 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during
    console writes") the calls to manipulate the secondary interrupts, which
    were done without holding the port lock, can also lead to the receiver
    being left disabled when set_termios() races with the console code (e.g.
    when init opens the tty during boot). This can manifest itself as a
    serial getty not accepting input.

    The calls to stop and start rx in set_termios() can similarly race with
    DMA completion and, for example, cause the DMA buffer to be unmapped
    twice or the mapping to be leaked.

    Fix this by only enabling the receiver during startup and while holding
    the port lock to avoid racing with the console code.

    Fixes: 6f3c3cafb115 ("serial: qcom-geni: disable interrupts during console writes")
    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-6-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 61c8f746ed831c4e8753bfbf0ccd08c20b13f83a
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:05 2024 +0200

    serial: qcom-geni: fix dma rx cancellation

    commit 23ee4a25661c33e6381d41e848a9060ed6d72845 upstream.

    Make sure to wait for the DMA transfer to complete when cancelling the
    rx command on stop_rx(). This specifically prevents the DMA completion
    interrupt from firing after rx has been restarted, something which can
    lead to an IOMMU fault and hosed rx when the interrupt handler unmaps
    the DMA buffer for the new command:

    	qcom_geni_serial 988000.serial: serial engine reports 0 RX bytes in!
    	arm-smmu 15000000.iommu: FSR    = 00000402 [Format=2 TF], SID=0x563
    	arm-smmu 15000000.iommu: FSYNR0 = 00210013 [S1CBNDX=33 WNR PLVL=3]
    	Bluetooth: hci0: command 0xfc00 tx timeout
    	Bluetooth: hci0: Reading QCA version information failed (-110)

    Also add the missing state machine reset which is needed in case
    cancellation fails.

    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Cc: stable@vger.kernel.org      # 6.3
    Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-5-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7176aee5a1b20ae4da1082d6fc59a3b58383f079
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:03 2024 +0200

    serial: qcom-geni: revert broken hibernation support

    commit 19df76662a33d2f2fc41a66607cb8285fc02d6ec upstream.

    This reverts commit 35781d8356a2eecaa6074ceeb80ee22e252fcdae.

    Hibernation is not supported on Qualcomm platforms with mainline
    kernels yet a broken vendor implementation for the GENI serial driver
    made it upstream.

    This is effectively dead code that cannot be tested and should just be
    removed, but if these paths were ever hit for an open non-console port
    they would crash the machine as the driver would fail to enable clocks
    during restore() (i.e. all ports would have to be closed by drivers and
    user space before hibernating the system to avoid this as a comment in
    the code hinted at).

    The broken implementation also added a random call to enable the
    receiver in the port setup code where it does not belong and which
    enables the receiver prematurely for console ports.

    Fixes: 35781d8356a2 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature")
    Cc: stable@vger.kernel.org	# 6.2
    Cc: Aniket Randive <quic_arandive@quicinc.com>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-3-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90e3f819e6aacfcf5b297d4769744f42b5a749c8
Author: Johan Hovold <johan+linaro@kernel.org>
Date:   Wed Oct 9 16:51:02 2024 +0200

    serial: qcom-geni: fix polled console initialisation

    commit 4bef7c6f299910f19876ad8e7f5897514855f1d2 upstream.

    The polled console (KGDB/KDB) implementation must not call port setup
    unconditionally as the port may already be in use by the console or a
    getty.

    Only make sure that the receiver is enabled, but do not enable any
    device interrupts.

    Fixes: d8851a96ba25 ("tty: serial: qcom-geni-serial: Add a poll_init() function")
    Cc: stable@vger.kernel.org	# 6.4
    Cc: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Link: https://lore.kernel.org/r/20241009145110.16847-2-johan+linaro@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6acd19ad3aaf270b19e704b5cff14808766fca84
Author: Nam Cao <namcao@linutronix.de>
Date:   Thu Oct 3 10:41:52 2024 +0200

    irqchip/sifive-plic: Unmask interrupt in plic_irq_enable()

    commit 6b1e0651e9ce8ce418ad4ff360e7b9925dc5da79 upstream.

    It is possible that an interrupt is disabled and masked at the same time.
    When the interrupt is enabled again by enable_irq(), only plic_irq_enable()
    is called, not plic_irq_unmask(). The interrupt remains masked and never
    raises.

    An example where interrupt is both disabled and masked is when
    handle_fasteoi_irq() is the handler, and IRQS_ONESHOT is set. The interrupt
    handler:

      1. Mask the interrupt
      2. Handle the interrupt
      3. Check if interrupt is still enabled, and unmask it (see
         cond_unmask_eoi_irq())

    If another task disables the interrupt in the middle of the above steps,
    the interrupt will not get unmasked, and will remain masked when it is
    enabled in the future.

    The problem is occasionally observed when PREEMPT_RT is enabled, because
    PREEMPT_RT adds the IRQS_ONESHOT flag. But PREEMPT_RT only makes the problem
    more likely to appear, the bug has been around since commit a1706a1c5062
    ("irqchip/sifive-plic: Separate the enable and mask operations").

    Fix it by unmasking interrupt in plic_irq_enable().

    Fixes: a1706a1c5062 ("irqchip/sifive-plic: Separate the enable and mask operations")
    Signed-off-by: Nam Cao <namcao@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241003084152.2422969-1-namcao@linutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 01282ab5182f85e42234df2ff42f0ce790f465ff
Author: Marc Zyngier <maz@kernel.org>
Date:   Wed Oct 2 21:49:59 2024 +0100

    irqchip/gic-v4: Don't allow a VMOVP on a dying VPE

    commit 1442ee0011983f0c5c4b92380e6853afb513841a upstream.

    Kunkun Jiang reported that there is a small window of opportunity for
    userspace to force a change of affinity for a VPE while the VPE has already
    been unmapped, but the corresponding doorbell interrupt still visible in
    /proc/irq/.

    Plug the race by checking the value of vmapp_count, which tracks whether
    the VPE is mapped ot not, and returning an error in this case.

    This involves making vmapp_count common to both GICv4.1 and its v4.0
    ancestor.

    Fixes: 64edfaa9a234 ("irqchip/gic-v4.1: Implement the v4.1 flavour of VMAPP")
    Reported-by: Kunkun Jiang <jiangkunkun@huawei.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/c182ece6-2ba0-ce4f-3404-dba7a3ab6c52@huawei.com
    Link: https://lore.kernel.org/all/20241002204959.2051709-1-maz@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fad940e2dd789155f99ecafa71a7baf6f96530bc
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Thu Sep 5 10:09:17 2024 +0800

    pinctrl: apple: check devm_kasprintf() returned value

    commit 665a58fe663ac7a9ea618dc0b29881649324b116 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/20240905020917.356534-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3b36bb1fca2b87f6292ca2a8593f297c5e9fab41
Author: Ma Ke <make24@iscas.ac.cn>
Date:   Fri Sep 6 18:03:26 2024 +0800

    pinctrl: stm32: check devm_kasprintf() returned value

    commit b0f0e3f0552a566def55c844b0d44250c58e4df6 upstream.

    devm_kasprintf() can return a NULL pointer on failure but this returned
    value is not checked. Fix this lack and check the returned value.

    Found by code review.

    Cc: stable@vger.kernel.org
    Fixes: 32c170ff15b0 ("pinctrl: stm32: set default gpio line names using pin names")
    Signed-off-by: Ma Ke <make24@iscas.ac.cn>
    Link: https://lore.kernel.org/20240906100326.624445-1-make24@iscas.ac.cn
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 20728e86289ab463b99b7ab4425515bd26aba417
Author: Sergey Matsievskiy <matsievskiysv@gmail.com>
Date:   Sat Oct 12 13:57:43 2024 +0300

    pinctrl: ocelot: fix system hang on level based interrupts

    commit 93b8ddc54507a227087c60a0013ed833b6ae7d3c upstream.

    The current implementation only calls chained_irq_enter() and
    chained_irq_exit() if it detects pending interrupts.

    ```
    for (i = 0; i < info->stride; i++) {
    	uregmap_read(info->map, id_reg + 4 * i, &reg);
    	if (!reg)
    		continue;

    	chained_irq_enter(parent_chip, desc);
    ```

    However, in case of GPIO pin configured in level mode and the parent
    controller configured in edge mode, GPIO interrupt might be lowered by the
    hardware. In the result, if the interrupt is short enough, the parent
    interrupt is still pending while the GPIO interrupt is cleared;
    chained_irq_enter() never gets called and the system hangs trying to
    service the parent interrupt.

    Moving chained_irq_enter() and chained_irq_exit() outside the for loop
    ensures that they are called even when GPIO interrupt is lowered by the
    hardware.

    The similar code with chained_irq_enter() / chained_irq_exit() functions
    wrapping interrupt checking loop may be found in many other drivers:
    ```
    grep -r -A 10 chained_irq_enter drivers/pinctrl
    ```

    Cc: stable@vger.kernel.org
    Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
    Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
    Link: https://lore.kernel.org/20241012105743.12450-2-matsievskiysv@gmail.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 481b477ab63c7245715a3e57ba79eb87c2dc0d02
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Sep 26 09:10:31 2024 -0700

    x86/bugs: Use code segment selector for VERW operand

    commit e4d2102018542e3ae5e297bc6e229303abff8a0f upstream.

    Robert Gill reported below #GP in 32-bit mode when dosemu software was
    executing vm86() system call:

      general protection fault: 0000 [#1] PREEMPT SMP
      CPU: 4 PID: 4610 Comm: dosemu.bin Not tainted 6.6.21-gentoo-x86 #1
      Hardware name: Dell Inc. PowerEdge 1950/0H723K, BIOS 2.7.0 10/30/2010
      EIP: restore_all_switch_stack+0xbe/0xcf
      EAX: 00000000 EBX: 00000000 ECX: 00000000 EDX: 00000000
      ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: ff8affdc
      DS: 0000 ES: 0000 FS: 0000 GS: 0033 SS: 0068 EFLAGS: 00010046
      CR0: 80050033 CR2: 00c2101c CR3: 04b6d000 CR4: 000406d0
      Call Trace:
       show_regs+0x70/0x78
       die_addr+0x29/0x70
       exc_general_protection+0x13c/0x348
       exc_bounds+0x98/0x98
       handle_exception+0x14d/0x14d
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf
       exc_bounds+0x98/0x98
       restore_all_switch_stack+0xbe/0xcf

    This only happens in 32-bit mode when VERW based mitigations like MDS/RFDS
    are enabled. This is because segment registers with an arbitrary user value
    can result in #GP when executing VERW. Intel SDM vol. 2C documents the
    following behavior for VERW instruction:

      #GP(0) - If a memory operand effective address is outside the CS, DS, ES,
    	   FS, or GS segment limit.

    CLEAR_CPU_BUFFERS macro executes VERW instruction before returning to user
    space. Use %cs selector to reference VERW operand. This ensures VERW will
    not #GP for an arbitrary user %ds.

    [ mingo: Fixed the SOB chain. ]

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Robert Gill <rtgill82@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com
    Cc: stable@vger.kernel.org # 5.10+
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218707
    Closes: https://lore.kernel.org/all/8c77ccfd-d561-45a1-8ed5-6b75212c7a58@leemhuis.info/
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Suggested-by: Brian Gerst <brgerst@gmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c29f192e0d44cc1cbaf698fa1ff198f63556691a
Author: Longlong Xia <xialonglong@kylinos.cn>
Date:   Thu Sep 26 21:02:13 2024 +0800

    tty: n_gsm: Fix use-after-free in gsm_cleanup_mux

    commit 9462f4ca56e7d2430fdb6dcc8498244acbfc4489 upstream.

    BUG: KASAN: slab-use-after-free in gsm_cleanup_mux+0x77b/0x7b0
    drivers/tty/n_gsm.c:3160 [n_gsm]
    Read of size 8 at addr ffff88815fe99c00 by task poc/3379
    CPU: 0 UID: 0 PID: 3379 Comm: poc Not tainted 6.11.0+ #56
    Hardware name: VMware, Inc. VMware Virtual Platform/440BX
    Desktop Reference Platform, BIOS 6.00 11/12/2020
    Call Trace:
     <TASK>
     gsm_cleanup_mux+0x77b/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     __pfx_gsm_cleanup_mux+0x10/0x10 drivers/tty/n_gsm.c:3124 [n_gsm]
     __pfx_sched_clock_cpu+0x10/0x10 kernel/sched/clock.c:389
     update_load_avg+0x1c1/0x27b0 kernel/sched/fair.c:4500
     __pfx_min_vruntime_cb_rotate+0x10/0x10 kernel/sched/fair.c:846
     __rb_insert_augmented+0x492/0xbf0 lib/rbtree.c:161
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     _raw_spin_lock_irqsave+0x92/0xf0 arch/x86/include/asm/atomic.h:107
     __pfx_gsmld_ioctl+0x10/0x10 drivers/tty/n_gsm.c:3822 [n_gsm]
     ktime_get+0x5e/0x140 kernel/time/timekeeping.c:195
     ldsem_down_read+0x94/0x4e0 arch/x86/include/asm/atomic64_64.h:79
     __pfx_ldsem_down_read+0x10/0x10 drivers/tty/tty_ldsem.c:338
     __pfx_do_vfs_ioctl+0x10/0x10 fs/ioctl.c:805
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    Allocated by task 65:
     gsm_data_alloc.constprop.0+0x27/0x190 drivers/tty/n_gsm.c:926 [n_gsm]
     gsm_send+0x2c/0x580 drivers/tty/n_gsm.c:819 [n_gsm]
     gsm1_receive+0x547/0xad0 drivers/tty/n_gsm.c:3038 [n_gsm]
     gsmld_receive_buf+0x176/0x280 drivers/tty/n_gsm.c:3609 [n_gsm]
     tty_ldisc_receive_buf+0x101/0x1e0 drivers/tty/tty_buffer.c:391
     tty_port_default_receive_buf+0x61/0xa0 drivers/tty/tty_port.c:39
     flush_to_ldisc+0x1b0/0x750 drivers/tty/tty_buffer.c:445
     process_scheduled_works+0x2b0/0x10d0 kernel/workqueue.c:3229
     worker_thread+0x3dc/0x950 kernel/workqueue.c:3391
     kthread+0x2a3/0x370 kernel/kthread.c:389
     ret_from_fork+0x2d/0x70 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:257

    Freed by task 3367:
     kfree+0x126/0x420 mm/slub.c:4580
     gsm_cleanup_mux+0x36c/0x7b0 drivers/tty/n_gsm.c:3160 [n_gsm]
     gsmld_ioctl+0x395/0x1450 drivers/tty/n_gsm.c:3408 [n_gsm]
     tty_ioctl+0x643/0x1100 drivers/tty/tty_io.c:2818

    [Analysis]
    gsm_msg on the tx_ctrl_list or tx_data_list of gsm_mux
    can be freed by multi threads through ioctl,which leads
    to the occurrence of uaf. Protect it by gsm tx lock.

    Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>
    Cc: stable <stable@kernel.org>
    Suggested-by: Jiri Slaby <jirislaby@kernel.org>
    Link: https://lore.kernel.org/r/20240926130213.531959-1-xialonglong@kylinos.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 227358e89703c344008119be7e8ffa3fdb5b92de
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:44 2024 -0700

    x86/entry_32: Clear CPU buffers after register restore in NMI return

    commit 48a2440d0f20c826b884e04377ccc1e4696c84e9 upstream.

    CPU buffers are currently cleared after call to exc_nmi, but before
    register state is restored. This may be okay for MDS mitigation but not for
    RDFS. Because RDFS mitigation requires CPU buffers to be cleared when
    registers don't have any sensitive data.

    Move CLEAR_CPU_BUFFERS after RESTORE_ALL_NMI.

    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-2-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c6a7e2c6012cee8273f2b7c1a335a609f8a73b7
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Wed Sep 25 15:25:38 2024 -0700

    x86/entry_32: Do not clobber user EFLAGS.ZF

    commit 2e2e5143d4868163d6756c8c6a4d28cbfa5245e5 upstream.

    Opportunistic SYSEXIT executes VERW to clear CPU buffers after user EFLAGS
    are restored. This can clobber user EFLAGS.ZF.

    Move CLEAR_CPU_BUFFERS before the user EFLAGS are restored. This ensures
    that the user EFLAGS.ZF is not clobbered.

    Closes: https://lore.kernel.org/lkml/yVXwe8gvgmPADpRB6lXlicS2fcHoV5OHHxyuFbB_MEleRPD7-KhGe5VtORejtPe-KCkT8Uhcg5d7-IBw4Ojb4H7z5LQxoZylSmJ8KNL3A8o=@protonmail.com/
    Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
    Reported-by: Jari Ruusu <jariruusu@protonmail.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-1-1de0daca2d42%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c8170b5ddc411201f8de0a654901f204a2cdd415
Author: John Allen <john.allen@amd.com>
Date:   Mon Sep 23 16:44:04 2024 +0000

    x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load

    commit ee4d4e8d2c3bec6ee652599ab31991055a72c322 upstream.

    Commit

      f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")

    causes a bit in the DE_CFG MSR to get set erroneously after a microcode late
    load.

    The microcode late load path calls into amd_check_microcode() and subsequently
    zen2_zenbleed_check(). Since the above commit removes the cpu_has_amd_erratum()
    call from zen2_zenbleed_check(), this will cause all non-Zen2 CPUs to go
    through the function and set the bit in the DE_CFG MSR.

    Call into the Zenbleed fix path on Zen2 CPUs only.

      [ bp: Massage commit message, use cpu_feature_enabled(). ]

    Fixes: f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")
    Signed-off-by: John Allen <john.allen@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20240923164404.27227-1-john.allen@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6663f0c658857e9ebb87ed6b98c0126bbaa2bf46
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Tue Oct 15 14:15:22 2024 +0800

    x86/apic: Always explicitly disarm TSC-deadline timer

    commit ffd95846c6ec6cf1f93da411ea10d504036cab42 upstream.

    New processors have become pickier about the local APIC timer state
    before entering low power modes. These low power modes are used (for
    example) when you close your laptop lid and suspend. If you put your
    laptop in a bag and it is not in this low power mode, it is likely
    to get quite toasty while it quickly sucks the battery dry.

    The problem boils down to some CPUs' inability to power down until the
    CPU recognizes that the local APIC timer is shut down. The current
    kernel code works in one-shot and periodic modes but does not work for
    deadline mode. Deadline mode has been the supported and preferred mode
    on Intel CPUs for over a decade and uses an MSR to drive the timer
    instead of an APIC register.

    Disable the TSC Deadline timer in lapic_timer_shutdown() by writing to
    MSR_IA32_TSC_DEADLINE when in TSC-deadline mode. Also avoid writing
    to the initial-count register (APIC_TMICT) which is ignored in
    TSC-deadline mode.

    Note: The APIC_LVTT|=APIC_LVT_MASKED operation should theoretically be
    enough to tell the hardware that the timer will not fire in any of the
    timer modes. But mitigating AMD erratum 411[1] also requires clearing
    out APIC_TMICT. Solely setting APIC_LVT_MASKED is also ineffective in
    practice on Intel Lunar Lake systems, which is the motivation for this
    change.

    1. 411 Processor May Exit Message-Triggered C1E State Without an Interrupt if Local APIC Timer Reaches Zero - https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/revision-guides/41322_10h_Rev_Gd.pdf

    Fixes: 279f1461432c ("x86: apic: Use tsc deadline for oneshot when available")
    Suggested-by: Dave Hansen <dave.hansen@intel.com>
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Tested-by: Todd Brandt <todd.e.brandt@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20241015061522.25288-1-rui.zhang%40intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 16d7d35f1c1e2a3a5cb14c91fe0f1922068942c9
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Tue Sep 17 09:02:53 2024 -0700

    x86/resctrl: Annotate get_mem_config() functions as __init

    commit d5fd042bf4cfb557981d65628e1779a492cd8cfa upstream.

    After a recent LLVM change [1] that deduces __cold on functions that only call
    cold code (such as __init functions), there is a section mismatch warning from
    __get_mem_config_intel(), which got moved to .text.unlikely. as a result of
    that optimization:

      WARNING: modpost: vmlinux: section mismatch in reference: \
      __get_mem_config_intel+0x77 (section: .text.unlikely.) -> thread_throttle_mode_init (section: .init.text)

    Mark __get_mem_config_intel() as __init as well since it is only called
    from __init code, which clears up the warning.

    While __rdt_get_mem_config_amd() does not exhibit a warning because it
    does not call any __init code, it is a similar function that is only
    called from __init code like __get_mem_config_intel(), so mark it __init
    as well to keep the code symmetrical.

    CONFIG_SECTION_MISMATCH_WARN_ONLY=n would turn this into a fatal error.

    Fixes: 05b93417ce5b ("x86/intel_rdt/mba: Add primary support for Memory Bandwidth Allocation (MBA)")
    Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature")
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Cc: <stable@kernel.org>
    Link: https://github.com/llvm/llvm-project/commit/6b11573b8c5e3d36beee099dbe7347c2a007bf53 [1]
    Link: https://lore.kernel.org/r/20240917-x86-restctrl-get_mem_config_intel-init-v3-1-10d521256284@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 66029078fee00646e2e9dbb8f41ff7819f8e7569
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Sep 20 12:32:19 2024 +0200

    parport: Proper fix for array out-of-bounds access

    commit 02ac3a9ef3a18b58d8f3ea2b6e46de657bf6c4f9 upstream.

    The recent fix for array out-of-bounds accesses replaced sprintf()
    calls blindly with snprintf().  However, since snprintf() returns the
    would-be-printed size, not the actually output size, the length
    calculation can still go over the given limit.

    Use scnprintf() instead of snprintf(), which returns the actually
    output letters, for addressing the potential out-of-bounds access
    properly.

    Fixes: ab11dac93d2d ("dev/parport: fix the array out-of-bounds risk")
    Cc: stable@vger.kernel.org
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://lore.kernel.org/r/20240920103318.19271-1-tiwai@suse.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c895d48c843dee8baf5327dee33ce786760c9d44
Author: Marek Vasut <marex@denx.de>
Date:   Wed Oct 2 20:40:38 2024 +0200

    serial: imx: Update mctrl old_status on RTSD interrupt

    commit 40d7903386df4d18f04d90510ba90eedee260085 upstream.

    When sending data using DMA at high baudrate (4 Mbdps in local test case) to
    a device with small RX buffer which keeps asserting RTS after every received
    byte, it is possible that the iMX UART driver would not recognize the falling
    edge of RTS input signal and get stuck, unable to transmit any more data.

    This condition happens when the following sequence of events occur:
    - imx_uart_mctrl_check() is called at some point and takes a snapshot of UART
      control signal status into sport->old_status using imx_uart_get_hwmctrl().
      The RTSS/TIOCM_CTS bit is of interest here (*).
    - DMA transfer occurs, the remote device asserts RTS signal after each byte.
      The i.MX UART driver recognizes each such RTS signal change, raises an
      interrupt with USR1 register RTSD bit set, which leads to invocation of
      __imx_uart_rtsint(), which calls uart_handle_cts_change().
      - If the RTS signal is deasserted, uart_handle_cts_change() clears
        port->hw_stopped and unblocks the port for further data transfers.
      - If the RTS is asserted, uart_handle_cts_change() sets port->hw_stopped
        and blocks the port for further data transfers. This may occur as the
        last interrupt of a transfer, which means port->hw_stopped remains set
        and the port remains blocked (**).
    - Any further data transfer attempts will trigger imx_uart_mctrl_check(),
      which will read current status of UART control signals by calling
      imx_uart_get_hwmctrl() (***) and compare it with sport->old_status .
      - If current status differs from sport->old_status for RTS signal,
        uart_handle_cts_change() is called and possibly unblocks the port
        by clearing port->hw_stopped .
      - If current status does not differ from sport->old_status for RTS
        signal, no action occurs. This may occur in case prior snapshot (*)
        was taken before any transfer so the RTS is deasserted, current
        snapshot (***) was taken after a transfer and therefore RTS is
        deasserted again, which means current status and sport->old_status
        are identical. In case (**) triggered when RTS got asserted, and
        made port->hw_stopped set, the port->hw_stopped will remain set
        because no change on RTS line is recognized by this driver and
        uart_handle_cts_change() is not called from here to unblock the
        port->hw_stopped.

    Update sport->old_status in __imx_uart_rtsint() accordingly to make
    imx_uart_mctrl_check() detect such RTS change. Note that TIOCM_CAR
    and TIOCM_RI bits in sport->old_status do not suffer from this problem.

    Fixes: ceca629e0b48 ("[ARM] 2971/1: i.MX uart handle rts irq")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Esben Haabendal <esben@geanix.com>
    Signed-off-by: Marek Vasut <marex@denx.de>
    Link: https://lore.kernel.org/r/20241002184133.19427-1-marex@denx.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 245bee12a52d55312aa3948ddae6887788566893
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:22 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for OTP device

    commit 2471787c1f0dae6721f60ab44be37460635d3732 upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 0969001569e4 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-2-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 78df42183e824d368e5d45169c6b7c506d81f690
Author: Heiko Thiery <heiko.thiery@gmail.com>
Date:   Mon Oct 7 09:11:20 2024 +0200

    misc: microchip: pci1xxxx: add support for NVMEM_DEVID_AUTO for EEPROM device

    commit 3c2d73de49be528276474c1a53f78b38ee11c1fa upstream.

    By using NVMEM_DEVID_AUTO we support more than 1 device and
    automatically enumerate.

    Fixes: 9ab5465349c0 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX EEPROM via NVMEM sysfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
    Reviewed-by: Michael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20241007071120.9522-1-heiko.thiery@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c3d3501cf896cd6b75f9b018d59247322ac5a4eb
Author: Prashanth K <quic_prashk@quicinc.com>
Date:   Tue Sep 24 15:02:08 2024 +0530

    usb: dwc3: Wait for EndXfer completion before restoring GUSB2PHYCFG

    commit c96e31252110a84dcc44412e8a7b456b33c3e298 upstream.

    DWC3 programming guide mentions that when operating in USB2.0 speeds,
    if GUSB2PHYCFG[6] or GUSB2PHYCFG[8] is set, it must be cleared prior
    to issuing commands and may be set again  after the command completes.
    But currently while issuing EndXfer command without CmdIOC set, we
    wait for 1ms after GUSB2PHYCFG is restored. This results in cases
    where EndXfer command doesn't get completed and causes SMMU faults
    since requests are unmapped afterwards. Hence restore GUSB2PHYCFG
    after waiting for EndXfer command completion.

    Cc: stable@vger.kernel.org
    Fixes: 1d26ba0944d3 ("usb: dwc3: Wait unconditionally after issuing EndXfer command")
    Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20240924093208.2524531-1-quic_prashk@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 479830f6c15b1a3e3c1488762a8a3bcf93e2b94f
Author: Jonathan Marek <jonathan@marek.ca>
Date:   Sat Oct 5 10:41:46 2024 -0400

    usb: typec: qcom-pmic-typec: fix sink status being overwritten with RP_DEF

    commit ffe85c24d7ca5de7d57690c0ab194b3838674935 upstream.

    This line is overwriting the result of the above switch-case.

    This fixes the tcpm driver getting stuck in a "Sink TX No Go" loop.

    Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jonathan Marek <jonathan@marek.ca>
    Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Link: https://lore.kernel.org/r/20241005144146.2345-1-jonathan@marek.ca
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 86c68aa714d0e5082ccee8f0679cb69821cf8339
Author: Daniele Palmas <dnlplm@gmail.com>
Date:   Thu Oct 3 11:38:08 2024 +0200

    USB: serial: option: add Telit FN920C04 MBIM compositions

    commit 6d951576ee16430822a8dee1e5c54d160e1de87d upstream.

    Add the following Telit FN920C04 compositions:

    0x10a2: MBIM + tty (AT/NMEA) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 17 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a2 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10a7: MBIM + tty (AT) + tty (AT) + tty (diag)
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 18 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10a7 Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    0x10aa: MBIM + tty (AT) + tty (diag) + DPL (data packet logging) + adb
    T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 15 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=10aa Rev=05.15
    S:  Manufacturer=Telit Cinterion
    S:  Product=FN920
    S:  SerialNumber=92c4c4d8
    C:  #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 90a5c64279ae5b906604cfb3809a25fb2d91d674
Author: Benjamin B. Frost <benjamin@geanix.com>
Date:   Wed Sep 11 10:54:05 2024 +0200

    USB: serial: option: add support for Quectel EG916Q-GL

    commit 540eff5d7faf0c9330ec762da49df453263f7676 upstream.

    Add Quectel EM916Q-GL with product ID 0x6007

    T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c7c ProdID=6007 Rev= 2.00
    S:  Manufacturer=Quectel
    S:  Product=EG916Q-GL
    C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=200mA
    A:  FirstIf#= 4 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
    I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=84(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=86(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=88(I) Atr=03(Int.) MxPS=  32 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    I:* If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

    MI_00 Quectel USB Diag Port
    MI_01 Quectel USB NMEA Port
    MI_02 Quectel USB AT Port
    MI_03 Quectel USB Modem Port
    MI_04 Quectel USB Net Port

    Signed-off-by: Benjamin B. Frost <benjamin@geanix.com>
    Reviewed-by: Lars Melin <larsm17@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 53cd1bb1f8ebf961a7be197734465893a8930a58
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:58 2024 +0300

    xhci: Mitigate failed set dequeue pointer commands

    commit fe49df60cdb7c2975aa743dc295f8786e4b7db10 upstream.

    Avoid xHC host from processing a cancelled URB by always turning
    cancelled URB TDs into no-op TRBs before queuing a 'Set TR Deq' command.

    If the command fails then xHC will start processing the cancelled TD
    instead of skipping it once endpoint is restarted, causing issues like
    Babble error.

    This is not a complete solution as a failed 'Set TR Deq' command does not
    guarantee xHC TRB caches are cleared.

    Fixes: 4db356924a50 ("xhci: turn cancelled td cleanup to its own function")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-3-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc7b7050996ac46a7236864a3c86adfd69829a14
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Oct 16 16:59:57 2024 +0300

    xhci: Fix incorrect stream context type macro

    commit 6599b6a6fa8060145046d0744456b6abdb3122a7 upstream.

    The stream contex type (SCT) bitfield is used both in the stream context
    data structure,  and in the 'Set TR Dequeue pointer' command TRB.
    In both cases it uses bits 3:1

    The SCT_FOR_TRB(p) macro used to set the stream context type (SCT) field
    for the 'Set TR Dequeue pointer' command TRB incorrectly shifts the value
    1 bit left before masking the three bits.

    Fix this by first masking and rshifting, just like the similar
    SCT_FOR_CTX(p) macro does

    This issue has not been visibile as the lost bit 3 is only used with
    secondary stream arrays (SSA). Xhci driver currently only supports using
    a primary stream array with Linear stream addressing.

    Fixes: 95241dbdf828 ("xhci: Set SCT field for Set TR dequeue on streams")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20241016140000.783905-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9c696bf4ab54c7cec81221887564305f0ceeac0a
Author: Henry Lin <henryl@nvidia.com>
Date:   Mon Oct 14 12:21:34 2024 +0800

    xhci: tegra: fix checked USB2 port number

    commit 7d381137cb6ecf558ef6698c7730ddd482d4c8f2 upstream.

    If USB virtualizatoin is enabled, USB2 ports are shared between all
    Virtual Functions. The USB2 port number owned by an USB2 root hub in
    a Virtual Function may be less than total USB2 phy number supported
    by the Tegra XUSB controller.

    Using total USB2 phy number as port number to check all PORTSC values
    would cause invalid memory access.

    [  116.923438] Unable to handle kernel paging request at virtual address 006c622f7665642f
    ...
    [  117.213640] Call trace:
    [  117.216783]  tegra_xusb_enter_elpg+0x23c/0x658
    [  117.222021]  tegra_xusb_runtime_suspend+0x40/0x68
    [  117.227260]  pm_generic_runtime_suspend+0x30/0x50
    [  117.232847]  __rpm_callback+0x84/0x3c0
    [  117.237038]  rpm_suspend+0x2dc/0x740
    [  117.241229] pm_runtime_work+0xa0/0xb8
    [  117.245769]  process_scheduled_works+0x24c/0x478
    [  117.251007]  worker_thread+0x23c/0x328
    [  117.255547]  kthread+0x104/0x1b0
    [  117.259389]  ret_from_fork+0x10/0x20
    [  117.263582] Code: 54000222 f9461ae8 f8747908 b4ffff48 (f9400100)

    Cc: stable@vger.kernel.org # v6.3+
    Fixes: a30951d31b25 ("xhci: tegra: USB2 pad power controls")
    Signed-off-by: Henry Lin <henryl@nvidia.com>
    Link: https://lore.kernel.org/r/20241014042134.27664-1-henryl@nvidia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc2d5f02636c7587bdd6d1f60fc59c55860b00a4
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Fri Oct 11 02:46:19 2024 +0900

    vt: prevent kernel-infoleak in con_font_get()

    commit f956052e00de211b5c9ebaa1958366c23f82ee9e upstream.

    font.data may not initialize all memory spaces depending on the implementation
    of vc->vc_sw->con_font_get. This may cause info-leak, so to prevent this, it
    is safest to modify it to initialize the allocated memory space to 0, and it
    generally does not affect the overall performance of the system.

    Cc: stable@vger.kernel.org
    Reported-by: syzbot+955da2d57931604ee691@syzkaller.appspotmail.com
    Fixes: 05e2600cb0a4 ("VT: Bump font size limitation to 64x128 pixels")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    Link: https://lore.kernel.org/r/20241010174619.59662-1-aha310510@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 885f8c873fedf3393c76827c4821071bf5fd16b1
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Oct 16 11:47:00 2024 -0400

    Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001

    commit 2c1dda2acc4192d826e84008d963b528e24d12bc upstream.

    Fake CSR controllers don't seem to handle short-transfer properly which
    cause command to time out:

    kernel: usb 1-1: new full-speed USB device number 19 using xhci_hcd
    kernel: usb 1-1: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
    kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    kernel: usb 1-1: Product: BT DONGLE10
    ...
    Bluetooth: hci1: Opcode 0x1004 failed: -110
    kernel: Bluetooth: hci1: command 0x1004 tx timeout

    According to USB Spec 2.0 Section 5.7.3 Interrupt Transfer Packet Size
    Constraints a interrupt transfer is considered complete when the size is 0
    (ZPL) or < wMaxPacketSize:

     'When an interrupt transfer involves more data than can fit in one
     data payload of the currently established maximum size, all data
     payloads are required to be maximum-sized except for the last data
     payload, which will contain the remaining data. An interrupt transfer
     is complete when the endpoint does one of the following:

     • Has transferred exactly the amount of data expected
     • Transfers a packet with a payload size less than wMaxPacketSize or
     transfers a zero-length packet'

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=219365
    Fixes: 7b05933340f4 ("Bluetooth: btusb: Fix not handling ZPL/short-transfer")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8fb8e912afb4c47dec12ea9a5853e7a8db95816f
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:08 2024 +0000

    Bluetooth: ISO: Fix multiple init when debugfs is disabled

    commit a9b7b535ba192c6b77e6c15a4c82d853163eab8c upstream.

    If bt_debugfs is not created successfully, which happens if either
    CONFIG_DEBUG_FS or CONFIG_DEBUG_FS_ALLOW_ALL is unset, then iso_init()
    returns early and does not set iso_inited to true. This means that a
    subsequent call to iso_init() will result in duplicate calls to
    proto_register(), bt_sock_register(), etc.

    With CONFIG_LIST_HARDENED and CONFIG_BUG_ON_DATA_CORRUPTION enabled, the
    duplicate call to proto_register() triggers this BUG():

      list_add double add: new=ffffffffc0b280d0, prev=ffffffffbab56250,
        next=ffffffffc0b280d0.
      ------------[ cut here ]------------
      kernel BUG at lib/list_debug.c:35!
      Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI
      CPU: 2 PID: 887 Comm: bluetoothd Not tainted 6.10.11-1-ao-desktop #1
      RIP: 0010:__list_add_valid_or_report+0x9a/0xa0
      ...
        __list_add_valid_or_report+0x9a/0xa0
        proto_register+0x2b5/0x340
        iso_init+0x23/0x150 [bluetooth]
        set_iso_socket_func+0x68/0x1b0 [bluetooth]
        kmem_cache_free+0x308/0x330
        hci_sock_sendmsg+0x990/0x9e0 [bluetooth]
        __sock_sendmsg+0x7b/0x80
        sock_write_iter+0x9a/0x110
        do_iter_readv_writev+0x11d/0x220
        vfs_writev+0x180/0x3e0
        do_writev+0xca/0x100
      ...

    This change removes the early return. The check for iso_debugfs being
    NULL was unnecessary, it is always NULL when iso_inited is false.

    Cc: stable@vger.kernel.org
    Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
    Signed-off-by: Aaron Thompson <dev@aaront.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 59bd80df4b88e28e37524105b3ec1853bae32713
Author: Aaron Thompson <dev@aaront.org>
Date:   Fri Oct 4 23:04:10 2024 +0000

    Bluetooth: Remove debugfs directory on module init failure

    commit 1db4564f101b47188c1b71696bd342ef09172b22 upstream.

    If bt_init() fails, the debugfs directory currently is not removed. If
    the module is loaded again after that, the debugfs directory is not set
    up properly due to the existing directory.

      # modprobe bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:26 ./
      drwx------ 31 root root 0 Sep 27 14:25 ../
      -r--r--r--  1 root root 0 Sep 27 14:26 l2cap
      -r--r--r--  1 root root 0 Sep 27 14:26 sco
      # modprobe -r bluetooth
      # ls -laF /sys/kernel/debug/bluetooth
      ls: cannot access '/sys/kernel/debug/bluetooth': No such file or directory
      #

      # modprobe bluetooth
      modprobe: ERROR: could not insert 'bluetooth': Invalid argument
      # dmesg | tail -n 6
      Bluetooth: Core ver 2.22
      NET: Registered PF_BLUETOOTH protocol family
      Bluetooth: HCI device and connection manager initialized
      Bluetooth: HCI socket layer initialized
      Bluetooth: Faking l2cap_init() failure for testing
      NET: Unregistered PF_BLUETOOTH protocol family
      # ls -laF /sys/kernel/debug/bluetooth
      total 0
      drwxr-xr-x  2 root root 0 Sep 27 14:31 ./
      drwx------ 31 root roo…
qaz6750 added a commit that referenced this pull request Nov 30, 2024
commit 9b5aad3a7498c261116a0251fe57f14ba9c4c6cf
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Nov 8 16:28:28 2024 +0100

    Linux 6.6.60

    Link: https://lore.kernel.org/r/20241106120308.841299741@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Hardik Garg <hargar@linux.microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc082e50375a29596153fc3f1f8fc85ad1b0b5b9
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date:   Thu Sep 5 15:03:48 2024 +0300

    fs/ntfs3: Sequential field availability check in mi_enum_attr()

    commit 090f612756a9720ec18b0b130e28be49839d7cb5 upstream.

    The code is slightly reformatted to consistently check field availability
    without duplication.

    Fixes: 556bdf27c2dd ("ntfs3: Add bounds checking to mi_enum_attr()")
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10c20d79d59cadfe572480d98cec271a89ffb024
Author: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Date:   Mon May 27 20:15:21 2024 +0530

    drm/amd/display: Add null checks for 'stream' and 'plane' before dereferencing

    commit 15c2990e0f0108b9c3752d7072a97d45d4283aea upstream.

    This commit adds null checks for the 'stream' and 'plane' variables in
    the dcn30_apply_idle_power_optimizations function. These variables were
    previously assumed to be null at line 922, but they were used later in
    the code without checking if they were null. This could potentially lead
    to a null pointer dereference, which would cause a crash.

    The null checks ensure that 'stream' and 'plane' are not null before
    they are used, preventing potential crashes.

    Fixes the below static smatch checker:
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:938 dcn30_apply_idle_power_optimizations() error: we previously assumed 'stream' could be null (see line 922)
    drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:940 dcn30_apply_idle_power_optimizations() error: we previously assumed 'plane' could be null (see line 922)

    Cc: Tom Chung <chiahsuan.chung@amd.com>
    Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
    Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Cc: Roman Li <roman.li@amd.com>
    Cc: Hersen Wu <hersenxs.wu@amd.com>
    Cc: Alex Hung <alex.hung@amd.com>
    Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Cc: Harry Wentland <harry.wentland@amd.com>
    Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    [Xiangyu: Modified file path to backport this commit]
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e979a6a626abf1358a5bb79219eea82ac160d3d3
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:15 2023 +0300

    ASoC: SOF: ipc4-control: Add support for ALSA enum control

    commit 07a866a41982c896dc46476f57d209a200602946 upstream.

    Enum controls use generic param_id and a generic struct where the data
    is passed to the firmware.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-4-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3facc0417d3d7b3ba5822e74155bcb1267ce62c1
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:14 2023 +0300

    ASoC: SOF: ipc4-control: Add support for ALSA switch control

    commit 4a2fd607b7ca6128ee3532161505da7624197f55 upstream.

    Volume controls with a max value of 1 are switches.
    Switch controls use generic param_id and a generic struct where the data
    is passed to the firmware.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-3-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f01d8fc623711046e1efee00827bff6d5882cdfd
Author: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Date:   Tue Sep 19 13:31:13 2023 +0300

    ASoC: SOF: ipc4-topology: Add definition for generic switch/enum control

    commit 060a07cd9bc69eba2da33ed96b1fa69ead60bab1 upstream.

    Currently IPC4 has no notion of a switch or enum type of control which is
    a generic concept in ALSA.

    The generic support for these control types will be as follows:
    - large config is used to send the channel-value par array
    - param_id of a SWITCH type is 200
    - param_id of an ENUM type is 201

    Each module need to support a switch or/and enum must handle these
    universal param_ids.
    The message payload is described by struct sof_ipc4_control_msg_payload.

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230919103115.30783-2-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d54afaef6570c277070c3cafe1ed73dcdc129e0a
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Tue Sep 19 11:35:15 2023 -0400

    SUNRPC: Remove BUG_ON call sites

    commit 789ce196a31dd13276076762204bee87df893e53 upstream.

    There is no need to take down the whole system for these assertions.

    I'd rather not attempt a heroic save here, as some bug has occurred
    that has left the transport data structures in an unknown state.
    Just warn and then leak the left-over resources.

    Acked-by: Christian Brauner <brauner@kernel.org>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27a58a19bd20a7afe369da2ce6d4ebea70768acd
Author: Michael Walle <mwalle@kernel.org>
Date:   Fri Jun 21 14:09:29 2024 +0200

    mtd: spi-nor: winbond: fix w25q128 regression

    commit d35df77707bf5ae1221b5ba1c8a88cf4fcdd4901 upstream.

    Commit 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128")
    removed the flags for non-SFDP devices. It was assumed that it wasn't in
    use anymore. This wasn't true. Add the no_sfdp_flags as well as the size
    again.

    We add the additional flags for dual and quad read because they have
    been reported to work properly by Hartmut using both older and newer
    versions of this flash, the similar flashes with 64Mbit and 256Mbit
    already have these flags and because it will (luckily) trigger our
    legacy SFDP parsing, so newer versions with SFDP support will still get
    the parameters from the SFDP tables.

    Reported-by: Hartmut Birr <e9hack@gmail.com>
    Closes: https://lore.kernel.org/r/CALxbwRo_-9CaJmt7r7ELgu+vOcgk=xZcGHobnKf=oT2=u4d4aA@mail.gmail.com/
    Fixes: 83e824a4a595 ("mtd: spi-nor: Correct flags for Winbond w25q128")
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Michael Walle <mwalle@kernel.org>
    Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Reviewed-by: Esben Haabendal <esben@geanix.com>
    Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
    Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
    Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org
    Link: https://lore.kernel.org/r/20240621120929.2670185-1-mwalle@kernel.org
    [Backported to v6.6 - vastly different due to upstream changes]
    Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3d544942c0010feedc048b048ee0c35d2d921100
Author: David Hildenbrand <david@redhat.com>
Date:   Fri Oct 11 12:24:45 2024 +0200

    mm: don't install PMD mappings when THPs are disabled by the hw/process/vma

    commit 2b0f922323ccfa76219bcaacd35cd50aeaa13592 upstream.

    We (or rather, readahead logic :) ) might be allocating a THP in the
    pagecache and then try mapping it into a process that explicitly disabled
    THP: we might end up installing PMD mappings.

    This is a problem for s390x KVM, which explicitly remaps all PMD-mapped
    THPs to be PTE-mapped in s390_enable_sie()->thp_split_mm(), before
    starting the VM.

    For example, starting a VM backed on a file system with large folios
    supported makes the VM crash when the VM tries accessing such a mapping
    using KVM.

    Is it also a problem when the HW disabled THP using
    TRANSPARENT_HUGEPAGE_UNSUPPORTED?  At least on x86 this would be the case
    without X86_FEATURE_PSE.

    In the future, we might be able to do better on s390x and only disallow
    PMD mappings -- what s390x and likely TRANSPARENT_HUGEPAGE_UNSUPPORTED
    really wants.  For now, fix it by essentially performing the same check as
    would be done in __thp_vma_allowable_orders() or in shmem code, where this
    works as expected, and disallow PMD mappings, making us fallback to PTE
    mappings.

    Link: https://lkml.kernel.org/r/20241011102445.934409-3-david@redhat.com
    Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reported-by: Leo Fu <bfu@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Cc: Thomas Huth <thuth@redhat.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Janosch Frank <frankja@linux.ibm.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 02ec4b3bba49e8d3abb25a3feba6875cae12da92
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
Date:   Fri Oct 11 12:24:44 2024 +0200

    mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw()

    commit 963756aac1f011d904ddd9548ae82286d3a91f96 upstream.

    Patch series "mm: don't install PMD mappings when THPs are disabled by the
    hw/process/vma".

    During testing, it was found that we can get PMD mappings in processes
    where THP (and more precisely, PMD mappings) are supposed to be disabled.
    While it works as expected for anon+shmem, the pagecache is the
    problematic bit.

    For s390 KVM this currently means that a VM backed by a file located on
    filesystem with large folio support can crash when KVM tries accessing the
    problematic page, because the readahead logic might decide to use a
    PMD-sized THP and faulting it into the page tables will install a PMD
    mapping, something that s390 KVM cannot tolerate.

    This might also be a problem with HW that does not support PMD mappings,
    but I did not try reproducing it.

    Fix it by respecting the ways to disable THPs when deciding whether we can
    install a PMD mapping.  khugepaged should already be taking care of not
    collapsing if THPs are effectively disabled for the hw/process/vma.

    This patch (of 2):

    Add vma_thp_disabled() and thp_disabled_by_hw() helpers to be shared by
    shmem_allowable_huge_orders() and __thp_vma_allowable_orders().

    [david@redhat.com: rename to vma_thp_disabled(), split out thp_disabled_by_hw() ]
    Link: https://lkml.kernel.org/r/20241011102445.934409-2-david@redhat.com
    Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reported-by: Leo Fu <bfu@redhat.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Boqiao Fu <bfu@redhat.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Janosch Frank <frankja@linux.ibm.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fc621e7a043de346c33bd7ae7e2e0c651d6152ef
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Oct 23 09:17:44 2024 +0200

    wifi: iwlwifi: mvm: fix 6 GHz scan construction

    commit 7245012f0f496162dd95d888ed2ceb5a35170f1a upstream.

    If more than 255 colocated APs exist for the set of all
    APs found during 2.4/5 GHz scanning, then the 6 GHz scan
    construction will loop forever since the loop variable
    has type u8, which can never reach the number found when
    that's bigger than 255, and is stored in a u32 variable.
    Also move it into the loops to have a smaller scope.

    Using a u32 there is fine, we limit the number of APs in
    the scan list and each has a limit on the number of RNR
    entries due to the frame size. With a limit of 1000 scan
    results, a frame size upper bound of 4096 (really it's
    more like ~2300) and a TBTT entry size of at least 11,
    we get an upper bound for the number of ~372k, well in
    the bounds of a u32.

    Cc: stable@vger.kernel.org
    Fixes: eae94cf82d74 ("iwlwifi: mvm: add support for 6GHz")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219375
    Link: https://patch.msgid.link/20241023091744.f4baed5c08a1.I8b417148bbc8c5d11c101e1b8f5bf372e17bf2a7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f2f1fa446676c21edb777e6d2bc4fa8f956fab68
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Fri Oct 18 04:33:10 2024 +0900

    nilfs2: fix kernel bug due to missing clearing of checked flag

    commit 41e192ad2779cae0102879612dfe46726e4396aa upstream.

    Syzbot reported that in directory operations after nilfs2 detects
    filesystem corruption and degrades to read-only,
    __block_write_begin_int(), which is called to prepare block writes, may
    fail the BUG_ON check for accesses exceeding the folio/page size,
    triggering a kernel bug.

    This was found to be because the "checked" flag of a page/folio was not
    cleared when it was discarded by nilfs2's own routine, which causes the
    sanity check of directory entries to be skipped when the directory
    page/folio is reloaded.  So, fix that.

    This was necessary when the use of nilfs2's own page discard routine was
    applied to more than just metadata files.

    Link: https://lkml.kernel.org/r/20241017193359.5051-1-konishi.ryusuke@gmail.com
    Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Reported-by: syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a53c2d847627b790fb3bd8b00e02c247941b17e0
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
Date:   Mon Jun 17 19:52:17 2024 +0800

    wifi: mac80211: fix NULL dereference at band check in starting tx ba session

    commit 021d53a3d87eeb9dbba524ac515651242a2a7e3b upstream.

    In MLD connection, link_data/link_conf are dynamically allocated. They
    don't point to vif->bss_conf. So, there will be no chanreq assigned to
    vif->bss_conf and then the chan will be NULL. Tweak the code to check
    ht_supported/vht_supported/has_he/has_eht on sta deflink.

    Crash log (with rtw89 version under MLO development):
    [ 9890.526087] BUG: kernel NULL pointer dereference, address: 0000000000000000
    [ 9890.526102] #PF: supervisor read access in kernel mode
    [ 9890.526105] #PF: error_code(0x0000) - not-present page
    [ 9890.526109] PGD 0 P4D 0
    [ 9890.526114] Oops: 0000 [#1] PREEMPT SMP PTI
    [ 9890.526119] CPU: 2 PID: 6367 Comm: kworker/u16:2 Kdump: loaded Tainted: G           OE      6.9.0 #1
    [ 9890.526123] Hardware name: LENOVO 2356AD1/2356AD1, BIOS G7ETB3WW (2.73 ) 11/28/2018
    [ 9890.526126] Workqueue: phy2 rtw89_core_ba_work [rtw89_core]
    [ 9890.526203] RIP: 0010:ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211
    [ 9890.526279] Code: f7 e8 d5 93 3e ea 48 83 c4 28 89 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 49 8b 84 24 e0 f1 ff ff 48 8b 80 90 1b 00 00 <83> 38 03 0f 84 37 fe ff ff bb ea ff ff ff eb cc 49 8b 84 24 10 f3
    All code
    ========
       0:	f7 e8                	imul   %eax
       2:	d5                   	(bad)
       3:	93                   	xchg   %eax,%ebx
       4:	3e ea                	ds (bad)
       6:	48 83 c4 28          	add    $0x28,%rsp
       a:	89 d8                	mov    %ebx,%eax
       c:	5b                   	pop    %rbx
       d:	41 5c                	pop    %r12
       f:	41 5d                	pop    %r13
      11:	41 5e                	pop    %r14
      13:	41 5f                	pop    %r15
      15:	5d                   	pop    %rbp
      16:	c3                   	retq
      17:	cc                   	int3
      18:	cc                   	int3
      19:	cc                   	int3
      1a:	cc                   	int3
      1b:	49 8b 84 24 e0 f1 ff 	mov    -0xe20(%r12),%rax
      22:	ff
      23:	48 8b 80 90 1b 00 00 	mov    0x1b90(%rax),%rax
      2a:*	83 38 03             	cmpl   $0x3,(%rax)		<-- trapping instruction
      2d:	0f 84 37 fe ff ff    	je     0xfffffffffffffe6a
      33:	bb ea ff ff ff       	mov    $0xffffffea,%ebx
      38:	eb cc                	jmp    0x6
      3a:	49                   	rex.WB
      3b:	8b                   	.byte 0x8b
      3c:	84 24 10             	test   %ah,(%rax,%rdx,1)
      3f:	f3                   	repz

    Code starting with the faulting instruction
    ===========================================
       0:	83 38 03             	cmpl   $0x3,(%rax)
       3:	0f 84 37 fe ff ff    	je     0xfffffffffffffe40
       9:	bb ea ff ff ff       	mov    $0xffffffea,%ebx
       e:	eb cc                	jmp    0xffffffffffffffdc
      10:	49                   	rex.WB
      11:	8b                   	.byte 0x8b
      12:	84 24 10             	test   %ah,(%rax,%rdx,1)
      15:	f3                   	repz
    [ 9890.526285] RSP: 0018:ffffb8db09013d68 EFLAGS: 00010246
    [ 9890.526291] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff9308e0d656c8
    [ 9890.526295] RDX: 0000000000000000 RSI: ffffffffab99460b RDI: ffffffffab9a7685
    [ 9890.526300] RBP: ffffb8db09013db8 R08: 0000000000000000 R09: 0000000000000873
    [ 9890.526304] R10: ffff9308e0d64800 R11: 0000000000000002 R12: ffff9308e5ff6e70
    [ 9890.526308] R13: ffff930952500e20 R14: ffff9309192a8c00 R15: 0000000000000000
    [ 9890.526313] FS:  0000000000000000(0000) GS:ffff930b4e700000(0000) knlGS:0000000000000000
    [ 9890.526316] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 9890.526318] CR2: 0000000000000000 CR3: 0000000391c58005 CR4: 00000000001706f0
    [ 9890.526321] Call Trace:
    [ 9890.526324]  <TASK>
    [ 9890.526327] ? show_regs (arch/x86/kernel/dumpstack.c:479)
    [ 9890.526335] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434)
    [ 9890.526340] ? page_fault_oops (arch/x86/mm/fault.c:713)
    [ 9890.526347] ? search_module_extables (kernel/module/main.c:3256 (discriminator 3))
    [ 9890.526353] ? ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211

    Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
    Link: https://patch.msgid.link/20240617115217.22344-1-kevin_yang@realtek.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6a91a5816b289018e0b42a25444c0b4f8c637dca
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Wed Apr 10 02:26:54 2024 +0100

    io_uring: always lock __io_cqring_overflow_flush

    commit 8d09a88ef9d3cb7d21d45c39b7b7c31298d23998 upstream.

    Conditional locking is never great, in case of
    __io_cqring_overflow_flush(), which is a slow path, it's not justified.
    Don't handle IOPOLL separately, always grab uring_lock for overflow
    flushing.

    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/162947df299aa12693ac4b305dacedab32ec7976.1712708261.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e3fb0e6afcc399660770428a35162b4880e2e14e
Author: Haibo Chen <haibo.chen@nxp.com>
Date:   Thu Sep 5 17:43:38 2024 +0800

    arm64: dts: imx8ulp: correct the flexspi compatible string

    commit 409dc5196d5b6eb67468a06bf4d2d07d7225a67b upstream.

    The flexspi on imx8ulp only has 16 LUTs, and imx8mm flexspi has
    32 LUTs, so correct the compatible string here, otherwise will
    meet below error:

    [    1.119072] ------------[ cut here ]------------
    [    1.123926] WARNING: CPU: 0 PID: 1 at drivers/spi/spi-nxp-fspi.c:855 nxp_fspi_exec_op+0xb04/0xb64
    [    1.133239] Modules linked in:
    [    1.136448] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc6-next-20240902-00001-g131bf9439dd9 #69
    [    1.146821] Hardware name: NXP i.MX8ULP EVK (DT)
    [    1.151647] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    1.158931] pc : nxp_fspi_exec_op+0xb04/0xb64
    [    1.163496] lr : nxp_fspi_exec_op+0xa34/0xb64
    [    1.168060] sp : ffff80008002b2a0
    [    1.171526] x29: ffff80008002b2d0 x28: 0000000000000000 x27: 0000000000000000
    [    1.179002] x26: ffff2eb645542580 x25: ffff800080610014 x24: ffff800080610000
    [    1.186480] x23: ffff2eb645548080 x22: 0000000000000006 x21: ffff2eb6455425e0
    [    1.193956] x20: 0000000000000000 x19: ffff80008002b5e0 x18: ffffffffffffffff
    [    1.201432] x17: ffff2eb644467508 x16: 0000000000000138 x15: 0000000000000002
    [    1.208907] x14: 0000000000000000 x13: ffff2eb6400d8080 x12: 00000000ffffff00
    [    1.216378] x11: 0000000000000000 x10: ffff2eb6400d8080 x9 : ffff2eb697adca80
    [    1.223850] x8 : ffff2eb697ad3cc0 x7 : 0000000100000000 x6 : 0000000000000001
    [    1.231324] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000000007a6
    [    1.238795] x2 : 0000000000000000 x1 : 00000000000001ce x0 : 00000000ffffff92
    [    1.246267] Call trace:
    [    1.248824]  nxp_fspi_exec_op+0xb04/0xb64
    [    1.253031]  spi_mem_exec_op+0x3a0/0x430
    [    1.257139]  spi_nor_read_id+0x80/0xcc
    [    1.261065]  spi_nor_scan+0x1ec/0xf10
    [    1.264901]  spi_nor_probe+0x108/0x2fc
    [    1.268828]  spi_mem_probe+0x6c/0xbc
    [    1.272574]  spi_probe+0x84/0xe4
    [    1.275958]  really_probe+0xbc/0x29c
    [    1.279713]  __driver_probe_device+0x78/0x12c
    [    1.284277]  driver_probe_device+0xd8/0x15c
    [    1.288660]  __device_attach_driver+0xb8/0x134
    [    1.293316]  bus_for_each_drv+0x88/0xe8
    [    1.297337]  __device_attach+0xa0/0x190
    [    1.301353]  device_initial_probe+0x14/0x20
    [    1.305734]  bus_probe_device+0xac/0xb0
    [    1.309752]  device_add+0x5d0/0x790
    [    1.313408]  __spi_add_device+0x134/0x204
    [    1.317606]  of_register_spi_device+0x3b4/0x590
    [    1.322348]  spi_register_controller+0x47c/0x754
    [    1.327181]  devm_spi_register_controller+0x4c/0xa4
    [    1.332289]  nxp_fspi_probe+0x1cc/0x2b0
    [    1.336307]  platform_probe+0x68/0xc4
    [    1.340145]  really_probe+0xbc/0x29c
    [    1.343893]  __driver_probe_device+0x78/0x12c
    [    1.348457]  driver_probe_device+0xd8/0x15c
    [    1.352838]  __driver_attach+0x90/0x19c
    [    1.356857]  bus_for_each_dev+0x7c/0xdc
    [    1.360877]  driver_attach+0x24/0x30
    [    1.364624]  bus_add_driver+0xe4/0x208
    [    1.368552]  driver_register+0x5c/0x124
    [    1.372573]  __platform_driver_register+0x28/0x34
    [    1.377497]  nxp_fspi_driver_init+0x1c/0x28
    [    1.381888]  do_one_initcall+0x80/0x1c8
    [    1.385908]  kernel_init_freeable+0x1c4/0x28c
    [    1.390472]  kernel_init+0x20/0x1d8
    [    1.394138]  ret_from_fork+0x10/0x20
    [    1.397885] ---[ end trace 0000000000000000 ]---
    [    1.407908] ------------[ cut here ]------------

    Fixes: ef89fd56bdfc ("arm64: dts: imx8ulp: add flexspi node")
    Cc: stable@kernel.org
    Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1a49b96c51063d38be296a0c1537928a06f02d6e
Author: Gregory Price <gourry@gourry.net>
Date:   Fri Oct 25 10:17:24 2024 -0400

    vmscan,migrate: fix page count imbalance on node stats when demoting pages

    [ Upstream commit 35e41024c4c2b02ef8207f61b9004f6956cf037b ]

    When numa balancing is enabled with demotion, vmscan will call
    migrate_pages when shrinking LRUs.  migrate_pages will decrement the
    the node's isolated page count, leading to an imbalanced count when
    invoked from (MG)LRU code.

    The result is dmesg output like such:

    $ cat /proc/sys/vm/stat_refresh

    [77383.088417] vmstat_refresh: nr_isolated_anon -103212
    [77383.088417] vmstat_refresh: nr_isolated_file -899642

    This negative value may impact compaction and reclaim throttling.

    The following path produces the decrement:

    shrink_folio_list
      demote_folio_list
        migrate_pages
          migrate_pages_batch
            migrate_folio_move
              migrate_folio_done
                mod_node_page_state(-ve) <- decrement

    This path happens for SUCCESSFUL migrations, not failures.  Typically
    callers to migrate_pages are required to handle putback/accounting for
    failures, but this is already handled in the shrink code.

    When accounting for migrations, instead do not decrement the count when
    the migration reason is MR_DEMOTION.  As of v6.11, this demotion logic
    is the only source of MR_DEMOTION.

    Link: https://lkml.kernel.org/r/20241025141724.17927-1-gourry@gourry.net
    Fixes: 26aa2d199d6f ("mm/migrate: demote pages during reclaim")
    Signed-off-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Yang Shi <shy828301@gmail.com>
    Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
    Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
    Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Wei Xu <weixugc@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 003d2996964c03dfd34860500428f4cdf1f5879e
Author: Jens Axboe <axboe@kernel.dk>
Date:   Thu Oct 31 08:05:44 2024 -0600

    io_uring/rw: fix missing NOWAIT check for O_DIRECT start write

    [ Upstream commit 1d60d74e852647255bd8e76f5a22dc42531e4389 ]

    When io_uring starts a write, it'll call kiocb_start_write() to bump the
    super block rwsem, preventing any freezes from happening while that
    write is in-flight. The freeze side will grab that rwsem for writing,
    excluding any new writers from happening and waiting for existing writes
    to finish. But io_uring unconditionally uses kiocb_start_write(), which
    will block if someone is currently attempting to freeze the mount point.
    This causes a deadlock where freeze is waiting for previous writes to
    complete, but the previous writes cannot complete, as the task that is
    supposed to complete them is blocked waiting on starting a new write.
    This results in the following stuck trace showing that dependency with
    the write blocked starting a new write:

    task:fio             state:D stack:0     pid:886   tgid:886   ppid:876
    Call trace:
     __switch_to+0x1d8/0x348
     __schedule+0x8e8/0x2248
     schedule+0x110/0x3f0
     percpu_rwsem_wait+0x1e8/0x3f8
     __percpu_down_read+0xe8/0x500
     io_write+0xbb8/0xff8
     io_issue_sqe+0x10c/0x1020
     io_submit_sqes+0x614/0x2110
     __arm64_sys_io_uring_enter+0x524/0x1038
     invoke_syscall+0x74/0x268
     el0_svc_common.constprop.0+0x160/0x238
     do_el0_svc+0x44/0x60
     el0_svc+0x44/0xb0
     el0t_64_sync_handler+0x118/0x128
     el0t_64_sync+0x168/0x170
    INFO: task fsfreeze:7364 blocked for more than 15 seconds.
          Not tainted 6.12.0-rc5-00063-g76aaf945701c #7963

    with the attempting freezer stuck trying to grab the rwsem:

    task:fsfreeze        state:D stack:0     pid:7364  tgid:7364  ppid:995
    Call trace:
     __switch_to+0x1d8/0x348
     __schedule+0x8e8/0x2248
     schedule+0x110/0x3f0
     percpu_down_write+0x2b0/0x680
     freeze_super+0x248/0x8a8
     do_vfs_ioctl+0x149c/0x1b18
     __arm64_sys_ioctl+0xd0/0x1a0
     invoke_syscall+0x74/0x268
     el0_svc_common.constprop.0+0x160/0x238
     do_el0_svc+0x44/0x60
     el0_svc+0x44/0xb0
     el0t_64_sync_handler+0x118/0x128
     el0t_64_sync+0x168/0x170

    Fix this by having the io_uring side honor IOCB_NOWAIT, and only attempt a
    blocking grab of the super block rwsem if it isn't set. For normal issue
    where IOCB_NOWAIT would always be set, this returns -EAGAIN which will
    have io_uring core issue a blocking attempt of the write. That will in
    turn also get completions run, ensuring forward progress.

    Since freezing requires CAP_SYS_ADMIN in the first place, this isn't
    something that can be triggered by a regular user.

    Cc: stable@vger.kernel.org # 5.10+
    Reported-by: Peter Mann <peter.mann@sh.cz>
    Link: https://lore.kernel.org/io-uring/38c94aec-81c9-4f62-b44e-1d87f5597644@sh.cz
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 70bbe8d0a949413df1bb6532fd6b19fbf0f88feb
Author: Andrey Konovalov <andreyknvl@gmail.com>
Date:   Tue Oct 22 18:07:06 2024 +0200

    kasan: remove vmalloc_percpu test

    [ Upstream commit 330d8df81f3673d6fb74550bbc9bb159d81b35f7 ]

    Commit 1a2473f0cbc0 ("kasan: improve vmalloc tests") added the
    vmalloc_percpu KASAN test with the assumption that __alloc_percpu always
    uses vmalloc internally, which is tagged by KASAN.

    However, __alloc_percpu might allocate memory from the first per-CPU
    chunk, which is not allocated via vmalloc().  As a result, the test might
    fail.

    Remove the test until proper KASAN annotation for the per-CPU allocated
    are added; tracked in https://bugzilla.kernel.org/show_bug.cgi?id=215019.

    Link: https://lkml.kernel.org/r/20241022160706.38943-1-andrey.konovalov@linux.dev
    Fixes: 1a2473f0cbc0 ("kasan: improve vmalloc tests")
    Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
    Reported-by: Samuel Holland <samuel.holland@sifive.com>
    Link: https://lore.kernel.org/all/4a245fff-cc46-44d1-a5f9-fd2f1c3764ae@sifive.com/
    Reported-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Link: https://lore.kernel.org/all/CACzwLxiWzNqPBp4C1VkaXZ2wDwvY3yZeetCi1TLGFipKW77drA@mail.gmail.com/
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Marco Elver <elver@google.com>
    Cc: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c60af16e1d6cc2237d58336546d6adfc067b6b8f
Author: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
Date:   Mon Sep 16 22:41:37 2024 +0500

    nvmet-auth: assign dh_key to NULL after kfree_sensitive

    [ Upstream commit d2f551b1f72b4c508ab9298419f6feadc3b5d791 ]

    ctrl->dh_key might be used across multiple calls to nvmet_setup_dhgroup()
    for the same controller. So it's better to nullify it after release on
    error path in order to avoid double free later in nvmet_destroy_auth().

    Found by Linux Verification Center (linuxtesting.org) with Svace.

    Fixes: 7a277c37d352 ("nvmet-auth: Diffie-Hellman key exchange support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a39320977f9c665faa37efaa8093b8e82dd8c41
Author: Christoffer Sandberg <cs@tuxedo.de>
Date:   Tue Oct 29 16:16:53 2024 +0100

    ALSA: hda/realtek: Fix headset mic on TUXEDO Stellaris 16 Gen6 mb1

    [ Upstream commit e49370d769e71456db3fbd982e95bab8c69f73e8 ]

    Quirk is needed to enable headset microphone on missing pin 0x19.

    Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20241029151653.80726-2-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b42adef85aca72b51eab1a812a79913ff5aeb584
Author: Christoffer Sandberg <cs@tuxedo.de>
Date:   Tue Oct 29 16:16:52 2024 +0100

    ALSA: hda/realtek: Fix headset mic on TUXEDO Gemini 17 Gen3

    [ Upstream commit 0b04fbe886b4274c8e5855011233aaa69fec6e75 ]

    Quirk is needed to enable headset microphone on missing pin 0x19.

    Signed-off-by: Christoffer Sandberg <cs@tuxedo.de>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20241029151653.80726-1-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 77ddc732416b017180893cbb2356e9f0a414c575
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Oct 23 15:37:22 2024 +0200

    xfs: fix finding a last resort AG in xfs_filestream_pick_ag

    [ Upstream commit dc60992ce76fbc2f71c2674f435ff6bde2108028 ]

    When the main loop in xfs_filestream_pick_ag fails to find a suitable
    AG it tries to just pick the online AG.  But the loop for that uses
    args->pag as loop iterator while the later code expects pag to be
    set.  Fix this by reusing the max_pag case for this last resort, and
    also add a check for impossible case of no AG just to make sure that
    the uninitialized pag doesn't even escape in theory.

    Reported-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Tested-by: syzbot+4125a3c514e3436a02e6@syzkaller.appspotmail.com
    Fixes: f8f1ed1ab3baba ("xfs: return a referenced perag from filestreams allocator")
    Cc: <stable@vger.kernel.org> # v6.3
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8e886e44397ba89f6e8da8471386112b4f5b67b7
Author: Matt Johnston <matt@codeconstruct.com.au>
Date:   Tue Oct 22 18:25:14 2024 +0800

    mctp i2c: handle NULL header address

    [ Upstream commit 01e215975fd80af81b5b79f009d49ddd35976c13 ]

    daddr can be NULL if there is no neighbour table entry present,
    in that case the tx packet should be dropped.

    saddr will usually be set by MCTP core, but check for NULL in case a
    packet is transmitted by a different protocol.

    Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
    Cc: stable@vger.kernel.org
    Reported-by: Dung Cao <dung@os.amperecomputing.com>
    Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241022-mctp-i2c-null-dest-v3-1-e929709956c5@codeconstruct.com.au
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 88f97a4b5843ce21c1286e082c02a5fb4d8eb473
Author: Edward Adam Davis <eadavis@qq.com>
Date:   Wed Oct 16 19:43:47 2024 +0800

    ocfs2: pass u64 to ocfs2_truncate_inline maybe overflow

    [ Upstream commit bc0a2f3a73fcdac651fca64df39306d1e5ebe3b0 ]

    Syzbot reported a kernel BUG in ocfs2_truncate_inline.  There are two
    reasons for this: first, the parameter value passed is greater than
    ocfs2_max_inline_data_with_xattr, second, the start and end parameters of
    ocfs2_truncate_inline are "unsigned int".

    So, we need to add a sanity check for byte_start and byte_len right before
    ocfs2_truncate_inline() in ocfs2_remove_inode_range(), if they are greater
    than ocfs2_max_inline_data_with_xattr return -EINVAL.

    Link: https://lkml.kernel.org/r/tencent_D48DB5122ADDAEDDD11918CFB68D93258C07@qq.com
    Fixes: 1afc32b95233 ("ocfs2: Write support for inline data")
    Signed-off-by: Edward Adam Davis <eadavis@qq.com>
    Reported-by: syzbot+81092778aac03460d6b7@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=81092778aac03460d6b7
    Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Gang He <ghe@suse.com>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c117a980185ee3812612e7e453e356a6a4f05305
Author: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Date:   Wed Oct 16 20:24:07 2024 +0500

    x86/traps: move kmsan check after instrumentation_begin

    [ Upstream commit 1db272864ff250b5e607283eaec819e1186c8e26 ]

    During x86_64 kernel build with CONFIG_KMSAN, the objtool warns following:

      AR      built-in.a
      AR      vmlinux.a
      LD      vmlinux.o
    vmlinux.o: warning: objtool: handle_bug+0x4: call to
        kmsan_unpoison_entry_regs() leaves .noinstr.text section
      OBJCOPY modules.builtin.modinfo
      GEN     modules.builtin
      MODPOST Module.symvers
      CC      .vmlinux.export.o

    Moving kmsan_unpoison_entry_regs() _after_ instrumentation_begin() fixes
    the warning.

    There is decode_bug(regs->ip, &imm) is left before KMSAN unpoisoining, but
    it has the return condition and if we include it after
    instrumentation_begin() it results the warning "return with
    instrumentation enabled", hence, I'm concerned that regs will not be KMSAN
    unpoisoned if `ud_type == BUG_NONE` is true.

    Link: https://lkml.kernel.org/r/20241016152407.3149001-1-snovitoll@gmail.com
    Fixes: ba54d194f8da ("x86/traps: avoid KMSAN bugs originating from handle_bug()")
    Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    Reviewed-by: Alexander Potapenko <glider@google.com>
    Cc: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 86ee1845cbbf52eff6d41ce438d5f7e9ab6f4602
Author: Gatlin Newhouse <gatlin.newhouse@gmail.com>
Date:   Wed Jul 24 00:01:55 2024 +0000

    x86/traps: Enable UBSAN traps on x86

    [ Upstream commit 7424fc6b86c8980a87169e005f5cd4438d18efe6 ]

    Currently ARM64 extracts which specific sanitizer has caused a trap via
    encoded data in the trap instruction. Clang on x86 currently encodes the
    same data in the UD1 instruction but x86 handle_bug() and
    is_valid_bugaddr() currently only look at UD2.

    Bring x86 to parity with ARM64, similar to commit 25b84002afb9 ("arm64:
    Support Clang UBSAN trap codes for better reporting"). See the llvm
    links for information about the code generation.

    Enable the reporting of UBSAN sanitizer details on x86 compiled with clang
    when CONFIG_UBSAN_TRAP=y by analysing UD1 and retrieving the type immediate
    which is encoded by the compiler after the UD1.

    [ tglx: Simplified it by moving the printk() into handle_bug() ]

    Signed-off-by: Gatlin Newhouse <gatlin.newhouse@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/all/20240724000206.451425-1-gatlin.newhouse@gmail.com
    Link: https://github.com/llvm/llvm-project/commit/c5978f42ec8e9#diff-bb68d7cd885f41cfc35843998b0f9f534adb60b415f647109e597ce448e92d9f
    Link: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/X86/X86InstrSystem.td#L27
    Stable-dep-of: 1db272864ff2 ("x86/traps: move kmsan check after instrumentation_begin")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b958948ae1cb3e39c48e9f805436fd652103c71e
Author: Matt Fleming <mfleming@cloudflare.com>
Date:   Fri Oct 11 13:07:37 2024 +0100

    mm/page_alloc: let GFP_ATOMIC order-0 allocs access highatomic reserves

    [ Upstream commit 281dd25c1a018261a04d1b8bf41a0674000bfe38 ]

    Under memory pressure it's possible for GFP_ATOMIC order-0 allocations to
    fail even though free pages are available in the highatomic reserves.
    GFP_ATOMIC allocations cannot trigger unreserve_highatomic_pageblock()
    since it's only run from reclaim.

    Given that such allocations will pass the watermarks in
    __zone_watermark_unusable_free(), it makes sense to fallback to highatomic
    reserves the same way that ALLOC_OOM can.

    This fixes order-0 page allocation failures observed on Cloudflare's fleet
    when handling network packets:

      kswapd1: page allocation failure: order:0, mode:0x820(GFP_ATOMIC),
      nodemask=(null),cpuset=/,mems_allowed=0-7
      CPU: 10 PID: 696 Comm: kswapd1 Kdump: loaded Tainted: G           O 6.6.43-CUSTOM #1
      Hardware name: MACHINE
      Call Trace:
       <IRQ>
       dump_stack_lvl+0x3c/0x50
       warn_alloc+0x13a/0x1c0
       __alloc_pages_slowpath.constprop.0+0xc9d/0xd10
       __alloc_pages+0x327/0x340
       __napi_alloc_skb+0x16d/0x1f0
       bnxt_rx_page_skb+0x96/0x1b0 [bnxt_en]
       bnxt_rx_pkt+0x201/0x15e0 [bnxt_en]
       __bnxt_poll_work+0x156/0x2b0 [bnxt_en]
       bnxt_poll+0xd9/0x1c0 [bnxt_en]
       __napi_poll+0x2b/0x1b0
       bpf_trampoline_6442524138+0x7d/0x1000
       __napi_poll+0x5/0x1b0
       net_rx_action+0x342/0x740
       handle_softirqs+0xcf/0x2b0
       irq_exit_rcu+0x6c/0x90
       sysvec_apic_timer_interrupt+0x72/0x90
       </IRQ>

    [mfleming@cloudflare.com: update comment]
      Link: https://lkml.kernel.org/r/20241015125158.3597702-1-matt@readmodwrite.com
    Link: https://lkml.kernel.org/r/20241011120737.3300370-1-matt@readmodwrite.com
    Link: https://lore.kernel.org/all/CAGis_TWzSu=P7QJmjD58WWiu3zjMTVKSzdOwWE8ORaGytzWJwQ@mail.gmail.com/
    Fixes: 1d91df85f399 ("mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs")
    Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
    Suggested-by: Vlastimil Babka <vbabka@suse.cz>
    Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4882a352b5df897c30f9d64fba340a219a6604d0
Author: Alexander Usyskin <alexander.usyskin@intel.com>
Date:   Tue Oct 15 15:31:57 2024 +0300

    mei: use kvmalloc for read buffer

    [ Upstream commit 4adf613e01bf99e1739f6ff3e162ad5b7d578d1a ]

    Read buffer is allocated according to max message size, reported by
    the firmware and may reach 64K in systems with pxp client.
    Contiguous 64k allocation may fail under memory pressure.
    Read buffer is used as in-driver message storage and not required
    to be contiguous.
    Use kvmalloc to allow kernel to allocate non-contiguous memory.

    Fixes: 3030dc056459 ("mei: add wrapper for queuing control commands.")
    Cc: stable <stable@kernel.org>
    Reported-by: Rohit Agarwal <rohiagar@chromium.org>
    Closes: https://lore.kernel.org/all/20240813084542.2921300-1-rohiagar@chromium.org/
    Tested-by: Brian Geffon <bgeffon@google.com>
    Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
    Acked-by: Tomas Winkler <tomasw@gmail.com>
    Link: https://lore.kernel.org/r/20241015123157.2337026-1-alexander.usyskin@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit cb8b81ad3e893a6d18dcdd3754cc2ea2a42c0136
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Mon Oct 21 12:25:26 2024 +0200

    mptcp: init: protect sched with rcu_read_lock

    [ Upstream commit 3deb12c788c385e17142ce6ec50f769852fcec65 ]

    Enabling CONFIG_PROVE_RCU_LIST with its dependence CONFIG_RCU_EXPERT
    creates this splat when an MPTCP socket is created:

      =============================
      WARNING: suspicious RCU usage
      6.12.0-rc2+ #11 Not tainted
      -----------------------------
      net/mptcp/sched.c:44 RCU-list traversed in non-reader section!!

      other info that might help us debug this:

      rcu_scheduler_active = 2, debug_locks = 1
      no locks held by mptcp_connect/176.

      stack backtrace:
      CPU: 0 UID: 0 PID: 176 Comm: mptcp_connect Not tainted 6.12.0-rc2+ #11
      Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      Call Trace:
       <TASK>
       dump_stack_lvl (lib/dump_stack.c:123)
       lockdep_rcu_suspicious (kernel/locking/lockdep.c:6822)
       mptcp_sched_find (net/mptcp/sched.c:44 (discriminator 7))
       mptcp_init_sock (net/mptcp/protocol.c:2867 (discriminator 1))
       ? sock_init_data_uid (arch/x86/include/asm/atomic.h:28)
       inet_create.part.0.constprop.0 (net/ipv4/af_inet.c:386)
       ? __sock_create (include/linux/rcupdate.h:347 (discriminator 1))
       __sock_create (net/socket.c:1576)
       __sys_socket (net/socket.c:1671)
       ? __pfx___sys_socket (net/socket.c:1712)
       ? do_user_addr_fault (arch/x86/mm/fault.c:1419 (discriminator 1))
       __x64_sys_socket (net/socket.c:1728)
       do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1))
       entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)

    That's because when the socket is initialised, rcu_read_lock() is not
    used despite the explicit comment written above the declaration of
    mptcp_sched_find() in sched.c. Adding the missing lock/unlock avoids the
    warning.

    Fixes: 1730b2b2c5a5 ("mptcp: add sched in mptcp_sock")
    Cc: stable@vger.kernel.org
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/523
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20241021-net-mptcp-sched-lock-v1-1-637759cf061c@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4f7ffa83fa79dd52efbaef366c850aaaae06a469
Author: Hugh Dickins <hughd@google.com>
Date:   Sun Oct 27 15:23:23 2024 -0700

    iov_iter: fix copy_page_from_iter_atomic() if KMAP_LOCAL_FORCE_MAP

    [ Upstream commit c749d9b7ebbc5716af7a95f7768634b30d9446ec ]

    generic/077 on x86_32 CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y with highmem,
    on huge=always tmpfs, issues a warning and then hangs (interruptibly):

    WARNING: CPU: 5 PID: 3517 at mm/highmem.c:622 kunmap_local_indexed+0x62/0xc9
    CPU: 5 UID: 0 PID: 3517 Comm: cp Not tainted 6.12.0-rc4 #2
    ...
    copy_page_from_iter_atomic+0xa6/0x5ec
    generic_perform_write+0xf6/0x1b4
    shmem_file_write_iter+0x54/0x67

    Fix copy_page_from_iter_atomic() by limiting it in that case
    (include/linux/skbuff.h skb_frag_must_loop() does similar).

    But going forward, perhaps CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP is too
    surprising, has outlived its usefulness, and should just be removed?

    Fixes: 908a1ad89466 ("iov_iter: Handle compound highmem pages in copy_page_from_iter_atomic()")
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Link: https://lore.kernel.org/r/dd5f0c89-186e-18e1-4f43-19a60f5a9774@google.com
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ade91f6e9848b370add44d89c976e070ccb492ef
Author: Shawn Wang <shawnwang@linux.alibaba.com>
Date:   Fri Oct 25 10:22:08 2024 +0800

    sched/numa: Fix the potential null pointer dereference in task_numa_work()

    [ Upstream commit 9c70b2a33cd2aa6a5a59c5523ef053bd42265209 ]

    When running stress-ng-vm-segv test, we found a null pointer dereference
    error in task_numa_work(). Here is the backtrace:

      [323676.066985] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
      ......
      [323676.067108] CPU: 35 PID: 2694524 Comm: stress-ng-vm-se
      ......
      [323676.067113] pstate: 23401009 (nzCv daif +PAN -UAO +TCO +DIT +SSBS BTYPE=--)
      [323676.067115] pc : vma_migratable+0x1c/0xd0
      [323676.067122] lr : task_numa_work+0x1ec/0x4e0
      [323676.067127] sp : ffff8000ada73d20
      [323676.067128] x29: ffff8000ada73d20 x28: 0000000000000000 x27: 000000003e89f010
      [323676.067130] x26: 0000000000080000 x25: ffff800081b5c0d8 x24: ffff800081b27000
      [323676.067133] x23: 0000000000010000 x22: 0000000104d18cc0 x21: ffff0009f7158000
      [323676.067135] x20: 0000000000000000 x19: 0000000000000000 x18: ffff8000ada73db8
      [323676.067138] x17: 0001400000000000 x16: ffff800080df40b0 x15: 0000000000000035
      [323676.067140] x14: ffff8000ada73cc8 x13: 1fffe0017cc72001 x12: ffff8000ada73cc8
      [323676.067142] x11: ffff80008001160c x10: ffff000be639000c x9 : ffff8000800f4ba4
      [323676.067145] x8 : ffff000810375000 x7 : ffff8000ada73974 x6 : 0000000000000001
      [323676.067147] x5 : 0068000b33e26707 x4 : 0000000000000001 x3 : ffff0009f7158000
      [323676.067149] x2 : 0000000000000041 x1 : 0000000000004400 x0 : 0000000000000000
      [323676.067152] Call trace:
      [323676.067153]  vma_migratable+0x1c/0xd0
      [323676.067155]  task_numa_work+0x1ec/0x4e0
      [323676.067157]  task_work_run+0x78/0xd8
      [323676.067161]  do_notify_resume+0x1ec/0x290
      [323676.067163]  el0_svc+0x150/0x160
      [323676.067167]  el0t_64_sync_handler+0xf8/0x128
      [323676.067170]  el0t_64_sync+0x17c/0x180
      [323676.067173] Code: d2888001 910003fd f9000bf3 aa0003f3 (f9401000)
      [323676.067177] SMP: stopping secondary CPUs
      [323676.070184] Starting crashdump kernel...

    stress-ng-vm-segv in stress-ng is used to stress test the SIGSEGV error
    handling function of the system, which tries to cause a SIGSEGV error on
    return from unmapping the whole address space of the child process.

    Normally this program will not cause kernel crashes. But before the
    munmap system call returns to user mode, a potential task_numa_work()
    for numa balancing could be added and executed. In this scenario, since the
    child process has no vma after munmap, the vma_next() in task_numa_work()
    will return a null pointer even if the vma iterator restarts from 0.

    Recheck the vma pointer before dereferencing it in task_numa_work().

    Fixes: 214dbc428137 ("sched: convert to vma iterator")
    Signed-off-by: Shawn Wang <shawnwang@linux.alibaba.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org # v6.2+
    Link: https://lkml.kernel.org/r/20241025022208.125527-1-shawnwang@linux.alibaba.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8c9a1ec39c698cbc38f4efa9113185f885137f8b
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Tue Oct 22 18:43:40 2024 -0700

    cxl/acpi: Ensure ports ready at cxl_acpi_probe() return

    [ Upstream commit 48f62d38a07d464a499fa834638afcfd2b68f852 ]

    In order to ensure root CXL ports are enabled upon cxl_acpi_probe()
    when the 'cxl_port' driver is built as a module, arrange for the
    module to be pre-loaded or built-in.

    The "Fixes:" but no "Cc: stable" on this patch reflects that the issue
    is merely by inspection since the bug that triggered the discovery of
    this potential problem [1] is fixed by other means. However, a stable
    backport should do no harm.

    Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver")
    Link: http://lore.kernel.org/20241004212504.1246-1-gourry@gourry.net [1]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Tested-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Link: https://patch.msgid.link/172964781969.81806.17276352414854540808.stgit@dwillia2-xfh.jf.intel.com
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a9ed67f39f888bb6e5729112ad45f15d9c5a3ef8
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Tue Oct 22 18:43:32 2024 -0700

    cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices()

    [ Upstream commit 3d6ebf16438de5d712030fefbb4182b46373d677 ]

    It turns out since its original introduction, pre-2.6.12,
    bus_rescan_devices() has skipped devices that might be in the process of
    attaching or detaching from their driver. For CXL this behavior is
    unwanted and expects that cxl_bus_rescan() is a probe barrier.

    That behavior is simple enough to achieve with bus_for_each_dev() paired
    with call to device_attach(), and it is unclear why bus_rescan_devices()
    took the position of lockless consumption of dev->driver which is racy.

    The "Fixes:" but no "Cc: stable" on this patch reflects that the issue
    is merely by inspection since the bug that triggered the discovery of
    this potential problem [1] is fixed by other means.  However, a stable
    backport should do no harm.

    Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver")
    Link: http://lore.kernel.org/20241004212504.1246-1-gourry@gourry.net [1]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Tested-by: Gregory Price <gourry@gourry.net>
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Link: https://patch.msgid.link/172964781104.81806.4277549800082443769.stgit@dwillia2-xfh.jf.intel.com
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit d210bc87cc4fdde62f757002530a08c3d109d94a
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:39 2024 +0800

    riscv: Remove duplicated GET_RM

    [ Upstream commit 164f66de6bb6ef454893f193c898dc8f1da6d18b ]

    The macro GET_RM defined twice in this file, one can be removed.

    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Fixes: 956d705dd279 ("riscv: Unaligned load/store handling for M_MODE")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20241008094141.549248-3-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 6d84e1b2e5ac04511e68bcf5577fc8369e73f4ed
Author: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Date:   Tue Oct 8 17:41:38 2024 +0800

    riscv: Remove unused GENERATING_ASM_OFFSETS

    [ Upstream commit 46d4e5ac6f2f801f97bcd0ec82365969197dc9b1 ]

    The macro is not used in the current version of kernel, it looks like
    can be removed to avoid a build warning:

    ../arch/riscv/kernel/asm-offsets.c: At top level:
    ../arch/riscv/kernel/asm-offsets.c:7: warning: macro "GENERATING_ASM_OFFSETS" is not used [-Wunused-macros]
        7 | #define GENERATING_ASM_OFFSETS

    Fixes: 9639a44394b9 ("RISC-V: Provide a cleaner raw_smp_processor_id()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
    Link: https://lore.kernel.org/r/20241008094141.549248-2-zhangchunyan@iscas.ac.cn
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit a63ba17207c50da91b19150b6cde09d199b34c2c
Author: WangYuli <wangyuli@uniontech.com>
Date:   Thu Oct 17 11:20:10 2024 +0800

    riscv: Use '%u' to format the output of 'cpu'

    [ Upstream commit e0872ab72630dada3ae055bfa410bf463ff1d1e0 ]

    'cpu' is an unsigned integer, so its conversion specifier should
    be %u, not %d.

    Suggested-by: Wentao Guan <guanwentao@uniontech.com>
    Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Link: https://lore.kernel.org/all/alpine.DEB.2.21.2409122309090.40372@angie.orcam.me.uk/
    Signed-off-by: WangYuli <wangyuli@uniontech.com>
    Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
    Tested-by: Charlie Jenkins <charlie@rivosinc.com>
    Fixes: f1e58583b9c7 ("RISC-V: Support cpu hotplug")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/4C127DEECDA287C8+20241017032010.96772-1-wangyuli@uniontech.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 909e71f28e9615410f52fca1b54acfd3d61c61c2
Author: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date:   Sun Sep 29 16:02:33 2024 +0200

    riscv: efi: Set NX compat flag in PE/COFF header

    [ Upstream commit d41373a4b910961df5a5e3527d7bde6ad45ca438 ]

    The IMAGE_DLLCHARACTERISTICS_NX_COMPAT informs the firmware that the
    EFI binary does not rely on pages that are both executable and
    writable.

    The flag is used by some distro versions of GRUB to decide if the EFI
    binary may be executed.

    As the Linux kernel neither has RWX sections nor needs RWX pages for
    relocation we should set the flag.

    Cc: Ard Biesheuvel <ardb@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
    Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
    Fixes: cb7d2dd5612a ("RISC-V: Add PE/COFF header for EFI stub")
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Link: https://lore.kernel.org/r/20240929140233.211800-1-heinrich.schuchardt@canonical.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 58e78589ade880330e359587bb50b1474f43aa12
Author: Kailang Yang <kailang@realtek.com>
Date:   Fri Oct 18 13:53:24 2024 +0800

    ALSA: hda/realtek: Limit internal Mic boost on Dell platform

    [ Upstream commit 78e7be018784934081afec77f96d49a2483f9188 ]

    Dell want to limit internal Mic boost on all Dell platform.

    Signed-off-by: Kailang Yang <kailang@realtek.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/561fc5f5eff04b6cbd79ed173cd1c1db@realtek.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit ceec8ad09135c27890cdee5a9bb0bf5f58c23720
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Fri Oct 18 17:17:48 2024 -0700

    Input: edt-ft5x06 - fix regmap leak when probe fails

    [ Upstream commit bffdf9d7e51a7be8eeaac2ccf9e54a5fde01ff65 ]

    The driver neglects to free the instance of I2C regmap constructed at
    the beginning of the edt_ft5x06_ts_probe() method when probe fails.
    Additionally edt_ft5x06_ts_remove() is freeing the regmap too early,
    before the rest of the device resources that are managed by devm are
    released.

    Fix this by installing a custom devm action that will ensure that the
    regmap is released at the right time during normal teardown as well as
    in case of probe failure.

    Note that devm_regmap_init_i2c() could not be used because the driver
    may replace the original regmap with a regmap specific for M06 devices
    in the middle of the probe, and using devm_regmap_init_i2c() would
    result in releasing the M06 regmap too early.

    Reported-by: Li Zetao <lizetao1@huawei.com>
    Fixes: 9dfd9708ffba ("Input: edt-ft5x06 - convert to use regmap API")
    Cc: stable@vger.kernel.org
    Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com>
    Link: https://lore.kernel.org/r/ZxL6rIlVlgsAu-Jv@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c19a0c171d37f86ab7267c638d475321fd9f0b77
Author: Alexandre Ghiti <alexghiti@rivosinc.com>
Date:   Wed Oct 16 10:36:24 2024 +0200

    riscv: vdso: Prevent the compiler from inserting calls to memset()

    [ Upstream commit bf40167d54d55d4b54d0103713d86a8638fb9290 ]

    The compiler is smart enough to insert a call to memset() in
    riscv_vdso_get_cpus(), which generates a dynamic relocation.

    So prevent this by using -fno-builtin option.

    Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Reviewed-by: Guo Ren <guoren@kernel.org>
    Link: https://lore.kernel.org/r/20241016083625.136311-2-alexghiti@rivosinc.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit e79c1f1c9100b4adc91c6512985db2cc961aafaa
Author: Frank Li <Frank.Li@nxp.com>
Date:   Wed Oct 23 16:30:32 2024 -0400

    spi: spi-fsl-dspi: Fix crash when not using GPIO chip select

    [ Upstream commit 25f00a13dccf8e45441265768de46c8bf58e08f6 ]

    Add check for the return value of spi_get_csgpiod() to avoid passing a NULL
    pointer to gpiod_direction_output(), preventing a crash when GPIO chip
    select is not used.

    Fix below crash:
    [    4.251960] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [    4.260762] Mem abort info:
    [    4.263556]   ESR = 0x0000000096000004
    [    4.267308]   EC = 0x25: DABT (current EL), IL = 32 bits
    [    4.272624]   SET = 0, FnV = 0
    [    4.275681]   EA = 0, S1PTW = 0
    [    4.278822]   FSC = 0x04: level 0 translation fault
    [    4.283704] Data abort info:
    [    4.286583]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [    4.292074]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [    4.297130]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [    4.302445] [0000000000000000] user address but active_mm is swapper
    [    4.308805] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
    [    4.315072] Modules linked in:
    [    4.318124] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc4-next-20241023-00008-ga20ec42c5fc1 #359
    [    4.328130] Hardware name: LS1046A QDS Board (DT)
    [    4.332832] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    4.339794] pc : gpiod_direction_output+0x34/0x5c
    [    4.344505] lr : gpiod_direction_output+0x18/0x5c
    [    4.349208] sp : ffff80008003b8f0
    [    4.352517] x29: ffff80008003b8f0 x28: 0000000000000000 x27: ffffc96bcc7e9068
    [    4.359659] x26: ffffc96bcc6e00b0 x25: ffffc96bcc598398 x24: ffff447400132810
    [    4.366800] x23: 0000000000000000 x22: 0000000011e1a300 x21: 0000000000020002
    [    4.373940] x20: 0000000000000000 x19: 0000000000000000 x18: ffffffffffffffff
    [    4.381081] x17: ffff44740016e600 x16: 0000000500000003 x15: 0000000000000007
    [    4.388221] x14: 0000000000989680 x13: 0000000000020000 x12: 000000000000001e
    [    4.395362] x11: 0044b82fa09b5a53 x10: 0000000000000019 x9 : 0000000000000008
    [    4.402502] x8 : 0000000000000002 x7 : 0000000000000007 …
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
[ Upstream commit 953e549 ]

Lockdep gives a false positive splat as it can't distinguish the lock
which is taken by different IRQ descriptors from different IRQ chips
that are organized in a way of a hierarchy:

   ======================================================
   WARNING: possible circular locking dependency detected
   6.12.0-rc5-next-20241101-00148-g9fabf8160b53 #562 Tainted: G        W
   ------------------------------------------------------
   modprobe/141 is trying to acquire lock:
   ffff899446947868 (intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock){+.+.}-{4:4}, at: regmap_update_bits_base+0x33/0x90

   but task is already holding lock:
   ffff899446947c68 (&d->lock){+.+.}-{4:4}, at: __setup_irq+0x682/0x790

   which lock already depends on the new lock.

   -> #3 (&d->lock){+.+.}-{4:4}:
   -> #2 (&desc->request_mutex){+.+.}-{4:4}:
   -> #1 (ipclock){+.+.}-{4:4}:
   -> #0 (intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock){+.+.}-{4:4}:

   Chain exists of:
     intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock --> &desc->request_mutex --> &d->lock

    Possible unsafe locking scenario:

          CPU0                    CPU1
          ----                    ----
     lock(&d->lock);
                                  lock(&desc->request_mutex);
                                  lock(&d->lock);
     lock(intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock);

    *** DEADLOCK ***

   3 locks held by modprobe/141:
    #0: ffff8994419368f8 (&dev->mutex){....}-{4:4}, at: __driver_attach+0xf6/0x250
    #1: ffff89944690b250 (&desc->request_mutex){+.+.}-{4:4}, at: __setup_irq+0x1a2/0x790
    #2: ffff899446947c68 (&d->lock){+.+.}-{4:4}, at: __setup_irq+0x682/0x790

Set a lockdep class when we map the IRQ so that it doesn't warn about
a lockdep bug that doesn't exist.

Fixes: 4af8be6 ("regmap: Convert regmap_irq to use irq_domain")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241101165553.4055617-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
[ Upstream commit 06dbbb4 ]

copy_from_kernel_nofault() can be called when doing read of /proc/kcore.
/proc/kcore can have some unmapped kfence objects which when read via
copy_from_kernel_nofault() can cause page faults. Since *_nofault()
functions define their own fixup table for handling fault, use that
instead of asking kfence to handle such faults.

Hence we search the exception tables for the nip which generated the
fault. If there is an entry then we let the fixup table handler handle the
page fault by returning an error from within ___do_page_fault().

This can be easily triggered if someone tries to do dd from /proc/kcore.
eg. dd if=/proc/kcore of=/dev/null bs=1M

Some example false negatives:

  ===============================
  BUG: KFENCE: invalid read in copy_from_kernel_nofault+0x9c/0x1a0
  Invalid read at 0xc0000000fdff0000:
   copy_from_kernel_nofault+0x9c/0x1a0
   0xc00000000665f950
   read_kcore_iter+0x57c/0xa04
   proc_reg_read_iter+0xe4/0x16c
   vfs_read+0x320/0x3ec
   ksys_read+0x90/0x154
   system_call_exception+0x120/0x310
   system_call_vectored_common+0x15c/0x2ec

  BUG: KFENCE: use-after-free read in copy_from_kernel_nofault+0x9c/0x1a0
  Use-after-free read at 0xc0000000fe050000 (in kfence-#2):
   copy_from_kernel_nofault+0x9c/0x1a0
   0xc00000000665f950
   read_kcore_iter+0x57c/0xa04
   proc_reg_read_iter+0xe4/0x16c
   vfs_read+0x320/0x3ec
   ksys_read+0x90/0x154
   system_call_exception+0x120/0x310
   system_call_vectored_common+0x15c/0x2ec

Fixes: 90cbac0 ("powerpc: Enable KFENCE for PPC32")
Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reported-by: Disha Goel <disgoel@linux.ibm.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/a411788081d50e3b136c6270471e35aba3dfafa3.1729271995.git.ritesh.list@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
[ Upstream commit cadae3a ]

The dtl_access_lock needs to be a rw_sempahore, a sleeping lock, because
the code calls kmalloc() while holding it, which can sleep:

  # echo 1 > /proc/powerpc/vcpudispatch_stats
  BUG: sleeping function called from invalid context at include/linux/sched/mm.h:337
  in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 199, name: sh
  preempt_count: 1, expected: 0
  3 locks held by sh/199:
   #0: c00000000a0743f8 (sb_writers#3){.+.+}-{0:0}, at: vfs_write+0x324/0x438
   #1: c0000000028c7058 (dtl_enable_mutex){+.+.}-{3:3}, at: vcpudispatch_stats_write+0xd4/0x5f4
   #2: c0000000028c70b8 (dtl_access_lock){+.+.}-{2:2}, at: vcpudispatch_stats_write+0x220/0x5f4
  CPU: 0 PID: 199 Comm: sh Not tainted 6.10.0-rc4 #152
  Hardware name: IBM pSeries (emulated by qemu) POWER9 (raw) 0x4e1202 0xf000005 of:SLOF,HEAD hv:linux,kvm pSeries
  Call Trace:
    dump_stack_lvl+0x130/0x148 (unreliable)
    __might_resched+0x174/0x410
    kmem_cache_alloc_noprof+0x340/0x3d0
    alloc_dtl_buffers+0x124/0x1ac
    vcpudispatch_stats_write+0x2a8/0x5f4
    proc_reg_write+0xf4/0x150
    vfs_write+0xfc/0x438
    ksys_write+0x88/0x148
    system_call_exception+0x1c4/0x5a0
    system_call_common+0xf4/0x258

Fixes: 06220d7 ("powerpc/pseries: Introduce rwlock to gatekeep DTLB usage")
Tested-by: Kajol Jain <kjain@linux.ibm.com>
Reviewed-by: Nysal Jan K.A <nysal@linux.ibm.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/20240819122401.513203-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
[ Upstream commit f10a890 ]

syzbot reports deadlock issue of f2fs as below:

======================================================
WARNING: possible circular locking dependency detected
6.12.0-rc3-syzkaller-00087-gc964ced77262 #0 Not tainted
------------------------------------------------------
kswapd0/79 is trying to acquire lock:
ffff888011824088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2199 [inline]
ffff888011824088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_record_stop_reason+0x52/0x1d0 fs/f2fs/super.c:4068

but task is already holding lock:
ffff88804bd92610 (sb_internal#2){.+.+}-{0:0}, at: f2fs_evict_inode+0x662/0x15c0 fs/f2fs/inode.c:842

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #2 (sb_internal#2){.+.+}-{0:0}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1716 [inline]
       sb_start_intwrite+0x4d/0x1c0 include/linux/fs.h:1899
       f2fs_evict_inode+0x662/0x15c0 fs/f2fs/inode.c:842
       evict+0x4e8/0x9b0 fs/inode.c:725
       f2fs_evict_inode+0x1a4/0x15c0 fs/f2fs/inode.c:807
       evict+0x4e8/0x9b0 fs/inode.c:725
       dispose_list fs/inode.c:774 [inline]
       prune_icache_sb+0x239/0x2f0 fs/inode.c:963
       super_cache_scan+0x38c/0x4b0 fs/super.c:223
       do_shrink_slab+0x701/0x1160 mm/shrinker.c:435
       shrink_slab+0x1093/0x14d0 mm/shrinker.c:662
       shrink_one+0x43b/0x850 mm/vmscan.c:4818
       shrink_many mm/vmscan.c:4879 [inline]
       lru_gen_shrink_node mm/vmscan.c:4957 [inline]
       shrink_node+0x3799/0x3de0 mm/vmscan.c:5937
       kswapd_shrink_node mm/vmscan.c:6765 [inline]
       balance_pgdat mm/vmscan.c:6957 [inline]
       kswapd+0x1ca3/0x3700 mm/vmscan.c:7226
       kthread+0x2f0/0x390 kernel/kthread.c:389
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

-> #1 (fs_reclaim){+.+.}-{0:0}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       __fs_reclaim_acquire mm/page_alloc.c:3834 [inline]
       fs_reclaim_acquire+0x88/0x130 mm/page_alloc.c:3848
       might_alloc include/linux/sched/mm.h:318 [inline]
       prepare_alloc_pages+0x147/0x5b0 mm/page_alloc.c:4493
       __alloc_pages_noprof+0x16f/0x710 mm/page_alloc.c:4722
       alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
       alloc_pages_noprof mm/mempolicy.c:2345 [inline]
       folio_alloc_noprof+0x128/0x180 mm/mempolicy.c:2352
       filemap_alloc_folio_noprof+0xdf/0x500 mm/filemap.c:1010
       do_read_cache_folio+0x2eb/0x850 mm/filemap.c:3787
       read_mapping_folio include/linux/pagemap.h:1011 [inline]
       f2fs_commit_super+0x3c0/0x7d0 fs/f2fs/super.c:4032
       f2fs_record_stop_reason+0x13b/0x1d0 fs/f2fs/super.c:4079
       f2fs_handle_critical_error+0x2ac/0x5c0 fs/f2fs/super.c:4174
       f2fs_write_inode+0x35f/0x4d0 fs/f2fs/inode.c:785
       write_inode fs/fs-writeback.c:1503 [inline]
       __writeback_single_inode+0x711/0x10d0 fs/fs-writeback.c:1723
       writeback_single_inode+0x1f3/0x660 fs/fs-writeback.c:1779
       sync_inode_metadata+0xc4/0x120 fs/fs-writeback.c:2849
       f2fs_release_file+0xa8/0x100 fs/f2fs/file.c:1941
       __fput+0x23f/0x880 fs/file_table.c:431
       task_work_run+0x24f/0x310 kernel/task_work.c:228
       resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
       exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
       __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
       syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218
       do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&sbi->sb_lock){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
       __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       down_write+0x99/0x220 kernel/locking/rwsem.c:1577
       f2fs_down_write fs/f2fs/f2fs.h:2199 [inline]
       f2fs_record_stop_reason+0x52/0x1d0 fs/f2fs/super.c:4068
       f2fs_handle_critical_error+0x2ac/0x5c0 fs/f2fs/super.c:4174
       f2fs_evict_inode+0xa61/0x15c0 fs/f2fs/inode.c:883
       evict+0x4e8/0x9b0 fs/inode.c:725
       f2fs_evict_inode+0x1a4/0x15c0 fs/f2fs/inode.c:807
       evict+0x4e8/0x9b0 fs/inode.c:725
       dispose_list fs/inode.c:774 [inline]
       prune_icache_sb+0x239/0x2f0 fs/inode.c:963
       super_cache_scan+0x38c/0x4b0 fs/super.c:223
       do_shrink_slab+0x701/0x1160 mm/shrinker.c:435
       shrink_slab+0x1093/0x14d0 mm/shrinker.c:662
       shrink_one+0x43b/0x850 mm/vmscan.c:4818
       shrink_many mm/vmscan.c:4879 [inline]
       lru_gen_shrink_node mm/vmscan.c:4957 [inline]
       shrink_node+0x3799/0x3de0 mm/vmscan.c:5937
       kswapd_shrink_node mm/vmscan.c:6765 [inline]
       balance_pgdat mm/vmscan.c:6957 [inline]
       kswapd+0x1ca3/0x3700 mm/vmscan.c:7226
       kthread+0x2f0/0x390 kernel/kthread.c:389
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

other info that might help us debug this:

Chain exists of:
  &sbi->sb_lock --> fs_reclaim --> sb_internal#2

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_internal#2);
                               lock(fs_reclaim);
                               lock(sb_internal#2);
  lock(&sbi->sb_lock);

Root cause is there will be potential deadlock in between
below tasks:

Thread A				Kswapd
- f2fs_ioc_commit_atomic_write
 - mnt_want_write_file -- down_read lock A
					- balance_pgdat
					 - __fs_reclaim_acquire  -- lock B
					  - shrink_node
					   - prune_icache_sb
					    - dispose_list
					     - f2fs_evict_inode
					      - sb_start_intwrite  -- down_read lock A
 - f2fs_do_sync_file
  - f2fs_write_inode
   - f2fs_handle_critical_error
    - f2fs_record_stop_reason
     - f2fs_commit_super
      - read_mapping_folio
       - filemap_alloc_folio_noprof
        - fs_reclaim_acquire  -- lock B

Both threads try to acquire read lock of lock A, then its upcoming write
lock grabber will trigger deadlock.

Let's always create an asynchronous task in f2fs_handle_critical_error()
rather than calling f2fs_record_stop_reason() synchronously to avoid
this potential deadlock issue.

Fixes: b62e71b ("f2fs: support errors=remount-ro|continue|panic mountoption")
Reported-by: syzbot+be4a9983e95a5e25c8d3@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6704d667.050a0220.1e4d62.0081.GAE@google.com
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
[ Upstream commit b22db8b ]

Fix possible use-after-free in 'taprio_dump()' by adding RCU
read-side critical section there. Never seen on x86 but
found on a KASAN-enabled arm64 system when investigating
https://syzkaller.appspot.com/bug?extid=b65e0af58423fc8a73aa:

[T15862] BUG: KASAN: slab-use-after-free in taprio_dump+0xa0c/0xbb0
[T15862] Read of size 4 at addr ffff0000d4bb88f8 by task repro/15862
[T15862]
[T15862] CPU: 0 UID: 0 PID: 15862 Comm: repro Not tainted 6.11.0-rc1-00293-gdefaf1a2113a-dirty #2
[T15862] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-20240524-5.fc40 05/24/2024
[T15862] Call trace:
[T15862]  dump_backtrace+0x20c/0x220
[T15862]  show_stack+0x2c/0x40
[T15862]  dump_stack_lvl+0xf8/0x174
[T15862]  print_report+0x170/0x4d8
[T15862]  kasan_report+0xb8/0x1d4
[T15862]  __asan_report_load4_noabort+0x20/0x2c
[T15862]  taprio_dump+0xa0c/0xbb0
[T15862]  tc_fill_qdisc+0x540/0x1020
[T15862]  qdisc_notify.isra.0+0x330/0x3a0
[T15862]  tc_modify_qdisc+0x7b8/0x1838
[T15862]  rtnetlink_rcv_msg+0x3c8/0xc20
[T15862]  netlink_rcv_skb+0x1f8/0x3d4
[T15862]  rtnetlink_rcv+0x28/0x40
[T15862]  netlink_unicast+0x51c/0x790
[T15862]  netlink_sendmsg+0x79c/0xc20
[T15862]  __sock_sendmsg+0xe0/0x1a0
[T15862]  ____sys_sendmsg+0x6c0/0x840
[T15862]  ___sys_sendmsg+0x1ac/0x1f0
[T15862]  __sys_sendmsg+0x110/0x1d0
[T15862]  __arm64_sys_sendmsg+0x74/0xb0
[T15862]  invoke_syscall+0x88/0x2e0
[T15862]  el0_svc_common.constprop.0+0xe4/0x2a0
[T15862]  do_el0_svc+0x44/0x60
[T15862]  el0_svc+0x50/0x184
[T15862]  el0t_64_sync_handler+0x120/0x12c
[T15862]  el0t_64_sync+0x190/0x194
[T15862]
[T15862] Allocated by task 15857:
[T15862]  kasan_save_stack+0x3c/0x70
[T15862]  kasan_save_track+0x20/0x3c
[T15862]  kasan_save_alloc_info+0x40/0x60
[T15862]  __kasan_kmalloc+0xd4/0xe0
[T15862]  __kmalloc_cache_noprof+0x194/0x334
[T15862]  taprio_change+0x45c/0x2fe0
[T15862]  tc_modify_qdisc+0x6a8/0x1838
[T15862]  rtnetlink_rcv_msg+0x3c8/0xc20
[T15862]  netlink_rcv_skb+0x1f8/0x3d4
[T15862]  rtnetlink_rcv+0x28/0x40
[T15862]  netlink_unicast+0x51c/0x790
[T15862]  netlink_sendmsg+0x79c/0xc20
[T15862]  __sock_sendmsg+0xe0/0x1a0
[T15862]  ____sys_sendmsg+0x6c0/0x840
[T15862]  ___sys_sendmsg+0x1ac/0x1f0
[T15862]  __sys_sendmsg+0x110/0x1d0
[T15862]  __arm64_sys_sendmsg+0x74/0xb0
[T15862]  invoke_syscall+0x88/0x2e0
[T15862]  el0_svc_common.constprop.0+0xe4/0x2a0
[T15862]  do_el0_svc+0x44/0x60
[T15862]  el0_svc+0x50/0x184
[T15862]  el0t_64_sync_handler+0x120/0x12c
[T15862]  el0t_64_sync+0x190/0x194
[T15862]
[T15862] Freed by task 6192:
[T15862]  kasan_save_stack+0x3c/0x70
[T15862]  kasan_save_track+0x20/0x3c
[T15862]  kasan_save_free_info+0x4c/0x80
[T15862]  poison_slab_object+0x110/0x160
[T15862]  __kasan_slab_free+0x3c/0x74
[T15862]  kfree+0x134/0x3c0
[T15862]  taprio_free_sched_cb+0x18c/0x220
[T15862]  rcu_core+0x920/0x1b7c
[T15862]  rcu_core_si+0x10/0x1c
[T15862]  handle_softirqs+0x2e8/0xd64
[T15862]  __do_softirq+0x14/0x20

Fixes: 18cdd2f ("net/sched: taprio: taprio_dump and taprio_change are protected by rtnl_mutex")
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20241018051339.418890-2-dmantipov@yandex.ru
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
commit 3cea8af upstream.

Currently, when configuring TMU (Time Management Unit) mode of a given
router, we take into account only its own TMU requirements ignoring
other routers in the domain. This is problematic if the router we are
configuring has lower TMU requirements than what is already configured
in the domain.

In the scenario below, we have a host router with two USB4 ports: A and
B. Port A connected to device router #1 (which supports CL states) and
existing DisplayPort tunnel, thus, the TMU mode is HiFi uni-directional.

1. Initial topology

          [Host]
         A/
         /
 [Device #1]
   /
Monitor

2. Plug in device #2 (that supports CL states) to downstream port B of
   the host router

         [Host]
        A/    B\
        /       \
 [Device #1]    [Device #2]
   /
Monitor

The TMU mode on port B and port A will be configured to LowRes which is
not what we want and will cause monitor to start flickering.

To address this we first scan the domain and search for any router
configured to HiFi uni-directional mode, and if found, configure TMU
mode of the given router to HiFi uni-directional as well.

Cc: stable@vger.kernel.org
Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
[ Upstream commit c749d9b ]

generic/077 on x86_32 CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y with highmem,
on huge=always tmpfs, issues a warning and then hangs (interruptibly):

WARNING: CPU: 5 PID: 3517 at mm/highmem.c:622 kunmap_local_indexed+0x62/0xc9
CPU: 5 UID: 0 PID: 3517 Comm: cp Not tainted 6.12.0-rc4 #2
...
copy_page_from_iter_atomic+0xa6/0x5ec
generic_perform_write+0xf6/0x1b4
shmem_file_write_iter+0x54/0x67

Fix copy_page_from_iter_atomic() by limiting it in that case
(include/linux/skbuff.h skb_frag_must_loop() does similar).

But going forward, perhaps CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP is too
surprising, has outlived its usefulness, and should just be removed?

Fixes: 908a1ad ("iov_iter: Handle compound highmem pages in copy_page_from_iter_atomic()")
Signed-off-by: Hugh Dickins <hughd@google.com>
Link: https://lore.kernel.org/r/dd5f0c89-186e-18e1-4f43-19a60f5a9774@google.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 7, 2024
commit 1f26339 upstream.

The scope of the TX skb is wider than just mse102x_tx_frame_spi(),
so in case the TX skb room needs to be expanded, we should free the
the temporary skb instead of the original skb. Otherwise the original
TX skb pointer would be freed again in mse102x_tx_work(), which leads
to crashes:

  Internal error: Oops: 0000000096000004 [#2] PREEMPT SMP
  CPU: 0 PID: 712 Comm: kworker/0:1 Tainted: G      D            6.6.23
  Hardware name: chargebyte Charge SOM DC-ONE (DT)
  Workqueue: events mse102x_tx_work [mse102x]
  pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
  pc : skb_release_data+0xb8/0x1d8
  lr : skb_release_data+0x1ac/0x1d8
  sp : ffff8000819a3cc0
  x29: ffff8000819a3cc0 x28: ffff0000046daa60 x27: ffff0000057f2dc0
  x26: ffff000005386c00 x25: 0000000000000002 x24: 00000000ffffffff
  x23: 0000000000000000 x22: 0000000000000001 x21: ffff0000057f2e50
  x20: 0000000000000006 x19: 0000000000000000 x18: ffff00003fdacfcc
  x17: e69ad452d0c49def x16: 84a005feff870102 x15: 0000000000000000
  x14: 000000000000024a x13: 0000000000000002 x12: 0000000000000000
  x11: 0000000000000400 x10: 0000000000000930 x9 : ffff00003fd913e8
  x8 : fffffc00001bc008
  x7 : 0000000000000000 x6 : 0000000000000008
  x5 : ffff00003fd91340 x4 : 0000000000000000 x3 : 0000000000000009
  x2 : 00000000fffffffe x1 : 0000000000000000 x0 : 0000000000000000
  Call trace:
   skb_release_data+0xb8/0x1d8
   kfree_skb_reason+0x48/0xb0
   mse102x_tx_work+0x164/0x35c [mse102x]
   process_one_work+0x138/0x260
   worker_thread+0x32c/0x438
   kthread+0x118/0x11c
   ret_from_fork+0x10/0x20
  Code: aa1303e0 97fffab6 72001c1f 54000141 (f9400660)

Cc: stable@vger.kernel.org
Fixes: 2f207cb ("net: vertexcom: Add MSE102x SPI support")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://patch.msgid.link/20241105163101.33216-1-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
qaz6750 pushed a commit that referenced this pull request Dec 29, 2024
[ Upstream commit 06dbbb4 ]

copy_from_kernel_nofault() can be called when doing read of /proc/kcore.
/proc/kcore can have some unmapped kfence objects which when read via
copy_from_kernel_nofault() can cause page faults. Since *_nofault()
functions define their own fixup table for handling fault, use that
instead of asking kfence to handle such faults.

Hence we search the exception tables for the nip which generated the
fault. If there is an entry then we let the fixup table handler handle the
page fault by returning an error from within ___do_page_fault().

This can be easily triggered if someone tries to do dd from /proc/kcore.
eg. dd if=/proc/kcore of=/dev/null bs=1M

Some example false negatives:

  ===============================
  BUG: KFENCE: invalid read in copy_from_kernel_nofault+0x9c/0x1a0
  Invalid read at 0xc0000000fdff0000:
   copy_from_kernel_nofault+0x9c/0x1a0
   0xc00000000665f950
   read_kcore_iter+0x57c/0xa04
   proc_reg_read_iter+0xe4/0x16c
   vfs_read+0x320/0x3ec
   ksys_read+0x90/0x154
   system_call_exception+0x120/0x310
   system_call_vectored_common+0x15c/0x2ec

  BUG: KFENCE: use-after-free read in copy_from_kernel_nofault+0x9c/0x1a0
  Use-after-free read at 0xc0000000fe050000 (in kfence-#2):
   copy_from_kernel_nofault+0x9c/0x1a0
   0xc00000000665f950
   read_kcore_iter+0x57c/0xa04
   proc_reg_read_iter+0xe4/0x16c
   vfs_read+0x320/0x3ec
   ksys_read+0x90/0x154
   system_call_exception+0x120/0x310
   system_call_vectored_common+0x15c/0x2ec

Fixes: 90cbac0 ("powerpc: Enable KFENCE for PPC32")
Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reported-by: Disha Goel <disgoel@linux.ibm.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/a411788081d50e3b136c6270471e35aba3dfafa3.1729271995.git.ritesh.list@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 29, 2024
[ Upstream commit cadae3a ]

The dtl_access_lock needs to be a rw_sempahore, a sleeping lock, because
the code calls kmalloc() while holding it, which can sleep:

  # echo 1 > /proc/powerpc/vcpudispatch_stats
  BUG: sleeping function called from invalid context at include/linux/sched/mm.h:337
  in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 199, name: sh
  preempt_count: 1, expected: 0
  3 locks held by sh/199:
   #0: c00000000a0743f8 (sb_writers#3){.+.+}-{0:0}, at: vfs_write+0x324/0x438
   #1: c0000000028c7058 (dtl_enable_mutex){+.+.}-{3:3}, at: vcpudispatch_stats_write+0xd4/0x5f4
   #2: c0000000028c70b8 (dtl_access_lock){+.+.}-{2:2}, at: vcpudispatch_stats_write+0x220/0x5f4
  CPU: 0 PID: 199 Comm: sh Not tainted 6.10.0-rc4 #152
  Hardware name: IBM pSeries (emulated by qemu) POWER9 (raw) 0x4e1202 0xf000005 of:SLOF,HEAD hv:linux,kvm pSeries
  Call Trace:
    dump_stack_lvl+0x130/0x148 (unreliable)
    __might_resched+0x174/0x410
    kmem_cache_alloc_noprof+0x340/0x3d0
    alloc_dtl_buffers+0x124/0x1ac
    vcpudispatch_stats_write+0x2a8/0x5f4
    proc_reg_write+0xf4/0x150
    vfs_write+0xfc/0x438
    ksys_write+0x88/0x148
    system_call_exception+0x1c4/0x5a0
    system_call_common+0xf4/0x258

Fixes: 06220d7 ("powerpc/pseries: Introduce rwlock to gatekeep DTLB usage")
Tested-by: Kajol Jain <kjain@linux.ibm.com>
Reviewed-by: Nysal Jan K.A <nysal@linux.ibm.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/20240819122401.513203-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 29, 2024
[ Upstream commit f10a890 ]

syzbot reports deadlock issue of f2fs as below:

======================================================
WARNING: possible circular locking dependency detected
6.12.0-rc3-syzkaller-00087-gc964ced77262 #0 Not tainted
------------------------------------------------------
kswapd0/79 is trying to acquire lock:
ffff888011824088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2199 [inline]
ffff888011824088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_record_stop_reason+0x52/0x1d0 fs/f2fs/super.c:4068

but task is already holding lock:
ffff88804bd92610 (sb_internal#2){.+.+}-{0:0}, at: f2fs_evict_inode+0x662/0x15c0 fs/f2fs/inode.c:842

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #2 (sb_internal#2){.+.+}-{0:0}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1716 [inline]
       sb_start_intwrite+0x4d/0x1c0 include/linux/fs.h:1899
       f2fs_evict_inode+0x662/0x15c0 fs/f2fs/inode.c:842
       evict+0x4e8/0x9b0 fs/inode.c:725
       f2fs_evict_inode+0x1a4/0x15c0 fs/f2fs/inode.c:807
       evict+0x4e8/0x9b0 fs/inode.c:725
       dispose_list fs/inode.c:774 [inline]
       prune_icache_sb+0x239/0x2f0 fs/inode.c:963
       super_cache_scan+0x38c/0x4b0 fs/super.c:223
       do_shrink_slab+0x701/0x1160 mm/shrinker.c:435
       shrink_slab+0x1093/0x14d0 mm/shrinker.c:662
       shrink_one+0x43b/0x850 mm/vmscan.c:4818
       shrink_many mm/vmscan.c:4879 [inline]
       lru_gen_shrink_node mm/vmscan.c:4957 [inline]
       shrink_node+0x3799/0x3de0 mm/vmscan.c:5937
       kswapd_shrink_node mm/vmscan.c:6765 [inline]
       balance_pgdat mm/vmscan.c:6957 [inline]
       kswapd+0x1ca3/0x3700 mm/vmscan.c:7226
       kthread+0x2f0/0x390 kernel/kthread.c:389
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

-> #1 (fs_reclaim){+.+.}-{0:0}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       __fs_reclaim_acquire mm/page_alloc.c:3834 [inline]
       fs_reclaim_acquire+0x88/0x130 mm/page_alloc.c:3848
       might_alloc include/linux/sched/mm.h:318 [inline]
       prepare_alloc_pages+0x147/0x5b0 mm/page_alloc.c:4493
       __alloc_pages_noprof+0x16f/0x710 mm/page_alloc.c:4722
       alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
       alloc_pages_noprof mm/mempolicy.c:2345 [inline]
       folio_alloc_noprof+0x128/0x180 mm/mempolicy.c:2352
       filemap_alloc_folio_noprof+0xdf/0x500 mm/filemap.c:1010
       do_read_cache_folio+0x2eb/0x850 mm/filemap.c:3787
       read_mapping_folio include/linux/pagemap.h:1011 [inline]
       f2fs_commit_super+0x3c0/0x7d0 fs/f2fs/super.c:4032
       f2fs_record_stop_reason+0x13b/0x1d0 fs/f2fs/super.c:4079
       f2fs_handle_critical_error+0x2ac/0x5c0 fs/f2fs/super.c:4174
       f2fs_write_inode+0x35f/0x4d0 fs/f2fs/inode.c:785
       write_inode fs/fs-writeback.c:1503 [inline]
       __writeback_single_inode+0x711/0x10d0 fs/fs-writeback.c:1723
       writeback_single_inode+0x1f3/0x660 fs/fs-writeback.c:1779
       sync_inode_metadata+0xc4/0x120 fs/fs-writeback.c:2849
       f2fs_release_file+0xa8/0x100 fs/f2fs/file.c:1941
       __fput+0x23f/0x880 fs/file_table.c:431
       task_work_run+0x24f/0x310 kernel/task_work.c:228
       resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
       exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
       __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
       syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218
       do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&sbi->sb_lock){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
       __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       down_write+0x99/0x220 kernel/locking/rwsem.c:1577
       f2fs_down_write fs/f2fs/f2fs.h:2199 [inline]
       f2fs_record_stop_reason+0x52/0x1d0 fs/f2fs/super.c:4068
       f2fs_handle_critical_error+0x2ac/0x5c0 fs/f2fs/super.c:4174
       f2fs_evict_inode+0xa61/0x15c0 fs/f2fs/inode.c:883
       evict+0x4e8/0x9b0 fs/inode.c:725
       f2fs_evict_inode+0x1a4/0x15c0 fs/f2fs/inode.c:807
       evict+0x4e8/0x9b0 fs/inode.c:725
       dispose_list fs/inode.c:774 [inline]
       prune_icache_sb+0x239/0x2f0 fs/inode.c:963
       super_cache_scan+0x38c/0x4b0 fs/super.c:223
       do_shrink_slab+0x701/0x1160 mm/shrinker.c:435
       shrink_slab+0x1093/0x14d0 mm/shrinker.c:662
       shrink_one+0x43b/0x850 mm/vmscan.c:4818
       shrink_many mm/vmscan.c:4879 [inline]
       lru_gen_shrink_node mm/vmscan.c:4957 [inline]
       shrink_node+0x3799/0x3de0 mm/vmscan.c:5937
       kswapd_shrink_node mm/vmscan.c:6765 [inline]
       balance_pgdat mm/vmscan.c:6957 [inline]
       kswapd+0x1ca3/0x3700 mm/vmscan.c:7226
       kthread+0x2f0/0x390 kernel/kthread.c:389
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

other info that might help us debug this:

Chain exists of:
  &sbi->sb_lock --> fs_reclaim --> sb_internal#2

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_internal#2);
                               lock(fs_reclaim);
                               lock(sb_internal#2);
  lock(&sbi->sb_lock);

Root cause is there will be potential deadlock in between
below tasks:

Thread A				Kswapd
- f2fs_ioc_commit_atomic_write
 - mnt_want_write_file -- down_read lock A
					- balance_pgdat
					 - __fs_reclaim_acquire  -- lock B
					  - shrink_node
					   - prune_icache_sb
					    - dispose_list
					     - f2fs_evict_inode
					      - sb_start_intwrite  -- down_read lock A
 - f2fs_do_sync_file
  - f2fs_write_inode
   - f2fs_handle_critical_error
    - f2fs_record_stop_reason
     - f2fs_commit_super
      - read_mapping_folio
       - filemap_alloc_folio_noprof
        - fs_reclaim_acquire  -- lock B

Both threads try to acquire read lock of lock A, then its upcoming write
lock grabber will trigger deadlock.

Let's always create an asynchronous task in f2fs_handle_critical_error()
rather than calling f2fs_record_stop_reason() synchronously to avoid
this potential deadlock issue.

Fixes: b62e71b ("f2fs: support errors=remount-ro|continue|panic mountoption")
Reported-by: syzbot+be4a9983e95a5e25c8d3@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6704d667.050a0220.1e4d62.0081.GAE@google.com
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 29, 2024
…ndex

[ Upstream commit e9db1b5 ]

Intel SoundWire machine driver always uses Pin number 2 and above.
Currently, the pin number is used as the FW DAI index directly. As a
result, FW DAI 0 and 1 are never used. That worked fine because we use
up to 2 DAIs in a SDW link. Convert the topology pin index to ALH dai
index, the mapping is using 2-off indexing, iow, pin #2 is ALH dai #0.

The issue exists since beginning. And the Fixes tag is the first commit
that this commit can be applied.

Fixes: b66bfc3 ("ASoC: SOF: sof-audio: Fix broken early bclk feature for SSP")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://patch.msgid.link/20241127092955.20026-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 29, 2024
[ Upstream commit 88fd2b7 ]

Commit bab1c29 ("LoongArch: Fix sleeping in atomic context in
setup_tlb_handler()") changes the gfp flag from GFP_KERNEL to GFP_ATOMIC
for alloc_pages_node(). However, for PREEMPT_RT kernels we can still get
a "sleeping in atomic context" error:

[    0.372259] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
[    0.372266] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
[    0.372268] preempt_count: 1, expected: 0
[    0.372270] RCU nest depth: 1, expected: 1
[    0.372272] 3 locks held by swapper/1/0:
[    0.372274]  #0: 900000000c9f5e60 (&pcp->lock){+.+.}-{3:3}, at: get_page_from_freelist+0x524/0x1c60
[    0.372294]  #1: 90000000087013b8 (rcu_read_lock){....}-{1:3}, at: rt_spin_trylock+0x50/0x140
[    0.372305]  #2: 900000047fffd388 (&zone->lock){+.+.}-{3:3}, at: __rmqueue_pcplist+0x30c/0xea0
[    0.372314] irq event stamp: 0
[    0.372316] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
[    0.372322] hardirqs last disabled at (0): [<9000000005947320>] copy_process+0x9c0/0x26e0
[    0.372329] softirqs last  enabled at (0): [<9000000005947320>] copy_process+0x9c0/0x26e0
[    0.372335] softirqs last disabled at (0): [<0000000000000000>] 0x0
[    0.372341] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.12.0-rc7+ #1891
[    0.372346] Hardware name: Loongson Loongson-3A5000-7A1000-1w-CRB/Loongson-LS3A5000-7A1000-1w-CRB, BIOS vUDK2018-LoongArch-V2.0.0-prebeta9 10/21/2022
[    0.372349] Stack : 0000000000000089 9000000005a0db9c 90000000071519c8 9000000100388000
[    0.372486]         900000010038b890 0000000000000000 900000010038b898 9000000007e53788
[    0.372492]         900000000815bcc8 900000000815bcc0 900000010038b700 0000000000000001
[    0.372498]         0000000000000001 4b031894b9d6b725 00000000055ec000 9000000100338fc0
[    0.372503]         00000000000000c4 0000000000000001 000000000000002d 0000000000000003
[    0.372509]         0000000000000030 0000000000000003 00000000055ec000 0000000000000003
[    0.372515]         900000000806d000 9000000007e53788 00000000000000b0 0000000000000004
[    0.372521]         0000000000000000 0000000000000000 900000000c9f5f10 0000000000000000
[    0.372526]         90000000076f12d8 9000000007e53788 9000000005924778 0000000000000000
[    0.372532]         00000000000000b0 0000000000000004 0000000000000000 0000000000070000
[    0.372537]         ...
[    0.372540] Call Trace:
[    0.372542] [<9000000005924778>] show_stack+0x38/0x180
[    0.372548] [<90000000071519c4>] dump_stack_lvl+0x94/0xe4
[    0.372555] [<900000000599b880>] __might_resched+0x1a0/0x260
[    0.372561] [<90000000071675cc>] rt_spin_lock+0x4c/0x140
[    0.372565] [<9000000005cbb768>] __rmqueue_pcplist+0x308/0xea0
[    0.372570] [<9000000005cbed84>] get_page_from_freelist+0x564/0x1c60
[    0.372575] [<9000000005cc0d98>] __alloc_pages_noprof+0x218/0x1820
[    0.372580] [<900000000593b36c>] tlb_init+0x1ac/0x298
[    0.372585] [<9000000005924b74>] per_cpu_trap_init+0x114/0x140
[    0.372589] [<9000000005921964>] cpu_probe+0x4e4/0xa60
[    0.372592] [<9000000005934874>] start_secondary+0x34/0xc0
[    0.372599] [<900000000715615c>] smpboot_entry+0x64/0x6c

This is because in PREEMPT_RT kernels normal spinlocks are replaced by
rt spinlocks and rt_spin_lock() will cause sleeping. Fix it by disabling
NUMA optimization completely for PREEMPT_RT kernels.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Dec 29, 2024
[ Upstream commit 2e3dbf9 ]

Since the netlink attribute range validation provides inclusive
checking, the *max* of attribute NL80211_ATTR_MLO_LINK_ID should be
IEEE80211_MLD_MAX_NUM_LINKS - 1 otherwise causing an off-by-one.

One crash stack for demonstration:
==================================================================
BUG: KASAN: wild-memory-access in ieee80211_tx_control_port+0x3b6/0xca0 net/mac80211/tx.c:5939
Read of size 6 at addr 001102080000000c by task fuzzer.386/9508

CPU: 1 PID: 9508 Comm: syz.1.386 Not tainted 6.1.70 #2
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x177/0x231 lib/dump_stack.c:106
 print_report+0xe0/0x750 mm/kasan/report.c:398
 kasan_report+0x139/0x170 mm/kasan/report.c:495
 kasan_check_range+0x287/0x290 mm/kasan/generic.c:189
 memcpy+0x25/0x60 mm/kasan/shadow.c:65
 ieee80211_tx_control_port+0x3b6/0xca0 net/mac80211/tx.c:5939
 rdev_tx_control_port net/wireless/rdev-ops.h:761 [inline]
 nl80211_tx_control_port+0x7b3/0xc40 net/wireless/nl80211.c:15453
 genl_family_rcv_msg_doit+0x22e/0x320 net/netlink/genetlink.c:756
 genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
 genl_rcv_msg+0x539/0x740 net/netlink/genetlink.c:850
 netlink_rcv_skb+0x1de/0x420 net/netlink/af_netlink.c:2508
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:861
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x74b/0x8c0 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0x882/0xb90 net/netlink/af_netlink.c:1874
 sock_sendmsg_nosec net/socket.c:716 [inline]
 __sock_sendmsg net/socket.c:728 [inline]
 ____sys_sendmsg+0x5cc/0x8f0 net/socket.c:2499
 ___sys_sendmsg+0x21c/0x290 net/socket.c:2553
 __sys_sendmsg net/socket.c:2582 [inline]
 __do_sys_sendmsg net/socket.c:2591 [inline]
 __se_sys_sendmsg+0x19e/0x270 net/socket.c:2589
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x45/0x90 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Update the policy to ensure correct validation.

Fixes: 7b0a0e3 ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
Suggested-by: Cengiz Can <cengiz.can@canonical.com>
Link: https://patch.msgid.link/20241130170526.96698-1-linma@zju.edu.cn
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Jan 17, 2025
[ Upstream commit 05aa156 ]

The mapping VMA address is saved in VAS window struct when the
paste address is mapped. This VMA address is used during migration
to unmap the paste address if the window is active. The paste
address mapping will be removed when the window is closed or with
the munmap(). But the VMA address in the VAS window is not updated
with munmap() which is causing invalid access during migration.

The KASAN report shows:
[16386.254991] BUG: KASAN: slab-use-after-free in reconfig_close_windows+0x1a0/0x4e8
[16386.255043] Read of size 8 at addr c00000014a819670 by task drmgr/696928

[16386.255096] CPU: 29 UID: 0 PID: 696928 Comm: drmgr Kdump: loaded Tainted: G    B              6.11.0-rc5-nxgzip #2
[16386.255128] Tainted: [B]=BAD_PAGE
[16386.255148] Hardware name: IBM,9080-HEX Power11 (architected) 0x820200 0xf000007 of:IBM,FW1110.00 (NH1110_016) hv:phyp pSeries
[16386.255181] Call Trace:
[16386.255202] [c00000016b297660] [c0000000018ad0ac] dump_stack_lvl+0x84/0xe8 (unreliable)
[16386.255246] [c00000016b297690] [c0000000006e8a90] print_report+0x19c/0x764
[16386.255285] [c00000016b297760] [c0000000006e9490] kasan_report+0x128/0x1f8
[16386.255309] [c00000016b297880] [c0000000006eb5c8] __asan_load8+0xac/0xe0
[16386.255326] [c00000016b2978a0] [c00000000013f898] reconfig_close_windows+0x1a0/0x4e8
[16386.255343] [c00000016b297990] [c000000000140e58] vas_migration_handler+0x3a4/0x3fc
[16386.255368] [c00000016b297a90] [c000000000128848] pseries_migrate_partition+0x4c/0x4c4
...

[16386.256136] Allocated by task 696554 on cpu 31 at 16377.277618s:
[16386.256149]  kasan_save_stack+0x34/0x68
[16386.256163]  kasan_save_track+0x34/0x80
[16386.256175]  kasan_save_alloc_info+0x58/0x74
[16386.256196]  __kasan_slab_alloc+0xb8/0xdc
[16386.256209]  kmem_cache_alloc_noprof+0x200/0x3d0
[16386.256225]  vm_area_alloc+0x44/0x150
[16386.256245]  mmap_region+0x214/0x10c4
[16386.256265]  do_mmap+0x5fc/0x750
[16386.256277]  vm_mmap_pgoff+0x14c/0x24c
[16386.256292]  ksys_mmap_pgoff+0x20c/0x348
[16386.256303]  sys_mmap+0xd0/0x160
...

[16386.256350] Freed by task 0 on cpu 31 at 16386.204848s:
[16386.256363]  kasan_save_stack+0x34/0x68
[16386.256374]  kasan_save_track+0x34/0x80
[16386.256384]  kasan_save_free_info+0x64/0x10c
[16386.256396]  __kasan_slab_free+0x120/0x204
[16386.256415]  kmem_cache_free+0x128/0x450
[16386.256428]  vm_area_free_rcu_cb+0xa8/0xd8
[16386.256441]  rcu_do_batch+0x2c8/0xcf0
[16386.256458]  rcu_core+0x378/0x3c4
[16386.256473]  handle_softirqs+0x20c/0x60c
[16386.256495]  do_softirq_own_stack+0x6c/0x88
[16386.256509]  do_softirq_own_stack+0x58/0x88
[16386.256521]  __irq_exit_rcu+0x1a4/0x20c
[16386.256533]  irq_exit+0x20/0x38
[16386.256544]  interrupt_async_exit_prepare.constprop.0+0x18/0x2c
...

[16386.256717] Last potentially related work creation:
[16386.256729]  kasan_save_stack+0x34/0x68
[16386.256741]  __kasan_record_aux_stack+0xcc/0x12c
[16386.256753]  __call_rcu_common.constprop.0+0x94/0xd04
[16386.256766]  vm_area_free+0x28/0x3c
[16386.256778]  remove_vma+0xf4/0x114
[16386.256797]  do_vmi_align_munmap.constprop.0+0x684/0x870
[16386.256811]  __vm_munmap+0xe0/0x1f8
[16386.256821]  sys_munmap+0x54/0x6c
[16386.256830]  system_call_exception+0x1a0/0x4a0
[16386.256841]  system_call_vectored_common+0x15c/0x2ec

[16386.256868] The buggy address belongs to the object at c00000014a819670
                which belongs to the cache vm_area_struct of size 168
[16386.256887] The buggy address is located 0 bytes inside of
                freed 168-byte region [c00000014a819670, c00000014a819718)

[16386.256915] The buggy address belongs to the physical page:
[16386.256928] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14a81
[16386.256950] memcg:c0000000ba430001
[16386.256961] anon flags: 0x43ffff800000000(node=4|zone=0|lastcpupid=0x7ffff)
[16386.256975] page_type: 0xfdffffff(slab)
[16386.256990] raw: 043ffff800000000 c00000000501c080 0000000000000000 5deadbee00000001
[16386.257003] raw: 0000000000000000 00000000011a011a 00000001fdffffff c0000000ba430001
[16386.257018] page dumped because: kasan: bad access detected

This patch adds close() callback in vas_vm_ops vm_operations_struct
which will be executed during munmap() before freeing VMA. The VMA
address in the VAS window is set to NULL after holding the window
mmap_mutex.

Fixes: 37e6764 ("powerpc/pseries/vas: Add VAS migration handler")
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241214051758.997759-1-haren@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Jan 17, 2025
[ Upstream commit 8fac326 ]

When I try to manually set bitrates:

iw wlan0 set bitrates legacy-2.4 1

I get sleeping from invalid context error, see below. Fix that by switching to
use recently introduced ieee80211_iterate_stations_mtx().

Do note that WCN6855 firmware is still crashing, I'm not sure if that firmware
even supports bitrate WMI commands and should we consider disabling
ath12k_mac_op_set_bitrate_mask() for WCN6855? But that's for another patch.

BUG: sleeping function called from invalid context at drivers/net/wireless/ath/ath12k/wmi.c:420
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 2236, name: iw
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
3 locks held by iw/2236:
 #0: ffffffffabc6f1d8 (cb_lock){++++}-{3:3}, at: genl_rcv+0x14/0x40
 #1: ffff888138410810 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: nl80211_pre_doit+0x54d/0x800 [cfg80211]
 #2: ffffffffab2cfaa0 (rcu_read_lock){....}-{1:2}, at: ieee80211_iterate_stations_atomic+0x2f/0x200 [mac80211]
CPU: 3 UID: 0 PID: 2236 Comm: iw Not tainted 6.11.0-rc7-wt-ath+ #1772
Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
Call Trace:
 <TASK>
 dump_stack_lvl+0xa4/0xe0
 dump_stack+0x10/0x20
 __might_resched+0x363/0x5a0
 ? __alloc_skb+0x165/0x340
 __might_sleep+0xad/0x160
 ath12k_wmi_cmd_send+0xb1/0x3d0 [ath12k]
 ? ath12k_wmi_init_wcn7850+0xa40/0xa40 [ath12k]
 ? __netdev_alloc_skb+0x45/0x7b0
 ? __asan_memset+0x39/0x40
 ? ath12k_wmi_alloc_skb+0xf0/0x150 [ath12k]
 ? reacquire_held_locks+0x4d0/0x4d0
 ath12k_wmi_set_peer_param+0x340/0x5b0 [ath12k]
 ath12k_mac_disable_peer_fixed_rate+0xa3/0x110 [ath12k]
 ? ath12k_mac_vdev_stop+0x4f0/0x4f0 [ath12k]
 ieee80211_iterate_stations_atomic+0xd4/0x200 [mac80211]
 ath12k_mac_op_set_bitrate_mask+0x5d2/0x1080 [ath12k]
 ? ath12k_mac_vif_chan+0x320/0x320 [ath12k]
 drv_set_bitrate_mask+0x267/0x470 [mac80211]
 ieee80211_set_bitrate_mask+0x4cc/0x8a0 [mac80211]
 ? __this_cpu_preempt_check+0x13/0x20
 nl80211_set_tx_bitrate_mask+0x2bc/0x530 [cfg80211]
 ? nl80211_parse_tx_bitrate_mask+0x2320/0x2320 [cfg80211]
 ? trace_contention_end+0xef/0x140
 ? rtnl_unlock+0x9/0x10
 ? nl80211_pre_doit+0x557/0x800 [cfg80211]
 genl_family_rcv_msg_doit+0x1f0/0x2e0
 ? genl_family_rcv_msg_attrs_parse.isra.0+0x250/0x250
 ? ns_capable+0x57/0xd0
 genl_family_rcv_msg+0x34c/0x600
 ? genl_family_rcv_msg_dumpit+0x310/0x310
 ? __lock_acquire+0xc62/0x1de0
 ? he_set_mcs_mask.isra.0+0x8d0/0x8d0 [cfg80211]
 ? nl80211_parse_tx_bitrate_mask+0x2320/0x2320 [cfg80211]
 ? cfg80211_external_auth_request+0x690/0x690 [cfg80211]
 genl_rcv_msg+0xa0/0x130
 netlink_rcv_skb+0x14c/0x400
 ? genl_family_rcv_msg+0x600/0x600
 ? netlink_ack+0xd70/0xd70
 ? rwsem_optimistic_spin+0x4f0/0x4f0
 ? genl_rcv+0x14/0x40
 ? down_read_killable+0x580/0x580
 ? netlink_deliver_tap+0x13e/0x350
 ? __this_cpu_preempt_check+0x13/0x20
 genl_rcv+0x23/0x40
 netlink_unicast+0x45e/0x790
 ? netlink_attachskb+0x7f0/0x7f0
 netlink_sendmsg+0x7eb/0xdb0
 ? netlink_unicast+0x790/0x790
 ? __this_cpu_preempt_check+0x13/0x20
 ? selinux_socket_sendmsg+0x31/0x40
 ? netlink_unicast+0x790/0x790
 __sock_sendmsg+0xc9/0x160
 ____sys_sendmsg+0x620/0x990
 ? kernel_sendmsg+0x30/0x30
 ? __copy_msghdr+0x410/0x410
 ? __kasan_check_read+0x11/0x20
 ? mark_lock+0xe6/0x1470
 ___sys_sendmsg+0xe9/0x170
 ? copy_msghdr_from_user+0x120/0x120
 ? __lock_acquire+0xc62/0x1de0
 ? do_fault_around+0x2c6/0x4e0
 ? do_user_addr_fault+0x8c1/0xde0
 ? reacquire_held_locks+0x220/0x4d0
 ? do_user_addr_fault+0x8c1/0xde0
 ? __kasan_check_read+0x11/0x20
 ? __fdget+0x4e/0x1d0
 ? sockfd_lookup_light+0x1a/0x170
 __sys_sendmsg+0xd2/0x180
 ? __sys_sendmsg_sock+0x20/0x20
 ? reacquire_held_locks+0x4d0/0x4d0
 ? debug_smp_processor_id+0x17/0x20
 __x64_sys_sendmsg+0x72/0xb0
 ? lockdep_hardirqs_on+0x7d/0x100
 x64_sys_call+0x894/0x9f0
 do_syscall_64+0x64/0x130
 entry_SYSCALL_64_after_hwframe+0x4b/0x53
RIP: 0033:0x7f230fe04807
Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
RSP: 002b:00007ffe996a7ea8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000556f9f9c3390 RCX: 00007f230fe04807
RDX: 0000000000000000 RSI: 00007ffe996a7ee0 RDI: 0000000000000003
RBP: 0000556f9f9c88c0 R08: 0000000000000002 R09: 0000000000000000
R10: 0000556f965ca190 R11: 0000000000000246 R12: 0000556f9f9c8780
R13: 00007ffe996a7ee0 R14: 0000556f9f9c87d0 R15: 0000556f9f9c88c0
 </TASK>

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20241007165932.78081-2-kvalo@kernel.org
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Jan 17, 2025
[ Upstream commit 542ed81 ]

Access to genmask field in struct nft_set_ext results in unaligned
atomic read:

[   72.130109] Unable to handle kernel paging request at virtual address ffff0000c2bb708c
[   72.131036] Mem abort info:
[   72.131213]   ESR = 0x0000000096000021
[   72.131446]   EC = 0x25: DABT (current EL), IL = 32 bits
[   72.132209]   SET = 0, FnV = 0
[   72.133216]   EA = 0, S1PTW = 0
[   72.134080]   FSC = 0x21: alignment fault
[   72.135593] Data abort info:
[   72.137194]   ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000
[   72.142351]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[   72.145989]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[   72.150115] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000237d27000
[   72.154893] [ffff0000c2bb708c] pgd=0000000000000000, p4d=180000023ffff403, pud=180000023f84b403, pmd=180000023f835403,
+pte=0068000102bb7707
[   72.163021] Internal error: Oops: 0000000096000021 [#1] SMP
[...]
[   72.170041] CPU: 7 UID: 0 PID: 54 Comm: kworker/7:0 Tainted: G            E      6.13.0-rc3+ #2
[   72.170509] Tainted: [E]=UNSIGNED_MODULE
[   72.170720] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-stable202302-for-qemu 03/01/2023
[   72.171192] Workqueue: events_power_efficient nft_rhash_gc [nf_tables]
[   72.171552] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
[   72.171915] pc : nft_rhash_gc+0x200/0x2d8 [nf_tables]
[   72.172166] lr : nft_rhash_gc+0x128/0x2d8 [nf_tables]
[   72.172546] sp : ffff800081f2bce0
[   72.172724] x29: ffff800081f2bd40 x28: ffff0000c2bb708c x27: 0000000000000038
[   72.173078] x26: ffff0000c6780ef0 x25: ffff0000c643df00 x24: ffff0000c6778f78
[   72.173431] x23: 000000000000001a x22: ffff0000c4b1f000 x21: ffff0000c6780f78
[   72.173782] x20: ffff0000c2bb70dc x19: ffff0000c2bb7080 x18: 0000000000000000
[   72.174135] x17: ffff0000c0a4e1c0 x16: 0000000000003000 x15: 0000ac26d173b978
[   72.174485] x14: ffffffffffffffff x13: 0000000000000030 x12: ffff0000c6780ef0
[   72.174841] x11: 0000000000000000 x10: ffff800081f2bcf8 x9 : ffff0000c3000000
[   72.175193] x8 : 00000000000004be x7 : 0000000000000000 x6 : 0000000000000000
[   72.175544] x5 : 0000000000000040 x4 : ffff0000c3000010 x3 : 0000000000000000
[   72.175871] x2 : 0000000000003a98 x1 : ffff0000c2bb708c x0 : 0000000000000004
[   72.176207] Call trace:
[   72.176316]  nft_rhash_gc+0x200/0x2d8 [nf_tables] (P)
[   72.176653]  process_one_work+0x178/0x3d0
[   72.176831]  worker_thread+0x200/0x3f0
[   72.176995]  kthread+0xe8/0xf8
[   72.177130]  ret_from_fork+0x10/0x20
[   72.177289] Code: 54fff984 d503201f d2800080 91003261 (f820303f)
[   72.177557] ---[ end trace 0000000000000000 ]---

Align struct nft_set_ext to word size to address this and
documentation it.

pahole reports that this increases the size of elements for rhash and
pipapo in 8 bytes on x86_64.

Fixes: 7ffc748 ("netfilter: nft_set_hash: skip duplicated elements pending gc run")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Jan 17, 2025
[ Upstream commit 4d94f05 ]

This reworks hci_cb_list to not use mutex hci_cb_list_lock to avoid bugs
like the bellow:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5070, name: kworker/u9:2
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
4 locks held by kworker/u9:2/5070:
 #0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
 #0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x1770 kernel/workqueue.c:3335
 #1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
 #1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x1770 kernel/workqueue.c:3335
 #2: ffff8880665d0078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xcf/0xae0 net/bluetooth/hci_event.c:6914
 #3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:298 [inline]
 #3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:750 [inline]
 #3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: hci_le_create_big_complete_evt+0xdb/0xae0 net/bluetooth/hci_event.c:6915
CPU: 0 PID: 5070 Comm: kworker/u9:2 Not tainted 6.8.0-syzkaller-08073-g480e035fc4c7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: hci0 hci_rx_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 __might_resched+0x5d4/0x780 kernel/sched/core.c:10187
 __mutex_lock_common kernel/locking/mutex.c:585 [inline]
 __mutex_lock+0xc1/0xd70 kernel/locking/mutex.c:752
 hci_connect_cfm include/net/bluetooth/hci_core.h:2004 [inline]
 hci_le_create_big_complete_evt+0x3d9/0xae0 net/bluetooth/hci_event.c:6939
 hci_event_func net/bluetooth/hci_event.c:7514 [inline]
 hci_event_packet+0xa53/0x1540 net/bluetooth/hci_event.c:7569
 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4171
 process_one_work kernel/workqueue.c:3254 [inline]
 process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
 kthread+0x2f0/0x390 kernel/kthread.c:388
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
 </TASK>

Reported-by: syzbot+2fb0835e0c9cefc34614@syzkaller.appspotmail.com
Tested-by: syzbot+2fb0835e0c9cefc34614@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2fb0835e0c9cefc34614
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
qaz6750 pushed a commit that referenced this pull request Jan 17, 2025
…le_direct_reclaim()

commit 6aaced5 upstream.

The task sometimes continues looping in throttle_direct_reclaim() because
allow_direct_reclaim(pgdat) keeps returning false.

 #0 [ffff80002cb6f8d0] __switch_to at ffff8000080095ac
 #1 [ffff80002cb6f900] __schedule at ffff800008abbd1c
 #2 [ffff80002cb6f990] schedule at ffff800008abc50c
 #3 [ffff80002cb6f9b0] throttle_direct_reclaim at ffff800008273550
 #4 [ffff80002cb6fa20] try_to_free_pages at ffff800008277b68
 #5 [ffff80002cb6fae0] __alloc_pages_nodemask at ffff8000082c4660
 #6 [ffff80002cb6fc50] alloc_pages_vma at ffff8000082e4a98
 #7 [ffff80002cb6fca0] do_anonymous_page at ffff80000829f5a8
 #8 [ffff80002cb6fce0] __handle_mm_fault at ffff8000082a5974
 gregkh#9 [ffff80002cb6fd90] handle_mm_fault at ffff8000082a5bd4

At this point, the pgdat contains the following two zones:

        NODE: 4  ZONE: 0  ADDR: ffff00817fffe540  NAME: "DMA32"
          SIZE: 20480  MIN/LOW/HIGH: 11/28/45
          VM_STAT:
                NR_FREE_PAGES: 359
        NR_ZONE_INACTIVE_ANON: 18813
          NR_ZONE_ACTIVE_ANON: 0
        NR_ZONE_INACTIVE_FILE: 50
          NR_ZONE_ACTIVE_FILE: 0
          NR_ZONE_UNEVICTABLE: 0
        NR_ZONE_WRITE_PENDING: 0
                     NR_MLOCK: 0
                    NR_BOUNCE: 0
                   NR_ZSPAGES: 0
            NR_FREE_CMA_PAGES: 0

        NODE: 4  ZONE: 1  ADDR: ffff00817fffec00  NAME: "Normal"
          SIZE: 8454144  PRESENT: 98304  MIN/LOW/HIGH: 68/166/264
          VM_STAT:
                NR_FREE_PAGES: 146
        NR_ZONE_INACTIVE_ANON: 94668
          NR_ZONE_ACTIVE_ANON: 3
        NR_ZONE_INACTIVE_FILE: 735
          NR_ZONE_ACTIVE_FILE: 78
          NR_ZONE_UNEVICTABLE: 0
        NR_ZONE_WRITE_PENDING: 0
                     NR_MLOCK: 0
                    NR_BOUNCE: 0
                   NR_ZSPAGES: 0
            NR_FREE_CMA_PAGES: 0

In allow_direct_reclaim(), while processing ZONE_DMA32, the sum of
inactive/active file-backed pages calculated in zone_reclaimable_pages()
based on the result of zone_page_state_snapshot() is zero.

Additionally, since this system lacks swap, the calculation of inactive/
active anonymous pages is skipped.

        crash> p nr_swap_pages
        nr_swap_pages = $1937 = {
          counter = 0
        }

As a result, ZONE_DMA32 is deemed unreclaimable and skipped, moving on to
the processing of the next zone, ZONE_NORMAL, despite ZONE_DMA32 having
free pages significantly exceeding the high watermark.

The problem is that the pgdat->kswapd_failures hasn't been incremented.

        crash> px ((struct pglist_data *) 0xffff00817fffe540)->kswapd_failures
        $1935 = 0x0

This is because the node deemed balanced.  The node balancing logic in
balance_pgdat() evaluates all zones collectively.  If one or more zones
(e.g., ZONE_DMA32) have enough free pages to meet their watermarks, the
entire node is deemed balanced.  This causes balance_pgdat() to exit early
before incrementing the kswapd_failures, as it considers the overall
memory state acceptable, even though some zones (like ZONE_NORMAL) remain
under significant pressure.


The patch ensures that zone_reclaimable_pages() includes free pages
(NR_FREE_PAGES) in its calculation when no other reclaimable pages are
available (e.g., file-backed or anonymous pages).  This change prevents
zones like ZONE_DMA32, which have sufficient free pages, from being
mistakenly deemed unreclaimable.  By doing so, the patch ensures proper
node balancing, avoids masking pressure on other zones like ZONE_NORMAL,
and prevents infinite loops in throttle_direct_reclaim() caused by
allow_direct_reclaim(pgdat) repeatedly returning false.


The kernel hangs due to a task stuck in throttle_direct_reclaim(), caused
by a node being incorrectly deemed balanced despite pressure in certain
zones, such as ZONE_NORMAL.  This issue arises from
zone_reclaimable_pages() returning 0 for zones without reclaimable file-
backed or anonymous pages, causing zones like ZONE_DMA32 with sufficient
free pages to be skipped.

The lack of swap or reclaimable pages results in ZONE_DMA32 being ignored
during reclaim, masking pressure in other zones.  Consequently,
pgdat->kswapd_failures remains 0 in balance_pgdat(), preventing fallback
mechanisms in allow_direct_reclaim() from being triggered, leading to an
infinite loop in throttle_direct_reclaim().

This patch modifies zone_reclaimable_pages() to account for free pages
(NR_FREE_PAGES) when no other reclaimable pages exist.  This ensures zones
with sufficient free pages are not skipped, enabling proper balancing and
reclaim behavior.

[akpm@linux-foundation.org: coding-style cleanups]
Link: https://lkml.kernel.org/r/20241130164346.436469-1-snishika@redhat.com
Link: https://lkml.kernel.org/r/20241130161236.433747-2-snishika@redhat.com
Fixes: 5a1c84b ("mm: remove reclaim and compaction retry approximations")
Signed-off-by: Seiji Nishikawa <snishika@redhat.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.