6.18.35-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 277/315 serial: zs: Switch to using channel reset
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit 8572955630f30948837088aa98bcbe0532d1ceac upstream.
Switch the driver to using the channel reset rather than hardware reset, simplifying handling by removing an interference between channels that causes the other channel to become uninitialised afterwards.
There is little difference between the two kinds of reset in terms of register settings that result, and we initialise the whole register set right away anyway. However this prevents a hang from happening should the console output handler in the firmware try to access the other port whose transmitter has been disabled and line parameters messed up.
For example this will happen if the keyboard port (port A) is chosen for the system console, unusually but not insanely for a headless system, as the port is wired to a standard DA-15 connector and an adapter can be easily made. Or with the next change in place this would happen for the regular console port (port B), since the keyboard port (port A) will be initialised first.
Just remove the unnecessary complication then, a channel reset is good enough. We still need the initialisation marker, now per channel rather than per SCC, as for the console port zs_reset() will be called twice:
once early on via zs_serial_console_init() for the console setup only, and then again via zs_config_port() as the port is associated with a TTY device.
--- drivers/tty/serial/zs.c | 7 ++++--- drivers/tty/serial/zs.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/tty/serial/zs.c +4 -3
@@ -832,21 +832,22 @@ static void zs_shutdown(struct uart_portstatic void zs_reset (struct zs_port *zport) { +struct zs_port *zport_a = &zport->scc->zport[ZS_CHAN_A ];struct zs_scc *scc = zport->scc;int irq;unsigned long flags;spin_lock_irqsave (&scc->zlock, flags); irq = !irqs_disabled_flags (flags); -if (!scc->initialised) { +if (!zport->initialised) {/* Reset the pointer first, just in case... */ read_zsreg (zport,R0 );/* And let the current transmission finish. */ zs_line_drain (zport, irq); -write_zsreg (zport,R9 ,FHWRES ); +write_zsreg (zport,R9 , zport == zport_a ?CHRA :CHRB );udelay (10 );write_zsreg (zport,R9 ,0 ); - scc->initialised =1 ; + zport->initialised =1 ; }load_zsregs (zport, zport->regs, irq);spin_unlock_irqrestore (&scc->zlock, flags);
drivers/tty/serial/zs.h +1 -1
@@ -22,6 +22,7 @@struct zs_port {struct zs_scc *scc;/* Containing SCC. */ struct uart_port port;/* Underlying UART. */ +int initialised;/* For the console port. */ int clk_mode;/* May be 1, 16, 32, or 64. */
@@ -41,7 +42,6 @@ struct zs_scc {struct zs_port zport[2 ];spinlock_t zlock; atomic_t irq_guard; - int initialised; };#endif /* __KERNEL__ */
Greg Kroah-Hartman
maintainerPATCH 278/315 serial: zs: Convert to use a platform device
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit 7cac59d08a73cb866ec51a483a6f3fe0f531947c upstream.
Prevent a crash from happening as the first serial port is initialised:
Console: switching to mono frame buffer device 160x64
fb0: PMAG-AA frame buffer device at tc0
DECstation Z85C30 serial driver version 0.10
CPU 0 Unable to handle kernel paging request at virtual address 0000002c, epc == 803ab00c, ra == 803aafe0 Oops[#1]:
CPU: 0 PID: 1 Comm: swapper Not tainted 6.4.0-rc3-00031-g84a9582fd203-dirty #57
$ 0 : 00000000 10012c00 803aaeb0 00000000
$ 4 : 80e12f60 80e12f50 80e12f58 81000030
$ 8 : 00000000 805ff37c 00000000 33433538
$12 : 65732030 00000006 80c2915d 6c616972
$16 : 80e12f00 807b7630 00000000 00000000
$20 : 00000004 00000348 000001a0 807623b8
$24 : 00000018 00000000
$28 : 80c24000 80c25d60 8078b148 803aafe0
Hi : 00000000
Lo : 00000000
epc : 803ab00c serial_base_ctrl_add+0x78/0xf4
ra : 803aafe0 serial_base_ctrl_add+0x4c/0xf4
Status: 10012c03 KERNEL EXL IE
Cause : 00000008 (ExcCode 02)
BadVA : 0000002c
PrId : 00000440 (R4400SC)
Modules linked in:
Process swapper (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=00000000)
Stack : 80760000 00000cc0 00400044 00400040 803aa02c 80d61ab8 00000000 807b7630
80760000 807623b8 807b7628 803aa644 80386998 00000000 80e17780 80220f68
80e17780 80d61ab8 80c17d80 80e17780 80e17780 8063c798 80e17780 80383fa0
00000010 80e17780 00000000 80386998 807a0000 00000000 00400040 8038f848
807623b8 80d61ab8 00000004 80e17780 00000000 803a68e4 80c25e2c 803bb884
...
Call Trace:
[<803ab00c>] serial_base_ctrl_add+0x78/0xf4
[<803aa644>] serial_core_register_port+0x174/0x69c
[<8077e9ac>] zs_init+0xc8/0xfc
[<800404d4>] do_one_initcall+0x40/0x2ac
[<8076cecc>] kernel_init_freeable+0x1e4/0x270
[<80605bec>] kernel_init+0x20/0x108
[<800431e8>] ret_from_kernel_thread+0x14/0x1c
Code: 2442aeb0 ae120024 ae0200d0 <8c67002c> 50e00001 8c670000 3c06806e 3c05806e afb30010
---[ end trace 0000000000000000 ]---(report at the offending commit) -- where a pointer is dereferenced that has been derived from a null pointer to the port's parent device.
Since no device is available with legacy probing and it's not anymore a preferable way to discover devices anyway, switch the driver to using a platform device and use it as the port's parent device. Update resource handling accordingly and only request the actual span of addresses used within the slot, which will have had its resource already requested by generic platform device code.
Use platform_driver_probe() not just because SCC devices are fixed with solder on board and not straightforward to remove, but foremost because the associated TTY's major device number is the same as used by the dz driver and the first driver to claim it will prevent the other one from using it. Either one DZ device or some SCC devices will be present in a given system but never both at a time, and therefore we want the major device number to be claimed by the first driver to actually successfully bind to its device and platform_driver_probe() is a way to fulfil that.
An unfortunate consequence of the switch to a platform device is we now hand the console over from the bootconsole much later in the bootstrap. The firmware console handler appears good enough though to work so late and in particular with interrupts enabled.
Since there is one way only remaining to reach zs_reset() now, remove the port initialisation marker as no longer needed and go through the channel reset unconditionally.
--- arch/mips/dec/platform.c | 60 ++++++++++++++ drivers/tty/serial/zs.c | 190 +++++++++++++++++------------------------------ drivers/tty/serial/zs.h | 1 3 files changed, 128 insertions(+), 123 deletions(-)
arch/mips/dec/platform.c +57 -3
@@ -13,6 +13,7 @@#include <asm/bootinfo.h> #include <asm/dec/interrupts.h> +#include <asm/dec/ioasic_addrs.h> #include <asm/dec/kn01.h> #include <asm/dec/kn02.h> #include <asm/dec/system.h>
@@ -53,10 +54,37 @@ static struct platform_device *dec_dz_de &dec_dz_device, }; +static struct resource dec_zs_resources[][2 ] = { + { + { .name ="scc0" , .flags =IORESOURCE_MEM , }, + { .name ="scc0" , .flags =IORESOURCE_IRQ , }, + }, + { + { .name ="scc1" , .flags =IORESOURCE_MEM , }, + { .name ="scc1" , .flags =IORESOURCE_IRQ , }, + }, +}; + +static struct platform_device dec_zs_device[] = { + { + .name ="zs" , + .id =0 , + .resource = dec_zs_resources[0 ], + .num_resources =ARRAY_SIZE (dec_zs_resources[0 ]), + }, + { + .name ="zs" , + .id =1 , + .resource = dec_zs_resources[1 ], + .num_resources =ARRAY_SIZE (dec_zs_resources[1 ]), + }, +}; +static int __init dec_add_devices (void ) { -int ret1, ret2; -int num_dz; +struct platform_device *dec_zs_devices[ARRAY_SIZE (dec_zs_device)]; +int ret1, ret2, ret3; +int num_dz, num_zs;int irq, i; dec_rtc_resources[0 ].start =RTC_PORT (0 );
@@ -84,10 +112,36 @@ static int __init dec_add_devices(void) } num_dz = i; + i =0 ; + irq = dec_interrupt[DEC_IRQ_SCC0 ]; +if (irq >=0 ) { +resource_size_t base = dec_kn_slot_base +IOASIC_SCC0 ; + + dec_zs_device[i].resource[0 ].start = base; + dec_zs_device[i].resource[0 ].end = base + dec_kn_slot_size -1 ; + dec_zs_device[i].resource[1 ].start = irq; + dec_zs_device[i].resource[1 ].end = irq; + dec_zs_devices[i] = &dec_zs_device[i]; + i++; + } + irq = dec_interrupt[DEC_IRQ_SCC1 ]; +if (irq >=0 ) { +resource_size_t base = dec_kn_slot_base +IOASIC_SCC1 ; + + dec_zs_device[i].resource[0 ].start = base; + dec_zs_device[i].resource[0 ].end = base + dec_kn_slot_size -1 ; + dec_zs_device[i].resource[1 ].start = irq; + dec_zs_device[i].resource[1 ].end = irq; + dec_zs_devices[i] = &dec_zs_device[i]; + i++; + } + num_zs = i; + ret1 =platform_device_register (&dec_rtc_device); ret2 =IS_ENABLED (CONFIG_32BIT ) ?platform_add_devices (dec_dz_devices, num_dz) :0 ; -return ret1 ? ret1 : ret2; + ret3 =platform_add_devices (dec_zs_devices, num_zs); +return ret1 ? ret1 : ret2 ? ret2 : ret3; }device_initcall (dec_add_devices);
drivers/tty/serial/zs.c +71 -119
275 lines not on this page · raw message
drivers/tty/serial/zs.h +0 -1
@@ -22,7 +22,6 @@struct zs_port {struct zs_scc *scc;/* Containing SCC. */ struct uart_port port;/* Underlying UART. */ -int initialised;/* For the console port. */ int clk_mode;/* May be 1, 16, 32, or 64. */
Greg Kroah-Hartman
maintainerPATCH 279/315 serial: core: introduce guard(uart_port_lock_check_sysrq_irqsave)
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacques Nilo <[email protected]>
commit c3cce2e67bb22a223f5b8ef05db0fcde70994068 upstream.
uart_handle_break() and uart_prepare_sysrq_char() (in include/linux/serial_core.h) capture a SysRq character into port->sysrq_ch while the port lock is held and rely on the unlock helper -- uart_unlock_and_check_sysrq_irqrestore() -- to dispatch the captured character to handle_sysrq() on scope exit.
The existing guard(uart_port_lock_irqsave) cannot be used by IRQ handlers that process RX, because its destructor calls plain uart_port_unlock_irqrestore() and silently drops port->sysrq_ch.
Add a dedicated guard(uart_port_lock_check_sysrq_irqsave) variant whose destructor is the sysrq-aware unlock helper. The lock side is identical to uart_port_lock_irqsave -- only the unlock-time behaviour differs. Callers that may capture SysRq characters must use guard(uart_port_lock_check_sysrq_irqsave); the existing guard(uart_port_lock_irqsave) keeps its current plain-unlock semantics for the many callers that do not process RX.
The new macro is placed after the CONFIG_MAGIC_SYSRQ_SERIAL block so both definitions of uart_unlock_and_check_sysrq_irqrestore() (sysrq enabled and disabled) are visible at expansion time. When CONFIG_MAGIC_SYSRQ_SERIAL=n the destructor degenerates to plain uart_port_unlock_irqrestore(), so there is no overhead.
No functional change on its own; users are converted in the following patches.
--- include/linux/serial_core.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/linux/serial_core.h +12 -0
@@ -1275,6 +1275,18 @@ static inline void uart_unlock_and_check#endif /* CONFIG_MAGIC_SYSRQ_SERIAL */ /* +* Variant of guard(uart_port_lock_irqsave) for IRQ handlers that may capture +* a SysRq character via uart_prepare_sysrq_char(). The destructor uses the +* sysrq-aware unlock helper so that a captured port->sysrq_ch is dispatched +* to handle_sysrq() on scope exit. The plain guard variant silently drops +* sysrq_ch and must not be used by callers that process RX. +*/ +DEFINE_LOCK_GUARD_1(uart_port_lock_check_sysrq_irqsave, struct uart_port, +uart_port_lock_irqsave (_T->lock, &_T->flags), +uart_unlock_and_check_sysrq_irqrestore (_T->lock, _T->flags), + unsigned long flags); + +/* * We do the SysRQ and SAK checking like this... */ static inline int uart_handle_break (struct uart_port *port)
Greg Kroah-Hartman
maintainerPATCH 280/315 serial: 8250: dispatch SysRq character in serial8250_handle_irq()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacques Nilo <[email protected]>
commit 71f42b2149a1307a97165b409493665579462ea0 upstream.
serial8250_handle_irq() captures a SysRq character into port->sysrq_ch inside serial8250_handle_irq_locked() via uart_prepare_sysrq_char() (reached from serial8250_read_char()). Dispatch of that captured character to handle_sysrq() is expected to happen at port-unlock time, through uart_unlock_and_check_sysrq[_irqrestore]().
After commit 8324a54f604d ("serial: 8250: Add serial8250_handle_irq_locked()") the function was reduced to a wrapper that takes the port lock via guard(uart_port_lock_irqsave) whose destructor is plain uart_port_unlock_irqrestore(). The sysrq-aware unlock helper is no longer called, so port->sysrq_ch is captured but never dispatched: BREAK + SysRq key is consumed silently.
This was the very condition Johan Hovold's 853a9ae29e978 ("serial:
8250: fix handle_irq locking", 2021) introduced uart_unlock_and_check_sysrq_irqrestore() to address.
Switch to the new guard(uart_port_lock_check_sysrq_irqsave), whose destructor is the sysrq-aware unlock helper, restoring the pre-split behaviour. Update the Context: comment on serial8250_handle_irq_locked() so future HW-specific 8250 wrappers know to use the same guard or the explicit sysrq-aware unlock.
Verified on RTL8196E with CONFIG_MAGIC_SYSRQ_SERIAL=y: BREAK + 'h' on the console UART produces the SysRq help dump in dmesg and the brk counter in /proc/tty/driver/serial increments correctly.
--- drivers/tty/serial/8250/8250_port.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_port.c +5 -2
@@ -1784,7 +1784,10 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir) }/* -* Context: port's lock must be held by the caller. +* Context: port's lock must be held by the caller. The caller must +* release it via guard(uart_port_lock_check_sysrq_irqsave) or +* uart_unlock_and_check_sysrq_irqrestore(), which captures SysRq +* character on unlock. */ void serial8250_handle_irq_locked (struct uart_port *port,unsigned int iir) {
@@ -1837,7 +1840,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)if (iir &UART_IIR_NO_INT )return 0 ; -guard (uart_port_lock_irqsave)(port); +guard (uart_port_lock_check_sysrq_irqsave)(port);serial8250_handle_irq_locked (port, iir);return 1 ;
Signature · 1 line
2.54.0
Greg Kroah-Hartman
maintainerPATCH 281/315 serial: 8250_dw: dispatch SysRq character in dw8250_handle_irq()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacques Nilo <[email protected]>
commit 2e211723953f7740e54b53f3d3a0d5e351a5e223 upstream.
dw8250_handle_irq() calls serial8250_handle_irq_locked() with the port lock held via guard(uart_port_lock_irqsave). The guard destructor is plain uart_port_unlock_irqrestore(), so a SysRq character captured into port->sysrq_ch by uart_prepare_sysrq_char() is dropped without ever being dispatched to handle_sysrq().
This is the same regression pattern as in serial8250_handle_irq(), introduced when 883c5a2bc934 ("serial: 8250_dw: Rework dw8250_handle_irq() locking and IIR handling") moved the function to the guard()-based locking scheme without using the sysrq-aware unlock helper.
Switch to guard(uart_port_lock_check_sysrq_irqsave) so that captured sysrq_ch is dispatched on scope exit, matching the fix in serial8250_handle_irq().
--- drivers/tty/serial/8250/8250_dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_dw.c +1 -1
@@ -427,7 +427,7 @@ static int dw8250_handle_irq(struct uart_port *p)unsigned int quirks = d->pdata->quirks;unsigned int status; -guard (uart_port_lock_irqsave)(p); +guard (uart_port_lock_check_sysrq_irqsave)(p);switch (FIELD_GET (DW_UART_IIR_IID , iir)) {case UART_IIR_NO_INT :
Signature · 1 line
2.54.0
Greg Kroah-Hartman
maintainerPATCH 282/315 platform/x86/intel/vsec: Refactor base_addr handling
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "David E. Box" <[email protected]>
[ Upstream commit 904b333fc51cc045941df9656302449a0fc9978e ]
The base_addr field in intel_vsec_platform_info was originally added to support devices that emulate PCI VSEC capabilities in MMIO. Previously, the code would check at registration time whether base_addr was set, falling back to the PCI BAR if not.
Refactor this by making base_addr an explicit function parameter. This clarifies ownership of the value and removes conditional logic from intel_vsec_add_dev(). It also enables making intel_vsec_platform_info const in a later patch, since the function no longer needs to write to info->base_addr.
No functional change intended.
Stable-dep-of: 348ccc754d89 ("platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery")
--- drivers/platform/x86/intel/vsec.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/platform/x86/intel/vsec.c +10 -13
@@ -271,14 +271,13 @@ EXPORT_SYMBOL_NS_GPL(intel_vsec_add_aux,static int intel_vsec_add_dev (struct pci_dev *pdev,struct intel_vsec_header *header,struct intel_vsec_platform_info *info, -unsigned long cap_id) +unsigned long cap_id,u64 base_addr) { struct intel_vsec_device __free(kfree) *intel_vsec_dev = NULL; struct resource __free(kfree) *res = NULL; struct resource *tmp; struct device *parent; unsigned long quirks = info->quirks; - u64 base_addr; int i; if (info->parent)
@@ -310,11 +309,6 @@ static int intel_vsec_add_dev(struct pciif (quirks &VSEC_QUIRK_TABLE_SHIFT ) header->offset >>=TABLE_OFFSET_SHIFT ; -if (info->base_addr) - base_addr = info->base_addr; -else - base_addr = pdev->resource[header->tbir].start; -/* * The DVSEC/VSEC contains the starting offset and count for a block of * discovery tables. Create a resource array of these tables to the
@@ -412,7 +406,8 @@ static int get_cap_id(u32 header_id, unsstatic int intel_vsec_register_device (struct pci_dev *pdev,struct intel_vsec_header *header, -struct intel_vsec_platform_info *info) +struct intel_vsec_platform_info *info, +u64 base_addr) {const struct vsec_feature_dependency *consumer_deps;struct vsec_priv *priv;
@@ -428,7 +423,7 @@ static int intel_vsec_register_device(st* For others using the exported APIs, add the device directly. */ if (!pci_match_id (intel_vsec_pci_ids, pdev)) -return intel_vsec_add_dev (pdev, header, info, cap_id); +return intel_vsec_add_dev (pdev, header, info, cap_id, base_addr); priv =pci_get_drvdata (pdev); if (priv->state[cap_id] == STATE_REGISTERED ||
@@ -444,7 +439,7 @@ static int intel_vsec_register_device(st consumer_deps =get_consumer_dependencies (priv, cap_id);if (!consumer_deps ||suppliers_ready (priv, consumer_deps, cap_id)) { - ret =intel_vsec_add_dev (pdev, header, info, cap_id); + ret =intel_vsec_add_dev (pdev, header, info, cap_id, base_addr);if (ret) priv->state[cap_id] =STATE_SKIP ;else
@@ -464,7 +459,7 @@ static bool intel_vsec_walk_header(strucint ret;for ( ; *header; header++) { - ret =intel_vsec_register_device (pdev, *header, info); + ret =intel_vsec_register_device (pdev, *header, info, info->base_addr);if (!ret) have_devices = true; }
@@ -512,7 +507,8 @@ static bool intel_vsec_walk_dvsec(structpci_read_config_dword (pdev, pos +PCI_DVSEC_HEADER2 , &hdr); header.id =PCI_DVSEC_HEADER2_ID (hdr); - ret =intel_vsec_register_device (pdev, &header, info); + ret =intel_vsec_register_device (pdev, &header, info, +pci_resource_start (pdev, header.tbir));if (ret)continue ;
@@ -557,7 +553,8 @@ static bool intel_vsec_walk_vsec(struct header.tbir =INTEL_DVSEC_TABLE_BAR (table); header.offset =INTEL_DVSEC_TABLE_OFFSET (table); - ret =intel_vsec_register_device (pdev, &header, info); + ret =intel_vsec_register_device (pdev, &header, info, +pci_resource_start (pdev, header.tbir));if (ret)continue ;
Greg Kroah-Hartman
maintainerPATCH 283/315 platform/x86/intel/vsec: Make driver_data info const
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "David E. Box" <[email protected]>
[ Upstream commit 9577c74c96f88d807d1ba005adbf5952e7127e55 ]
Treat PCI id->driver_data (intel_vsec_platform_info) as read-only by making vsec_priv->info a const pointer and updating all function signatures to accept const intel_vsec_platform_info *.
This improves const-correctness and clarifies that the platform info data from the driver_data table is not meant to be modified at runtime.
No functional changes intended.
Stable-dep-of: 348ccc754d89 ("platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery")
--- drivers/platform/x86/intel/vsec.c | 20 ++++++++++---------- include/linux/intel_vsec.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/platform/x86/intel/vsec.c +10 -10
@@ -42,7 +42,7 @@ enum vsec_device_state { };struct vsec_priv { -struct intel_vsec_platform_info *info; +const struct intel_vsec_platform_info *info;struct device *suppliers[VSEC_FEATURE_COUNT ];struct oobmsm_plat_info plat_info;enum vsec_device_state state[VSEC_FEATURE_COUNT ];
@@ -270,7 +270,7 @@ cleanup_aux:EXPORT_SYMBOL_NS_GPL (intel_vsec_add_aux,"INTEL_VSEC" );static int intel_vsec_add_dev (struct pci_dev *pdev,struct intel_vsec_header *header, -struct intel_vsec_platform_info *info, +const struct intel_vsec_platform_info *info,unsigned long cap_id,u64 base_addr) { struct intel_vsec_device __free(kfree) *intel_vsec_dev = NULL;
@@ -406,7 +406,7 @@ static int get_cap_id(u32 header_id, unsstatic int intel_vsec_register_device (struct pci_dev *pdev,struct intel_vsec_header *header, -struct intel_vsec_platform_info *info, +const struct intel_vsec_platform_info *info,u64 base_addr) {const struct vsec_feature_dependency *consumer_deps;
@@ -452,7 +452,7 @@ static int intel_vsec_register_device(st }static bool intel_vsec_walk_header (struct pci_dev *pdev, -struct intel_vsec_platform_info *info) +const struct intel_vsec_platform_info *info) {struct intel_vsec_header **header = info->headers;bool have_devices = false;
@@ -468,7 +468,7 @@ static bool intel_vsec_walk_header(struc }static bool intel_vsec_walk_dvsec (struct pci_dev *pdev, -struct intel_vsec_platform_info *info) +const struct intel_vsec_platform_info *info) {bool have_devices = false;int pos =0 ;
@@ -519,7 +519,7 @@ static bool intel_vsec_walk_dvsec(struct }static bool intel_vsec_walk_vsec (struct pci_dev *pdev, -struct intel_vsec_platform_info *info) +const struct intel_vsec_platform_info *info) {bool have_devices = false;int pos =0 ;
@@ -565,7 +565,7 @@ static bool intel_vsec_walk_vsec(struct }int intel_vsec_register (struct pci_dev *pdev, -struct intel_vsec_platform_info *info) +const struct intel_vsec_platform_info *info) {if (!pdev || !info || !info->headers)return -EINVAL ;
@@ -578,7 +578,7 @@ int intel_vsec_register(struct pci_dev *EXPORT_SYMBOL_NS_GPL (intel_vsec_register,"INTEL_VSEC" );static bool intel_vsec_get_features (struct pci_dev *pdev, -struct intel_vsec_platform_info *info) +const struct intel_vsec_platform_info *info) {bool found = false;
@@ -622,7 +622,7 @@ static void intel_vsec_skip_missing_depestatic int intel_vsec_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) { -struct intel_vsec_platform_info *info; +const struct intel_vsec_platform_info *info;struct vsec_priv *priv;int num_caps, ret;int run_once =0 ;
@@ -633,7 +633,7 @@ static int intel_vsec_pci_probe(struct preturn ret;pci_save_state (pdev); - info = (struct intel_vsec_platform_info *)id->driver_data; + info = (const struct intel_vsec_platform_info *)id->driver_data;if (!info)return -EINVAL ;
include/linux/intel_vsec.h +2 -2
@@ -199,13 +199,13 @@ static inline struct intel_vsec_device *#if IS_ENABLED (CONFIG_INTEL_VSEC )int intel_vsec_register (struct pci_dev *pdev, -struct intel_vsec_platform_info *info); +const struct intel_vsec_platform_info *info);int intel_vsec_set_mapping (struct oobmsm_plat_info *plat_info,struct intel_vsec_device *vsec_dev);struct oobmsm_plat_info *intel_vsec_get_mapping (struct pci_dev *pdev);#else static inline int intel_vsec_register (struct pci_dev *pdev, -struct intel_vsec_platform_info *info) +const struct intel_vsec_platform_info *info) {return -ENODEV ; }
Greg Kroah-Hartman
maintainerPATCH 284/315 platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
[ Upstream commit 348ccc754d8939e21ca5956ff45720b81d6e407f ]
After a PCIe Uncorrectable Error has been reported by a device with Intel Vendor Specific Extended Capabilities and has been recovered through a Secondary Bus Reset, its driver calls intel_vsec_pci_probe() to rescan and reinitialize VSECs.
intel_vsec_pci_probe() invokes pcim_enable_device() and thereby adds another devm action which calls pcim_disable_device() on driver unbind.
So once the driver unbinds, pcim_disable_device() will be called as many times as an Uncorrectable Error occurred, plus one. This will lead to an enable_cnt imbalance on driver unbind.
Additionally, since commit dc957ab6aa05 ("platform/x86/intel/vsec: Add private data for per-device data"), a devm_kzalloc() allocation is leaked on every Uncorrectable Error.
Avoid by splitting the VSEC rescan out of intel_vsec_pci_probe() into a separate helper and calling that on PCIe error recovery.
--- drivers/platform/x86/intel/vsec.c | 54 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-)
drivers/platform/x86/intel/vsec.c +30 -24
@@ -620,29 +620,13 @@ static void intel_vsec_skip_missing_depe } } -static int intel_vsec_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) +static int intel_vsec_pci_init (struct pci_dev *pdev) { -const struct intel_vsec_platform_info *info; -struct vsec_priv *priv; -int num_caps, ret; +struct vsec_priv *priv =pci_get_drvdata (pdev); +const struct intel_vsec_platform_info *info = priv->info;int run_once =0 ;bool found_any = false; - - ret =pcim_enable_device (pdev); -if (ret) -return ret; - -pci_save_state (pdev); - info = (const struct intel_vsec_platform_info *)id->driver_data; -if (!info) -return -EINVAL ; - - priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); -if (!priv) -return -ENOMEM ; - - priv->info = info; -pci_set_drvdata (pdev, priv); +int num_caps; num_caps =hweight_long (info->caps);while (num_caps--) {
@@ -663,6 +647,31 @@ static int intel_vsec_pci_probe(struct preturn 0 ; } +static int intel_vsec_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) +{ +const struct intel_vsec_platform_info *info; +struct vsec_priv *priv; +int ret; + + ret =pcim_enable_device (pdev); +if (ret) +return ret; + +pci_save_state (pdev); + info = (const struct intel_vsec_platform_info *)id->driver_data; +if (!info) +return -EINVAL ; + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->info = info; +pci_set_drvdata (pdev, priv); + +return intel_vsec_pci_init (pdev); +} +int intel_vsec_set_mapping (struct oobmsm_plat_info *plat_info,struct intel_vsec_device *vsec_dev) {
@@ -796,7 +805,6 @@ static pci_ers_result_t intel_vsec_pci_s {struct intel_vsec_device *intel_vsec_dev;pci_ers_result_t status =PCI_ERS_RESULT_DISCONNECT ; -const struct pci_device_id *pci_dev_id;unsigned long index;dev_info (&pdev->dev,"Resetting PCI slot\n" );
@@ -817,10 +825,8 @@ static pci_ers_result_t intel_vsec_pci_sdevm_release_action (&pdev->dev, intel_vsec_remove_aux, &intel_vsec_dev->auxdev); } -pci_disable_device (pdev);pci_restore_state (pdev); - pci_dev_id =pci_match_id (intel_vsec_pci_ids, pdev); -intel_vsec_pci_probe (pdev, pci_dev_id); +intel_vsec_pci_init (pdev); out:return status;
Greg Kroah-Hartman
maintainerPATCH 285/315 x86/mm: Disable broadcast TLB flush when PCID is disabled
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Lendacky <[email protected]>
[ Upstream commit 44126343d58c68adaa8343fbf1c07dd20078c35e ]
Booting with "nopcid" clears X86_FEATURE_PCID and keeps CR4.PCIDE from being set to one. On AMD CPUs that support INVLPGB, broadcast TLB flushing remains enabled.
There are two checks that decide whether the global ASID code runs, mm_global_asid() and consider_global_asid(), that key off of the X86_FEATURE_INVLPGB feature. Once an mm becomes active on more than three CPUs, consider_global_asid() assigns it a global ASID, after which flush_tlb_mm_range() takes the broadcast_tlb_flush() path using a non-zero PCID. Issuing an INVLPGB with a non-zero PCID while CR4.PCIDE is not set results in a #GP:
Oops: general protection fault, kernel NULL pointer dereference 0x1: 0000 [#1] SMP NOPTI CPU: 158 UID: 0 PID: 3119 Comm: snap Not tainted 7.1.0-rc3 #1 PREEMPT(full) Hardware name: ... RIP: 0010:broadcast_tlb_flush Code: ... 89 da 48 83 c8 07 <0f> 01 fe eb 08 cc cc cc ... Call Trace: <TASK> flush_tlb_mm_range ptep_clear_flush wp_page_copy ? _raw_spin_unlock __handle_mm_fault handle_mm_fault do_user_addr_fault exc_page_fault asm_exc_page_fault
All processors that support broadcast TLB invalidation also have PCID support, so it is only the "nopcid" scenario that is of concern. In this situation just disable the broadcast TLB support using the CPUID dependency support by making X86_FEATURE_INVLPGB dependent on X86_FEATURE_PCID.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/cpuid-deps.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/cpuid-deps.c +1 -0
@@ -89,6 +89,7 @@ static const struct cpuid_dep cpuid_deps { X86_FEATURE_SHSTK, X86_FEATURE_XSAVES }, { X86_FEATURE_FRED, X86_FEATURE_LKGS }, { X86_FEATURE_SPEC_CTRL_SSBD, X86_FEATURE_SPEC_CTRL }, + { X86_FEATURE_INVLPGB, X86_FEATURE_PCID }, {} };
Greg Kroah-Hartman
maintainerPATCH 286/315 rxrpc: Fix DATA decrypt vs splice() by copying data to buffer in recvmsg
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit d2bc90cf6c75cb96d2ce549be6c35efa3099d25b ]
This improves the fix for CVE-2026-43500.
Fix the pagecache corruption from in-place decryption of a DATA packet transmitted locally by splice() by getting rid of the packet sharing in the I/O thread and unconditionally extracting the packet content into a bounce buffer in which the buffer is decrypted. recvmsg() (or the kernel equivalent) then copies the data from the bounce buffer to the destination buffer. The sk_buff then remains unmodified.
This has an additional advantage in that the packet is then arranged in the buffer with the correct alignment required for the crypto algorithms to process directly. The performance of the crypto does seem to be a little faster and, surprisingly, the unencrypted performance doesn't seem to change much - possibly due to removing complexity from the I/O thread.
Yet another advantage is that the I/O thread doesn't have to copy packets which would slow down packet distribution, ACK generation, etc..
The buffer belongs to the call and is allocated initially at 2K, sufficiently large to hold a whole jumbo subpacket, but the buffer will be increased in size if needed. However, to take this work, MSG_PEEK may cause a later packet to be decrypted into the buffer, in which case the earlier one will need re-decrypting for a subsequent recvmsg().
Note that rx_pkt_offset may legitimately see 0 as a valid offset now, so switch to using USHRT_MAX to indicate an invalid offset.
Note also that I would generally prefer to replace the buffers of the current sk_buff with a new kmalloc'd buffer of the right size, ditching the old data and frags as this makes the handling of MSG_PEEK easier and removes the re-decryption issue, but this looks like quite a complicated thing to achieve. skb_morph() looks half way to what I want, but I don't want to have to allocate a new sk_buff.
Stable-dep-of: 8bfab4b6ffc2 ("rxrpc: Fix RESPONSE packet verification to extract skb to a linear buffer")
--- net/rxrpc/ar-internal.h | 7 ++- net/rxrpc/call_event.c | 22 ------------ net/rxrpc/call_object.c | 2 + net/rxrpc/insecure.c | 3 - net/rxrpc/recvmsg.c | 68 ++++++++++++++++++++++++++++++------- net/rxrpc/rxgk.c | 51 +++++++++++++--------------- net/rxrpc/rxgk_common.h | 82 +++++++++++++++++++++++++++++++++++++++++++++ net/rxrpc/rxkad.c | 86 +++++++++++++++++------------------------------- 8 files changed, 201 insertions(+), 120 deletions(-)
net/rxrpc/ar-internal.h +5 -2
@@ -213,8 +213,6 @@ struct rxrpc_skb_priv {struct {u16 offset;/* Offset of data */ u16 len;/* Length of data */ -u8 flags; -#define RXRPC_RX_VERIFIED 0x01 };struct {rxrpc_seq_t first_ack;/* First packet in acks table */
@@ -774,6 +772,11 @@ struct rxrpc_call {struct sk_buff_head recvmsg_queue;/* Queue of packets ready for recvmsg() */ struct sk_buff_head rx_queue;/* Queue of packets for this call to receive */ struct sk_buff_head rx_oos_queue;/* Queue of out of sequence packets */ +void *rx_dec_buffer;/* Decryption buffer */ +unsigned short rx_dec_bsize;/* rx_dec_buffer size */ +unsigned short rx_dec_offset;/* Decrypted packet data offset */ +unsigned short rx_dec_len;/* Decrypted packet data len */ +rxrpc_seq_t rx_dec_seq;/* Packet in decryption buffer */ rxrpc_seq_t rx_highest_seq;/* Higest sequence number received */ rxrpc_seq_t rx_consumed;/* Highest packet consumed */
net/rxrpc/call_event.c +1 -21
@@ -332,27 +332,7 @@ bool rxrpc_input_call_event(struct rxrpc saw_ack |= sp->hdr.type ==RXRPC_PACKET_TYPE_ACK ; -if (sp->hdr.type ==RXRPC_PACKET_TYPE_DATA && - sp->hdr.securityIndex !=0 && - (skb_cloned (skb) || -skb_has_frag_list (skb) || -skb_has_shared_frag (skb))) { -/* Unshare the packet so that it can be -* modified by in-place decryption. -*/ -struct sk_buff *nskb =skb_copy (skb,GFP_ATOMIC ); - -if (nskb) { -rxrpc_new_skb (nskb, rxrpc_skb_new_unshared); -rxrpc_input_call_packet (call, nskb); -rxrpc_free_skb (nskb, rxrpc_skb_put_call_rx); - }else { -/* OOM - Drop the packet. */ -rxrpc_see_skb (skb, rxrpc_skb_see_unshare_nomem); - } - }else { -rxrpc_input_call_packet (call, skb); - } +rxrpc_input_call_packet (call, skb);rxrpc_free_skb (skb, rxrpc_skb_put_call_rx); did_receive = true; }
net/rxrpc/call_object.c +2 -0
@@ -152,6 +152,7 @@ struct rxrpc_call *rxrpc_alloc_call(struspin_lock_init (&call->notify_lock);refcount_set (&call->ref,1 ); call->debug_id = debug_id; + call->rx_pkt_offset =USHRT_MAX ; call->tx_total_len =-1 ; call->tx_jumbo_max =1 ; call->next_rx_timo =20 *HZ ;
@@ -553,6 +554,7 @@ static void rxrpc_cleanup_rx_buffers(strrxrpc_purge_queue (&call->recvmsg_queue);rxrpc_purge_queue (&call->rx_queue);rxrpc_purge_queue (&call->rx_oos_queue); +kfree (call->rx_dec_buffer); }/*
net/rxrpc/insecure.c +0 -3
@@ -32,9 +32,6 @@ static int none_secure_packet(struct rxrstatic int none_verify_packet (struct rxrpc_call *call,struct sk_buff *skb) { -struct rxrpc_skb_priv *sp =rxrpc_skb (skb); - - sp->flags |=RXRPC_RX_VERIFIED ;return 0 ; }
net/rxrpc/recvmsg.c +55 -13
103 lines not on this page · raw message
net/rxrpc/rxgk.c +24 -27
104 lines not on this page · raw message
net/rxrpc/rxgk_common.h +82 -0
94 lines not on this page · raw message
net/rxrpc/rxkad.c +32 -54
166 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 287/315 rxrpc: Fix RESPONSE packet verification to extract skb to a linear buffer
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 8bfab4b6ffc2fe92da86300728fc8c3c7ebffb56 ]
This improves the fix for CVE-2026-43500.
Fix the verification of RESPONSE packets to avoid the problem of overwriting a RESPONSE packet sent via splice to a local address by extracting the contents of the UDP packet into a kmalloc'd linear buffer rather than decrypting the data in place in the sk_buff (which may corrupt the original buffer).
--- net/rxrpc/ar-internal.h | 7 ++- net/rxrpc/conn_event.c | 30 ++++++--------- net/rxrpc/insecure.c | 5 +- net/rxrpc/rxgk.c | 96 +++++++++++++++--------------------------------- net/rxrpc/rxgk_app.c | 46 +++++++++-------------- net/rxrpc/rxgk_common.h | 92 +--------------------------------------------- net/rxrpc/rxkad.c | 29 +++++--------- 7 files changed, 81 insertions(+), 224 deletions(-)
net/rxrpc/ar-internal.h +4 -3
@@ -307,15 +307,16 @@ struct rxrpc_security { struct sk_buff *challenge);/* verify a response */ -int (*verify_response)(struct rxrpc_connection *, -struct sk_buff *); +int (*verify_response)(struct rxrpc_connection *conn, +struct sk_buff *response_skb, +void *response,unsigned int len);/* clear connection security */ void (*clear)(struct rxrpc_connection *);/* Default ticket -> key decoder */ int (*default_decode_ticket)(struct rxrpc_connection *conn,struct sk_buff *skb, -unsigned int ticket_offset,unsigned int ticket_len, +void *ticket,unsigned int ticket_len,struct key **_key); };
net/rxrpc/conn_event.c +12 -18
@@ -243,28 +243,22 @@ static void rxrpc_call_is_secure(structstatic int rxrpc_verify_response (struct rxrpc_connection *conn,struct sk_buff *skb) { +unsigned int len = skb->len -sizeof (struct rxrpc_wire_header ); +void *buffer;int ret; -if (skb_cloned (skb) ||skb_has_frag_list (skb) || -skb_has_shared_frag (skb)) { -/* Copy the packet if shared so that we can do in-place -* decryption. -*/ -struct sk_buff *nskb =skb_copy (skb,GFP_NOFS ); + buffer =kmalloc (len,GFP_NOFS ); +if (!buffer) +return -ENOMEM ; -if (nskb) { -rxrpc_new_skb (nskb, rxrpc_skb_new_unshared); - ret = conn->security->verify_response (conn, nskb); -rxrpc_free_skb (nskb, rxrpc_skb_put_response_copy); - }else { -/* OOM - Drop the packet. */ -rxrpc_see_skb (skb, rxrpc_skb_see_unshare_nomem); - ret = -ENOMEM ; - } - }else { - ret = conn->security->verify_response (conn, skb); - } + ret =skb_copy_bits (skb,sizeof (struct rxrpc_wire_header ), buffer, len); +if (ret <0 ) + goto out; + ret = conn->security->verify_response (conn, skb, buffer, len); + +out: +kfree (buffer);return ret; }
net/rxrpc/insecure.c +3 -2
@@ -54,9 +54,10 @@ static int none_sendmsg_respond_to_chall }static int none_verify_response (struct rxrpc_connection *conn, -struct sk_buff *skb) +struct sk_buff *response_skb, +void *response,unsigned int len) { -return rxrpc_abort_conn (conn, skb,RX_PROTOCOL_ERROR , -EPROTO , +return rxrpc_abort_conn (conn, response_skb,RX_PROTOCOL_ERROR , -EPROTO , rxrpc_eproto_rxnull_response); }
net/rxrpc/rxgk.c +31 -65
160 lines not on this page · raw message
net/rxrpc/rxgk_app.c +19 -27
115 lines not on this page · raw message
net/rxrpc/rxgk_common.h +2 -90
112 lines not on this page · raw message
net/rxrpc/rxkad.c +10 -19
@@ -963,7 +963,6 @@ static int rxkad_decrypt_ticket(struct r *_expiry =0 ;ASSERT (server_key->payload.data[0 ] !=NULL ); - ASSERTCMP((unsigned long) ticket & 7UL, ==, 0);memcpy (&iv, &server_key->payload.data[2 ],sizeof (iv));
@@ -1112,14 +1111,15 @@ unlock:* verify a response */ static int rxkad_verify_response (struct rxrpc_connection *conn, -struct sk_buff *skb) +struct sk_buff *skb, +void *buffer,unsigned int len) {struct rxkad_response *response;struct rxrpc_skb_priv *sp =rxrpc_skb (skb);struct rxrpc_crypt session_key;struct key *server_key;time64_t expiry; -void *ticket =NULL ; +void *ticket;u32 version, kvno, ticket_len, level;__be32 csum;int ret, i;
@@ -1142,13 +1142,8 @@ static int rxkad_verify_response(struct } } - ret = -ENOMEM ; - response =kzalloc (sizeof (struct rxkad_response ),GFP_NOFS ); -if (!response) - goto error; - -if (skb_copy_bits (skb,sizeof (struct rxrpc_wire_header ), - response,sizeof (*response)) <0 ) { + response = buffer; +if (len <sizeof (*response)) { ret =rxrpc_abort_conn (conn, skb,RXKADPACKETSHORT , -EPROTO , rxkad_abort_resp_short); goto error;
@@ -1160,6 +1155,9 @@ static int rxkad_verify_response(structtrace_rxrpc_rx_response (conn, sp->hdr.serial, version, kvno, ticket_len); + buffer +=sizeof (*response); + len -=sizeof (*response); +if (version !=RXKAD_VERSION ) { ret =rxrpc_abort_conn (conn, skb,RXKADINCONSISTENCY , -EPROTO , rxkad_abort_resp_version);
@@ -1179,13 +1177,8 @@ static int rxkad_verify_response(struct }/* extract the kerberos ticket and decrypt and decode it */ - ret = -ENOMEM ; - ticket =kmalloc (ticket_len,GFP_NOFS ); -if (!ticket) - goto error; - -if (skb_copy_bits (skb,sizeof (struct rxrpc_wire_header ) +sizeof (*response), - ticket, ticket_len) <0 ) { + ticket = buffer; +if (ticket_len > len) { ret =rxrpc_abort_conn (conn, skb,RXKADPACKETSHORT , -EPROTO , rxkad_abort_resp_short_tkt); goto error;
@@ -1265,8 +1258,6 @@ static int rxkad_verify_response(struct ret =rxrpc_get_server_data_key (conn, &session_key, expiry, kvno); error: -kfree (ticket); -kfree (response);key_put (server_key);_leave (" = %d" , ret);return ret;
Greg Kroah-Hartman
maintainerPATCH 288/315 serdev: Provide a bustype shutdown function
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 6d71c62b13c33ea858ab298fe20beaec5736edc7 ]
To prepare serdev driver to migrate away from struct device_driver::shutdown (and then eventually remove that callback) create a serdev driver shutdown callback and migration code to keep the existing behaviour. Note this introduces a warning for each driver at register time that isn't converted yet to that callback.
Stable-dep-of: 375ba7484132 ("Bluetooth: hci_qca: Convert timeout from jiffies to ms")
--- drivers/tty/serdev/core.c | 21 +++++++++++++++++++++ include/linux/serdev.h | 1 + 2 files changed, 22 insertions(+)
drivers/tty/serdev/core.c +21 -0
@@ -414,11 +414,21 @@ static void serdev_drv_remove(struct dev sdrv->remove (to_serdev_device (dev)); } +static void serdev_drv_shutdown (struct device *dev) +{ +const struct serdev_device_driver *sdrv = +to_serdev_device_driver (dev->driver); + +if (dev->driver && sdrv->shutdown) + sdrv->shutdown (to_serdev_device (dev)); +} +static const struct bus_type serdev_bus_type = { .name ="serial" , .match = serdev_device_match, .probe = serdev_drv_probe, .remove = serdev_drv_remove, + .shutdown = serdev_drv_shutdown, };/**
@@ -814,6 +824,14 @@ void serdev_controller_remove(struct ser }EXPORT_SYMBOL_GPL (serdev_controller_remove); +static void serdev_legacy_shutdown (struct serdev_device *serdev) +{ +struct device *dev = &serdev->dev; +struct device_driver *driver = dev->driver; + + driver->shutdown (dev); +} +/** * __serdev_device_driver_register() - Register client driver with serdev core * @sdrv: client driver to be associated with client-device.
@@ -830,6 +848,9 @@ int __serdev_device_driver_register(stru/* force drivers to async probe so I/O is possible in probe */ sdrv->driver.probe_type =PROBE_PREFER_ASYNCHRONOUS ; +if (!sdrv->shutdown && sdrv->driver.shutdown) + sdrv->shutdown = serdev_legacy_shutdown; +return driver_register (&sdrv->driver); }EXPORT_SYMBOL_GPL (__serdev_device_driver_register);
include/linux/serdev.h +1 -0
@@ -65,6 +65,7 @@ struct serdev_device_driver {struct device_driver driver;int (*probe)(struct serdev_device *);void (*remove)(struct serdev_device *); +void (*shutdown)(struct serdev_device *); };static inline struct serdev_device_driver *to_serdev_device_driver (struct device_driver *d)
Greg Kroah-Hartman
maintainerPATCH 289/315 Bluetooth: hci_qca: Migrate to serdev specific shutdown function
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 12a6a5726c515455935982429ac35dee2307233d ]
This saves a cast in the driver. The motivation is stop using the callback .shutdown in qca_serdev_driver.driver to make it possible to drop that.
Stable-dep-of: 375ba7484132 ("Bluetooth: hci_qca: Convert timeout from jiffies to ms")
--- drivers/bluetooth/hci_qca.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_qca.c +2 -3
@@ -2567,11 +2567,10 @@ static void qca_serdev_remove(struct serhci_uart_unregister_device (&qcadev->serdev_hu); } -static void qca_serdev_shutdown (struct device *dev) +static void qca_serdev_shutdown (struct serdev_device *serdev) {int ret;int timeout =msecs_to_jiffies (CMD_TRANS_TIMEOUT_MS ); -struct serdev_device *serdev =to_serdev_device (dev);struct qca_serdev *qcadev =serdev_device_get_drvdata (serdev);struct hci_uart *hu = &qcadev->serdev_hu;struct hci_dev *hdev = hu->hdev;
@@ -2793,11 +2792,11 @@ static void hciqca_coredump(struct devicstatic struct serdev_device_driver qca_serdev_driver = { .probe = qca_serdev_probe, .remove = qca_serdev_remove, + .shutdown = qca_serdev_shutdown, .driver = { .name ="hci_uart_qca" , .of_match_table =of_match_ptr (qca_bluetooth_of_match), .acpi_match_table =ACPI_PTR (qca_bluetooth_acpi_match), - .shutdown = qca_serdev_shutdown, .pm = &qca_pm_ops, #ifdef CONFIG_DEV_COREDUMP .coredump = hciqca_coredump,
Greg Kroah-Hartman
maintainerPATCH 290/315 Bluetooth: hci_qca: Convert timeout from jiffies to ms
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Zhang <[email protected]>
[ Upstream commit 375ba7484132662a4a8c7547d088fb6275c00282 ]
Since the timer uses jiffies as its unit rather than ms, the timeout value must be converted from ms to jiffies when configuring the timer. Otherwise, the intended 8s timeout is incorrectly set to approximately 33s.
To improve readability, embed msecs_to_jiffies() directly in the macro definitions and drop the _MS suffix from macros that now yield jiffies
values: MEMDUMP_TIMEOUT, FW_DOWNLOAD_TIMEOUT, IBS_DISABLE_SSR_TIMEOUT, CMD_TRANS_TIMEOUT, and IBS_BTSOC_TX_IDLE_TIMEOUT.
IBS_WAKE_RETRANS_TIMEOUT_MS and IBS_HOST_TX_IDLE_TIMEOUT_MS are intentionally left unchanged. Their values are stored in the struct fields wake_retrans and tx_idle_delay, which hold ms values at runtime and can be modified via debugfs. The msecs_to_jiffies() conversion happens at each call site against the field value, so it cannot be embedded in the macro.
Wake timer depends on commit c347ca17d62a
--- drivers/bluetooth/hci_qca.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/bluetooth/hci_qca.c +16 -17
@@ -48,13 +48,12 @@#define HCI_MAX_IBS_SIZE 10#define IBS_WAKE_RETRANS_TIMEOUT_MS 100 -#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS 200 +#define IBS_BTSOC_TX_IDLE_TIMEOUT msecs_to_jiffies(200)#define IBS_HOST_TX_IDLE_TIMEOUT_MS 2000 -#define CMD_TRANS_TIMEOUT_MS 100 -#define MEMDUMP_TIMEOUT_MS 8000 -#define IBS_DISABLE_SSR_TIMEOUT_MS \ - (MEMDUMP_TIMEOUT_MS + FW_DOWNLOAD_TIMEOUT_MS) -#define FW_DOWNLOAD_TIMEOUT_MS 3000 +#define CMD_TRANS_TIMEOUT msecs_to_jiffies(100) +#define MEMDUMP_TIMEOUT msecs_to_jiffies(8000) +#define FW_DOWNLOAD_TIMEOUT msecs_to_jiffies(3000) +#define IBS_DISABLE_SSR_TIMEOUT (MEMDUMP_TIMEOUT + FW_DOWNLOAD_TIMEOUT)/* susclk rate */ #define SUSCLK_RATE_32KHZ 32768
@@ -1091,7 +1090,7 @@ static void qca_controller_memdump(strucqueue_delayed_work (qca->workqueue, &qca->ctrl_memdump_timeout, -msecs_to_jiffies (MEMDUMP_TIMEOUT_MS )); +MEMDUMP_TIMEOUT );skb_pull (skb,sizeof (qca_memdump->ram_dump_size)); qca_memdump->current_seq_no =0 ; qca_memdump->received_dump =0 ;
@@ -1364,7 +1363,7 @@ static int qca_set_baudrate(struct hci_dif (hu->serdev)serdev_device_wait_until_sent (hu->serdev, -msecs_to_jiffies (CMD_TRANS_TIMEOUT_MS )); +CMD_TRANS_TIMEOUT );/* Give the controller time to process the request */ switch (qca_soc_type (hu)) {
@@ -1396,8 +1395,8 @@ static inline void host_set_baudrate(strstatic int qca_send_power_pulse (struct hci_uart *hu,bool on) { +int timeout =CMD_TRANS_TIMEOUT ;int ret; -int timeout =msecs_to_jiffies (CMD_TRANS_TIMEOUT_MS );u8 cmd = on ?QCA_WCN3990_POWERON_PULSE :QCA_WCN3990_POWEROFF_PULSE ;/* These power pulses are single byte command which are sent
@@ -1602,7 +1601,7 @@ static void qca_wait_for_dump_collectionstruct qca_data *qca = hu->priv;wait_on_bit_timeout (&qca->flags,QCA_MEMDUMP_COLLECTION , -TASK_UNINTERRUPTIBLE ,MEMDUMP_TIMEOUT_MS ); +TASK_UNINTERRUPTIBLE ,MEMDUMP_TIMEOUT );clear_bit (QCA_MEMDUMP_COLLECTION , &qca->flags); }
@@ -2570,7 +2569,7 @@ static void qca_serdev_remove(struct serstatic void qca_serdev_shutdown (struct serdev_device *serdev) {int ret; -int timeout =msecs_to_jiffies (CMD_TRANS_TIMEOUT_MS ); +int timeout =CMD_TRANS_TIMEOUT ;struct qca_serdev *qcadev =serdev_device_get_drvdata (serdev);struct hci_uart *hu = &qcadev->serdev_hu;struct hci_dev *hdev = hu->hdev;
@@ -2627,7 +2626,7 @@ static int __maybe_unused qca_suspend(stbool tx_pending = false;int ret =0 ;u8 cmd; -u32 wait_timeout =0 ; +unsigned long wait_timeout =0 ;set_bit (QCA_SUSPENDING , &qca->flags);
@@ -2648,15 +2647,15 @@ static int __maybe_unused qca_suspend(stif (test_bit (QCA_IBS_DISABLED , &qca->flags) ||test_bit (QCA_SSR_TRIGGERED , &qca->flags)) { wait_timeout =test_bit (QCA_SSR_TRIGGERED , &qca->flags) ? -IBS_DISABLE_SSR_TIMEOUT_MS : -FW_DOWNLOAD_TIMEOUT_MS ; +IBS_DISABLE_SSR_TIMEOUT : +FW_DOWNLOAD_TIMEOUT ;/* QCA_IBS_DISABLED flag is set to true, During FW download * and during memory dump collection. It is reset to false, * After FW download complete. */ wait_on_bit_timeout (&qca->flags,QCA_IBS_DISABLED , -TASK_UNINTERRUPTIBLE ,msecs_to_jiffies (wait_timeout)); +TASK_UNINTERRUPTIBLE , wait_timeout);if (test_bit (QCA_IBS_DISABLED , &qca->flags)) {bt_dev_err (hu->hdev,"SSR or FW download time out" );
@@ -2708,7 +2707,7 @@ static int __maybe_unused qca_suspend(stif (tx_pending) {serdev_device_wait_until_sent (hu->serdev, -msecs_to_jiffies (CMD_TRANS_TIMEOUT_MS )); +CMD_TRANS_TIMEOUT );serial_clock_vote (HCI_IBS_TX_VOTE_CLOCK_OFF , hu); }
@@ -2717,7 +2716,7 @@ static int __maybe_unused qca_suspend(st*/ ret =wait_event_interruptible_timeout (qca->suspend_wait_q, qca->rx_ibs_state ==HCI_IBS_RX_ASLEEP , -msecs_to_jiffies (IBS_BTSOC_TX_IDLE_TIMEOUT_MS )); +IBS_BTSOC_TX_IDLE_TIMEOUT );if (ret ==0 ) { ret = -ETIMEDOUT ; goto error;
Greg Kroah-Hartman
maintainerPATCH 291/315 selftests: mptcp: drop nanoseconds width specifier
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Matthieu Baerts (NGI0)" <[email protected]>
[ Upstream commit 01ff78e4b3d98689184c52d97f9575dfbdc3b10f ]
Using the format specifier +%s%3N with GNU date is honoured, and only prints 3 digits of the nanoseconds portion of the seconds since epoch, which corresponds to the milliseconds.
The uutils implementation of date currently does not honour this, and always prints all 9 digits. This is a known issue [1], but can be worked around by adapting this test to use nanoseconds instead of microseconds, and then divide it by 1e6.
This fix is similar to what has been done on systemd side [2], and it is needed to run the selftests on Ubuntu 26.04, containing uutils 0.8.0.
Note that the Fixes tag is there even if this patch doesn't fix an issue in the kernel selftests, but it is useful for those using uutils 0.8.0.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 6 +++--- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +3 -3
@@ -415,7 +415,7 @@ do_transfer() mptcp_lib_wait_local_port_listen "${listener_ns}" "${port}" local start - start=$(date +%s%3N) + start=$(date +%s%N) timeout ${timeout_test} \ ip netns exec ${connector_ns} \ ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
@@ -428,7 +428,7 @@ do_transfer() local rets=$? local stop - stop=$(date +%s%3N) + stop=$(date +%s%N) if $capture; then sleep 1
@@ -444,7 +444,7 @@ do_transfer() fi local duration - duration=$((stop-start)) + duration=$(((stop-start) / 1000000)) printf "(duration %05sms) " "${duration}" if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then mptcp_lib_pr_fail "client exit code $retc, server $rets"
tools/testing/selftests/net/mptcp/mptcp_lib.sh +5 -5
@@ -28,7 +28,7 @@ declare -rx MPTCP_LIB_AF_INET6=10 MPTCP_LIB_SUBTESTS=() MPTCP_LIB_SUBTESTS_DUPLICATED=0 MPTCP_LIB_SUBTEST_FLAKY=0 -MPTCP_LIB_SUBTESTS_LAST_TS_MS= +MPTCP_LIB_SUBTESTS_LAST_TS_NS= MPTCP_LIB_TEST_COUNTER=0 MPTCP_LIB_TEST_FORMAT="%02u %-50s" MPTCP_LIB_IP_MPTCP=0
@@ -227,7 +227,7 @@ mptcp_lib_kversion_ge() { } mptcp_lib_subtests_last_ts_reset() { - MPTCP_LIB_SUBTESTS_LAST_TS_MS="$(date +%s%3N)" + MPTCP_LIB_SUBTESTS_LAST_TS_NS="$(date +%s%N)" } mptcp_lib_subtests_last_ts_reset
@@ -246,7 +246,7 @@ __mptcp_lib_result_check_duplicated() { __mptcp_lib_result_add() { local result="${1}" local time="time=" - local ts_prev_ms + local ts_prev_ns shift local id=$((${#MPTCP_LIB_SUBTESTS[@]} + 1))
@@ -256,9 +256,9 @@ __mptcp_lib_result_add() { # not to add two '#' [[ "${*}" != *"#"* ]] && time="# ${time}" - ts_prev_ms="${MPTCP_LIB_SUBTESTS_LAST_TS_MS}" + ts_prev_ns="${MPTCP_LIB_SUBTESTS_LAST_TS_NS}" mptcp_lib_subtests_last_ts_reset - time+="$((MPTCP_LIB_SUBTESTS_LAST_TS_MS - ts_prev_ms))ms" + time+="$(((MPTCP_LIB_SUBTESTS_LAST_TS_NS - ts_prev_ns) / 1000000))ms" MPTCP_LIB_SUBTESTS+=("${result} ${id} - ${KSFT_TEST}: ${*} ${time}") }
Greg Kroah-Hartman
maintainerPATCH 292/315 net: devmem: reject dma-buf bind with non-page-aligned size or SG length
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Carlier <[email protected]>
[ Upstream commit 4eb82ba543421e9e38cc14e4e82058b78850df50 ]
net_devmem_bind_dmabuf() trusts dmabuf->size and sg_dma_len() to be PAGE_SIZE multiples without checking:
- tx_vec is sized dmabuf->size / PAGE_SIZE, and net_devmem_get_niov_at() only bounds-checks virt_addr < dmabuf->size before indexing tx_vec[virt_addr / PAGE_SIZE]. With size = N*PAGE_SIZE + r (1 <= r < PAGE_SIZE), sendmsg() at iov_base = N*PAGE_SIZE passes the bound check and reads tx_vec[N] -- one past.
- owner->area.num_niovs = len / PAGE_SIZE while gen_pool_add_owner() covers the full byte len, so a non-page-multiple non-final sg desyncs num_niovs from the gen_pool region for every later sg, on both RX and TX.
dma-buf does not require page-aligned sizes, so the bind path has to enforce what its own indexing assumes. Reject both with -EINVAL.
The size check is TX-only (only tx_vec is sized off dmabuf->size); the SG-length check covers both directions.
--- net/core/devmem.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/core/devmem.c +11 -0
@@ -232,6 +232,11 @@ net_devmem_bind_dmabuf(struct net_device }if (direction ==DMA_TO_DEVICE ) { +if (!IS_ALIGNED (dmabuf->size,PAGE_SIZE )) { + err = -EINVAL ; +NL_SET_ERR_MSG (extack,"TX dma-buf size must be a multiple of PAGE_SIZE" ); + goto err_unmap; + } binding->tx_vec =kvmalloc_array (dmabuf->size /PAGE_SIZE ,sizeof (struct net_iov *),GFP_KERNEL );
@@ -259,6 +264,12 @@ net_devmem_bind_dmabuf(struct net_devicesize_t len =sg_dma_len (sg);struct net_iov *niov; +if (!IS_ALIGNED (len,PAGE_SIZE )) { + err = -EINVAL ; +NL_SET_ERR_MSG (extack,"dma-buf SG length must be PAGE_SIZE aligned" ); + goto err_free_chunks; + } + owner =kzalloc_node (sizeof (*owner),GFP_KERNEL ,dev_to_node (&dev->dev));if (!owner) {
Greg Kroah-Hartman
maintainerPATCH 293/315 mptcp: handle first subflow closing consistently
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 0eeb372deebce6c25b9afc09e35d6c75a744299a ]
Currently, as soon as the PM closes a subflow, the msk stops accepting data from it, even if the TCP socket could be still formally open in the incoming direction, with the notable exception of the first subflow.
The root cause of such behavior is that code currently piggy back two separate semantic on the subflow->disposable bit: the subflow context must be released and that the subflow must stop accepting incoming data.
The first subflow is never disposed, so it also never stop accepting incoming data. Use a separate bit to mark the latter status and set such bit in __mptcp_close_ssk() for all subflows.
Beyond making per subflow behaviour more consistent this will also simplify the next patch.
Stable-dep-of: 50c2d91c5dfa ("mptcp: do not drop partial packets")
--- net/mptcp/protocol.c | 14 +++++++++----- net/mptcp/protocol.h | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-)
net/mptcp/protocol.c +9 -5
@@ -854,10 +854,10 @@ void mptcp_data_ready(struct sock *sk, sstruct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk);/* The peer can send data while we are shutting down this -* subflow at msk destruction time, but we must avoid enqueuing +* subflow at subflow destruction time, but we must avoid enqueuing * more data to the msk receive queue */ -if (unlikely (subflow->disposable)) +if (unlikely (subflow->closing))return ;mptcp_data_lock (sk);
@@ -2455,6 +2455,13 @@ static void __mptcp_close_ssk(struct socstruct mptcp_sock *msk =mptcp_sk (sk);bool dispose_it, need_push = false; +/* Do not pass RX data to the msk, even if the subflow socket is not +* going to be freed (i.e. even for the first subflow on graceful +* subflow close. +*/ +lock_sock_nested (ssk,SINGLE_DEPTH_NESTING ); + subflow->closing =1 ; +/* If the first subflow moved to a close state before accept, e.g. due * to an incoming reset or listener shutdown, the subflow socket is * already deleted by inet_child_forget() and the mptcp socket can't
@@ -2465,7 +2472,6 @@ static void __mptcp_close_ssk(struct soc/* ensure later check in mptcp_worker() will dispose the msk */ sock_set_flag (sk,SOCK_DEAD );mptcp_set_close_tout (sk, tcp_jiffies32 - (mptcp_close_timeout (sk) +1 )); -lock_sock_nested (ssk,SINGLE_DEPTH_NESTING );mptcp_subflow_drop_ctx (ssk); goto out_release; }
@@ -2474,8 +2480,6 @@ static void __mptcp_close_ssk(struct socif (dispose_it)list_del (&subflow->node); -lock_sock_nested (ssk,SINGLE_DEPTH_NESTING ); -if (subflow->send_fastclose && ssk->sk_state !=TCP_CLOSE )tcp_set_state (ssk,TCP_CLOSE );
net/mptcp/protocol.h +2 -1
@@ -537,12 +537,13 @@ struct mptcp_subflow_context { send_infinite_map : 1, remote_key_valid : 1, /* received the peer key from */ disposable : 1, /* ctx can be free at ulp release time */ + closing : 1, /* must not pass rx data to msk anymore */ stale : 1, /* unable to snd/rcv data, do not use for xmit */ valid_csum_seen : 1, /* at least one csum validated */ is_mptfo : 1, /* subflow is doing TFO */ close_event_done : 1, /* has done the post-closed part */ mpc_drop : 1, /* the MPC option has been dropped in a rtx */ - __unused : 9; + __unused : 8;bool data_avail;bool scheduled;bool pm_listener;/* a listener managed by the kernel PM? */
Greg Kroah-Hartman
maintainerPATCH 294/315 mptcp: borrow forward memory from subflow
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 9db5b3cec4ec1c0cd3239689f5c8653d691a1754 ]
In the MPTCP receive path, we release the subflow allocated fwd memory just to allocate it again shortly after for the msk.
That could increases the failures chances, especially when we will add backlog processing, with other actions could consume the just released memory before the msk socket has a chance to do the rcv allocation.
Replace the skb_orphan() call with an open-coded variant that explicitly borrows, the fwd memory from the subflow socket instead of releasing it.
The borrowed memory does not have PAGE_SIZE granularity; rounding to the page size will make the fwd allocated memory higher than what is strictly required and could make the incoming subflow fwd mem consistently negative. Instead, keep track of the accumulated frag and borrow the full page at subflow close time.
This allow removing the last drop in the TCP to MPTCP transition and the associated, now unused, MIB.
Stable-dep-of: 50c2d91c5dfa ("mptcp: do not drop partial packets")
--- net/mptcp/fastopen.c | 4 +++- net/mptcp/mib.c | 1 - net/mptcp/mib.h | 1 - net/mptcp/protocol.c | 23 +++++++++++++++-------- net/mptcp/protocol.h | 28 ++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 11 deletions(-)
net/mptcp/fastopen.c +3 -1
@@ -33,7 +33,8 @@ void mptcp_fastopen_subflow_synack_set_p/* dequeue the skb from sk receive queue */ __skb_unlink (skb, &ssk->sk_receive_queue);skb_ext_reset (skb); -skb_orphan (skb); + +mptcp_subflow_lend_fwdmem (subflow, skb);/* We copy the fastopen data, but that don't belong to the mptcp sequence * space, need to offset it in the subflow sequence, see mptcp_subflow_get_map_offset()
@@ -52,6 +53,7 @@ void mptcp_fastopen_subflow_synack_set_pmptcp_data_lock (sk);DEBUG_NET_WARN_ON_ONCE (sock_owned_by_user_nocheck (sk)); +mptcp_borrow_fwdmem (sk, skb);skb_set_owner_r (skb, sk);__skb_queue_tail (&sk->sk_receive_queue, skb);mptcp_sk (sk)->bytes_received += skb->len;
net/mptcp/mib.c +0 -1
@@ -71,7 +71,6 @@ static const struct snmp_mib mptcp_snmp_SNMP_MIB_ITEM ("MPFastcloseRx" ,MPTCP_MIB_MPFASTCLOSERX ),SNMP_MIB_ITEM ("MPRstTx" ,MPTCP_MIB_MPRSTTX ),SNMP_MIB_ITEM ("MPRstRx" ,MPTCP_MIB_MPRSTRX ), -SNMP_MIB_ITEM ("RcvPruned" ,MPTCP_MIB_RCVPRUNED ),SNMP_MIB_ITEM ("SubflowStale" ,MPTCP_MIB_SUBFLOWSTALE ),SNMP_MIB_ITEM ("SubflowRecover" ,MPTCP_MIB_SUBFLOWRECOVER ), SNMP_MIB_ITEM("SndWndShared", MPTCP_MIB_SNDWNDSHARED),
net/mptcp/mib.h +0 -1
@@ -70,7 +70,6 @@ enum linux_mptcp_mib_field {MPTCP_MIB_MPFASTCLOSERX ,/* Received a MP_FASTCLOSE */ MPTCP_MIB_MPRSTTX ,/* Transmit a MP_RST */ MPTCP_MIB_MPRSTRX ,/* Received a MP_RST */ -MPTCP_MIB_RCVPRUNED ,/* Incoming packet dropped due to memory limit */ MPTCP_MIB_SUBFLOWSTALE ,/* Subflows entered 'stale' status */ MPTCP_MIB_SUBFLOWRECOVER ,/* Subflows returned to active status after being stale */ MPTCP_MIB_SNDWNDSHARED, /* Subflow snd wnd is overridden by msk's one */
net/mptcp/protocol.c +15 -8
@@ -352,7 +352,7 @@ end:static void mptcp_init_skb (struct sock *ssk,struct sk_buff *skb,int offset,int copy_len) { -const struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk); +struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk);bool has_rxtstamp =TCP_SKB_CB (skb)->has_rxtstamp;/* the skb map_seq accounts for the skb offset:
@@ -377,11 +377,7 @@ static bool __mptcp_move_skb(struct sockstruct mptcp_sock *msk =mptcp_sk (sk);struct sk_buff *tail; -/* try to fetch required memory from subflow */ -if (!sk_rmem_schedule (sk, skb, skb->truesize)) { -MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_RCVPRUNED ); - goto drop; - } +mptcp_borrow_fwdmem (sk, skb);if (MPTCP_SKB_CB (skb)->map_seq == msk->ack_seq) {/* in sequence */
@@ -403,7 +399,6 @@ static bool __mptcp_move_skb(struct sock* will retransmit as needed, if needed. */ MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_DUPDATA ); -drop:mptcp_drop (sk, skb);return false; }
@@ -704,7 +699,7 @@ static bool __mptcp_move_skbs_from_subflsize_t len = skb->len - offset;mptcp_init_skb (ssk, skb, offset, len); -skb_orphan (skb); +mptcp_subflow_lend_fwdmem (subflow, skb); ret =__mptcp_move_skb (sk, skb) || ret; seq += len;
@@ -2454,6 +2449,7 @@ static void __mptcp_close_ssk(struct soc {struct mptcp_sock *msk =mptcp_sk (sk);bool dispose_it, need_push = false; +int fwd_remaining;/* Do not pass RX data to the msk, even if the subflow socket is not * going to be freed (i.e. even for the first subflow on graceful
@@ -2462,6 +2458,17 @@ static void __mptcp_close_ssk(struct soclock_sock_nested (ssk,SINGLE_DEPTH_NESTING ); subflow->closing =1 ; +/* Borrow the fwd allocated page left-over; fwd memory for the subflow +* could be negative at this point, but will be reach zero soon - when +* the data allocated using such fragment will be freed. +*/ +if (subflow->lent_mem_frag) { + fwd_remaining =PAGE_SIZE - subflow->lent_mem_frag; +sk_forward_alloc_add (sk, fwd_remaining); +sk_forward_alloc_add (ssk, -fwd_remaining); + subflow->lent_mem_frag =0 ; + } +/* If the first subflow moved to a close state before accept, e.g. due * to an incoming reset or listener shutdown, the subflow socket is * already deleted by inet_child_forget() and the mptcp socket can't
net/mptcp/protocol.h +28 -0
@@ -548,6 +548,7 @@ struct mptcp_subflow_context {bool scheduled;bool pm_listener;/* a listener managed by the kernel PM? */ bool fully_established;/* path validated */ +u32 lent_mem_frag;u32 remote_nonce;u64 thmac;u32 local_nonce;
@@ -647,6 +648,33 @@ mptcp_send_active_reset_reason(struct sotcp_send_active_reset (sk,GFP_ATOMIC , reason); } +/* Made the fwd mem carried by the given skb available to the msk, +* To be paired with a previous mptcp_subflow_lend_fwdmem() before freeing +* the skb or setting the skb ownership. +*/ +static inline void mptcp_borrow_fwdmem (struct sock *sk,struct sk_buff *skb) +{ +struct sock *ssk = skb->sk; + +/* The subflow just lend the skb fwd memory, and we know that the skb +* is only accounted on the incoming subflow rcvbuf. +*/ +DEBUG_NET_WARN_ON_ONCE (skb->destructor); + skb->sk =NULL ; +sk_forward_alloc_add (sk, skb->truesize); +atomic_sub (skb->truesize, &ssk->sk_rmem_alloc); +} + +static inline void +mptcp_subflow_lend_fwdmem (struct mptcp_subflow_context *subflow, +struct sk_buff *skb) +{ +int frag = (subflow->lent_mem_frag + skb->truesize) & (PAGE_SIZE -1 ); + + skb->destructor =NULL ; + subflow->lent_mem_frag = frag; +} +static inline u64 mptcp_subflow_get_map_offset (const struct mptcp_subflow_context *subflow) {
Greg Kroah-Hartman
maintainerPATCH 295/315 mptcp: do not drop partial packets
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shardul Bankar <[email protected]>
[ Upstream commit 50c2d91c5dfa0e465826ec1f8dbad9cdc254bd85 ]
When a packet arrives with map_seq < ack_seq < end_seq, the beginning of the packet has already been acknowledged but the end contains new data. Currently the entire packet is dropped as "old data," forcing the sender to retransmit.
Instead, skip the already-acked bytes by adjusting the skb offset and enqueue only the new portion. Update bytes_received and ack_seq to reflect the new data consumed.
A previous attempt at this fix has been sent by Paolo Abeni [1], but had issues [2]: it also added a zero-window check and changed rcv_wnd_sent initialization, which caused test regressions. This version addresses only the partial packet handling without modifying receive window accounting.
--- net/mptcp/protocol.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
net/mptcp/protocol.c +19 -5
@@ -395,12 +395,26 @@ static bool __mptcp_move_skb(struct sockreturn false; } -/* old data, keep it simple and drop the whole pkt, sender -* will retransmit as needed, if needed. +/* Completely old data? */ +if (!after64 (MPTCP_SKB_CB (skb)->end_seq, msk->ack_seq)) { +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_DUPDATA ); +mptcp_drop (sk, skb); +return false; + } + +/* Partial packet: map_seq < ack_seq < end_seq. +* Skip the already-acked bytes and enqueue the new data. */ -MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_DUPDATA ); -mptcp_drop (sk, skb); -return false; + copy_len =MPTCP_SKB_CB (skb)->end_seq - msk->ack_seq; +MPTCP_SKB_CB (skb)->offset += msk->ack_seq -MPTCP_SKB_CB (skb)->map_seq; +MPTCP_SKB_CB (skb)->map_seq += msk->ack_seq - +MPTCP_SKB_CB (skb)->map_seq; + msk->bytes_received += copy_len; +WRITE_ONCE (msk->ack_seq, msk->ack_seq + copy_len); + +skb_set_owner_r (skb, sk); +__skb_queue_tail (&sk->sk_receive_queue, skb); +return true; }static void mptcp_stop_rtx_timer (struct sock *sk)
Greg Kroah-Hartman
maintainerPATCH 296/315 arm64: tlb: Flush walk cache when unsharing PMD tables
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zeng Heng <[email protected]>
[ Upstream commit c2ff4764e03e7a8d758352f4aceb8fe1be6ac971 ]
When huge_pmd_unshare() is called to unshare a PMD table, the tlb_unshare_pmd_ptdesc() function sets tlb->unshared_tables=true but the aarch64 tlb_flush() only checked tlb->freed_tables to determine whether to use TLBF_NONE (vae1is, invalidates walk cache) or TLBF_NOWALKCACHE (vale1is, leaf-only).
This caused the stale PMD page table entry to remain in the walk cache after unshare, potentially leading to incorrect page table walks.
Fix by including unshared_tables in the check, so that when unsharing tables, TLBF_NONE is used and the walk cache is properly invalidated.
Here is the detailed distinction between vae1is and vale1is:
| Instruction Combination | Actual Invalidation Scope | | ------------------------ | --------------------------------------------------| | `VAE1IS` + TTL=`0` | All entries at all levels (full invalidation) | | `VAE1IS` + TTL=`2` (L2) | Non-leaf at Level 0/1 + leaf at Level 2 | | `VALE1IS` + TTL=`0` | Leaf entries at all levels (non-leaf not cleared) | | `VALE1IS` + TTL=`2` (L2) | Leaf entry at Level 2 only |
--- arch/arm64/include/asm/tlb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/tlb.h +1 -1
@@ -53,7 +53,7 @@ static inline int tlb_get_level(struct mstatic inline void tlb_flush (struct mmu_gather *tlb) {struct vm_area_struct vma =TLB_FLUSH_VMA (tlb->mm,0 ); -bool last_level = !tlb->freed_tables; +bool last_level = !(tlb->freed_tables || tlb->unshared_tables);unsigned long stride =tlb_get_unmap_size (tlb);int tlb_level =tlb_get_level (tlb);
Greg Kroah-Hartman
maintainerPATCH 297/315 octeontx2-pf: avoid double free of pool->stack on AQ init failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dawei Feng <[email protected]>
[ Upstream commit 9b244c242bec48b37e82b89787afd6a4c43457e1 ]
otx2_pool_aq_init() frees pool->stack when mailbox sync or retry allocation fails, but leaves the pointer unchanged. Later, otx2_sq_aura_pool_init() unwinds the partial setup through otx2_aura_pool_free(), which frees pool->stack again. The CN20K-specific cn20k_pool_aq_init() implementation has the same bug in
its corresponding error path.
Set pool->stack to NULL immediately after the local free so the shared cleanup path does not free the same stack again while cleaning up partially initialized pool state.
The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1-rc3.
Runtime validation was not performed because reproducing this path requires OcteonTX2/CN20K hardware.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +2 -0
@@ -1468,11 +1468,13 @@ int otx2_pool_init(struct otx2_nic *pfvf err =otx2_sync_mbox_msg (&pfvf->mbox);if (err) {qmem_free (pfvf->dev, pool->stack); + pool->stack =NULL ;return err; } aq =otx2_mbox_alloc_msg_npa_aq_enq (&pfvf->mbox);if (!aq) {qmem_free (pfvf->dev, pool->stack); + pool->stack =NULL ;return -ENOMEM ; } }
Greg Kroah-Hartman
maintainerPATCH 298/315 mptcp: cleanup fallback dummy mapping generation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 2834f8edd74d5dda368087a654c0e52b141e9893 ]
MPTCP currently access ack_seq outside the msk socket log scope to generate the dummy mapping for fallback socket. Soon we are going to introduce backlog usage and even for fallback socket the ack_seq value will be significantly off outside of the msk socket lock scope.
Avoid relying on ack_seq for dummy mapping generation, using instead the subflow sequence number. Note that in case of disconnect() and (re)connect() we must ensure that any previous state is re-set.
Stable-dep-of: 0981f90e1a05 ("mptcp: reset rcv wnd on disconnect")
--- net/mptcp/protocol.c | 3 +++ net/mptcp/subflow.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +3 -0
@@ -3333,6 +3333,9 @@ static int mptcp_disconnect(struct sock msk->rcvspace_init =0 ; msk->fastclosing =0 ; +/* for fallback's sake */ +WRITE_ONCE (msk->ack_seq,0 ); +WRITE_ONCE (sk->sk_shutdown,0 );sk_error_report (sk);return 0 ;
net/mptcp/subflow.c +7 -1
@@ -491,6 +491,9 @@ static void subflow_set_remote_key(strucmptcp_crypto_key_sha (subflow->remote_key,NULL , &subflow->iasn); subflow->iasn++; +/* for fallback's sake */ + subflow->map_seq = subflow->iasn; +WRITE_ONCE (msk->remote_key, subflow->remote_key);WRITE_ONCE (msk->ack_seq, subflow->iasn);WRITE_ONCE (msk->can_ack, true);
@@ -1435,9 +1438,12 @@ reset: skb =skb_peek (&ssk->sk_receive_queue); subflow->map_valid =1 ; - subflow->map_seq =READ_ONCE (msk->ack_seq); subflow->map_data_len = skb->len; subflow->map_subflow_seq =tcp_sk (ssk)->copied_seq - subflow->ssn_offset; + subflow->map_seq =__mptcp_expand_seq (subflow->map_seq, + subflow->iasn + +TCP_SKB_CB (skb)->seq - + subflow->ssn_offset -1 );WRITE_ONCE (subflow->data_avail, true);return true; }
Greg Kroah-Hartman
maintainerPATCH 299/315 mptcp: reset rcv wnd on disconnect
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 0981f90e1a05773a4c29c6e720f5ea1e3c8f1876 ]
If the MPTCP socket fallback to TCP before the MP handshake completion, the IASN remain 0, and the rcv_wnd_sent field is not explicitly initialized, just incremented over time with the data transfer.
At disconnect time such value is not cleared. If the next connection falls back to TCP before the MP handshake completion, the data transfer will keep incrementing the receive window end sequence starting from the last value used in the previous connection: the announced window will be unrelated from the actual receiver buffer size and likely too big.
Address the issue zeroing the field at disconnect time.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -3335,6 +3335,7 @@ static int mptcp_disconnect(struct sock/* for fallback's sake */ WRITE_ONCE (msk->ack_seq,0 ); +atomic64_set (&msk->rcv_wnd_sent,0 );WRITE_ONCE (sk->sk_shutdown,0 );sk_error_report (sk);
Greg Kroah-Hartman
maintainerPATCH 300/315 cpufreq: intel_pstate: Add and use hybrid_get_cpu_type()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 528dde6619677ac6dc26d9dda1e3c9014b4a08c8 ]
Introduce a function for identifying the type of a given CPU in a hybrid system, called hybrid_get_cpu_type(), and use if for hybrid scaling factor determination in hwp_get_cpu_scaling().
Stable-dep-of: 0e7c710478b3 ("cpufreq: intel_pstate: Use correct scaling factor on Raptor Lake-E")
--- drivers/cpufreq/intel_pstate.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/cpufreq/intel_pstate.c +7 -6
@@ -909,6 +909,11 @@ static struct freq_attr *hwp_cpufreq_att [HWP_CPUFREQ_ATTR_COUNT] = NULL, }; +static u8 hybrid_get_cpu_type (unsigned int cpu) +{ +return cpu_data (cpu).topo.intel_type; +} +static bool no_cas__ro_after_init ;static struct cpudata *hybrid_max_perf_cpu__read_mostly ;
@@ -2299,18 +2304,14 @@ static int knl_get_turbo_pstate(int cpu)static int hwp_get_cpu_scaling (int cpu) {if (hybrid_scaling_factor) { -struct cpuinfo_x86 *c = &cpu_data (cpu); -u8 cpu_type = c->topo.intel_type; -/* * Return the hybrid scaling factor for P-cores and use the * default core scaling for E-cores. */ -if (cpu_type ==INTEL_CPU_TYPE_CORE ) +if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE )return hybrid_scaling_factor; -if (cpu_type ==INTEL_CPU_TYPE_ATOM ) -return core_get_scaling (); +return core_get_scaling (); }/* Use core scaling on non-hybrid systems. */
Greg Kroah-Hartman
maintainerPATCH 301/315 cpufreq: intel_pstate: Use correct scaling factor on Raptor Lake-E
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 0e7c710478b3089cdfe8669347f77b163e836c4f ]
Raptor Lake-E has the same processor ID as Raptor Lake-S, so there is an entry in intel_hybrid_scaling_factor[] for it. It does not contain E-cores though and hybrid_get_cpu_type() returns 0 for its P-cores, so they get the default "core" scaling factor. However, the original Raptor Lake scaling factor for P-cores still needs to be used for mapping the HWP performance levels of the P-cores in Raptor Lake-E to frequency, as though they were part of a real hybrid system.
To address this, update hwp_get_cpu_scaling() to return hybrid_scaling_factor, which is the P-core scaling factor retrieved from intel_hybrid_scaling_factor[], for all CPUs that are not enumerated as E-cores.
--- drivers/cpufreq/intel_pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +1 -1
@@ -2308,7 +2308,7 @@ static int hwp_get_cpu_scaling(int cpu)* Return the hybrid scaling factor for P-cores and use the * default core scaling for E-cores. */ -if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE ) +if (hybrid_get_cpu_type (cpu) !=INTEL_CPU_TYPE_ATOM )return hybrid_scaling_factor;return core_get_scaling ();
Greg Kroah-Hartman
maintainerPATCH 302/315 xfrm: iptfs: reset runtime state when cloning SAs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaomin Chen <[email protected]>
[ Upstream commit 7f83d174073234839aea176f265e517e0d50a1d2 ]
iptfs_clone_state() clones the IPTFS mode data with kmemdup(). This copies runtime objects which must not be shared with the original SA, including the embedded sk_buff_head, hrtimers, spinlock, and in-flight reassembly/reorder state.
If xfrm_state_migrate() fails after clone_state() but before the later init_state() call has reinitialized those fields, the cloned state can be destroyed by xfrm_state_gc_task() with list and timer state copied from the original SA. With queued packets this lets the clone splice and free skbs owned by the original IPTFS queue, leading to use-after-free and double-free reports in iptfs_destroy_state() and skb release paths.
Reinitialize the clone's runtime state before publishing it through x->mode_data. Because clone_state() now publishes a destroyable mode_data object before init_state(), take the mode callback module reference there. Avoid taking it again from __iptfs_init_state() for the same object.
--- net/xfrm/xfrm_iptfs.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
net/xfrm/xfrm_iptfs.c +24 -5
@@ -2650,7 +2650,8 @@ static void __iptfs_init_state(struct xf x->props.enc_hdr_len =sizeof (struct ip_iptfs_hdr );/* Always keep a module reference when x->mode_data is set */ -__module_get (x->mode_cbs->owner); +if (x->mode_data != xtfs) +__module_get (x->mode_cbs->owner); x->mode_data = xtfs; xtfs->x = x;
@@ -2658,22 +2659,40 @@ static void __iptfs_init_state(struct xfstatic int iptfs_clone_state (struct xfrm_state *x,struct xfrm_state *orig) { +struct skb_wseq *w_saved =NULL ;struct xfrm_iptfs_data *xtfs; xtfs =kmemdup (orig->mode_data,sizeof (*xtfs),GFP_KERNEL );if (!xtfs)return -ENOMEM ; - xtfs->ra_newskb =NULL ;if (xtfs->cfg.reorder_win_size) { - xtfs->w_saved =kcalloc (xtfs->cfg.reorder_win_size, -sizeof (*xtfs->w_saved),GFP_KERNEL ); -if (!xtfs->w_saved) { + w_saved =kcalloc (xtfs->cfg.reorder_win_size, +sizeof (*w_saved),GFP_KERNEL ); +if (!w_saved) {kfree_sensitive (xtfs);return -ENOMEM ; } } + xtfs->w_saved = w_saved; +__skb_queue_head_init (&xtfs->queue); + xtfs->queue_size =0 ; +hrtimer_setup (&xtfs->iptfs_timer, iptfs_delay_timer,CLOCK_MONOTONIC , +IPTFS_HRTIMER_MODE ); + +spin_lock_init (&xtfs->drop_lock); +hrtimer_setup (&xtfs->drop_timer, iptfs_drop_timer,CLOCK_MONOTONIC , +IPTFS_HRTIMER_MODE ); + + xtfs->w_seq_set = false; + xtfs->w_wantseq =0 ; + xtfs->w_savedlen =0 ; + xtfs->ra_newskb =NULL ; + xtfs->ra_wantseq =0 ; + xtfs->ra_runtlen =0 ; + +__module_get (x->mode_cbs->owner); x->mode_data = xtfs; xtfs->x = x;
Greg Kroah-Hartman
maintainerPATCH 303/315 usb: dwc3: xilinx: fix error handling in zynqmp init error paths
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <[email protected]>
[ Upstream commit c1a0ecbf32c4b397353204e2ec94c5bb9f3300ed ]
Fix error handling and resource cleanup i.e remove invalid phy_exit() after failed phy_init(), route failures through proper cleanup paths and return 0 explicitly on success.
--- drivers/usb/dwc3/dwc3-xilinx.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/usb/dwc3/dwc3-xilinx.c +15 -12
@@ -190,15 +190,13 @@ static int dwc3_xlnx_init_zynqmp(struct } ret =phy_init (priv_data->usb3_phy); -if (ret <0 ) { -phy_exit (priv_data->usb3_phy); +if (ret <0 ) goto err; - } ret =reset_control_deassert (apbrst);if (ret <0 ) {dev_err (dev,"Failed to release APB reset\n" ); - goto err; + goto err_phy_exit; }/* Set PIPE Power Present signal in FPD Power Present Register*/
@@ -210,27 +208,25 @@ static int dwc3_xlnx_init_zynqmp(struct ret =reset_control_deassert (crst);if (ret <0 ) {dev_err (dev,"Failed to release core reset\n" ); - goto err; + goto err_phy_exit; } ret =reset_control_deassert (hibrst);if (ret <0 ) {dev_err (dev,"Failed to release hibernation reset\n" ); - goto err; + goto err_phy_exit; } ret =phy_power_on (priv_data->usb3_phy); -if (ret <0 ) { -phy_exit (priv_data->usb3_phy); - goto err; - } +if (ret <0 ) + goto err_phy_exit; skip_usb3_phy:/* ulpi reset via gpio-modepin or gpio-framework driver */ reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH );if (IS_ERR (reset_gpio)) { -return dev_err_probe (dev,PTR_ERR (reset_gpio), -"Failed to request reset GPIO\n" ); + ret =PTR_ERR (reset_gpio); + goto err_phy_power_off; }if (reset_gpio) {
@@ -240,6 +236,13 @@ skip_usb3_phy: }dwc3_xlnx_set_coherency (priv_data,XLNX_USB_TRAFFIC_ROUTE_CONFIG ); + +return 0 ; + +err_phy_power_off: +phy_power_off (priv_data->usb3_phy); +err_phy_exit: +phy_exit (priv_data->usb3_phy); err:return ret; }
Greg Kroah-Hartman
maintainerPATCH 304/315 USB: serial: cypress_m8: fix memory corruption with small endpoint
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit e1a9d791fd66ab2431b9e6f6f835823809869047 upstream.
Make sure that the interrupt-out endpoint max packet size is at least eight bytes to avoid user-controlled slab corruption or NULL-pointer dereference should a malicious device report a smaller size.
---
This one should apply to 6.18 and earlier trees that lack kzalloc_obj().
Johan
drivers/usb/serial/cypress_m8.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/serial/cypress_m8.c +8 -0
@@ -445,6 +445,14 @@ static int cypress_generic_port_probe(streturn -ENODEV ; } +/* +* The buffer must be large enough for the one or two-byte header (and +* following data), but assume anything smaller than eight bytes is +* broken. +*/ +if (port->interrupt_out_size <8 ) +return -EINVAL ; + priv =kzalloc (sizeof (struct cypress_private ),GFP_KERNEL );if (!priv)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 305/315 USB: serial: digi_acceleport: fix memory corruption with small endpoints
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit cb3560e8eab1dfa1cac1ed52631adf8ec6ff2cd5 upstream.
Add the missing bulk-out buffer size sanity checks to avoid out-of-bounds memory accesses or slab corruption should a malicious device report smaller buffers than expected.
---
Should apply also to older trees without kzalloc_obj().
Johan
drivers/usb/serial/digi_acceleport.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/usb/serial/digi_acceleport.c +21 -2
@@ -1229,15 +1229,34 @@ static int digi_port_init(struct usb_serstatic int digi_startup (struct usb_serial *serial) {struct digi_serial *serial_priv; +int oob_port_num;int ret; +int i; + +/* +* The port bulk-out buffers must be large enough for header and +* buffered data. +*/ +for (i =0 ; i < serial->type->num_ports; i++) { +if (serial->port[i]->bulk_out_size <DIGI_OUT_BUF_SIZE +2 ) +return -EINVAL ; + } + +/* +* The OOB port bulk-out buffer must be large enough for the two +* commands in digi_set_modem_signals(). +*/ + oob_port_num = serial->type->num_ports; +if (serial->port[oob_port_num]->bulk_out_size <8 ) +return -EINVAL ; serial_priv =kzalloc (sizeof (*serial_priv),GFP_KERNEL );if (!serial_priv)return -ENOMEM ;spin_lock_init (&serial_priv->ds_serial_lock); - serial_priv->ds_oob_port_num = serial->type->num_ports; - serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; + serial_priv->ds_oob_port_num = oob_port_num; + serial_priv->ds_oob_port = serial->port[oob_port_num]; ret =digi_port_init (serial_priv->ds_oob_port, serial_priv->ds_oob_port_num);
Greg Kroah-Hartman
maintainerPATCH 306/315 USB: serial: mct_u232: fix memory corruption with small endpoint
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 915b36d701950503c4ea0f6e314b10868e59fce3 upstream.
The driver overrides the maximum transfer size for a specific device which only accepts 16 byte packets for its 32 byte bulk-out endpoint.
Make sure to never increase the maximum transfer size to prevent slab corruption should a malicious device report a smaller endpoint max packet size than expected.
--- drivers/usb/serial/mct_u232.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/usb/serial/mct_u232.c +11 -10
@@ -378,6 +378,7 @@ static int mct_u232_port_probe(struct us {struct usb_serial *serial = port->serial;struct mct_u232_private *priv; +u16 pid;/* check first to simplify error handling */ if (!serial->port[1 ] || !serial->port[1 ]->interrupt_in_urb) {
@@ -385,6 +386,16 @@ static int mct_u232_port_probe(struct usreturn -ENODEV ; } +/* +* Compensate for a hardware bug: although the Sitecom U232-P25 +* device reports a maximum output packet size of 32 bytes, +* it seems to be able to accept only 16 bytes (and that's what +* SniffUSB says too...) +*/ + pid =le16_to_cpu (serial->dev->descriptor.idProduct); +if (pid ==MCT_U232_SITECOM_PID ) + port->bulk_out_size =min (16 , port->bulk_out_size); + priv =kzalloc (sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
@@ -410,7 +421,6 @@ static void mct_u232_port_remove(structstatic int mct_u232_open (struct tty_struct *tty,struct usb_serial_port *port) { -struct usb_serial *serial = port->serial;struct mct_u232_private *priv =usb_get_serial_port_data (port);int retval =0 ;unsigned int control_state;
@@ -418,15 +428,6 @@ static int mct_u232_open(struct tty_strunsigned char last_lcr;unsigned char last_msr; -/* Compensate for a hardware bug: although the Sitecom U232-P25 -* device reports a maximum output packet size of 32 bytes, -* it seems to be able to accept only 16 bytes (and that's what -* SniffUSB says too...) -*/ -if (le16_to_cpu (serial->dev->descriptor.idProduct) - ==MCT_U232_SITECOM_PID ) - port->bulk_out_size =16 ; -/* Do a defined restart: the normal serial device seems to * always turn on DTR and RTS here, so do the same. I'm not * sure if this is really necessary. But it should not harm
Greg Kroah-Hartman
maintainerPATCH 307/315 hwmon: (pmbus) Add support for guarded PMBus lock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 1814f4d3ff358277a5b6957e7f133c2812dc80ec ]
Add support for guard(pmbus_lock)() and scoped_guard(pmbus_lock)() to be able to simplify the PMBus code.
Also introduce pmbus_lock() as pre-requisite for supporting guard().
Stable-dep-of: 4e4af55aaca7 ("hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock")
--- drivers/hwmon/pmbus/pmbus.h | 5 +++++ drivers/hwmon/pmbus/pmbus_core.c | 8 ++++++++ 2 files changed, 13 insertions(+)
drivers/hwmon/pmbus/pmbus.h +5 -0
@@ -10,6 +10,7 @@#define PMBUS_H #include <linux/bitops.h> +#include <linux/cleanup.h> #include <linux/regulator/driver.h> /*
@@ -563,7 +564,11 @@ int pmbus_get_fan_rate_device(struct i2cint pmbus_get_fan_rate_cached (struct i2c_client *client,int page,int id,enum pmbus_fan_mode mode);int pmbus_lock_interruptible (struct i2c_client *client); +void pmbus_lock (struct i2c_client *client);void pmbus_unlock (struct i2c_client *client); + +DEFINE_GUARD(pmbus_lock, struct i2c_client *, pmbus_lock(_T), pmbus_unlock(_T)) +int pmbus_update_fan (struct i2c_client *client,int page,int id,u8 config,u8 mask,u16 command);struct dentry *pmbus_get_debugfs_dir (struct i2c_client *client);
drivers/hwmon/pmbus/pmbus_core.c +8 -0
@@ -3871,6 +3871,14 @@ struct dentry *pmbus_get_debugfs_dir(str }EXPORT_SYMBOL_NS_GPL (pmbus_get_debugfs_dir,"PMBUS" ); +void pmbus_lock (struct i2c_client *client) +{ +struct pmbus_data *data =i2c_get_clientdata (client); + +mutex_lock (&data->update_lock); +} +EXPORT_SYMBOL_NS_GPL (pmbus_lock,"PMBUS" ); +int pmbus_lock_interruptible (struct i2c_client *client) {struct pmbus_data *data =i2c_get_clientdata (client);
Greg Kroah-Hartman
maintainerPATCH 308/315 hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdurrahman Hussain <[email protected]>
[ Upstream commit 4e4af55aaca7f6d7673d5f9889ad0529db86a048 ]
adm1266_state_read() backs the sequencer_state debugfs entry and issues an i2c_smbus_read_word_data(client, ADM1266_READ_STATE) against the device without taking pmbus_lock. pmbus_core holds pmbus_lock around its own multi-transaction sequences (notably the "set PAGE, then read paged register" pattern used by hwmon attributes), so an unlocked debugfs reader can land between a PAGE write and the subsequent paged read in another thread. READ_STATE itself is not paged, so it cannot corrupt PAGE in flight, but the same defensive serialisation that applies to the GPIO accessors applies here: any direct device access from outside pmbus_core should be ordered with respect to pmbus_core's own.
Take pmbus_lock at the top of adm1266_state_read() via the scope-based guard().
--- drivers/hwmon/pmbus/adm1266.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/adm1266.c +1 -0
@@ -328,6 +328,7 @@ static int adm1266_state_read(struct seqstruct i2c_client *client =to_i2c_client (dev);int ret; +guard (pmbus_lock)(client); ret =i2c_smbus_read_word_data (client,ADM1266_READ_STATE );if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 309/315 hwmon: (pmbus/adm1266) serialize GPIO PMBus accesses with pmbus_lock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdurrahman Hussain <[email protected]>
[ Upstream commit bab8c6fb5af8df7e753d196c1262cb78e92ca872 ]
adm1266_gpio_get(), adm1266_gpio_get_multiple(), and adm1266_gpio_dbg_show() all issue PMBus reads against the device but none of them take pmbus_lock. The pmbus_core framework holds pmbus_lock around its own multi-transaction sequences (notably the "set PAGE, then read paged register" pattern used by hwmon attributes), so an unlocked GPIO accessor can land between a PAGE write and the subsequent paged read in another thread and corrupt either side's view of the device state machine.
Take pmbus_lock at the top of each of the three accessors via the scope-based guard(). The lock is uncontended in the common case and adds only a single mutex round-trip per call.
--- drivers/hwmon/pmbus/adm1266.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hwmon/pmbus/adm1266.c +6 -0
@@ -173,6 +173,8 @@ static int adm1266_gpio_get(struct gpio_else pmbus_cmd =ADM1266_PDIO_STATUS ; +guard (pmbus_lock)(data->client); + ret =i2c_smbus_read_block_data (data->client, pmbus_cmd, read_buf);if (ret <0 )return ret;
@@ -195,6 +197,8 @@ static int adm1266_gpio_get_multiple(strunsigned int gpio_nr;int ret; +guard (pmbus_lock)(data->client); + ret =i2c_smbus_read_block_data (data->client,ADM1266_GPIO_STATUS , read_buf);if (ret <0 )return ret;
@@ -236,6 +240,8 @@ static void adm1266_gpio_dbg_show(structint ret;int i; +guard (pmbus_lock)(data->client); +for (i =0 ; i <ADM1266_GPIO_NR ; i++) { write_cmd = adm1266_gpio_mapping[i][1 ]; ret =adm1266_pmbus_block_xfer (data,ADM1266_GPIO_CONFIG ,1 , &write_cmd, read_buf);
Greg Kroah-Hartman
maintainerPATCH 310/315 mm/slub: hold cpus_read_lock around flush_rcu_sheaves_on_cache()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qing Wang <[email protected]>
[ Upstream commit 67ea9d353d0ba12bdbc9183ff568dead9e949b80 ]
flush_rcu_sheaves_on_cache() calls queue_work_on() in a for_each_online_cpu() loop, which requires the cpu to stay online. But cpus_read_lock() is not held in kvfree_rcu_barrier_on_cache() and the set of "online cpus" is subject to change.
There are two paths that call flush_rcu_sheaves_on_cache():
// has cpus_read_lock()
flush_all_rcu_sheaves()
-> flush_rcu_sheaves_on_cache()
// no cpus_read_lock()
kvfree_rcu_barrier_on_cache()
-> flush_rcu_sheaves_on_cache()
Fix this by holding cpus_read_lock() in kvfree_rcu_barrier_on_cache().
Why not move cpus_read_lock() from flush_all_rcu_sheaves() into flush_rcu_sheaves_on_cache()? The reason is it would introduce a new lock order (slab_mutex -> cpu_hotplug_lock). The reverse order (cpu_hotplug_lock -> slab_mutex) is established by
- cpuhp_setup_state_nocalls(..., slub_cpu_setup, ...)
- kmem_cache_destroy()
The two orders together would form an AB-BA deadlock.
Finally, add lockdep_assert_cpus_held() in flush_rcu_sheaves_on_cache() to catch the same problem in the future.
--- mm/slab_common.c | 2 ++ mm/slub.c | 1 + 2 files changed, 3 insertions(+)
mm/slab_common.c +2 -0
@@ -2135,7 +2135,9 @@ EXPORT_SYMBOL_GPL(kvfree_rcu_barrier);void kvfree_rcu_barrier_on_cache (struct kmem_cache *s) {if (s->cpu_sheaves) { +cpus_read_lock ();flush_rcu_sheaves_on_cache (s); +cpus_read_unlock ();rcu_barrier (); }
mm/slub.c +1 -0
@@ -4203,6 +4203,7 @@ void flush_rcu_sheaves_on_cache(struct kstruct slub_flush_work *sfw;unsigned int cpu; +lockdep_assert_cpus_held ();mutex_lock (&flush_lock);for_each_online_cpu (cpu) {
Greg Kroah-Hartman
maintainerPATCH 311/315 net: phy: micrel: fix LAN8814 QSGMII soft reset
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Marko <[email protected]>
[ Upstream commit e027c218c482c6a0ae1948129ccda3b0a2033368 ]
LAN8814 QSGMII soft reset was moved into the probe function to avoid triggering it for each of 4 PHY-s in the package.
However, that broke QSGMII link between the MAC and PHY on most LAN8814 PHY-s, specificaly for us on the Microchip LAN969x switch. Reading the QSGMII status registers it was visible that lanes were only partially synced.
It looks like the reset timing is crucial, so lets move the reset back into the .config_init function but guard it with phy_package_init_once() to avoid it being triggered on each of 4 PHY-s in the package. Change the probe function to use phy_package_probe_once() for coma and PtP setup.
--- drivers/net/phy/micrel.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/phy/micrel.c +8 -7
@@ -4389,6 +4389,13 @@ static int lan8814_config_init(struct phy_device *phydev) {struct kszphy_priv *lan8814 = phydev->priv; +if (phy_package_init_once (phydev)) +/* Reset the PHY */ +lanphy_modify_page_reg (phydev,LAN8814_PAGE_COMMON_REGS , +LAN8814_QSGMII_SOFT_RESET , +LAN8814_QSGMII_SOFT_RESET_BIT , +LAN8814_QSGMII_SOFT_RESET_BIT ); +/* Disable ANEG with QSGMII PCS Host side */ lanphy_modify_page_reg(phydev, LAN8814_PAGE_PORT_REGS, LAN8814_QSGMII_PCS1G_ANEG_CONFIG,
@@ -4473,13 +4480,7 @@ static int lan8814_probe(struct phy_device *phydev)devm_phy_package_join (&phydev->mdio.dev, phydev, addr,sizeof (struct lan8814_shared_priv )); -if (phy_package_init_once (phydev)) { -/* Reset the PHY */ -lanphy_modify_page_reg (phydev,LAN8814_PAGE_COMMON_REGS , -LAN8814_QSGMII_SOFT_RESET , -LAN8814_QSGMII_SOFT_RESET_BIT , -LAN8814_QSGMII_SOFT_RESET_BIT ); - +if (phy_package_probe_once (phydev)) { err =lan8814_release_coma_mode (phydev);if (err)return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 312/315 xhci: tegra: Fix ghost USB device on dual-role port unplug
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei-Cheng Chen <[email protected]>
[ Upstream commit 5a4c828b8b29b47534814ade26d9aee09d5101fc ]
When a USB device is unplugged from the dual-role port, the device-mode path in tegra_xhci_id_work() explicitly clears both SS and HS port power via direct hub_control ClearPortFeature(POWER) calls. This preempts the xHCI controller's normal disconnect processing -- PORT_CSC is never generated, the USB core never sees the disconnect, and the device remains in its internal tree as a ghost visible in lsusb.
Add an otg_set_port_power flag to control whether the dual-role switch path performs explicit port power management. SoCs that need it (Tegra124 / Tegra210 / Tegra186) set the flag; later SoCs (Tegra194 and beyond) rely on the PHY mode change to handle disconnect naturally and skip all port power calls.
Within the port power path, otg_reset_sspi additionally gates the SSPI reset sequence on host-mode entry for SoCs that require it.
Flags set per SoC:
Tegra124, Tegra186 -> otg_set_port_power Tegra210 -> otg_set_port_power, otg_reset_sspi Tegra194 and later -> (none)
[ Backport to 6.18.y: keep the host-mode snapshot in the existing
tegra->lock section, retain pm_runtime_mark_last_busy() in the host port-power path, preserve str_on_off(), and resolve context around the SoC ops/Tegra234 entries. ]
--- drivers/usb/host/xhci-tegra.c | 79 ++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 34 deletions(-)
drivers/usb/host/xhci-tegra.c +45 -34
@@ -247,6 +247,7 @@ struct tegra_xusb_soc {bool has_ipfs;bool lpm_support;bool otg_reset_sspi; +bool otg_set_port_power;bool has_bar2; };
@@ -1352,14 +1353,17 @@ static void tegra_xhci_id_work(struct work_struct *work)struct tegra_xusb_mbox_msg msg;struct phy *phy =tegra_xusb_get_phy (tegra,"usb2" , tegra->otg_usb2_port); +bool host_mode;u32 status;int ret; -dev_dbg (tegra->dev,"host mode %s\n" ,str_on_off (tegra->host_mode)); -mutex_lock (&tegra->lock); -if (tegra->host_mode) + host_mode = tegra->host_mode; + +dev_dbg (tegra->dev,"host mode %s\n" ,str_on_off (host_mode)); + +if (host_mode)phy_set_mode_ext (phy,PHY_MODE_USB_OTG ,USB_ROLE_HOST );else phy_set_mode_ext (phy,PHY_MODE_USB_OTG ,USB_ROLE_NONE );
@@ -1370,42 +1374,44 @@ static void tegra_xhci_id_work(struct work_struct *work) tegra->otg_usb2_port);pm_runtime_get_sync (tegra->dev); -if (tegra->host_mode) { -/* switch to host mode */ -if (tegra->otg_usb3_port >=0 ) { -if (tegra->soc->otg_reset_sspi) { -/* set PP=0 */ - tegra_xhci_hc_driver.hub_control ( - xhci->shared_hcd, GetPortStatus, -0 , tegra->otg_usb3_port+1 , - (char *) &status,sizeof (status)); -if (status &USB_SS_PORT_STAT_POWER ) -tegra_xhci_set_port_power (tegra, false, - false); - -/* reset OTG port SSPI */ - msg.cmd =MBOX_CMD_RESET_SSPI ; - msg.data = tegra->otg_usb3_port+1 ; - - ret =tegra_xusb_mbox_send (tegra, &msg); -if (ret <0 ) { -dev_info (tegra->dev, -"failed to RESET_SSPI %d\n" , - ret); +if (tegra->soc->otg_set_port_power) { +if (host_mode) { +/* switch to host mode */ +if (tegra->otg_usb3_port >=0 ) { +if (tegra->soc->otg_reset_sspi) { +/* set PP=0 */ + tegra_xhci_hc_driver.hub_control ( + xhci->shared_hcd, GetPortStatus, +0 , tegra->otg_usb3_port+1 , + (char *) &status,sizeof (status)); +if (status &USB_SS_PORT_STAT_POWER ) +tegra_xhci_set_port_power (tegra, false, + false); + +/* reset OTG port SSPI */ + msg.cmd =MBOX_CMD_RESET_SSPI ; + msg.data = tegra->otg_usb3_port+1 ; + + ret =tegra_xusb_mbox_send (tegra, &msg); +if (ret <0 ) { +dev_info (tegra->dev, +"failed to RESET_SSPI %d\n" , + ret); + } } - } -tegra_xhci_set_port_power (tegra, false, true); - } +tegra_xhci_set_port_power (tegra, false, true); + } -tegra_xhci_set_port_power (tegra, true, true); -pm_runtime_mark_last_busy (tegra->dev); +tegra_xhci_set_port_power (tegra, true, true); +pm_runtime_mark_last_busy (tegra->dev); - }else { -if (tegra->otg_usb3_port >=0 ) -tegra_xhci_set_port_power (tegra, false, false); + }else { +if (tegra->otg_usb3_port >=0 ) +tegra_xhci_set_port_power (tegra, false, false); -tegra_xhci_set_port_power (tegra, true, false); +tegra_xhci_set_port_power (tegra, true, false); + } }pm_runtime_put_autosuspend (tegra->dev); }
@@ -2558,6 +2564,7 @@ static const struct tegra_xusb_soc tegra124_soc = { .scale_ss_clock = true, .has_ipfs = true, .otg_reset_sspi = false, + .otg_set_port_power = true, .ops = &tegra124_ops, .mbox = { .cmd = 0xe4,
@@ -2596,6 +2603,7 @@ static const struct tegra_xusb_soc tegra210_soc = { .scale_ss_clock = false, .has_ipfs = true, .otg_reset_sspi = true, + .otg_set_port_power = true, .ops = &tegra124_ops, .mbox = { .cmd = 0xe4,
@@ -2639,6 +2647,7 @@ static const struct tegra_xusb_soc tegra186_soc = { .scale_ss_clock = false, .has_ipfs = false, .otg_reset_sspi = false, + .otg_set_port_power = true, .ops = &tegra124_ops, .mbox = { .cmd = 0xe4,
@@ -2672,6 +2681,7 @@ static const struct tegra_xusb_soc tegra194_soc = { .scale_ss_clock = false, .has_ipfs = false, .otg_reset_sspi = false, + .otg_set_port_power = false, .ops = &tegra124_ops, .mbox = { .cmd = 0x68,
@@ -2705,6 +2715,7 @@ static const struct tegra_xusb_soc tegra234_soc = { .scale_ss_clock = false, .has_ipfs = false, .otg_reset_sspi = false, + .otg_set_port_power = false, .ops = &tegra234_ops, .mbox = { .cmd = XUSB_BAR2_ARU_MBOX_CMD,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 314/315 drm/i915/psr: Use DC_OFF wake reference to block DC6 on vblank enable
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
[ Upstream commit 3549a9649dc7c5fc586ab12f675279283cdcb2a7 ]
We are observing following warnings:
*ERROR* power well DC_off state mismatch (refcount 0/enabled 1)
gen9_dc_off_power_well_enabled is considering target state DC_STATE_DISABLE as DC_OFF power well being enabled. Fix this by using wakeref for the purpose.
To achieve this we need to modify notification code as well. Currently it is possible that PSR gets notified vblank enable/disable twice on same status. This is currently not a problem as it is just triggering call to intel_display_power_set_target_dc_state with same target state as a parameter. When using wakeref this becomes a problem due to reference counting. Fix this storing vbank status on last notification and use that to ensure there are no more than one notification with same vblank status.
v2: ensure there is no subsequent notifications with same status
--- drivers/gpu/drm/i915/display/intel_display_core.h | 1 drivers/gpu/drm/i915/display/intel_display_irq.c | 8 +++++-- drivers/gpu/drm/i915/display/intel_display_types.h | 2 + drivers/gpu/drm/i915/display/intel_psr.c | 24 +++++++-------------- 4 files changed, 18 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
@@ -472,6 +472,7 @@ struct intel_display {u8 vblank_enabled;int vblank_enable_count; +bool vblank_status_last_notified;struct work_struct vblank_notify_work;
drivers/gpu/drm/i915/display/intel_display_irq.c +6 -2
@@ -1707,8 +1707,12 @@ static void intel_display_vblank_notify_struct intel_display *display =container_of (work,typeof (*display), irq.vblank_notify_work);int vblank_enable_count =READ_ONCE (display->irq.vblank_enable_count); +bool vblank_status = !!vblank_enable_count; -intel_psr_notify_vblank_enable_disable (display, vblank_enable_count); +if (display->irq.vblank_status_last_notified != vblank_status) { +intel_psr_notify_vblank_enable_disable (display, vblank_status); + display->irq.vblank_status_last_notified = vblank_status; + } }int bdw_enable_vblank (struct drm_crtc *_crtc)
@@ -1721,10 +1725,10 @@ int bdw_enable_vblank(struct drm_crtc *_if (gen11_dsi_configure_te (crtc, true))return 0 ; +spin_lock_irqsave (&display->irq.lock, irqflags);if (crtc->vblank_psr_notify && display->irq.vblank_enable_count++ ==0 )schedule_work (&display->irq.vblank_notify_work); -spin_lock_irqsave (&display->irq.lock, irqflags);bdw_enable_pipe_irq (display, pipe,GEN8_PIPE_VBLANK );spin_unlock_irqrestore (&display->irq.lock, irqflags);
drivers/gpu/drm/i915/display/intel_display_types.h +2 -0
@@ -1690,6 +1690,8 @@ struct intel_psr {bool pkg_c_latency_used;u8 active_non_psr_pipes; + +struct ref_tracker *vblank_wakeref; };struct intel_dp {
drivers/gpu/drm/i915/display/intel_psr.c +9 -15
@@ -3982,14 +3982,20 @@ void intel_psr_notify_vblank_enable_disa bool enable) {struct intel_encoder *encoder; -bool block_dc_states = false;for_each_intel_encoder_with_psr (display->drm, encoder) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);mutex_lock (&intel_dp->psr.lock); -if (CAN_PANEL_REPLAY (intel_dp)) - block_dc_states = true; +if (CAN_PANEL_REPLAY (intel_dp)) { +if (enable) + intel_dp->psr.vblank_wakeref = +intel_display_power_get (display, +POWER_DOMAIN_DC_OFF ); +else +intel_display_power_put (display,POWER_DOMAIN_DC_OFF , + intel_dp->psr.vblank_wakeref); + }if (intel_dp->psr.enabled && !intel_dp->psr.panel_replay_enabled && intel_dp->psr.pkg_c_latency_used)
@@ -3997,18 +4003,6 @@ void intel_psr_notify_vblank_enable_disamutex_unlock (&intel_dp->psr.lock); } - -/* -* NOTE: intel_display_power_set_target_dc_state is used -* only by PSR code for DC3CO handling. DC3CO target -* state is currently disabled in * PSR code. If DC3CO -* is taken into use we need take that into account here -* as well. -*/ -if (block_dc_states) -intel_display_power_set_target_dc_state (display, enable ? -DC_STATE_DISABLE : -DC_STATE_EN_UPTO_DC6 ); } static void
Greg Kroah-Hartman
maintainerPATCH 315/315 thunderbolt: property: Cap recursion depth in __tb_property_parse_dir()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
[ Upstream commit 928abe19fbf0127003abcb1ea69cabc1c897d0ab ]
A DIRECTORY entry's value field is used as the dir_offset for a recursive call into __tb_property_parse_dir() with no depth counter. A crafted peer that chains DIRECTORY entries into a back-reference loop drives the parser until the kernel stack is exhausted and the guard page fires. Any untrusted XDomain peer (cable, dock, in-line inspector, adjacent host) that reaches the PROPERTIES_REQUEST control-plane exchange can trigger this without authentication.
Thread a depth counter through tb_property_parse() and __tb_property_parse_dir(), and reject blocks that exceed TB_PROPERTY_MAX_DEPTH = 8. That is comfortably larger than any observed legitimate XDomain layout.
Operators who do not need XDomain host-to-host discovery can disable the path entirely with thunderbolt.xdomain=0 on the kernel command line.
--- drivers/thunderbolt/property.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/thunderbolt/property.c +12 -6
@@ -35,10 +35,11 @@ struct tb_property_dir_entry { };#define TB_PROPERTY_ROOTDIR_MAGIC 0x55584401 +#define TB_PROPERTY_MAX_DEPTH 8static struct tb_property_dir *__tb_property_parse_dir (const u32 *block,size_t block_len,unsigned int dir_offset,size_t dir_len, -bool is_root); +bool is_root,unsigned int depth);static inline void parse_dwdata (void *dst,const void *src,size_t dwords) {
@@ -97,7 +98,8 @@ tb_property_alloc(const char *key, enum }static struct tb_property *tb_property_parse (const u32 *block,size_t block_len, -const struct tb_property_entry *entry) +const struct tb_property_entry *entry, +unsigned int depth) {char key[TB_PROPERTY_KEY_SIZE +1 ];struct tb_property *property;
@@ -118,7 +120,7 @@ static struct tb_property *tb_property_pswitch (property->type) {case TB_PROPERTY_TYPE_DIRECTORY : dir =__tb_property_parse_dir (block, block_len, entry->value, - entry->length, false); + entry->length, false, depth +1 );if (!dir) {kfree (property);return NULL ;
@@ -163,13 +165,17 @@ static struct tb_property *tb_property_p }static struct tb_property_dir *__tb_property_parse_dir (const u32 *block, -size_t block_len,unsigned int dir_offset,size_t dir_len,bool is_root) +size_t block_len,unsigned int dir_offset,size_t dir_len,bool is_root, +unsigned int depth) {const struct tb_property_entry *entries;size_t i, content_len, nentries;unsigned int content_offset;struct tb_property_dir *dir; +if (depth >TB_PROPERTY_MAX_DEPTH ) +return NULL ; + dir =kzalloc (sizeof (*dir),GFP_KERNEL );if (!dir)return NULL ;
@@ -200,7 +206,7 @@ static struct tb_property_dir *__tb_propfor (i =0 ; i < nentries; i++) {struct tb_property *property; - property =tb_property_parse (block, block_len, &entries[i]); + property =tb_property_parse (block, block_len, &entries[i], depth);if (!property) {tb_property_free_dir (dir);return NULL ;
@@ -239,7 +245,7 @@ struct tb_property_dir *tb_property_parsreturn NULL ;return __tb_property_parse_dir (block, block_len,0 , rootdir->length, - true); + true,0 ); }/**
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.18.35 release. There are 315 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
We see build problem here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/jobs/14732223960
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/2582906697
Best regards,
Pavel
arch/arm64/kvm/nested.c: In function 'kvm_init_nv_sysregs':
1807
12:45:08arch/arm64/kvm/nested.c:1776:9: error: 'resx' undeclared (first use in this function); did you mean 'res1'? 1808
12:45:08
1776 | resx.res0 = ZCR_ELx_RES0 | GENMASK_ULL(8, 4);
1809
12:45:08
| ^~~~
1810
12:45:08
| res1
1811
12:45:08arch/arm64/kvm/nested.c:1776:9: note: each undeclared identifier is reported only once for each function it appears in 1812
12:45:08arch/arm64/kvm/nested.c:1778:9: error: too few arguments to function 'set_sysreg_masks'
1813
12:45:08
1778 | set_sysreg_masks(kvm, ZCR_EL2, resx);
1814
12:45:08
| ^~~~~~~~~~~~~~~~
1815
12:45:08arch/arm64/kvm/nested.c:1641:29: note: declared here
1816
12:45:08
1641 | static __always_inline void set_sysreg_masks(struct kvm *kvm, int sr, u64 res0, u64 res1)
1817
12:45:08
| ^~~~~~~~~~~~~~~~
1818
12:45:08
CC block/holder.o
1819
12:45:08
CC drivers/irqchip/irq-ls-scfg-msi.o
1820
12:45:09
make[4]: *** [scripts/Makefile.build:287: arch/arm64/kvm/nested.o] Error 1
Quoted 1,310 lines
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:Greg Kroah-Hartman <[email protected]>
Linux 6.18.35-rc1Michael Bommarito <[email protected]>
thunderbolt: property: Cap recursion depth in__tb_property_parse_dir()Jouni Högander <[email protected]>
drm/i915/psr: UseDC_OFFwake reference to block DC6 on vblank enableJassi Brar <[email protected]>
mailbox: Fix NULL message support inmbox_send_message()Wei-Cheng Chen <[email protected]>
xhci: tegra: Fix ghost USB device on dual-role port unplugRobert Marko <[email protected]>
net: phy: micrel: fix LAN8814 QSGMII soft resetQing Wang <[email protected]>
mm/slub: holdcpus_read_lockaroundflush_rcu_sheaves_on_cache()Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serialize GPIO PMBus accesses withpmbus_lockAbdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serializesequencer_statedebugfs read withpmbus_lockGuenter Roeck <[email protected]>
hwmon: (pmbus) Add support for guarded PMBus lockJohan Hovold <[email protected]>
USB: serial:mct_u232: fix memory corruption with small endpointJohan Hovold <[email protected]>
USB: serial:digi_acceleport: fix memory corruption with small endpointsJohan Hovold <[email protected]>
USB: serial:cypress_m8: fix memory corruption with small endpointRadhey Shyam Pandey <[email protected]>
usb: dwc3: xilinx: fix error handling in zynqmp init error pathsShaomin Chen <[email protected]>
xfrm: iptfs: reset runtime state when cloning SAsRafael J. Wysocki <[email protected]>
cpufreq:intel_pstate: Use correct scaling factor on Raptor Lake-ERafael J. Wysocki <[email protected]>
cpufreq:intel_pstate: Add and usehybrid_get_cpu_type()Paolo Abeni <[email protected]>
mptcp: reset rcv wnd on disconnectPaolo Abeni <[email protected]>
mptcp: cleanup fallback dummy mapping generationDawei Feng <[email protected]>
octeontx2-pf: avoid double free of pool->stack on AQ init failureZeng Heng <[email protected]>
arm64: tlb: Flush walk cache when unsharing PMD tablesShardul Bankar <[email protected]>
mptcp: do not drop partial packetsPaolo Abeni <[email protected]>
mptcp: borrow forward memory from subflowPaolo Abeni <[email protected]>
mptcp: handle first subflow closing consistentlyDavid Carlier <[email protected]>
net: devmem: reject dma-buf bind with non-page-aligned size or SG lengthMatthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: drop nanoseconds width specifierShuai Zhang <[email protected]>
Bluetooth:hci_qca: Convert timeout from jiffies to msUwe Kleine-König <[email protected]>
Bluetooth:hci_qca: Migrate to serdev specific shutdown functionUwe Kleine-König <[email protected]>
serdev: Provide a bustype shutdown functionDavid Howells <[email protected]>
rxrpc: Fix RESPONSE packet verification to extract skb to a linear bufferDavid Howells <[email protected]>
rxrpc: Fix DATA decrypt vssplice()by copying data to buffer in recvmsgTom Lendacky <[email protected]>
x86/mm: Disable broadcast TLB flush when PCID is disabledLukas Wunner <[email protected]>
platform/x86/intel/vsec: Fixenable_cntimbalance on PCIe error recoveryDavid E. Box <[email protected]>
platform/x86/intel/vsec: Makedriver_datainfo constDavid E. Box <[email protected]>
platform/x86/intel/vsec: Refactorbase_addrhandlingJacques Nilo <[email protected]>
serial: 8250_dw: dispatch SysRq character indw8250_handle_irq()Jacques Nilo <[email protected]>
serial: 8250: dispatch SysRq character inserial8250_handle_irq()Jacques Nilo <[email protected]>
serial: core: introduceguard(uart_port_lock_check_sysrq_irqsave)Maciej W. Rozycki <[email protected]>
serial: zs: Convert to use a platform deviceMaciej W. Rozycki <[email protected]>
serial: zs: Switch to using channel resetMaciej W. Rozycki <[email protected]>
serial: zs: Fix bootconsole handover lockupMaciej W. Rozycki <[email protected]>
serial: dz: Convert to use a platform deviceMaciej W. Rozycki <[email protected]>
serial: dz: Fix bootconsole handover lockupMaciej W. Rozycki <[email protected]>
serial: dz: Fix bootconsole message clobbering at chip resetZiyi Guo <[email protected]>
drm/amdgpu: checknum_entriesinGEM_OPGET_MAPPING_INFOChristian König <[email protected]>
drm/amdgpu: fix calling VM invalidation inamdgpu_hmm_invalidate_gfxMichael Bommarito <[email protected]>
drm/amdgpu: fix lock leak on ENOMEM inAMDGPU_GEM_OP_GET_MAPPING_INFODavid Francis <[email protected]>
drm/amdkfd: Check for pdd drm file first in CRIU restore pathEric Huang <[email protected]>
drm/amdkfd: fix a vulnerability of integer overflow in kfd debuggerEric Huang <[email protected]>
drm/amdkfd: fix NULL pointer bug insvm_range_set_attrShitalkumar Gandhi <[email protected]>
serial:fsl_lpuart: fix rx buffer and DMA map leaks instart_rx_dmaMaciej W. Rozycki <[email protected]>
serial: zs: Fix swapped RI/DSR modem line transition countingHongling Zeng <[email protected]>
serial: sh-sci: fix memory region release in error pathViken Dadhaniya <[email protected]>
serial:qcom_geni: fix kfifo underflow when flush precedes DMA completion IRQPrasanna S <[email protected]>
serial: qcom-geni: fixUART_RX_PAR_ENbit positionMyeonghun Pak <[email protected]>
serial:altera_jtaguart: handleuart_add_one_port()failuresTimur Kristóf <[email protected]>
drm/amd/pm/si: Disregard vblank time when no displays are connectedJanusz Krzysztofik <[email protected]>
drm/i915: Fix potential UAF in TTM object purgeJouni Högander <[email protected]>
drm/i915/psr: Block DC states on vblank enable when Panel Replay supportedZhenghang Xiao <[email protected]>
drm/gem: fix race betweenchange_handleandhandle_deleteBerkant Koc <[email protected]>
drm/hyperv: validate VMBus packet size in receive callbackBerkant Koc <[email protected]>
drm/hyperv: validateresolution_countand fix WIN8 fallbackAlexandru Hossu <[email protected]>
scsi: target: iscsi: ValidateCHAP_Rlength before base64 decodeMichael Bommarito <[email protected]>
scsi: target: iscsi: Boundiscsi_encode_text_output()appends torsp_bufMichael Bommarito <[email protected]>
scsi: target: iscsi: Fix CRC overread and double-free iniscsit_handle_text_cmd()Michael Bommarito <[email protected]>
scsi:scsi_transport_fc: Widen FPIN pname walker counter to u32Michael Bommarito <[email protected]>
scsi: fcoe: Reject FIP descriptors with zerofip_dlenin CVL walkerMichael Bommarito <[email protected]>
thunderbolt: property: Rejectdir_len< 4 to preventsize_tunderflowMichael Bommarito <[email protected]>
thunderbolt: property: Reject u32 wrap intb_property_entry_valid()Michael Bommarito <[email protected]>
usb: gadget:f_fs: serialize DMABUF cancel against request completionMichael Bommarito <[email protected]>
usb: gadget:f_fs: copy only received bytes on short ep0 readSeungjin Bae <[email protected]>
usb: gadget:dummy_hcd: Reject hub port requests for non-existent portsJeremy Erazo <[email protected]>
usb: gadget: composite: fix integer underflow in WebUSBGET_URLhandlingGuangshuo Li <[email protected]>
usb: gadget:f_hid: fix device reference leak inhidg_alloc()Guangshuo Li <[email protected]>
usb: gadget: net2280: Fix double free in probe error pathKai Aizen <[email protected]>
usb: gadget: uvc: hold opts->lock across XU walks in uvc_function_bindJohan Hovold <[email protected]>
USB: serial:mct_u232: fix missing interrupt-in transfer sanity checkJohan Hovold <[email protected]>
USB: serial: mxuport: fix memory corruption with small endpointJohan Hovold <[email protected]>
USB: serial: keyspan: fix missing indat transfer sanity checkZhang Cen <[email protected]>
USB: serial:cypress_m8: validate interrupt packet headersZhang Cen <[email protected]>
USB: serial:belkin_sa: validate interrupt status lengthWanquan Zhong <[email protected]>
USB: serial: option: add missing RSVD(5) flag for Rolling RW135R-GLJan Volckaert <[email protected]>
USB: serial: option: add MeiG SRM813QMyrrh Periwinkle <[email protected]>
usb: typec: ucsi: Don't updatepower_supplyon power role change if not connectedMyrrh Periwinkle <[email protected]>
usb: typec: ucsi: Check if power role change actually happened before handlingSebastian Reichel <[email protected]>
usb: typec: tcpm: improve handling ofDISCOVER_MODESfailuresDan Carpenter <[email protected]>
usb: typec: tipd: Fix error code intps6598x_probe()Heitor Alves de Siqueira <[email protected]>
usb: usbtmc: reject interrupt endpoints with small wMaxPacketSizeHeitor Alves de Siqueira <[email protected]>
usb: usbtmc: check URBactual_lengthfor interrupt-IN notificationsMichael Bommarito <[email protected]>
usbip: vudc: Fix use after free bug invudc_removedue to race conditionSam Burkels <[email protected]>
usb: storage: Add quirks for PNY Elite Portable SSDStephen J. Fuhry <[email protected]>
USB: quirks: addNO_LPMfor Lenovo ThinkPad USB-C Dock Gen2 hub controllersWentao Liang <[email protected]>
usb: musb: omap2430: Fix use-after-free in omap2430_probe()Michal Pecio <[email protected]>
usb: core: Fix up Interrupt IN endpoints with bogus wBytesPerIntervalXu Yang <[email protected]>
usb: chipidea: core: convertci_role_switchto local variableTudor Ambarus <[email protected]>
tty: serial: samsung: Remove redundant port lock acquisition in rx helpersZhaoyang Yu <[email protected]>
tty: serial:pch_uart: add check fordma_alloc_coherent()Guangshuo Li <[email protected]>
counter: Fix refcount leak incounter_alloc()error pathIan Abbott <[email protected]>
comedi:comedi_test: Fix limiting ofconvert_arginwaveform_ai_cmdtest()Ian Abbott <[email protected]>
comedi:comedi_test: fix check for validscan_begin_srcinwaveform_ai_cmdtest()Hongling Zeng <[email protected]>
gpib: cb7210: Fix region leak whenrequest_irqfailsNicolás Bazaes <[email protected]>
Input: synaptics - add LEN2058 to SMBus passlist for ThinkPad E490Dmitry Torokhov <[email protected]>
Input:atmel_mxt_ts- fix boundary check inmxt_prepare_cfg_memXiaolei Wang <[email protected]>
misc: rp1: Send IACK on IRQ activate to fix kdump/kexecAli Ganiyev <[email protected]>
ksmbd: OOB read regression insmb_check_perm_dacl()ACE-walk loopsDmitriy Zharov <[email protected]>
Input: xpad - add support for ASUS ROG RAIKIRI IIQbeliw Tanaka <[email protected]>
Input: xpad - add "Nova 2 Lite" from GameSirZhang Heng <[email protected]>
ALSA: hda/realtek: Fix speaker output on ASUS ROG Strix G615LPJingguo Tan <[email protected]>
xfrm: esp: restore combined single-frag length gateSrinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: do not set stream state in event and trigger callbacksSrinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: close stream only when runningHamza Mahfooz <[email protected]>
netfilter: conntrack: tcp: do not force CLOSE on invalid-seq RST without direction checkCássio Gabriel <[email protected]>
ALSA: firewire-motu: Protect register DSP event queue positionsGeoffrey D. Bennett <[email protected]>
ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417Michael Bommarito <[email protected]>
xfrm: ah: useskb_to_full_skin async output callbacksHerbert Xu <[email protected]>
xfrm: ipcomp: Free destination pages on acomp errorsMaoyi Xie <[email protected]>
xfrm: route MIGRATE notifications to caller's netnsAshutosh Desai <[email protected]>
nfc: hci: fix out-of-bounds read in HCP header parsingArnd Bergmann <[email protected]>
iommu, debugobjects: avoid gcc-16.1 section mismatch warningsLee Jones <[email protected]>
HID: wacom: Fix OOB write inwacom_hid_set_device_mode()Santhosh Kumar K <[email protected]>
spi: spi-mem: avoid mutating op template inspi_mem_supports_op()Minh Nguyen <[email protected]>
net: skbuff: fix missing zerocopy reference inpskb_carvehelpersKuniyuki Iwashima <[email protected]>
ip6: vti: Use ip6_tnl.net invti6_changelink().Michael Bommarito <[email protected]>
l2tp: userefcount_inc_not_zeroinl2tp_session_get_by_ifnameZhengchuan Liang <[email protected]>
xfrm: input: hold netns during deferred transport reinjectionQi Tang <[email protected]>
ipv6: validate extension header length before copying to cmsgMaoyi Xie <[email protected]>
ip6: vti: Use ip6_tnl.net invti6_siocdevprivate().Zhengchuan Liang <[email protected]>
ipv6: exthdrs: refresh nh after handling HAO optionSrinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: fix error handling in prepare andset_paramsJustin Iurman <[email protected]>
ipv6: exthdrs: refresh nh pointer afteripv6_hop_jumbo()Junrui Luo <[email protected]>
macsec: fix replay protection at XPN lower-PN wrapYuqi Xu <[email protected]>
bpf: sockmap: fix tail fragment offset inbpf_msg_push_dataJason A. Donenfeld <[email protected]>
wireguard: send: append trailer after expanding headAlexis Lothoré (eBPF Foundation) <[email protected]>
x86/ftrace: Relocate %rip-relative percpu refs in dynamic trampolinesChaitanya Sabnis <[email protected]>
i2c: davinci: fix division by zero on missing clock-frequencyDmitry Torokhov <[email protected]>
Input:elan_i2c- validate firmware size before useDan Carpenter <[email protected]>
usb: dwc2: Fix use after free in debug codePeter Chen <[email protected]>
usb: cdns3: plat: fix unbalancedpm_runtime_forbid()call permanently leaks the runtime PM usage counter across bind/unbind cyclesPeter Chen <[email protected]>
usb: cdns3: plat: fix leakedusb2_phyinitialization onusb3_phyacquisition failureYongchao Wu <[email protected]>
usb: cdns3: gadget: fix request skipping after clearing haltJohan Hovold <[email protected]>
USB: serial: omninet: fix memory corruption with small endpointBenoît Monin <[email protected]>
iio: buffer: Fix DMA fence leak iniio_buffer_enqueue_dmabuf()Felix Gu <[email protected]>
iio: buffer: hw-consumer: fix use-after-free in error pathAldo Conte <[email protected]>
iio: light: cm3323: fixreg_confnot being initialized correctlyAntoniu Miclaus <[email protected]>
iio: chemical: scd30: fix division by zero inwrite_rawPengpeng Hou <[email protected]>
iio: chemical: mhz19b: reject oversized serial repliesSvyatoslav Ryhel <[email protected]>
iio: Fixiio_multiply_valueuse iniio_read_channel_processed_scaleFelix Gu <[email protected]>
iio: light: veml6070: Fix resource leak in probe error pathAdvait Dhamorikar <[email protected]>
iio: magnetometer:st_magn: fix default DRDY pin selection for LIS2MDLSalah Triki <[email protected]>
iio: temperature: tsys01: fix broken PROM checksum validationSanjay Chitroda <[email protected]>
iio:ssp_sensors: cancel delayedwork_refreshon removeAntoniu Miclaus <[email protected]>
iio: gyro: adis16260: fix division by zero inwrite_rawDavid Carlier <[email protected]>
iio: gyro: itg3200: fix i2c read into the wrong stack locationRadu Sabau <[email protected]>
iio: adc: ad4695: Fix call ordering in offload buffer postenableSalah Triki <[email protected]>
iio: adc: viperboard: Fix error handling invprbrd_iio_read_rawSalah Triki <[email protected]>
iio: adc: mt6359: fix unchecked return value inmt6358_read_impRodrigo Alencar <[email protected]>
iio: dac: ad5686: fix powerdown control on dual-channel devicesRodrigo Alencar <[email protected]>
iio: dac: ad5686: acquire lock when doing powerdown controlRodrigo Alencar <[email protected]>
iio: dac: ad5686: fix input raw value checkRodrigo Alencar <[email protected]>
iio: dac: ad5686: fix ref bit initialization for single-channel partsSalah Triki <[email protected]>
iio: dac: max5821: fix return value check in powerdown syncKim Seer Paller <[email protected]>
iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode stringsDavid Carlier <[email protected]>
iio: adc: npcm: fix unbalancedclk_disable_unprepare()Christofer Jonason <[email protected]>
iio: adc: xilinx-xadc: Fix sequencer mode in postdisable for dual muxNathan Chancellor <[email protected]>
Disable -Wattribute-alias for clang-23 and newerSean Christopherson <[email protected]>
KVM: SEV: Don't explicitly pass PSC buffer tosnp_begin_psc()Sean Christopherson <[email protected]>
KVM: SEV: UseREAD_ONCE()when reading entries/indices from PSC bufferSean Christopherson <[email protected]>
KVM: SEV: Check PSC request indices against the actual size of the bufferSean Christopherson <[email protected]>
KVM: SEV: Compute the correct max length of the in-GHCB scratch areaSean Christopherson <[email protected]>
KVM: SEV: WARN if KVM attempts to setup scratch area with min_len==0Sean Christopherson <[email protected]>
KVM: SEV: Use the size of the PSC header as the minimum size for PSC requestsSean Christopherson <[email protected]>
KVM: SEV: Ignore Port I/O requests of length '0'Michael Roth <[email protected]>
KVM: SEV: Require in-GHCB scratch area if GHCB v2+ is in useSean Christopherson <[email protected]>
KVM: SVM: Flush the current TLB when transitioning from xAVIC => x2AVICQiang Ma <[email protected]>
KVM: arm64: PMU: Preserve AArch32 counter low bitsMark Brown <[email protected]>
KVM: arm64: Correctly capZCR_EL2provided by a guest hypervisorWentao Guan <[email protected]>
USB: cdc-acm: Fix bit overlap and move quirk definitions to headerAlice Ryhl <[email protected]>
rust_binder: avoid callingpending_oneway_finished()onTF_UPDATE_TXNMatthew Maurer <[email protected]>
rust_binder: Avoid holding lock when droppingdelivered_deathBen Hutchings <[email protected]>
parport: Fix race between port and client registrationDmitry Torokhov <[email protected]>
Input: xpad - fix out-of-bounds access for Share buttonDoruk Tan Ozturk <[email protected]>
Bluetooth:hci_sync: fix UAF inhci_le_create_cis_syncShuai Zhang <[email protected]>
Bluetooth:hci_qca: Use 100 ms SSR delay for rampatch and NVM loadingPavitra Jha <[email protected]>
Bluetooth:hci_conn: Fix memory leak inhci_le_big_terminate()Muhammad Bilal <[email protected]>
Bluetooth: ISO: serializeiso_sock_clear_timerwith socket lockMuhammad Bilal <[email protected]>
Bluetooth: ISO: fix UAF iniso_recv_frameMuhammad Bilal <[email protected]>
Bluetooth: HIDP: fix missing length checks inhidp_input_report()Siwei Zhang <[email protected]>
Bluetooth: L2CAP: fix chan ref leak inl2cap_chan_timeout()on !connSiwei Zhang <[email protected]>
Bluetooth: L2CAP: use chan timer to close channels incleanup_listen()Steve French <[email protected]>
smb: client: fix uninitialized variable insmb2_writev_callbackStepan Ionichev <[email protected]>
auxdisplay: line-display: fix OOB read on zero-lengthmessage_store()Dev Jain <[email protected]>
mm/rmap: initializenr_pagesto 1 at loop start intry_to_unmap_onePratyush Yadav (Google) <[email protected]>
memfd: deny writeable mappings when implyingSEAL_WRITEAlexandre Ghiti <[email protected]>
mm: memcontrol: propagate NMI slab stats to memcg vmstatsLinpu Yu <[email protected]>
ipc: limitnext_idallocation to the valid ID rangeSeongJae Park <[email protected]>
mm/damon/sysfs-schemes: delete tried region inregions_rmdirs()Mikulas Patocka <[email protected]>
hpfs: fix a crash ifhpfs_map_dnode_bitmapfailsShuai Zhang <[email protected]>
Bluetooth: btusb: Allow firmware re-download when version matcheshlleng <[email protected]>
HID: quirks: AddALWAYS_POLLquirk for SIGMACHIP USB mouseThomas Fourier <[email protected]>
Input: ims-pcu - fixusb_free_coherent()size inims_pcu_buffers_free()Henri A <[email protected]>
media: rc: igorplugusb: fix control request setup packetJohan Hovold <[email protected]>
USB: serial:safe_serial: fix memory corruption with small endpointGreg Kroah-Hartman <[email protected]>
usb: typec: ucsi: validate connector number inucsi_connector_change()Greg Kroah-Hartman <[email protected]>
usb: typec: tcpm/tcpci_maxim: validate header NDO againstRX_BYTE_CNTGreg Kroah-Hartman <[email protected]>
usb: typec: wcove: don't write past structpd_messageinwcove_read_rx_buffer()Greg Kroah-Hartman <[email protected]>
usb: typec: altmodes/displayport: validate count before reading Status Update VDOGreg Kroah-Hartman <[email protected]>
usb: typec: ucsi: displayport: NAKDP_CMD_CONFIGUREwithout a payload VDOGreg Kroah-Hartman <[email protected]>
usb: typec: tcpm: bound altmode_desc[] per iteration in svdm_consume_modes()Greg Kroah-Hartman <[email protected]>
usb: typec: tcpm: validate VDO count in Discover Identity ACK handlersGreg Kroah-Hartman <[email protected]>
usb: typec: ucsi: ccg: reject firmware images without a ':' record headerGreg Kroah-Hartman <[email protected]>
iio: pressure: bmp280: fix stack leak in bmp580 trigger handlerGreg Kroah-Hartman <[email protected]>
iio: imu: adis16550: fix stack leak in trigger handlerGreg Kroah-Hartman <[email protected]>
iio: imu:st_lsm6dsx: fix stack leak in tagged FIFO bufferHoratiu Vultur <[email protected]>
phy: mscc: Use PHY_ID_MATCH_EXACT for VSC8584, VSC8582, VSC8575, VSC856XJouni Högander <[email protected]>
drm/i915/psr: Apply Intel DPCD workaround when SDP on prior line usedJouni Högander <[email protected]>
drm/i915/psr: Read Intel DPCD workaround registerJouni Högander <[email protected]>
drm/i915/psr: Add defininitions forINTEL_WA_REGISTER_CAPSDPCD registerPeter Oberparleiter <[email protected]>
s390/cio: RestoreGFP_DMAfor CHSC allocationAndrei Vagin <[email protected]>
Revert "x86/fpu: Refine and simplify the magic number check during signal return"Michael Bommarito <[email protected]>
smb: client: validate the whole DACL before rewriting it in cifsaclOliver Neukum <[email protected]>
media: rc: ttusbir: fix inverted error logicSean Young <[email protected]>
media: rc: fix race between unregister and urb/irq callbacksPavel Begunkov <[email protected]>
net: skbuff: fixpskb_carveleaking zcopy pagesJiayuan Chen <[email protected]>
ipv6: fix possible infinite loop infib6_select_path()Jiayuan Chen <[email protected]>
ipv6: fix possible infinite loop inrt6_fill_node()Jingguo Tan <[email protected]>
vsock/virtio: bind uarg before filling zerocopy skbZhenghang Xiao <[email protected]>
sctp: fix race betweensctp_wait_for_connectand peeloffDipayaan Roy <[email protected]>
net: mana: Skip redundant detach on already-detached portDipayaan Roy <[email protected]>
net: mana: Add NULL guards in teardown path to prevent panic on attach failureMarco Scardovi <[email protected]>
gpio: rockchip: teardown bugs and resource leaksMarco Scardovi <[email protected]>
gpio: rockchip: convert bank->clk to devm_clk_get_enabled()Dan Carpenter <[email protected]>
gpio: virtuser: Fix uninitialized data bug ingpio_virtuser_direction_do_write()Bartosz Golaszewski <[email protected]>
gpio: adnp: fix flow control regression caused byscoped_guard()Heitor Alves de Siqueira <[email protected]>
Bluetooth:hci_sync: Reset device counters inhci_dev_close_sync()Heitor Alves de Siqueira <[email protected]>
Bluetooth:hci_sync: SetHCI_CMD_DRAIN_WORKQUEUEduring device closeLuiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix possible crash onl2cap_ecred_conn_rspZhenghang Xiao <[email protected]>
Bluetooth: l2cap: clear chan->ident on ECRED reconfiguration successChuck Lever <[email protected]>
net/handshake: Pass negative errno throughhandshake_complete()Chuck Lever <[email protected]>
nvme-tcp: store negative errno in queue->tls_errChuck Lever <[email protected]>
net/handshake: Usespin_lock_bhforhn_lockJijie Shao <[email protected]>
net: hibmcge: disable Relaxed Ordering to fix RX packet corruptionJamal Hadi Salim <[email protected]>
net/sched: Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree"Rahul Chandelkar <[email protected]>
ipv6: rpl: fix hdrlen overflow inipv6_rpl_srh_decompress()Jakub Kicinski <[email protected]>
ethtool: eeprom: add more safeties to EEPROM Netlink fallbackJakub Kicinski <[email protected]>
ethtool: eeprom: add missingethnl_ops_begin()/_complete()during fallbackJakub Kicinski <[email protected]>
ethtool: strset: fix header attribute index inethnl_req_get_phydev()Jakub Kicinski <[email protected]>
ethtool: tsinfo: don't passERR_PTRtogenlmsg_cancelon prepare failureJakub Kicinski <[email protected]>
ethtool: tsinfo: fix uninitialized stats on the by-PHC pathJakub Kicinski <[email protected]>
ethtool: tsconfig: fix missingethnl_ops_complete()Jakub Kicinski <[email protected]>
ethtool: pse-pd: fix missingethnl_ops_complete()Jakub Kicinski <[email protected]>
ethtool: linkstate: fix unbalancedethnl_ops_complete()on PHY lookup errorJakub Kicinski <[email protected]>
ethtool: tsconfig: fix reply error handlingJakub Kicinski <[email protected]>
ethtool: coalesce: cap profile updates atNET_DIM_PARAMS_NUM_PROFILESIdo Schimmel <[email protected]>
bridge: Fix sleep in atomic context in sysfs pathIdo Schimmel <[email protected]>
bridge: Fix sleep in atomic context in netlink pathOliver Hartkopp <[email protected]>
bonding: refuse to enslave CAN devicesZhao Dongdong <[email protected]>
Bluetooth: 6lowpan: checkskb_clone()return value insend_mcast_pkt()Balasubramani Vivekanandan <[email protected]>
drm/xe: Restore IDLEDLY regiter on engine resetCássio Gabriel <[email protected]>
ASoC: codecs: simple-mux: Fix enum control bounds checkSean Shen <[email protected]>
ksmbd: fix FSCTL permission bypass by adding a permission check forFSCTL_SET_SPARSEEric Dumazet <[email protected]>
tunnels: do not assume transport header iniptunnel_pmtud_check_icmp()Eric Dumazet <[email protected]>
vxlan: do not reuse cachedip_hdr()value afterskb_tunnel_check_pmtu()Eric Dumazet <[email protected]>
tunnels: load network headers afterskb_cow()in iptunnel_pmtud_build_icmp[v6]()Li Ming <[email protected]>
cxl/test: Update mock dev array before callingplatform_device_add()Jakub Kicinski <[email protected]>
ethtool: cmis: validate fw->size against start_cmd_payload_sizeJakub Kicinski <[email protected]>
ethtool: cmis: validatestart_cmd_payload_sizefrom moduleJakub Kicinski <[email protected]>
ethtool: cmis: fix u16-to-u8 truncation ofmsleep_pre_rplJakub Kicinski <[email protected]>
ethtool: cmis: require exact CDB reply lengthJakub Kicinski <[email protected]>
ethtool: module: fix cleanup if socket used for flashing multiple devicesJakub Kicinski <[email protected]>
ethtool: module: checkfw_flash_in_progressunderrtnl_lockJakub Kicinski <[email protected]>
ethtool: module: avoid racy updates to dev->ethtool bitfieldJakub Kicinski <[email protected]>
ethtool: module: avoid leaking a netdev ref on module flash errorsJakub Kicinski <[email protected]>
ethtool: module: callethnl_ops_complete()on module flash errorsJakub Kicinski <[email protected]>
ethtool: rss: avoid device context leak on reply-build failureJakub Kicinski <[email protected]>
ethtool: rss: fix hkey leak whenindir_sizeis 0Jakub Kicinski <[email protected]>
ethtool: rss: fixindir_tableand hkey leak onget_rxfhfailureJakub Kicinski <[email protected]>
ethtool: rss: fix falsely ignoring indir table updatesJakub Kicinski <[email protected]>
ethtool: rss: add missing errno on RSS context deleteJakub Kicinski <[email protected]>
ethtool: rss: avoid modifying the RSS context responseBjörn Töpel <[email protected]>
net: Avoid checksumming unreadable skb tail on trimWeiming Shi <[email protected]>
net: team: fix NULL pointer dereference inteam_xmitduring mode changeMarc Harvey <[email protected]>
net: team: Renameport_disabledteam mode op toport_tx_disabledMarc Harvey <[email protected]>
net: team: Remove unusedteam_mode_op,port_enabledAlexander Stein <[email protected]>
gpio: mxc: fixirq_highhandlingLuka Gejak <[email protected]>
net: hsr: fix potential OOB access in supervision frame handlingPrathamesh Deshpande <[email protected]>
net/mlx5: HWS: Reject unsupported remove-header actionCássio Gabriel <[email protected]>
ASoC: Intel:bytcht_es8316: Fix MCLK leak on init errorsCássio Gabriel <[email protected]>
ALSA: pcm: oss: Fix setup list UAF on proc write errorEric Dumazet <[email protected]>
ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table()David Jeffery <[email protected]>
scsi: core: Run queues for all non-SDEV_DEL devices fromscsi_run_host_queuesBreno Leitao <[email protected]>
net/iucv: fix locking in .getsockoptAlexandra Winter <[email protected]>
net/smc: Do not re-initialize smc hashtablesIlya Maximets <[email protected]>
net: netlink: don't set nsid on local notificationsIlya Maximets <[email protected]>
net: netlink: fix sending unassigned nsid after assigned oneZiyu Zhang <[email protected]>
vsock: keep poll shutdown state consistentWeiming Shi <[email protected]>
tun: free page onbuild_skbfailure intun_xdp_one()Weiming Shi <[email protected]>
tun: free page on short-frame rejection intun_xdp_one()Fernando Fernandez Mancera <[email protected]>
netfilter:nf_tables: fix dst corruption in same register operationFlorian Westphal <[email protected]>
netfilter: ebtables: fix OOB read incompat_mtw_from_userFlorian Westphal <[email protected]>
netfilter:xt_cpu: preferraw_smp_processor_idChris Mason <[email protected]>
netfilter: synproxy: refresh tcphdr afterskb_ensure_writableDeepanshu Kartikey <[email protected]>
kernel/fork: validateexit_signalinkernel_clone()Dhabaleshwar Das <[email protected]>
accel/rocket: fix UAF via dangling GEM handle increate_boFlorian Schmaus <[email protected]>
kunit: fix use-after-free in debugfs when using kunit.filterLiu Kai <[email protected]>
HID: remove duplicatehid_warn_ratelimiteddefinitionHongtao Lee <[email protected]>
tools/bootconfig: Fix buf leaks inapply_xbcCarl Lee <[email protected]>
nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systemsDavid Ahern <[email protected]>
xfrm: Check for underflow inxfrm_state_mtuLee Jones <[email protected]>
nfc: llcp: Fix use-after-free race innfc_llcp_recv_cc()Lee Jones <[email protected]>
nfc: llcp: Fix use-after-free inllcp_sock_release()Mingzhe Zou <[email protected]>
bcache: fix uninitialized closure objectVictor Nogueria <[email protected]>
net/sched:sch_sfb: Replace direct dequeue call with peek andqdisc_dequeue_peekedUsama Arif <[email protected]>
xfrm: movepolicy_bydstRCU sync from per-netns .exit to .pre_exitJeremy Kerr <[email protected]>
net: mctp: ensure our nlmsg responses are initialisedDavide Caratti <[email protected]>
net/sched:cls_fw: fix NULL dereference of "old" filters beforechange()Greg Kroah-Hartman <[email protected]>
Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size-------------
Diffstat:
Documentation/netlink/specs/handshake.yaml | 8 + Makefile | 4 +- arch/arm64/include/asm/kvm_host.h | 2 +- arch/arm64/include/asm/tlb.h | 2 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 16 +- arch/arm64/kvm/nested.c | 5 + arch/arm64/kvm/pmu-emul.c | 4 +- arch/arm64/kvm/sys_regs.c | 11 +- arch/mips/dec/platform.c | 109 ++++++++++- arch/riscv/include/asm/syscall_wrapper.h | 4 + arch/x86/kernel/cpu/cpuid-deps.c | 1 + arch/x86/kernel/fpu/signal.c | 11 +- arch/x86/kernel/ftrace.c | 7 + arch/x86/kvm/svm/avic.c | 35 +++- arch/x86/kvm/svm/sev.c | 76 ++++--- drivers/accel/rocket/rocket_gem.c | 17 +- drivers/android/binder/allocation.rs | 8 + drivers/android/binder/process.rs | 7 +- drivers/android/binder/transaction.rs | 11 +- drivers/auxdisplay/line-display.c | 2 +- drivers/bluetooth/btusb.c | 8 +- drivers/bluetooth/hci_qca.c | 42 ++-- drivers/comedi/drivers/comedi_test.c | 5 +- drivers/counter/counter-core.c | 3 +- drivers/cpufreq/intel_pstate.c | 13 +- drivers/gpio/gpio-adnp.c | 4 +- drivers/gpio/gpio-mxc.c | 2 +- drivers/gpio/gpio-rockchip.c | 23 ++- drivers/gpio/gpio-virtuser.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 11 +- drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 +- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 + drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 4 + drivers/gpu/drm/bridge/sil-sii8620.c | 1 + drivers/gpu/drm/drm_gem.c | 2 + drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 113 +++++++++-- drivers/gpu/drm/i915/display/intel_display_core.h | 1 + drivers/gpu/drm/i915/display/intel_display_irq.c | 8 +- drivers/gpu/drm/i915/display/intel_display_types.h | 3 + drivers/gpu/drm/i915/display/intel_dpcd.h | 15 ++ drivers/gpu/drm/i915/display/intel_psr.c | 60 ++++-- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 28 +-- drivers/gpu/drm/xe/xe_guc_ads.c | 5 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-picolcd_cir.c | 1 + drivers/hid/hid-quirks.c | 1 + drivers/hid/wacom_sys.c | 13 +- drivers/hid/wacom_wac.h | 1 + drivers/hwmon/pmbus/adm1266.c | 7 + drivers/hwmon/pmbus/pmbus.h | 5 + drivers/hwmon/pmbus/pmbus_core.c | 8 + drivers/i2c/busses/i2c-davinci.c | 2 +- drivers/iio/adc/ad4695.c | 23 +-- drivers/iio/adc/mt6359-auxadc.c | 1 + drivers/iio/adc/npcm_adc.c | 25 +-- drivers/iio/adc/viperboard_adc.c | 4 +- drivers/iio/adc/xilinx-xadc-core.c | 11 +- drivers/iio/buffer/industrialio-hw-consumer.c | 4 +- drivers/iio/chemical/mhz19b.c | 17 ++ drivers/iio/chemical/scd30_core.c | 2 +- drivers/iio/common/ssp_sensors/ssp_dev.c | 1 + drivers/iio/dac/ad3530r.c | 54 +++-- drivers/iio/dac/ad5686.c | 56 ++++-- drivers/iio/dac/ad5686.h | 1 + drivers/iio/dac/max5821.c | 9 +- drivers/iio/gyro/adis16260.c | 3 + drivers/iio/gyro/itg3200_buffer.c | 2 +- drivers/iio/imu/adis16550.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +- drivers/iio/industrialio-buffer.c | 1 + drivers/iio/inkern.c | 6 +- drivers/iio/light/cm3323.c | 5 +- drivers/iio/light/veml6070.c | 14 +- drivers/iio/magnetometer/st_magn_core.c | 13 +- drivers/iio/pressure/bmp280-core.c | 2 +- drivers/iio/temperature/tsys01.c | 2 +- drivers/input/joystick/xpad.c | 14 +- drivers/input/misc/ims-pcu.c | 2 +- drivers/input/mouse/elan_i2c_core.c | 5 + drivers/input/mouse/synaptics.c | 1 + drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- drivers/input/touchscreen/usbtouchscreen.c | 5 + drivers/iommu/io-pgtable-arm-v7s.c | 18 +- drivers/mailbox/mailbox.c | 15 +- drivers/mailbox/tegra-hsp.c | 2 +- drivers/md/bcache/super.c | 3 +- drivers/media/cec/core/cec-core.c | 2 +- drivers/media/common/siano/smsir.c | 1 + drivers/media/i2c/ir-kbd-i2c.c | 2 + drivers/media/pci/bt8xx/bttv-input.c | 3 +- drivers/media/pci/cx23885/cx23885-input.c | 1 + drivers/media/pci/cx88/cx88-input.c | 3 +- drivers/media/pci/dm1105/dm1105.c | 1 + drivers/media/pci/mantis/mantis_input.c | 1 + drivers/media/pci/saa7134/saa7134-input.c | 1 + drivers/media/pci/smipcie/smipcie-ir.c | 1 + drivers/media/pci/ttpci/budget-ci.c | 1 + drivers/media/rc/ati_remote.c | 6 +- drivers/media/rc/ene_ir.c | 2 +- drivers/media/rc/fintek-cir.c | 3 +- drivers/media/rc/igorplugusb.c | 3 +- drivers/media/rc/iguanair.c | 1 + drivers/media/rc/img-ir/img-ir-hw.c | 3 +- drivers/media/rc/img-ir/img-ir-raw.c | 3 +- drivers/media/rc/imon.c | 3 +- drivers/media/rc/ir-hix5hd2.c | 2 +- drivers/media/rc/ir_toy.c | 1 + drivers/media/rc/ite-cir.c | 2 +- drivers/media/rc/mceusb.c | 1 + drivers/media/rc/rc-ir-raw.c | 5 - drivers/media/rc/rc-loopback.c | 1 + drivers/media/rc/rc-main.c | 6 +- drivers/media/rc/redrat3.c | 4 +- drivers/media/rc/st_rc.c | 2 +- drivers/media/rc/streamzap.c | 7 +- drivers/media/rc/sunxi-cir.c | 1 + drivers/media/rc/ttusbir.c | 4 +- drivers/media/rc/winbond-cir.c | 2 +- drivers/media/rc/xbox_remote.c | 5 +- drivers/media/usb/au0828/au0828-input.c | 1 + drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 1 + drivers/media/usb/dvb-usb/dvb-usb-remote.c | 6 +- drivers/media/usb/em28xx/em28xx-input.c | 1 + drivers/misc/rp1/rp1_pci.c | 1 + drivers/net/bonding/bond_main.c | 6 + drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c | 3 + .../ethernet/marvell/octeontx2/nic/otx2_common.c | 2 + .../mellanox/mlx5/core/steering/hws/fs_hws.c | 4 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 78 +++++--- drivers/net/macsec.c | 3 +- drivers/net/phy/micrel.c | 15 +- drivers/net/phy/mscc/mscc.h | 8 +- drivers/net/phy/mscc/mscc_main.c | 23 +-- drivers/net/team/team_core.c | 51 +++-- drivers/net/team/team_mode_loadbalance.c | 4 +- drivers/net/tun.c | 5 +- drivers/net/vxlan/vxlan_core.c | 4 +- drivers/net/wireguard/send.c | 20 +- drivers/nfc/nxp-nci/i2c.c | 21 +- drivers/nvme/host/tcp.c | 2 +- drivers/parport/share.c | 11 +- drivers/platform/x86/intel/vsec.c | 91 ++++----- drivers/s390/cio/chsc.c | 4 +- drivers/s390/cio/chsc_sch.c | 20 +- drivers/s390/cio/scm.c | 2 +- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/scsi_lib.c | 27 ++- drivers/scsi/scsi_transport_fc.c | 77 ++++---- drivers/spi/spi-mem.c | 15 +- drivers/staging/gpib/cb7210/cb7210.c | 10 +- drivers/staging/media/av7110/av7110_ir.c | 1 + drivers/target/iscsi/iscsi_target.c | 5 +- drivers/target/iscsi/iscsi_target_auth.c | 19 +- drivers/target/iscsi/iscsi_target_nego.c | 7 +- drivers/target/iscsi/iscsi_target_parameters.c | 62 ++++-- drivers/target/iscsi/iscsi_target_parameters.h | 2 +- drivers/thunderbolt/property.c | 32 ++- drivers/tty/serdev/core.c | 21 ++ drivers/tty/serial/8250/8250_dw.c | 2 +- drivers/tty/serial/8250/8250_port.c | 7 +- drivers/tty/serial/altera_jtaguart.c | 7 +- drivers/tty/serial/dz.c | 171 ++++++++-------- drivers/tty/serial/fsl_lpuart.c | 15 +- drivers/tty/serial/pch_uart.c | 19 +- drivers/tty/serial/qcom_geni_serial.c | 16 +- drivers/tty/serial/samsung_tty.c | 8 - drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/zs.c | 218 ++++++++------------- drivers/tty/serial/zs.h | 1 - drivers/usb/cdns3/cdns3-gadget.c | 12 +- drivers/usb/cdns3/cdns3-plat.c | 11 +- drivers/usb/chipidea/core.c | 16 +- drivers/usb/class/cdc-acm.c | 2 - drivers/usb/class/cdc-acm.h | 2 + drivers/usb/class/usbtmc.c | 14 ++ drivers/usb/core/config.c | 9 +- drivers/usb/core/quirks.c | 4 + drivers/usb/dwc2/hcd.c | 4 +- drivers/usb/dwc3/dwc3-xilinx.c | 27 +-- drivers/usb/gadget/composite.c | 5 +- drivers/usb/gadget/function/f_fs.c | 26 ++- drivers/usb/gadget/function/f_hid.c | 3 +- drivers/usb/gadget/function/f_uvc.c | 28 ++- drivers/usb/gadget/udc/dummy_hcd.c | 4 + drivers/usb/gadget/udc/net2280.c | 4 +- drivers/usb/host/xhci-tegra.c | 77 ++++---- drivers/usb/musb/omap2430.c | 3 +- drivers/usb/serial/belkin_sa.c | 3 + drivers/usb/serial/cypress_m8.c | 20 +- drivers/usb/serial/digi_acceleport.c | 23 ++- drivers/usb/serial/keyspan.c | 4 + drivers/usb/serial/mct_u232.c | 26 ++- drivers/usb/serial/mxuport.c | 8 + drivers/usb/serial/omninet.c | 9 +- drivers/usb/serial/option.c | 9 +- drivers/usb/serial/safe_serial.c | 11 ++ drivers/usb/storage/unusual_uas.h | 7 + drivers/usb/typec/altmodes/displayport.c | 2 + drivers/usb/typec/tcpm/tcpci_maxim_core.c | 9 + drivers/usb/typec/tcpm/tcpm.c | 117 ++++++----- drivers/usb/typec/tcpm/wcove.c | 13 +- drivers/usb/typec/tipd/core.c | 1 + drivers/usb/typec/ucsi/displayport.c | 4 + drivers/usb/typec/ucsi/ucsi.c | 24 ++- drivers/usb/typec/ucsi/ucsi_ccg.c | 5 + drivers/usb/usbip/vudc_dev.c | 1 + drivers/usb/usbip/vudc_transfer.c | 3 +- fs/hpfs/alloc.c | 2 +- fs/smb/client/cifsacl.c | 116 ++++++++--- fs/smb/client/smb2pdu.c | 2 +- fs/smb/server/smb2pdu.c | 11 ++ fs/smb/server/smbacl.c | 8 +- include/kunit/test.h | 1 + include/linux/compat.h | 4 + include/linux/compiler-clang.h | 6 + include/linux/compiler_attributes.h | 11 ++ include/linux/compiler_types.h | 4 + include/linux/hid.h | 2 - include/linux/if_team.h | 3 +- include/linux/intel_vsec.h | 4 +- include/linux/mailbox_controller.h | 3 + include/linux/parport.h | 1 + include/linux/serdev.h | 1 + include/linux/serial_core.h | 12 ++ include/linux/syscalls.h | 4 + include/media/rc-core.h | 2 - include/net/netfilter/nf_tables.h | 7 + include/net/xfrm.h | 3 +- ipc/util.c | 2 +- kernel/fork.c | 11 +- lib/debugobjects.c | 2 +- lib/kunit/executor.c | 19 +- lib/kunit/test.c | 1 + mm/damon/sysfs-schemes.c | 8 +- mm/memcontrol.c | 6 + mm/memfd.c | 12 +- mm/rmap.c | 2 + mm/slab_common.c | 2 + mm/slub.c | 1 + net/bluetooth/6lowpan.c | 2 + net/bluetooth/hci_conn.c | 4 +- net/bluetooth/hci_sync.c | 16 +- net/bluetooth/hidp/core.c | 23 ++- net/bluetooth/iso.c | 12 +- net/bluetooth/l2cap_core.c | 41 +++- net/bluetooth/l2cap_sock.c | 16 +- net/bridge/br_netlink.c | 17 +- net/bridge/br_switchdev.c | 1 - net/bridge/br_sysfs_if.c | 30 ++- net/bridge/netfilter/ebtables.c | 30 +++ net/core/devmem.c | 11 ++ net/core/filter.c | 2 +- net/core/skbuff.c | 45 ++++- net/ethtool/cmis.h | 4 +- net/ethtool/cmis_cdb.c | 9 +- net/ethtool/cmis_fw_update.c | 44 +++-- net/ethtool/coalesce.c | 6 + net/ethtool/eeprom.c | 10 +- net/ethtool/linkstate.c | 6 +- net/ethtool/module.c | 41 ++-- net/ethtool/netlink.c | 4 +- net/ethtool/netlink.h | 4 +- net/ethtool/pse-pd.c | 10 +- net/ethtool/rss.c | 37 ++-- net/ethtool/strset.c | 2 +- net/ethtool/tsconfig.c | 15 +- net/ethtool/tsinfo.c | 19 +- net/handshake/genl.c | 3 +- net/handshake/genl.h | 1 + net/handshake/handshake-test.c | 2 +- net/handshake/handshake.h | 4 +- net/handshake/netlink.c | 6 +- net/handshake/request.c | 16 +- net/handshake/tlshd.c | 6 +- net/hsr/hsr_forward.c | 4 +- net/ipv4/ah4.c | 2 +- net/ipv4/esp4.c | 4 +- net/ipv4/ip_tunnel_core.c | 22 ++- net/ipv4/sysctl_net_ipv4.c | 2 +- net/ipv6/ah6.c | 2 +- net/ipv6/datagram.c | 54 ++++- net/ipv6/esp6.c | 4 +- net/ipv6/exthdrs.c | 6 +- net/ipv6/ip6_vti.c | 23 ++- net/ipv6/route.c | 5 + net/iucv/af_iucv.c | 20 +- net/key/af_key.c | 6 +- net/l2tp/l2tp_core.c | 11 +- net/mctp/device.c | 1 + net/mctp/neigh.c | 1 + net/mctp/route.c | 1 + net/mptcp/fastopen.c | 4 +- net/mptcp/mib.c | 1 - net/mptcp/mib.h | 1 - net/mptcp/protocol.c | 65 ++++-- net/mptcp/protocol.h | 31 ++- net/mptcp/subflow.c | 8 +- net/netfilter/nf_conntrack_proto_tcp.c | 3 +- net/netfilter/nf_synproxy_core.c | 2 + net/netfilter/nft_bitwise.c | 18 +- net/netfilter/nft_byteorder.c | 13 +- net/netfilter/xt_cpu.c | 2 +- net/netlink/af_netlink.c | 11 +- net/nfc/hci/core.c | 10 + net/nfc/llcp_core.c | 11 ++ net/nfc/llcp_sock.c | 2 + net/nfc/nci/hci.c | 10 + net/rxrpc/ar-internal.h | 14 +- net/rxrpc/call_event.c | 22 +-- net/rxrpc/call_object.c | 2 + net/rxrpc/conn_event.c | 30 ++- net/rxrpc/insecure.c | 8 +- net/rxrpc/recvmsg.c | 68 +++++-- net/rxrpc/rxgk.c | 147 ++++++-------- net/rxrpc/rxgk_app.c | 46 ++--- net/rxrpc/rxgk_common.h | 66 +++---- net/rxrpc/rxkad.c | 115 ++++------- net/sched/cls_fw.c | 6 +- net/sched/sch_netem.c | 40 ---- net/sched/sch_sfb.c | 2 +- net/sctp/socket.c | 2 + net/smc/af_smc.c | 4 +- net/vmw_vsock/af_vsock.c | 49 +++-- net/vmw_vsock/hyperv_transport.c | 9 +- net/vmw_vsock/virtio_transport_common.c | 26 ++- net/vmw_vsock/vmci_transport.c | 8 +- net/xfrm/xfrm_input.c | 16 +- net/xfrm/xfrm_ipcomp.c | 12 +- net/xfrm/xfrm_iptfs.c | 29 ++- net/xfrm/xfrm_policy.c | 17 +- net/xfrm/xfrm_state.c | 23 ++- net/xfrm/xfrm_user.c | 5 +- sound/core/oss/pcm_oss.c | 18 +- .../motu/motu-register-dsp-message-parser.c | 11 +- sound/hda/codecs/realtek/alc269.c | 1 + sound/soc/codecs/simple-mux.c | 2 +- sound/soc/intel/boards/bytcht_es8316.c | 29 ++- sound/soc/qcom/qdsp6/q6asm-dai.c | 43 ++-- sound/usb/mixer_scarlett2.c | 33 +++- tools/bootconfig/main.c | 4 +- tools/testing/cxl/test/cxl.c | 105 ++++------ tools/testing/selftests/net/mptcp/mptcp_connect.sh | 6 +- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 10 +- 346 files changed, 3284 insertions(+), 1733 deletions(-)
Jon Hunter
maintainerQuoted 51 lines · Pavel Machek
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.18.35 release. There are 315 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
We see build problem here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/jobs/14732223960
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/2582906697Best regards,
Pavel
arch/arm64/kvm/nested.c: In function 'kvm_init_nv_sysregs':
1807
12:45:08arch/arm64/kvm/nested.c:1776:9: error: 'resx' undeclared (first use in this function); did you mean 'res1'? 1808
12:45:08
1776 | resx.res0 =ZCR_ELx_RES0|GENMASK_ULL(8, 4);
1809
12:45:08| ^~~~1810
12:45:08
| res1
1811
12:45:08arch/arm64/kvm/nested.c:1776:9: note: each undeclared identifier is reported only once for each function it appears in 1812
12:45:08arch/arm64/kvm/nested.c:1778:9: error: too few arguments to function 'set_sysreg_masks'
1813
12:45:08
1778 |set_sysreg_masks(kvm, ZCR_EL2, resx);
1814
12:45:08| ^~~~~~~~~~~~~~~~1815
12:45:08arch/arm64/kvm/nested.c:1641:29: note: declared here
1816
12:45:08
1641 | static__always_inlinevoidset_sysreg_masks(struct kvm *kvm, int sr, u64 res0, u64 res1)
1817
12:45:08| ^~~~~~~~~~~~~~~~
Quoted 10 lines
1818
12:45:08
CCblock/holder.o
1819
12:45:08
CCdrivers/irqchip/irq-ls-scfg-msi.o
1820
12:45:09
make[4]: *** [scripts/Makefile.build:287:arch/arm64/kvm/nested.o] Error 1
I am seeing the same build error for ARM64.
Jon
Signature · 1 line
nvpublic
Hi!
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines
This is the start of the stable review cycle for the 6.18.35 release. There are 315 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
We see build problem here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/jobs/14732223960
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/2582906697I am seeing the same build error for ARM64.
Thanks for confirmation.
There are more details in Message-ID:
<[email protected]> .
Best regards,
Pavel
Quoted 8 lines · On Sun, 07 Jun 2026 11:56:27 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.18.35 release. There are 315 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 09 Jun 2026 09:56:45 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64:
arm32 builds fine too.
However, on arm64 I am seeing:
arch/arm64/kvm/nested.c:1776:2: error: use of undeclared identifier 'resx'
1776 | resx.res0 = ZCR_ELx_RES0 | GENMASK_ULL(8, 4);
| ^
arch/arm64/kvm/nested.c:1777:2: error: use of undeclared identifier 'resx'
1777 | resx.res1 = ZCR_ELx_RES1;
| ^
arch/arm64/kvm/nested.c:1778:33: error: use of undeclared identifier 'resx'
1778 | set_sysreg_masks(kvm, ZCR_EL2, resx);
| ^
Due to commit 10206eaad1b9 ("KVM: arm64: Correctly cap ZCR_EL2 provided by a guest hypervisor") here.
resx indeed doesn't exist, and it seems like it was added by commits 0879478913dd ("KVM: arm64: Introduce data structure tracking both RES0 and RES1 bits") etc., which are in 7.0, from this series:
https://lore.kernel.org/all/[email protected]/
So either we make a targeted backport or backport some commits, no?
I hope that help!
Cheers,
Miguel
Am 07.06.2026 um 11:56 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.18.35 release. There are 315 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Build tested in our x86,loongarch,riscv config successfully without error.
NOTE: Revert "KVM: arm64: Correctly cap ZCR_EL2 provided by a guest hypervisor" which reported by Marc Zyngier <[email protected]> applied and arm64 built ok.
BRs
Wentao Guan
defconfigs:
https://gist.github.com/opsiff/a840ae9e3d6857f5b7bacb9cdc49f8e9
Log:
Linux version 6.18.35-rc1-g24a2e29b003c (guanwentao@uos-PC) (aarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP PREEMPT_DYNAMIC Linux version 6.18.35-rc1-g24a2e29b003c (guanwentao@uos-PC) (aarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #2 SMP PREEMPT_DYNAMIC Mon Jun 8 09:47:30 CST 2026 Linux version 6.18.35-rc1-ga392253fde81 (guanwentao@uos-PC) (loongarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP PREEMPT_DYNAMIC Linux version 6.18.35-rc1-ga392253fde81 (guanwentao@uos-PC) (loongarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #5 SMP PREEMPT_DYNAMIC Mon Jun 8 11:23:18 CST 2026 Linux version 6.18.35-rc1+ (guanwentao@uos-PC) (riscv64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP PREEMPT
Linux version 6.18.35-rc1+ (guanwentao@uos-PC) (riscv64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #4 SMP PREEMPT Mon Jun 8 10:20:57 CST 2026 Linux version 6.18.35-rc1-ga392253fde81 (guanwentao@uos-PC) (gcc (Deepin 12.3.0-17deepin15) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP PREEMPT_DYNAMIC
Linux version 6.18.35-rc1-ga392253fde81 (guanwentao@uos-PC) (gcc (Deepin 12.3.0-17deepin15) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #1 SMP PREEMPT_DYNAMIC Mon Jun 8 01:26:28 CST 2026
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.18.35 release. There are 315 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 09 Jun 2026 09:56:45 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.18.35-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.18.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.18.35 release. There are 315 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 09 Jun 2026 09:56:45 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.18.35-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.18.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Greg Kroah-Hartman
maintainercover 6.12.93-rc1 review
This is the start of the stable review cycle for the 6.12.93 release. There are 307 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 09 Jun 2026 09:56:47 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.93-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.12.93-rc1
Pratyush Yadav (Google) <[email protected]>
memfd: deny writeable mappings when implying SEAL_WRITE
Liu Ye <[email protected]>
mm/memfd: fix spelling and grammatical issues
Lorenzo Stoakes <[email protected]>
mm: perform all memfd seal checks in a single place
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serialize GPIO PMBus accesses with pmbus_lock
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serialize NVMEM blackbox read with pmbus_lock
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock
Alexis Lothoré (eBPF Foundation) <[email protected]>
x86/ftrace: Relocate %rip-relative percpu refs in dynamic trampolines
Ingo Molnar <[email protected]>
x86/alternatives: Rename 'apply_relocation()' to 'text_poke_apply_relocation()'
Myrrh Periwinkle <[email protected]>
usb: typec: ucsi: Don't update power_supply on power role change if not connected
Michael Bommarito <[email protected]>
scsi: target: iscsi: Fix CRC overread and double-free in iscsit_handle_text_cmd()
Michael Bommarito <[email protected]>
thunderbolt: property: Cap recursion depth in __tb_property_parse_dir()
Myrrh Periwinkle <[email protected]>
usb: typec: ucsi: Check if power role change actually happened before handling
Wentao Liang <[email protected]>
usb: musb: omap2430: Fix use-after-free in omap2430_probe()
Radhey Shyam Pandey <[email protected]>
usb: dwc3: xilinx: fix error handling in zynqmp init error paths
Cássio Gabriel <[email protected]>
ALSA: firewire-motu: Protect register DSP event queue positions
Rodrigo Alencar <[email protected]>
iio: dac: ad5686: fix ref bit initialization for single-channel parts
Antoniu Miclaus <[email protected]>
iio: chemical: scd30: fix division by zero in write_raw
Jonathan Cameron <[email protected]>
iio: chemical: scd30: Use guard(mutex) to allow early returns
SeongJae Park <[email protected]>
mm/damon/sysfs-schemes: delete tried region in regions_rmdirs()
Shardul Bankar <[email protected]>
mptcp: do not drop partial packets
Paolo Abeni <[email protected]>
mptcp: handle first subflow closing consistently
Paolo Abeni <[email protected]>
mptcp: introduce the mptcp_init_skb helper
Dawei Feng <[email protected]>
octeontx2-pf: avoid double free of pool->stack on AQ init failure
Zeng Heng <[email protected]>
arm64: tlb: Flush walk cache when unsharing PMD tables
Paolo Abeni <[email protected]>
mptcp: reset rcv wnd on disconnect
Paolo Abeni <[email protected]>
mptcp: cleanup fallback dummy mapping generation
Masami Hiramatsu (Google) <[email protected]>
ring-buffer: Flush and stop persistent ring buffer on panic
Jose Ignacio Tornos Martinez <[email protected]>
ice: fix VF queue configuration with low MTU values
Li Xiasong <[email protected]>
mptcp: pm: fix ADD_ADDR timer infinite retry on option space insufficient
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: drop nanoseconds width specifier
Michael Bommarito <[email protected]>
net: hsr: defer node table free until after RCU readers
Lukas Wunner <[email protected]>
platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery
Alistair Popple <[email protected]>
mm/memory: fix spurious warning when unmapping device-private/exclusive pages
Cássio Gabriel <[email protected]>
ALSA: scarlett2: Allow flash writes ending at segment boundary
Geoffrey D. Bennett <[email protected]>
ALSA: scarlett2: Return ENOSPC for out-of-bounds flash writes
Shuai Zhang <[email protected]>
Bluetooth: hci_qca: Convert timeout from jiffies to ms
Uwe Kleine-König <[email protected]>
Bluetooth: hci_qca: Migrate to serdev specific shutdown function
Uwe Kleine-König <[email protected]>
serdev: Provide a bustype shutdown function
David Howells <[email protected]>
rxrpc: Fix RESPONSE packet verification to extract skb to a linear buffer
David Howells <[email protected]>
rxrpc: Fix DATA decrypt vs splice() by copying data to buffer in recvmsg
Aleksandr Nogikh <[email protected]>
x86/kexec: Disable KCOV instrumentation after load_segments()
Brian Gerst <[email protected]>
x86/boot: Disable stack protector for early boot code
Tushar Dave <[email protected]>
iommu: Skip PASID validation for devices without PASID capability
Wei-Cheng Chen <[email protected]>
xhci: tegra: Fix ghost USB device on dual-role port unplug
Johan Hovold <[email protected]>
USB: serial: digi_acceleport: fix memory corruption with small endpoints
Johan Hovold <[email protected]>
USB: serial: cypress_m8: fix memory corruption with small endpoint
Maciej W. Rozycki <[email protected]>
serial: zs: Convert to use a platform device
Maciej W. Rozycki <[email protected]>
serial: zs: Switch to using channel reset
Maciej W. Rozycki <[email protected]>
serial: zs: Fix bootconsole handover lockup
Maciej W. Rozycki <[email protected]>
serial: dz: Convert to use a platform device
Maciej W. Rozycki <[email protected]>
serial: dz: Fix bootconsole handover lockup
Maciej W. Rozycki <[email protected]>
serial: dz: Fix bootconsole message clobbering at chip reset
David Francis <[email protected]>
drm/amdkfd: Check for pdd drm file first in CRIU restore path
Eric Huang <[email protected]>
drm/amdkfd: fix a vulnerability of integer overflow in kfd debugger
Eric Huang <[email protected]>
drm/amdkfd: fix NULL pointer bug in svm_range_set_attr
Shitalkumar Gandhi <[email protected]>
serial: fsl_lpuart: fix rx buffer and DMA map leaks in start_rx_dma
Maciej W. Rozycki <[email protected]>
serial: zs: Fix swapped RI/DSR modem line transition counting
Hongling Zeng <[email protected]>
serial: sh-sci: fix memory region release in error path
Viken Dadhaniya <[email protected]>
serial: qcom_geni: fix kfifo underflow when flush precedes DMA completion IRQ
Prasanna S <[email protected]>
serial: qcom-geni: fix UART_RX_PAR_EN bit position
Myeonghun Pak <[email protected]>
serial: altera_jtaguart: handle uart_add_one_port() failures
Timur Kristóf <[email protected]>
drm/amd/pm/si: Disregard vblank time when no displays are connected
Janusz Krzysztofik <[email protected]>
drm/i915: Fix potential UAF in TTM object purge
Berkant Koc <[email protected]>
drm/hyperv: validate VMBus packet size in receive callback
Berkant Koc <[email protected]>
drm/hyperv: validate resolution_count and fix WIN8 fallback
Alexandru Hossu <[email protected]>
scsi: target: iscsi: Validate CHAP_R length before base64 decode
Michael Bommarito <[email protected]>
scsi: target: iscsi: Bound iscsi_encode_text_output() appends to rsp_buf
Michael Bommarito <[email protected]>
scsi: scsi_transport_fc: Widen FPIN pname walker counter to u32
Michael Bommarito <[email protected]>
scsi: fcoe: Reject FIP descriptors with zero fip_dlen in CVL walker
Michael Bommarito <[email protected]>
thunderbolt: property: Reject dir_len < 4 to prevent size_t underflow
Michael Bommarito <[email protected]>
thunderbolt: property: Reject u32 wrap in tb_property_entry_valid()
Michael Bommarito <[email protected]>
usb: gadget: f_fs: serialize DMABUF cancel against request completion
Michael Bommarito <[email protected]>
usb: gadget: f_fs: copy only received bytes on short ep0 read
Seungjin Bae <[email protected]>
usb: gadget: dummy_hcd: Reject hub port requests for non-existent ports
Jeremy Erazo <[email protected]>
usb: gadget: composite: fix integer underflow in WebUSB GET_URL handling
Guangshuo Li <[email protected]>
usb: gadget: f_hid: fix device reference leak in hidg_alloc()
Guangshuo Li <[email protected]>
usb: gadget: net2280: Fix double free in probe error path
Kai Aizen <[email protected]>
usb: gadget: uvc: hold opts->lock across XU walks in uvc_function_bind
Johan Hovold <[email protected]>
USB: serial: mct_u232: fix missing interrupt-in transfer sanity check
Johan Hovold <[email protected]>
USB: serial: mxuport: fix memory corruption with small endpoint
Johan Hovold <[email protected]>
USB: serial: keyspan: fix missing indat transfer sanity check
Zhang Cen <[email protected]>
USB: serial: cypress_m8: validate interrupt packet headers
Zhang Cen <[email protected]>
USB: serial: belkin_sa: validate interrupt status length
Wanquan Zhong <[email protected]>
USB: serial: option: add missing RSVD(5) flag for Rolling RW135R-GL
Jan Volckaert <[email protected]>
USB: serial: option: add MeiG SRM813Q
Sebastian Reichel <[email protected]>
usb: typec: tcpm: improve handling of DISCOVER_MODES failures
Heitor Alves de Siqueira <[email protected]>
usb: usbtmc: reject interrupt endpoints with small wMaxPacketSize
Heitor Alves de Siqueira <[email protected]>
usb: usbtmc: check URB actual_length for interrupt-IN notifications
Michael Bommarito <[email protected]>
usbip: vudc: Fix use after free bug in vudc_remove due to race condition
Sam Burkels <[email protected]>
usb: storage: Add quirks for PNY Elite Portable SSD
Stephen J. Fuhry <[email protected]>
USB: quirks: add NO_LPM for Lenovo ThinkPad USB-C Dock Gen2 hub controllers
Michal Pecio <[email protected]>
usb: core: Fix up Interrupt IN endpoints with bogus wBytesPerInterval
Xu Yang <[email protected]>
usb: chipidea: core: convert ci_role_switch to local variable
Tudor Ambarus <[email protected]>
tty: serial: samsung: Remove redundant port lock acquisition in rx helpers
Zhaoyang Yu <[email protected]>
tty: serial: pch_uart: add check for dma_alloc_coherent()
Guangshuo Li <[email protected]>
counter: Fix refcount leak in counter_alloc() error path
Ian Abbott <[email protected]>
comedi: comedi_test: Fix limiting of convert_arg in waveform_ai_cmdtest()
Ian Abbott <[email protected]>
comedi: comedi_test: fix check for valid scan_begin_src in waveform_ai_cmdtest()
Nicolás Bazaes <[email protected]>
Input: synaptics - add LEN2058 to SMBus passlist for ThinkPad E490
Dmitry Torokhov <[email protected]>
Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem
Ali Ganiyev <[email protected]>
ksmbd: OOB read regression in smb_check_perm_dacl() ACE-walk loops
Dmitriy Zharov <[email protected]>
Input: xpad - add support for ASUS ROG RAIKIRI II
Qbeliw Tanaka <[email protected]>
Input: xpad - add "Nova 2 Lite" from GameSir
Jingguo Tan <[email protected]>
xfrm: esp: restore combined single-frag length gate
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: do not set stream state in event and trigger callbacks
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: close stream only when running
Hamza Mahfooz <[email protected]>
netfilter: conntrack: tcp: do not force CLOSE on invalid-seq RST without direction check
Geoffrey D. Bennett <[email protected]>
ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417
Michael Bommarito <[email protected]>
xfrm: ah: use skb_to_full_sk in async output callbacks
Maoyi Xie <[email protected]>
xfrm: route MIGRATE notifications to caller's netns
Ashutosh Desai <[email protected]>
nfc: hci: fix out-of-bounds read in HCP header parsing
Arnd Bergmann <[email protected]>
iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
Lee Jones <[email protected]>
HID: wacom: Fix OOB write in wacom_hid_set_device_mode()
Minh Nguyen <[email protected]>
net: skbuff: fix missing zerocopy reference in pskb_carve helpers
Kuniyuki Iwashima <[email protected]>
ip6: vti: Use ip6_tnl.net in vti6_changelink().
Michael Bommarito <[email protected]>
l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname
Zhengchuan Liang <[email protected]>
xfrm: input: hold netns during deferred transport reinjection
Qi Tang <[email protected]>
ipv6: validate extension header length before copying to cmsg
Maoyi Xie <[email protected]>
ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
Zhengchuan Liang <[email protected]>
ipv6: exthdrs: refresh nh after handling HAO option
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: fix error handling in prepare and set_params
Justin Iurman <[email protected]>
ipv6: exthdrs: refresh nh pointer after ipv6_hop_jumbo()
Junrui Luo <[email protected]>
macsec: fix replay protection at XPN lower-PN wrap
Yuqi Xu <[email protected]>
bpf: sockmap: fix tail fragment offset in bpf_msg_push_data
Jason A. Donenfeld <[email protected]>
wireguard: send: append trailer after expanding head
Dmitry Torokhov <[email protected]>
Input: elan_i2c - validate firmware size before use
Dan Carpenter <[email protected]>
usb: dwc2: Fix use after free in debug code
Peter Chen <[email protected]>
usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles
Peter Chen <[email protected]>
usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure
Yongchao Wu <[email protected]>
usb: cdns3: gadget: fix request skipping after clearing halt
Johan Hovold <[email protected]>
USB: serial: omninet: fix memory corruption with small endpoint
Benoît Monin <[email protected]>
iio: buffer: Fix DMA fence leak in iio_buffer_enqueue_dmabuf()
Felix Gu <[email protected]>
iio: buffer: hw-consumer: fix use-after-free in error path
Aldo Conte <[email protected]>
iio: light: cm3323: fix reg_conf not being initialized correctly
Advait Dhamorikar <[email protected]>
iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL
Salah Triki <[email protected]>
iio: temperature: tsys01: fix broken PROM checksum validation
Sanjay Chitroda <[email protected]>
iio: ssp_sensors: cancel delayed work_refresh on remove
Antoniu Miclaus <[email protected]>
iio: gyro: adis16260: fix division by zero in write_raw
David Carlier <[email protected]>
iio: gyro: itg3200: fix i2c read into the wrong stack location
Salah Triki <[email protected]>
iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw
Salah Triki <[email protected]>
iio: adc: mt6359: fix unchecked return value in mt6358_read_imp
Rodrigo Alencar <[email protected]>
iio: dac: ad5686: acquire lock when doing powerdown control
Rodrigo Alencar <[email protected]>
iio: dac: ad5686: fix input raw value check
Salah Triki <[email protected]>
iio: dac: max5821: fix return value check in powerdown sync
David Carlier <[email protected]>
iio: adc: npcm: fix unbalanced clk_disable_unprepare()
Christofer Jonason <[email protected]>
iio: adc: xilinx-xadc: Fix sequencer mode in postdisable for dual mux
Nathan Chancellor <[email protected]>
Disable -Wattribute-alias for clang-23 and newer
Sean Christopherson <[email protected]>
KVM: SEV: Don't explicitly pass PSC buffer to snp_begin_psc()
Sean Christopherson <[email protected]>
KVM: SEV: Use READ_ONCE() when reading entries/indices from PSC buffer
Sean Christopherson <[email protected]>
KVM: SEV: Check PSC request indices against the actual size of the buffer
Sean Christopherson <[email protected]>
KVM: SEV: Compute the correct max length of the in-GHCB scratch area
Sean Christopherson <[email protected]>
KVM: SEV: WARN if KVM attempts to setup scratch area with min_len==0
Sean Christopherson <[email protected]>
KVM: SEV: Use the size of the PSC header as the minimum size for PSC requests
Michael Roth <[email protected]>
KVM: SEV: Require in-GHCB scratch area if GHCB v2+ is in use
Sean Christopherson <[email protected]>
KVM: SVM: Flush the current TLB when transitioning from xAVIC => x2AVIC
Qiang Ma <[email protected]>
KVM: arm64: PMU: Preserve AArch32 counter low bits
Wentao Guan <[email protected]>
USB: cdc-acm: Fix bit overlap and move quirk definitions to header
Ben Hutchings <[email protected]>
parport: Fix race between port and client registration
Dmitry Torokhov <[email protected]>
Input: xpad - fix out-of-bounds access for Share button
Doruk Tan Ozturk <[email protected]>
Bluetooth: hci_sync: fix UAF in hci_le_create_cis_sync
Muhammad Bilal <[email protected]>
Bluetooth: ISO: serialize iso_sock_clear_timer with socket lock
Muhammad Bilal <[email protected]>
Bluetooth: ISO: fix UAF in iso_recv_frame
Muhammad Bilal <[email protected]>
Bluetooth: HIDP: fix missing length checks in hidp_input_report()
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: use chan timer to close channels in cleanup_listen()
Stepan Ionichev <[email protected]>
auxdisplay: line-display: fix OOB read on zero-length message_store()
Linpu Yu <[email protected]>
ipc: limit next_id allocation to the valid ID range
Mikulas Patocka <[email protected]>
hpfs: fix a crash if hpfs_map_dnode_bitmap fails
Shuai Zhang <[email protected]>
Bluetooth: btusb: Allow firmware re-download when version matches
hlleng <[email protected]>
HID: quirks: Add ALWAYS_POLL quirk for SIGMACHIP USB mouse
Thomas Fourier <[email protected]>
Input: ims-pcu - fix usb_free_coherent() size in ims_pcu_buffers_free()
Henri A <[email protected]>
media: rc: igorplugusb: fix control request setup packet
Johan Hovold <[email protected]>
USB: serial: safe_serial: fix memory corruption with small endpoint
Greg Kroah-Hartman <[email protected]>
usb: typec: ucsi: validate connector number in ucsi_connector_change()
Greg Kroah-Hartman <[email protected]>
usb: typec: tcpm/tcpci_maxim: validate header NDO against RX_BYTE_CNT
Greg Kroah-Hartman <[email protected]>
usb: typec: wcove: don't write past struct pd_message in wcove_read_rx_buffer()
Greg Kroah-Hartman <[email protected]>
usb: typec: altmodes/displayport: validate count before reading Status Update VDO
Greg Kroah-Hartman <[email protected]>
usb: typec: ucsi: displayport: NAK DP_CMD_CONFIGURE without a payload VDO
Greg Kroah-Hartman <[email protected]>
usb: typec: tcpm: bound altmode_desc[] per iteration in svdm_consume_modes()
Greg Kroah-Hartman <[email protected]>
usb: typec: tcpm: validate VDO count in Discover Identity ACK handlers
Greg Kroah-Hartman <[email protected]>
usb: typec: ucsi: ccg: reject firmware images without a ':' record header
Greg Kroah-Hartman <[email protected]>
iio: imu: st_lsm6dsx: fix stack leak in tagged FIFO buffer
Sven Eckelmann <[email protected]>
batman-adv: tt: prevent TVLV entry number overflow
Horatiu Vultur <[email protected]>
phy: mscc: Use PHY_ID_MATCH_EXACT for VSC8584, VSC8582, VSC8575, VSC856X
Will Deacon <[email protected]>
arm64: io: Extract user memory type in ioremap_prot()
Will Deacon <[email protected]>
arm64: io: Rename ioremap_prot() to __ioremap_prot()
Jouni Högander <[email protected]>
drm/i915/psr: Apply Intel DPCD workaround when SDP on prior line used
Suraj Kandpal <[email protected]>
drm/dp: Add eDP 1.5 bit definition
Jouni Högander <[email protected]>
drm/i915/psr: Read Intel DPCD workaround register
Jouni Högander <[email protected]>
drm/i915/psr: Add defininitions for INTEL_WA_REGISTER_CAPS DPCD register
Nathan Chancellor <[email protected]>
HID: core: Fix size_t specifier in hid_report_raw_event()
Benjamin Tissoires <[email protected]>
HID: core: introduce hid_safe_input_report()
Benjamin Tissoires <[email protected]>
HID: pass the buffer size to hid_report_raw_event
Vicki Pfau <[email protected]>
HID: core: Add printk_ratelimited variants to hid_warn() etc
Jakub Kicinski <[email protected]>
inet: frags: flush pending skbs in fqdir_pre_exit()
Jakub Kicinski <[email protected]>
inet: frags: add inet_frag_queue_flush()
Oliver Neukum <[email protected]>
media: rc: ttusbir: fix inverted error logic
Sean Young <[email protected]>
media: rc: fix race between unregister and urb/irq callbacks
Mikhail Gavrilov <[email protected]>
mm/page_alloc: clear page->private in free_pages_prepare()
Sven Eckelmann <[email protected]>
batman-adv: bla: avoid double decrement of bla.num_requests
Sven Eckelmann <[email protected]>
batman-adv: tt: avoid empty VLAN responses
Sven Eckelmann <[email protected]>
batman-adv: tt: fix TOCTOU race for reported vlans
Sven Eckelmann <[email protected]>
batman-adv: tp_meter: directly shut down timer on cleanup
Peter Oberparleiter <[email protected]>
s390/cio: Restore GFP_DMA for CHSC allocation
Sven Eckelmann <[email protected]>
batman-adv: tp_meter: avoid role confusion in tp_list
Sven Eckelmann <[email protected]>
batman-adv: iv: recover OGM scheduling after forward packet error
Sven Eckelmann <[email protected]>
batman-adv: tvlv: reject oversized TVLV packets
Sven Eckelmann <[email protected]>
batman-adv: bla: avoid NULL-ptr deref for claim via dropped interface
Sven Eckelmann <[email protected]>
batman-adv: tt: reject oversized local TVLV buffers
Sven Eckelmann <[email protected]>
batman-adv: tvlv: abort OGM send on tvlv append failure
Sven Eckelmann <[email protected]>
batman-adv: v: stop OGMv2 on disabled interface
Yeoreum Yun <[email protected]>
perf: Fix dangling cgroup pointer in cpuctx
Pavel Begunkov <[email protected]>
net: skbuff: fix pskb_carve leaking zcopy pages
Jiayuan Chen <[email protected]>
ipv6: fix possible infinite loop in fib6_select_path()
Jiayuan Chen <[email protected]>
ipv6: fix possible infinite loop in rt6_fill_node()
Zhenghang Xiao <[email protected]>
sctp: fix race between sctp_wait_for_connect and peeloff
Dipayaan Roy <[email protected]>
net: mana: Add NULL guards in teardown path to prevent panic on attach failure
Marco Scardovi <[email protected]>
gpio: rockchip: convert bank->clk to devm_clk_get_enabled()
Dan Carpenter <[email protected]>
gpio: virtuser: Fix uninitialized data bug in gpio_virtuser_direction_do_write()
Heitor Alves de Siqueira <[email protected]>
Bluetooth: hci_sync: Set HCI_CMD_DRAIN_WORKQUEUE during device close
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix possible crash on l2cap_ecred_conn_rsp
Zhenghang Xiao <[email protected]>
Bluetooth: l2cap: clear chan->ident on ECRED reconfiguration success
Chuck Lever <[email protected]>
net/handshake: Drain pending requests at net namespace exit
Chuck Lever <[email protected]>
net/handshake: Take a long-lived file reference at submit
Al Viro <[email protected]>
remove pointless includes of <linux/fdtable.h>
Chuck Lever <[email protected]>
net/handshake: Pass negative errno through handshake_complete()
Chuck Lever <[email protected]>
nvme-tcp: store negative errno in queue->tls_err
Chuck Lever <[email protected]>
net/handshake: Use spin_lock_bh for hn_lock
Victor Nogueira <[email protected]>
net/sched: act_mirred: Fix return code in early mirred redirect error paths
Jamal Hadi Salim <[email protected]>
net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop
Jamal Hadi Salim <[email protected]>
net: Introduce skb tc depth field to track packet loops
Eric Dumazet <[email protected]>
net/sched: act_mirred: add loop detection
Sebastian Andrzej Siewior <[email protected]>
net/sched: act_mirred: Move the recursion counter struct netdev_xmit
Jamal Hadi Salim <[email protected]>
net/sched: fix packet loop on netem when duplicate is on
Jamal Hadi Salim <[email protected]>
net/sched: Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree"
Rahul Chandelkar <[email protected]>
ipv6: rpl: fix hdrlen overflow in ipv6_rpl_srh_decompress()
Jakub Kicinski <[email protected]>
ethtool: eeprom: add more safeties to EEPROM Netlink fallback
Jakub Kicinski <[email protected]>
ethtool: eeprom: add missing ethnl_ops_begin() / _complete() during fallback
Jakub Kicinski <[email protected]>
ethtool: strset: fix header attribute index in ethnl_req_get_phydev()
Jakub Kicinski <[email protected]>
ethtool: pse-pd: fix missing ethnl_ops_complete()
Jakub Kicinski <[email protected]>
ethtool: linkstate: fix unbalanced ethnl_ops_complete() on PHY lookup error
Jakub Kicinski <[email protected]>
ethtool: coalesce: cap profile updates at NET_DIM_PARAMS_NUM_PROFILES
Oliver Hartkopp <[email protected]>
bonding: refuse to enslave CAN devices
Zhao Dongdong <[email protected]>
Bluetooth: 6lowpan: check skb_clone() return value in send_mcast_pkt()
Cássio Gabriel <[email protected]>
ASoC: codecs: simple-mux: Fix enum control bounds check
Eric Dumazet <[email protected]>
tunnels: do not assume transport header in iptunnel_pmtud_check_icmp()
Eric Dumazet <[email protected]>
vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu()
Eric Dumazet <[email protected]>
tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]()
Li Ming <[email protected]>
cxl/test: Update mock dev array before calling platform_device_add()
Jakub Kicinski <[email protected]>
ethtool: cmis: validate fw->size against start_cmd_payload_size
Jakub Kicinski <[email protected]>
ethtool: cmis: validate start_cmd_payload_size from module
Danielle Ratson <[email protected]>
net: ethtool: Add support for writing firmware blocks using EPL payload
Danielle Ratson <[email protected]>
net: ethtool: Add new parameters and a function to support EPL
Jakub Kicinski <[email protected]>
ethtool: cmis: fix u16-to-u8 truncation of msleep_pre_rpl
Jakub Kicinski <[email protected]>
ethtool: cmis: require exact CDB reply length
Jakub Kicinski <[email protected]>
ethtool: module: fix cleanup if socket used for flashing multiple devices
Jakub Kicinski <[email protected]>
ethtool: module: check fw_flash_in_progress under rtnl_lock
Jakub Kicinski <[email protected]>
ethtool: module: avoid leaking a netdev ref on module flash errors
Jakub Kicinski <[email protected]>
ethtool: rss: fix hkey leak when indir_size is 0
Björn Töpel <[email protected]>
net: Avoid checksumming unreadable skb tail on trim
Alexander Stein <[email protected]>
gpio: mxc: fix irq_high handling
Dan Carpenter <[email protected]>
accel/ivpu: prevent uninitialized data bug in debugfs
Luka Gejak <[email protected]>
net: hsr: fix potential OOB access in supervision frame handling
Cássio Gabriel <[email protected]>
ASoC: Intel: bytcht_es8316: Fix MCLK leak on init errors
Cássio Gabriel <[email protected]>
ALSA: pcm: oss: Fix setup list UAF on proc write error
Eric Dumazet <[email protected]>
ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table()
David Jeffery <[email protected]>
scsi: core: Run queues for all non-SDEV_DEL devices from scsi_run_host_queues
Breno Leitao <[email protected]>
net/iucv: fix locking in .getsockopt
Alexandra Winter <[email protected]>
net/smc: Do not re-initialize smc hashtables
Ilya Maximets <[email protected]>
net: netlink: don't set nsid on local notifications
Ilya Maximets <[email protected]>
net: netlink: fix sending unassigned nsid after assigned one
Ziyu Zhang <[email protected]>
vsock: keep poll shutdown state consistent
Weiming Shi <[email protected]>
tun: free page on build_skb failure in tun_xdp_one()
Weiming Shi <[email protected]>
tun: free page on short-frame rejection in tun_xdp_one()
Florian Westphal <[email protected]>
netfilter: ebtables: fix OOB read in compat_mtw_from_user
Florian Westphal <[email protected]>
netfilter: xt_cpu: prefer raw_smp_processor_id
Chris Mason <[email protected]>
netfilter: synproxy: refresh tcphdr after skb_ensure_writable
Deepanshu Kartikey <[email protected]>
kernel/fork: validate exit_signal in kernel_clone()
Florian Schmaus <[email protected]>
kunit: fix use-after-free in debugfs when using kunit.filter
Carl Lee <[email protected]>
nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
David Ahern <[email protected]>
xfrm: Check for underflow in xfrm_state_mtu
Lee Jones <[email protected]>
nfc: llcp: Fix use-after-free race in nfc_llcp_recv_cc()
Lee Jones <[email protected]>
nfc: llcp: Fix use-after-free in llcp_sock_release()
Ada Couprie Diaz <[email protected]>
arm64: debug: always unmask interrupts in el0_softstp()
Ada Couprie Diaz <[email protected]>
arm64: debug: remove debug exception registration infrastructure
Ada Couprie Diaz <[email protected]>
arm64: debug: split bkpt32 exception entry
Ada Couprie Diaz <[email protected]>
arm64: debug: split brk64 exception entry
Ada Couprie Diaz <[email protected]>
arm64: debug: split hardware watchpoint exception entry
Ada Couprie Diaz <[email protected]>
arm64: debug: split single stepping exception entry
Ada Couprie Diaz <[email protected]>
arm64: debug: refactor reinstall_suspended_bps()
Ada Couprie Diaz <[email protected]>
arm64: debug: split hardware breakpoint exception entry
Ada Couprie Diaz <[email protected]>
arm64: entry: Add entry and exit functions for debug exceptions
Ada Couprie Diaz <[email protected]>
arm64: debug: remove break/step handler registration infrastructure
Ada Couprie Diaz <[email protected]>
arm64: debug: call step handlers statically
Ada Couprie Diaz <[email protected]>
arm64: debug: call software breakpoint handlers statically
Ada Couprie Diaz <[email protected]>
arm64: refactor aarch32_break_handler()
Ada Couprie Diaz <[email protected]>
arm64: debug: clean up single_step_handler logic
Mostafa Saleh <[email protected]>
arm64: Introduce esr_is_ubsan_brk()
Kevin Hao <[email protected]>
net: cpsw_new: Fix potential unregister of netdev that has not been registered yet
Mingzhe Zou <[email protected]>
bcache: fix uninitialized closure object
Victor Nogueria <[email protected]>
net/sched: sch_sfb: Replace direct dequeue call with peek and qdisc_dequeue_peeked
Usama Arif <[email protected]>
xfrm: move policy_bydst RCU sync from per-netns .exit to .pre_exit
Jeremy Kerr <[email protected]>
net: mctp: ensure our nlmsg responses are initialised
Davide Caratti <[email protected]>
net/sched: cls_fw: fix NULL dereference of "old" filters before change()
Maíra Canal <[email protected]>
drm/v3d: Release indirect CSD GEM reference on CPU job free
Maíra Canal <[email protected]>
drm/v3d: Fix use-after-free of CPU job query arrays on error path
Greg Kroah-Hartman <[email protected]>
Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size
-------------
Diffstat:
Documentation/netlink/specs/handshake.yaml | 8 + Makefile | 4 +- arch/alpha/include/asm/Kbuild | 1 + arch/arc/include/asm/Kbuild | 1 + arch/arm/include/asm/Kbuild | 1 + arch/arm64/include/asm/debug-monitors.h | 34 +-- arch/arm64/include/asm/esr.h | 5 + arch/arm64/include/asm/exception.h | 14 +- arch/arm64/include/asm/io.h | 24 +- arch/arm64/include/asm/kgdb.h | 12 + arch/arm64/include/asm/kprobes.h | 8 + arch/arm64/include/asm/ring_buffer.h | 10 + arch/arm64/include/asm/system_misc.h | 4 - arch/arm64/include/asm/tlb.h | 2 +- arch/arm64/include/asm/traps.h | 6 + arch/arm64/include/asm/uprobes.h | 11 + arch/arm64/kernel/acpi.c | 2 +- arch/arm64/kernel/debug-monitors.c | 258 ++++++++------------- arch/arm64/kernel/entry-common.c | 148 +++++++++++- arch/arm64/kernel/hw_breakpoint.c | 60 ++--- arch/arm64/kernel/kgdb.c | 39 +--- arch/arm64/kernel/probes/kprobes.c | 31 +-- arch/arm64/kernel/probes/kprobes_trampoline.S | 2 +- arch/arm64/kernel/probes/uprobes.c | 24 +- arch/arm64/kernel/traps.c | 80 +------ arch/arm64/kvm/pmu-emul.c | 4 +- arch/arm64/mm/fault.c | 75 ------ arch/arm64/mm/ioremap.c | 7 +- arch/csky/include/asm/Kbuild | 1 + arch/hexagon/include/asm/Kbuild | 1 + arch/loongarch/include/asm/Kbuild | 1 + arch/m68k/include/asm/Kbuild | 1 + arch/microblaze/include/asm/Kbuild | 1 + arch/mips/dec/platform.c | 109 ++++++++- arch/mips/include/asm/Kbuild | 1 + arch/nios2/include/asm/Kbuild | 1 + arch/openrisc/include/asm/Kbuild | 1 + arch/parisc/include/asm/Kbuild | 1 + arch/powerpc/include/asm/Kbuild | 1 + arch/riscv/include/asm/Kbuild | 1 + arch/riscv/include/asm/syscall_wrapper.h | 4 + arch/s390/include/asm/Kbuild | 1 + arch/sh/include/asm/Kbuild | 1 + arch/sparc/include/asm/Kbuild | 1 + arch/um/include/asm/Kbuild | 1 + arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/text-patching.h | 2 +- arch/x86/kernel/Makefile | 16 ++ arch/x86/kernel/alternative.c | 6 +- arch/x86/kernel/callthunks.c | 6 +- arch/x86/kernel/ftrace.c | 7 + arch/x86/kvm/svm/avic.c | 35 ++- arch/x86/kvm/svm/sev.c | 68 ++++-- arch/x86/mm/Makefile | 2 + arch/xtensa/include/asm/Kbuild | 1 + drivers/accel/ivpu/ivpu_debugfs.c | 2 +- drivers/auxdisplay/line-display.c | 2 +- drivers/bluetooth/btusb.c | 8 +- drivers/bluetooth/hci_qca.c | 38 ++- drivers/comedi/drivers/comedi_test.c | 5 +- drivers/counter/counter-core.c | 3 +- drivers/gpio/gpio-mxc.c | 2 +- drivers/gpio/gpio-rockchip.c | 6 +- drivers/gpio/gpio-virtuser.c | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 +- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 + drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 4 + drivers/gpu/drm/bridge/sil-sii8620.c | 1 + drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 113 +++++++-- drivers/gpu/drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_dpcd.h | 15 ++ drivers/gpu/drm/i915/display/intel_psr.c | 34 ++- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 28 ++- drivers/gpu/drm/v3d/v3d_sched.c | 16 +- drivers/gpu/drm/v3d/v3d_submit.c | 22 +- drivers/hid/bpf/hid_bpf_dispatch.c | 6 +- drivers/hid/hid-core.c | 62 ++++- drivers/hid/hid-gfrm.c | 4 +- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-logitech-hidpp.c | 2 +- drivers/hid/hid-multitouch.c | 2 +- drivers/hid/hid-picolcd_cir.c | 1 + drivers/hid/hid-primax.c | 2 +- drivers/hid/hid-quirks.c | 1 + drivers/hid/hid-vivaldi-common.c | 2 +- drivers/hid/i2c-hid/i2c-hid-core.c | 7 +- drivers/hid/usbhid/hid-core.c | 11 +- drivers/hid/wacom_sys.c | 19 +- drivers/hid/wacom_wac.h | 1 + drivers/hwmon/pmbus/adm1266.c | 54 ++++- drivers/iio/adc/mt6359-auxadc.c | 1 + drivers/iio/adc/npcm_adc.c | 25 +- drivers/iio/adc/viperboard_adc.c | 4 +- drivers/iio/adc/xilinx-xadc-core.c | 11 +- drivers/iio/buffer/industrialio-hw-consumer.c | 4 +- drivers/iio/chemical/scd30_core.c | 65 +++--- drivers/iio/common/ssp_sensors/ssp_dev.c | 1 + drivers/iio/dac/ad5686.c | 16 +- drivers/iio/dac/ad5686.h | 1 + drivers/iio/dac/max5821.c | 9 +- drivers/iio/gyro/adis16260.c | 3 + drivers/iio/gyro/itg3200_buffer.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +- drivers/iio/industrialio-buffer.c | 1 + drivers/iio/light/cm3323.c | 5 +- drivers/iio/magnetometer/st_magn_core.c | 13 +- drivers/iio/temperature/tsys01.c | 2 +- drivers/input/joystick/xpad.c | 14 +- drivers/input/misc/ims-pcu.c | 2 +- drivers/input/mouse/elan_i2c_core.c | 5 + drivers/input/mouse/synaptics.c | 1 + drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- drivers/input/touchscreen/usbtouchscreen.c | 5 + drivers/iommu/io-pgtable-arm-v7s.c | 18 +- drivers/iommu/iommu.c | 25 +- drivers/md/bcache/super.c | 3 +- drivers/media/cec/core/cec-core.c | 2 +- drivers/media/common/siano/smsir.c | 1 + drivers/media/i2c/ir-kbd-i2c.c | 2 + drivers/media/pci/bt8xx/bttv-input.c | 3 +- drivers/media/pci/cx23885/cx23885-input.c | 1 + drivers/media/pci/cx88/cx88-input.c | 3 +- drivers/media/pci/dm1105/dm1105.c | 1 + drivers/media/pci/mantis/mantis_input.c | 1 + drivers/media/pci/saa7134/saa7134-input.c | 1 + drivers/media/pci/smipcie/smipcie-ir.c | 1 + drivers/media/pci/ttpci/budget-ci.c | 1 + drivers/media/rc/ati_remote.c | 6 +- drivers/media/rc/ene_ir.c | 2 +- drivers/media/rc/fintek-cir.c | 3 +- drivers/media/rc/igorplugusb.c | 3 +- drivers/media/rc/iguanair.c | 1 + drivers/media/rc/img-ir/img-ir-hw.c | 3 +- drivers/media/rc/img-ir/img-ir-raw.c | 3 +- drivers/media/rc/imon.c | 3 +- drivers/media/rc/ir-hix5hd2.c | 2 +- drivers/media/rc/ir_toy.c | 1 + drivers/media/rc/ite-cir.c | 2 +- drivers/media/rc/mceusb.c | 1 + drivers/media/rc/rc-ir-raw.c | 5 - drivers/media/rc/rc-loopback.c | 1 + drivers/media/rc/rc-main.c | 6 +- drivers/media/rc/redrat3.c | 4 +- drivers/media/rc/st_rc.c | 2 +- drivers/media/rc/streamzap.c | 7 +- drivers/media/rc/sunxi-cir.c | 1 + drivers/media/rc/ttusbir.c | 4 +- drivers/media/rc/winbond-cir.c | 2 +- drivers/media/rc/xbox_remote.c | 5 +- drivers/media/usb/au0828/au0828-input.c | 1 + drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 1 + drivers/media/usb/dvb-usb/dvb-usb-remote.c | 6 +- drivers/media/usb/em28xx/em28xx-input.c | 1 + drivers/net/bonding/bond_main.c | 6 + drivers/net/ethernet/intel/ice/ice_virtchnl.c | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 2 + drivers/net/ethernet/microsoft/mana/mana_en.c | 72 +++--- drivers/net/ethernet/ti/cpsw_new.c | 4 +- drivers/net/macsec.c | 3 +- drivers/net/phy/mscc/mscc.h | 8 +- drivers/net/phy/mscc/mscc_main.c | 23 +- drivers/net/tun.c | 5 +- drivers/net/vxlan/vxlan_core.c | 4 +- drivers/net/wireguard/send.c | 20 +- drivers/nfc/nxp-nci/i2c.c | 21 +- drivers/nvme/host/tcp.c | 2 +- drivers/parport/share.c | 11 +- drivers/platform/x86/intel/vsec.c | 36 +-- drivers/s390/cio/chsc.c | 4 +- drivers/s390/cio/chsc_sch.c | 20 +- drivers/s390/cio/scm.c | 2 +- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/scsi_lib.c | 27 ++- drivers/scsi/scsi_transport_fc.c | 77 +++--- drivers/staging/greybus/hid.c | 2 +- drivers/staging/media/av7110/av7110_ir.c | 1 + drivers/target/iscsi/iscsi_target.c | 6 +- drivers/target/iscsi/iscsi_target_auth.c | 19 +- drivers/target/iscsi/iscsi_target_nego.c | 7 +- drivers/target/iscsi/iscsi_target_parameters.c | 62 +++-- drivers/target/iscsi/iscsi_target_parameters.h | 2 +- drivers/thunderbolt/property.c | 32 ++- drivers/tty/serdev/core.c | 21 ++ drivers/tty/serial/altera_jtaguart.c | 7 +- drivers/tty/serial/dz.c | 171 +++++++------- drivers/tty/serial/fsl_lpuart.c | 15 +- drivers/tty/serial/pch_uart.c | 19 +- drivers/tty/serial/qcom_geni_serial.c | 16 +- drivers/tty/serial/samsung_tty.c | 8 - drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/zs.c | 218 +++++++---------- drivers/tty/serial/zs.h | 1 - drivers/usb/cdns3/cdns3-gadget.c | 12 +- drivers/usb/cdns3/cdns3-plat.c | 11 +- drivers/usb/chipidea/core.c | 16 +- drivers/usb/class/cdc-acm.c | 2 - drivers/usb/class/cdc-acm.h | 2 + drivers/usb/class/usbtmc.c | 14 ++ drivers/usb/core/config.c | 9 +- drivers/usb/core/quirks.c | 4 + drivers/usb/dwc2/hcd.c | 4 +- drivers/usb/dwc3/dwc3-xilinx.c | 26 ++- drivers/usb/gadget/composite.c | 5 +- drivers/usb/gadget/function/f_fs.c | 26 ++- drivers/usb/gadget/function/f_hid.c | 3 +- drivers/usb/gadget/function/f_uvc.c | 28 ++- drivers/usb/gadget/udc/dummy_hcd.c | 4 + drivers/usb/gadget/udc/net2280.c | 4 +- drivers/usb/host/xhci-tegra.c | 77 +++--- drivers/usb/musb/omap2430.c | 3 +- drivers/usb/serial/belkin_sa.c | 3 + drivers/usb/serial/cypress_m8.c | 20 +- drivers/usb/serial/digi_acceleport.c | 23 +- drivers/usb/serial/keyspan.c | 4 + drivers/usb/serial/mct_u232.c | 5 + drivers/usb/serial/mxuport.c | 8 + drivers/usb/serial/omninet.c | 9 +- drivers/usb/serial/option.c | 9 +- drivers/usb/serial/safe_serial.c | 11 + drivers/usb/storage/unusual_uas.h | 7 + drivers/usb/typec/altmodes/displayport.c | 2 + drivers/usb/typec/tcpm/tcpci_maxim_core.c | 9 + drivers/usb/typec/tcpm/tcpm.c | 117 ++++++---- drivers/usb/typec/tcpm/wcove.c | 13 +- drivers/usb/typec/ucsi/displayport.c | 4 + drivers/usb/typec/ucsi/ucsi.c | 24 +- drivers/usb/typec/ucsi/ucsi_ccg.c | 5 + drivers/usb/usbip/vudc_dev.c | 1 + drivers/usb/usbip/vudc_transfer.c | 3 +- fs/fcntl.c | 1 - fs/file_table.c | 1 - fs/hpfs/alloc.c | 2 +- fs/hugetlbfs/inode.c | 5 - fs/notify/fanotify/fanotify.c | 1 - fs/notify/fanotify/fanotify_user.c | 1 - fs/overlayfs/copy_up.c | 1 - fs/proc/base.c | 1 - fs/smb/server/smbacl.c | 8 +- include/asm-generic/ring_buffer.h | 13 ++ include/drm/display/drm_dp.h | 1 + include/kunit/test.h | 1 + include/linux/compat.h | 4 + include/linux/compiler-clang.h | 6 + include/linux/compiler_attributes.h | 11 + include/linux/compiler_types.h | 4 + include/linux/hid.h | 17 +- include/linux/hid_bpf.h | 14 +- include/linux/memfd.h | 23 +- include/linux/mm.h | 55 ----- include/linux/netdevice_xmit.h | 10 + include/linux/parport.h | 1 + include/linux/serdev.h | 1 + include/linux/skbuff.h | 2 + include/linux/syscalls.h | 4 + include/media/rc-core.h | 2 - include/net/inet_frag.h | 18 +- include/net/ipv6_frag.h | 9 +- include/net/xfrm.h | 3 +- io_uring/io_uring.c | 1 - ipc/util.c | 2 +- kernel/bpf/bpf_inode_storage.c | 1 - kernel/bpf/bpf_task_storage.c | 1 - kernel/bpf/token.c | 1 - kernel/events/core.c | 16 +- kernel/exit.c | 1 - kernel/fork.c | 11 +- kernel/module/dups.c | 1 - kernel/module/kmod.c | 1 - kernel/trace/ring_buffer.c | 22 ++ kernel/umh.c | 1 - lib/debugobjects.c | 2 +- lib/kunit/executor.c | 19 +- lib/kunit/test.c | 1 + mm/damon/sysfs-schemes.c | 8 +- mm/memfd.c | 56 ++++- mm/memory.c | 2 +- mm/mmap.c | 12 +- mm/page_alloc.c | 1 + mm/shmem.c | 6 - net/batman-adv/bat_iv_ogm.c | 82 +++++-- net/batman-adv/bat_v_ogm.c | 59 +++-- net/batman-adv/bridge_loop_avoidance.c | 57 +++-- net/batman-adv/soft-interface.c | 1 + net/batman-adv/tp_meter.c | 67 +++--- net/batman-adv/translation-table.c | 57 ++++- net/batman-adv/tvlv.c | 28 ++- net/batman-adv/tvlv.h | 2 +- net/batman-adv/types.h | 42 +++- net/bluetooth/6lowpan.c | 2 + net/bluetooth/hci_sync.c | 12 +- net/bluetooth/hidp/core.c | 23 +- net/bluetooth/iso.c | 12 +- net/bluetooth/l2cap_core.c | 41 +++- net/bluetooth/l2cap_sock.c | 16 +- net/bridge/netfilter/ebtables.c | 30 +++ net/core/filter.c | 2 +- net/core/skbuff.c | 45 +++- net/ethtool/cmis.h | 20 +- net/ethtool/cmis_cdb.c | 103 ++++++-- net/ethtool/cmis_fw_update.c | 214 ++++++++++++----- net/ethtool/coalesce.c | 6 + net/ethtool/eeprom.c | 10 +- net/ethtool/linkstate.c | 6 +- net/ethtool/module.c | 26 +-- net/ethtool/netlink.c | 4 +- net/ethtool/netlink.h | 4 +- net/ethtool/pse-pd.c | 10 +- net/ethtool/rss.c | 3 +- net/ethtool/strset.c | 2 +- net/handshake/genl.c | 3 +- net/handshake/genl.h | 1 + net/handshake/handshake-test.c | 2 +- net/handshake/handshake.h | 6 +- net/handshake/netlink.c | 22 +- net/handshake/request.c | 64 +++-- net/handshake/tlshd.c | 6 +- net/hsr/hsr_forward.c | 4 +- net/hsr/hsr_framereg.c | 6 +- net/ipv4/ah4.c | 2 +- net/ipv4/esp4.c | 4 +- net/ipv4/inet_fragment.c | 51 +++- net/ipv4/ip_fragment.c | 18 +- net/ipv4/ip_tunnel_core.c | 22 +- net/ipv4/sysctl_net_ipv4.c | 2 +- net/ipv6/ah6.c | 2 +- net/ipv6/datagram.c | 54 ++++- net/ipv6/esp6.c | 4 +- net/ipv6/exthdrs.c | 6 +- net/ipv6/ip6_vti.c | 23 +- net/ipv6/route.c | 5 + net/iucv/af_iucv.c | 20 +- net/key/af_key.c | 6 +- net/l2tp/l2tp_core.c | 11 +- net/mctp/device.c | 1 + net/mctp/neigh.c | 1 + net/mctp/route.c | 1 + net/mptcp/pm.c | 40 +++- net/mptcp/pm_netlink.c | 16 +- net/mptcp/protocol.c | 92 +++++--- net/mptcp/protocol.h | 3 +- net/mptcp/subflow.c | 8 +- net/netfilter/nf_conntrack_proto_tcp.c | 3 +- net/netfilter/nf_synproxy_core.c | 2 + net/netfilter/xt_cpu.c | 2 +- net/netlink/af_netlink.c | 11 +- net/nfc/hci/core.c | 10 + net/nfc/llcp_core.c | 11 + net/nfc/llcp_sock.c | 2 + net/nfc/nci/hci.c | 10 + net/rxrpc/ar-internal.h | 12 +- net/rxrpc/call_event.c | 27 +-- net/rxrpc/call_object.c | 2 + net/rxrpc/conn_event.c | 30 +-- net/rxrpc/insecure.c | 8 +- net/rxrpc/recvmsg.c | 68 ++++-- net/rxrpc/rxkad.c | 115 ++++----- net/sched/act_mirred.c | 77 ++++-- net/sched/cls_fw.c | 6 +- net/sched/sch_netem.c | 47 +--- net/sched/sch_sfb.c | 2 +- net/sctp/socket.c | 2 + net/smc/af_smc.c | 4 +- net/vmw_vsock/af_vsock.c | 49 ++-- net/vmw_vsock/hyperv_transport.c | 9 +- net/vmw_vsock/virtio_transport_common.c | 14 +- net/vmw_vsock/vmci_transport.c | 8 +- net/xfrm/xfrm_input.c | 16 +- net/xfrm/xfrm_policy.c | 17 +- net/xfrm/xfrm_state.c | 23 +- net/xfrm/xfrm_user.c | 5 +- security/apparmor/domain.c | 1 - sound/core/oss/pcm_oss.c | 18 +- .../motu/motu-register-dsp-message-parser.c | 14 +- sound/soc/codecs/simple-mux.c | 2 +- sound/soc/intel/boards/bytcht_es8316.c | 29 ++- sound/soc/qcom/qdsp6/q6asm-dai.c | 43 ++-- sound/usb/mixer_scarlett2.c | 38 ++- tools/testing/cxl/test/cxl.c | 105 ++++----- tools/testing/selftests/mm/hmm-tests.c | 50 ++++ tools/testing/selftests/net/mptcp/mptcp_connect.sh | 6 +- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 10 +- 382 files changed, 3974 insertions(+), 2279 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/307 Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 2905281cbda52ec9df540113b35b835feb5fafd3 upstream.
nexio_read_data() pulls data_len and x_len from a packed __be16 header in the device's interrupt packet and then walks packet->data[0..x_len) and packet->data[x_len..data_len) comparing each byte against a threshold.
Both fields are 16-bit on the wire (max 65535). The existing adjustments shave at most 0x100 / 0x80 off, so the loop bound can still reach roughly 0xfeff. The URB transfer buffer for NEXIO is rept_size (1024) bytes from usb_alloc_coherent(), with the first 7 occupied by the packed header — so packet->data[] has 1017 valid bytes. read_data() callbacks are not given urb->actual_length, and nothing else bounds the walk.
A device that lies about its length can get a ~64 KiB out-of-bounds read past the coherent DMA allocation. The first index whose byte exceeds NEXIO_THRESHOLD lands in begin_x / begin_y and from there into the reported touch coordinates, so adjacent kernel memory contents leak to userspace as ABS_X / ABS_Y events. Far enough out, the read can also hit an unmapped page and fault.
Fix this all by clamping data_len to the buffer's data[] capacity and x_len to data_len.
--- drivers/input/touchscreen/usbtouchscreen.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/input/touchscreen/usbtouchscreen.c +5 -0
@@ -1070,6 +1070,11 @@ static int nexio_read_data(struct usbtouif (x_len >0xff ) x_len -=0x80 ; +if (data_len > usbtouch->data_size -sizeof (*packet)) + data_len = usbtouch->data_size -sizeof (*packet); +if (x_len > data_len) + x_len = data_len; +/* send ACK */ ret =usb_submit_urb (priv->ack,GFP_ATOMIC );if (ret)
Greg Kroah-Hartman
maintainerPATCH 2/307 drm/v3d: Fix use-after-free of CPU job query arrays on error path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit b0fe80c0b9250b35e2211bf3117e7aca814a21b0 ]
The CPU job ioctl's fail label calls kvfree() on cpu_job's timestamp and performance query arrays after v3d_job_cleanup(), which drops the job's last reference and frees cpu_job. Reading cpu_job at that point is a use-after-free. Also, on the early v3d_job_init() failure path, it is a NULL dereference, since v3d_job_deallocate() zeroes the local pointer.
In the success path, the arrays are released from the scheduler's .free_job callback, but on the error path, they are freed manually, as the job was never pushed to the scheduler. While the success path deals with this correctly, the fail path doesn't.
On top of that, the manual kvfree() calls only free the array storage; they don't drm_syncobj_put() the per-query syncobjs that v3d_timestamp_query_info_free() and v3d_performance_query_info_free() release on the success path. So the same fail path that triggers the use-after-free also leaks one syncobj reference per query.
Unify the CPU job teardown into the CPU job's kref destructor, mirroring v3d_render_job_free(). The scheduler's .free_job slot reverts to the generic v3d_sched_job_free() and the fail label drops the manual kvfree() calls, leaving a single teardown path that is reached from both the scheduler and the ioctl error path. That removes the use-after-free, the NULL dereference, and the syncobj leak by construction.
--- drivers/gpu/drm/v3d/v3d_sched.c | 16 +--------------- drivers/gpu/drm/v3d/v3d_submit.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 18 deletions(-)
drivers/gpu/drm/v3d/v3d_sched.c +1 -15
@@ -103,20 +103,6 @@ v3d_performance_query_info_free(struct v3d_performance_query_info *query_info, } } -static void -v3d_cpu_job_free (struct drm_sched_job *sched_job) -{ -struct v3d_cpu_job *job =to_cpu_job (sched_job); - -v3d_timestamp_query_info_free (&job->timestamp_query, - job->timestamp_query.count); - -v3d_performance_query_info_free (&job->performance_query, - job->performance_query.count); - -v3d_job_cleanup (&job->base); -} -static void v3d_switch_perfmon (struct v3d_dev *v3d,struct v3d_job *job) {
@@ -846,7 +832,7 @@ static const struct drm_sched_backend_ops v3d_cache_clean_sched_ops = {static const struct drm_sched_backend_ops v3d_cpu_sched_ops = { .run_job = v3d_cpu_job_run, .timedout_job = v3d_generic_job_timedout, - .free_job = v3d_cpu_job_free + .free_job = v3d_sched_job_free };int
drivers/gpu/drm/v3d/v3d_submit.c +16 -3
@@ -118,6 +118,21 @@ v3d_render_job_free(struct kref *ref)v3d_job_free (ref); } +static void +v3d_cpu_job_free (struct kref *ref) +{ + struct v3d_cpu_job *job = container_of(ref, struct v3d_cpu_job, + base.refcount); + +v3d_timestamp_query_info_free (&job->timestamp_query, + job->timestamp_query.count); + +v3d_performance_query_info_free (&job->performance_query, + job->performance_query.count); + +v3d_job_free (ref); +} +void v3d_job_cleanup (struct v3d_job *job) {if (!job)
@@ -1310,7 +1325,7 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,trace_v3d_submit_cpu_ioctl (&v3d->drm, cpu_job->job_type); ret =v3d_job_init (v3d, file_priv, &cpu_job->base, - v3d_job_free,0 , &se,V3D_CPU ); + v3d_cpu_job_free,0 , &se,V3D_CPU );if (ret) {v3d_job_deallocate ((void *)&cpu_job); goto fail;
@@ -1393,8 +1408,6 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,v3d_job_cleanup ((void *)csd_job);v3d_job_cleanup (clean_job);v3d_put_multisync_post_deps (&se); -kvfree (cpu_job->timestamp_query.queries); -kvfree (cpu_job->performance_query.queries);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 3/307 drm/v3d: Release indirect CSD GEM reference on CPU job free
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit 6eb6e5acafa46854d4363e6c34981289995f3ace ]
v3d_get_cpu_indirect_csd_params() takes a reference to the indirect BO via drm_gem_object_lookup() and stashes it in cpu_job->indirect_csd.indirect, but nothing on the CPU job teardown path ever drops that reference.
Drop the extra reference in v3d_cpu_job_free(). The NULL check covers ioctl errors before the lookup ran and CPU job types other than V3D_CPU_JOB_TYPE_INDIRECT_CSD, which leave the field zero-initialised.
--- drivers/gpu/drm/v3d/v3d_submit.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/v3d/v3d_submit.c +3 -0
@@ -130,6 +130,9 @@ v3d_cpu_job_free(struct kref *ref)v3d_performance_query_info_free (&job->performance_query, job->performance_query.count); +if (job->indirect_csd.indirect) +drm_gem_object_put (job->indirect_csd.indirect); +v3d_job_free (ref); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 4/307 net/sched: cls_fw: fix NULL dereference of "old" filters before change()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit 65782b2db7321d5f97c16718c4c7f6c7205a56be ]
Like pointed out by Sashiko [1], since commit ed76f5edccc9 ("net: sched:
protect filter_chain list with filter_chain_lock mutex") TC filters are added to a shared block and published to datapath before their ->change() function is called. This is a problem for cls_fw: an invalid filter created with the "old" method can still classify some packets before it is destroyed by the validation logic added by Xiang. Therefore, insisting with repeated runs of the following script:
# ip link add dev crash0 type dummy # ip link set dev crash0 up # mausezahn crash0 -c 100000 -P 10 \
Quoted 1 line
-A 4.3.2.1 -B 1.2.3.4 -t udp "dp=1234" -q &
# sleep 1 # tc qdisc add dev crash0 egress_block 1 clsact # tc filter add block 1 protocol ip prio 1 matchall \
Quoted 1 line
action skbedit mark 65536 continue
# tc filter add block 1 protocol ip prio 2 fw # ip link del dev crash0
can still make fw_classify() hit the WARN_ON() in [2]:
WARNING: ./include/net/pkt_cls.h:88 at fw_classify+0x244/0x250 [cls_fw], CPU#18: mausezahn/1399 Modules linked in: cls_fw(E) act_skbedit(E) CPU: 18 UID: 0 PID: 1399 Comm: mausezahn Tainted: G E 7.0.0-rc6-virtme #17 PREEMPT(full) Tainted: [E]=UNSIGNED_MODULE Hardware name: Red Hat KVM, BIOS 1.16.3-2.el9 04/01/2014 RIP: 0010:fw_classify+0x244/0x250 [cls_fw] Code: 5c 49 c7 45 00 00 00 00 00 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 5b b8 ff ff ff ff 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 90 <0f> 0b 90 eb a0 0f 1f 80 00 00 00 00 90 90 90 90 90 90 90 90 90 90 RSP: 0018:ffffd1b7026bf8a8 EFLAGS: 00010202 RAX: ffff8c5ac9c60800 RBX: ffff8c5ac99322c0 RCX: 0000000000000004 RDX: 0000000000000001 RSI: ffff8c5b74d7a000 RDI: ffff8c5ac8284f40 RBP: ffffd1b7026bf8d0 R08: 0000000000000000 R09: ffffd1b7026bf9b0 R10: 00000000ffffffff R11: 0000000000000000 R12: 0000000000010000 R13: ffffd1b7026bf930 R14: ffff8c5ac8284f40 R15: 0000000000000000 FS: 00007fca40c37740(0000) GS:ffff8c5b74d7a000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fca40e822a0 CR3: 0000000005ca0001 CR4: 0000000000172ef0 Call Trace: <TASK> tcf_classify+0x17d/0x5c0 tc_run+0x9d/0x150 __dev_queue_xmit+0x2ab/0x14d0 ip_finish_output2+0x340/0x8f0 ip_output+0xa4/0x250 raw_sendmsg+0x147d/0x14b0 __sys_sendto+0x1cc/0x1f0 __x64_sys_sendto+0x24/0x30 do_syscall_64+0x126/0xf80 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fca40e822ba Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89 RSP: 002b:00007ffc248a42c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 000055ef233289d0 RCX: 00007fca40e822ba RDX: 000000000000001e RSI: 000055ef23328c30 RDI: 0000000000000003 RBP: 000055ef233289d0 R08: 00007ffc248a42d0 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000001e R13: 00000000000186a0 R14: 0000000000000000 R15: 00007fca41043000 </TASK> irq event stamp: 1045778 hardirqs last enabled at (1045784): [<ffffffff864ec042>] __up_console_sem+0x52/0x60 hardirqs last disabled at (1045789): [<ffffffff864ec027>] __up_console_sem+0x37/0x60 softirqs last enabled at (1045426): [<ffffffff874d48c7>] __alloc_skb+0x207/0x260 softirqs last disabled at (1045434): [<ffffffff874fe8f8>] __dev_queue_xmit+0x78/0x14d0
Then, because of the value in the packet's mark, dereference on 'q->handle' with NULL 'q' occurs:
BUG: kernel NULL pointer dereference, address: 0000000000000038 [...] RIP: 0010:fw_classify+0x1fe/0x250 [cls_fw] [...]
Skip "old-style" classification on shared blocks, so that the NULL dereference is fixed and WARN_ON() is not hit anymore in the short lifetime of invalid cls_fw "old-style" filters.
[1] https://sashiko.dev/#/patchset/20260331050217.504278-1-xmei5%40asu.edu
[2] https://elixir.bootlin.com/linux/v7.0-rc6/source/include/net/pkt_cls.h#L86
--- net/sched/cls_fw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sched/cls_fw.c +5 -1
@@ -74,9 +74,13 @@ TC_INDIRECT_SCOPE int fw_classify(struct sk_buff *skb, } } }else { -struct Qdisc *q =tcf_block_q (tp->chain->block); +struct Qdisc *q;/* Old method: classify the packet using its skb mark. */ +if (tcf_block_shared (tp->chain->block)) +return -1 ; + + q =tcf_block_q (tp->chain->block);if (id && (TC_H_MAJ (id) ==0 || !(TC_H_MAJ (id ^ q->handle)))) { res->classid = id;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 5/307 net: mctp: ensure our nlmsg responses are initialised
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Kerr <[email protected]>
[ Upstream commit a6a9bc544b675d8b5180f2718ec985ad267b5cbf ]
Syed Faraz Abrar (@farazsth98) from Zellic, and Pumpkin (@u1f383) from DEVCORE Research Team working with Trend Micro Zero Day Initiative report that a RTM_GETNEIGH will return uninitalised data in the pad bytes of the ndmsg data.
Ensure we're initialising the netlink data to zero, in the link, addr and neigh response messages.
--- net/mctp/device.c | 1 + net/mctp/neigh.c | 1 + net/mctp/route.c | 1 + 3 files changed, 3 insertions(+)
net/mctp/device.c +1 -0
@@ -70,6 +70,7 @@ static int mctp_fill_addrinfo(struct sk_buff *skb,return -EMSGSIZE ; hdr =nlmsg_data (nlh); +memset (hdr,0 ,sizeof (*hdr)); hdr->ifa_family =AF_MCTP ; hdr->ifa_prefixlen =0 ; hdr->ifa_flags =0 ;
net/mctp/neigh.c +1 -0
@@ -218,6 +218,7 @@ static int mctp_fill_neigh(struct sk_buff *skb, u32 portid, u32 seq, int event,return -EMSGSIZE ; hdr =nlmsg_data (nlh); +memset (hdr,0 ,sizeof (*hdr)); hdr->ndm_family =AF_MCTP ; hdr->ndm_ifindex = dev->ifindex; hdr->ndm_state =0 ;// TODO other state bits?
net/mctp/route.c +1 -0
@@ -1405,6 +1405,7 @@ static int mctp_fill_rtinfo(struct sk_buff *skb, struct mctp_route *rt,return -EMSGSIZE ; hdr =nlmsg_data (nlh); +memset (hdr,0 ,sizeof (*hdr)); hdr->rtm_family =AF_MCTP ;/* we use the _len fields as a number of EIDs, rather than
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 6/307 xfrm: move policy_bydst RCU sync from per-netns .exit to .pre_exit
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Usama Arif <[email protected]>
[ Upstream commit 3e52417318473782012b236d0325bf7d2266a597 ]
The struct pernet_operations docstring in include/net/net_namespace.h explicitly warns against blocking RCU primitives in .exit handlers:
Exit methods using blocking RCU primitives, such as synchronize_rcu(), should be implemented via exit_batch. [...]
Please, avoid synchronize_rcu() at all, where it's possible.
Note that a combination of pre_exit() and exit() can be used, since a synchronize_rcu() is guaranteed between the calls.
xfrm_policy_fini() violates this: it calls synchronize_rcu() before freeing the policy_bydst hash tables (so no RCU reader is mid- traversal at free time), but runs from xfrm_net_ops.exit -- once per namespace -- so a cleanup_net() of N namespaces pays N full RCU grace periods serially.
Use the documented pre_exit/exit split. Move the policy flush (and the workqueue drains it depends on) into a new .pre_exit handler; xfrm_policy_fini() then runs in .exit and frees the hash tables after the synchronize_rcu_expedited() that cleanup_net() guarantees between the two phases. Providing O(1) RCU grace periods per batch instead of O(N).
Observed on Linux 6.18 with a workload doing unshare(CLONE_NEWNET) at ~13/sec sustained: cleanup_net() and the netns_wq rescuer kthread both stuck in xfrm_policy_fini()'s synchronize_rcu(), >300k struct net accumulated in the cleanup queue, Percpu in /proc/meminfo climbed to 130+ GB on 256-CPU hosts, and memcg OOMs followed. setup_net and __put_net counts were balanced, ruling out a refcount leak.
--- net/xfrm/xfrm_policy.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
net/xfrm/xfrm_policy.c +8 -7
@@ -4264,21 +4264,21 @@ static int __net_init xfrm_policy_init(struct net *net)return -ENOMEM ; } -static void xfrm_policy_fini (struct net *net) +static void __net_exit xfrm_net_pre_exit(struct net *net) { -struct xfrm_pol_inexact_bin *b, *t; -unsigned int sz; -int dir; -disable_work_sync (&net->xfrm.policy_hthresh.work); -flush_work (&net->xfrm.policy_hash_work);#ifdef CONFIG_XFRM_SUB_POLICY xfrm_policy_flush (net,XFRM_POLICY_TYPE_SUB , false);#endif xfrm_policy_flush (net,XFRM_POLICY_TYPE_MAIN , false); +} -synchronize_rcu (); +static void xfrm_policy_fini (struct net *net) +{ +struct xfrm_pol_inexact_bin *b, *t; +unsigned int sz; +int dir;WARN_ON (!list_empty (&net->xfrm.policy_all));
@@ -4356,6 +4356,7 @@ static void __net_exit xfrm_net_exit(struct net *net)static struct pernet_operations __net_initdata xfrm_net_ops = { .init = xfrm_net_init, + .pre_exit = xfrm_net_pre_exit, .exit = xfrm_net_exit, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 7/307 net/sched: sch_sfb: Replace direct dequeue call with peek and qdisc_dequeue_peeked
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueria <[email protected]>
[ Upstream commit 1b9bc71153b01dbde8045b9edede4240f4f5520e ]
When sfb has children (eg qfq qdisc) whose peek() callback is qdisc_peek_dequeued(), we could get a kernel panic. When the parent of such qdiscs (eg illustrated in patch #3 as tbf) wants to retrieve an skb from its child (sfb in this case), it will do the following:
1a. do a peek() - and when sensing there's an skb the child can offer, then
- the child in this case(sfb) calls its child's (qfq) peek. qfq does the right thing and will return the gso_skb queue packet.
Note: if there wasnt a gso_skb entry then qfq will store it there.
1b. invoke a dequeue() on the child (sfb). And herein lies the problem.
- sfb will call the child's dequeue() which will essentially just try to grab something of qfq's queue.
[ 127.594489][ T453] KASAN: null-ptr-deref in range [0x0000000000000048-0x000000000000004f] [ 127.594741][ T453] CPU: 2 UID: 0 PID: 453 Comm: ping Not tainted 7.1.0-rc1-00035-gac961974495b-dirty #793 PREEMPT(full) [ 127.595059][ T453] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 127.595254][ T453] RIP: 0010:qfq_dequeue+0x35c/0x1650 [sch_qfq] [ 127.595461][ T453] Code: 00 fc ff df 80 3c 02 00 0f 85 17 0e 00 00 4c 8d 73 48 48 89 9d b8 02 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 76 0c 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b [ 127.596081][ T453] RSP: 0018:ffff88810e5af440 EFLAGS: 00010216 [ 127.596337][ T453] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: dffffc0000000000 [ 127.596623][ T453] RDX: 0000000000000009 RSI: 0000001880000000 RDI: ffff888104fd82b0 [ 127.596917][ T453] RBP: ffff888104fd8000 R08: ffff888104fd8280 R09: 1ffff110211893a3 [ 127.597165][ T453] R10: 1ffff110211893a6 R11: 1ffff110211893a7 R12: 0000001880000000 [ 127.597404][ T453] R13: ffff888104fd82b8 R14: 0000000000000048 R15: 0000000040000000 [ 127.597644][ T453] FS: 00007fc380cbfc40(0000) GS:ffff88816f2a8000(0000) knlGS:0000000000000000 [ 127.597956][ T453] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 127.598160][ T453] CR2: 00005610aa9890a8 CR3: 000000010369e000 CR4: 0000000000750ef0 [ 127.598390][ T453] PKRU: 55555554 [ 127.598509][ T453] Call Trace: [ 127.598629][ T453] <TASK> [ 127.598718][ T453] ? mark_held_locks+0x40/0x70 [ 127.598890][ T453] ? srso_alias_return_thunk+0x5/0xfbef5 [ 127.599053][ T453] sfb_dequeue+0x88/0x4d0 [ 127.599174][ T453] ? ktime_get+0x137/0x230 [ 127.599328][ T453] ? srso_alias_return_thunk+0x5/0xfbef5 [ 127.599480][ T453] ? qdisc_peek_dequeued+0x7b/0x350 [sch_qfq] [ 127.599670][ T453] ? srso_alias_return_thunk+0x5/0xfbef5 [ 127.599831][ T453] tbf_dequeue+0x6b1/0x1098 [sch_tbf] [ 127.599988][ T453] __qdisc_run+0x169/0x1900
The right thing to do in #1b is to grab the skb off gso_skb queue. This patchset fixes that issue by changing #1b to use qdisc_dequeue_peeked() method instead.
--- net/sched/sch_sfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_sfb.c +1 -1
@@ -439,7 +439,7 @@ static struct sk_buff *sfb_dequeue(struct Qdisc *sch)struct Qdisc *child = q->qdisc;struct sk_buff *skb; - skb = child->dequeue (q->qdisc); + skb =qdisc_dequeue_peeked (child);if (skb) {qdisc_bstats_update (sch, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 8/307 bcache: fix uninitialized closure object
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingzhe Zou <[email protected]>
[ Upstream commit 20a8e451ec1c7e99060b1bbaaad03ce88c39ddb8 ]
In the previous patch ("bcache: fix cached_dev.sb_bio use-after-free and crash"), we adopted a simple modification suggestion from AI to fix the use-after-free.
But in actual testing, we found an extreme case where the device is stopped before calling bch_write_bdev_super().
At this point, struct closure sb_write has not been initialized yet. For this patch, we ensure that sb_bio has been completed via sb_write_mutex.
--- drivers/md/bcache/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +2 -1
@@ -1378,7 +1378,8 @@ static CLOSURE_CALLBACK(cached_dev_free)* The sb_bio is embedded in struct cached_dev, so we must * ensure no I/O is in progress. */ -closure_sync (&dc->sb_write); +down (&dc->sb_write_mutex); +up (&dc->sb_write_mutex);if (dc->sb_disk)put_page (virt_to_page (dc->sb_disk));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 9/307 net: cpsw_new: Fix potential unregister of netdev that has not been registered yet
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Hao <[email protected]>
[ Upstream commit 9d724b34fbe13b71865ad0906a4be97571f19cf5 ]
If an error occurs during register_netdev() for the first MAC in cpsw_register_ports(), even though cpsw->slaves[0].ndev is set to NULL, cpsw->slaves[1].ndev would remain unchanged. This could later cause cpsw_unregister_ports() to attempt unregistering the second MAC. To address this, add a check for ndev->reg_state before calling unregister_netdev(). With this change, setting cpsw->slaves[i].ndev to NULL becomes unnecessary and can be removed accordingly.
--- drivers/net/ethernet/ti/cpsw_new.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/cpsw_new.c +2 -2
@@ -1443,7 +1443,8 @@ static void cpsw_unregister_ports(struct cpsw_common *cpsw)int i =0 ;for (i =0 ; i < cpsw->data.slaves; i++) { -if (!cpsw->slaves[i].ndev) +if (!cpsw->slaves[i].ndev || + cpsw->slaves[i].ndev->reg_state !=NETREG_REGISTERED )continue ;unregister_netdev (cpsw->slaves[i].ndev);
@@ -1463,7 +1464,6 @@ static int cpsw_register_ports(struct cpsw_common *cpsw)if (ret) {dev_err (cpsw->dev,"cpsw: err registering net device%d\n" , i); - cpsw->slaves[i].ndev =NULL ;break ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 10/307 arm64: Introduce esr_is_ubsan_brk()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mostafa Saleh <[email protected]>
[ Upstream commit dc1fd37a7f501731e488c1c6f86b2f591632a4ad ]
Soon, KVM is going to use this logic for hypervisor panics, so add it in a wrapper that can be used by the hypervisor exit handler to decode hyp panics.
--- arch/arm64/include/asm/esr.h | 5 +++++ arch/arm64/kernel/traps.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm64/include/asm/esr.h +5 -0
@@ -409,6 +409,11 @@ static inline bool esr_is_cfi_brk(unsigned long esr) (esr_brk_comment (esr) & ~CFI_BRK_IMM_MASK ) ==CFI_BRK_IMM_BASE ; } +static inline bool esr_is_ubsan_brk (unsigned long esr) +{ +return (esr_brk_comment (esr) & ~UBSAN_BRK_MASK ) ==UBSAN_BRK_IMM ; +} +static inline bool esr_fsc_is_translation_fault (unsigned long esr) { esr = esr & ESR_ELx_FSC;
arch/arm64/kernel/traps.c +1 -1
@@ -1136,7 +1136,7 @@ int __init early_brk64(unsigned long addr, unsigned long esr,return kasan_handler (regs, esr) !=DBG_HOOK_HANDLED ;#endif #ifdef CONFIG_UBSAN_TRAP -if ((esr_brk_comment (esr) & ~UBSAN_BRK_MASK ) ==UBSAN_BRK_IMM ) +if (esr_is_ubsan_brk (esr))return ubsan_handler (regs, esr) !=DBG_HOOK_HANDLED ;#endif return bug_handler (regs, esr) !=DBG_HOOK_HANDLED ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 11/307 arm64: debug: clean up single_step_handler logic
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit ad8b22648b7d0bc6f84230508436b1aafc2e2516 ]
Remove the unnecessary boolean which always checks if the handler was found and return early instead.
--- arch/arm64/kernel/debug-monitors.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/arm64/kernel/debug-monitors.c +4 -6
@@ -241,8 +241,6 @@ static void send_user_sigtrap(int si_code)static int single_step_handler (unsigned long unused,unsigned long esr,struct pt_regs *regs) { -bool handler_found = false; -/* * If we are stepping a pending breakpoint, call the hw_breakpoint * handler first.
@@ -250,10 +248,10 @@ static int single_step_handler(unsigned long unused, unsigned long esr,if (!reinstall_suspended_bps (regs))return 0 ; -if (!handler_found &&call_step_hook (regs, esr) ==DBG_HOOK_HANDLED ) - handler_found = true; +if (call_step_hook (regs, esr) ==DBG_HOOK_HANDLED ) +return 0 ; -if (!handler_found &&user_mode (regs)) { +if (user_mode (regs)) {send_user_sigtrap (TRAP_TRACE );/*
@@ -263,7 +261,7 @@ static int single_step_handler(unsigned long unused, unsigned long esr,* to the active-not-pending state). */ user_rewind_single_step (current); - }else if (!handler_found) { + }else {pr_warn ("Unexpected kernel single-step exception at EL1\n" );/* * Re-enable stepping since we know that we will be
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 12/307 arm64: refactor aarch32_break_handler()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit b1e2d95524e4d0f5b643394c739212869e95cf6a ]
aarch32_break_handler() is called in do_el0_undef() when we are trying to handle an exception whose Exception Syndrome is unknown. It checks if the instruction hit might be a 32-bit arm break (be it A32 or T2), and sends a SIGTRAP to userspace if it is so that it can be handled.
However, this is badly represented in the naming of the function, and is not consistent with the other functions called with the same logic in do_el0_undef().
Rename it try_handle_aarch32_break() and change the return value to a boolean to align with the logic of the other tentative handlers in do_el0_undef(), the previous error code being ignored anyway.
--- arch/arm64/include/asm/debug-monitors.h | 2 +- arch/arm64/kernel/debug-monitors.c | 10 +++++----- arch/arm64/kernel/traps.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/arm64/include/asm/debug-monitors.h +1 -1
@@ -115,7 +115,7 @@ static inline int reinstall_suspended_bps(struct pt_regs *regs) }#endif -int aarch32_break_handler (struct pt_regs *regs); +bool try_handle_aarch32_break (struct pt_regs *regs);void debug_traps_init (void );
arch/arm64/kernel/debug-monitors.c +5 -5
@@ -335,7 +335,7 @@ static int brk_handler(unsigned long unused, unsigned long esr, }NOKPROBE_SYMBOL (brk_handler); -int aarch32_break_handler (struct pt_regs *regs) +bool try_handle_aarch32_break (struct pt_regs *regs) {u32 arm_instr;u16 thumb_instr;
@@ -343,7 +343,7 @@ int aarch32_break_handler(struct pt_regs *regs)void __user *pc = (void __user *)instruction_pointer (regs);if (!compat_user_mode (regs)) -return -EFAULT ; +return false;if (compat_thumb_mode (regs)) {/* get 16-bit Thumb instruction */
@@ -367,12 +367,12 @@ int aarch32_break_handler(struct pt_regs *regs) }if (!bp) -return -EFAULT ; +return false;send_user_sigtrap (TRAP_BRKPT ); -return 0 ; +return true; } -NOKPROBE_SYMBOL (aarch32_break_handler); +NOKPROBE_SYMBOL (try_handle_aarch32_break);void __init debug_traps_init (void ) {
arch/arm64/kernel/traps.c +1 -1
@@ -462,7 +462,7 @@ void do_el0_undef(struct pt_regs *regs, unsigned long esr)u32 insn;/* check for AArch32 breakpoint instructions */ -if (!aarch32_break_handler (regs)) +if (try_handle_aarch32_break (regs))return ;if (user_insn_read (regs, &insn))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 13/307 arm64: debug: call software breakpoint handlers statically
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit 6adfdc5e2ef9c71a76d8d127a2eb54f0fbe9be5e ]
Software breakpoints pass an immediate value in ESR ("comment") that can be used to call a specialized handler (KGDB, KASAN...).
We do so in two different ways :
- During early boot, early_brk64 statically checks against known immediates and calls the corresponding handler,
- During init, handlers are dynamically registered into a list. When called, the generic software breakpoint handler will iterate over the list to find the appropriate handler.
The dynamic registration does not provide any benefit here as it is not exported and all its uses are within the arm64 tree. It also depends on an RCU list, whose safe access currently relies on the non-preemptible state of do_debug_exception.
Replace the list iteration logic in call_break_hooks to call the breakpoint handlers statically if they are enabled, like in early_brk64.
Expose the handlers in their respective headers to be reachable from arch/arm64/kernel/debug-monitors.c at link time.
Unify the naming of the software breakpoint handlers to XXX_brk_handler(), making it clear they are related and to differentiate from the hardware breakpoints.
--- arch/arm64/include/asm/kgdb.h | 3 + arch/arm64/include/asm/kprobes.h | 8 +++ arch/arm64/include/asm/traps.h | 6 ++ arch/arm64/include/asm/uprobes.h | 2 + arch/arm64/kernel/debug-monitors.c | 53 +++++++++++++---- arch/arm64/kernel/kgdb.c | 22 ++----- arch/arm64/kernel/probes/kprobes.c | 31 ++-------- arch/arm64/kernel/probes/kprobes_trampoline.S | 2 +- arch/arm64/kernel/probes/uprobes.c | 9 +-- arch/arm64/kernel/traps.c | 59 ++++--------------- 10 files changed, 82 insertions(+), 113 deletions(-)
arch/arm64/include/asm/kgdb.h +3 -0
@@ -24,6 +24,9 @@ static inline void arch_kgdb_breakpoint(void)extern void kgdb_handle_bus_error (void );extern int kgdb_fault_expected; +int kgdb_brk_handler (struct pt_regs *regs,unsigned long esr); +int kgdb_compiled_brk_handler (struct pt_regs *regs,unsigned long esr); +#endif /* !__ASSEMBLY__ */ /*
arch/arm64/include/asm/kprobes.h +8 -0
@@ -41,4 +41,12 @@ void __kretprobe_trampoline(void);void __kprobes *trampoline_probe_handler (struct pt_regs *regs);#endif /* CONFIG_KPROBES */ + +int __kprobes kprobe_brk_handler (struct pt_regs *regs, +unsigned long esr); +int __kprobes kprobe_ss_brk_handler (struct pt_regs *regs, +unsigned long esr); +int __kprobes kretprobe_brk_handler (struct pt_regs *regs, +unsigned long esr); +#endif /* _ARM_KPROBES_H */
arch/arm64/include/asm/traps.h +6 -0
@@ -29,6 +29,12 @@ void arm64_force_sig_fault_pkey(unsigned long far, const char *str, int pkey);void arm64_force_sig_mceerr (int code,unsigned long far,short lsb,const char *str);void arm64_force_sig_ptrace_errno_trap (int errno,unsigned long far,const char *str); +int bug_brk_handler (struct pt_regs *regs,unsigned long esr); +int cfi_brk_handler (struct pt_regs *regs,unsigned long esr); +int reserved_fault_brk_handler (struct pt_regs *regs,unsigned long esr); +int kasan_brk_handler (struct pt_regs *regs,unsigned long esr); +int ubsan_brk_handler (struct pt_regs *regs,unsigned long esr); +int early_brk64 (unsigned long addr,unsigned long esr,struct pt_regs *regs);/*
arch/arm64/include/asm/uprobes.h +2 -0
@@ -28,4 +28,6 @@ struct arch_uprobe { bool simulate; }; +int uprobe_brk_handler (struct pt_regs *regs,unsigned long esr); +#endif
arch/arm64/kernel/debug-monitors.c +41 -12
71 lines not on this page · raw message
arch/arm64/kernel/kgdb.c +4 -18
@@ -234,21 +234,21 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,return err; } -static int kgdb_brk_fn (struct pt_regs *regs,unsigned long esr) +int kgdb_brk_handler (struct pt_regs *regs,unsigned long esr) {kgdb_handle_exception (1 ,SIGTRAP ,0 , regs);return DBG_HOOK_HANDLED ; } -NOKPROBE_SYMBOL (kgdb_brk_fn) +NOKPROBE_SYMBOL (kgdb_brk_handler) -static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned long esr) +int kgdb_compiled_brk_handler(struct pt_regs *regs, unsigned long esr) { compiled_break =1 ;kgdb_handle_exception (1 ,SIGTRAP ,0 , regs);return DBG_HOOK_HANDLED ; } -NOKPROBE_SYMBOL (kgdb_compiled_brk_fn); +NOKPROBE_SYMBOL (kgdb_compiled_brk_handler);static int kgdb_step_brk_fn (struct pt_regs *regs,unsigned long esr) {
@@ -260,16 +260,6 @@ static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned long esr) }NOKPROBE_SYMBOL (kgdb_step_brk_fn); -static struct break_hook kgdb_brkpt_hook = { - .fn = kgdb_brk_fn, - .imm =KGDB_DYN_DBG_BRK_IMM , -}; - -static struct break_hook kgdb_compiled_brkpt_hook = { - .fn = kgdb_compiled_brk_fn, - .imm =KGDB_COMPILED_DBG_BRK_IMM , -}; -static struct step_hook kgdb_step_hook = { .fn = kgdb_step_brk_fn };
@@ -316,8 +306,6 @@ int kgdb_arch_init(void)if (ret !=0 )return ret; -register_kernel_break_hook (&kgdb_brkpt_hook); -register_kernel_break_hook (&kgdb_compiled_brkpt_hook);register_kernel_step_hook (&kgdb_step_hook);return 0 ; }
@@ -329,8 +317,6 @@ int kgdb_arch_init(void)*/ void kgdb_arch_exit (void ) { -unregister_kernel_break_hook (&kgdb_brkpt_hook); -unregister_kernel_break_hook (&kgdb_compiled_brkpt_hook);unregister_kernel_step_hook (&kgdb_step_hook);unregister_die_notifier (&kgdb_notifier); }
arch/arm64/kernel/probes/kprobes.c +6 -25
@@ -306,8 +306,8 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr)return 0 ; } -static int __kprobes -kprobe_breakpoint_handler (struct pt_regs *regs,unsigned long esr) +int __kprobes +kprobe_brk_handler (struct pt_regs *regs,unsigned long esr) {struct kprobe *p, *cur_kprobe;struct kprobe_ctlblk *kcb;
@@ -350,13 +350,8 @@ kprobe_breakpoint_handler(struct pt_regs *regs, unsigned long esr)return DBG_HOOK_HANDLED ; } -static struct break_hook kprobes_break_hook = { - .imm =KPROBES_BRK_IMM , - .fn = kprobe_breakpoint_handler, -}; - -static int __kprobes -kprobe_breakpoint_ss_handler (struct pt_regs *regs,unsigned long esr) +int __kprobes +kprobe_ss_brk_handler (struct pt_regs *regs,unsigned long esr) {struct kprobe_ctlblk *kcb =get_kprobe_ctlblk ();unsigned long addr =instruction_pointer (regs);
@@ -374,13 +369,8 @@ kprobe_breakpoint_ss_handler(struct pt_regs *regs, unsigned long esr)return DBG_HOOK_ERROR ; } -static struct break_hook kprobes_break_ss_hook = { - .imm =KPROBES_BRK_SS_IMM , - .fn = kprobe_breakpoint_ss_handler, -}; - -static int __kprobes -kretprobe_breakpoint_handler (struct pt_regs *regs,unsigned long esr) +int __kprobes +kretprobe_brk_handler (struct pt_regs *regs,unsigned long esr) {if (regs->pc != (unsigned long )__kretprobe_trampoline)return DBG_HOOK_ERROR ;
@@ -389,11 +379,6 @@ kretprobe_breakpoint_handler(struct pt_regs *regs, unsigned long esr)return DBG_HOOK_HANDLED ; } -static struct break_hook kretprobes_break_hook = { - .imm =KRETPROBES_BRK_IMM , - .fn = kretprobe_breakpoint_handler, -}; -/* * Provide a blacklist of symbols identifying ranges which cannot be kprobed. * This blacklist is exposed to userspace via debugfs (kprobes/blacklist).
@@ -436,9 +421,5 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p)int __init arch_init_kprobes (void ) { -register_kernel_break_hook (&kprobes_break_hook); -register_kernel_break_hook (&kprobes_break_ss_hook); -register_kernel_break_hook (&kretprobes_break_hook); -return 0 ; }
arch/arm64/kernel/probes/kprobes_trampoline.S +1 -1
@@ -12,7 +12,7 @@ SYM_CODE_START(__kretprobe_trampoline) /* * Trigger a breakpoint exception. The PC will be adjusted by - * kretprobe_breakpoint_handler(), and no subsequent instructions will + * kretprobe_brk_handler(), and no subsequent instructions will * be executed from the trampoline. */ brk #KRETPROBES_BRK_IMM
arch/arm64/kernel/probes/uprobes.c +1 -8
@@ -165,7 +165,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,return NOTIFY_DONE ; } -static int uprobe_breakpoint_handler (struct pt_regs *regs, +int uprobe_brk_handler (struct pt_regs *regs,unsigned long esr) {if (uprobe_pre_sstep_notifier (regs))
@@ -186,12 +186,6 @@ static int uprobe_single_step_handler(struct pt_regs *regs,return DBG_HOOK_ERROR ; } -/* uprobe breakpoint handler hook */ -static struct break_hook uprobes_break_hook = { - .imm =UPROBES_BRK_IMM , - .fn = uprobe_breakpoint_handler, -}; -/* uprobe single step handler hook */ static struct step_hook uprobes_step_hook = { .fn = uprobe_single_step_handler,
@@ -199,7 +193,6 @@ static struct step_hook uprobes_step_hook = {static int __init arch_init_uprobes (void ) { -register_user_break_hook (&uprobes_break_hook);register_user_step_hook (&uprobes_step_hook);return 0 ;
arch/arm64/kernel/traps.c +10 -49
127 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 14/307 arm64: debug: call step handlers statically
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit 403b48aad5b3e857b8c2576ce6a421f3d23dd6a6 ]
Software stepping checks for the correct handler by iterating over a list of dynamically registered handlers and calling all of them until one handles the exception.
This is the only generic way to handle software stepping handlers in arm64 as the exception does not provide an immediate that could be checked, contrary to software breakpoints.
However, the registration mechanism is not exported and has only two current users : the KGDB stepping handler, and the uprobe single step handler.
Given that one comes from user mode and the other from kernel mode, call the appropriate one by checking the source EL of the exception. Add a stand-in that returns DBG_HOOK_ERROR when the configuration options are not enabled.
Remove arch_init_uprobes() as it is not useful anymore and is specific to arm64.
Unify the naming of the handler to XXX_single_step_handler(), making it clear they are related.
--- arch/arm64/include/asm/kgdb.h | 9 +++++++++ arch/arm64/include/asm/uprobes.h | 9 +++++++++ arch/arm64/kernel/debug-monitors.c | 25 ++++++------------------- arch/arm64/kernel/kgdb.c | 17 +++-------------- arch/arm64/kernel/probes/uprobes.c | 15 +-------------- 5 files changed, 28 insertions(+), 47 deletions(-)
arch/arm64/include/asm/kgdb.h +9 -0
@@ -26,6 +26,15 @@ extern int kgdb_fault_expected;int kgdb_brk_handler (struct pt_regs *regs,unsigned long esr);int kgdb_compiled_brk_handler (struct pt_regs *regs,unsigned long esr); +#ifdef CONFIG_KGDB +int kgdb_single_step_handler (struct pt_regs *regs,unsigned long esr); +#else +static inline int kgdb_single_step_handler (struct pt_regs *regs, +unsigned long esr) +{ +return DBG_HOOK_ERROR ; +} +#endif #endif /* !__ASSEMBLY__ */
arch/arm64/include/asm/uprobes.h +9 -0
@@ -29,5 +29,14 @@ struct arch_uprobe { };int uprobe_brk_handler (struct pt_regs *regs,unsigned long esr); +#ifdef CONFIG_UPROBES +int uprobe_single_step_handler (struct pt_regs *regs,unsigned long esr); +#else +static inline int uprobe_single_step_handler (struct pt_regs *regs, +unsigned long esr) +{ +return DBG_HOOK_ERROR ; +} +#endif #endif
arch/arm64/kernel/debug-monitors.c +6 -19
@@ -200,30 +200,17 @@ void unregister_kernel_step_hook(struct step_hook *hook) }/* -* Call registered single step handlers +* Call single step handlers * There is no Syndrome info to check for determining the handler. -* So we call all the registered handlers, until the right handler is -* found which returns zero. +* However, there is only one possible handler for user and kernel modes, so +* check and call the appropriate one. */ static int call_step_hook (struct pt_regs *regs,unsigned long esr) { -struct step_hook *hook; -struct list_head *list; -int retval =DBG_HOOK_ERROR ; +if (user_mode (regs)) +return uprobe_single_step_handler (regs, esr); - list =user_mode (regs) ? &user_step_hook : &kernel_step_hook; - -/* -* Since single-step exception disables interrupt, this function is -* entirely not preemptible, and we can use rcu list safely here. -*/ -list_for_each_entry_rcu (hook, list, node) { - retval = hook->fn (regs, esr); -if (retval ==DBG_HOOK_HANDLED ) -break ; - } - -return retval; +return kgdb_single_step_handler (regs, esr); }NOKPROBE_SYMBOL (call_step_hook);
arch/arm64/kernel/kgdb.c +3 -14
@@ -250,7 +250,7 @@ int kgdb_compiled_brk_handler(struct pt_regs *regs, unsigned long esr) }NOKPROBE_SYMBOL (kgdb_compiled_brk_handler); -static int kgdb_step_brk_fn (struct pt_regs *regs,unsigned long esr) +int kgdb_single_step_handler (struct pt_regs *regs,unsigned long esr) {if (!kgdb_single_step)return DBG_HOOK_ERROR ;
@@ -258,11 +258,7 @@ static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned long esr)kgdb_handle_exception (0 ,SIGTRAP ,0 , regs);return DBG_HOOK_HANDLED ; } -NOKPROBE_SYMBOL (kgdb_step_brk_fn); - -static struct step_hook kgdb_step_hook = { - .fn = kgdb_step_brk_fn -}; +NOKPROBE_SYMBOL (kgdb_single_step_handler);static int __kgdb_notify (struct die_args *args,unsigned long cmd) {
@@ -301,13 +297,7 @@ static struct notifier_block kgdb_notifier = {*/ int kgdb_arch_init (void ) { -int ret =register_die_notifier (&kgdb_notifier); - -if (ret !=0 ) -return ret; - -register_kernel_step_hook (&kgdb_step_hook); -return 0 ; +return register_die_notifier (&kgdb_notifier); }/*
@@ -317,7 +307,6 @@ int kgdb_arch_init(void)*/ void kgdb_arch_exit (void ) { -unregister_kernel_step_hook (&kgdb_step_hook);unregister_die_notifier (&kgdb_notifier); }
arch/arm64/kernel/probes/uprobes.c +1 -14
@@ -174,7 +174,7 @@ int uprobe_brk_handler(struct pt_regs *regs,return DBG_HOOK_ERROR ; } -static int uprobe_single_step_handler (struct pt_regs *regs, +int uprobe_single_step_handler (struct pt_regs *regs,unsigned long esr) {struct uprobe_task *utask = current->utask;
@@ -186,16 +186,3 @@ static int uprobe_single_step_handler(struct pt_regs *regs,return DBG_HOOK_ERROR ; } -/* uprobe single step handler hook */ -static struct step_hook uprobes_step_hook = { - .fn = uprobe_single_step_handler, -}; - -static int __init arch_init_uprobes (void ) -{ -register_user_step_hook (&uprobes_step_hook); - -return 0 ; -} - -device_initcall (arch_init_uprobes);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/307 arm64: debug: remove break/step handler registration infrastructure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit d4e0b12620946a4011ad695490211fc38bf5cb42 ]
Remove all infrastructure for the dynamic registration previously used by software breakpoints and stepping handlers.
--- arch/arm64/include/asm/debug-monitors.h | 24 ---------- arch/arm64/kernel/debug-monitors.c | 63 ------------------------- 2 files changed, 87 deletions(-)
arch/arm64/include/asm/debug-monitors.h +0 -24
@@ -62,30 +62,6 @@ struct task_struct;#define DBG_HOOK_HANDLED 0#define DBG_HOOK_ERROR 1 -struct step_hook { -struct list_head node; -int (*fn)(struct pt_regs *regs,unsigned long esr); -}; - -void register_user_step_hook (struct step_hook *hook); -void unregister_user_step_hook (struct step_hook *hook); - -void register_kernel_step_hook (struct step_hook *hook); -void unregister_kernel_step_hook (struct step_hook *hook); - -struct break_hook { -struct list_head node; -int (*fn)(struct pt_regs *regs,unsigned long esr); -u16 imm; -u16 mask;/* These bits are ignored when comparing with imm */ -}; - -void register_user_break_hook (struct break_hook *hook); -void unregister_user_break_hook (struct break_hook *hook); - -void register_kernel_break_hook (struct break_hook *hook); -void unregister_kernel_break_hook (struct break_hook *hook); -u8 debug_monitors_arch (void );enum dbg_active_el {
arch/arm64/kernel/debug-monitors.c +0 -63
75 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 16/307 arm64: entry: Add entry and exit functions for debug exceptions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit eaff68b3286116d499a3d4e513a36d772faba587 ]
Move the debug_exception_enter() and debug_exception_exit() functions from mm/fault.c, as they are needed to split the debug exceptions entry paths from the current unified one.
Make them externally visible in include/asm/exception.h until the caller in mm/fault.c is cleaned up.
--- arch/arm64/include/asm/exception.h | 4 ++++ arch/arm64/kernel/entry-common.c | 22 ++++++++++++++++++++++ arch/arm64/mm/fault.c | 22 ---------------------- 3 files changed, 26 insertions(+), 22 deletions(-)
arch/arm64/include/asm/exception.h +4 -0
@@ -77,4 +77,8 @@ void do_serror(struct pt_regs *regs, unsigned long esr);void do_signal (struct pt_regs *regs);void __noreturn panic_bad_stack (struct pt_regs *regs,unsigned long esr,unsigned long far); + +void debug_exception_enter (struct pt_regs *regs); +void debug_exception_exit (struct pt_regs *regs); +#endif /* __ASM_EXCEPTION_H */
arch/arm64/kernel/entry-common.c +22 -0
@@ -441,6 +441,28 @@ static __always_inline void fpsimd_syscall_exit(void)__this_cpu_write (fpsimd_last_state.to_save,FP_STATE_CURRENT ); } +/* +* In debug exception context, we explicitly disable preemption despite +* having interrupts disabled. +* This serves two purposes: it makes it much less likely that we would +* accidentally schedule in exception context and it will force a warning +* if we somehow manage to schedule by accident. +*/ +void debug_exception_enter (struct pt_regs *regs) +{ +preempt_disable (); + +/* This code is a bit fragile. Test it. */ +RCU_LOCKDEP_WARN (!rcu_is_watching (),"exception_enter didn't work" ); +} +NOKPROBE_SYMBOL (debug_exception_enter); + +void debug_exception_exit (struct pt_regs *regs) +{ +preempt_enable_no_resched (); +} +NOKPROBE_SYMBOL (debug_exception_exit); + UNHANDLED(el1t, 64, sync) UNHANDLED(el1t, 64, irq)UNHANDLED (el1t,64 , fiq)
arch/arm64/mm/fault.c +0 -22
@@ -939,28 +939,6 @@ void __init hook_debug_fault_code(int nr, debug_fault_info[nr].name = name; } -/* -* In debug exception context, we explicitly disable preemption despite -* having interrupts disabled. -* This serves two purposes: it makes it much less likely that we would -* accidentally schedule in exception context and it will force a warning -* if we somehow manage to schedule by accident. -*/ -static void debug_exception_enter (struct pt_regs *regs) -{ -preempt_disable (); - -/* This code is a bit fragile. Test it. */ -RCU_LOCKDEP_WARN (!rcu_is_watching (),"exception_enter didn't work" ); -} -NOKPROBE_SYMBOL (debug_exception_enter); - -static void debug_exception_exit (struct pt_regs *regs) -{ -preempt_enable_no_resched (); -} -NOKPROBE_SYMBOL (debug_exception_exit); -void do_debug_exception (unsigned long addr_if_watchpoint,unsigned long esr,struct pt_regs *regs) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 17/307 arm64: debug: split hardware breakpoint exception entry
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit 43e2ae77fcab8a01101a2e5da528b5222b338e5f ]
Currently all debug exceptions share common entry code and are routed to do_debug_exception(), which calls dynamically-registered handlers for each specific debug exception. This is unfortunate as different debug exceptions have different entry handling requirements, and it would be better to handle these distinct requirements earlier.
Hardware breakpoints exceptions are generated by the hardware after user configuration. As such, they can be exploited when training branch predictors outside of the userspace VA range: they still need to call arm64_apply_bp_hardening() if needed to mitigate against this attack.
However, they do not need to handle the Cortex-A76 erratum #1463225 as it only applies to single stepping exceptions.
It does not set an address in FAR_EL1 either, only the hardware watchpoint does.
As the hardware breakpoint handler only returns 0 and never triggers the call to arm64_notify_die(), we can call it directly from entry-common.c.
Split the hardware breakpoint exception entry, adjust
the function signature, and handling of the Cortex-A76 erratum to fit the behaviour of the exception.
Move the call to arm64_apply_bp_hardening() to entry-common.c so that we can do it as early as possible, and only for the exceptions coming from EL0, where it is needed.
This is safe to do as it is noinstr, as are all the functions it may call. el0_ia() and el0_pc() already call it this way.
--- arch/arm64/include/asm/exception.h | 5 +++++ arch/arm64/kernel/entry-common.c | 28 ++++++++++++++++++++++++++++ arch/arm64/kernel/hw_breakpoint.c | 16 ++++++---------- 3 files changed, 39 insertions(+), 10 deletions(-)
arch/arm64/include/asm/exception.h +5 -0
@@ -59,6 +59,11 @@ void do_el0_bti(struct pt_regs *regs);void do_el1_bti (struct pt_regs *regs,unsigned long esr);void do_debug_exception (unsigned long addr_if_watchpoint,unsigned long esr,struct pt_regs *regs); +#ifdef CONFIG_HAVE_HW_BREAKPOINT +void do_breakpoint (unsigned long esr,struct pt_regs *regs); +#else +static inline void do_breakpoint (unsigned long esr,struct pt_regs *regs) {} +#endif /* CONFIG_HAVE_HW_BREAKPOINT */ void do_fpsimd_acc (unsigned long esr,struct pt_regs *regs);void do_sve_acc (unsigned long esr,struct pt_regs *regs);void do_sme_acc (unsigned long esr,struct pt_regs *regs);
arch/arm64/kernel/entry-common.c +28 -0
@@ -508,6 +508,15 @@ static void noinstr el1_bti(struct pt_regs *regs, unsigned long esr)exit_to_kernel_mode (regs); } +static void noinstr el1_breakpt(struct pt_regs *regs, unsigned long esr) +{ +arm64_enter_el1_dbg (regs); +debug_exception_enter (regs); +do_breakpoint (esr, regs); +debug_exception_exit (regs); +arm64_exit_el1_dbg (regs); +} + static void noinstr el1_dbg(struct pt_regs *regs, unsigned long esr) {unsigned long far =read_sysreg (far_el1);
@@ -551,6 +560,8 @@ asmlinkage void noinstr el1h_64_sync_handler(struct pt_regs *regs)el1_bti (regs, esr);break ;case ESR_ELx_EC_BREAKPT_CUR: +el1_breakpt (regs, esr); +break ;case ESR_ELx_EC_SOFTSTP_CUR:case ESR_ELx_EC_WATCHPT_CUR:case ESR_ELx_EC_BRK64:
@@ -737,6 +748,19 @@ static void noinstr el0_inv(struct pt_regs *regs, unsigned long esr)exit_to_user_mode (regs); } +static void noinstr el0_breakpt(struct pt_regs *regs, unsigned long esr) +{ +if (!is_ttbr0_addr (regs->pc)) +arm64_apply_bp_hardening (); + +enter_from_user_mode (regs); +debug_exception_enter (regs); +do_breakpoint (esr, regs); +debug_exception_exit (regs); +local_daif_restore (DAIF_PROCCTX ); +exit_to_user_mode (regs); +} + static void noinstr el0_dbg(struct pt_regs *regs, unsigned long esr) {/* Only watchpoints write FAR_EL1, otherwise its UNKNOWN */
@@ -813,6 +837,8 @@ asmlinkage void noinstr el0t_64_sync_handler(struct pt_regs *regs)el0_mops (regs, esr);break ;case ESR_ELx_EC_BREAKPT_LOW: +el0_breakpt (regs, esr); +break ;case ESR_ELx_EC_SOFTSTP_LOW:case ESR_ELx_EC_WATCHPT_LOW:case ESR_ELx_EC_BRK64:
@@ -933,6 +959,8 @@ asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs)el0_cp15 (regs, esr);break ;case ESR_ELx_EC_BREAKPT_LOW: +el0_breakpt (regs, esr); +break ;case ESR_ELx_EC_SOFTSTP_LOW:case ESR_ELx_EC_WATCHPT_LOW:case ESR_ELx_EC_BKPT32:
arch/arm64/kernel/hw_breakpoint.c +6 -10
@@ -22,6 +22,7 @@#include <asm/current.h> #include <asm/debug-monitors.h> #include <asm/esr.h> +#include <asm/exception.h> #include <asm/hw_breakpoint.h> #include <asm/traps.h> #include <asm/cputype.h>
@@ -618,8 +619,7 @@ NOKPROBE_SYMBOL(toggle_bp_registers);/* * Debug exception handlers. */ -static int breakpoint_handler (unsigned long unused,unsigned long esr, -struct pt_regs *regs) +void do_breakpoint (unsigned long esr,struct pt_regs *regs) {int i, step =0 , *kernel_step;u32 ctrl_reg;
@@ -662,7 +662,7 @@ static int breakpoint_handler(unsigned long unused, unsigned long esr, }if (!step) -return 0 ; +return ;if (user_mode (regs)) { debug_info->bps_disabled =1 ;
@@ -670,7 +670,7 @@ static int breakpoint_handler(unsigned long unused, unsigned long esr,/* If we're already stepping a watchpoint, just return. */ if (debug_info->wps_disabled) -return 0 ; +return ;if (test_thread_flag (TIF_SINGLESTEP )) debug_info->suspended_step =1 ;
@@ -681,7 +681,7 @@ static int breakpoint_handler(unsigned long unused, unsigned long esr, kernel_step =this_cpu_ptr (&stepping_kernel_bp);if (*kernel_step !=ARM_KERNEL_STEP_NONE ) -return 0 ; +return ;if (kernel_active_single_step ()) { *kernel_step =ARM_KERNEL_STEP_SUSPEND ;
@@ -690,10 +690,8 @@ static int breakpoint_handler(unsigned long unused, unsigned long esr,kernel_enable_single_step (regs); } } - -return 0 ; } -NOKPROBE_SYMBOL (breakpoint_handler); +NOKPROBE_SYMBOL (do_breakpoint);/* * Arm64 hardware does not always report a watchpoint hit address that matches
@@ -988,8 +986,6 @@ static int __init arch_hw_breakpoint_init(void) core_num_brps, core_num_wrps);/* Register debug fault handlers. */ -hook_debug_fault_code (DBG_ESR_EVT_HWBP , breakpoint_handler,SIGTRAP , -TRAP_HWBKPT ,"hw-breakpoint handler" );hook_debug_fault_code (DBG_ESR_EVT_HWWP , watchpoint_handler,SIGTRAP ,TRAP_HWBKPT ,"hw-watchpoint handler" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/307 arm64: debug: refactor reinstall_suspended_bps()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit 80691d35523de3292b64c2ffa444aab3d55e51ba ]
reinstall_suspended_bps() plays a key part in the stepping process when we have hardware breakpoints and watchpoints enabled. It checks if we need to step one, will re-enable it if it has been handled and will return whether or not we need to proceed with a single-step.
However, the current naming and return values make it harder to understand the logic and goal of the function.
Rename it try_step_suspended_breakpoints() and change the return value to a boolean, aligning it with similar functions used in do_el0_undef() like try_emulate_mrs(), and making its behaviour more obvious.
--- arch/arm64/include/asm/debug-monitors.h | 6 +++--- arch/arm64/kernel/debug-monitors.c | 2 +- arch/arm64/kernel/hw_breakpoint.c | 25 ++++++++++++------------- 3 files changed, 16 insertions(+), 17 deletions(-)
arch/arm64/include/asm/debug-monitors.h +3 -3
@@ -83,11 +83,11 @@ int kernel_active_single_step(void);void kernel_rewind_single_step (struct pt_regs *regs);#ifdef CONFIG_HAVE_HW_BREAKPOINT -int reinstall_suspended_bps (struct pt_regs *regs); +bool try_step_suspended_breakpoints (struct pt_regs *regs);#else -static inline int reinstall_suspended_bps (struct pt_regs *regs) +static inline bool try_step_suspended_breakpoints (struct pt_regs *regs) { -return -ENODEV ; +return false; }#endif
arch/arm64/kernel/debug-monitors.c +1 -1
@@ -195,7 +195,7 @@ static int single_step_handler(unsigned long unused, unsigned long esr,* If we are stepping a pending breakpoint, call the hw_breakpoint * handler first. */ -if (!reinstall_suspended_bps (regs)) +if (try_step_suspended_breakpoints (regs))return 0 ;if (call_step_hook (regs, esr) ==DBG_HOOK_HANDLED )
arch/arm64/kernel/hw_breakpoint.c +12 -13
@@ -847,36 +847,35 @@ NOKPROBE_SYMBOL(watchpoint_handler);/* * Handle single-step exception. */ -int reinstall_suspended_bps (struct pt_regs *regs) +bool try_step_suspended_breakpoints (struct pt_regs *regs) {struct debug_info *debug_info = ¤t->thread.debug; -int handled_exception =0 , *kernel_step; - - kernel_step =this_cpu_ptr (&stepping_kernel_bp); +int *kernel_step =this_cpu_ptr (&stepping_kernel_bp); +bool handled_exception = false;/* * Called from single-step exception handler. -* Return 0 if execution can resume, 1 if a SIGTRAP should be -* reported. +* Return true if we stepped a breakpoint and can resume execution, +* false if we need to handle a single-step. */ if (user_mode (regs)) {if (debug_info->bps_disabled) { debug_info->bps_disabled =0 ;toggle_bp_registers (AARCH64_DBG_REG_BCR ,DBG_ACTIVE_EL0 ,1 ); - handled_exception =1 ; + handled_exception = true; }if (debug_info->wps_disabled) { debug_info->wps_disabled =0 ;toggle_bp_registers (AARCH64_DBG_REG_WCR ,DBG_ACTIVE_EL0 ,1 ); - handled_exception =1 ; + handled_exception = true; }if (handled_exception) {if (debug_info->suspended_step) { debug_info->suspended_step =0 ;/* Allow exception handling to fall-through. */ - handled_exception =0 ; + handled_exception = false; }else {user_disable_single_step (current); }
@@ -890,17 +889,17 @@ int reinstall_suspended_bps(struct pt_regs *regs)if (*kernel_step !=ARM_KERNEL_STEP_SUSPEND ) {kernel_disable_single_step (); - handled_exception =1 ; + handled_exception = true; }else { - handled_exception =0 ; + handled_exception = false; } *kernel_step =ARM_KERNEL_STEP_NONE ; } -return !handled_exception; +return handled_exception; } -NOKPROBE_SYMBOL (reinstall_suspended_bps); +NOKPROBE_SYMBOL (try_step_suspended_breakpoints);/* * Context-switcher for restoring suspended breakpoints.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/307 arm64: debug: split single stepping exception entry
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit 0ac7584c08ceff13fc1e3082a0104548688d6b00 ]
Currently all debug exceptions share common entry code and are routed to do_debug_exception(), which calls dynamically-registered handlers for each specific debug exception. This is unfortunate as different debug exceptions have different entry handling requirements, and it would be better to handle these distinct requirements earlier.
The single stepping exception has the most constraints : it can be exploited to train branch predictors and it needs special handling at EL1 for the Cortex-A76 erratum #1463225. We need to conserve all those mitigations.
However, it does not write an address at FAR_EL1, as only hardware watchpoints do so.
The single-step handler does its own signaling if it needs to and only returns 0, so we can call it directly from entry-common.c.
Split the single stepping exception entry, adjust the function signature, keep the security mitigation and erratum handling.
Further, as the EL0 and EL1 code paths are cleanly separated, we can split do_softstep() into do_el0_softstep() and do_el1_softstep() and call them directly from the relevant entry paths.
We can also remove NOKPROBE_SYMBOL for the EL0 path, as it cannot lead to a kprobe recursion.
Move the call to arm64_apply_bp_hardening() to entry-common.c so that we can do it as early as possible, and only for the exceptions coming from EL0, where it is needed.
This is safe to do as it is noinstr, as are all the functions it may call. el0_ia() and el0_pc() already call it this way.
When taking a soft-step exception from EL0, most of the single stepping handling is safely preemptible : the only possible handler is uprobe_single_step_handler(). It only operates on task-local data and properly checks its validity, then raises a Thread Information Flag, processed before returning to userspace in do_notify_resume(), which is already preemptible.
However, the soft-step handler first calls reinstall_suspended_bps() to check if there is any hardware breakpoint or watchpoint pending or already stepped through.
This cannot be preempted as it manipulates the hardware breakpoint and watchpoint registers.
Move the call to try_step_suspended_breakpoints() to entry-common.c and adjust the relevant comments.
We can now safely unmask interrupts before handling the step itself, fixing a PREEMPT_RT issue where the handler could call a sleeping function with preemption disabled.
--- arch/arm64/include/asm/exception.h | 2 + arch/arm64/kernel/debug-monitors.c | 73 +++++++++++------------------- arch/arm64/kernel/entry-common.c | 43 ++++++++++++++++++ arch/arm64/kernel/hw_breakpoint.c | 2 +- 4 files changed, 73 insertions(+), 47 deletions(-)
arch/arm64/include/asm/exception.h +2 -0
@@ -64,6 +64,8 @@ void do_breakpoint(unsigned long esr, struct pt_regs *regs);#else static inline void do_breakpoint (unsigned long esr,struct pt_regs *regs) {}#endif /* CONFIG_HAVE_HW_BREAKPOINT */ +void do_el0_softstep (unsigned long esr,struct pt_regs *regs); +void do_el1_softstep (unsigned long esr,struct pt_regs *regs);void do_fpsimd_acc (unsigned long esr,struct pt_regs *regs);void do_sve_acc (unsigned long esr,struct pt_regs *regs);void do_sme_acc (unsigned long esr,struct pt_regs *regs);
arch/arm64/kernel/debug-monitors.c +27 -46
103 lines not on this page · raw message
arch/arm64/kernel/entry-common.c +43 -0
73 lines not on this page · raw message
arch/arm64/kernel/hw_breakpoint.c +1 -1
@@ -854,7 +854,7 @@ bool try_step_suspended_breakpoints(struct pt_regs *regs)bool handled_exception = false;/* -* Called from single-step exception handler. +* Called from single-step exception entry. * Return true if we stepped a breakpoint and can resume execution, * false if we need to handle a single-step. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 20/307 arm64: debug: split hardware watchpoint exception entry
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit 413f0bba005dacf2484bb8ecce212fab9be79d81 ]
Currently all debug exceptions share common entry code and are routed to do_debug_exception(), which calls dynamically-registered handlers for each specific debug exception. This is unfortunate as different debug exceptions have different entry handling requirements, and it would be better to handle these distinct requirements earlier.
Hardware watchpoints are the only debug exceptions that will write FAR_EL1, so we need to preserve it and pass it down. However, they cannot be used to maliciously train branch predictors, so we can omit calling arm64_bp_hardening(), nor do they need to handle the Cortex-A76 erratum #1463225, as it only applies to single stepping exceptions.
As the hardware watchpoint handler only returns 0 and never triggers the call to arm64_notify_die(), we can call it directly from entry-common.c.
Split the hardware watchpoint exception entry and adjust the behaviour to match the lack of needed mitigations.
--- arch/arm64/include/asm/exception.h | 4 ++++ arch/arm64/kernel/entry-common.c | 31 ++++++++++++++++++++++++++++++ arch/arm64/kernel/hw_breakpoint.c | 17 +++++----------- 3 files changed, 40 insertions(+), 12 deletions(-)
arch/arm64/include/asm/exception.h +4 -0
@@ -61,8 +61,12 @@ void do_debug_exception(unsigned long addr_if_watchpoint, unsigned long esr, struct pt_regs *regs);#ifdef CONFIG_HAVE_HW_BREAKPOINT void do_breakpoint (unsigned long esr,struct pt_regs *regs); +void do_watchpoint (unsigned long addr,unsigned long esr, +struct pt_regs *regs);#else static inline void do_breakpoint (unsigned long esr,struct pt_regs *regs) {} +static inline void do_watchpoint (unsigned long addr,unsigned long esr, +struct pt_regs *regs) {}#endif /* CONFIG_HAVE_HW_BREAKPOINT */ void do_el0_softstep (unsigned long esr,struct pt_regs *regs);void do_el1_softstep (unsigned long esr,struct pt_regs *regs);
arch/arm64/kernel/entry-common.c +31 -0
@@ -535,6 +535,18 @@ static void noinstr el1_softstp(struct pt_regs *regs, unsigned long esr)arm64_exit_el1_dbg (regs); } +static void noinstr el1_watchpt(struct pt_regs *regs, unsigned long esr) +{ +/* Watchpoints are the only debug exception to write FAR_EL1 */ +unsigned long far =read_sysreg (far_el1); + +arm64_enter_el1_dbg (regs); +debug_exception_enter (regs); +do_watchpoint (far, esr, regs); +debug_exception_exit (regs); +arm64_exit_el1_dbg (regs); +} + static void noinstr el1_dbg(struct pt_regs *regs, unsigned long esr) {unsigned long far =read_sysreg (far_el1);
@@ -584,6 +596,8 @@ asmlinkage void noinstr el1h_64_sync_handler(struct pt_regs *regs)el1_softstp (regs, esr);break ;case ESR_ELx_EC_WATCHPT_CUR: +el1_watchpt (regs, esr); +break ;case ESR_ELx_EC_BRK64:el1_dbg (regs, esr);break ;
@@ -800,6 +814,19 @@ static void noinstr el0_softstp(struct pt_regs *regs, unsigned long esr)exit_to_user_mode (regs); } +static void noinstr el0_watchpt(struct pt_regs *regs, unsigned long esr) +{ +/* Watchpoints are the only debug exception to write FAR_EL1 */ +unsigned long far =read_sysreg (far_el1); + +enter_from_user_mode (regs); +debug_exception_enter (regs); +do_watchpoint (far, esr, regs); +debug_exception_exit (regs); +local_daif_restore (DAIF_PROCCTX ); +exit_to_user_mode (regs); +} + static void noinstr el0_dbg(struct pt_regs *regs, unsigned long esr) {/* Only watchpoints write FAR_EL1, otherwise its UNKNOWN */
@@ -882,6 +909,8 @@ asmlinkage void noinstr el0t_64_sync_handler(struct pt_regs *regs)el0_softstp (regs, esr);break ;case ESR_ELx_EC_WATCHPT_LOW: +el0_watchpt (regs, esr); +break ;case ESR_ELx_EC_BRK64:el0_dbg (regs, esr);break ;
@@ -1006,6 +1035,8 @@ asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs)el0_softstp (regs, esr);break ;case ESR_ELx_EC_WATCHPT_LOW: +el0_watchpt (regs, esr); +break ;case ESR_ELx_EC_BKPT32:el0_dbg (regs, esr);break ;
arch/arm64/kernel/hw_breakpoint.c +5 -12
@@ -750,8 +750,7 @@ static int watchpoint_report(struct perf_event *wp, unsigned long addr,return step; } -static int watchpoint_handler (unsigned long addr,unsigned long esr, -struct pt_regs *regs) +void do_watchpoint (unsigned long addr,unsigned long esr,struct pt_regs *regs) {int i, step =0 , *kernel_step, access, closest_match =0 ;u64 min_dist =-1 , dist;
@@ -806,7 +805,7 @@ static int watchpoint_handler(unsigned long addr, unsigned long esr,rcu_read_unlock ();if (!step) -return 0 ; +return ;/* * We always disable EL0 watchpoints because the kernel can
@@ -819,7 +818,7 @@ static int watchpoint_handler(unsigned long addr, unsigned long esr,/* If we're already stepping a breakpoint, just return. */ if (debug_info->bps_disabled) -return 0 ; +return ;if (test_thread_flag (TIF_SINGLESTEP )) debug_info->suspended_step =1 ;
@@ -830,7 +829,7 @@ static int watchpoint_handler(unsigned long addr, unsigned long esr, kernel_step =this_cpu_ptr (&stepping_kernel_bp);if (*kernel_step !=ARM_KERNEL_STEP_NONE ) -return 0 ; +return ;if (kernel_active_single_step ()) { *kernel_step =ARM_KERNEL_STEP_SUSPEND ;
@@ -839,10 +838,8 @@ static int watchpoint_handler(unsigned long addr, unsigned long esr,kernel_enable_single_step (regs); } } - -return 0 ; } -NOKPROBE_SYMBOL (watchpoint_handler); +NOKPROBE_SYMBOL (do_watchpoint);/* * Handle single-step exception.
@@ -984,10 +981,6 @@ static int __init arch_hw_breakpoint_init(void)pr_info ("found %d breakpoint and %d watchpoint registers.\n" , core_num_brps, core_num_wrps); -/* Register debug fault handlers. */ -hook_debug_fault_code (DBG_ESR_EVT_HWWP , watchpoint_handler,SIGTRAP , -TRAP_HWBKPT ,"hw-watchpoint handler" ); -/* * Reset the breakpoint resources. We assume that a halting * debugger will leave the world in a nice state for us.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 21/307 arm64: debug: split brk64 exception entry
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit 31575e11ecf7e44face72d1e624cb147a9283733 ]
Currently all debug exceptions share common entry code and are routed to do_debug_exception(), which calls dynamically-registered handlers for each specific debug exception. This is unfortunate as different debug exceptions have different entry handling requirements, and it would be better to handle these distinct requirements earlier.
The BRK64 instruction can only be triggered by a BRK instruction. Thus, we know that the PC is a legitimate address and isn't being used to train a branch predictor with a bogus address : we don't need to call arm64_apply_bp_hardening().
We do not need to handle the Cortex-A76 erratum #1463225 either, as it only relevant for single stepping at EL1.
BRK64 does not write FAR_EL1 either, as only hardware watchpoints do so.
Split the BRK64 exception entry, adjust the function signature, and its behaviour to match the lack of needed mitigations.
Further, as the EL0 and EL1 code paths are cleanly separated, we can split do_brk64() into do_el0_brk64() and do_el1_brk64(), and call them directly from the relevant entry paths.
Use die() directly for the EL1 error path, as in do_el1_bti() and do_el1_undef().
We can also remove NOKRPOBE_SYMBOL for the EL0 path, as it cannot lead to a kprobe recursion.
When taking a BRK64 exception from EL0, the exception handling is safely preemptible : the only possible handler is uprobe_brk_handler(). It only operates on task-local data and properly checks its validity, then raises a Thread Information Flag, processed before returning to userspace in do_notify_resume(), which is already preemptible. Thus we can safely unmask interrupts and enable preemption before handling the break itself, fixing a PREEMPT_RT issue where the handler could call a sleeping function with preemption disabled.
Given that the break hook registration is handled statically in call_break_hook since
(arm64: debug: call software break handlers statically)
and that we now bypass the exception handler registration, this change renders early_brk64 redundant : its functionality is now handled through the post-init path.
This also removes the last usage of el1_dbg().
This also removes the last usage of el0_dbg() without CONFIG_COMPAT. Mark it __maybe_unused, to prevent a warning when building this patch without CONFIG_COMPAT, as the following patch removes el0_dbg().
--- arch/arm64/include/asm/exception.h | 2 ++ arch/arm64/kernel/debug-monitors.c | 46 ++++++++++++++---------------- arch/arm64/kernel/entry-common.c | 24 ++++++++++------ 3 files changed, 39 insertions(+), 33 deletions(-)
arch/arm64/include/asm/exception.h +2 -0
@@ -70,6 +70,8 @@ static inline void do_watchpoint(unsigned long addr, unsigned long esr,#endif /* CONFIG_HAVE_HW_BREAKPOINT */ void do_el0_softstep (unsigned long esr,struct pt_regs *regs);void do_el1_softstep (unsigned long esr,struct pt_regs *regs); +void do_el0_brk64 (unsigned long esr,struct pt_regs *regs); +void do_el1_brk64 (unsigned long esr,struct pt_regs *regs);void do_fpsimd_acc (unsigned long esr,struct pt_regs *regs);void do_sve_acc (unsigned long esr,struct pt_regs *regs);void do_sme_acc (unsigned long esr,struct pt_regs *regs);
arch/arm64/kernel/debug-monitors.c +21 -25
70 lines not on this page · raw message
arch/arm64/kernel/entry-common.c +16 -8
@@ -547,13 +547,12 @@ static void noinstr el1_watchpt(struct pt_regs *regs, unsigned long esr)arm64_exit_el1_dbg (regs); } -static void noinstr el1_dbg(struct pt_regs *regs, unsigned long esr) +static void noinstr el1_brk64(struct pt_regs *regs, unsigned long esr) { -unsigned long far =read_sysreg (far_el1); -arm64_enter_el1_dbg (regs); -if (!cortex_a76_erratum_1463225_debug_handler (regs)) -do_debug_exception (far, esr, regs); +debug_exception_enter (regs); +do_el1_brk64 (esr, regs); +debug_exception_exit (regs);arm64_exit_el1_dbg (regs); }
@@ -599,7 +598,7 @@ asmlinkage void noinstr el1h_64_sync_handler(struct pt_regs *regs)el1_watchpt (regs, esr);break ;case ESR_ELx_EC_BRK64: -el1_dbg (regs, esr); +el1_brk64 (regs, esr);break ;case ESR_ELx_EC_FPAC:el1_fpac (regs, esr);
@@ -827,7 +826,16 @@ static void noinstr el0_watchpt(struct pt_regs *regs, unsigned long esr)exit_to_user_mode (regs); } -static void noinstr el0_dbg(struct pt_regs *regs, unsigned long esr) +static void noinstr el0_brk64(struct pt_regs *regs, unsigned long esr) +{ +enter_from_user_mode (regs); +local_daif_restore (DAIF_PROCCTX ); +do_el0_brk64 (esr, regs); +exit_to_user_mode (regs); +} + +static void noinstr __maybe_unused +el0_dbg (struct pt_regs *regs,unsigned long esr) {/* Only watchpoints write FAR_EL1, otherwise its UNKNOWN */ unsigned long far =read_sysreg (far_el1);
@@ -912,7 +920,7 @@ asmlinkage void noinstr el0t_64_sync_handler(struct pt_regs *regs)el0_watchpt (regs, esr);break ;case ESR_ELx_EC_BRK64: -el0_dbg (regs, esr); +el0_brk64 (regs, esr);break ;case ESR_ELx_EC_FPAC:el0_fpac (regs, esr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 22/307 arm64: debug: split bkpt32 exception entry
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit fc5e5d0477c532054ce8692fd16fdaab2cb8946f ]
Currently all debug exceptions share common entry code and are routed to do_debug_exception(), which calls dynamically-registered handlers for each specific debug exception. This is unfortunate as different debug exceptions have different entry handling requirements, and it would be better to handle these distinct requirements earlier.
The BKPT32 exception can only be triggered by a BKPT instruction. Thus, we know that the PC is a legitimate address and isn't being used to train a branch predictor with a bogus address : we don't need to call arm64_apply_bp_hardening().
The handler for this exception only pends a signal and doesn't depend on any per-CPU state : we don't need to inhibit preemption, nor do we need to keep the DAIF exceptions masked, so we can unmask them earlier.
Split the BKPT32 exception entry and adjust function signatures and its behaviour to match its relaxed constraints compared to other debug exceptions.
We can also remove NOKRPOBE_SYMBOL, as this cannot lead to a kprobe recursion.
This replaces the last usage of el0_dbg(), so remove it.
--- arch/arm64/include/asm/exception.h | 1 + arch/arm64/kernel/debug-monitors.c | 7 +++++++ arch/arm64/kernel/entry-common.c | 22 +++++++++------------- 3 files changed, 17 insertions(+), 13 deletions(-)
arch/arm64/include/asm/exception.h +1 -0
@@ -72,6 +72,7 @@ void do_el0_softstep(unsigned long esr, struct pt_regs *regs);void do_el1_softstep (unsigned long esr,struct pt_regs *regs);void do_el0_brk64 (unsigned long esr,struct pt_regs *regs);void do_el1_brk64 (unsigned long esr,struct pt_regs *regs); +void do_bkpt32 (unsigned long esr,struct pt_regs *regs);void do_fpsimd_acc (unsigned long esr,struct pt_regs *regs);void do_sve_acc (unsigned long esr,struct pt_regs *regs);void do_sme_acc (unsigned long esr,struct pt_regs *regs);
arch/arm64/kernel/debug-monitors.c +7 -0
@@ -270,6 +270,13 @@ void do_el1_brk64(unsigned long esr, struct pt_regs *regs) }NOKPROBE_SYMBOL (do_el1_brk64); +#ifdef CONFIG_COMPAT +void do_bkpt32 (unsigned long esr,struct pt_regs *regs) +{ +arm64_notify_die ("aarch32 BKPT" , regs,SIGTRAP ,TRAP_BRKPT , regs->pc, esr); +} +#endif /* CONFIG_COMPAT */ +bool try_handle_aarch32_break (struct pt_regs *regs) {u32 arm_instr;
arch/arm64/kernel/entry-common.c +9 -13
@@ -834,18 +834,6 @@ static void noinstr el0_brk64(struct pt_regs *regs, unsigned long esr)exit_to_user_mode (regs); } -static void noinstr __maybe_unused -el0_dbg (struct pt_regs *regs,unsigned long esr) -{ -/* Only watchpoints write FAR_EL1, otherwise its UNKNOWN */ -unsigned long far =read_sysreg (far_el1); - -enter_from_user_mode (regs); -do_debug_exception (far, esr, regs); -local_daif_restore (DAIF_PROCCTX ); -exit_to_user_mode (regs); -} - static void noinstr el0_svc(struct pt_regs *regs) {enter_from_user_mode (regs);
@@ -1003,6 +991,14 @@ static void noinstr el0_svc_compat(struct pt_regs *regs)exit_to_user_mode (regs); } +static void noinstr el0_bkpt32(struct pt_regs *regs, unsigned long esr) +{ +enter_from_user_mode (regs); +local_daif_restore (DAIF_PROCCTX ); +do_bkpt32 (esr, regs); +exit_to_user_mode (regs); +} + asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs) {unsigned long esr =read_sysreg (esr_el1);
@@ -1046,7 +1042,7 @@ asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs)el0_watchpt (regs, esr);break ;case ESR_ELx_EC_BKPT32: -el0_dbg (regs, esr); +el0_bkpt32 (regs, esr);break ;default :el0_inv (regs, esr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 23/307 arm64: debug: remove debug exception registration infrastructure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit a8b8cce9d96d65dfe3d89abf02033151f8b7d670 ]
Now that debug exceptions are handled individually and without the need for dynamic registration, remove the unused registration infrastructure.
This removes the external caller for debug_exception_enter() and debug_exception_exit().
Make them static again and remove them from the header.
Remove early_brk64() as it has been made redundant by (arm64: debug: split brk64 exception entry) and is not used anymore. Note : in early_brk64() bug_brk_handler() is called unconditionally as a fall-through, but now call_break_hook() only calls it if the immediate matches.
This does not change the behaviour in early boot, as if bug_brk_handler() was called on a non-BUG immediate it would return DBG_HOOK_ERROR anyway, which call_break_hook() will do if no immediate matches.
Remove trap_init(), as it would be empty and a weak definition already exists in init/main.c.
--- arch/arm64/include/asm/debug-monitors.h | 2 - arch/arm64/include/asm/exception.h | 6 --- arch/arm64/include/asm/system_misc.h | 4 -- arch/arm64/kernel/debug-monitors.c | 3 -- arch/arm64/kernel/entry-common.c | 4 +- arch/arm64/kernel/traps.c | 27 ------------- arch/arm64/mm/fault.c | 53 ------------------------- 7 files changed, 2 insertions(+), 97 deletions(-)
arch/arm64/include/asm/debug-monitors.h +0 -2
@@ -93,7 +93,5 @@ static inline bool try_step_suspended_breakpoints(struct pt_regs *regs)bool try_handle_aarch32_break (struct pt_regs *regs); -void debug_traps_init (void ); -#endif /* __ASSEMBLY */ #endif /* __ASM_DEBUG_MONITORS_H */
arch/arm64/include/asm/exception.h +0 -6
@@ -57,8 +57,6 @@ void do_el0_undef(struct pt_regs *regs, unsigned long esr);void do_el1_undef (struct pt_regs *regs,unsigned long esr);void do_el0_bti (struct pt_regs *regs);void do_el1_bti (struct pt_regs *regs,unsigned long esr); -void do_debug_exception (unsigned long addr_if_watchpoint,unsigned long esr, -struct pt_regs *regs);#ifdef CONFIG_HAVE_HW_BREAKPOINT void do_breakpoint (unsigned long esr,struct pt_regs *regs); void do_watchpoint(unsigned long addr, unsigned long esr,
@@ -91,8 +89,4 @@ void do_serror(struct pt_regs *regs, unsigned long esr);void do_signal (struct pt_regs *regs);void __noreturn panic_bad_stack (struct pt_regs *regs,unsigned long esr,unsigned long far); - -void debug_exception_enter (struct pt_regs *regs); -void debug_exception_exit (struct pt_regs *regs); -#endif /* __ASM_EXCEPTION_H */
arch/arm64/include/asm/system_misc.h +0 -4
@@ -25,10 +25,6 @@ void arm64_notify_die(const char *str, struct pt_regs *regs, int signo, int sicode, unsigned long far, unsigned long err); -void hook_debug_fault_code (int nr,int (*fn)(unsigned long ,unsigned long , -struct pt_regs *), -int sig,int code,const char *name); -struct mm_struct ;extern void __show_regs (struct pt_regs *);
arch/arm64/kernel/debug-monitors.c +0 -3
@@ -316,9 +316,6 @@ bool try_handle_aarch32_break(struct pt_regs *regs) }NOKPROBE_SYMBOL (try_handle_aarch32_break); -void __init debug_traps_init (void ) -{} -/* Re-enable single step for syscall restarting. */ void user_rewind_single_step (struct task_struct *task) {
arch/arm64/kernel/entry-common.c +2 -2
@@ -448,7 +448,7 @@ static __always_inline void fpsimd_syscall_exit(void)* accidentally schedule in exception context and it will force a warning * if we somehow manage to schedule by accident. */ -void debug_exception_enter (struct pt_regs *regs) +static void debug_exception_enter (struct pt_regs *regs) {preempt_disable ();
@@ -457,7 +457,7 @@ void debug_exception_enter(struct pt_regs *regs) }NOKPROBE_SYMBOL (debug_exception_enter); -void debug_exception_exit (struct pt_regs *regs) +static void debug_exception_exit (struct pt_regs *regs) {preempt_enable_no_resched (); }
arch/arm64/kernel/traps.c +0 -27
@@ -1091,30 +1091,3 @@ int ubsan_brk_handler(struct pt_regs *regs, unsigned long esr) return DBG_HOOK_HANDLED; }#endif - -/* -* Initial handler for AArch64 BRK exceptions -* This handler only used until debug_traps_init(). -*/ -int __init early_brk64 (unsigned long addr,unsigned long esr, -struct pt_regs *regs) -{ -#ifdef CONFIG_CFI_CLANG -if (esr_is_cfi_brk (esr)) -return cfi_brk_handler (regs, esr) !=DBG_HOOK_HANDLED ; -#endif -#ifdef CONFIG_KASAN_SW_TAGS -if ((esr_brk_comment (esr) & ~KASAN_BRK_MASK ) ==KASAN_BRK_IMM ) -return kasan_brk_handler (regs, esr) !=DBG_HOOK_HANDLED ; -#endif -#ifdef CONFIG_UBSAN_TRAP -if (esr_is_ubsan_brk (esr)) -return ubsan_brk_handler (regs, esr) !=DBG_HOOK_HANDLED ; -#endif -return bug_brk_handler (regs, esr) !=DBG_HOOK_HANDLED ; -} - -void __init trap_init (void ) -{ -debug_traps_init (); -}
arch/arm64/mm/fault.c +0 -53
71 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 24/307 arm64: debug: always unmask interrupts in el0_softstp()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <[email protected]>
[ Upstream commit ea0d55ae4b3207c33691a73da3443b1fd379f1d2 ]
We intend that EL0 exception handlers unmask all DAIF exceptions before calling exit_to_user_mode().
When completing single-step of a suspended breakpoint, we do not call local_daif_restore(DAIF_PROCCTX) before calling exit_to_user_mode(), leaving all DAIF exceptions masked.
When pseudo-NMIs are not in use this is benign.
When pseudo-NMIs are in use, this is unsound. At this point interrupts are masked by both DAIF.IF and PMR_EL1, and subsequent irq flag manipulation may not work correctly. For example, a subsequent local_irq_enable() within exit_to_user_mode_loop() will only unmask interrupts via PMR_EL1 (leaving those masked via DAIF.IF), and anything depending on interrupts being unmasked (e.g. delivery of signals) will not work correctly.
This was detected by CONFIG_ARM64_DEBUG_PRIORITY_MASKING.
Move the call to try_step_suspended_breakpoints() outside of the check so that interrupts can be unmasked even if we don't call the step handler.
--- arch/arm64/kernel/entry-common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/arm64/kernel/entry-common.c +5 -3
@@ -796,6 +796,8 @@ static void noinstr el0_breakpt(struct pt_regs *regs, unsigned long esr) static void noinstr el0_softstp(struct pt_regs *regs, unsigned long esr) { +bool step_done; +if (!is_ttbr0_addr (regs->pc))arm64_apply_bp_hardening ();
@@ -806,10 +808,10 @@ static void noinstr el0_softstp(struct pt_regs *regs, unsigned long esr)* If we are stepping a suspended breakpoint there's nothing more to do: * the single-step is complete. */ -if (!try_step_suspended_breakpoints (regs)) { -local_daif_restore (DAIF_PROCCTX ); + step_done =try_step_suspended_breakpoints (regs); +local_daif_restore (DAIF_PROCCTX ); +if (!step_done)do_el0_softstep (esr, regs); - }exit_to_user_mode (regs); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 25/307 nfc: llcp: Fix use-after-free in llcp_sock_release()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
[ Upstream commit f4268b466190dae95a7585f69b4f1f8ad097632c ]
llcp_sock_release() unconditionally unlinks the socket from the local sockets list. However, if the socket is still in connecting state, it is on the connecting list.
Fix this by checking the socket state and unlinking from the correct list.
--- net/nfc/llcp_sock.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/llcp_sock.c +2 -0
@@ -633,6 +633,8 @@ static int llcp_sock_release(struct socket *sock)if (sock->type ==SOCK_RAW )nfc_llcp_sock_unlink (&local->raw_sockets, sk); +else if (sk->sk_state ==LLCP_CONNECTING ) +nfc_llcp_sock_unlink (&local->connecting_sockets, sk);else nfc_llcp_sock_unlink (&local->sockets, sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 26/307 nfc: llcp: Fix use-after-free race in nfc_llcp_recv_cc()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
[ Upstream commit b493ea2765cc17cb8aa7e7544a4b6dcb05b6ed77 ]
A race condition exists in the NFC LLCP connection state machine where the connection acceptance packet (CC) can be processed concurrently with socket release. This can lead to a use-after-free of the socket object.
When nfc_llcp_recv_cc() moves the socket from the connecting_sockets list to the sockets list, it does so without holding the socket lock. If llcp_sock_release() is executing concurrently, it might have already unlinked the socket and dropped its references, which can result in nfc_llcp_recv_cc() linking a freed socket into the live list.
Fix this by holding lock_sock() during the state transition and list movement in nfc_llcp_recv_cc(). After acquiring the lock, check if the socket is still hashed to ensure it hasn't already been unlinked and marked for destruction by the release path. This aligns the locking pattern with recv_hdlc() and recv_disc().
--- net/nfc/llcp_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/nfc/llcp_core.c +11 -0
@@ -1216,6 +1216,15 @@ static void nfc_llcp_recv_cc(struct nfc_llcp_local *local, sk = &llcp_sock->sk; +lock_sock (sk); + +/* Check if socket was destroyed whilst waiting for the lock */ +if (!sk_hashed (sk)) { +release_sock (sk); +nfc_llcp_sock_put (llcp_sock); +return ; + } +/* Unlink from connecting and link to the client array */ nfc_llcp_sock_unlink (&local->connecting_sockets, sk);nfc_llcp_sock_link (&local->sockets, sk);
@@ -1227,6 +1236,8 @@ static void nfc_llcp_recv_cc(struct nfc_llcp_local *local, sk->sk_state =LLCP_CONNECTED ; sk->sk_state_change (sk); +release_sock (sk); +nfc_llcp_sock_put (llcp_sock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 27/307 xfrm: Check for underflow in xfrm_state_mtu
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit 742b04d0550b0ec89dcbc99537ec88653bd1ad90 ]
Leo Lin reported OOB write issue in esp component:
xfrm_state_mtu() returns u32 but performs its arithmetic in unsigned modulo-2^32 space using an attacker-influenced "header_len + authsize + net_adj" subtracted from a small "mtu" argument. A nobody user can install an IPv4 ESP tunnel SA with a large authentication key (XFRMA_ALG_AUTH_TRUNC, e.g. hmac(sha512), 64-byte key, 64-byte trunc), configure a small interface MTU (68 bytes), and set XFRMA_TFCPAD to a large value. When a single UDP datagram is then sent through the tunnel, xfrm_state_mtu() underflows to a near-2^32 value, and esp_output() consumes it as a signed int via:
padto = min(x->tfcpad, xfrm_state_mtu(x, mtu_cached))
esp.tfclen = padto - skb->len (assigned to int) esp.tfclen ends up negative (e.g. -207). It is sign-extended to size_t when passed to memset() inside esp_output_fill_trailer(), producing a ~16 EB write of zeroes at skb_tail_pointer(skb). KASAN logs it as "Write of size 18446744073709551537 at addr ffff888...".
Check for underflow and return 1. This causes the sendmsg attempt to fail with ENETUNREACH.
--- net/xfrm/xfrm_state.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
net/xfrm/xfrm_state.c +16 -3
@@ -3022,10 +3022,14 @@ u32 xfrm_state_mtu(struct xfrm_state *x, int mtu)const struct xfrm_type *type =READ_ONCE (x->type);struct crypto_aead *aead;u32 blksize, net_adj =0 ; +u32 overhead, payload_mtu;if (x->km.state !=XFRM_STATE_VALID || - !type || type->proto !=IPPROTO_ESP ) + !type || type->proto !=IPPROTO_ESP ) { +if (mtu <= x->props.header_len) +return 1 ;return mtu - x->props.header_len; + } aead = x->data; blksize =ALIGN (crypto_aead_blocksize (aead),4 );
@@ -3045,8 +3049,17 @@ u32 xfrm_state_mtu(struct xfrm_state *x, int mtu)break ; } -return ((mtu - x->props.header_len -crypto_aead_authsize (aead) - - net_adj) & ~(blksize -1 )) + net_adj -2 ; + overhead = x->props.header_len +crypto_aead_authsize (aead) + net_adj; +if (mtu <= overhead) +return 1 ; + + payload_mtu = mtu - overhead; + payload_mtu &= ~(blksize -1 ); +if (payload_mtu <=2 ) +return 1 ; + +return payload_mtu + net_adj -2 ; + }EXPORT_SYMBOL_GPL (xfrm_state_mtu);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 28/307 nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carl Lee <[email protected]>
[ Upstream commit f23bf992d65a42007c517b060ca35cebdea3525a ]
Some ACPI-based platforms report incorrect IRQ trigger types (e.g. IRQF_TRIGGER_HIGH), which can lead to interrupt storms.
Use the historically working rising-edge trigger on ACPI systems to avoid this regression.
Device Tree-based systems continue to use the firmware-provided trigger type.
--- drivers/nfc/nxp-nci/i2c.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/nfc/nxp-nci/i2c.c +20 -1
@@ -16,6 +16,7 @@#include <linux/delay.h> #include <linux/i2c.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/module.h> #include <linux/nfc.h> #include <linux/gpio/consumer.h>
@@ -267,6 +268,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) {struct device *dev = &client->dev;struct nxp_nci_i2c_phy *phy; +unsigned long irqflags;int r;if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) {
@@ -303,9 +305,26 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)if (r <0 )return r; +/* +* ACPI platforms may report incorrect IRQ trigger types +* (e.g. level-high), which can lead to interrupt storms. +* +* Use the historically stable rising-edge trigger for ACPI devices. +* +* On non-ACPI systems (e.g. Device Tree), prefer the firmware- +* provided trigger type, falling back to rising-edge if not set. +*/ +if (ACPI_COMPANION (dev)) { + irqflags =IRQF_TRIGGER_RISING ; + }else { + irqflags =irq_get_trigger_type (client->irq); +if (!irqflags) + irqflags =IRQF_TRIGGER_RISING ; + } + r =request_threaded_irq (client->irq,NULL , nxp_nci_i2c_irq_thread_fn, -IRQF_ONESHOT , + irqflags |IRQF_ONESHOT ,NXP_NCI_I2C_DRIVER_NAME , phy);if (r <0 )nfc_err (&client->dev,"Unable to register IRQ handler\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 29/307 kunit: fix use-after-free in debugfs when using kunit.filter
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Schmaus <[email protected]>
[ Upstream commit fb6988b83b4cafe8db63999c1ddff1b7c66d2ff5 ]
When the kernel is booted with a kunit filter (e.g., kunit.filter="speed!=slow"), the kunit executor dynamically allocates copies of the filtered test suites using kmalloc/kmemdup.
During the initial boot execution, kunit_debugfs_create_suite() creates debugfs files (such as /sys/kernel/debug/kunit/<suite>/run) and permanently stores a pointer to the dynamically allocated suite in the inode's i_private field.
Previously, the executor freed this dynamically allocated suite_set immediately after executing the boot-time tests. Because the debugfs nodes were not destroyed, any subsequent interaction with the debugfs run file from userspace triggered a use-after-free (UAF). On systems with architectural capabilities, like CHERI RISC-V, this resulted in an immediate fatal hardware exception due to the invalidation of the capability tags on the reclaimed memory. On other architectures, it resulted in silent memory corruption.
Fix this UAF by properly coupling the lifetime of the filtered suite memory allocation to the lifetime of the kunit subsystem and its associated VFS nodes. Ownership of the boot-time suite_set is now transferred to a global tracker ('kunit_boot_suites'), and the memory is cleanly released in kunit_exit() during module teardown.
--- include/kunit/test.h | 1 + lib/kunit/executor.c | 19 ++++++++++++++++--- lib/kunit/test.c | 1 + 3 files changed, 18 insertions(+), 3 deletions(-)
include/kunit/test.h +1 -0
@@ -547,6 +547,7 @@ unsigned long kunit_vm_mmap(struct kunit *test, struct file *file, unsigned long offset);void kunit_cleanup (struct kunit *test); +void kunit_free_boot_suites (void ); void __printf(2, 3) kunit_log_append(struct string_stream *log, const char *fmt, ...);
lib/kunit/executor.c +16 -3
@@ -15,6 +15,16 @@ extern struct kunit_suite * const __kunit_suites_end[];extern struct kunit_suite *const __kunit_init_suites_start[];extern struct kunit_suite *const __kunit_init_suites_end[]; +static struct kunit_suite_set kunit_boot_suites; + +void kunit_free_boot_suites (void ) +{ +if (kunit_boot_suites.start) { +kunit_free_suite_set (kunit_boot_suites); + kunit_boot_suites = (struct kunit_suite_set ){NULL ,NULL }; + } +} +static char *action_param;module_param_named (action, action_param, charp,0400 );
@@ -392,9 +402,12 @@ int kunit_run_all_tests(void)pr_err ("kunit executor: unknown action '%s'\n" , action_param); free_out: -if (filter_glob_param || filter_param) -kunit_free_suite_set (suite_set); -else if (init_num_suites >0 ) +if (filter_glob_param || filter_param) { +if (err) +kunit_free_suite_set (suite_set); +else + kunit_boot_suites = suite_set; + }else if (init_num_suites >0 )/* Don't use kunit_free_suite_set because suites aren't individually allocated */ kfree (suite_set.start);
lib/kunit/test.c +1 -0
@@ -954,6 +954,7 @@ static void __exit kunit_exit(void)kunit_bus_shutdown ();kunit_debugfs_cleanup (); +kunit_free_boot_suites (); }module_exit (kunit_exit);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 30/307 kernel/fork: validate exit_signal in kernel_clone()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit 09e7827e785729f391c8d46dc71becce70d296ab ]
When a child process exits, it sends exit_signal to its parent via do_notify_parent(). The clone() syscall constructs exit_signal as:
(lower_32_bits(clone_flags) & CSIGNAL)
CSIGNAL is 0xff, so values in the range 65-255 are possible. However, valid_signal() only accepts signals up to _NSIG (64 on x86_64). A non-zero non-valid exit_signal acts the same as exit_signal == 0: the parent process is not signaled when the child terminates.
The syzkaller reproducer triggers this by calling clone() with flags=0x80, resulting in exit_signal = (0x80 & CSIGNAL) = 128, which exceeds _NSIG and is not a valid signal.
The v1 of this patch added the check only in the clone() syscall handler, which is incomplete. kernel_clone() has other callers such as sys_ia32_clone() which would remain unprotected. Move the check to kernel_clone() to cover all callers.
Since the valid_signal() check is now in kernel_clone() and covers all callers including clone3(), the same check in copy_clone_args_from_user() becomes redundant and is removed. The higher 32bits check for clone3() is kept as it is clone3() specific.
Note that this is a user-visible change: previously, passing an invalid exit_signal to clone() was silently accepted. The man page for clone() does not document any defined behavior for invalid exit_signal values, so rejecting them with -EINVAL is the correct behavior. It is unlikely that any sane application relies on passing an invalid exit_signal.
--- kernel/fork.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
kernel/fork.c +5 -6
@@ -2773,8 +2773,6 @@ struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)* * It copies the process, and if successful kick-starts * it and waits for it to finish using the VM if required. -* -* args->exit_signal is expected to be checked for sanity by the caller. */ pid_t kernel_clone (struct kernel_clone_args *args) {
@@ -2799,6 +2797,9 @@ pid_t kernel_clone(struct kernel_clone_args *args) (args->pidfd == args->parent_tid))return -EINVAL ; +if (!valid_signal (args->exit_signal)) +return -EINVAL ; +/* * Determine whether and which event to report to ptracer. When * called from kernel_thread or CLONE_UNTRACED is explicitly
@@ -2999,11 +3000,9 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,return -EINVAL ;/* -* Verify that higher 32bits of exit_signal are unset and that -* it is a valid signal +* Verify that higher 32bits of exit_signal are unset */ -if (unlikely ((args.exit_signal & ~((u64 )CSIGNAL )) || - !valid_signal (args.exit_signal))) +if (unlikely (args.exit_signal & ~((u64 )CSIGNAL )))return -EINVAL ; if ((args.flags & CLONE_INTO_CGROUP) &&
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 31/307 netfilter: synproxy: refresh tcphdr after skb_ensure_writable
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
[ Upstream commit 92170e6afe927ab2792a3f71902845789c8e31b1 ]
synproxy_tstamp_adjust() rewrites the TCP timestamp option in place and then patches the TCP checksum via inet_proto_csum_replace4() on the caller-supplied tcphdr pointer. Both ipv4_synproxy_hook() and ipv6_synproxy_hook() obtain that pointer with skb_header_pointer() before calling in, so it may either alias skb->head directly or point at the caller's on-stack _tcph buffer.
Between obtaining the pointer and using it, the function calls skb_ensure_writable(skb, optend), which on a cloned or non-linear skb invokes pskb_expand_head() and frees the old skb->head. After that point the cached th is stale:
caller (ipv[46]_synproxy_hook)
th = skb_header_pointer(skb, ..., &_tcph)
synproxy_tstamp_adjust(skb, protoff, th, ...)
skb_ensure_writable(skb, optend)
pskb_expand_head() /* kfree(old skb->head) */
...
inet_proto_csum_replace4(&th->check, ...)
/* writes into freed head, or
into the caller's stack copy
leaving the on-wire checksum
stale */The option bytes are written through skb->data and are fine; only the checksum update goes through th and so lands in the wrong place. The result is either a write into freed slab memory or a packet leaving with a checksum that does not match its payload.
Fix by re-deriving th from skb->data + protoff immediately after skb_ensure_writable() succeeds, so the subsequent checksum update targets the linear, writable header.
--- net/netfilter/nf_synproxy_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nf_synproxy_core.c +2 -0
@@ -199,6 +199,8 @@ synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,if (skb_ensure_writable (skb, optend))return 0 ; + th = (struct tcphdr *)(skb->data + protoff); +while (optoff < optend) {unsigned char *op = skb->data + optoff;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 32/307 netfilter: xt_cpu: prefer raw_smp_processor_id
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit c376f07e16c02239ed44cabb97145d03f65b4d15 ]
With PREEMPT_RCU we get splat:
BUG: using smp_processor_id() in preemptible [..] caller is cpu_mt+0x53/0xd0 net/netfilter/xt_cpu.c:37 CPU: 1 .. Comm: syz.3.1377 #0 PREEMPT(full) Call Trace: <TASK> dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 check_preemption_disabled+0xd3/0xe0 lib/smp_processor_id.c:47 cpu_mt+0x53/0xd0 net/netfilter/xt_cpu.c:37 [..]
Just use raw version instead.
This is similar to 14d14a5d2957 ("netfilter: nft_meta: use raw_smp_processor_id()").
--- net/netfilter/xt_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_cpu.c +1 -1
@@ -34,7 +34,7 @@ static bool cpu_mt(const struct sk_buff *skb, struct xt_action_param *par) {const struct xt_cpu_info *info = par->matchinfo; -return (info->cpu ==smp_processor_id ()) ^ info->invert; +return (info->cpu ==raw_smp_processor_id ()) ^ info->invert; }static struct xt_match cpu_mt_reg__read_mostly = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 33/307 netfilter: ebtables: fix OOB read in compat_mtw_from_user
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit f438d1786d657d57790c5d138d6db3fc9fdac392 ]
Luxiao Xu says:
The function compat_mtw_from_user() converts ebtables extensions from 32-bit user structures to kernel native structures. However, it lacks proper validation of the user-supplied match_size/target_size.
When certain extensions are processed, the kernel-side translation logic may perform memory accesses based on the extension's expected size. If the user provides a size smaller than what the extension requires, it results in an out-of-bounds read as reported by KASAN.
This fix introduces a check to ensure match_size is at least as large as the extension's required compatsize. This covers matches, watchers, and targets, while maintaining compatibility with standard targets.
AFAIU this is relevant for matches that need to go though match->compat_from_user() call. Those that use plain memcpy with the user-provided size are ok because the caller checks that size vs the start of the next rule entry offset (which itself is checked vs. total size copied from userspace).
The ->compat_from_user() callbacks assume they can read compatsize bytes, so they need this extra check.
Based on an earlier patch from Luxiao Xu.
--- net/bridge/netfilter/ebtables.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
net/bridge/netfilter/ebtables.c +30 -0
@@ -1952,6 +1952,25 @@ enum compat_mwt { EBT_COMPAT_TARGET, }; +static bool match_size_ok (const struct xt_match *match,unsigned int match_size) +{ +u16 csize; + +if (match->matchsize ==-1 )/* cannot validate ebt_among */ +return true; + + csize = match->compatsize ? : match->matchsize; + +return match_size >= csize; +} + +static bool tgt_size_ok (const struct xt_target *tgt,unsigned int tgt_size) +{ +u16 csize = tgt->compatsize ? : tgt->targetsize; + +return tgt_size >= csize; +} + static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt, enum compat_mwt compat_mwt, struct ebt_entries_buf_state *state,
@@ -1977,6 +1996,11 @@ static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt,if (IS_ERR (match))return PTR_ERR (match); +if (!match_size_ok (match, match_size)) { +module_put (match->me); +return -EINVAL ; + } + off =ebt_compat_match_offset (match, match_size);if (dst) {if (match->compat_from_user)
@@ -1996,6 +2020,12 @@ static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt, mwt->u.revision);if (IS_ERR (wt))return PTR_ERR (wt); + +if (!tgt_size_ok (wt, match_size)) { +module_put (wt->me); +return -EINVAL ; + } + off =xt_compat_target_offset (wt);if (dst) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 34/307 tun: free page on short-frame rejection in tun_xdp_one()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit f4feb1e20058e407cb00f45aff47f5b7e19a6bbf ]
tun_xdp_one() returns -EINVAL on a frame shorter than ETH_HLEN without freeing the page that vhost_net_build_xdp() allocated for it. tun_sendmsg() discards that -EINVAL and still returns total_len, so vhost_tx_batch() takes the success path and never frees the page; each short frame in a batch leaks one page-frag chunk.
A local process that can open /dev/net/tun and /dev/vhost-net can hit this path: it attaches a tun/tap device as the vhost-net backend and feeds TX descriptors whose length minus the virtio-net header is below ETH_HLEN. Each kick leaks the page-frag chunks for that batch, and a tight submission loop exhausts host memory and triggers an OOM panic. Free the page before returning -EINVAL, matching the XDP-program error path in the same function.
--- drivers/net/tun.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/tun.c +3 -1
@@ -2459,8 +2459,10 @@ static int tun_xdp_one(struct tun_struct *tun,bool skb_xdp = false;struct page *page; -if (unlikely (datasize <ETH_HLEN )) +if (unlikely (datasize <ETH_HLEN )) { +put_page (virt_to_head_page (xdp->data));return -EINVAL ; + } xdp_prog =rcu_dereference (tun->xdp_prog);if (xdp_prog) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 35/307 tun: free page on build_skb failure in tun_xdp_one()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit aa8963fdce667a42fb7f0bdd2909fadcab02f9a8 ]
When build_skb() fails in tun_xdp_one(), the function sets ret to -ENOMEM and jumps to the out label, which returns without freeing the page that vhost_net_build_xdp() allocated for the frame. As with the short-frame rejection path, tun_sendmsg() discards the per-buffer error and still returns total_len, so vhost_tx_batch() takes the success path and never frees the page. Each build_skb() failure in a batch leaks one page-frag chunk.
Free the page before taking the error path, matching the put_page() the other error exits of tun_xdp_one() already perform.
--- drivers/net/tun.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/tun.c +1 -0
@@ -2505,6 +2505,7 @@ static int tun_xdp_one(struct tun_struct *tun, build: skb =build_skb (xdp->data_hard_start, buflen);if (!skb) { +put_page (virt_to_head_page (xdp->data)); ret = -ENOMEM ; goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 36/307 vsock: keep poll shutdown state consistent
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziyu Zhang <[email protected]>
[ Upstream commit aae9d8a5528b8ee9ff8dc5d3558b8a9f852a724a ]
vsock_poll() reads vsk->peer_shutdown before taking the socket lock to set EPOLLHUP and EPOLLRDHUP, then reads it again after taking the lock to report EOF readability. A shutdown packet can update peer_shutdown while poll is waiting for the lock, so one poll invocation can report EOF readability without the corresponding HUP/RDHUP bits.
For connectible sockets, take one peer_shutdown snapshot after lock_sock() and use it for all peer-shutdown-derived poll bits. For datagram sockets, which do not take lock_sock() in poll(), take one lockless READ_ONCE() snapshot and pair it with WRITE_ONCE() on the writer side.
This keeps the peer-shutdown-derived bits internally consistent for each poll pass.
--- net/vmw_vsock/af_vsock.c | 49 ++++++++++++++++--------- net/vmw_vsock/hyperv_transport.c | 9 +++-- net/vmw_vsock/virtio_transport_common.c | 14 ++++--- net/vmw_vsock/vmci_transport.c | 8 ++-- 4 files changed, 52 insertions(+), 28 deletions(-)
net/vmw_vsock/af_vsock.c +32 -17
@@ -523,7 +523,7 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)*/ sock_reset_flag (sk,SOCK_DONE ); sk->sk_state =TCP_CLOSE ; - vsk->peer_shutdown =0 ; +WRITE_ONCE (vsk->peer_shutdown,0 ); }if (sk->sk_type ==SOCK_SEQPACKET ) {
@@ -814,7 +814,7 @@ static struct sock *__vsock_create(struct net *net, vsk->rejected = false; vsk->sent_request = false; vsk->ignore_connecting_rst = false; - vsk->peer_shutdown =0 ; +WRITE_ONCE (vsk->peer_shutdown,0 );INIT_DELAYED_WORK (&vsk->connect_work, vsock_connect_timeout);INIT_DELAYED_WORK (&vsk->pending_work, vsock_pending_work);
@@ -1099,6 +1099,25 @@ static int vsock_shutdown(struct socket *sock, int mode)return err; } +static __poll_t vsock_poll_shutdown (struct sock *sk,u32 peer_shutdown) +{ +__poll_t mask =0 ; + +/* INET sockets treat local write shutdown and peer write shutdown as a +* case of EPOLLHUP set. +*/ +if (sk->sk_shutdown ==SHUTDOWN_MASK || + ((sk->sk_shutdown &SEND_SHUTDOWN ) && + (peer_shutdown &SEND_SHUTDOWN ))) + mask |=EPOLLHUP ; + +if (sk->sk_shutdown &RCV_SHUTDOWN || + peer_shutdown &SEND_SHUTDOWN ) + mask |=EPOLLRDHUP ; + +return mask; +} +static __poll_t vsock_poll (struct file *file,struct socket *sock,poll_table *wait) {
@@ -1116,24 +1135,17 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock,/* Signify that there has been an error on this socket. */ mask |=EPOLLERR ; -/* INET sockets treat local write shutdown and peer write shutdown as a -* case of EPOLLHUP set. -*/ -if ((sk->sk_shutdown ==SHUTDOWN_MASK ) || - ((sk->sk_shutdown &SEND_SHUTDOWN ) && - (vsk->peer_shutdown &SEND_SHUTDOWN ))) { - mask |=EPOLLHUP ; - } - -if (sk->sk_shutdown &RCV_SHUTDOWN || - vsk->peer_shutdown &SEND_SHUTDOWN ) { - mask |=EPOLLRDHUP ; - } -if (sk_is_readable (sk)) mask |=EPOLLIN |EPOLLRDNORM ;if (sock->type ==SOCK_DGRAM ) { +u32 peer_shutdown =READ_ONCE (vsk->peer_shutdown); + +/* DGRAM sockets do not take lock_sock() in poll(), so use one +* lockless snapshot for all shutdown-derived mask bits. +*/ + mask |=vsock_poll_shutdown (sk, peer_shutdown); +/* For datagram sockets we can read if there is something in * the queue and write as long as the socket isn't shutdown for * sending.
@@ -1148,6 +1160,7 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock, }else if (sock_type_connectible (sk->sk_type)) {const struct vsock_transport *transport; +u32 peer_shutdown;lock_sock (sk);
@@ -1180,8 +1193,10 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock,* terminated should also be considered read, and we check the * shutdown flag for that. */ + peer_shutdown =READ_ONCE (vsk->peer_shutdown); + mask |=vsock_poll_shutdown (sk, peer_shutdown);if (sk->sk_shutdown &RCV_SHUTDOWN || - vsk->peer_shutdown &SEND_SHUTDOWN ) { + peer_shutdown &SEND_SHUTDOWN ) { mask |=EPOLLIN |EPOLLRDNORM ; }
net/vmw_vsock/hyperv_transport.c +6 -3
@@ -264,7 +264,7 @@ static void hvs_do_close_lock_held(struct vsock_sock *vsk,struct sock *sk =sk_vsock (vsk);sock_set_flag (sk,SOCK_DONE ); - vsk->peer_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (vsk->peer_shutdown,SHUTDOWN_MASK );if (vsock_stream_has_data (vsk) <=0 ) sk->sk_state =TCP_CLOSING ; sk->sk_state_change (sk);
@@ -593,7 +593,9 @@ static int hvs_update_recv_data(struct hvsock *hvs)return -EIO ;if (payload_len ==0 ) - hvs->vsk->peer_shutdown |=SEND_SHUTDOWN ; +WRITE_ONCE (hvs->vsk->peer_shutdown, +READ_ONCE (hvs->vsk->peer_shutdown) | +SEND_SHUTDOWN ); hvs->recv_data_len = payload_len; hvs->recv_data_off =0 ;
@@ -704,7 +706,8 @@ static s64 hvs_stream_has_data(struct vsock_sock *vsk) ret =1 ;break ;case 0 : - vsk->peer_shutdown |=SEND_SHUTDOWN ; +WRITE_ONCE (vsk->peer_shutdown, +READ_ONCE (vsk->peer_shutdown) |SEND_SHUTDOWN ); ret =0 ;break ;default :/* -1 */
net/vmw_vsock/virtio_transport_common.c +9 -5
@@ -1234,7 +1234,7 @@ static void virtio_transport_do_close(struct vsock_sock *vsk,struct sock *sk =sk_vsock (vsk);sock_set_flag (sk,SOCK_DONE ); - vsk->peer_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (vsk->peer_shutdown,SHUTDOWN_MASK );if (vsock_stream_has_data (vsk) <=0 ) sk->sk_state =TCP_CLOSING ; sk->sk_state_change (sk);
@@ -1437,12 +1437,15 @@ virtio_transport_recv_connected(struct sock *sk,case VIRTIO_VSOCK_OP_CREDIT_UPDATE : sk->sk_write_space (sk);break ; -case VIRTIO_VSOCK_OP_SHUTDOWN : +case VIRTIO_VSOCK_OP_SHUTDOWN : { +u32 peer_shutdown =READ_ONCE (vsk->peer_shutdown); +if (le32_to_cpu (hdr->flags) &VIRTIO_VSOCK_SHUTDOWN_RCV ) - vsk->peer_shutdown |=RCV_SHUTDOWN ; + peer_shutdown |=RCV_SHUTDOWN ;if (le32_to_cpu (hdr->flags) &VIRTIO_VSOCK_SHUTDOWN_SEND ) - vsk->peer_shutdown |=SEND_SHUTDOWN ; -if (vsk->peer_shutdown ==SHUTDOWN_MASK ) { + peer_shutdown |=SEND_SHUTDOWN ; +WRITE_ONCE (vsk->peer_shutdown, peer_shutdown); +if (peer_shutdown ==SHUTDOWN_MASK ) {if (vsock_stream_has_data (vsk) <=0 && !sock_flag (sk,SOCK_DONE )) { (void )virtio_transport_reset (vsk,NULL );virtio_transport_do_close (vsk, true);
@@ -1457,6 +1460,7 @@ virtio_transport_recv_connected(struct sock *sk,if (le32_to_cpu (virtio_vsock_hdr (skb)->flags)) sk->sk_state_change (sk);break ; + }case VIRTIO_VSOCK_OP_RST :virtio_transport_do_close (vsk, true);break ;
net/vmw_vsock/vmci_transport.c +5 -3
@@ -811,7 +811,7 @@ static void vmci_transport_handle_detach(struct sock *sk)/* On a detach the peer will not be sending or receiving * anymore. */ - vsk->peer_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (vsk->peer_shutdown,SHUTDOWN_MASK );/* We should not be sending anymore since the peer won't be * there to receive, but we can still receive if there is data
@@ -1534,7 +1534,9 @@ static int vmci_transport_recv_connected(struct sock *sk,if (pkt->u.mode) { vsk =vsock_sk (sk); - vsk->peer_shutdown |= pkt->u.mode; +WRITE_ONCE (vsk->peer_shutdown, +READ_ONCE (vsk->peer_shutdown) | + pkt->u.mode); sk->sk_state_change (sk); }break ;
@@ -1551,7 +1553,7 @@ static int vmci_transport_recv_connected(struct sock *sk,* a clean shutdown. */ sock_set_flag (sk,SOCK_DONE ); - vsk->peer_shutdown =SHUTDOWN_MASK ; +WRITE_ONCE (vsk->peer_shutdown,SHUTDOWN_MASK );if (vsock_stream_has_data (vsk) <=0 ) sk->sk_state =TCP_CLOSING ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 37/307 net: netlink: fix sending unassigned nsid after assigned one
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 70f8592ee90585272018a725054b6eb2ab7e99ca ]
If the current skb is not shared, it is re-used directly for all the sockets subscribed to the notification. If we have remote all-nsid socket receiving a message first, then the 'nsid_is_set' will be set to 'true'. If the nsid is NOT_ASSIGNED for the next socket in the list, the 'nsid_is_set' will remain 'true' and the negative value is be delivered to the user space. All subsequent nsid values will be delivered as well, since there is no code path that sets the flag back to 'false'.
Fix that by always dropping the flag to 'false' first.
--- net/netlink/af_netlink.c | 1 + 1 file changed, 1 insertion(+)
net/netlink/af_netlink.c +1 -0
@@ -1477,6 +1477,7 @@ static void do_one_broadcast(struct sock *sk, p->skb2 =NULL ; goto out; } +NETLINK_CB (p->skb2).nsid_is_set = false;NETLINK_CB (p->skb2).nsid =peernet2id (sock_net (sk), p->net);if (NETLINK_CB (p->skb2).nsid !=NETNSA_NSID_NOT_ASSIGNED )NETLINK_CB (p->skb2).nsid_is_set = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 38/307 net: netlink: dont set nsid on local notifications
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 88b126b39f9757e9debc322d4679239e9af089c7 ]
In most cases, notifications on sockets with NETLINK_LISTEN_ALL_NSID do not contain NSID in their ancillary data in case the event is local to the listener.
However, when a self-referential NSID is allocated for a namespace, every local notification starts sending this ID to the user space.
This is problematic, because the listener cannot tell if those notifications are local or not anymore without making extra requests to figure out if the provided NSID is local or not. The listener can also not figure out the local NSID beforehand as it can be allocated at any point in time by other processes, changing the structure of the future notifications for everyone.
The value is practically not useful, since it's the namespace's own ID that the application has to obtain from other sources in order to figure out if it's the same or not. So, for the application it's just an extra busy work with no benefits. Moreover, applications that do not know about this quirk may be mishandling notifications with NSID set as notifications from remote namespaces. This is the case for ovs-vswitchd and the iproute2's 'ip monitor' that stops printing 'current' and starts printing the nsid number mid-session.
Lack of clear documentation for this behavior is also not helping.
A search though open-source projects doesn't reveal any projects that use NETNSA_NSID_NOT_ASSIGNED and rely on metadata to contain self-referential NSIDs (expected, since the value is not useful). Quite the opposite, as already mentioned, there are few applications that rely on NSID to not be present in local events.
Since the value is not useful and actively harmful in some cases, let's not report it for local events, making the notifications more consistent.
Also adding some blank lines for readability.
--- net/netlink/af_netlink.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/netlink/af_netlink.c +7 -3
@@ -1477,10 +1477,14 @@ static void do_one_broadcast(struct sock *sk, p->skb2 =NULL ; goto out; } +NETLINK_CB (p->skb2).nsid_is_set = false; -NETLINK_CB (p->skb2).nsid =peernet2id (sock_net (sk), p->net); -if (NETLINK_CB (p->skb2).nsid !=NETNSA_NSID_NOT_ASSIGNED ) -NETLINK_CB (p->skb2).nsid_is_set = true; +if (!net_eq (sock_net (sk), p->net)) { +NETLINK_CB (p->skb2).nsid =peernet2id (sock_net (sk), p->net); +if (NETLINK_CB (p->skb2).nsid !=NETNSA_NSID_NOT_ASSIGNED ) +NETLINK_CB (p->skb2).nsid_is_set = true; + } + val =netlink_broadcast_deliver (sk, p->skb2);if (val <0 ) {netlink_overrun (sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 39/307 net/smc: Do not re-initialize smc hashtables
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandra Winter <[email protected]>
[ Upstream commit 9e4389b0038781f19f97895186ed941ff8ac1678 ]
INIT_HLIST_HEAD(&smc_v*_hashinfo.ht) are called after smc_nl_init(), proto_register() and sock_register(). This can lead to smc_v*_hashinfo.ht being reset even though hash entries already exist and are being used, possibly resulting in a corrupted list.
Remove unnecessary and dangerous re-initialisation of smc_v*_hashinfo.ht in smc_init(); it is implicitly initialised to zero anyhow. Add HLIST_HEAD_INIT to the definitions for clarity.
--- net/smc/af_smc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/smc/af_smc.c +2 -2
@@ -187,10 +187,12 @@ static bool smc_hs_congested(const struct sock *sk)struct smc_hashinfo smc_v4_hashinfo = { .lock =__RW_LOCK_UNLOCKED (smc_v4_hashinfo.lock), + .ht =HLIST_HEAD_INIT , };struct smc_hashinfo smc_v6_hashinfo = { .lock =__RW_LOCK_UNLOCKED (smc_v6_hashinfo.lock), + .ht =HLIST_HEAD_INIT , };int smc_hash_sk (struct sock *sk)
@@ -3594,8 +3596,6 @@ static int __init smc_init(void)pr_err ("%s: sock_register fails with %d\n" , __func__, rc); goto out_proto6; } -INIT_HLIST_HEAD (&smc_v4_hashinfo.ht); -INIT_HLIST_HEAD (&smc_v6_hashinfo.ht); rc =smc_ib_register_client ();if (rc) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/307 net/iucv: fix locking in .getsockopt
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 3589d20a666caf30ad100c960a2de7de390fce88 ]
Mirror iucv_sock_setsockopt() and wrap the whole switch in lock_sock()/release_sock(). The pre-existing SO_MSGLIMIT-only lock becomes redundant and is removed.
Any AF_IUCV HIPER user can potentially crash the kernel by racing recvmsg() with getsockopt(SO_MSGSIZE): the SO_MSGSIZE arm dereferences iucv->hs_dev->mtu after iucv_sock_close() (called from the racing recvmsg()) has set hs_dev to NULL, producing a NULL pointer dereference oops.
--- net/iucv/af_iucv.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
net/iucv/af_iucv.c +14 -6
@@ -1537,7 +1537,7 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname,struct sock *sk = sock->sk;struct iucv_sock *iucv =iucv_sk (sk);unsigned int val; -int len; +int len, rc;if (level !=SOL_IUCV )return -ENOPROTOOPT ;
@@ -1550,26 +1550,34 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname, len = min_t(unsigned int, len, sizeof(int)); + rc =0 ; + +lock_sock (sk);switch (optname) {case SO_IPRMDATA_MSG : val = (iucv->flags &IUCV_IPRMDATA ) ?1 :0 ;break ;case SO_MSGLIMIT : -lock_sock (sk); val = (iucv->path !=NULL ) ? iucv->path->msglim/* connected */ : iucv->msglimit;/* default */ -release_sock (sk);break ;case SO_MSGSIZE : -if (sk->sk_state ==IUCV_OPEN ) -return -EBADFD ; +if (sk->sk_state ==IUCV_OPEN ) { + rc = -EBADFD ; +break ; + } val = (iucv->hs_dev) ? iucv->hs_dev->mtu -sizeof (struct af_iucv_trans_hdr ) -ETH_HLEN :0x7fffffff ;break ;default : -return -ENOPROTOOPT ; + rc = -ENOPROTOOPT ; +break ; } +release_sock (sk); + +if (rc) +return rc;if (put_user (len, optlen))return -EFAULT ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 41/307 scsi: core: Run queues for all non-SDEV_DEL devices from scsi_run_host_queues
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Jeffery <[email protected]>
[ Upstream commit 7205b58702273baf21d6ba7992e6ba15852325f7 ]
While a SCSI host is in a recovery state, scsi_mq_requeue_cmd() will not set the requeue list for a requeued command to be kicked in the future. The expectation is a call to scsi_run_host_queues() will kick all SCSI devices once the recovery state is cleared.
However, scsi_run_host_queues() uses shost_for_each_device() which uses scsi_device_get() and so will ignore devices in a partially removed state like SDEV_CANCEL. But these devices may also have requeued requests, leaving their requests stuck from not being kicked and causing the removal process of the device to hang.
scsi_run_host_queues() needs to run against more devices than the macro shost_for_each_device() allows. Instead of using the too limiting scsi_device_get() state checks, only ignore devices in SDEV_DEL state or when unable to acquire a reference. Attempt to run the queues for all other devices when scsi_run_host_queues() is called.
--- drivers/scsi/scsi_lib.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/scsi/scsi_lib.c +25 -2
@@ -569,10 +569,33 @@ void scsi_requeue_run_queue(struct work_struct *work)void scsi_run_host_queues (struct Scsi_Host *shost) { -struct scsi_device *sdev; +struct scsi_device *sdev, *prev =NULL ; +unsigned long flags; -shost_for_each_device (sdev, shost) +spin_lock_irqsave (shost->host_lock, flags); +__shost_for_each_device (sdev, shost) { +/* +* Only skip devices so deep into removal they will never need +* another kick to their queues. Thus scsi_device_get() cannot +* be used as it would skip devices in SDEV_CANCEL state which +* may need a queue kick. +*/ +if (sdev->sdev_state ==SDEV_DEL || + !get_device (&sdev->sdev_gendev)) +continue ; +spin_unlock_irqrestore (shost->host_lock, flags); + +if (prev) +put_device (&prev->sdev_gendev);scsi_run_queue (sdev->request_queue); + + prev = sdev; + +spin_lock_irqsave (shost->host_lock, flags); + } +spin_unlock_irqrestore (shost->host_lock, flags); +if (prev) +put_device (&prev->sdev_gendev); }static void scsi_uninit_cmd (struct scsi_cmnd *cmd)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 42/307 ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 87a1e0fe7776da7ab411be332b4be58ac8840d10 ]
ipv4_sysctl_exit_net() is currently freeing net->ipv4.sysctl_local_reserved_ports too soon.
Only after unregister_net_sysctl_table() we can be sure no threads can possibly use the sysctls, including /proc/sys/net/ipv4/ip_local_reserved_ports.
--- net/ipv4/sysctl_net_ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/sysctl_net_ipv4.c +1 -1
@@ -1630,10 +1630,10 @@ static __net_exit void ipv4_sysctl_exit_net(struct net *net) {const struct ctl_table *table; -kfree (net->ipv4.sysctl_local_reserved_ports); table = net->ipv4.ipv4_hdr->ctl_table_arg;unregister_net_sysctl_table (net->ipv4.ipv4_hdr);kfree (table); +kfree (net->ipv4.sysctl_local_reserved_ports); }static __net_initdata struct pernet_operations ipv4_sysctl_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 43/307 ALSA: pcm: oss: Fix setup list UAF on proc write error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 4cc54bdd54b337e77115be5b55577d1c58608eae ]
snd_pcm_oss_proc_write() links a newly allocated setup entry into the OSS setup list before duplicating the task name. If the task-name allocation fails, the error path frees the already linked entry and leaves setup_list pointing at freed memory.
A later OSS device open can then walk the stale list entry in snd_pcm_oss_look_for_setup() and dereference freed memory.
Allocate the task name and initialize the setup entry before publishing the entry on setup_list. Also fetch the initial proc read iterator only after taking setup_mutex, so all setup_list traversal follows the same list lifetime rules.
--- sound/core/oss/pcm_oss.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
sound/core/oss/pcm_oss.c +11 -7
@@ -2966,8 +2966,10 @@ static void snd_pcm_oss_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) {struct snd_pcm_str *pstr = entry->private_data; -struct snd_pcm_oss_setup *setup = pstr->oss.setup_list; +struct snd_pcm_oss_setup *setup; +guard (mutex)(&pstr->oss.setup_mutex); + setup = pstr->oss.setup_list;while (setup) { snd_iprintf(buffer, "%s %u %u%s%s%s%s%s%s\n", setup->task_name,
@@ -3052,6 +3054,13 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, buffer->error = -ENOMEM ;return ; } + template.task_name =kstrdup (task_name,GFP_KERNEL ); +if (!template.task_name) { +kfree (setup); + buffer->error = -ENOMEM ; +return ; + } + *setup = template;if (pstr->oss.setup_list ==NULL ) pstr->oss.setup_list = setup;else {
@@ -3059,12 +3068,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, setup1->next; setup1 = setup1->next); setup1->next = setup; } - template.task_name =kstrdup (task_name,GFP_KERNEL ); -if (! template.task_name) { -kfree (setup); - buffer->error = -ENOMEM ; -return ; - } +continue ; } *setup = template; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 44/307 ASoC: Intel: bytcht_es8316: Fix MCLK leak on init errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit afb2a3a9d8369d18122a0d7cd294eba9a98259c6 ]
byt_cht_es8316_init() enables MCLK before configuring the codec sysclk and creating the headset jack. If either of those later steps fails, the function returns without disabling MCLK, leaving the clock enabled after card registration fails.
Track whether this driver enabled MCLK and disable it on the init error paths. Add the matching DAI link exit callback so the same clock enable is also balanced when ASoC cleans up a successfully initialized link.
--- sound/soc/intel/boards/bytcht_es8316.c | 29 ++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
sound/soc/intel/boards/bytcht_es8316.c +27 -2
@@ -40,6 +40,7 @@ struct byt_cht_es8316_private {struct gpio_desc *speaker_en_gpio;struct device *codec_dev;bool speaker_en; +bool mclk_enabled; };enum {
@@ -170,6 +171,15 @@ static struct snd_soc_jack_pin byt_cht_es8316_jack_pins[] = { }, }; +static void byt_cht_es8316_disable_mclk (struct byt_cht_es8316_private *priv) +{ +if (!priv->mclk_enabled) +return ; + +clk_disable_unprepare (priv->mclk); + priv->mclk_enabled = false; +} +static int byt_cht_es8316_init (struct snd_soc_pcm_runtime *runtime) {struct snd_soc_component *codec =snd_soc_rtd_to_codec (runtime,0 )->component;
@@ -226,12 +236,14 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime) ret =clk_prepare_enable (priv->mclk);if (ret)dev_err (card->dev,"unable to enable MCLK\n" ); +else + priv->mclk_enabled = true; ret =snd_soc_dai_set_sysclk (snd_soc_rtd_to_codec (runtime,0 ),0 ,19200000 ,SND_SOC_CLOCK_IN );if (ret <0 ) {dev_err (card->dev,"can't set codec clock %d\n" , ret); -return ret; + goto err_disable_mclk; } ret = snd_soc_card_jack_new_pins(card, "Headset",
@@ -240,13 +252,25 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime) ARRAY_SIZE(byt_cht_es8316_jack_pins));if (ret) {dev_err (card->dev,"jack creation failed %d\n" , ret); -return ret; + goto err_disable_mclk; }snd_jack_set_key (priv->jack.jack,SND_JACK_BTN_0 ,KEY_PLAYPAUSE );snd_soc_component_set_jack (codec, &priv->jack,NULL );return 0 ; + +err_disable_mclk: +byt_cht_es8316_disable_mclk (priv); +return ret; +} + +static void byt_cht_es8316_exit (struct snd_soc_pcm_runtime *runtime) +{ +struct snd_soc_card *card = runtime->card; +struct byt_cht_es8316_private *priv =snd_soc_card_get_drvdata (card); + +byt_cht_es8316_disable_mclk (priv); } static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
@@ -356,6 +380,7 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = { .dpcm_playback = 1, .dpcm_capture = 1, .init = byt_cht_es8316_init, + .exit = byt_cht_es8316_exit, SND_SOC_DAILINK_REG(ssp2_port, ssp2_codec, platform), }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 45/307 net: hsr: fix potential OOB access in supervision frame handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luka Gejak <[email protected]>
[ Upstream commit f229426072fc865654a60978bb7fda790a051ff3 ]
Ensure the entire TLV header is linearized before access by adding sizeof(struct hsr_sup_tlv) to the pskb_may_pull() calls. Without this, a truncated frame could cause an out-of-bounds access.
--- net/hsr/hsr_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/hsr/hsr_forward.c +2 -2
@@ -84,7 +84,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb)/* Get next tlv */ total_length += hsr_sup_tag->tlv.HSR_TLV_length; -if (!pskb_may_pull (skb, total_length)) +if (!pskb_may_pull (skb, total_length +sizeof (struct hsr_sup_tlv )))return false;skb_pull (skb, total_length); hsr_sup_tlv = (struct hsr_sup_tlv *)skb->data;
@@ -100,7 +100,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb)/* make sure another tlv follows */ total_length +=sizeof (struct hsr_sup_tlv ) + hsr_sup_tlv->HSR_TLV_length; -if (!pskb_may_pull (skb, total_length)) +if (!pskb_may_pull (skb, total_length +sizeof (struct hsr_sup_tlv )))return false;/* get next tlv */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 46/307 accel/ivpu: prevent uninitialized data bug in debugfs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 44e151be23deb788d9f6124de93823faf6e04e99 ]
The simple_write_to_buffer() will only initialize data starting from the *pos offset so if it's non-zero then the first part of the buffer uninitialized. Really, if *pos is non-zero then this code won't work so just check for that at the start of the function.
--- drivers/accel/ivpu/ivpu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_debugfs.c +1 -1
@@ -447,7 +447,7 @@ priority_bands_fops_write(struct file *file, const char __user *user_buf, size_tu32 band;int ret; -if (size >=sizeof (buf)) +if (*pos !=0 || size >=sizeof (buf))return -EINVAL ; ret =simple_write_to_buffer (buf,sizeof (buf) -1 , pos, user_buf, size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 47/307 gpio: mxc: fix irq_high handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit dac917ed5aead741004db8d0d5151dd577802df8 ]
If port->irq_high is -1 (fsl,imx21-gpio compatible) and gpio_idx is >= 16 enable_irq_wake() is called with -1 which is wrong.
--- drivers/gpio/gpio-mxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mxc.c +1 -1
@@ -473,7 +473,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)* the handler is needed only once, but doing it for every port * is more robust and easier. */ - port->irq_high =-1 ; + port->irq_high =0 ; port->mx_irq_handler = mx2_gpio_irq_handler; }else port->mx_irq_handler = mx3_gpio_irq_handler;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 48/307 net: Avoid checksumming unreadable skb tail on trim
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Björn Töpel <[email protected]>
[ Upstream commit 2e357f002c61fd76fd8f12468744a06a5ec48eaa ]
pskb_trim_rcsum_slow() keeps CHECKSUM_COMPLETE valid by subtracting the checksum of the bytes removed from the skb tail. That assumes the removed bytes can be read.
io_uring zcrx skbs may contain unreadable net_iov frags. With fbnic header/data split, small TCP/IPv4 packets can carry Ethernet padding in such a frag. ip_rcv_core() trims the skb to iph->tot_len before TCP sees it, and the CHECKSUM_COMPLETE adjustment then calls skb_checksum() on the padding.
This is exposed by IPv4 because small TCP/IPv4 frames can be shorter than the Ethernet minimum payload. TCP/IPv6 frames are large enough in the normal zcrx path, so they do not hit the same padding trim.
Keep the existing checksum adjustment for readable skbs. If the remaining packet is fully linear, drop CHECKSUM_COMPLETE and let the stack validate the packet after trimming. If unreadable payload would remain, fail the trim; the checksum cannot be adjusted without reading the trimmed tail.
Also clear skb->unreadable when trimming removes all frags.
--- net/core/skbuff.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
net/core/skbuff.c +27 -4
@@ -2765,6 +2765,8 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len) skb->data_len =0 ;skb_set_tail_pointer (skb, len); } +if (!skb_shinfo (skb)->nr_frags && !skb_has_frag_list (skb)) + skb->unreadable =0 ;if (!skb->sk || skb->destructor == sock_edemux)skb_condense (skb);
@@ -2772,16 +2774,37 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len) }EXPORT_SYMBOL (___pskb_trim); +static int pskb_trim_rcsum_complete (struct sk_buff *skb,unsigned int len) +{ +int delta = skb->len - len; + +if (skb_frags_readable (skb)) { + skb->csum =csum_block_sub (skb->csum, +skb_checksum (skb, len, delta,0 ), + len); +return 0 ; + } + +if (len >skb_headlen (skb)) +return -EFAULT ; + +/* The trimmed bytes are unreadable, but the remaining packet can be +* checksummed by software after trimming. +*/ + skb->ip_summed =CHECKSUM_NONE ; +return 0 ; +} +/* Note : use pskb_trim_rcsum() instead of calling this directly */ int pskb_trim_rcsum_slow (struct sk_buff *skb,unsigned int len) {if (skb->ip_summed ==CHECKSUM_COMPLETE ) { -int delta = skb->len - len; +int err; - skb->csum =csum_block_sub (skb->csum, -skb_checksum (skb, len, delta,0 ), - len); + err =pskb_trim_rcsum_complete (skb, len); +if (err) +return err; }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) {int hdlen = (len >skb_headlen (skb)) ?skb_headlen (skb) : len;int offset =skb_checksum_start_offset (skb) + skb->csum_offset;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 49/307 ethtool: rss: fix hkey leak when indir_size is 0
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 78ccf1a70c6378e1f5073a8c2209b5129067b925 ]
rss_get_data_alloc() allocates a single buffer that backs both the indirection table and the hash key, but only assigned data->indir_table when indir_size was nonzero. The expectation was that no driver implements RSS without supporting indirection table but apparently enic does just that (it's the only such in-tree driver). enic has get_rxfh_key_size but no get_rxfh_indir_size. data->indir_table stays as NULL, hkey gets set but rss_get_data_free() kfree(data->indir_table) is a nop and the allocation leaks.
Always store the allocation base in data->indir_table so the free path is unambiguous. No caller treats indir_table as a sentinel; everything keys off indir_size.
--- net/ethtool/rss.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ethtool/rss.c +1 -2
@@ -78,8 +78,7 @@ rss_prepare_get(const struct rss_req_info *request, struct net_device *dev, goto out_ops; } -if (data->indir_size) - data->indir_table = (u32 *)rss_config; + data->indir_table = (u32 *)rss_config;if (data->hkey_size) data->hkey = rss_config + indir_bytes;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 50/307 ethtool: module: avoid leaking a netdev ref on module flash errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit fb7f511d62692661846c47f199e0afe25c2982db ]
module_flash_fw_schedule() is missing undo for setting the "in_progress" flag and taking the netdev reference. Delay taking these, the device can't disappear while we are holding rtnl_lock.
--- net/ethtool/module.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ethtool/module.c +3 -2
@@ -318,8 +318,6 @@ module_flash_fw_schedule(struct net_device *dev, const char *file_name,if (err <0 ) goto err_release_firmware; - dev->ethtool->module_fw_flash_in_progress = true; -netdev_hold (dev, &module_fw->dev_tracker,GFP_KERNEL ); fw_update->dev = dev; fw_update->ntf_params.portid = info->snd_portid; fw_update->ntf_params.seq = info->snd_seq;
@@ -334,6 +332,9 @@ module_flash_fw_schedule(struct net_device *dev, const char *file_name,if (err <0 ) goto err_release_firmware; + dev->ethtool->module_fw_flash_in_progress = true; +netdev_hold (dev, &module_fw->dev_tracker,GFP_KERNEL ); +schedule_work (&module_fw->work);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 51/307 ethtool: module: check fw_flash_in_progress under rtnl_lock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 504eaefa44c8dec50f7499edcb36d24f3aefab2a ]
ethnl_set_module_validate() inspects module_fw_flash_in_progress but validate is meant for _input_ validation, not state validation. rtnl_lock is not held, yet. Move the check into ethnl_set_module().
--- net/ethtool/module.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/ethtool/module.c +6 -6
@@ -119,12 +119,6 @@ ethnl_set_module_validate(struct ethnl_req_info *req_info,if (!tb[ETHTOOL_A_MODULE_POWER_MODE_POLICY ])return 0 ; -if (req_info->dev->ethtool->module_fw_flash_in_progress) { -NL_SET_ERR_MSG (info->extack, -"Module firmware flashing is in progress" ); -return -EBUSY ; - } -if (!ops->get_module_power_mode || !ops->set_module_power_mode) { NL_SET_ERR_MSG_ATTR(info->extack, tb[ETHTOOL_A_MODULE_POWER_MODE_POLICY],
@@ -147,6 +141,12 @@ ethnl_set_module(struct ethnl_req_info *req_info, struct genl_info *info) ops = dev->ethtool_ops; +if (dev->ethtool->module_fw_flash_in_progress) { +NL_SET_ERR_MSG (info->extack, +"Module firmware flashing is in progress" ); +return -EBUSY ; + } + power_new.policy =nla_get_u8 (tb[ETHTOOL_A_MODULE_POWER_MODE_POLICY ]); ret = ops->get_module_power_mode (dev, &power, info->extack);if (ret <0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 52/307 ethtool: module: fix cleanup if socket used for flashing multiple devices
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 760d04ebad5c4304f22c0d2251c9623b87a117c8 ]
When a single Netlink socket issues MODULE_FW_FLASH_ACT against multiple devices, ethnl_sock_priv_set() overwrites sk_priv->dev on each call, retaining only the last one. The socket priv is used on socket close, to walk the global work list and mark the uncompleted flashing work as "orphaned". Otherwise if another socket reuses the PID it will unexpectedly receive the flashing notifications.
Don't record the device, record net pointer instead. The purpose of the dev is to scope the work to a netns, anyway. If we store netns the overrides are safe/a nop since all flashed devices must be in the same netns as the socket.
--- net/ethtool/module.c | 9 ++++----- net/ethtool/netlink.c | 4 ++-- net/ethtool/netlink.h | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-)
net/ethtool/module.c +4 -5
@@ -282,11 +282,9 @@ void ethnl_module_fw_flash_sock_destroy(struct ethnl_sock_priv *sk_priv)spin_lock (&module_fw_flash_work_list_lock);list_for_each_entry (work, &module_fw_flash_work_list, list) { -if (work->fw_update.dev == sk_priv->dev && - work->fw_update.ntf_params.portid == sk_priv->portid) { +if (work->fw_update.ntf_params.portid == sk_priv->portid && +dev_net (work->fw_update.dev) == sk_priv->net) work->fw_update.ntf_params.closed_sock = true; -break ; - } }spin_unlock (&module_fw_flash_work_list_lock); }
@@ -323,7 +321,8 @@ module_flash_fw_schedule(struct net_device *dev, const char *file_name, fw_update->ntf_params.seq = info->snd_seq; fw_update->ntf_params.closed_sock = false; - err =ethnl_sock_priv_set (skb, dev, fw_update->ntf_params.portid, + err =ethnl_sock_priv_set (skb,dev_net (dev), + fw_update->ntf_params.portid,ETHTOOL_SOCK_TYPE_MODULE_FW_FLASH );if (err <0 ) goto err_release_firmware;
net/ethtool/netlink.c +2 -2
@@ -50,7 +50,7 @@ const struct nla_policy ethnl_header_policy_phy_stats[] = { [ETHTOOL_A_HEADER_PHY_INDEX] = NLA_POLICY_MIN(NLA_U32, 1), }; -int ethnl_sock_priv_set (struct sk_buff *skb,struct net_device *dev,u32 portid, +int ethnl_sock_priv_set (struct sk_buff *skb,struct net *net,u32 portid,enum ethnl_sock_type type) {struct ethnl_sock_priv *sk_priv;
@@ -59,7 +59,7 @@ int ethnl_sock_priv_set(struct sk_buff *skb, struct net_device *dev, u32 portid,if (IS_ERR (sk_priv))return PTR_ERR (sk_priv); - sk_priv->dev = dev; + sk_priv->net = net; sk_priv->portid = portid; sk_priv->type = type;
net/ethtool/netlink.h +2 -2
@@ -315,12 +315,12 @@ enum ethnl_sock_type { };struct ethnl_sock_priv { -struct net_device *dev; +struct net *net;u32 portid;enum ethnl_sock_type type; }; -int ethnl_sock_priv_set (struct sk_buff *skb,struct net_device *dev,u32 portid, +int ethnl_sock_priv_set (struct sk_buff *skb,struct net *net,u32 portid,enum ethnl_sock_type type);/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 53/307 ethtool: cmis: require exact CDB reply length
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 6c3f999a9d1338c6c89a9ff4549eafe72bc2e7b1 ]
Malicious SFP module could respond with rpl_len longer than what cmis_cdb_process_reply() expected, leading to OOB writes. Malicious HW is a bit theoretical but some modules may just be buggy and/or the reads may occasionally get corrupted, so let's protect the kernel.
The existing check protects from short replies. We need to protect from long ones, too. All callers that pass a non-zero rpl_exp_len cast the reply payload to a fixed-layout struct and read fields at fixed offsets, with no version negotiation or short-reply handling:
- cmis_cdb_validate_password()
- cmis_cdb_module_features_get()
- cmis_fw_update_fw_mng_features_get()
so let's assume that responses longer than expected do not have to be handled gracefully here. Add a warning message to make the debug easier in case my understanding is wrong...
Note that page_data->length (argument of kmalloc) comes from last arg to ethtool_cmis_page_init() which is rpl_exp_len.
Note2 that AIs also like to point out overflows in args->req.payload itself (which is a fixed-size 120 B buffer, on the stack), but callers should be reading structs defined by the standard, so protecting from requests for more data than max seem like defensive programming.
--- net/ethtool/cmis_cdb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/ethtool/cmis_cdb.c +7 -2
@@ -508,8 +508,13 @@ static int cmis_cdb_process_reply(struct net_device *dev, } rpl = (struct ethtool_cmis_cdb_rpl *)page_data->data; -if ((args->rpl_exp_len > rpl->hdr.rpl_len + rpl_hdr_len) || - !rpl->hdr.rpl_chk_code) { +if (rpl->hdr.rpl_len != args->rpl_exp_len) { +netdev_warn (dev,"CDB reply length mismatch, expected %u got %u\n" , + args->rpl_exp_len, rpl->hdr.rpl_len); + err = -EIO ; + goto out; + } +if (!rpl->hdr.rpl_chk_code) { err = -EIO ; goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 54/307 ethtool: cmis: fix u16-to-u8 truncation of msleep_pre_rpl
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 3e8c3d464c36bb342fe377b026577c7ec27fdbb4 ]
ethtool_cmis_cdb_compose_args() accepts msleep_pre_rpl as u16 but stores it into the u8 field ethtool_cmis_cdb_cmd_args::msleep_pre_rpl, silently truncating values >= 256. Seven of the nine call sites pass 1000 ms (it's the third argument from the end).
--- net/ethtool/cmis.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ethtool/cmis.h +2 -2
@@ -59,9 +59,9 @@ struct ethtool_cmis_cdb_request {* struct ethtool_cmis_cdb_cmd_args - CDB commands execution arguments * @req: CDB command fields as described in the CMIS standard. * @max_duration: Maximum duration time for command completion in msec. +* @msleep_pre_rpl: Waiting time before checking reply in msec. * @read_write_len_ext: Allowable additional number of byte octets to the LPL * in a READ or a WRITE commands. -* @msleep_pre_rpl: Waiting time before checking reply in msec. * @rpl_exp_len: Expected reply length in bytes. * @flags: Validation flags for CDB commands. * @err_msg: Error message to be sent to user space.
@@ -69,8 +69,8 @@ struct ethtool_cmis_cdb_request {struct ethtool_cmis_cdb_cmd_args {struct ethtool_cmis_cdb_request req;u16 max_duration; +u16 msleep_pre_rpl;u8 read_write_len_ext; -u8 msleep_pre_rpl;u8 rpl_exp_len;u8 flags;char *err_msg;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 55/307 net: ethtool: Add new parameters and a function to support EPL
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danielle Ratson <[email protected]>
[ Upstream commit edc344568922eb9588e77ba49de1ef0cb9a2ff1c ]
In the CMIS specification for pluggable modules, LPL (Local Payload) and EPL (Extended Payload) are two types of data payloads used for managing various functions and features of the module.
EPL payloads are used for more complex and extensive management functions that require a larger amount of data, so writing firmware blocks using EPL is much more efficient.
Currently, only LPL payload is supported for writing firmware blocks to the module.
Add EPL related parameters to the function ethtool_cmis_cdb_compose_args() and add a specific function for calculating the maximum allowable length extension for EPL. Both will be used in the next patch to add support for writing firmware blocks using EPL.
Stable-dep-of: 12c2496a71f8 ("ethtool: cmis: validate start_cmd_payload_size from module")
--- net/ethtool/cmis.h | 12 +++++++----- net/ethtool/cmis_cdb.c | 32 +++++++++++++++++++++----------- net/ethtool/cmis_fw_update.c | 17 ++++++++++------- 3 files changed, 38 insertions(+), 23 deletions(-)
net/ethtool/cmis.h +7 -5
@@ -96,13 +96,15 @@ struct ethtool_cmis_cdb_rpl {u8 payload[ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH ]; }; -u32 ethtool_cmis_get_max_payload_size (u8 num_of_byte_octs); +u32 ethtool_cmis_get_max_lpl_size (u8 num_of_byte_octs); +u32 ethtool_cmis_get_max_epl_size (u8 num_of_byte_octs);void ethtool_cmis_cdb_compose_args (struct ethtool_cmis_cdb_cmd_args *args, -enum ethtool_cmis_cdb_cmd_id cmd,u8 *pl, -u8 lpl_len,u16 max_duration, -u8 read_write_len_ext,u16 msleep_pre_rpl, -u8 rpl_exp_len,u8 flags); +enum ethtool_cmis_cdb_cmd_id cmd,u8 *lpl, +u8 lpl_len,u8 *epl,u16 epl_len, +u16 max_duration,u8 read_write_len_ext, +u16 msleep_pre_rpl,u8 rpl_exp_len, +u8 flags);void ethtool_cmis_cdb_check_completion_flag (u8 cmis_rev,u8 *flags);
net/ethtool/cmis_cdb.c +21 -11
@@ -11,25 +11,34 @@* min(i, 15) byte octets where i specifies the allowable additional number of * byte octets in a READ or a WRITE. */ -u32 ethtool_cmis_get_max_payload_size (u8 num_of_byte_octs) +u32 ethtool_cmis_get_max_lpl_size (u8 num_of_byte_octs) {return 8 * (1 +min_t (u8, num_of_byte_octs,15 )); } +/* For accessing the EPL field on page 9Fh, the allowable length extension is +* min(i, 255) byte octets where i specifies the allowable additional number of +* byte octets in a READ or a WRITE. +*/ +u32 ethtool_cmis_get_max_epl_size (u8 num_of_byte_octs) +{ +return 8 * (1 +min_t (u8, num_of_byte_octs,255 )); +} +void ethtool_cmis_cdb_compose_args (struct ethtool_cmis_cdb_cmd_args *args, -enum ethtool_cmis_cdb_cmd_id cmd,u8 *pl, -u8 lpl_len,u16 max_duration, -u8 read_write_len_ext,u16 msleep_pre_rpl, -u8 rpl_exp_len,u8 flags) +enum ethtool_cmis_cdb_cmd_id cmd,u8 *lpl, +u8 lpl_len,u8 *epl,u16 epl_len, +u16 max_duration,u8 read_write_len_ext, +u16 msleep_pre_rpl,u8 rpl_exp_len,u8 flags) { args->req.id =cpu_to_be16 (cmd); args->req.lpl_len = lpl_len; -if (pl) -memcpy (args->req.payload, pl, args->req.lpl_len); +if (lpl) +memcpy (args->req.payload, lpl, args->req.lpl_len); args->max_duration = max_duration; args->read_write_len_ext = -ethtool_cmis_get_max_payload_size (read_write_len_ext); +ethtool_cmis_get_max_lpl_size (read_write_len_ext); args->msleep_pre_rpl = msleep_pre_rpl; args->rpl_exp_len = rpl_exp_len; args->flags = flags;
@@ -183,7 +192,7 @@ cmis_cdb_validate_password(struct ethtool_cmis_cdb *cdb, }ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_QUERY_STATUS , - (u8 *)&qs_pl,sizeof (qs_pl),0 , + (u8 *)&qs_pl,sizeof (qs_pl),NULL ,0 ,0 , cdb->read_write_len_ext,1000 ,sizeof (*rpl),CDB_F_COMPLETION_VALID |CDB_F_STATUS_VALID );
@@ -245,8 +254,9 @@ static int cmis_cdb_module_features_get(struct ethtool_cmis_cdb *cdb,ethtool_cmis_cdb_check_completion_flag (cdb->cmis_rev, &flags);ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_MODULE_FEATURES , -NULL ,0 ,0 , cdb->read_write_len_ext, -1000 ,sizeof (*rpl), flags); +NULL ,0 ,NULL ,0 ,0 , + cdb->read_write_len_ext,1000 , +sizeof (*rpl), flags); err =ethtool_cmis_cdb_execute_cmd (dev, &args);if (err <0 ) {
net/ethtool/cmis_fw_update.c +10 -7
@@ -54,7 +54,8 @@ cmis_fw_update_fw_mng_features_get(struct ethtool_cmis_cdb *cdb,ethtool_cmis_cdb_check_completion_flag (cdb->cmis_rev, &flags);ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_FW_MANAGMENT_FEATURES , -NULL ,0 , cdb->max_completion_time, +NULL ,0 ,NULL ,0 , + cdb->max_completion_time, cdb->read_write_len_ext,1000 ,sizeof (*rpl), flags);
@@ -122,7 +123,7 @@ cmis_fw_update_start_download(struct ethtool_cmis_cdb *cdb,ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_START_FW_DOWNLOAD , - (u8 *)&pl, lpl_len, + (u8 *)&pl, lpl_len,NULL ,0 , fw_mng->max_duration_start, cdb->read_write_len_ext,1000 ,0 ,CDB_F_COMPLETION_VALID |CDB_F_STATUS_VALID );
@@ -158,7 +159,7 @@ cmis_fw_update_write_image(struct ethtool_cmis_cdb *cdb,int err; max_lpl_len =min_t (u32, -ethtool_cmis_get_max_payload_size (cdb->read_write_len_ext), +ethtool_cmis_get_max_lpl_size (cdb->read_write_len_ext),ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH ); max_block_size = max_lpl_len - sizeof_field(struct cmis_cdb_write_fw_block_lpl_pl,
@@ -183,7 +184,7 @@ cmis_fw_update_write_image(struct ethtool_cmis_cdb *cdb,ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_WRITE_FW_BLOCK_LPL , - (u8 *)&pl, lpl_len, + (u8 *)&pl, lpl_len,NULL ,0 , fw_mng->max_duration_write, cdb->read_write_len_ext,1 ,0 ,CDB_F_COMPLETION_VALID |CDB_F_STATUS_VALID );
@@ -212,7 +213,8 @@ cmis_fw_update_complete_download(struct ethtool_cmis_cdb *cdb,ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_COMPLETE_FW_DOWNLOAD , -NULL ,0 , fw_mng->max_duration_complete, +NULL ,0 ,NULL ,0 , + fw_mng->max_duration_complete, cdb->read_write_len_ext,1000 ,0 ,CDB_F_COMPLETION_VALID |CDB_F_STATUS_VALID );
@@ -294,7 +296,7 @@ cmis_fw_update_run_image(struct ethtool_cmis_cdb *cdb, struct net_device *dev,int err;ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_RUN_FW_IMAGE , - (u8 *)&pl,sizeof (pl), + (u8 *)&pl,sizeof (pl),NULL ,0 , cdb->max_completion_time, cdb->read_write_len_ext,1000 ,0 ,CDB_F_MODULE_STATE_VALID );
@@ -326,7 +328,8 @@ cmis_fw_update_commit_image(struct ethtool_cmis_cdb *cdb,ethtool_cmis_cdb_compose_args (&args,ETHTOOL_CMIS_CDB_CMD_COMMIT_FW_IMAGE , -NULL ,0 , cdb->max_completion_time, +NULL ,0 ,NULL ,0 , + cdb->max_completion_time, cdb->read_write_len_ext,1000 ,0 ,CDB_F_COMPLETION_VALID |CDB_F_STATUS_VALID );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 56/307 net: ethtool: Add support for writing firmware blocks using EPL payload
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danielle Ratson <[email protected]>
[ Upstream commit 9a3b0d078bd825613c0821bf7bf5a2e1d8d60057 ]
In the CMIS specification for pluggable modules, LPL (Local Payload) and EPL (Extended Payload) are two types of data payloads used for managing various functions and features of the module.
EPL payloads are used for more complex and extensive management functions that require a larger amount of data, so writing firmware blocks using EPL is much more efficient.
Currently, only LPL payload is supported for writing firmware blocks to the module.
Add support for writing firmware block using EPL payload, both to support modules that supports only EPL write mechanism, and to optimize the flashing process of modules that support LPL and EPL.
Stable-dep-of: 12c2496a71f8 ("ethtool: cmis: validate start_cmd_payload_size from module")
--- net/ethtool/cmis.h | 4 ++ net/ethtool/cmis_cdb.c | 66 ++++++++++++++++++++++++-- net/ethtool/cmis_fw_update.c | 91 ++++++++++++++++++++++++++++++++---- 3 files changed, 148 insertions(+), 13 deletions(-)
net/ethtool/cmis.h +4 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0-only */ #define ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH 120 +#define ETHTOOL_CMIS_CDB_EPL_MAX_PL_LENGTH 2048#define ETHTOOL_CMIS_CDB_CMD_PAGE 0x9F#define ETHTOOL_CMIS_CDB_PAGE_I2C_ADDR 0x50
@@ -23,6 +24,7 @@ enum ethtool_cmis_cdb_cmd_id {ETHTOOL_CMIS_CDB_CMD_FW_MANAGMENT_FEATURES =0x0041 ,ETHTOOL_CMIS_CDB_CMD_START_FW_DOWNLOAD =0x0101 ,ETHTOOL_CMIS_CDB_CMD_WRITE_FW_BLOCK_LPL =0x0103 , +ETHTOOL_CMIS_CDB_CMD_WRITE_FW_BLOCK_EPL =0x0104 ,ETHTOOL_CMIS_CDB_CMD_COMPLETE_FW_DOWNLOAD =0x0107 ,ETHTOOL_CMIS_CDB_CMD_RUN_FW_IMAGE =0x0109 , ETHTOOL_CMIS_CDB_CMD_COMMIT_FW_IMAGE = 0x010A,
@@ -38,6 +40,7 @@ enum ethtool_cmis_cdb_cmd_id {* @resv1: Added to match the CMIS standard request continuity. * @resv2: Added to match the CMIS standard request continuity. * @payload: Payload for the CDB commands. +* @epl: Extended payload for the CDB commands. */ struct ethtool_cmis_cdb_request {__be16 id;
@@ -49,6 +52,7 @@ struct ethtool_cmis_cdb_request {u8 resv2;u8 payload[ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH ]; ); +u8 *epl;/* Everything above this field checksummed. */ };#define CDB_F_COMPLETION_VALID BIT(0)
net/ethtool/cmis_cdb.c +62 -4
93 lines not on this page · raw message
net/ethtool/cmis_fw_update.c +82 -9
135 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 57/307 ethtool: cmis: validate start_cmd_payload_size from module
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 12c2496a71f82f63617971ca9b730dffa05cf58b ]
The CMIS firmware update code reads start_cmd_payload_size from the module's FW Management Features CDB reply and uses it directly as the byte count for memcpy. The destination buffer is 112 bytes (ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH - 8). So a malicious module (or corrupted response) can cause a OOB write later on in cmis_fw_update_start_download().
Let's error out. If modules that expect longer LPL writes actually exist we should revisit.
struct cmis_cdb_start_fw_download_pl's definition has to move, no change there.
--- net/ethtool/cmis_fw_update.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
net/ethtool/cmis_fw_update.c +22 -14
@@ -43,6 +43,20 @@ enum cmis_cdb_fw_write_mechanism { CMIS_CDB_FW_WRITE_MECHANISM_BOTH = 0x11, }; +/* See section 9.7.2 "CMD 0101h: Start Firmware Download" in CMIS standard +* revision 5.2. +* struct cmis_cdb_start_fw_download_pl is a structured layout of the +* flat array, ethtool_cmis_cdb_request::payload. +*/ +struct cmis_cdb_start_fw_download_pl { + __struct_group(cmis_cdb_start_fw_download_pl_h, head, /* no attrs */, + __be32 image_size; +__be32 resv1; + ); +u8 vendor_data[ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH - +sizeof (struct cmis_cdb_start_fw_download_pl_h )]; +}; + static int cmis_fw_update_fw_mng_features_get(struct ethtool_cmis_cdb *cdb, struct net_device *dev,
@@ -85,6 +99,14 @@ cmis_fw_update_fw_mng_features_get(struct ethtool_cmis_cdb *cdb,*/ cdb->read_write_len_ext = rpl->read_write_len_ext; fw_mng->start_cmd_payload_size = rpl->start_cmd_payload_size; +if (fw_mng->start_cmd_payload_size > + sizeof_field(struct cmis_cdb_start_fw_download_pl, vendor_data)) { +ethnl_module_fw_flash_ntf_err (dev, ntf_params, +"Start cmd payload size exceeds max LPL payload" , +NULL ); +return -EINVAL ; + } + fw_mng->write_mechanism = rpl->write_mechanism ==CMIS_CDB_FW_WRITE_MECHANISM_LPL ? CMIS_CDB_FW_WRITE_MECHANISM_LPL :
@@ -96,20 +118,6 @@ cmis_fw_update_fw_mng_features_get(struct ethtool_cmis_cdb *cdb,return 0 ; } -/* See section 9.7.2 "CMD 0101h: Start Firmware Download" in CMIS standard -* revision 5.2. -* struct cmis_cdb_start_fw_download_pl is a structured layout of the -* flat array, ethtool_cmis_cdb_request::payload. -*/ -struct cmis_cdb_start_fw_download_pl { - __struct_group(cmis_cdb_start_fw_download_pl_h, head, /* no attrs */, - __be32 image_size; -__be32 resv1; - ); -u8 vendor_data[ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH - -sizeof (struct cmis_cdb_start_fw_download_pl_h )]; -}; - static int cmis_fw_update_start_download(struct ethtool_cmis_cdb *cdb, struct ethtool_cmis_fw_update_params *fw_update,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 58/307 ethtool: cmis: validate fw->size against start_cmd_payload_size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit d5551f4c1800dc714cec86647bdd651ae0de923e ]
cmis_fw_update_start_download() copies start_cmd_payload_size bytes from the firmware blob into the CDB LPL vendor_data[] payload without validating that the FW has enough data.
Since the start_cmd_payload_size can only be ~120B an image too short is most likely corrupted, so reject it.
--- net/ethtool/cmis_fw_update.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/ethtool/cmis_fw_update.c +8 -0
@@ -129,6 +129,14 @@ cmis_fw_update_start_download(struct ethtool_cmis_cdb *cdb,u8 lpl_len;int err; +if (fw_update->fw->size < vendor_data_size) { +ethnl_module_fw_flash_ntf_err (fw_update->dev, + &fw_update->ntf_params, +"Firmware image too small for module's start payload" , +NULL ); +return -EINVAL ; + } + pl.image_size =cpu_to_be32 (fw_update->fw->size);memcpy (pl.vendor_data, fw_update->fw->data, vendor_data_size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 59/307 cxl/test: Update mock dev array before calling platform_device_add()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Ming <[email protected]>
[ Upstream commit d90f236f8b9e354848bd226f581db27755ab901d ]
CXL test environment hits the following error sometimes.
cxl_mem mem9: endpoint7 failed probe
All mock memdevs are platform firmware devices added by cxl_test module, and cxl_test module also provides a platform device driver for them to create a memdev device to CXL subsystem. cxl_test module uses cxl_rcd/mem_single/mem arrays to store different types of mock memdevs. CXL drivers calls registered mock functions for a mock memdev by checking if a given memdev is in these arrays.
When cxl_test module adds these mock memdevs, it always calls platform_device_add() before adding them to a suitable mock memdev array. However, there is a small window where CXL drivers calls mock function for a added memdev before it added to a mock memdev array. In above case, cxl endpoint driver considers a added memdev was not a mock memdev, then calling devm_cxl_endpoint_decoders_setup() for it rather than mock_endpoint_decoders_setup().
An appropriate solution is that adding a new mock device to a mock device array before calling platform_device_add() for it. It can guarantee the new mock device is visible to CXL subsystem.
This patch introduces a new helped called cxl_mock_platform_device_add() to handle the issue, and uses the function for all mock devices addition.
--- tools/testing/cxl/test/cxl.c | 105 ++++++++++++++--------------------- 1 file changed, 43 insertions(+), 62 deletions(-)
tools/testing/cxl/test/cxl.c +43 -62
@@ -1058,6 +1058,23 @@ static void mock_companion(struct acpi_device *adev, struct device *dev)#define SZ_64G (SZ_32G * 2)#endif +static int cxl_mock_platform_device_add (struct platform_device *pdev, +struct platform_device **ppdev) +{ +int rc; + +if (ppdev) + *ppdev = pdev; + rc =platform_device_add (pdev); +if (rc) { +platform_device_put (pdev); +if (ppdev) + *ppdev =NULL ; + } + +return rc; +} +static __init int cxl_rch_topo_init (void ) {int rc, i;
@@ -1072,13 +1089,10 @@ static __init int cxl_rch_topo_init(void) goto err_bridge;mock_companion (adev, &pdev->dev); - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_rch[i]); +if (rc) goto err_bridge; - } - cxl_rch[i] = pdev; mock_pci_bus[idx].bridge = &pdev->dev; rc =sysfs_create_link (&pdev->dev.kobj, &pdev->dev.kobj,"firmware_node" );
@@ -1130,13 +1144,10 @@ static __init int cxl_single_topo_init(void) goto err_bridge;mock_companion (adev, &pdev->dev); - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_hb_single[i]); +if (rc) goto err_bridge; - } - cxl_hb_single[i] = pdev; mock_pci_bus[i +NR_CXL_HOST_BRIDGES ].bridge = &pdev->dev; rc =sysfs_create_link (&pdev->dev.kobj, &pdev->dev.kobj,"physical_node" );
@@ -1155,12 +1166,9 @@ static __init int cxl_single_topo_init(void) goto err_port; pdev->dev.parent = &bridge->dev; - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_root_single[i]); +if (rc) goto err_port; - } - cxl_root_single[i] = pdev; }for (i =0 ; i <ARRAY_SIZE (cxl_swu_single); i++) {
@@ -1173,12 +1181,9 @@ static __init int cxl_single_topo_init(void) goto err_uport; pdev->dev.parent = &root_port->dev; - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_swu_single[i]); +if (rc) goto err_uport; - } - cxl_swu_single[i] = pdev; }for (i =0 ; i <ARRAY_SIZE (cxl_swd_single); i++) {
@@ -1192,12 +1197,9 @@ static __init int cxl_single_topo_init(void) goto err_dport; pdev->dev.parent = &uport->dev; - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_swd_single[i]); +if (rc) goto err_dport; - } - cxl_swd_single[i] = pdev; }return 0 ;
@@ -1270,12 +1272,9 @@ static int cxl_mem_init(void) pdev->dev.parent = &dport->dev;set_dev_node (&pdev->dev, i %2 ); - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_mem[i]); +if (rc) goto err_mem; - } - cxl_mem[i] = pdev; }for (i =0 ; i <ARRAY_SIZE (cxl_mem_single); i++) {
@@ -1288,12 +1287,9 @@ static int cxl_mem_init(void) pdev->dev.parent = &dport->dev;set_dev_node (&pdev->dev, i %2 ); - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_mem_single[i]); +if (rc) goto err_single; - } - cxl_mem_single[i] = pdev; }for (i =0 ; i <ARRAY_SIZE (cxl_rcd); i++) {
@@ -1307,12 +1303,9 @@ static int cxl_mem_init(void) pdev->dev.parent = &rch->dev;set_dev_node (&pdev->dev, i %2 ); - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_rcd[i]); +if (rc) goto err_rcd; - } - cxl_rcd[i] = pdev; }return 0 ;
@@ -1373,13 +1366,10 @@ static __init int cxl_test_init(void) goto err_bridge;mock_companion (adev, &pdev->dev); - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_host_bridge[i]); +if (rc) goto err_bridge; - } - cxl_host_bridge[i] = pdev; mock_pci_bus[i].bridge = &pdev->dev; rc =sysfs_create_link (&pdev->dev.kobj, &pdev->dev.kobj,"physical_node" );
@@ -1397,12 +1387,9 @@ static __init int cxl_test_init(void) goto err_port; pdev->dev.parent = &bridge->dev; - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_root_port[i]); +if (rc) goto err_port; - } - cxl_root_port[i] = pdev; }BUILD_BUG_ON (ARRAY_SIZE (cxl_switch_uport) !=ARRAY_SIZE (cxl_root_port));
@@ -1415,12 +1402,9 @@ static __init int cxl_test_init(void) goto err_uport; pdev->dev.parent = &root_port->dev; - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_switch_uport[i]); +if (rc) goto err_uport; - } - cxl_switch_uport[i] = pdev; }for (i =0 ; i <ARRAY_SIZE (cxl_switch_dport); i++) {
@@ -1433,12 +1417,9 @@ static __init int cxl_test_init(void) goto err_dport; pdev->dev.parent = &uport->dev; - rc =platform_device_add (pdev); -if (rc) { -platform_device_put (pdev); + rc =cxl_mock_platform_device_add (pdev, &cxl_switch_dport[i]); +if (rc) goto err_dport; - } - cxl_switch_dport[i] = pdev; } rc =cxl_single_topo_init ();
@@ -1456,9 +1437,9 @@ static __init int cxl_test_init(void)mock_companion (&acpi0017_mock, &cxl_acpi->dev); acpi0017_mock.dev.bus = &platform_bus_type; - rc =platform_device_add (cxl_acpi); + rc =cxl_mock_platform_device_add (cxl_acpi,NULL );if (rc) - goto err_root; + goto err_rch; rc =cxl_mem_init ();if (rc)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 60/307 tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b4bc94353050b1fa7b702bd4c6600710dd926cff ]
Sashiko found that iptunnel_pmtud_build_icmp() and iptunnel_pmtud_build_icmpv6() were caching ip_hdr() and ipv6_hdr() before an skb_cow() call which can reallocate skb->head.
Fix this possible UAF by initializing the local variables after the skb_cow() call.
Remove skb_reset_network_header() calls which were not needed.
--- net/ipv4/ip_tunnel_core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/ipv4/ip_tunnel_core.c +4 -5
@@ -210,7 +210,7 @@ EXPORT_SYMBOL_GPL(iptunnel_handle_offloads);*/ static int iptunnel_pmtud_build_icmp (struct sk_buff *skb,int mtu) { -const struct iphdr *iph =ip_hdr (skb); +const struct iphdr *iph;struct icmphdr *icmph;struct iphdr *niph;struct ethhdr eh;
@@ -224,7 +224,6 @@ static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu)skb_copy_bits (skb,skb_mac_offset (skb), &eh,ETH_HLEN );pskb_pull (skb,ETH_HLEN ); -skb_reset_network_header (skb); err =pskb_trim (skb,576 -sizeof (*niph) -sizeof (*icmph));if (err)
@@ -234,7 +233,7 @@ static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu) err =skb_cow (skb,sizeof (*niph) +sizeof (*icmph) +ETH_HLEN );if (err)return err; - + iph =ip_hdr (skb); icmph =skb_push (skb,sizeof (*icmph)); *icmph = (struct icmphdr ) { .type =ICMP_DEST_UNREACH ,
@@ -306,7 +305,7 @@ static int iptunnel_pmtud_check_icmp(struct sk_buff *skb, int mtu)*/ static int iptunnel_pmtud_build_icmpv6 (struct sk_buff *skb,int mtu) { -const struct ipv6hdr *ip6h =ipv6_hdr (skb); +const struct ipv6hdr *ip6h;struct icmp6hdr *icmp6h;struct ipv6hdr *nip6h;struct ethhdr eh;
@@ -321,7 +320,6 @@ static int iptunnel_pmtud_build_icmpv6(struct sk_buff *skb, int mtu)skb_copy_bits (skb,skb_mac_offset (skb), &eh,ETH_HLEN );pskb_pull (skb,ETH_HLEN ); -skb_reset_network_header (skb); err =pskb_trim (skb,IPV6_MIN_MTU -sizeof (*nip6h) -sizeof (*icmp6h));if (err)
@@ -332,6 +330,7 @@ static int iptunnel_pmtud_build_icmpv6(struct sk_buff *skb, int mtu)if (err)return err; + ip6h =ipv6_hdr (skb); icmp6h =skb_push (skb,sizeof (*icmp6h)); *icmp6h = (struct icmp6hdr ) { .icmp6_type =ICMPV6_PKT_TOOBIG ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 61/307 vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7d9ef0cb271555d8cf39fefe6c981e1493b25ecf ]
skb_tunnel_check_pmtu() can change skb->head.
Reusing old_iph afer skb_tunnel_check_pmtu() can cause an UAF.
Use instead ip_hdr(skb) as done in drivers/net/bareudp.c and drivers/net/geneve.c.
Found by Sashiko.
--- drivers/net/vxlan/vxlan_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/vxlan/vxlan_core.c +2 -2
@@ -2541,7 +2541,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, goto out_unlock; } - tos =ip_tunnel_ecn_encap (tos, old_iph, skb); + tos =ip_tunnel_ecn_encap (tos,ip_hdr (skb), skb); ttl = ttl ? :ip4_dst_hoplimit (&rt->dst); err =vxlan_build_skb (skb, ndst,sizeof (struct iphdr ), vni, md, flags, udp_sum);
@@ -2601,7 +2601,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, goto out_unlock; } - tos =ip_tunnel_ecn_encap (tos, old_iph, skb); + tos =ip_tunnel_ecn_encap (tos,ip_hdr (skb), skb); ttl = ttl ? :ip6_dst_hoplimit (ndst);skb_scrub_packet (skb, xnet); err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr),
Signature · 1 line
2.53.0