Skip to content

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Mar 23, 2025

finish #677 ,because of github bug.

arndb and others added 30 commits March 23, 2025 19:37
[ Upstream commit 9de7695 ]

When both of X86_LOCAL_APIC and X86_THERMAL_VECTOR are disabled,
the irq tracing produces a W=1 build warning for the tracing
definitions:

  In file included from include/trace/trace_events.h:27,
                 from include/trace/define_trace.h:113,
                 from arch/x86/include/asm/trace/irq_vectors.h:383,
                 from arch/x86/kernel/irq.c:29:
  include/trace/stages/init.h:2:23: error: 'str__irq_vectors__trace_system_name' defined but not used [-Werror=unused-const-variable=]

Make the tracepoints conditional on the same symbosl that guard
their usage.

Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit bb41ef3)
[ Upstream commit db75a16 ]

Recently, some fallback have been initiated, while the connection was
not supposed to fallback.

Add a safety check with a warning to detect when an wrong attempt to
fallback is being done. This should help detecting any future issues
quicker.

Acked-by: Paolo Abeni <[email protected]>
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 47f4272)
[ Upstream commit 01f1d77 ]

Keep user-forced connector status even if it cannot be programmed. Same
behavior as for the rest of the drivers.

Signed-off-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Lyude Paul <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit deb9982)
[ Upstream commit 77e4514 ]

napi_schedule() is expected to be called either:

* From an interrupt, where raised softirqs are handled on IRQ exit

* From a softirq disabled section, where raised softirqs are handled on
  the next call to local_bh_enable().

* From a softirq handler, where raised softirqs are handled on the next
  round in do_softirq(), or further deferred to a dedicated kthread.

Other bare tasks context may end up ignoring the raised NET_RX vector
until the next random softirq handling opportunity, which may not
happen before a while if the CPU goes idle afterwards with the tick
stopped.

Such "misuses" have been detected on several places thanks to messages
of the kind:

	"NOHZ tick-stop error: local softirq work is pending, handler deepin-community#8!!!"

For example:

       __raise_softirq_irqoff
        __napi_schedule
        rtl8152_runtime_resume.isra.0
        rtl8152_resume
        usb_resume_interface.isra.0
        usb_resume_both
        __rpm_callback
        rpm_callback
        rpm_resume
        __pm_runtime_resume
        usb_autoresume_device
        usb_remote_wakeup
        hub_event
        process_one_work
        worker_thread
        kthread
        ret_from_fork
        ret_from_fork_asm

And also:

* drivers/net/usb/r8152.c::rtl_work_func_t
* drivers/net/netdevsim/netdev.c::nsim_start_xmit

There is a long history of issues of this kind:

	019edd0 ("ath10k: sdio: Add missing BH locking around napi_schdule()")
	3300685 ("idpf: disable local BH when scheduling napi for marker packets")
	e3d5d70 ("net: lan78xx: fix "softirq work is pending" error")
	e55c27e ("mt76: mt7615: add missing bh-disable around rx napi schedule")
	c0182aa ("mt76: mt7915: add missing bh-disable around tx napi enable/schedule")
	970be1d ("mt76: disable BH around napi_schedule() calls")
	019edd0 ("ath10k: sdio: Add missing BH locking around napi_schdule()")
	30bfec4 ("can: rx-offload: can_rx_offload_threaded_irq_finish(): add new  function to be called from threaded interrupt")
	e63052a ("mlx5e: add add missing BH locking around napi_schdule()")
	83a0c6e ("i40e: Invoke softirqs after napi_reschedule")
	bd4ce94 ("mlx4: Invoke softirqs after napi_reschedule")
	8cf699e ("mlx4: do not call napi_schedule() without care")
	ec13ee8 ("virtio_net: invoke softirqs after __napi_schedule")

This shows that relying on the caller to arrange a proper context for
the softirqs to be handled while calling napi_schedule() is very fragile
and error prone. Also fixing them can also prove challenging if the
caller may be called from different kinds of contexts.

Therefore fix this from napi_schedule() itself with waking up ksoftirqd
when softirqs are raised from task contexts.

Reported-by: Paul Menzel <[email protected]>
Reported-by: Jakub Kicinski <[email protected]>
Reported-by: Francois Romieu <[email protected]>
Closes: https://lore.kernel.org/lkml/[email protected]/
Cc: Breno Leitao <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 474cebf)
Commit 62346c6 upstream.

An identical one exists for vm_insert_page(), add one for
vm_insert_pages() to avoid needing to check for CONFIG_MMU in code using
it.

Acked-by: Johannes Weiner <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit b6690a4)
Commit 3ab1db3 upstream.

Rather than use remap_pfn_range() for this and manually free later,
switch to using vm_insert_pages() and have it Just Work.

If possible, allocate a single compound page that covers the range that
is needed. If that works, then we can just use page_address() on that
page. If we fail to get a compound page, allocate single pages and use
vmap() to map them into the kernel virtual address space.

This just covers the rings/sqes, the other remaining user of the mmap
remap_pfn_range() user will be converted separately. Once that is done,
we can kill the old alloc/free code.

Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 2905c4f)
Commit 06fe9b1 upstream.

If IORING_FEAT_SINGLE_MMAP is ignored, as can happen if an application
uses an ancient liburing or does setup manually, then 3 mmap's are
required to map the ring into userspace. The kernel will still have
collapsed the mappings, however userspace may ask for mapping them
individually. If so, then we should not use the full number of ring
pages, as it may exceed the partial mapping. Doing so will yield an
-EFAULT from vm_insert_pages(), as we pass in more pages than what the
application asked for.

Cap the number of pages to match what the application asked for, for
the particular mapping operation.

Reported-by: Lucas Mülling <[email protected]>
Link: axboe/liburing#1157
Fixes: 3ab1db3 ("io_uring: get rid of remap_pfn_range() for mapping rings/sqes")
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit a0b21f2)
Commit 43eef70 upstream.

io_pages_unmap() is a bit tricky in trying to figure whether the pages
were previously vmap'ed or not. In particular If there is juts one page
it belives there is no need to vunmap. Paired io_pages_map(), however,
could've failed io_mem_alloc_compound() and attempted to
io_mem_alloc_single(), which does vmap, and that leads to unpaired vmap.

The solution is to fail if io_mem_alloc_compound() can't allocate a
single page. That's the easiest way to deal with it, and those two
functions are getting removed soon, so no need to overcomplicate it.

Cc: [email protected]
Fixes: 3ab1db3 ("io_uring: get rid of remap_pfn_range() for mapping rings/sqes")
Signed-off-by: Pavel Begunkov <[email protected]>
Link: https://lore.kernel.org/r/477e75a3907a2fe83249e49c0a92cd480b2c60e0.1732569842.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit b89f95b)
Commit 09fc75e upstream.

This is the last holdout which does odd page checking, convert it to
vmap just like what is done for the non-mmap path.

Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 719e745)
Commit 1943f96 upstream.

Move it into io_uring.c where it belongs, and use it in there as well
rather than have two implementations of this.

Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 6168ec8)
Commit e270bfd upstream.

This avoids needing to care about HIGHMEM, and it makes the buffer
indexing easier as both ring provided buffer methods are now virtually
mapped in a contigious fashion.

Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit af8f27e)
Commit 87585b0 upstream.

Rather than use remap_pfn_range() for this and manually free later,
switch to using vm_insert_page() and have it Just Work.

This requires a bit of effort on the mmap lookup side, as the ctx
uring_lock isn't held, which  otherwise protects buffer_lists from being
torn down, and it's not safe to grab from mmap context that would
introduce an ABBA deadlock between the mmap lock and the ctx uring_lock.
Instead, lookup the buffer_list under RCU, as the the list is RCU freed
already. Use the existing reference count to determine whether it's
possible to safely grab a reference to it (eg if it's not zero already),
and drop that reference when done with the mapping. If the mmap
reference is the last one, the buffer_list and the associated memory can
go away, since the vma insertion has references to the inserted pages at
that point.

Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 46b1b3d)
Commit 18595c0 upstream.

There are a few cases of open-rolled loops around unpin_user_page(), use
the generic helper instead.

Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 1fdb9c9)
Commit bcc87d9 upstream.

Syz reports a problem, which boils down to NULL vs IS_ERR inconsistent
error handling in io_alloc_pbuf_ring().

KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:__io_remove_buffers+0xac/0x700 io_uring/kbuf.c:341
Call Trace:
 <TASK>
 io_put_bl io_uring/kbuf.c:378 [inline]
 io_destroy_buffers+0x14e/0x490 io_uring/kbuf.c:392
 io_ring_ctx_free+0xa00/0x1070 io_uring/io_uring.c:2613
 io_ring_exit_work+0x80f/0x8a0 io_uring/io_uring.c:2844
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390
 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

Cc: [email protected]
Reported-by: [email protected]
Fixes: 87585b0 ("io_uring/kbuf: use vm_insert_pages() for mmap'ed pbuf ring")
Signed-off-by: Pavel Begunkov <[email protected]>
Link: https://lore.kernel.org/r/c5f9df20560bd9830401e8e48abc029e7cfd9f5e.1721329239.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 78aefac)
commit c9ccb88 upstream.

commit 767d833 ("Input: ads7846 - Convert to use software nodes")

has simplified the code but accidentially converted a devm_gpiod_get()
to gpiod_get(). This leaves the gpio reserved on module remove and the
driver can no longer be loaded again.

Fixes: 767d833 ("Input: ads7846 - Convert to use software nodes")
Cc: [email protected]
Signed-off-by: H. Nikolaus Schaller <[email protected]>
Link: https://lore.kernel.org/r/6e9b143f19cdfda835711a8a7a3966e5a2494cff.1738410204.git.hns@goldelico.com
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit cbd68fc)
commit a2add51 upstream.

Some register groups reserve a byte at the end of their continuous
address space. Depending on the variant of silicon, this field may
share the same memory space as the lower byte of the system status
register (0x10).

In these cases, caching the reserved byte and writing it later may
effectively reset the device depending on what happened in between
the read and write operations.

Solve this problem by avoiding any access to this last byte within
offending register groups. This method replaces a workaround which
attempted to write the reserved byte with up-to-date contents, but
left a small window in which updates by the device could have been
clobbered.

Now that the driver does not touch these reserved bytes, the order
in which the device's registers are written no longer matters, and
they can be written in their natural order. The new method is also
much more generic, and can be more easily extended to new variants
of silicon with different register maps.

As part of this change, the register read and write functions must
be gently updated to support byte access instead of word access.

Fixes: 2e70ef5 ("Input: iqs7222 - acknowledge reset before writing registers")
Signed-off-by: Jeff LaBundy <[email protected]>
Link: https://lore.kernel.org/r/Z85Alw+d9EHKXx2e@nixie71
Cc: [email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 0b5b651)
…trollers

commit 36e093c upstream.

Add 8BitDo SN30 Pro, Hyperkin X91 and Gamesir G7 SE to the list of
recognized controllers, and update vendor comments to match.

Signed-off-by: Nilton Perim Neto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Cc: [email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 5184e44)
commit 3492321 upstream.

This is based on multiple commits at https://github.com/paroj/xpad
that had bouncing email addresses and were not signed off.

Signed-off-by: Pavel Rojtberg <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Cc: [email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 8cf88f3)
commit 709329c upstream.

ZOTAC Gaming Zone is ZOTAC's 2024 handheld release. As it is common
with these handhelds, it uses a hybrid USB device with an xpad
endpoint, a keyboard endpoint, and a vendor-specific endpoint for
RGB control et al.

Signed-off-by: Antheas Kapenekakis <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Cc: [email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit dc9839d)
commit 95a54a9 upstream.

TECNO Pocket Go is a kickstarter handheld by manufacturer TECNO Mobile.
It poses a unique feature: it does not have a display. Instead, the
handheld is essentially a pc in a controller. As customary, it has an
xpad endpoint, a keyboard endpoint, and a vendor endpoint for its
vendor software.

Signed-off-by: Antheas Kapenekakis <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Cc: [email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 0c4484c)
commit 659a761 upstream.

The QH controller is actually the controller of the Legion Go S, with
the manufacturer string wch.cn and product name Legion Go S in its
USB descriptor. A cursory lookup of the VID reveals the same.

Therefore, rename the xpad entries to match.

Signed-off-by: Antheas Kapenekakis <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Cc: [email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit d639d55)
commit 729d163 upstream.

Some older Clevo barebones have problems like no or laggy keyboard after
resume or boot which can be fixed with the SERIO_QUIRK_FORCENORESTORE
quirk.

With the old i8042 quirks this devices keyboard is sometimes laggy after
resume. With the new quirk this issue doesn't happen.

Cc: [email protected]
Signed-off-by: Werner Sembach <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 105a211)
commit 9ed468e upstream.

Some older Clevo barebones have problems like no or laggy keyboard after
resume or boot which can be fixed with the SERIO_QUIRK_FORCENORESTORE
quirk.

The PB71RD keyboard is sometimes laggy after resume and the PC70DR, PB51RF,
P640RE, and PCX0DX_GN20 keyboard is sometimes unresponsive after resume.
This quirk fixes that.

Cc: [email protected]
Signed-off-by: Werner Sembach <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit e690d0c)
…devices

commit 75ee4eb upstream.

Some older Clevo barebones have problems like no or laggy keyboard after
resume or boot which can be fixed with the SERIO_QUIRK_FORCENORESTORE
quirk.

While the old quirk combination did not show negative effects on these
devices specifically, the new quirk works just as well and seems more
stable in general.

Cc: [email protected]
Signed-off-by: Werner Sembach <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit e7c95c0)
…ices

commit d85862c upstream.

Some older Clevo barebones have problems like no or laggy keyboard after
resume or boot which can be fixed with the SERIO_QUIRK_FORCENORESTORE
quirk.

We could not activly retest these devices because we no longer have them in
our archive, but based on the other old Clevo barebones we tested where the
new quirk had the same or a better behaviour I think it would be good to
apply it on these too.

Cc: [email protected]
Signed-off-by: Werner Sembach <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 392e9b2)
commit 18e0885 upstream.

The Altera USB Blaster 3, available as both a cable and an on-board
solution, is primarily used for programming and debugging FPGAs.

It interfaces with host software such as Quartus Programmer,
System Console, SignalTap, and Nios Debugger. The device utilizes
either an FT2232 or FT4232 chip.

Enabling the support for various configurations of the on-board
USB Blaster 3 by including the appropriate VID/PID pairs,
allowing it to function as a serial device via ftdi_sio.

Note that this check-in does not include support for the
cable solution, as it does not support UART functionality.
The supported configurations are determined by the
hardware design and include:

1) PID 0x6022, FT2232, 1 JTAG port (Port A) + Port B as UART
2) PID 0x6025, FT4232, 1 JTAG port (Port A) + Port C as UART
3) PID 0x6026, FT4232, 1 JTAG port (Port A) + Port C, D as UART
4) PID 0x6029, FT4232, 1 JTAG port (Port B) + Port C as UART
5) PID 0x602a, FT4232, 1 JTAG port (Port B) + Port C, D as UART
6) PID 0x602c, FT4232, 1 JTAG port (Port A) + Port B as UART
7) PID 0x602d, FT4232, 1 JTAG port (Port A) + Port B, C as UART
8) PID 0x602e, FT4232, 1 JTAG port (Port A) + Port B, C, D as UART

These configurations allow for flexibility in how the USB Blaster 3 is
used, depending on the specific needs of the hardware design.

Signed-off-by: Boon Khai Ng <[email protected]>
Cc: [email protected]
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 528ac20)
commit 4981bb5 upstream.

Add the following Telit Cinterion FE990B40 compositions:

0x10b0: rmnet + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
        tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  7 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bc7 ProdID=10b0 Rev=05.15
S:  Manufacturer=Telit Cinterion
S:  Product=FE990
S:  SerialNumber=28c2595e
C:  #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
I:  If#= 1 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#= 2 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#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

0x10b1: MBIM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
        tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bc7 ProdID=10b1 Rev=05.15
S:  Manufacturer=Telit Cinterion
S:  Product=FE990
S:  SerialNumber=28c2595e
C:  #Ifs=10 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= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

0x10b2: RNDIS + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
        tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  9 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bc7 ProdID=10b2 Rev=05.15
S:  Manufacturer=Telit Cinterion
S:  Product=FE990
S:  SerialNumber=28c2595e
C:  #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
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= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

0x10b3: ECM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
        tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 11 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bc7 ProdID=10b3 Rev=05.15
S:  Manufacturer=Telit Cinterion
S:  Product=FE990
S:  SerialNumber=28c2595e
C:  #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
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= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Cc: [email protected]
Signed-off-by: Fabio Porcedda <[email protected]>
Reviewed-by: Daniele Palmas <[email protected]>
[ johan: use USB_DEVICE_AND_INTERFACE_INFO() and sort by protocol ]
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit e1bfbf0)
commit 6232f0d upstream.

The correct name for FE990 is FE990A so use it in order to avoid
confusion with FE990B.

Cc: [email protected]
Signed-off-by: Fabio Porcedda <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 61e5400)
commit 9a665fe upstream.

The device id entries for Telit FN990B ended up matching only on the
interface protocol. While this works, the protocol is qualified by the
interface class (and subclass) which should have been included.

Switch to matching using USB_DEVICE_AND_INTERFACE_INFO() while keeping
the entries sorted also by protocol for consistency.

Link: https://lore.kernel.org/[email protected]/
Cc: Fabio Porcedda <[email protected]>
Cc: Daniele Palmas <[email protected]>
Cc: [email protected]
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit ab0f6e7)
commit e3e8917 upstream.

Currently, load_microcode_amd() iterates over all NUMA nodes, retrieves their
CPU masks and unconditionally accesses per-CPU data for the first CPU of each
mask.

According to Documentation/admin-guide/mm/numaperf.rst:

  "Some memory may share the same node as a CPU, and others are provided as
  memory only nodes."

Therefore, some node CPU masks may be empty and wouldn't have a "first CPU".

On a machine with far memory (and therefore CPU-less NUMA nodes):
- cpumask_of_node(nid) is 0
- cpumask_first(0) is CONFIG_NR_CPUS
- cpu_data(CONFIG_NR_CPUS) accesses the cpu_info per-CPU array at an
  index that is 1 out of bounds

This does not have any security implications since flashing microcode is
a privileged operation but I believe this has reliability implications by
potentially corrupting memory while flashing a microcode update.

When booting with CONFIG_UBSAN_BOUNDS=y on an AMD machine that flashes
a microcode update. I get the following splat:

  UBSAN: array-index-out-of-bounds in arch/x86/kernel/cpu/microcode/amd.c:X:Y
  index 512 is out of range for type 'unsigned long[512]'
  [...]
  Call Trace:
   dump_stack
   __ubsan_handle_out_of_bounds
   load_microcode_amd
   request_microcode_amd
   reload_store
   kernfs_fop_write_iter
   vfs_write
   ksys_write
   do_syscall_64
   entry_SYSCALL_64_after_hwframe

Change the loop to go over only NUMA nodes which have CPUs before determining
whether the first CPU on the respective node needs microcode update.

  [ bp: Massage commit message, fix typo. ]

Fixes: 7ff6edf ("x86/microcode/AMD: Fix mixed steppings support")
Signed-off-by: Florent Revest <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit e686349)
albankurti and others added 27 commits March 23, 2025 19:37
[ Upstream commit 6933c10 ]

Several pr_info! calls in rust/kernel/init.rs (both in code examples
and macro documentation) were missing a newline, causing logs to
run together. This commit updates these calls to include a trailing
newline, improving readability and consistency with the C side.

Fixes: 6841d45 ("rust: init: add `stack_pin_init!` macro")
Fixes: 7f8977a ("rust: init: add `{pin_}chain` functions to `{Pin}Init<T, E>`")
Fixes: d0fdc39 ("rust: init: add `PinnedDrop` trait and macros")
Fixes: 4af84c6 ("rust: init: update expanded macro explanation")
Reported-by: Miguel Ojeda <[email protected]>
Link: Rust-for-Linux/linux#1139
Signed-off-by: Alban Kurti <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Replaced Closes with Link since it fixes part of the issue. Added
  one more Fixes tag (still same set of stable kernels). - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 2592a62)
[ Upstream commit 247fba1 ]

SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT722_SDCA_ENT_FU15,
RT722_SDCA_CTL_FU_CH_GAIN, CH_01) ... SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
RT722_SDCA_ENT_FU15, RT722_SDCA_CTL_FU_CH_GAIN, CH_04) are used by the
"FU15 Boost Volume" control, but not marked as readable.
And the mbq size are 2 for those registers.

Fixes: 7f5d603 ("ASoC: rt722-sdca: Add RT722 SDCA driver")
Signed-off-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Shuming Fan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 69a9004)
[ Upstream commit ed92bc5 ]

Free some resources in the error handling path of the probe, as already
done in the remove function.

Fixes: e3523e0 ("ASoC: wm0010: Add initial wm0010 DSP driver")
Fixes: fd8b965 ("ASoC: wm0010: Clear IRQ as wake source and include missing header")
Signed-off-by: Christophe JAILLET <[email protected]>
Reviewed-by: Charles Keepax <[email protected]>
Link: https://patch.msgid.link/5139ba1ab8c4c157ce04e56096a0f54a1683195c.1741549792.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit a702594)
[ Upstream commit 2e0f91a ]

The macros crate has depended on std and proc_macro since its
introduction in commit 1fbde52 ("rust: add `macros` crate"). These
dependencies were omitted from commit 8c4555c ("scripts: add
`generate_rust_analyzer.py`") resulting in missing go-to-definition and
autocomplete, and false-positive warnings emitted from rust-analyzer
such as:

  [{
  	"resource": "/Users/tamird/src/linux/rust/macros/module.rs",
  	"owner": "_generated_diagnostic_collection_name_#1",
  	"code": {
  		"value": "non_snake_case",
  		"target": {
  			"$mid": 1,
  			"path": "/rustc/",
  			"scheme": "https",
  			"authority": "doc.rust-lang.org",
  			"query": "search=non_snake_case"
  		}
  	},
  	"severity": 4,
  	"message": "Variable `None` should have snake_case name, e.g. `none`",
  	"source": "rust-analyzer",
  	"startLineNumber": 123,
  	"startColumn": 17,
  	"endLineNumber": 123,
  	"endColumn": 21
  }]

Add the missing dependencies to improve the developer experience.

  [ Fiona had a different approach (thanks!) at:

        https://lore.kernel.org/rust-for-linux/[email protected]/

    But Tamir and Fiona agreed to this one. - Miguel ]

Fixes: 8c4555c ("scripts: add `generate_rust_analyzer.py`")
Reviewed-by: Fiona Behrens <[email protected]>
Diagnosed-by: Chayim Refael Friedman <[email protected]>
Link: rust-lang/rust-analyzer#17759 (comment)
Signed-off-by: Tamir Duberstein <[email protected]>
Tested-by: Andreas Hindborg <[email protected]>
Link: https://lore.kernel.org/r/20250210-rust-analyzer-macros-core-dep-v3-1-45eb4836f218@gmail.com
[ Removed `return`. Changed tag name. Added Link. Slightly
  reworded. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit d3f9fdc)
[ Upstream commit 7489161 ]

User-provided mount parameter acregmax of type u32 is intended to have
an upper limit, but before it is validated, the value is converted from
seconds to jiffies which can lead to an integer overflow.

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

Fixes: 5780464 ("cifs: Add new parameter "acregmax" for distinct file and directory metadata timeout")
Signed-off-by: Murad Masimov <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 0252c33)
[ Upstream commit 5b29891 ]

User-provided mount parameter acdirmax of type u32 is intended to have
an upper limit, but before it is validated, the value is converted from
seconds to jiffies which can lead to an integer overflow.

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

Fixes: 4c9f948 ("cifs: Add new mount parameter "acdirmax" to allow caching directory metadata")
Signed-off-by: Murad Masimov <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 9e438d0)
[ Upstream commit 64f690e ]

User-provided mount parameter actimeo of type u32 is intended to have
an upper limit, but before it is validated, the value is converted from
seconds to jiffies which can lead to an integer overflow.

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

Fixes: 6d20e84 ("cifs: add attribute cache timeout (actimeo) tunable")
Signed-off-by: Murad Masimov <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit d5fff81)
[ Upstream commit d5a30fd ]

User-provided mount parameter closetimeo of type u32 is intended to have
an upper limit, but before it is validated, the value is converted from
seconds to jiffies which can lead to an integer overflow.

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

Fixes: 5efdd91 ("smb3: allow deferred close timeout to be configurable")
Signed-off-by: Murad Masimov <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 6c13fcb)
[ Upstream commit 1f48660 ]

WSL socket, fifo, char and block devices have empty reparse buffer.
Validate the length of the reparse buffer.

Signed-off-by: Pali Rohár <[email protected]>
Signed-off-by: Steve French <[email protected]>
Stable-dep-of: cad3fc0 ("cifs: Throw -EOPNOTSUPP error on unsupported reparse point type from parse_reparse_point()")
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 474c087)
…parse_reparse_point()

[ Upstream commit cad3fc0 ]

This would help to track and detect by caller if the reparse point type was
processed or not.

Signed-off-by: Pali Rohár <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 10cbae8)
[ Upstream commit 9b5463f ]

If i2c_add_adapter() fails, the request_region() call in ali1535_setup()
must be undone by a corresponding release_region() call, as done in the
remove function.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://lore.kernel.org/r/0daf63d7a2ce74c02e2664ba805bbfadab7d25e5.1741031571.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit beb68cf)
[ Upstream commit 6e55caa ]

If i2c_add_adapter() fails, the request_region() call in ali15x3_setup()
must be undone by a corresponding release_region() call, as done in the
remove function.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Andi Shyti <[email protected]>
Link: https://lore.kernel.org/r/9b2090cbcc02659f425188ea05f2e02745c4e67b.1741031878.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 9e3bef1)
[ Upstream commit 2b22459 ]

If i2c_add_adapter() fails, the request_region() call in sis630_setup()
must be undone by a corresponding release_region() call, as done in the
remove function.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Christophe JAILLET <[email protected]>
Link: https://lore.kernel.org/r/3d607601f2c38e896b10207963c6ab499ca5c307.1741033587.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Andi Shyti <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 6653927)
[ Upstream commit 00371a3 ]

pcim_iomap_regions() should receive the driver's name as its third
parameter, not the PCI device's name.

Define the driver name with a macro and use it at the appropriate
places, including pcim_iomap_regions().

Cc: [email protected] # v5.14+
Fixes: 30bba69 ("stmmac: pci: Add dwmac support for Loongson")
Signed-off-by: Philipp Stanner <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Reviewed-by: Yanteng Si <[email protected]>
Tested-by: Henry Chen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 643607a)
Conflicts:
	drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
[Handle Context different]
[ Upstream commit eea5119 ]

There are now more servers which advertise support for IAKerb (passthrough
Kerberos authentication via proxy).  IAKerb is a public extension industry
standard Kerberos protocol that allows a client without line-of-sight
to a Domain Controller to authenticate. There can be cases where we
would fail to mount if the server only advertises the OID for IAKerb
in SPNEGO/GSSAPI.  Add code to allow us to still upcall to userspace
in these cases to obtain the Kerberos ticket.

Signed-off-by: Steve French <[email protected]>
Stable-dep-of: 605b249 ("smb: client: Fix match_session bug preventing session reuse")
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 7dc9abf)
[ Upstream commit 605b249 ]

Fix a bug in match_session() that can causes the session to not be
reused in some cases.

Reproduction steps:

mount.cifs //server/share /mnt/a -o credentials=creds
mount.cifs //server/share /mnt/b -o credentials=creds,sec=ntlmssp
cat /proc/fs/cifs/DebugData | grep SessionId | wc -l

mount.cifs //server/share /mnt/b -o credentials=creds,sec=ntlmssp
mount.cifs //server/share /mnt/a -o credentials=creds
cat /proc/fs/cifs/DebugData | grep SessionId | wc -l

Cc: [email protected]
Reviewed-by: Enzo Matsumiya <[email protected]>
Signed-off-by: Henrique Carvalho <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit fb0800c)
commit ab4eedb upstream.

This fixes the following trace by reworking the locking of l2cap_conn
so instead of only locking when changing the chan_l list this promotes
chan_lock to a general lock of l2cap_conn so whenever it is being held
it would prevents the likes of l2cap_conn_del to run:

list_del corruption, ffff888021297e00->prev is LIST_POISON2 (dead000000000122)
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:61!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 UID: 0 PID: 5896 Comm: syz-executor213 Not tainted 6.14.0-rc1-next-20250204-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
RIP: 0010:__list_del_entry_valid_or_report+0x12c/0x190 lib/list_debug.c:59
Code: 8c 4c 89 fe 48 89 da e8 32 8c 37 fc 90 0f 0b 48 89 df e8 27 9f 14 fd 48 c7 c7 a0 c0 60 8c 4c 89 fe 48 89 da e8 15 8c 37 fc 90 <0f> 0b 4c 89 e7 e8 0a 9f 14 fd 42 80 3c 2b 00 74 08 4c 89 e7 e8 cb
RSP: 0018:ffffc90003f6f998 EFLAGS: 00010246
RAX: 000000000000004e RBX: dead000000000122 RCX: 01454d423f7fbf00
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: dffffc0000000000 R08: ffffffff819f077c R09: 1ffff920007eded0
R10: dffffc0000000000 R11: fffff520007eded1 R12: dead000000000122
R13: dffffc0000000000 R14: ffff8880352248d8 R15: ffff888021297e00
FS:  00007f7ace6686c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7aceeeb1d0 CR3: 000000003527c000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __list_del_entry_valid include/linux/list.h:124 [inline]
 __list_del_entry include/linux/list.h:215 [inline]
 list_del_rcu include/linux/rculist.h:168 [inline]
 hci_chan_del+0x70/0x1b0 net/bluetooth/hci_conn.c:2858
 l2cap_conn_free net/bluetooth/l2cap_core.c:1816 [inline]
 kref_put include/linux/kref.h:65 [inline]
 l2cap_conn_put+0x70/0xe0 net/bluetooth/l2cap_core.c:1830
 l2cap_sock_shutdown+0xa8a/0x1020 net/bluetooth/l2cap_sock.c:1377
 l2cap_sock_release+0x79/0x1d0 net/bluetooth/l2cap_sock.c:1416
 __sock_release net/socket.c:642 [inline]
 sock_close+0xbc/0x240 net/socket.c:1393
 __fput+0x3e9/0x9f0 fs/file_table.c:448
 task_work_run+0x24f/0x310 kernel/task_work.c:227
 ptrace_notify+0x2d2/0x380 kernel/signal.c:2522
 ptrace_report_syscall include/linux/ptrace.h:415 [inline]
 ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
 syscall_exit_work+0xc7/0x1d0 kernel/entry/common.c:173
 syscall_exit_to_user_mode_prepare kernel/entry/common.c:200 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:205 [inline]
 syscall_exit_to_user_mode+0x24a/0x340 kernel/entry/common.c:218
 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7aceeaf449
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7ace668218 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: fffffffffffffffc RBX: 00007f7acef39328 RCX: 00007f7aceeaf449
RDX: 000000000000000e RSI: 0000000020000100 RDI: 0000000000000004
RBP: 00007f7acef39320 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
R13: 0000000000000004 R14: 00007f7ace668670 R15: 000000000000000b
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_del_entry_valid_or_report+0x12c/0x190 lib/list_debug.c:59
Code: 8c 4c 89 fe 48 89 da e8 32 8c 37 fc 90 0f 0b 48 89 df e8 27 9f 14 fd 48 c7 c7 a0 c0 60 8c 4c 89 fe 48 89 da e8 15 8c 37 fc 90 <0f> 0b 4c 89 e7 e8 0a 9f 14 fd 42 80 3c 2b 00 74 08 4c 89 e7 e8 cb
RSP: 0018:ffffc90003f6f998 EFLAGS: 00010246
RAX: 000000000000004e RBX: dead000000000122 RCX: 01454d423f7fbf00
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: dffffc0000000000 R08: ffffffff819f077c R09: 1ffff920007eded0
R10: dffffc0000000000 R11: fffff520007eded1 R12: dead000000000122
R13: dffffc0000000000 R14: ffff8880352248d8 R15: ffff888021297e00
FS:  00007f7ace6686c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7acef05b08 CR3: 000000003527c000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Reported-by: [email protected]
Tested-by: [email protected]
Fixes: b4f82f9 ("Bluetooth: L2CAP: Fix slab-use-after-free Read in l2cap_send_cmd")
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit efc3087)
commit f13409b upstream.

It's not possible to call nvme_state_ctrl_state with holding a spin
lock, because nvme_state_ctrl_state calls cancel_delayed_work_sync
when fastfail is enabled.

Instead syncing the ASSOC_FLAG and state transitions using a lock, it's
possible to only rely on the state machine transitions. That means
nvme_fc_ctrl_connectivity_loss should unconditionally call
nvme_reset_ctrl which avoids the read race on the ctrl state variable.
Actually, it's not necessary to test in which state the ctrl is, the
reset work will only scheduled when the state machine is in LIVE state.

In nvme_fc_create_association, the LIVE state can only be entered if it
was previously CONNECTING. If this is not possible then the reset
handler got triggered. Thus just error out here.

Fixes: ee59e38 ("nvme-fc: do not ignore connectivity loss during connecting")
Closes: https://lore.kernel.org/all/denqwui6sl5erqmz2gvrwueyxakl5txzbbiu3fgebryzrfxunm@iwxuthct377m/
Reported-by: Shinichiro Kawasaki <[email protected]>
Tested-by: Shin'ichiro Kawasaki <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Signed-off-by: Daniel Wagner <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit a09e085)
commit 221cea1 upstream.

Remove the fixup to make the Omoton KB066's F6 key F6 when not holding
Fn. That was really just a hack to allow typing F6 in fnmode>0, and it
didn't fix any of the other F keys that were likewise untypable in
fnmode>0. Instead, because the Omoton's Fn key is entirely internal to
the keyboard, completely disable Fn key translation when an Omoton is
detected, which will prevent the hid-apple driver from interfering with
the keyboard's built-in Fn key handling. All of the F keys, including
F6, are then typable when Fn is held.

The Omoton KB066 and the Apple A1255 both have HID product code
05ac:022c. The self-reported name of every original A1255 when they left
the factory was "Apple Wireless Keyboard". By default, Mac OS changes
the name to "<username>'s keyboard" when pairing with the keyboard, but
Mac OS allows the user to set the internal name of Apple keyboards to
anything they like. The Omoton KB066's name, on the other hand, is not
configurable: It is always "Bluetooth Keyboard". Because that name is so
generic that a user might conceivably use the same name for a real Apple
keyboard, detect Omoton keyboards based on both having that exact name
and having HID product code 022c.

Fixes: 819083c ("HID: apple: fix up the F6 key on the Omoton KB066 keyboard")
Signed-off-by: Alex Henrie <[email protected]>
Reviewed-by: Aditya Garg <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 6248573)
commit afb41b0 upstream.

In H2CTermReq, a FES with value 0x05 means "R2T Limit Exceeded"; but
in C2HTermReq the same value has a different meaning (Data Transfer Limit
Exceeded).

Fixes: 84e0090 ("nvme-tcp: add basic support for the C2HTermReq PDU")
Signed-off-by: Maurizio Lombardi <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 812080b)
commit 966944f upstream.

Currently, dynamically allocated LockCLassKeys can be used from the Rust
side without having them registered. This is a soundness issue, so
remove them.

Fixes: 6ea5aa0 ("rust: sync: introduce `LockClassKey`")
Suggested-by: Alice Ryhl <[email protected]>
Signed-off-by: Mitchell Levy <[email protected]>
Signed-off-by: Boqun Feng <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Boqun Feng <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 50b22a9)
commit 7395dfa upstream.

Add a timestamp field at the beginning of the transaction, store it
in the nftables per-netns area.

Update set backend .insert, .deactivate and sync gc path to use the
timestamp, this avoids that an element expires while control plane
transaction is still unfinished.

.lookup and .update, which are used from packet path, still use the
current time to check if the element has expired. And .get path and dump
also since this runs lockless under rcu read size lock. Then, there is
async gc which also needs to check the current time since it runs
asynchronously from a workqueue.

Fixes: c3e1b00 ("netfilter: nf_tables: add set element timeout support")
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Jianqi Ren <[email protected]>
Signed-off-by: He Zhe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 7fa2e29)
commit 3c13725 upstream.

All existing NFT_EXPR_STATEFUL provide a .clone interface, remove
fallback to copy content of stateful expression since this is never
exercised and bail out if .clone interface is not defined.

Stable-dep-of: fa23e0d ("netfilter: nf_tables: allow clone callbacks to sleep")
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit f6de68e)
commit fa23e0d upstream.

Sven Auhagen reports transaction failures with following error:
  ./main.nft:13:1-26: Error: Could not process rule: Cannot allocate memory
  percpu: allocation failed, size=16 align=8 atomic=1, atomic alloc failed, no space left

This points to failing pcpu allocation with GFP_ATOMIC flag.
However, transactions happen from user context and are allowed to sleep.

One case where we can call into percpu allocator with GFP_ATOMIC is
nft_counter expression.

Normally this happens from control plane, so this could use GFP_KERNEL
instead.  But one use case, element insertion from packet path,
needs to use GFP_ATOMIC allocations (nft_dynset expression).

At this time, .clone callbacks always use GFP_ATOMIC for this reason.

Add gfp_t argument to the .clone function and pass GFP_KERNEL or
GFP_ATOMIC flag depending on context, this allows all clone memory
allocations to sleep for the normal (transaction) case.

Cc: Sven Auhagen <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit a561c6a)
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 1998f70)
Link: https://lore.kernel.org/r/[email protected]
Tested-by: SeongJae Park <[email protected]>
Tested-by: Florian Fainelli <[email protected]>
Tested-by: Harshit Mogalapalli <[email protected]>
Tested-by: Jon Hunter <[email protected]>
Tested-by: Ron Economos <[email protected]>
Tested-by: Shuah Khan <[email protected]>
Tested-by: Hardik Garg <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Tested-by: Jon Hunter <[email protected]>
Tested-by: Florian Fainelli <[email protected]>
Tested-by: Peter Schneider <[email protected]>
Tested-by: Linux Kernel Functional Testing <[email protected]>
Tested-by: Mark Brown <[email protected]>
Tested-by: Hardik Garg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 594a1dd)
Link: https://lore.kernel.org/r/[email protected]
Tested-by: Jon Hunter <[email protected]>
Tested-by: Ron Economos <[email protected]>
Tested-by: Miguel Ojeda <[email protected]>
Tested-by: Mark Brown <[email protected]>
Tested-by: Hardik Garg <[email protected]>
Tested-by: Peter Schneider <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Tested-by: Florian Fainelli <[email protected]>
Tested-by: Harshit Mogalapalli <[email protected]>
Tested-by: Linux Kernel Functional Testing <[email protected]>
Tested-by: Frank Scheiner <[email protected]>
Tested-by: Jon Hunter <[email protected]>
Tested-by: Hardik Garg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 4b6a8fa)
@opsiff opsiff merged commit a116ac6 into deepin-community:linux-6.6.y Mar 23, 2025
5 of 6 checks passed
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 23, 2025

Reviewer's Guide by Sourcery

This pull request updates the kernel base to 6.6.84-part2. It includes several bug fixes and improvements across various subsystems, including io_uring, Bluetooth, i8042, NVMe-TCP, AMD display driver, iqs7222, USB serial, ksmbd, netfilter, and more. The most significant changes involve refactoring io_uring memory management, removing unnecessary locking in L2CAP, and improving security checks in remap_file_pages.

Sequence diagram for io_uring mmap

sequenceDiagram
  participant User
  participant io_uring_mmap
  participant io_uring_validate_mmap_request
  participant io_uring_mmap_pages
  participant vm_insert_pages

  User->>io_uring_mmap: mmap(offset, size)
  io_uring_mmap->>io_uring_validate_mmap_request: ptr = io_uring_validate_mmap_request(offset, size)
  alt IS_ERR(ptr)
    io_uring_mmap->>User: return PTR_ERR(ptr)
  else
    io_uring_mmap->>io_uring_mmap_pages: io_uring_mmap_pages(ctx, vma, pages, npages)
    io_uring_mmap_pages->>vm_insert_pages: vm_insert_pages(vma, vma->vm_start, pages, nr_pages)
    vm_insert_pages-->>io_uring_mmap_pages: return
    io_uring_mmap_pages-->>io_uring_mmap: return
  end
  io_uring_mmap-->>User: return
Loading

File-Level Changes

Change Details Files
Refactors io_uring memory management to use pages instead of folios, improving flexibility and potentially performance.
  • Replaces folio_put with io_pages_unmap for freeing memory.
  • Introduces io_pin_pages to pin user pages.
  • Uses vmap to map pages into kernel space.
  • Removes io_mem_free and io_mem_alloc and introduces io_pages_map.
  • Updates io_rings_free to unmap pages correctly.
  • Modifies io_uring_validate_mmap_request to return the mapped address directly.
  • Updates io_uring_mmap to use io_uring_mmap_pages for mapping.
  • Updates io_allocate_scq_urings to use io_pages_map.
  • Removes io_kbuf_mmap_list_free.
io_uring/io_uring.c
io_uring/kbuf.c
io_uring/rsrc.c
io_uring/io_uring.h
Removes unnecessary locking in L2CAP channel management, improving performance.
  • Removes mutex_lock and mutex_unlock calls around __l2cap_get_chan_by_scid and __l2cap_get_chan_by_dcid.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_conn_update_id_addr.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_conn_start.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_conn_ready.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_conn_unreliable.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_conn_del.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_raw_recv.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_ecred_conn_rsp.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_le_command_rej.
  • Removes mutex_lock and mutex_unlock calls around channel list iteration in l2cap_security_cfm.
  • Removes mutex_lock and mutex_unlock calls in l2cap_chan_connect.
  • Adds mutex_lock and mutex_unlock around l2cap_conn_start in l2cap_info_timeout.
  • Adds mutex_lock and mutex_unlock around l2cap_recv_frame in process_pending_rx.
  • Adds mutex_lock and mutex_unlock around l2cap_conn_del.
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_sock.c
Updates the i8042 driver to use SERIO_QUIRK_FORCENORESTORE instead of a combination of other quirks for certain Clevo barebones, simplifying the code and potentially improving reliability.
  • Replaces `SERIO_QUIRK_NOMUX
SERIO_QUIRK_RESET_ALWAYS
Fixes a security issue in remap_file_pages by adding security checks and preventing changes underneath us.
  • Adds mmap_read_lock_killable to protect against signals.
  • Looks up VMA under read lock first to perform security checks without holding locks.
  • Saves vm_flags and file and rechecks them later under write lock.
  • Calls security_mmap_file outside mmap_lock.
  • Adds checks to ensure things didn't change under us before proceeding.
mm/mmap.c
Improves NVMe-TCP controller connectivity loss handling by simplifying the reset process.
  • Removes the switch statement based on nvme_ctrl_state in nvme_fc_ctrl_connectivity_loss.
  • Directly calls nvme_reset_ctrl after setting the ASSOC_FAILED flag.
  • Adds a check for ASSOC_FAILED in nvme_fc_create_association to return an error if the association failed.
drivers/nvme/host/fc.c
Improves HPD interrupt handling in the AMD display driver by explicitly clearing interrupts and managing interrupt references.
  • Clears all HPD and HPD_RX interrupts during initialization.
  • Gets a base driver IRQ reference for HPD interrupts.
  • Falls back to dc_interrupt_set for HPD sources beyond mode_info.num_hpd.
  • Releases HPD interrupt references during finalization.
  • Adds a TODO comment regarding a mismatch between mode_info.num_hpd and the number of connectors with HPD sources.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
Fixes and improves the iqs7222 touchscreen driver by correcting register access and initialization.
  • Fixes the register length for filter registers.
  • Removes unnecessary filter setup code.
  • Updates the burst read and write functions to use the correct value length.
  • Updates the report function to use the correct number of status registers.
drivers/input/misc/iqs7222.c
Adds support for new Telit and other USB devices to the option serial driver.
  • Adds new USB device IDs for Telit FE990B, FN990B, and other devices.
  • Updates the driver info for some Telit devices.
drivers/usb/serial/option.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio_ids.h
Improves oplock break notification handling in ksmbd, fixing a potential deadlock and improving performance.
  • Removes the interim list and sends interim responses directly in oplock_break.
  • Increments and decrements the connection request count to prevent deadlocks.
  • Removes unnecessary list operations.
fs/smb/server/oplock.c
fs/smb/server/ksmbd_work.c
fs/smb/server/oplock.h
Fixes a race condition in DP MST topology probing and improves handling of connection status notifications.
  • Adds a check to skip connection status notifications received before topology probing is complete.
  • Moves drm_dp_mst_topology_put_mstb to ensure it's always called.
  • Removes unnecessary code related to handling connection status notifications before probing is complete.
drivers/gpu/drm/display/drm_dp_mst_topology.c
Adds support for new Xbox controllers and fixes device identification in the xpad driver.
  • Adds new device IDs for ThrustMaster, Mad Catz, PDP, Hori, Turtle Beach, 8BitDo, and other Xbox controllers.
  • Fixes a device identification issue with QH Electronics controllers.
drivers/input/joystick/xpad.c
Fixes a potential memory leak in netfilter by using GFP_ATOMIC in nft_limit_clone.
  • Changes GFP_KERNEL to GFP_ATOMIC in nft_limit_clone to prevent blocking in atomic contexts.
net/netfilter/nft_limit.c
Fixes a potential memory leak in netfilter by using GFP_ATOMIC in nft_connlimit_clone.
  • Changes GFP_KERNEL to GFP_ATOMIC in nft_connlimit_clone to prevent blocking in atomic contexts.
net/netfilter/nft_connlimit.c
Fixes a potential memory leak in netfilter by using GFP_ATOMIC in nft_counter_clone.
  • Changes GFP_KERNEL to GFP_ATOMIC in nft_counter_clone to prevent blocking in atomic contexts.
net/netfilter/nft_counter.c
Fixes a potential memory leak in netfilter by using GFP_ATOMIC in nft_last_clone.
  • Changes GFP_KERNEL to GFP_ATOMIC in nft_last_clone to prevent blocking in atomic contexts.
net/netfilter/nft_last.c
Fixes a potential memory leak in netfilter by using GFP_ATOMIC in nft_quota_clone.
  • Changes GFP_KERNEL to GFP_ATOMIC in nft_quota_clone to prevent blocking in atomic contexts.
net/netfilter/nft_quota.c
Fixes a potential memory leak in netfilter by using GFP_ATOMIC in nft_dynset_clone.
  • Changes GFP_KERNEL to GFP_ATOMIC in nft_dynset_clone to prevent blocking in atomic contexts.
net/netfilter/nft_dynset.c
Fixes a potential memory leak in the i2c-ali1535 driver by releasing the region on probe failure.
  • Adds a goto statement to release the region on probe failure.
drivers/i2c/busses/i2c-ali1535.c
Fixes a potential memory leak in the i2c-ali15x3 driver by releasing the region on probe failure.
  • Adds a goto statement to release the region on probe failure.
drivers/i2c/busses/i2c-ali15x3.c
Fixes a potential memory leak in the i2c-sis630 driver by releasing the region on probe failure.
  • Adds a goto statement to release the region on probe failure.
drivers/i2c/busses/i2c-sis630.c
Fixes a potential memory leak in the wm0010 driver by releasing the irq on probe failure.
  • Adds a goto statement to release the irq on probe failure.
sound/soc/codecs/wm0010.c
Fixes a potential memory leak in the qlcnic driver by freeing the vlans on probe failure.
  • Adds a goto statement to release the vlans on probe failure.
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
Fixes a potential integer overflow in snd_soc_put_volsw.
  • Changes ((int)val + min) > mc->platform_max to val > mc->platform_max.
sound/soc/soc-ops.c
Fixes a potential integer overflow in smb3_fs_context_parse_param.
  • Changes HZ * result.uint_32 > CIFS_MAX_ACTIMEO to result.uint_32 > CIFS_MAX_ACTIMEO / HZ.
fs/smb/client/fs_context.c
Fixes a potential integer overflow in clk-pll.c.
  • Changes PLL lock time to use PLL142XX_LOCK_FACTOR for pll_142xx.
drivers/clk/samsung/clk-pll.c
Fixes a potential integer overflow in dc_resource.c.
  • Adds COLOR_DEPTH_141414 and COLOR_DEPTH_161616 to get_norm_pix_clk.
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
Fixes a potential integer overflow in rt722-sdca-sdw.c.
  • Adds missing registers to rt722_sdca_mbq_readable_register.
sound/soc/codecs/rt722-sdca-sdw.c
Fixes a potential integer overflow in cs42l43.c.
  • Changes 0xF, 5 to 0xF, 4 in SOC_DOUBLE_R_SX_TLV.
sound/soc/codecs/cs42l43.c
Fixes a potential integer overflow in amdgpu_dm_hdcp.c.
  • Adds cancel_delayed_work_sync(&hdcp_work[i].property_validate_dwork).
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
Fixes a potential integer overflow in stmmac/dwmac-loongson.c.
  • Changes pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)) to pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME).
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
Fixes a potential integer overflow in ads7846.c.
  • Changes ts->gpio_pendown = gpiod_get(&spi->dev, "pendown", GPIOD_IN) to ts->gpio_pendown = devm_gpiod_get(&spi->dev, "pendown", GPIOD_IN).
drivers/input/touchscreen/ads7846.c
Fixes a potential integer overflow in apple_input_configured.
  • Adds apple_is_omoton_kb066(hdev) to if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found).
drivers/hid/hid-apple.c
Fixes a potential integer overflow in dm_resume.
  • Adds set the backlight after a reset.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Fixes a potential integer overflow in mid_bios.c.
  • Adds if (pci_gfx_root == NULL) { WARN_ON(1); return; }.
drivers/gpu/drm/gma500/mid_bios.c
Fixes a potential integer overflow in nouveau_connector.c.
  • Removes connector->status = connector_status_disconnected.
drivers/gpu/drm/nouveau/nouveau_connector.c
Fixes a potential integer overflow in drm_atomic_connector_commit_dpms.
  • Adds if (connector->dpms == mode) goto out;.
drivers/gpu/drm/drm_atomic_uapi.c
Fixes a potential integer overflow in dm-flakey.c.
  • Changes bio_init(clone, fc->dev->bdev, bio->bi_inline_vecs, nr_iovecs, bio->bi_opf) to bio_init(clone, fc->dev->bdev, clone->bi_inline_vecs, nr_iovecs, bio->bi_opf).
drivers/md/dm-flakey.c
Fixes a potential integer overflow in mptcp_do_fallback.
  • Adds if (WARN_ON_ONCE(!READ_ONCE(msk->allow_infinite_fallback))) return;.
net/mptcp/protocol.h
Fixes a potential integer overflow in __napi_schedule.
  • Changes __raise_softirq_irqoff(NET_RX_SOFTIRQ) to raise_softirq_irqoff(NET_RX_SOFTIRQ).
net/core/dev.c
Fixes a potential integer overflow in amd.c.
  • Changes for_each_node(nid) to for_each_node_with_cpus(nid).
arch/x86/kernel/cpu/microcode/amd.c
Fixes a potential integer overflow in irq.c.
  • Adds #if defined(CONFIG_X86_LOCAL_APIC)
Fixes a potential integer overflow in mmu.c.
  • Adds WARN_ON_ONCE(end - start > PAGES_PER_SECTION * sizeof(struct page)).
arch/arm64/mm/mmu.c
Fixes a potential integer overflow in init.rs.
  • Changes pr_info!("a: {}", &*foo.a.lock()); to pr_info!("a: {}\n", &*foo.a.lock());
rust/kernel/init.rs
Fixes a potential integer overflow in macros.rs.
  • Changes pr_info!("{self:p} is getting dropped."); to pr_info!("{self:p} is getting dropped.\n");
rust/kernel/init/macros.rs
Fixes a potential integer overflow in error.rs.
  • Changes crate::pr_warn!("attempted to create Error with out of range errno: {}", errno); to crate::pr_warn!("attempted to create Error with out of range errno: {}\n", errno);
rust/kernel/error.rs
Fixes a potential integer overflow in l2cap_sock.c.
  • Changes chan = l2cap_pi(sk)->chan; l2cap_chan_hold(chan); to chan = l2cap_chan_hold_unless_zero(l2cap_pi(sk)->chan); if (!chan) goto shutdown_already;.
net/bluetooth/l2cap_sock.c
Fixes a potential integer overflow in ksmbd_conn_try_dequeue_request.
  • Changes atomic_inc(&conn->refcnt); if (!atomic_dec_return(&conn->r_count) && waitqueue_active(&conn->r_count_q)) wake_up(&conn->r_count_q); if (atomic_dec_and_test(&conn->refcnt)) kfree(conn); to ksmbd_conn_r_count_dec(conn);
fs/smb/server/server.c
Fixes a potential integer overflow in buildid.c.
  • Adds if (vma_is_secretmem(vma)) return -EFAULT;.
lib/buildid.c
Fixes a potential integer overflow in parse_reparse_point.
  • Adds if (le16_to_cpu(buf->ReparseDataLength) != 0) { cifs_dbg(VFS, "srv returned malformed buffer for reparse point: 0x%08x\n", le32_to_cpu(buf->ReparseTag)); return -EIO; } return 0;.
fs/smb/client/reparse.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @opsiff - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The i8042 changes are removing several flags and replacing them with SERIO_QUIRK_FORCENORESTORE - it would be good to understand why this single flag is sufficient.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 2 issues found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

return ret;

if (mmap_write_lock_killable(mm))
if (mmap_read_lock_killable(mm))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Changed initial locking from write to read in remap_file_pages

Please ensure that performing the security check under a read lock and later upgrading to the write lock does not introduce any race conditions or deadlocks.

default_conn_ops.terminate_fn = ops->terminate_fn;
}

void ksmbd_conn_r_count_inc(struct ksmbd_conn *conn)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Added connection read count management functions

The new functions using atomic operations to manage 'r_count' and 'refcnt' are critical for connection lifecycle. Please ensure that the ordering and wake-up of wait queues are thoroughly verified to avoid premature freeing or leaks.

}

void *io_mem_alloc(size_t size)
static void *io_mem_alloc_compound(struct page **pages, int nr_pages,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (complexity): Consider unifying the compound and single page allocation paths into a single function with internal fallback to simplify the allocation logic and reduce code duplication in io_pages_map.

Try unifying the two allocation paths into one routine to reduce the fragmentation of the control flow. For example, instead of splitting into separate functions for compound and single allocations, you could create one helper (e.g. io_mem_alloc_pages()) that first attempts a compound allocation and then falls back internally to a single allocation when needed. This not only centralizes the logic but also simplifies tests and maintenance. For example:

static void *io_mem_alloc_pages(struct page ***pages, int nr_pages, size_t size, gfp_t gfp)
{
    void *ret;
    /* Try compound allocation first */
    if (nr_pages > 1) {
        ret = io_mem_alloc_compound(*pages, nr_pages, size, gfp);
        if (!IS_ERR(ret))
            return ret;
    }
    /* For single page or compound failure, try single allocation */
    ret = io_mem_alloc_single(*pages, nr_pages, size, gfp);
    return ret;
}

void *io_pages_map(struct page ***out_pages, unsigned short *npages, size_t size)
{
    gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO | __GFP_NOWARN;
    struct page **pages;
    int nr_pages;
    void *ret;

    nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
    pages = kvmalloc_array(nr_pages, sizeof(struct page *), gfp);
    if (!pages)
        return ERR_PTR(-ENOMEM);

    ret = io_mem_alloc_pages(&pages, nr_pages, size, gfp);
    if (!IS_ERR(ret)) {
        *out_pages = pages;
        *npages = nr_pages;
        return ret;
    }
    kvfree(pages);
    *out_pages = NULL;
    *npages = 0;
    return ret;
}

Actionable Steps:

  1. Combine io_mem_alloc_compound and io_mem_alloc_single into a single function that internally falls back if the first attempt fails.
  2. Update io_pages_map() to call the new unified routine.
  3. Validate that existing behavior (e.g. handling a single page vs discontiguous pages) remains intact.

This consolidation will simplify the control flow and make the allocation logic easier to follow without altering functionality.

}

static int oplock_break(struct oplock_info *brk_opinfo, int req_op_level)
static int oplock_break(struct oplock_info *brk_opinfo, int req_op_level,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (complexity): Consider extracting the asynchronous handling in 'oplock_break' into its own helper function to reduce cyclomatic complexity and improve code maintainability by isolating the new branch logic from the main synchronous flow, creating separate synchronous and asynchronous paths, and delegating the new asynchronous branch to the new helper function, 'oplock_break_async' to simplify the main function and make each code path easier to follow and maintain, while the synchronous path would call 'oplock_break_sync' and decrement the breaking count if needed, and the main function would call either of these functions based on whether 'in_work' is present or not, respectively, to handle the asynchronous or synchronous paths accordingly, thus simplifying the main function and making each code path easier to follow and maintain, and reducing cyclomatic complexity.

You could reduce the cyclomatic complexity by extracting the asynchronous handling into its own helper function. This isolates the new branch logic from the main synchronous flow without reverting functionality. For example, you might do something like:

static int oplock_break_async(struct oplock_info *brk_opinfo, int req_op_level,
                              struct ksmbd_work *in_work) {
    int err = 0;
    /* Asynchronous branch logic currently embedded in oplock_break */
    if (brk_opinfo->is_lease) {
        struct lease *lease = brk_opinfo->o_lease;
        if (lease->state & SMB2_LEASE_HANDLE_CACHING_LE && !lease->is_dir)
            lease->new_state = SMB2_LEASE_READ_CACHING_LE;
        else
            lease->new_state = SMB2_LEASE_NONE_LE;
        if (in_work) {
            setup_async_work(in_work, NULL, NULL);
            smb2_send_interim_resp(in_work, STATUS_PENDING);
            release_async_work(in_work);
        }
        brk_opinfo->op_state = OPLOCK_ACK_WAIT;
    } else {
        err = oplock_break_pending(brk_opinfo, req_op_level);
        if (err)
            return err < 0 ? err : 0;
        if (brk_opinfo->level == SMB2_OPLOCK_LEVEL_BATCH ||
            brk_opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE)
            brk_opinfo->op_state = OPLOCK_ACK_WAIT;
    }
    return err;
}

static int oplock_break_sync(struct oplock_info *brk_opinfo, int req_op_level) {
    int err = 0;
    if (brk_opinfo->is_lease) {
        struct lease *lease = brk_opinfo->o_lease;
        if (lease->state & SMB2_LEASE_HANDLE_CACHING_LE && !lease->is_dir)
            lease->new_state = SMB2_LEASE_READ_CACHING_LE;
        else
            lease->new_state = SMB2_LEASE_NONE_LE;
        /* For the synchronous path, decrement breaking count if needed */
        atomic_dec(&brk_opinfo->breaking_cnt);
    } else {
        err = oplock_break_pending(brk_opinfo, req_op_level);
        if (err)
            return err < 0 ? err : 0;
        if (brk_opinfo->level == SMB2_OPLOCK_LEVEL_BATCH ||
            brk_opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE)
            brk_opinfo->op_state = OPLOCK_ACK_WAIT;
    }
    return err;
}

static int oplock_break(struct oplock_info *brk_opinfo, int req_op_level,
                        struct ksmbd_work *in_work) {
    if (in_work)
        return oplock_break_async(brk_opinfo, req_op_level, in_work);
    else
        return oplock_break_sync(brk_opinfo, req_op_level);
}

By delegating the new asynchronous branch to the oplock_break_async helper, you simplify the main function and make each code path easier to follow and maintain.

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.