5.15.174-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 428/565 dt_bindings: rs485: Correct delay values
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lino Sanfilippo <[email protected]>
[ Upstream commit 885dcb08c93d75b784468e65fd4f1f82d5313061 ]
Currently the documentation claims that a maximum of 1000 msecs is allowed for RTS delays. However nothing actually checks the values read from device tree/ACPI and so it is possible to set much higher values.
There is already a maximum of 100 ms enforced for RTS delays that are set via the UART TIOCSRS485 ioctl. To be consistent with that use the same limit for DT/ACPI values.
Although this change is visible to userspace the risk of breaking anything when reducing the max delays from 1000 to 100 ms should be very low, since 100 ms is already a very high maximum for delays that are usually rather in the usecs range.
Stable-dep-of: 12b3642b6c24 ("dt-bindings: serial: rs485: Fix rs485-rts-delay property")
--- Documentation/devicetree/bindings/serial/rs485.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/serial/rs485.yaml +2 -2
@@ -22,12 +22,12 @@ properties: - description: Delay between rts signal and beginning of data sent in milliseconds. It corresponds to the delay before sending data. default: 0 - maximum: 1000 + maximum: 100 - description: Delay between end of data sent and rts signal in milliseconds. It corresponds to the delay after sending data and actual release of the line. default: 0 - maximum: 1000 + maximum: 100 rs485-rts-active-low: description: drive RTS low when sending (default is high).
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 429/565 dt-bindings: serial: rs485: Fix rs485-rts-delay property
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
[ Upstream commit 12b3642b6c242061d3ba84e6e3050c3141ded14c ]
Code expects array only with 2 items which should be checked. But also item checking is not working as it should likely because of incorrect items description.
--- .../devicetree/bindings/serial/rs485.yaml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/serial/rs485.yaml +9 -10
@@ -18,16 +18,15 @@ properties: description: prop-encoded-array <a b> $ref: /schemas/types.yaml#/definitions/uint32-array items: - items: - - description: Delay between rts signal and beginning of data sent in - milliseconds. It corresponds to the delay before sending data. - default: 0 - maximum: 100 - - description: Delay between end of data sent and rts signal in milliseconds. - It corresponds to the delay after sending data and actual release - of the line. - default: 0 - maximum: 100 + - description: Delay between rts signal and beginning of data sent in + milliseconds. It corresponds to the delay before sending data. + default: 0 + maximum: 100 + - description: Delay between end of data sent and rts signal in milliseconds. + It corresponds to the delay after sending data and actual release + of the line. + default: 0 + maximum: 100 rs485-rts-active-low: description: drive RTS low when sending (default is high).
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 430/565 serial: amba-pl011: Use port lock wrappers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit 68ca3e72d7463d79d29b6e4961d6028df2a88e25 ]
When a serial port is used for kernel console output, then all modifications to the UART registers which are done from other contexts, e.g. getty, termios, are interference points for the kernel console.
So far this has been ignored and the printk output is based on the principle of hope. The rework of the console infrastructure which aims to support threaded and atomic consoles, requires to mark sections which modify the UART registers as unsafe. This allows the atomic write function to make informed decisions and eventually to restore operational state. It also allows to prevent the regular UART code from modifying UART registers while printk output is in progress.
All modifications of UART registers are guarded by the UART port lock, which provides an obvious synchronization point with the console infrastructure.
To avoid adding this functionality to all UART drivers, wrap the spin_[un]lock*() invocations for uart_port::lock into helper functions which just contain the spin_[un]lock*() invocations for now. In a subsequent step these helpers will gain the console synchronization mechanisms.
Converted with coccinelle. No functional change.
Stable-dep-of: 2bcacc1c87ac ("serial: amba-pl011: Fix RX stall when DMA is used")
--- drivers/tty/serial/amba-pl011.c | 72 ++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-)
drivers/tty/serial/amba-pl011.c +36 -36
@@ -351,9 +351,9 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap) flag =TTY_FRAME ; } -spin_unlock (&uap->port.lock); +uart_port_unlock (&uap->port); sysrq =uart_handle_sysrq_char (&uap->port, ch &255 ); -spin_lock (&uap->port.lock); +uart_port_lock (&uap->port);if (!sysrq)uart_insert_char (&uap->port, ch,UART011_DR_OE , ch, flag);
@@ -548,7 +548,7 @@ static void pl011_dma_tx_callback(void *data)unsigned long flags;u16 dmacr; -spin_lock_irqsave (&uap->port.lock, flags); +uart_port_lock_irqsave (&uap->port, &flags);if (uap->dmatx.queued)dma_unmap_single (dmatx->chan->device->dev, dmatx->dma, dmatx->len,DMA_TO_DEVICE );
@@ -569,7 +569,7 @@ static void pl011_dma_tx_callback(void *data)if (!(dmacr &UART011_TXDMAE ) ||uart_tx_stopped (&uap->port) ||uart_circ_empty (&uap->port.state->xmit)) { uap->dmatx.queued = false; -spin_unlock_irqrestore (&uap->port.lock, flags); +uart_port_unlock_irqrestore (&uap->port, flags);return ; }
@@ -580,7 +580,7 @@ static void pl011_dma_tx_callback(void *data)*/ pl011_start_tx_pio (uap); -spin_unlock_irqrestore (&uap->port.lock, flags); +uart_port_unlock_irqrestore (&uap->port, flags); }/*
@@ -1009,7 +1009,7 @@ static void pl011_dma_rx_callback(void *data)* routine to flush out the secondary DMA buffer while * we immediately trigger the next DMA job. */ -spin_lock_irq (&uap->port.lock); +uart_port_lock_irq (&uap->port);/* * Rx data can be taken by the UART interrupts during * the DMA irq handler. So we check the residue here.
@@ -1025,7 +1025,7 @@ static void pl011_dma_rx_callback(void *data) ret =pl011_dma_rx_trigger_dma (uap);pl011_dma_rx_chars (uap, pending, lastbuf, false); -spin_unlock_irq (&uap->port.lock); +uart_port_unlock_irq (&uap->port);/* * Do this check after we picked the DMA chars so we don't * get some IRQ immediately from RX.
@@ -1091,11 +1091,11 @@ static void pl011_dma_rx_poll(struct timer_list *t)if (jiffies_to_msecs (jiffies - dmarx->last_jiffies) > uap->dmarx.poll_timeout) { -spin_lock_irqsave (&uap->port.lock, flags); +uart_port_lock_irqsave (&uap->port, &flags);pl011_dma_rx_stop (uap); uap->im |=UART011_RXIM ;pl011_write (uap->im, uap,REG_IMSC ); -spin_unlock_irqrestore (&uap->port.lock, flags); +uart_port_unlock_irqrestore (&uap->port, flags); uap->dmarx.running = false;dmaengine_terminate_all (rxchan);
@@ -1191,10 +1191,10 @@ static void pl011_dma_shutdown(struct uart_amba_port *uap)while (pl011_read (uap,REG_FR ) & uap->vendor->fr_busy)cpu_relax (); -spin_lock_irq (&uap->port.lock); +uart_port_lock_irq (&uap->port); uap->dmacr &= ~(UART011_DMAONERR |UART011_RXDMAE |UART011_TXDMAE );pl011_write (uap->dmacr, uap,REG_DMACR ); -spin_unlock_irq (&uap->port.lock); +uart_port_unlock_irq (&uap->port);if (uap->using_tx_dma) {/* In theory, this should already be done by pl011_dma_flush_buffer */
@@ -1405,9 +1405,9 @@ static void pl011_throttle_rx(struct uart_port *port) {unsigned long flags; -spin_lock_irqsave (&port->lock, flags); +uart_port_lock_irqsave (port, &flags);pl011_stop_rx (port); -spin_unlock_irqrestore (&port->lock, flags); +uart_port_unlock_irqrestore (port, flags); }static void pl011_enable_ms (struct uart_port *port)
@@ -1425,7 +1425,7 @@ __acquires(&uap->port.lock) {pl011_fifo_to_tty (uap); -spin_unlock (&uap->port.lock); +uart_port_unlock (&uap->port);tty_flip_buffer_push (&uap->port.state->port);/* * If we were temporarily out of DMA mode for a while,
@@ -1450,7 +1450,7 @@ __acquires(&uap->port.lock)#endif } } -spin_lock (&uap->port.lock); +uart_port_lock (&uap->port); } static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c,
@@ -1556,7 +1556,7 @@ static irqreturn_t pl011_int(int irq, void *dev_id)unsigned int status, pass_counter =AMBA_ISR_PASS_LIMIT ;int handled =0 ; -spin_lock_irqsave (&uap->port.lock, flags); +uart_port_lock_irqsave (&uap->port, &flags); status =pl011_read (uap,REG_RIS ) & uap->im;if (status) { do {
@@ -1586,7 +1586,7 @@ static irqreturn_t pl011_int(int irq, void *dev_id) handled =1 ; } -spin_unlock_irqrestore (&uap->port.lock, flags); +uart_port_unlock_irqrestore (&uap->port, flags);return IRQ_RETVAL (handled); }
@@ -1658,14 +1658,14 @@ static void pl011_break_ctl(struct uart_port *port, int break_state)unsigned long flags;unsigned int lcr_h; -spin_lock_irqsave (&uap->port.lock, flags); +uart_port_lock_irqsave (&uap->port, &flags); lcr_h =pl011_read (uap,REG_LCRH_TX );if (break_state ==-1 ) lcr_h |= UART01x_LCRH_BRK;else lcr_h &= ~UART01x_LCRH_BRK;pl011_write (lcr_h, uap,REG_LCRH_TX ); -spin_unlock_irqrestore (&uap->port.lock, flags); +uart_port_unlock_irqrestore (&uap->port, flags); }#ifdef CONFIG_CONSOLE_POLL
@@ -1804,7 +1804,7 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)unsigned long flags;unsigned int i; -spin_lock_irqsave (&uap->port.lock, flags); +uart_port_lock_irqsave (&uap->port, &flags);/* Clear out any spuriously appearing RX interrupts */ pl011_write (UART011_RTIS |UART011_RXIS , uap,REG_ICR );
@@ -1826,7 +1826,7 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)if (!pl011_dma_rx_running (uap)) uap->im |=UART011_RXIM ;pl011_write (uap->im, uap,REG_IMSC ); -spin_unlock_irqrestore (&uap->port.lock, flags); +uart_port_unlock_irqrestore (&uap->port, flags); }static void pl011_unthrottle_rx (struct uart_port *port)
@@ -1834,7 +1834,7 @@ static void pl011_unthrottle_rx(struct uart_port *port) struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);unsigned long flags; -spin_lock_irqsave (&uap->port.lock, flags); +uart_port_lock_irqsave (&uap->port, &flags); uap->im =UART011_RTIM ;if (!pl011_dma_rx_running (uap))
@@ -1842,7 +1842,7 @@ static void pl011_unthrottle_rx(struct uart_port *port)pl011_write (uap->im, uap,REG_IMSC ); -spin_unlock_irqrestore (&uap->port.lock, flags); +uart_port_unlock_irqrestore (&uap->port, flags); }static int pl011_startup (struct uart_port *port)
@@ -1862,7 +1862,7 @@ static int pl011_startup(struct uart_port *port)pl011_write (uap->vendor->ifls, uap,REG_IFLS ); -spin_lock_irq (&uap->port.lock); +uart_port_lock_irq (&uap->port);/* restore RTS and DTR */ cr = uap->old_cr & (UART011_CR_RTS |UART011_CR_DTR );
@@ -1873,7 +1873,7 @@ static int pl011_startup(struct uart_port *port)pl011_write (cr, uap,REG_CR ); -spin_unlock_irq (&uap->port.lock); +uart_port_unlock_irq (&uap->port);/* * initialise the old status of the modem signals
@@ -1934,13 +1934,13 @@ static void pl011_disable_uart(struct uart_amba_port *uap)unsigned int cr; uap->port.status &= ~(UPSTAT_AUTOCTS |UPSTAT_AUTORTS ); -spin_lock_irq (&uap->port.lock); +uart_port_lock_irq (&uap->port); cr =pl011_read (uap,REG_CR ); uap->old_cr = cr; cr &=UART011_CR_RTS |UART011_CR_DTR ; cr |= UART01x_CR_UARTEN |UART011_CR_TXE ;pl011_write (cr, uap,REG_CR ); -spin_unlock_irq (&uap->port.lock); +uart_port_unlock_irq (&uap->port);/* * disable break condition and fifos
@@ -1952,14 +1952,14 @@ static void pl011_disable_uart(struct uart_amba_port *uap)static void pl011_disable_interrupts (struct uart_amba_port *uap) { -spin_lock_irq (&uap->port.lock); +uart_port_lock_irq (&uap->port);/* mask all interrupts and clear all pending ones */ uap->im =0 ;pl011_write (uap->im, uap,REG_IMSC );pl011_write (0xffff , uap,REG_ICR ); -spin_unlock_irq (&uap->port.lock); +uart_port_unlock_irq (&uap->port); }static void pl011_shutdown (struct uart_port *port)
@@ -2104,7 +2104,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, bits =tty_get_frame_size (termios->c_cflag); -spin_lock_irqsave (&port->lock, flags); +uart_port_lock_irqsave (port, &flags);/* * Update the per-port timeout.
@@ -2171,7 +2171,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,pl011_write_lcr_h (uap, lcr_h);pl011_write (old_cr, uap,REG_CR ); -spin_unlock_irqrestore (&port->lock, flags); +uart_port_unlock_irqrestore (port, flags); } static void
@@ -2189,10 +2189,10 @@ sbsa_uart_set_termios(struct uart_port *port, struct ktermios *termios, termios->c_cflag &= ~(CMSPAR |CRTSCTS ); termios->c_cflag |=CS8 |CLOCAL ; -spin_lock_irqsave (&port->lock, flags); +uart_port_lock_irqsave (port, &flags);uart_update_timeout (port,CS8 , uap->fixed_baud);pl011_setup_status_masks (port, termios); -spin_unlock_irqrestore (&port->lock, flags); +uart_port_unlock_irqrestore (port, flags); }static const char *pl011_type (struct uart_port *port)
@@ -2345,9 +2345,9 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)if (uap->port.sysrq) locked =0 ;else if (oops_in_progress) - locked =spin_trylock (&uap->port.lock); + locked =uart_port_trylock (&uap->port);else -spin_lock (&uap->port.lock); +uart_port_lock (&uap->port);/* * First save the CR then disable the interrupts
@@ -2373,7 +2373,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)pl011_write (old_cr, uap,REG_CR );if (locked) -spin_unlock (&uap->port.lock); +uart_port_unlock (&uap->port);local_irq_restore (flags);clk_disable (uap->clk);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 431/565 serial: amba-pl011: Fix RX stall when DMA is used
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kartik Rajput <[email protected]>
[ Upstream commit 2bcacc1c87acf9a8ebc17de18cb2b3cfeca547cf ]
Function pl011_throttle_rx() calls pl011_stop_rx() to disable RX, which also disables the RX DMA by clearing the RXDMAE bit of the DMACR register. However, to properly unthrottle RX when DMA is used, the function pl011_unthrottle_rx() is expected to set the RXDMAE bit of the DMACR register, which it currently lacks. This causes RX to stall after the throttle API is called.
Set RXDMAE bit in the DMACR register while unthrottling RX if RX DMA is used.
--- drivers/tty/serial/amba-pl011.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/amba-pl011.c +5 -0
@@ -1842,6 +1842,11 @@ static void pl011_unthrottle_rx(struct uart_port *port)pl011_write (uap->im, uap,REG_IMSC ); +if (uap->using_rx_dma) { + uap->dmacr |=UART011_RXDMAE ; +pl011_write (uap->dmacr, uap,REG_DMACR ); + } +uart_port_unlock_irqrestore (&uap->port, flags); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 432/565 bpftool: Remove asserts from JIT disassembler
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quentin Monnet <[email protected]>
[ Upstream commit 55b4de58d0e2aca810ed2b198a0173640300acf8 ]
The JIT disassembler in bpftool is the only components (with the JSON writer) using asserts to check the return values of functions. But it does not do so in a consistent way, and diasm_print_insn() returns no value, although sometimes the operation failed.
Remove the asserts, and instead check the return values, print messages on errors, and propagate the error to the caller from prog.c.
Remove the inclusion of assert.h from jit_disasm.c, and also from map.c where it is unused.
Stable-dep-of: ef3ba8c258ee ("bpftool: fix potential NULL pointer dereferencing in prog_dump()")
--- tools/bpf/bpftool/jit_disasm.c | 51 +++++++++++++++++++++++----------- tools/bpf/bpftool/main.h | 25 +++++++++-------- tools/bpf/bpftool/map.c | 1 - tools/bpf/bpftool/prog.c | 15 ++++++---- 4 files changed, 57 insertions(+), 35 deletions(-)
tools/bpf/bpftool/jit_disasm.c +35 -16
@@ -16,7 +16,6 @@#include <stdarg.h> #include <stdint.h> #include <stdlib.h> -#include <assert.h> #include <unistd.h> #include <string.h> #include <bfd.h>
@@ -29,14 +28,18 @@#include "json_writer.h" #include "main.h" -static void get_exec_path (char *tpath,size_t size) +static int get_exec_path (char *tpath,size_t size) {const char *path ="/proc/self/exe" ;ssize_t len; len =readlink (path, tpath, size -1 ); -assert (len >0 ); +if (len <=0 ) +return -1 ; + tpath[len] =0 ; + +return 0 ; }static int oper_count;
@@ -97,30 +100,39 @@ static int fprintf_json_styled(void *out,return r; } -void disasm_print_insn (unsigned char *image,ssize_t len,int opcodes, -const char *arch,const char *disassembler_options, -const struct btf *btf, -const struct bpf_prog_linfo *prog_linfo, -__u64 func_ksym,unsigned int func_idx, -bool linum) +int disasm_print_insn (unsigned char *image,ssize_t len,int opcodes, +const char *arch,const char *disassembler_options, +const struct btf *btf, +const struct bpf_prog_linfo *prog_linfo, +__u64 func_ksym,unsigned int func_idx, +bool linum) {const struct bpf_line_info *linfo =NULL ;disassembler_ftype disassemble; +int count, i, pc =0 , err =-1 ;struct disassemble_info info;unsigned int nr_skip =0 ; -int count, i, pc =0 ;char tpath[PATH_MAX ];bfd *bfdf;if (!len) -return ; +return -1 ;memset (tpath,0 ,sizeof (tpath)); -get_exec_path (tpath,sizeof (tpath)); +if (get_exec_path (tpath,sizeof (tpath))) { +p_err ("failed to create disasembler (get_exec_path)" ); +return -1 ; + } bfdf =bfd_openr (tpath,NULL ); -assert (bfdf); -assert (bfd_check_format (bfdf, bfd_object)); +if (!bfdf) { +p_err ("failed to create disassembler (bfd_openr)" ); +return -1 ; + } +if (!bfd_check_format (bfdf, bfd_object)) { +p_err ("failed to create disassembler (bfd_check_format)" ); + goto exit_close; + }if (json_output) init_disassemble_info_compat(&info, stdout,
@@ -139,7 +151,7 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes, bfdf->arch_info = inf; }else {p_err ("No libbfd support for %s" , arch); -return ; + goto exit_close; } }
@@ -160,7 +172,10 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,#else disassemble =disassembler (bfdf);#endif -assert (disassemble); +if (!disassemble) { +p_err ("failed to create disassembler" ); + goto exit_close; + }if (json_output)jsonw_start_array (json_wtr);
@@ -224,7 +239,11 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,if (json_output)jsonw_end_array (json_wtr); + err =0 ; + +exit_close:bfd_close (bfdf); +return err; }int disasm_init (void )
tools/bpf/bpftool/main.h +13 -12
@@ -193,22 +193,23 @@ int map_parse_fd_and_info(int *argc, char ***argv, void *info, __u32 *info_len);struct bpf_prog_linfo ;#ifdef HAVE_LIBBFD_SUPPORT -void disasm_print_insn (unsigned char *image,ssize_t len,int opcodes, -const char *arch,const char *disassembler_options, -const struct btf *btf, -const struct bpf_prog_linfo *prog_linfo, -__u64 func_ksym,unsigned int func_idx, -bool linum); +int disasm_print_insn (unsigned char *image,ssize_t len,int opcodes, +const char *arch,const char *disassembler_options, +const struct btf *btf, +const struct bpf_prog_linfo *prog_linfo, +__u64 func_ksym,unsigned int func_idx, +bool linum);int disasm_init (void );#else static inline -void disasm_print_insn (unsigned char *image,ssize_t len,int opcodes, -const char *arch,const char *disassembler_options, -const struct btf *btf, -const struct bpf_prog_linfo *prog_linfo, -__u64 func_ksym,unsigned int func_idx, -bool linum) +int disasm_print_insn (unsigned char *image,ssize_t len,int opcodes, +const char *arch,const char *disassembler_options, +const struct btf *btf, +const struct bpf_prog_linfo *prog_linfo, +__u64 func_ksym,unsigned int func_idx, +bool linum) { +return 0 ; }static inline int disasm_init (void ) {
tools/bpf/bpftool/map.c +0 -1
@@ -1,7 +1,6 @@// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2017-2018 Netronome Systems, Inc. */ -#include <assert.h> #include <errno.h> #include <fcntl.h> #include <linux/err.h>
tools/bpf/bpftool/prog.c +9 -6
@@ -744,10 +744,11 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,printf ("%s:\n" , sym_name); } -disasm_print_insn (img, lens[i], opcodes, - name, disasm_opt, btf, - prog_linfo, ksyms[i], i, - linum); +if (disasm_print_insn (img, lens[i], opcodes, + name, disasm_opt, btf, + prog_linfo, ksyms[i], i, + linum)) + goto exit_free; img += lens[i];
@@ -760,8 +761,10 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,if (json_output)jsonw_end_array (json_wtr); }else { -disasm_print_insn (buf, member_len, opcodes, name, - disasm_opt, btf,NULL ,0 ,0 , false); +if (disasm_print_insn (buf, member_len, opcodes, name, + disasm_opt, btf,NULL ,0 ,0 , + false)) + goto exit_free; } }else if (visual) {if (json_output)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 433/565 bpftool: fix potential NULL pointer dereferencing in prog_dump()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Mohammadi <[email protected]>
[ Upstream commit ef3ba8c258ee368a5343fa9329df85b4bcb9e8b5 ]
A NULL pointer dereference could occur if ksyms
is not properly checked before usage in the prog_dump() function.
--- tools/bpf/bpftool/prog.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
tools/bpf/bpftool/prog.c +12 -5
@@ -744,11 +744,18 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,printf ("%s:\n" , sym_name); } -if (disasm_print_insn (img, lens[i], opcodes, - name, disasm_opt, btf, - prog_linfo, ksyms[i], i, - linum)) - goto exit_free; +if (ksyms) { +if (disasm_print_insn (img, lens[i], opcodes, + name, disasm_opt, btf, + prog_linfo, ksyms[i], i, + linum)) + goto exit_free; + }else { +if (disasm_print_insn (img, lens[i], opcodes, + name, disasm_opt, btf, +NULL ,0 ,0 , false)) + goto exit_free; + } img += lens[i];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 434/565 drm/sti: Add __iomem for mixer_dbg_mxns parameter
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 86e8f94789dd6f3e705bfa821e1e416f97a2f863 ]
Sparse complains about incorrect type in argument 1. expected void const volatile __iomem *ptr but got void *. so modify mixer_dbg_mxn's addr parameter.
--- drivers/gpu/drm/sti/sti_mixer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_mixer.c +1 -1
@@ -137,7 +137,7 @@ static void mixer_dbg_crb(struct seq_file *s, int val) } } -static void mixer_dbg_mxn (struct seq_file *s,void *addr) +static void mixer_dbg_mxn (struct seq_file *s,void __iomem *addr) {int i;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 435/565 tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijian Zhang <[email protected]>
[ Upstream commit ca70b8baf2bd125b2a4d96e76db79375c07d7ff2 ]
The current sk memory accounting logic in __SK_REDIRECT is pre-uncharging tosend bytes, which is either msg->sg.size or a smaller value apply_bytes.
Potential problems with this strategy are as follows:
- If the actual sent bytes are smaller than tosend, we need to charge some bytes back, as in line 487, which is okay but seems not clean.
- When tosend is set to apply_bytes, as in line 417, and (ret < 0), we may miss uncharging (msg->sg.size - apply_bytes) bytes.
[...]
415 tosend = msg->sg.size;
416 if (psock->apply_bytes && psock->apply_bytes < tosend)
417 tosend = psock->apply_bytes;
[...]
443 sk_msg_return(sk, msg, tosend);
444 release_sock(sk);
446 origsize = msg->sg.size;
447 ret = tcp_bpf_sendmsg_redir(sk_redir, redir_ingress,
448 msg, tosend, flags);
449 sent = origsize - msg->sg.size;
[...]
454 lock_sock(sk);
455 if (unlikely(ret < 0)) {
456 int free = sk_msg_free_nocharge(sk, msg);
458 if (!cork)
459 *copied -= free;
460 }
[...]
487 if (eval == __SK_REDIRECT)
488 sk_mem_charge(sk, tosend - sent);
[...]
When running the selftest test_txmsg_redir_wait_sndmem with txmsg_apply, the following warning will be reported:
------------[ cut here ]------------ WARNING: CPU: 6 PID: 57 at net/ipv4/af_inet.c:156 inet_sock_destruct+0x190/0x1a0 Modules linked in: CPU: 6 UID: 0 PID: 57 Comm: kworker/6:0 Not tainted 6.12.0-rc1.bm.1-amd64+ #43 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Workqueue: events sk_psock_destroy RIP: 0010:inet_sock_destruct+0x190/0x1a0 RSP: 0018:ffffad0a8021fe08 EFLAGS: 00010206 RAX: 0000000000000011 RBX: ffff9aab4475b900 RCX: ffff9aab481a0800 RDX: 0000000000000303 RSI: 0000000000000011 RDI: ffff9aab4475b900 RBP: ffff9aab4475b990 R08: 0000000000000000 R09: ffff9aab40050ec0 R10: 0000000000000000 R11: ffff9aae6fdb1d01 R12: ffff9aab49c60400 R13: ffff9aab49c60598 R14: ffff9aab49c60598 R15: dead000000000100 FS: 0000000000000000(0000) GS:ffff9aae6fd80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffec7e47bd8 CR3: 00000001a1a1c004 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __warn+0x89/0x130 ? inet_sock_destruct+0x190/0x1a0 ? report_bug+0xfc/0x1e0 ? handle_bug+0x5c/0xa0 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? inet_sock_destruct+0x190/0x1a0 __sk_destruct+0x25/0x220 sk_psock_destroy+0x2b2/0x310 process_scheduled_works+0xa3/0x3e0 worker_thread+0x117/0x240 ? __pfx_worker_thread+0x10/0x10 kthread+0xcf/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x31/0x40 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> ---[ end trace 0000000000000000 ]---
In __SK_REDIRECT, a more concise way is delaying the uncharging after sent bytes are finalized, and uncharge this value. When (ret < 0), we shall invoke sk_msg_free.
Same thing happens in case __SK_DROP, when tosend is set to apply_bytes, we may miss uncharging (msg->sg.size - apply_bytes) bytes. The same warning will be reported in selftest.
[...]
468 case __SK_DROP:
469 default:
470 sk_msg_free_partial(sk, msg, tosend);
471 sk_msg_apply_bytes(psock, tosend);
472 *copied -= (tosend + delta);
473 return -EACCES;
[...]
So instead of sk_msg_free_partial we can do sk_msg_free here.
--- net/ipv4/tcp_bpf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
net/ipv4/tcp_bpf.c +4 -7
@@ -396,7 +396,6 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, cork = true; psock->cork =NULL ; } -sk_msg_return (sk, msg, tosend);release_sock (sk); origsize = msg->sg.size;
@@ -408,8 +407,9 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock,sock_put (sk_redir);lock_sock (sk); +sk_mem_uncharge (sk, sent);if (unlikely (ret <0 )) { -int free =sk_msg_free_nocharge (sk, msg); +int free =sk_msg_free (sk, msg);if (!cork) *copied -= free;
@@ -423,7 +423,7 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock,break ;case __SK_DROP:default : -sk_msg_free_partial (sk, msg, tosend); +sk_msg_free (sk, msg);sk_msg_apply_bytes (psock, tosend); *copied -= (tosend + delta);return -EACCES ;
@@ -439,11 +439,8 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, }if (msg && msg->sg.data[msg->sg.start].page_link && - msg->sg.data[msg->sg.start].length) { -if (eval == __SK_REDIRECT) -sk_mem_charge (sk, tosend - sent); + msg->sg.data[msg->sg.start].length) goto more_data; - } }return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 436/565 ALSA: pcm: Add more disconnection checks at file ops
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 36df2427ac3ea04510368561c8cee22388a7434a ]
In the case of hot-disconnection of a PCM device, all file operations except for close should be rejected. This patch adds more sanity checks in the file operation code paths.
Stable-dep-of: 4f9d674377d0 ("ALSA: usb-audio: Notify xrun for low-latency mode")
--- sound/core/pcm_native.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
sound/core/pcm_native.c +21 -4
@@ -3283,6 +3283,9 @@ static int snd_pcm_common_ioctl(struct file *file,if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; +if (substream->runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED ) +return -EBADFD ; + res =snd_power_wait (substream->pcm->card);if (res <0 )return res;
@@ -3409,6 +3412,9 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,snd_pcm_uframes_t *frames = arg;snd_pcm_sframes_t result; +if (substream->runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED ) +return -EBADFD ; +switch (cmd) {case SNDRV_PCM_IOCTL_FORWARD : {
@@ -3451,7 +3457,8 @@ static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count,if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; runtime = substream->runtime; -if (runtime->status->state ==SNDRV_PCM_STATE_OPEN ) +if (runtime->status->state ==SNDRV_PCM_STATE_OPEN || + runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED )return -EBADFD ;if (!frame_aligned (runtime, count))return -EINVAL ;
@@ -3475,7 +3482,8 @@ static ssize_t snd_pcm_write(struct file *file, const char __user *buf,if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; runtime = substream->runtime; -if (runtime->status->state ==SNDRV_PCM_STATE_OPEN ) +if (runtime->status->state ==SNDRV_PCM_STATE_OPEN || + runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED )return -EBADFD ;if (!frame_aligned (runtime, count))return -EINVAL ;
@@ -3501,7 +3509,8 @@ static ssize_t snd_pcm_readv(struct kiocb *iocb, struct iov_iter *to)if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; runtime = substream->runtime; -if (runtime->status->state ==SNDRV_PCM_STATE_OPEN ) +if (runtime->status->state ==SNDRV_PCM_STATE_OPEN || + runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED )return -EBADFD ;if (!iter_is_iovec (to))return -EINVAL ;
@@ -3537,7 +3546,8 @@ static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from)if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; runtime = substream->runtime; -if (runtime->status->state ==SNDRV_PCM_STATE_OPEN ) +if (runtime->status->state ==SNDRV_PCM_STATE_OPEN || + runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED )return -EBADFD ;if (!iter_is_iovec (from))return -EINVAL ;
@@ -3576,6 +3586,9 @@ static __poll_t snd_pcm_poll(struct file *file, poll_table *wait)return ok |EPOLLERR ; runtime = substream->runtime; +if (runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED ) +return ok |EPOLLERR ; +poll_wait (file, &runtime->sleep, wait); mask =0 ;
@@ -3887,6 +3900,8 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) substream = pcm_file->substream;if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; +if (substream->runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED ) +return -EBADFD ; offset = area->vm_pgoff <<PAGE_SHIFT ;switch (offset) {
@@ -3923,6 +3938,8 @@ static int snd_pcm_fasync(int fd, struct file * file, int on)if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; runtime = substream->runtime; +if (runtime->status->state ==SNDRV_PCM_STATE_DISCONNECTED ) +return -EBADFD ;return fasync_helper (fd, file, on, &runtime->fasync); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 437/565 ALSA: pcm: Avoid reference to status->state
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit f0061c18c169f0c32d96b59485c3edee85e343ed ]
In the PCM core and driver code, there are lots place referring to the current PCM state via runtime->status->state. This patch introduced a local PCM state in runtime itself and replaces those references with runtime->state. It has improvements in two aspects:
- The reduction of a indirect access leads to more code optimization
- It avoids a possible (unexpected) modification of the state via mmap of the status record
The status->state is updated together with runtime->state, so that user-space can still read the current state via mmap like before, too.
This patch touches only the ALSA core code. The changes in each driver will follow in later patches.
Stable-dep-of: 4f9d674377d0 ("ALSA: usb-audio: Notify xrun for low-latency mode")
--- include/sound/pcm.h | 20 +++++- sound/core/oss/pcm_oss.c | 42 ++++++------- sound/core/pcm.c | 9 +-- sound/core/pcm_compat.c | 4 +- sound/core/pcm_lib.c | 16 ++--- sound/core/pcm_native.c | 127 ++++++++++++++++++++------------------- 6 files changed, 118 insertions(+), 100 deletions(-)
include/sound/pcm.h +18 -2
@@ -343,6 +343,8 @@ static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracystruct snd_pcm_runtime {/* -- Status -- */ +snd_pcm_state_t state;/* stream state */ +snd_pcm_state_t suspended_state;/* suspended stream state */ struct snd_pcm_substream *trigger_master;struct timespec64 trigger_tstamp;/* trigger timestamp */ bool trigger_tstamp_latched;/* trigger timestamp latched in low-level driver/hardware */
@@ -675,11 +677,25 @@ void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,*/ static inline int snd_pcm_running (struct snd_pcm_substream *substream) { -return (substream->runtime->status->state ==SNDRV_PCM_STATE_RUNNING || - (substream->runtime->status->state ==SNDRV_PCM_STATE_DRAINING && +return (substream->runtime->state ==SNDRV_PCM_STATE_RUNNING || + (substream->runtime->state ==SNDRV_PCM_STATE_DRAINING && substream->stream ==SNDRV_PCM_STREAM_PLAYBACK )); } +/** +* __snd_pcm_set_state - Change the current PCM state +* @runtime: PCM runtime to set +* @state: the current state to set +* +* Call within the stream lock +*/ +static inline void __snd_pcm_set_state (struct snd_pcm_runtime *runtime, +snd_pcm_state_t state) +{ + runtime->state = state; + runtime->status->state = state;/* copy for mmap */ +} +/** * bytes_to_samples - Unit conversion of the size from bytes to samples * @runtime: PCM runtime instance
sound/core/oss/pcm_oss.c +21 -21
124 lines not on this page · raw message
sound/core/pcm.c +5 -4
@@ -386,7 +386,7 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,snd_iprintf (buffer,"closed\n" ); goto unlock; } -if (runtime->status->state ==SNDRV_PCM_STATE_OPEN ) { +if (runtime->state ==SNDRV_PCM_STATE_OPEN ) {snd_iprintf (buffer,"no setup\n" ); goto unlock; }
@@ -423,7 +423,7 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,snd_iprintf (buffer,"closed\n" ); goto unlock; } -if (runtime->status->state ==SNDRV_PCM_STATE_OPEN ) { +if (runtime->state ==SNDRV_PCM_STATE_OPEN ) {snd_iprintf (buffer,"no setup\n" ); goto unlock; }
@@ -969,7 +969,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,init_waitqueue_head (&runtime->sleep);init_waitqueue_head (&runtime->tsleep); - runtime->status->state =SNDRV_PCM_STATE_OPEN ; +__snd_pcm_set_state (runtime,SNDRV_PCM_STATE_OPEN );mutex_init (&runtime->buffer_mutex);atomic_set (&runtime->buffer_accessing,0 );
@@ -1110,7 +1110,8 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)if (snd_pcm_running (substream))snd_pcm_stop (substream,SNDRV_PCM_STATE_DISCONNECTED );/* to be sure, set the state unconditionally */ - substream->runtime->status->state =SNDRV_PCM_STATE_DISCONNECTED ; +__snd_pcm_set_state (substream->runtime, +SNDRV_PCM_STATE_DISCONNECTED );wake_up (&substream->runtime->sleep);wake_up (&substream->runtime->tsleep); }
sound/core/pcm_compat.c +2 -2
@@ -299,7 +299,7 @@ static int snd_pcm_ioctl_xferi_compat(struct snd_pcm_substream *substream,return -ENOTTY ;if (substream->stream != dir)return -EINVAL ; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) +if (substream->runtime->state ==SNDRV_PCM_STATE_OPEN )return -EBADFD ; if (get_user(buf, &data32->buf) ||
@@ -345,7 +345,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,return -ENOTTY ;if (substream->stream != dir)return -EINVAL ; -if (substream->runtime->status->state ==SNDRV_PCM_STATE_OPEN ) +if (substream->runtime->state ==SNDRV_PCM_STATE_OPEN )return -EBADFD ; ch = substream->runtime->channels;
sound/core/pcm_lib.c +8 -8
@@ -185,7 +185,7 @@ int snd_pcm_update_state(struct snd_pcm_substream *substream, avail =snd_pcm_avail (substream);if (avail > runtime->avail_max) runtime->avail_max = avail; -if (runtime->status->state ==SNDRV_PCM_STATE_DRAINING ) { +if (runtime->state ==SNDRV_PCM_STATE_DRAINING ) {if (avail >= runtime->buffer_size) {snd_pcm_drain_done (substream);return -EPIPE ;
@@ -1910,7 +1910,7 @@ static int wait_for_avail(struct snd_pcm_substream *substream,snd_pcm_stream_lock_irq (substream);set_current_state (TASK_INTERRUPTIBLE ); -switch (runtime->status->state) { +switch (runtime->state) {case SNDRV_PCM_STATE_SUSPENDED : err = -ESTRPIPE ; goto _endloop;
@@ -2098,14 +2098,14 @@ static int pcm_sanity_check(struct snd_pcm_substream *substream) runtime = substream->runtime;if (snd_BUG_ON (!substream->ops->copy_user && !runtime->dma_area))return -EINVAL ; -if (runtime->status->state ==SNDRV_PCM_STATE_OPEN ) +if (runtime->state ==SNDRV_PCM_STATE_OPEN )return -EBADFD ;return 0 ; }static int pcm_accessible_state (struct snd_pcm_runtime *runtime) { -switch (runtime->status->state) { +switch (runtime->state) {case SNDRV_PCM_STATE_PREPARED :case SNDRV_PCM_STATE_RUNNING :case SNDRV_PCM_STATE_PAUSED :
@@ -2209,7 +2209,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, goto _end_unlock; runtime->twake = runtime->control->avail_min ? :1 ; -if (runtime->status->state ==SNDRV_PCM_STATE_RUNNING ) +if (runtime->state ==SNDRV_PCM_STATE_RUNNING )snd_pcm_update_hw_ptr (substream);/*
@@ -2217,7 +2217,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,* thread may start capture */ if (!is_playback && - runtime->status->state ==SNDRV_PCM_STATE_PREPARED && + runtime->state ==SNDRV_PCM_STATE_PREPARED && size >= runtime->start_threshold) { err =snd_pcm_start (substream);if (err <0 )
@@ -2231,7 +2231,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,snd_pcm_uframes_t cont;if (!avail) {if (!is_playback && - runtime->status->state ==SNDRV_PCM_STATE_DRAINING ) { + runtime->state ==SNDRV_PCM_STATE_DRAINING ) {snd_pcm_stop (substream,SNDRV_PCM_STATE_SETUP ); goto _end_unlock; }
@@ -2283,7 +2283,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, xfer += frames; avail -= frames;if (is_playback && - runtime->status->state ==SNDRV_PCM_STATE_PREPARED && + runtime->state ==SNDRV_PCM_STATE_PREPARED &&snd_pcm_playback_hw_avail (runtime) >= (snd_pcm_sframes_t )runtime->start_threshold) { err =snd_pcm_start (substream);if (err <0 )
sound/core/pcm_native.c +64 -63
418 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 438/565 ALSA: usb-audio: Notify xrun for low-latency mode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 4f9d674377d090e38d93360bd4df21b67534d622 ]
The low-latency mode of USB-audio driver uses a similar approach like the implicit feedback mode but it has an explicit queuing at the trigger start time. The difference is, however, that no packet will be handled any longer after all queued packets are handled but no enough data is fed. In the case of implicit feedback mode, the capture-side packet handling triggers the re-queuing, and this checks the XRUN. OTOH, in the low-latency mode, it just stops without XRUN notification unless any new action is taken from user-space via ack callback. For example, when you stop the stream in aplay, no XRUN is reported.
This patch adds the XRUN check at the packet complete callback in the case all pending URBs are exhausted. Strictly speaking, this state doesn't match really with XRUN; in theory the application may queue immediately after this happens. But such behavior is only for 1-period configuration, which the USB-audio driver doesn't support. So we may conclude that this situation leads certainly to XRUN.
A caveat is that the XRUN should be triggered only for the PCM RUNNING state, and not during DRAINING. This additional state check is put in notify_xrun(), too.
--- sound/usb/endpoint.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
sound/usb/endpoint.c +11 -3
@@ -402,10 +402,15 @@ static int prepare_inbound_urb(struct snd_usb_endpoint *ep,static void notify_xrun (struct snd_usb_endpoint *ep) {struct snd_usb_substream *data_subs; +struct snd_pcm_substream *psubs; data_subs =READ_ONCE (ep->data_subs); -if (data_subs && data_subs->pcm_substream) -snd_pcm_stop_xrun (data_subs->pcm_substream); +if (!data_subs) +return ; + psubs = data_subs->pcm_substream; +if (psubs && psubs->runtime && + psubs->runtime->state ==SNDRV_PCM_STATE_RUNNING ) +snd_pcm_stop_xrun (psubs); } static struct snd_usb_packet_info *
@@ -556,7 +561,10 @@ static void snd_complete_urb(struct urb *urb)push_back_to_ready_list (ep, ctx);clear_bit (ctx->index, &ep->active_mask);snd_usb_queue_pending_output_urbs (ep, false); -atomic_dec (&ep->submitted_urbs);/* decrement at last */ +/* decrement at last, and check xrun */ +if (atomic_dec_and_test (&ep->submitted_urbs) && + !snd_usb_endpoint_implicit_feedback_sink (ep)) +notify_xrun (ep);return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 439/565 tools: Override makefile ARCH variable if defined, but empty
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Björn Töpel <[email protected]>
[ Upstream commit 537a2525eaf76ea9b0dca62b994500d8670b39d5 ]
There are a number of tools (bpftool, selftests), that require a "bootstrap" build. Here, a bootstrap build is a build host variant of a target. E.g., assume that you're performing a bpftool cross-build on x86 to riscv, a bootstrap build would then be an x86 variant of bpftool. The typical way to perform the host build variant, is to pass "ARCH=" in a sub-make. However, if a variable has been set with a command argument, then ordinary assignments in the makefile are ignored.
This side-effect results in that ARCH, and variables depending on ARCH are not set. Workaround by overriding ARCH to the host arch, if ARCH is empty.
--- tools/scripts/Makefile.arch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/scripts/Makefile.arch +2 -2
@@ -6,8 +6,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) -ifndef ARCH -ARCH := $(HOSTARCH) +ifeq ($(strip $(ARCH)),) +override ARCH := $(HOSTARCH) endif SRCARCH := $(ARCH)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 440/565 spi: mpc52xx: Add cancel_work_sync before module remove
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 984836621aad98802d92c4a3047114cf518074c8 ]
If we remove the module which will call mpc52xx_spi_remove it will free 'ms' through spi_unregister_controller. while the work ms->work will be used. The sequence of operations that may lead to a UAF bug.
Fix it by ensuring that the work is canceled before proceeding with the cleanup in mpc52xx_spi_remove.
--- drivers/spi/spi-mpc52xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-mpc52xx.c +1 -0
@@ -521,6 +521,7 @@ static int mpc52xx_spi_remove(struct platform_device *op)struct mpc52xx_spi *ms =spi_master_get_devdata (master);int i; +cancel_work_sync (&ms->work);free_irq (ms->irq0, ms);free_irq (ms->irq1, ms);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 441/565 drm/v3d: Enable Performance Counters before clearing them
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit c98b10496b2f3c4f576af3482c71aadcfcbf765e ]
On the Raspberry Pi 5, performance counters are not being cleared when v3d_perfmon_start() is called, even though we write to the CLR register. As a result, their values accumulate until they overflow.
The expected behavior is for performance counters to reset to zero at the start of a job. When the job finishes and the perfmon is stopped, the counters should accurately reflect the values for that specific job.
To ensure this behavior, the performance counters are now enabled before being cleared. This allows the CLR register to function as intended, zeroing the counter values when the job begins.
--- drivers/gpu/drm/v3d/v3d_perfmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/v3d/v3d_perfmon.c +1 -1
@@ -49,9 +49,9 @@ void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon)V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_SRC_X (source), channel); } +V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask);V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_CLR , mask);V3D_CORE_WRITE (0 ,V3D_PCTR_0_OVERFLOW , mask); -V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask); v3d->active_perfmon = perfmon; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 442/565 ocfs2: free inode when ocfs2_get_init_inode() fails
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 965b5dd1894f4525f38c1b5f99b0106a07dbb5db ]
syzbot is reporting busy inodes after unmount, for commit 9c89fe0af826 ("ocfs2: Handle error from dquot_initialize()") forgot to call iput() when new_inode() succeeded and dquot_initialize() failed.
--- fs/ocfs2/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/namei.c +3 -1
@@ -200,8 +200,10 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode) mode =mode_strip_sgid (&init_user_ns, dir, mode);inode_init_owner (&init_user_ns, inode, dir, mode); status =dquot_initialize (inode); -if (status) +if (status) { +iput (inode);return ERR_PTR (status); + }return inode; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 443/565 bpf: Handle BPF_EXIST and BPF_NOEXIST for LPM trie
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit eae6a075e9537dd69891cf77ca5a88fa8a28b4a1 ]
Add the currently missing handling for the BPF_EXIST and BPF_NOEXIST flags. These flags can be specified by users and are relevant since LPM trie supports exact matches during update.
--- kernel/bpf/lpm_trie.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
kernel/bpf/lpm_trie.c +20 -3
@@ -366,6 +366,10 @@ static int trie_update_elem(struct bpf_map *map,* simply assign the @new_node to that slot and be done. */ if (!node) { +if (flags ==BPF_EXIST ) { + ret = -ENOENT ; + goto out; + }rcu_assign_pointer (*slot, new_node); goto out; }
@@ -374,18 +378,31 @@ static int trie_update_elem(struct bpf_map *map,* which already has the correct data array set. */ if (node->prefixlen == matchlen) { +if (!(node->flags &LPM_TREE_NODE_FLAG_IM )) { +if (flags ==BPF_NOEXIST ) { + ret = -EEXIST ; + goto out; + } + trie->n_entries--; + }else if (flags ==BPF_EXIST ) { + ret = -ENOENT ; + goto out; + } + new_node->child[0 ] = node->child[0 ]; new_node->child[1 ] = node->child[1 ]; -if (!(node->flags &LPM_TREE_NODE_FLAG_IM )) - trie->n_entries--; -rcu_assign_pointer (*slot, new_node);kfree_rcu (node, rcu); goto out; } +if (flags ==BPF_EXIST ) { + ret = -ENOENT ; + goto out; + } +/* If the new node matches the prefix completely, it must be inserted * as an ancestor. Simply insert it between @node and *@slot. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 444/565 bpf: Fix exact match conditions in trie_get_next_key()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit 27abc7b3fa2e09bbe41e2924d328121546865eda ]
trie_get_next_key() uses node->prefixlen == key->prefixlen to identify an exact match, However, it is incorrect because when the target key doesn't fully match the found node (e.g., node->prefixlen != matchlen), these two nodes may also have the same prefixlen. It will return expected result when the passed key exist in the trie. However when a recently-deleted key or nonexistent key is passed to trie_get_next_key(), it may skip keys and return incorrect result.
Fix it by using node->prefixlen == matchlen to identify exact matches. When the condition is true after the search, it also implies node->prefixlen equals key->prefixlen, otherwise, the search would return NULL instead.
--- kernel/bpf/lpm_trie.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/lpm_trie.c +2 -2
@@ -639,7 +639,7 @@ static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key)struct lpm_trie_node **node_stack =NULL ;int err =0 , stack_ptr =-1 ;unsigned int next_bit; -size_t matchlen; +size_t matchlen =0 ;/* The get_next_key follows postorder. For the 4 node example in * the top of this file, the trie_get_next_key() returns the following
@@ -678,7 +678,7 @@ static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key) next_bit =extract_bit (key->data, node->prefixlen); node =rcu_dereference (node->child[next_bit]); } -if (!node || node->prefixlen != key->prefixlen || +if (!node || node->prefixlen != matchlen || (node->flags &LPM_TREE_NODE_FLAG_IM )) goto find_leftmost;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 445/565 HID: wacom: fix when get product name maybe null pointer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
commit 59548215b76be98cf3422eea9a67d6ea578aca3d upstream.
Due to incorrect dev->product reporting by certain devices, null pointer dereferences occur when dev->product is empty, leading to potential system crashes.
This issue was found on EXCELSIOR DL37-D05 device with Loongson-LS3A6000-7A2000-DL37 motherboard.
Kernel logs:
[ 56.470885] usb 4-3: new full-speed USB device number 4 using ohci-pci [ 56.671638] usb 4-3: string descriptor 0 read error: -22 [ 56.671644] usb 4-3: New USB device found, idVendor=056a, idProduct=0374, bcdDevice= 1.07 [ 56.671647] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 56.678839] hid-generic 0003:056A:0374.0004: hiddev0,hidraw3: USB HID v1.10 Device [HID 056a:0374] on usb-0000:00:05.0-3/input0 [ 56.697719] CPU 2 Unable to handle kernel paging request at virtual address 0000000000000000, era == 90000000066e35c8, ra == ffff800004f98a80 [ 56.697732] Oops[#1]: [ 56.697734] CPU: 2 PID: 2742 Comm: (udev-worker) Tainted: G OE 6.6.0-loong64-desktop #25.00.2000.015 [ 56.697737] Hardware name: Inspur CE520L2/C09901N000000000, BIOS 2.09.00 10/11/2024 [ 56.697739] pc 90000000066e35c8 ra ffff800004f98a80 tp 9000000125478000 sp 900000012547b8a0 [ 56.697741] a0 0000000000000000 a1 ffff800004818b28 a2 0000000000000000 a3 0000000000000000 [ 56.697743] a4 900000012547b8f0 a5 0000000000000000 a6 0000000000000000 a7 0000000000000000 [ 56.697745] t0 ffff800004818b2d t1 0000000000000000 t2 0000000000000003 t3 0000000000000005 [ 56.697747] t4 0000000000000000 t5 0000000000000000 t6 0000000000000000 t7 0000000000000000 [ 56.697748] t8 0000000000000000 u0 0000000000000000 s9 0000000000000000 s0 900000011aa48028 [ 56.697750] s1 0000000000000000 s2 0000000000000000 s3 ffff800004818e80 s4 ffff800004810000 [ 56.697751] s5 90000001000b98d0 s6 ffff800004811f88 s7 ffff800005470440 s8 0000000000000000 [ 56.697753] ra: ffff800004f98a80 wacom_update_name+0xe0/0x300 [wacom] [ 56.697802] ERA: 90000000066e35c8 strstr+0x28/0x120 [ 56.697806] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) [ 56.697816] PRMD: 0000000c (PPLV0 +PIE +PWE) [ 56.697821] EUEN: 00000000 (-FPE -SXE -ASXE -BTE) [ 56.697827] ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7) [ 56.697831] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0) [ 56.697835] BADV: 0000000000000000 [ 56.697836] PRID: 0014d000 (Loongson-64bit, Loongson-3A6000) [ 56.697838] Modules linked in: wacom(+) bnep bluetooth rfkill qrtr nls_iso8859_1 nls_cp437 snd_hda_codec_conexant snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore input_leds mousedev led_class joydev deepin_netmonitor(OE) fuse nfnetlink dmi_sysfs ip_tables x_tables overlay amdgpu amdxcp drm_exec gpu_sched drm_buddy radeon drm_suballoc_helper i2c_algo_bit drm_ttm_helper r8169 ttm drm_display_helper spi_loongson_pci xhci_pci cec xhci_pci_renesas spi_loongson_core hid_generic realtek gpio_loongson_64bit [ 56.697887] Process (udev-worker) (pid: 2742, threadinfo=00000000aee0d8b4, task=00000000a9eff1f3) [ 56.697890] Stack : 0000000000000000 ffff800004817e00 0000000000000000 0000251c00000000 [ 56.697896] 0000000000000000 00000011fffffffd 0000000000000000 0000000000000000 [ 56.697901] 0000000000000000 1b67a968695184b9 0000000000000000 90000001000b98d0 [ 56.697906] 90000001000bb8d0 900000011aa48028 0000000000000000 ffff800004f9d74c [ 56.697911] 90000001000ba000 ffff800004f9ce58 0000000000000000 ffff800005470440 [ 56.697916] ffff800004811f88 90000001000b98d0 9000000100da2aa8 90000001000bb8d0 [ 56.697921] 0000000000000000 90000001000ba000 900000011aa48028 ffff800004f9d74c [ 56.697926] ffff8000054704e8 90000001000bb8b8 90000001000ba000 0000000000000000 [ 56.697931] 90000001000bb8d0 9000000006307564 9000000005e666e0 90000001752359b8 [ 56.697936] 9000000008cbe400 900000000804d000 9000000005e666e0 0000000000000000 [ 56.697941] ... [ 56.697944] Call Trace: [ 56.697945] [<90000000066e35c8>] strstr+0x28/0x120 [ 56.697950] [<ffff800004f98a80>] wacom_update_name+0xe0/0x300 [wacom] [ 56.698000] [<ffff800004f9ce58>] wacom_parse_and_register+0x338/0x900 [wacom] [ 56.698050] [<ffff800004f9d74c>] wacom_probe+0x32c/0x420 [wacom] [ 56.698099] [<9000000006307564>] hid_device_probe+0x144/0x260 [ 56.698103] [<9000000005e65d68>] really_probe+0x208/0x540 [ 56.698109] [<9000000005e661dc>] __driver_probe_device+0x13c/0x1e0 [ 56.698112] [<9000000005e66620>] driver_probe_device+0x40/0x100 [ 56.698116] [<9000000005e6680c>] __device_attach_driver+0x12c/0x180 [ 56.698119] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160 [ 56.698123] [<9000000005e66468>] __device_attach+0x108/0x260 [ 56.698126] [<9000000005e63918>] device_reprobe+0x78/0x100 [ 56.698129] [<9000000005e62a68>] bus_for_each_dev+0x88/0x160 [ 56.698132] [<9000000006304e54>] __hid_bus_driver_added+0x34/0x80 [ 56.698134] [<9000000005e62bc8>] bus_for_each_drv+0x88/0x160 [ 56.698137] [<9000000006304df0>] __hid_register_driver+0x70/0xa0 [ 56.698142] [<9000000004e10fe4>] do_one_initcall+0x104/0x320 [ 56.698146] [<9000000004f38150>] do_init_module+0x90/0x2c0 [ 56.698151] [<9000000004f3a3d8>] init_module_from_file+0xb8/0x120 [ 56.698155] [<9000000004f3a590>] idempotent_init_module+0x150/0x3a0 [ 56.698159] [<9000000004f3a890>] sys_finit_module+0xb0/0x140 [ 56.698163] [<900000000671e4e8>] do_syscall+0x88/0xc0 [ 56.698166] [<9000000004e12404>] handle_syscall+0xc4/0x160 [ 56.698171] Code: 0011958f 00150224 5800cd85 <2a00022c> 00150004 4000c180 0015022c 03400000 03400000 [ 56.698192] ---[ end trace 0000000000000000 ]---
--- drivers/hid/wacom_sys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/wacom_sys.c +2 -1
@@ -2242,7 +2242,8 @@ static void wacom_update_name(struct wacif (hid_is_usb (wacom->hdev)) {struct usb_interface *intf =to_usb_interface (wacom->hdev->dev.parent);struct usb_device *dev =interface_to_usbdev (intf); - product_name = dev->product; +if (dev->product !=NULL ) + product_name = dev->product; }if (wacom->hdev->bus ==BUS_I2C ) {
Greg Kroah-Hartman
maintainerPATCH 446/565 watchdog: rti: of: honor timeout-sec property
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 4962ee045d8f06638714d801ab0fb72f89c16690 upstream.
Currently "timeout-sec" Device Tree property is being silently ignored:
even though watchdog_init_timeout() is being used, the driver always passes "heartbeat" == DEFAULT_HEARTBEAT == 60 as argument.
Fix this by setting struct watchdog_device::timeout to DEFAULT_HEARTBEAT and passing real module parameter value to watchdog_init_timeout() (which may now be 0 if not specified).
--- drivers/watchdog/rti_wdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/rti_wdt.c +2 -1
@@ -54,7 +54,7 @@#define MAX_HW_ERROR 250 -static int heartbeat =DEFAULT_HEARTBEAT ; +static int heartbeat;/* * struct to hold data for each WDT device
@@ -242,6 +242,7 @@ static int rti_wdt_probe(struct platform wdd->min_timeout =1 ; wdd->max_hw_heartbeat_ms = (WDT_PRELOAD_MAX <<WDT_PRELOAD_SHIFT ) / wdt->freq *1000 ; + wdd->timeout =DEFAULT_HEARTBEAT ; wdd->parent = dev;watchdog_set_drvdata (wdd, wdt);
Greg Kroah-Hartman
maintainerPATCH 447/565 can: dev: can_set_termination(): allow sleeping GPIOs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
commit ee1dfbdd8b4b6de85e96ae2059dc9c1bdb6b49b5 upstream.
In commit 6e86a1543c37 ("can: dev: provide optional GPIO based termination support") GPIO based termination support was added.
For no particular reason that patch uses gpiod_set_value() to set the GPIO. This leads to the following warning, if the systems uses a sleeping GPIO, i.e. behind an I2C port expander:
| WARNING: CPU: 0 PID: 379 at /drivers/gpio/gpiolib.c:3496 gpiod_set_value+0x50/0x6c
| CPU: 0 UID: 0 PID: 379 Comm: ip Not tainted 6.11.0-20241016-1 #1 823affae360cc91126e4d316d7a614a8bf86236c
Replace gpiod_set_value() by gpiod_set_value_cansleep() to allow the use of sleeping GPIOs.
--- drivers/net/can/dev/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/dev/dev.c +1 -1
@@ -409,7 +409,7 @@ static int can_set_termination(struct neelse set =0 ; -gpiod_set_value (priv->termination_gpio, set); +gpiod_set_value_cansleep (priv->termination_gpio, set);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 448/565 tracing: Fix cmp_entries_dup() to respect sort() comparison rules
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
commit e63fbd5f6810ed756bbb8a1549c7d4132968baa9 upstream.
The cmp_entries_dup() function used as the comparator for sort() violated the symmetry and transitivity properties required by the sorting algorithm. Specifically, it returned 1 whenever memcmp() was non-zero, which broke the following expectations:
* Symmetry: If x < y, then y > x.
* Transitivity: If x < y and y < z, then x < z.
These violations could lead to incorrect sorting and failure to correctly identify duplicate elements.
Fix the issue by directly returning the result of memcmp(), which adheres to the required comparison properties.
--- kernel/trace/tracing_map.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
kernel/trace/tracing_map.c +1 -5
@@ -845,15 +845,11 @@ int tracing_map_init(struct tracing_mapstatic int cmp_entries_dup (const void *A ,const void *B ) {const struct tracing_map_sort_entry *a, *b; -int ret =0 ; a = *(const struct tracing_map_sort_entry **)A ; b = *(const struct tracing_map_sort_entry **)B ; -if (memcmp (a->key, b->key, a->elt->map->key_size)) - ret =1 ; - -return ret; +return memcmp (a->key, b->key, a->elt->map->key_size); }static int cmp_entries_sum (const void *A ,const void *B )
Greg Kroah-Hartman
maintainerPATCH 449/565 arm64: ptrace: fix partial SETREGSET for NT_ARM_TAGGED_ADDR_CTRL
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit ca62d90085f4af36de745883faab9f8a7cbb45d3 upstream.
Currently tagged_addr_ctrl_set() doesn't initialize the temporary 'ctrl' variable, and a SETREGSET call with a length of zero will leave this uninitialized. Consequently tagged_addr_ctrl_set() will consume an arbitrary value, potentially leaking up to 64 bits of memory from the kernel stack. The read is limited to a specific slot on the stack, and the issue does not provide a write mechanism.
As set_tagged_addr_ctrl() only accepts values where bits [63:4] zero and rejects other values, a partial SETREGSET attempt will randomly succeed or fail depending on the value of the uninitialized value, and the exposure is significantly limited.
Fix this by initializing the temporary value before copying the regset from userspace, as for other regsets (e.g. NT_PRSTATUS, NT_PRFPREG, NT_ARM_SYSTEM_CALL). In the case of a zero-length write, the existing value of the tagged address ctrl will be retained.
The NT_ARM_TAGGED_ADDR_CTRL regset is only visible in the user_aarch64_view used by a native AArch64 task to manipulate another native AArch64 task. As get_tagged_addr_ctrl() only returns an error value when called for a compat task, tagged_addr_ctrl_get() and tagged_addr_ctrl_set() should never observe an error value from get_tagged_addr_ctrl(). Add a WARN_ON_ONCE() to both to indicate that such an error would be unexpected, and error handlnig is not missing in either case.
--- arch/arm64/kernel/ptrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kernel/ptrace.c +5 -1
@@ -1075,7 +1075,7 @@ static int tagged_addr_ctrl_get(struct t {long ctrl =get_tagged_addr_ctrl (target); -if (IS_ERR_VALUE (ctrl)) +if (WARN_ON_ONCE (IS_ERR_VALUE (ctrl)))return ctrl;return membuf_write (&to, &ctrl,sizeof (ctrl));
@@ -1089,6 +1089,10 @@ static int tagged_addr_ctrl_set(struct tint ret;long ctrl; + ctrl =get_tagged_addr_ctrl (target); +if (WARN_ON_ONCE (IS_ERR_VALUE (ctrl))) +return ctrl; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, &ctrl,0 ,-1 );if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 450/565 ALSA: usb-audio: add mixer mapping for Corsair HS80
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marie Ramlow <[email protected]>
commit a7de2b873f3dbcda02d504536f1ec6dc50e3f6c4 upstream.
The Corsair HS80 RGB Wireless is a USB headset with a mic and a sidetone feature. It has the same quirk as the Virtuoso series.
This labels the mixers appropriately, so applications don't move the sidetone volume when they actually intend to move the main headset volume.
--- sound/usb/mixer_maps.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/usb/mixer_maps.c +10 -0
@@ -574,6 +574,16 @@ static const struct usbmix_ctl_map usbmi .id = USB_ID(0x1b1c, 0x0a42), .map = corsair_virtuoso_map, }, + { + /* Corsair HS80 RGB Wireless (wired mode) */ + .id = USB_ID(0x1b1c, 0x0a6a), + .map = corsair_virtuoso_map, + }, + { + /* Corsair HS80 RGB Wireless (wireless mode) */ + .id = USB_ID(0x1b1c, 0x0a6b), + .map = corsair_virtuoso_map, + }, { /* Gigabyte TRX40 Aorus Master (rear panel + front mic) */ .id = USB_ID(0x0414, 0xa001), .map = aorus_master_alc1220vb_map,
Greg Kroah-Hartman
maintainerPATCH 451/565 ALSA: hda/realtek: Enable mute and micmute LED on HP ProBook 430 G8
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nazar Bilinskyi <[email protected]>
commit 3a83f7baf1346aca885cb83cb888e835fef7c472 upstream.
HP ProBook 430 G8 has a mute and micmute LEDs that can be made to work using quirk ALC236_FIXUP_HP_GPIO_LED. Enable already existing quirk.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9212,6 +9212,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x103c ,0x87b7 ,"HP Laptop 14-fq0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x87c8 ,"HP" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87d3 ,"HP Laptop 15-gw0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), +SND_PCI_QUIRK (0x103c ,0x87df ,"HP ProBook 430 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87e5 ,"HP ProBook 440 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87e7 ,"HP ProBook 450 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Greg Kroah-Hartman
maintainerPATCH 452/565 ALSA: hda/realtek: Add support for Samsung Galaxy Book3 360 (NP730QFG)
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sahas Leelodharry <[email protected]>
commit e2974a220594c06f536e65dfd7b2447e0e83a1cb upstream.
Fixes the 3.5mm headphone jack on the Samsung Galaxy Book 3 360 NP730QFG laptop.
Unlike the other Galaxy Book3 series devices, this device only needs the ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET quirk. Verified changes on the device and compared with codec state in Windows.
[ white-space fixes by tiwai ]
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9345,6 +9345,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x144d ,0xc830 ,"Samsung Galaxy Book Ion (NT950XCJ-X716A)" ,ALC298_FIXUP_SAMSUNG_AMP ),SND_PCI_QUIRK (0x144d ,0xc832 ,"Samsung Galaxy Book Flex Alpha (NP730QCJ)" ,ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xca03 ,"Samsung Galaxy Book2 Pro 360 (NP930QED)" ,ALC298_FIXUP_SAMSUNG_AMP ), +SND_PCI_QUIRK (0x144d ,0xca06 ,"Samsung Galaxy Book3 360 (NP730QFG)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc868 ,"Samsung Galaxy Book2 Pro (NP930XED)" ,ALC298_FIXUP_SAMSUNG_AMP ),SND_PCI_QUIRK (0x1458 ,0xfa53 ,"Gigabyte BXBT-2807" ,ALC283_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Greg Kroah-Hartman
maintainerPATCH 453/565 scsi: qla2xxx: Fix abort in bsg timeout
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit c423263082ee8ccfad59ab33e3d5da5dc004c21e upstream.
Current abort of bsg on timeout prematurely clears the outstanding_cmds[]. Abort does not allow FW to return the IOCB/SRB. In addition, bsg_job_done() is not called to return the BSG (i.e. leak).
Abort the outstanding bsg/SRB and wait for the completion. The completion IOCB will wake up the bsg_timeout thread. If abort is not successful, then driver will forcibly call bsg_job_done() and free the srb.
Err Inject:
- qaucli -z
- assign CT Passthru IOCB's NportHandle with another initiator nport handle to trigger timeout. Remote port will drop CT request.
- bsg_job_done is properly called as part of cleanup
kernel: qla2xxx [0000:21:00.1]-7012:7: qla2x00_process_ct : 286 : Error Inject.
kernel: qla2xxx [0000:21:00.1]-7016:7: bsg rqst type: FC_BSG_HST_CT else type: 101 - loop-id=1 portid=fffffa.
kernel: qla2xxx [0000:21:00.1]-70bb:7: qla24xx_bsg_timeout CMD timeout. bsg ptr ffff9971a42f0838 msgcode 80000004 vendor cmd fa010000
kernel: qla2xxx [0000:21:00.1]-507c:7: Abort command issued - hdl=4b, type=5
kernel: qla2xxx [0000:21:00.1]-5040:7: ELS-CT pass-through-ct pass-through error hdl=4b comp_status-status=0x5 error subcode 1=0x0 error subcode 2=0xaf882e80.
kernel: qla2xxx [0000:21:00.1]-7009:7: qla2x00_bsg_job_done: sp hdl 4b, result=70000 bsg ptr ffff9971a42f0838
kernel: qla2xxx [0000:21:00.1]-802c:7: Aborting bsg ffff9971a42f0838 sp=ffff99760b87ba80 handle=4b rval=0
kernel: qla2xxx [0000:21:00.1]-708a:7: bsg abort success. bsg ffff9971a42f0838 sp=ffff99760b87ba80 handle=0x4b
kernel: qla2xxx [0000:21:00.1]-7012:7: qla2x00_process_ct : 286 : Error Inject.
kernel: qla2xxx [0000:21:00.1]-7016:7: bsg rqst type: FC_BSG_HST_CT else type: 101 - loop-id=1 portid=fffffa.
kernel: qla2xxx [0000:21:00.1]-70bb:7: qla24xx_bsg_timeout CMD timeout. bsg ptr ffff9971a42f43b8 msgcode 80000004 vendor cmd fa010000
kernel: qla2xxx [0000:21:00.1]-7012:7: qla_bsg_found : 2206 : Error Inject 2.
kernel: qla2xxx [0000:21:00.1]-802c:7: Aborting bsg ffff9971a42f43b8 sp=ffff99762c304440 handle=5e rval=5
kernel: qla2xxx [0000:21:00.1]-704f:7: bsg abort fail. bsg=ffff9971a42f43b8 sp=ffff99762c304440 rval=5.
kernel: qla2xxx [0000:21:00.1]-7051:7: qla_bsg_found bsg_job_done : bsg ffff9971a42f43b8 result 0xfffffffa sp ffff99762c304440.
--- drivers/scsi/qla2xxx/qla_bsg.c | 114 +++++++++++++++++++++++++++++++++-------- 1 file changed, 92 insertions(+), 22 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.c +92 -22
@@ -24,6 +24,7 @@ void qla2x00_bsg_job_done(srb_t *sp, int {struct bsg_job *bsg_job = sp->u.bsg_job;struct fc_bsg_reply *bsg_reply = bsg_job->reply; +struct completion *comp = sp->comp; ql_dbg(ql_dbg_user, sp->vha, 0x7009, "%s: sp hdl %x, result=%x bsg ptr %p\n",
@@ -35,6 +36,9 @@ void qla2x00_bsg_job_done(srb_t *sp, int bsg_reply->result = res;bsg_job_done (bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); + +if (comp) +complete (comp); }void qla2x00_bsg_sp_free (srb_t *sp)
@@ -2968,7 +2972,7 @@ skip_chip_chk:static bool qla_bsg_found (struct qla_qpair *qpair,struct bsg_job *bsg_job) { -bool found = false; +bool found, do_bsg_done;struct fc_bsg_reply *bsg_reply = bsg_job->reply;scsi_qla_host_t *vha =shost_priv (fc_bsg_to_shost (bsg_job));struct qla_hw_data *ha = vha->hw;
@@ -2976,6 +2980,11 @@ static bool qla_bsg_found(struct qla_qpaint cnt;unsigned long flags;struct req_que *req; +int rval; +DECLARE_COMPLETION_ONSTACK (comp); +uint32_t ratov_j; + + found = do_bsg_done = false;spin_lock_irqsave (qpair->qp_lock_ptr, flags); req = qpair->req;
@@ -2987,42 +2996,104 @@ static bool qla_bsg_found(struct qla_qpa sp->type == SRB_ELS_CMD_HST || sp->type == SRB_ELS_CMD_HST_NOLOGIN) && sp->u.bsg_job == bsg_job) { - req->outstanding_cmds[cnt] = NULL; -spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); - -if (!ha->flags.eeh_busy && ha->isp_ops->abort_command (sp)) { -ql_log (ql_log_warn, vha,0x7089 , -"mbx abort_command failed.\n" ); - bsg_reply->result = -EIO ; - }else { -ql_dbg (ql_dbg_user, vha,0x708a , -"mbx abort_command success.\n" ); - bsg_reply->result =0 ; - } -/* ref: INIT */ -kref_put (&sp->cmd_kref, qla2x00_sp_release); found = true; - goto done; + sp->comp = ∁ +break ; } }spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); -done: -return found; +if (!found) +return false; + +if (ha->flags.eeh_busy) { +/* skip over abort. EEH handling will return the bsg. Wait for it */ + rval =QLA_SUCCESS ; +ql_dbg (ql_dbg_user, vha,0x802c , +"eeh encounter. bsg %p sp=%p handle=%x \n" , + bsg_job, sp, sp->handle); + }else { + rval = ha->isp_ops->abort_command (sp); +ql_dbg (ql_dbg_user, vha,0x802c , +"Aborting bsg %p sp=%p handle=%x rval=%x\n" , + bsg_job, sp, sp->handle, rval); + } + +switch (rval) { +case QLA_SUCCESS : +/* Wait for the command completion. */ + ratov_j = ha->r_a_tov /10 *4 *1000 ; + ratov_j =msecs_to_jiffies (ratov_j); + +if (!wait_for_completion_timeout (&comp, ratov_j)) { +ql_log (ql_log_info, vha,0x7089 , +"bsg abort timeout. bsg=%p sp=%p handle %#x .\n" , + bsg_job, sp, sp->handle); + + do_bsg_done = true; + }else { +/* fw had returned the bsg */ +ql_dbg (ql_dbg_user, vha,0x708a , +"bsg abort success. bsg %p sp=%p handle=%#x\n" , + bsg_job, sp, sp->handle); + do_bsg_done = false; + } +break ; +default : +ql_log (ql_log_info, vha,0x704f , +"bsg abort fail. bsg=%p sp=%p rval=%x.\n" , + bsg_job, sp, rval); + + do_bsg_done = true; +break ; + } + +if (!do_bsg_done) +return true; + +spin_lock_irqsave (qpair->qp_lock_ptr, flags); +/* +* recheck to make sure it's still the same bsg_job due to +* qp_lock_ptr was released earlier. +*/ +if (req->outstanding_cmds[cnt] && + req->outstanding_cmds[cnt]->u.bsg_job != bsg_job) { +/* fw had returned the bsg */ +spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); +return true; + } + req->outstanding_cmds[cnt] =NULL ; +spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); + +/* ref: INIT */ + sp->comp =NULL ; +kref_put (&sp->cmd_kref, qla2x00_sp_release); + bsg_reply->result = -ENXIO ; + bsg_reply->reply_payload_rcv_len =0 ; + +ql_dbg (ql_dbg_user, vha,0x7051 , +"%s bsg_job_done : bsg %p result %#x sp %p.\n" , + __func__, bsg_job, bsg_reply->result, sp); + +bsg_job_done (bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); + +return true; }int qla24xx_bsg_timeout (struct bsg_job *bsg_job) { -struct fc_bsg_reply *bsg_reply = bsg_job->reply; +struct fc_bsg_request *bsg_request = bsg_job->request;scsi_qla_host_t *vha =shost_priv (fc_bsg_to_shost (bsg_job));struct qla_hw_data *ha = vha->hw;int i;struct qla_qpair *qpair; -ql_log (ql_log_info, vha,0x708b ,"%s CMD timeout. bsg ptr %p.\n" , - __func__, bsg_job); +ql_log (ql_log_info, vha,0x708b , +"%s CMD timeout. bsg ptr %p msgcode %x vendor cmd %x\n" , + __func__, bsg_job, bsg_request->msgcode, + bsg_request->rqst_data.h_vendor.vendor_cmd[0 ]);if (qla2x00_isp_reg_stat (ha)) { ql_log(ql_log_info, vha, 0x9007,
@@ -3043,7 +3114,6 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_ }ql_log (ql_log_info, vha,0x708b ,"SRB not found to abort.\n" ); - bsg_reply->result = -ENXIO ; done:return 0 ;
Greg Kroah-Hartman
maintainerPATCH 454/565 scsi: qla2xxx: Fix NVMe and NPIV connect issue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 4812b7796c144f63a1094f79a5eb8fbdad8d7ebc upstream.
NVMe controller fails to send connect command due to failure to locate hw context buffer for NVMe queue 0 (blk_mq_hw_ctx, hctx_idx=0). The cause of the issue is NPIV host did not initialize the vha->irq_offset field. This field is given to blk-mq (blk_mq_pci_map_queues) to help locate the beginning of IO Queues which in turn help locate NVMe queue 0.
Initialize this field to allow NVMe to work properly with NPIV host.
kernel: nvme nvme5: Connect command failed, errno: -18
kernel: nvme nvme5: qid 0: secure concatenation is not supported
kernel: nvme nvme5: NVME-FC{5}: create_assoc failed, assoc_id 2e9100 ret 401
kernel: nvme nvme5: NVME-FC{5}: reset: Reconnect attempt failed (401)
kernel: nvme nvme5: NVME-FC{5}: Reconnect attempt in 2 seconds
--- drivers/scsi/qla2xxx/qla_mid.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_mid.c +1 -0
@@ -515,6 +515,7 @@ qla24xx_create_vhost(struct fc_vport *fcreturn (NULL ); } + vha->irq_offset =QLA_BASE_VECTORS ; host = vha->host; fc_vport->dd_data = vha;/* New host info */
Greg Kroah-Hartman
maintainerPATCH 455/565 scsi: qla2xxx: Supported speed displayed incorrectly for VPorts
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anil Gurumurthy <[email protected]>
commit e4e268f898c8a08f0a1188677e15eadbc06e98f6 upstream.
The fc_function_template for vports was missing the .show_host_supported_speeds. The base port had the same.
Add .show_host_supported_speeds to the vport template as well.
--- drivers/scsi/qla2xxx/qla_attr.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_attr.c +1 -0
@@ -3303,6 +3303,7 @@ struct fc_function_template qla2xxx_tran .show_host_node_name = 1, .show_host_port_name = 1, .show_host_supported_classes = 1, + .show_host_supported_speeds = 1, .get_host_port_id = qla2x00_get_host_port_id, .show_host_port_id = 1,
Greg Kroah-Hartman
maintainerPATCH 456/565 scsi: qla2xxx: Fix use after free on unload
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 07c903db0a2ff84b68efa1a74a4de353ea591eb0 upstream.
System crash is observed with stack trace warning of use after free. There are 2 signals to tell dpc_thread to terminate (UNLOADING flag and kthread_stop).
On setting the UNLOADING flag when dpc_thread happens to run at the time and sees the flag, this causes dpc_thread to exit and clean up itself. When kthread_stop is called for final cleanup, this causes use after free.
Remove UNLOADING signal to terminate dpc_thread. Use the kthread_stop as the main signal to exit dpc_thread.
[596663.812935] kernel BUG at mm/slub.c:294! [596663.812950] invalid opcode: 0000 [#1] SMP PTI [596663.812957] CPU: 13 PID: 1475935 Comm: rmmod Kdump: loaded Tainted: G IOE --------- - - 4.18.0-240.el8.x86_64 #1 [596663.812960] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 08/20/2012 [596663.812974] RIP: 0010:__slab_free+0x17d/0x360
...
[596663.813008] Call Trace: [596663.813022] ? __dentry_kill+0x121/0x170 [596663.813030] ? _cond_resched+0x15/0x30 [596663.813034] ? _cond_resched+0x15/0x30 [596663.813039] ? wait_for_completion+0x35/0x190 [596663.813048] ? try_to_wake_up+0x63/0x540 [596663.813055] free_task+0x5a/0x60 [596663.813061] kthread_stop+0xf3/0x100 [596663.813103] qla2x00_remove_one+0x284/0x440 [qla2xxx]
--- drivers/scsi/qla2xxx/qla_os.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +8 -7
@@ -6851,12 +6851,15 @@ qla2x00_do_dpc(void *data)set_user_nice (current,MIN_NICE );set_current_state (TASK_INTERRUPTIBLE ); -while (!kthread_should_stop ()) { +while (1 ) {ql_dbg (ql_dbg_dpc, base_vha,0x4000 ,"DPC handler sleeping.\n" );schedule (); +if (kthread_should_stop ()) +break ; +if (test_and_clear_bit (DO_EEH_RECOVERY , &base_vha->dpc_flags))qla_pci_set_eeh_busy (base_vha);
@@ -6869,15 +6872,16 @@ qla2x00_do_dpc(void *data) goto end_loop; } +if (test_bit (UNLOADING , &base_vha->dpc_flags)) +/* don't do any work. Wait to be terminated by kthread_stop */ + goto end_loop; + ha->dpc_active =1 ;ql_dbg (ql_dbg_dpc + ql_dbg_verbose, base_vha,0x4001 ,"DPC handler waking up, dpc_flags=0x%lx.\n" , base_vha->dpc_flags); -if (test_bit (UNLOADING , &base_vha->dpc_flags)) -break ; -if (IS_P3P_TYPE (ha)) {if (IS_QLA8044 (ha)) { if (test_and_clear_bit(ISP_UNRECOVERABLE,
@@ -7195,9 +7199,6 @@ end_loop:*/ ha->dpc_active =0 ; -/* Cleanup any residual CTX SRBs. */ -qla2x00_abort_all_cmds (base_vha,DID_NO_CONNECT <<16 ); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 457/565 scsi: qla2xxx: Remove check req_sg_cnt should be equal to rsp_sg_cnt
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saurav Kashyap <[email protected]>
commit 833c70e212fc40d3e98da941796f4c7bcaecdf58 upstream.
Firmware supports multiple sg_cnt for request and response for CT commands, so remove the redundant check. A check is there where sg_cnt for request and response should be same. This is not required as driver and FW have code to handle multiple and different sg_cnt on request and response.
--- drivers/scsi/qla2xxx/qla_bsg.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.c +0 -10
@@ -494,16 +494,6 @@ qla2x00_process_ct(struct bsg_job *bsg_j goto done; } -if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || - (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { -ql_log (ql_log_warn, vha,0x7011 , -"request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x " -"dma_reply_sg_cnt: %x\n" , bsg_job->request_payload.sg_cnt, - req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); - rval = -EAGAIN ; - goto done_unmap_sg; - } -if (!vha->flags.online) {ql_log (ql_log_warn, vha,0x7012 ,"Host is not online.\n" );
Greg Kroah-Hartman
maintainerPATCH 458/565 scsi: ufs: core: sysfs: Prevent div by zero
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gwendal Grignou <[email protected]>
commit eb48e9fc0028bed94a40a9352d065909f19e333c upstream.
Prevent a division by 0 when monitoring is not enabled.
--- drivers/scsi/ufs/ufs-sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/ufs/ufs-sysfs.c +6 -0
@@ -371,6 +371,9 @@ static ssize_t read_req_latency_avg_showstruct ufs_hba *hba =dev_get_drvdata (dev);struct ufs_hba_monitor *m = &hba->monitor; +if (!m->nr_req[READ ]) +return sysfs_emit (buf,"0\n" ); +return sysfs_emit (buf,"%llu\n" ,div_u64 (ktime_to_us (m->lat_sum[READ ]), m->nr_req[READ ])); }
@@ -438,6 +441,9 @@ static ssize_t write_req_latency_avg_shostruct ufs_hba *hba =dev_get_drvdata (dev);struct ufs_hba_monitor *m = &hba->monitor; +if (!m->nr_req[WRITE ]) +return sysfs_emit (buf,"0\n" ); +return sysfs_emit (buf,"%llu\n" ,div_u64 (ktime_to_us (m->lat_sum[WRITE ]), m->nr_req[WRITE ])); }
Greg Kroah-Hartman
maintainerPATCH 459/565 nilfs2: fix potential out-of-bounds memory access in nilfs_find_entry()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 985ebec4ab0a28bb5910c3b1481a40fbf7f9e61d upstream.
Syzbot reported that when searching for records in a directory where the inode's i_size is corrupted and has a large value, memory access outside the folio/page range may occur, or a use-after-free bug may be detected if KASAN is enabled.
This is because nilfs_last_byte(), which is called by nilfs_find_entry() and others to calculate the number of valid bytes of directory data in a page from i_size and the page index, loses the upper 32 bits of the 64-bit size information due to an inappropriate type of local variable to which the i_size value is assigned.
This caused a large byte offset value due to underflow in the end address calculation in the calling nilfs_find_entry(), resulting in memory access that exceeds the folio/page size.
Fix this issue by changing the type of the local variable causing the bit loss from "unsigned int" to "u64". The return value of nilfs_last_byte() is also of type "unsigned int", but it is truncated so as not to exceed PAGE_SIZE and no bit loss occurs, so no change is required.
--- fs/nilfs2/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/dir.c +1 -1
@@ -76,7 +76,7 @@ static inline void nilfs_put_page(struct*/ static unsigned int nilfs_last_byte (struct inode *inode,unsigned long page_nr) { -unsigned int last_byte = inode->i_size; +u64 last_byte = inode->i_size; last_byte -= page_nr <<PAGE_SHIFT ;if (last_byte >PAGE_SIZE )
Greg Kroah-Hartman
maintainerPATCH 460/565 bcache: revert replacing IS_ERR_OR_NULL with IS_ERR again
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liequan Che <[email protected]>
commit b2e382ae12a63560fca35050498e19e760adf8c0 upstream.
Commit 028ddcac477b ("bcache: Remove unnecessary NULL point check in node allocations") leads a NULL pointer deference in cache_set_flush().
1721 if (!IS_ERR_OR_NULL(c->root))
1722 list_add(&c->root->list, &c->btree_cache);
Quoted 1 line
From the above code in
cache_set_flush(), if previous registration code
fails before allocating c->root, it is possible c->root is NULL as what it is initialized. __bch_btree_node_alloc() never returns NULL but c->root is possible to be NULL at above line 1721.
This patch replaces IS_ERR() by IS_ERR_OR_NULL() to fix this.
--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/super.c +1 -1
@@ -1731,7 +1731,7 @@ static void cache_set_flush(struct closuif (!IS_ERR_OR_NULL (c->gc_thread))kthread_stop (c->gc_thread); -if (!IS_ERR (c->root)) +if (!IS_ERR_OR_NULL (c->root))list_add (&c->root->list, &c->btree_cache);/*
Greg Kroah-Hartman
maintainerPATCH 461/565 bpf: fix OOB devmap writes when deleting elements
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
commit ab244dd7cf4c291f82faacdc50b45cc0f55b674d upstream.
Jordy reported issue against XSKMAP which also applies to DEVMAP - the index used for accessing map entry, due to being a signed integer, causes the OOB writes. Fix is simple as changing the type from int to u32, however, when compared to XSKMAP case, one more thing needs to be addressed.
When map is released from system via dev_map_free(), we iterate through all of the entries and an iterator variable is also an int, which implies OOB accesses. Again, change it to be u32.
Example splat below:
[ 160.724676] BUG: unable to handle page fault for address: ffffc8fc2c001000 [ 160.731662] #PF: supervisor read access in kernel mode [ 160.736876] #PF: error_code(0x0000) - not-present page [ 160.742095] PGD 0 P4D 0 [ 160.744678] Oops: Oops: 0000 [#1] PREEMPT SMP [ 160.749106] CPU: 1 UID: 0 PID: 520 Comm: kworker/u145:12 Not tainted 6.12.0-rc1+ #487 [ 160.757050] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019 [ 160.767642] Workqueue: events_unbound bpf_map_free_deferred [ 160.773308] RIP: 0010:dev_map_free+0x77/0x170 [ 160.777735] Code: 00 e8 fd 91 ed ff e8 b8 73 ed ff 41 83 7d 18 19 74 6e 41 8b 45 24 49 8b bd f8 00 00 00 31 db 85 c0 74 48 48 63 c3 48 8d 04 c7 <48> 8b 28 48 85 ed 74 30 48 8b 7d 18 48 85 ff 74 05 e8 b3 52 fa ff [ 160.796777] RSP: 0018:ffffc9000ee1fe38 EFLAGS: 00010202 [ 160.802086] RAX: ffffc8fc2c001000 RBX: 0000000080000000 RCX: 0000000000000024 [ 160.809331] RDX: 0000000000000000 RSI: 0000000000000024 RDI: ffffc9002c001000 [ 160.816576] RBP: 0000000000000000 R08: 0000000000000023 R09: 0000000000000001 [ 160.823823] R10: 0000000000000001 R11: 00000000000ee6b2 R12: dead000000000122 [ 160.831066] R13: ffff88810c928e00 R14: ffff8881002df405 R15: 0000000000000000 [ 160.838310] FS: 0000000000000000(0000) GS:ffff8897e0c40000(0000) knlGS:0000000000000000 [ 160.846528] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 160.852357] CR2: ffffc8fc2c001000 CR3: 0000000005c32006 CR4: 00000000007726f0 [ 160.859604] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 160.866847] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 160.874092] PKRU: 55555554 [ 160.876847] Call Trace: [ 160.879338] <TASK> [ 160.881477] ? __die+0x20/0x60 [ 160.884586] ? page_fault_oops+0x15a/0x450 [ 160.888746] ? search_extable+0x22/0x30 [ 160.892647] ? search_bpf_extables+0x5f/0x80 [ 160.896988] ? exc_page_fault+0xa9/0x140 [ 160.900973] ? asm_exc_page_fault+0x22/0x30 [ 160.905232] ? dev_map_free+0x77/0x170 [ 160.909043] ? dev_map_free+0x58/0x170 [ 160.912857] bpf_map_free_deferred+0x51/0x90 [ 160.917196] process_one_work+0x142/0x370 [ 160.921272] worker_thread+0x29e/0x3b0 [ 160.925082] ? rescuer_thread+0x4b0/0x4b0 [ 160.929157] kthread+0xd4/0x110 [ 160.932355] ? kthread_park+0x80/0x80 [ 160.936079] ret_from_fork+0x2d/0x50 [ 160.943396] ? kthread_park+0x80/0x80 [ 160.950803] ret_from_fork_asm+0x11/0x20 [ 160.958482] </TASK>
--- kernel/bpf/devmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/bpf/devmap.c +3 -3
@@ -183,7 +183,7 @@ static struct bpf_map *dev_map_alloc(unistatic void dev_map_free (struct bpf_map *map) { struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); -int i; +u32 i;/* At this point bpf_prog->aux->refcnt == 0 and this map->refcnt == 0, * so the programs (can be more than one that used this map) were
@@ -806,7 +806,7 @@ static int dev_map_delete_elem(struct bp { struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map);struct bpf_dtab_netdev *old_dev; -int k = *(u32 *)key; +u32 k = *(u32 *)key;if (k >= map->max_entries)return -EINVAL ;
@@ -821,7 +821,7 @@ static int dev_map_hash_delete_elem(stru { struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map);struct bpf_dtab_netdev *old_dev; -int k = *(u32 *)key; +u32 k = *(u32 *)key;unsigned long flags;int ret = -ENOENT ;
Greg Kroah-Hartman
maintainerPATCH 462/565 dma-buf: fix dma_fence_array_signaled v4
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit 78ac1c3558810486d90aa533b0039aa70487a3da upstream.
The function silently assumed that signaling was already enabled for the dma_fence_array. This meant that without enabling signaling first we would never see forward progress.
Fix that by falling back to testing each individual fence when signaling isn't enabled yet.
v2: add the comment suggested by Boris why this is done this way
v3: fix the underflow pointed out by Tvrtko
v4: atomic_read_acquire() as suggested by Tvrtko
--- drivers/dma-buf/dma-fence-array.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/dma-buf/dma-fence-array.c +27 -1
@@ -103,10 +103,36 @@ static bool dma_fence_array_enable_signastatic bool dma_fence_array_signaled (struct dma_fence *fence) {struct dma_fence_array *array =to_dma_fence_array (fence); +int num_pending; +unsigned int i; -if (atomic_read (&array->num_pending) >0 ) +/* +* We need to read num_pending before checking the enable_signal bit +* to avoid racing with the enable_signaling() implementation, which +* might decrement the counter, and cause a partial check. +* atomic_read_acquire() pairs with atomic_dec_and_test() in +* dma_fence_array_enable_signaling() +* +* The !--num_pending check is here to account for the any_signaled case +* if we race with enable_signaling(), that means the !num_pending check +* in the is_signalling_enabled branch might be outdated (num_pending +* might have been decremented), but that's fine. The user will get the +* right value when testing again later. +*/ + num_pending =atomic_read_acquire (&array->num_pending); +if (test_bit (DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT , &array->base.flags)) { +if (num_pending <=0 ) + goto signal;return false; + } +for (i =0 ; i < array->num_fences; ++i) { +if (dma_fence_is_signaled (array->fences[i]) && !--num_pending) + goto signal; + } +return false; + +signal:dma_fence_array_clear_pending_error (array);return true; }
Greg Kroah-Hartman
maintainerPATCH 463/565 xsk: fix OOB map writes when deleting elements
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
commit 32cd3db7de97c0c7a018756ce66244342fd583f0 upstream.
Jordy says:
"
In the xsk_map_delete_elem function an unsigned integer (map->max_entries) is compared with a user-controlled signed integer (k). Due to implicit type conversion, a large unsigned value for map->max_entries can bypass the intended bounds check:
if (k >= map->max_entries) return -EINVAL;
This allows k to hold a negative value (between -2147483648 and -2), which is then used as an array index in m->xsk_map[k], which results in an out-of-bounds access.
spin_lock_bh(&m->lock); map_entry = &m->xsk_map[k]; // Out-of-bounds map_entry old_xs = unrcu_pointer(xchg(map_entry, NULL)); // Oob write if (old_xs) xsk_map_sock_delete(old_xs, map_entry); spin_unlock_bh(&m->lock);
The xchg operation can then be used to cause an out-of-bounds write. Moreover, the invalid map_entry passed to xsk_map_sock_delete can lead to further memory corruption.
"
It indeed results in following splat:
[76612.897343] BUG: unable to handle page fault for address: ffffc8fc2e461108 [76612.904330] #PF: supervisor write access in kernel mode [76612.909639] #PF: error_code(0x0002) - not-present page [76612.914855] PGD 0 P4D 0 [76612.917431] Oops: Oops: 0002 [#1] PREEMPT SMP [76612.921859] CPU: 11 UID: 0 PID: 10318 Comm: a.out Not tainted 6.12.0-rc1+ #470 [76612.929189] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019 [76612.939781] RIP: 0010:xsk_map_delete_elem+0x2d/0x60 [76612.944738] Code: 00 00 41 54 55 53 48 63 2e 3b 6f 24 73 38 4c 8d a7 f8 00 00 00 48 89 fb 4c 89 e7 e8 2d bf 05 00 48 8d b4 eb 00 01 00 00 31 ff <48> 87 3e 48 85 ff 74 05 e8 16 ff ff ff 4c 89 e7 e8 3e bc 05 00 31 [76612.963774] RSP: 0018:ffffc9002e407df8 EFLAGS: 00010246 [76612.969079] RAX: 0000000000000000 RBX: ffffc9002e461000 RCX: 0000000000000000 [76612.976323] RDX: 0000000000000001 RSI: ffffc8fc2e461108 RDI: 0000000000000000 [76612.983569] RBP: ffffffff80000001 R08: 0000000000000000 R09: 0000000000000007 [76612.990812] R10: ffffc9002e407e18 R11: ffff888108a38858 R12: ffffc9002e4610f8 [76612.998060] R13: ffff888108a38858 R14: 00007ffd1ae0ac78 R15: ffffc9002e4610c0 [76613.005303] FS: 00007f80b6f59740(0000) GS:ffff8897e0ec0000(0000) knlGS:0000000000000000 [76613.013517] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [76613.019349] CR2: ffffc8fc2e461108 CR3: 000000011e3ef001 CR4: 00000000007726f0 [76613.026595] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [76613.033841] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [76613.041086] PKRU: 55555554 [76613.043842] Call Trace: [76613.046331] <TASK> [76613.048468] ? __die+0x20/0x60 [76613.051581] ? page_fault_oops+0x15a/0x450 [76613.055747] ? search_extable+0x22/0x30 [76613.059649] ? search_bpf_extables+0x5f/0x80 [76613.063988] ? exc_page_fault+0xa9/0x140 [76613.067975] ? asm_exc_page_fault+0x22/0x30 [76613.072229] ? xsk_map_delete_elem+0x2d/0x60 [76613.076573] ? xsk_map_delete_elem+0x23/0x60 [76613.080914] __sys_bpf+0x19b7/0x23c0 [76613.084555] __x64_sys_bpf+0x1a/0x20 [76613.088194] do_syscall_64+0x37/0xb0 [76613.091832] entry_SYSCALL_64_after_hwframe+0x4b/0x53 [76613.096962] RIP: 0033:0x7f80b6d1e88d [76613.100592] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 b5 0f 00 f7 d8 64 89 01 48 [76613.119631] RSP: 002b:00007ffd1ae0ac68 EFLAGS: 00000206 ORIG_RAX: 0000000000000141 [76613.131330] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f80b6d1e88d [76613.142632] RDX: 0000000000000098 RSI: 00007ffd1ae0ad20 RDI: 0000000000000003 [76613.153967] RBP: 00007ffd1ae0adc0 R08: 0000000000000000 R09: 0000000000000000 [76613.166030] R10: 00007f80b6f77040 R11: 0000000000000206 R12: 00007ffd1ae0aed8 [76613.177130] R13: 000055ddf42ce1e9 R14: 000055ddf42d0d98 R15: 00007f80b6fab040 [76613.188129] </TASK>
Fix this by simply changing key type from int to u32.
--- net/xdp/xskmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xdp/xskmap.c +1 -1
@@ -214,7 +214,7 @@ static int xsk_map_delete_elem(struct bp struct xsk_map *m = container_of(map, struct xsk_map, map);struct xdp_sock __rcu **map_entry;struct xdp_sock *old_xs; -int k = *(u32 *)key; +u32 k = *(u32 *)key;if (k >= map->max_entries)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 464/565 regmap: detach regmap from dev on regmap_exit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
commit 3061e170381af96d1e66799d34264e6414d428a7 upstream.
At the end of __regmap_init(), if dev is not NULL, regmap_attach_dev() is called, which adds a devres reference to the regmap, to be able to retrieve a dev's regmap by name using dev_get_regmap().
When calling regmap_exit, the opposite does not happen, and the reference is kept until the dev is detached.
Add a regmap_detach_dev() function and call it in regmap_exit() to make sure that the devres reference is not kept.
Rule: add
--- drivers/base/regmap/regmap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/base/regmap/regmap.c +12 -0
@@ -663,6 +663,17 @@ int regmap_attach_dev(struct device *dev }EXPORT_SYMBOL_GPL (regmap_attach_dev); +static int dev_get_regmap_match (struct device *dev,void *res,void *data); + +static int regmap_detach_dev (struct device *dev,struct regmap *map) +{ +if (!dev) +return 0 ; + +return devres_release (dev, dev_get_regmap_release, + dev_get_regmap_match, (void *)map->name); +} +static enum regmap_endian regmap_get_reg_endian (const struct regmap_bus *bus,const struct regmap_config *config) {
@@ -1497,6 +1508,7 @@ int regmap_reinit_cache(struct regmap *m {int ret; +regmap_detach_dev (map->dev, map);regcache_exit (map);regmap_debugfs_exit (map);
Greg Kroah-Hartman
maintainerPATCH 465/565 mmc: sdhci-pci: Add DMI quirk for missing CD GPIO on Vexia Edu Atla 10 tablet
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 7f0fa47ceebcff0e3591bb7e32a71a2cd7846149 upstream.
The Vexia Edu Atla 10 tablet distributed to schools in the Spanish Andalucía region has no ACPI fwnode associated with the SDHCI controller for its microsd-slot and thus has no ACPI GPIO resource info.
This causes the following error to be logged and the slot to not work:
[ 10.572113] sdhci-pci 0000:00:12.0: failed to setup card detect gpio
Add a DMI quirk table for providing gpiod_lookup_tables with manually provided CD GPIO info and use this DMI table to provide the CD GPIO info on this tablet. This fixes the microsd-slot not working.
Message-ID: <[email protected]>
--- drivers/mmc/host/sdhci-pci-core.c | 72 ++++++++++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci-pci.h | 1 2 files changed, 73 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +72 -0
@@ -23,6 +23,7 @@#include <linux/io.h> #include <linux/iopoll.h> #include <linux/gpio.h> +#include <linux/gpio/machine.h> #include <linux/pm_runtime.h> #include <linux/pm_qos.h> #include <linux/debugfs.h>
@@ -1303,6 +1304,29 @@ static const struct sdhci_pci_fixes sdhc .priv_size = sizeof(struct intel_host), }; +/* DMI quirks for devices with missing or broken CD GPIO info */ +static const struct gpiod_lookup_table vexia_edu_atla10_cd_gpios = { + .dev_id ="0000:00:12.0" , + .table = { +GPIO_LOOKUP ("INT33FC:00" ,38 ,"cd" ,GPIO_ACTIVE_HIGH ), + { } + }, +}; + +static const struct dmi_system_id sdhci_intel_byt_cd_gpio_override[] = { + { +/* Vexia Edu Atla 10 tablet 9V version */ + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"AMI Corporation" ), +DMI_MATCH (DMI_BOARD_NAME ,"Aptio CRB" ), +/* Above strings are too generic, also match on BIOS date */ +DMI_MATCH (DMI_BIOS_DATE ,"08/25/2014" ), + }, + .driver_data = (void *)&vexia_edu_atla10_cd_gpios, + }, + { } +}; +static const struct sdhci_pci_fixes sdhci_intel_byt_sd = { #ifdef CONFIG_PM_SLEEP .resume = byt_resume,
@@ -1321,6 +1345,7 @@ static const struct sdhci_pci_fixes sdhc .add_host = byt_add_host, .remove_slot = byt_remove_slot, .ops = &sdhci_intel_byt_ops, + .cd_gpio_override = sdhci_intel_byt_cd_gpio_override, .priv_size = sizeof(struct intel_host), };
@@ -2120,6 +2145,42 @@ static const struct dev_pm_ops sdhci_pci* * \*****************************************************************************/ +static struct gpiod_lookup_table *sdhci_pci_add_gpio_lookup_table ( +struct sdhci_pci_chip *chip) +{ +struct gpiod_lookup_table *cd_gpio_lookup_table; +const struct dmi_system_id *dmi_id =NULL ; +size_t count; + +if (chip->fixes && chip->fixes->cd_gpio_override) + dmi_id =dmi_first_match (chip->fixes->cd_gpio_override); + +if (!dmi_id) +return NULL ; + + cd_gpio_lookup_table = dmi_id->driver_data; +for (count =0 ; cd_gpio_lookup_table->table[count].key; count++) + ; + + cd_gpio_lookup_table =kmemdup (dmi_id->driver_data, +/* count + 1 terminating entry */ +struct_size (cd_gpio_lookup_table, table, count +1 ), +GFP_KERNEL ); +if (!cd_gpio_lookup_table) +return ERR_PTR (-ENOMEM ); + +gpiod_add_lookup_table (cd_gpio_lookup_table); +return cd_gpio_lookup_table; +} + +static void sdhci_pci_remove_gpio_lookup_table (struct gpiod_lookup_table *lookup_table) +{ +if (lookup_table) { +gpiod_remove_lookup_table (lookup_table); +kfree (lookup_table); + } +} +static struct sdhci_pci_slot *sdhci_pci_probe_slot (struct pci_dev *pdev,struct sdhci_pci_chip *chip,int first_bar,int slotno)
@@ -2224,8 +2285,19 @@ static struct sdhci_pci_slot *sdhci_pci_device_init_wakeup (&pdev->dev, true);if (slot->cd_idx >=0 ) { +struct gpiod_lookup_table *cd_gpio_lookup_table; + + cd_gpio_lookup_table =sdhci_pci_add_gpio_lookup_table (chip); +if (IS_ERR (cd_gpio_lookup_table)) { + ret =PTR_ERR (cd_gpio_lookup_table); + goto remove; + } + ret =mmc_gpiod_request_cd (host->mmc,"cd" , slot->cd_idx, slot->cd_override_level,0 ); + +sdhci_pci_remove_gpio_lookup_table (cd_gpio_lookup_table); +if (ret && ret != -EPROBE_DEFER ) ret = mmc_gpiod_request_cd(host->mmc, NULL, slot->cd_idx,
drivers/mmc/host/sdhci-pci.h +1 -0
@@ -151,6 +151,7 @@ struct sdhci_pci_fixes {#endif const struct sdhci_ops *ops; +const struct dmi_system_id *cd_gpio_override;size_t priv_size; };
Greg Kroah-Hartman
maintainerPATCH 466/565 mmc: core: Further prevent card detect during shutdown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit 87a0d90fcd31c0f36da0332428c9e1a1e0f97432 upstream.
Disabling card detect from the host's ->shutdown_pre() callback turned out to not be the complete solution. More precisely, beyond the point when the mmc_bus->shutdown() has been called, to gracefully power off the card, we need to prevent card detect. Otherwise the mmc_rescan work may poll for the card with a CMD13, to see if it's still alive, which then will fail and hang as the card has already been powered off.
To fix this problem, let's disable mmc_rescan prior to power off the card during shutdown.
Message-ID: <[email protected]>
--- drivers/mmc/core/bus.c | 2 ++ drivers/mmc/core/core.c | 3 +++ 2 files changed, 5 insertions(+)
drivers/mmc/core/bus.c +2 -0
@@ -158,6 +158,8 @@ static void mmc_bus_shutdown(struct deviif (dev->driver && drv->shutdown) drv->shutdown (card); +__mmc_stop_host (host); +if (host->bus_ops->shutdown) { ret = host->bus_ops->shutdown (host);if (ret)
drivers/mmc/core/core.c +3 -0
@@ -2282,6 +2282,9 @@ void mmc_start_host(struct mmc_host *hosvoid __mmc_stop_host (struct mmc_host *host) { +if (host->rescan_disable) +return ; +if (host->slot.cd_irq >=0 ) {mmc_gpio_set_cd_wake (host, false);disable_irq (host->slot.cd_irq);
Greg Kroah-Hartman
maintainerPATCH 467/565 ocfs2: update seq_file index in ocfs2_dlm_seq_next
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wengang Wang <[email protected]>
commit 914eec5e980171bc128e7e24f7a22aa1d803570e upstream.
The following INFO level message was seen:
seq_file: buggy .next function ocfs2_dlm_seq_next [ocfs2] did not update position index
Fix:
Update *pos (so m->index) to make seq_read_iter happy though the index its self makes no sense to ocfs2_dlm_seq_next.
--- fs/ocfs2/dlmglue.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/dlmglue.c +1 -0
@@ -3108,6 +3108,7 @@ static void *ocfs2_dlm_seq_next(struct sstruct ocfs2_lock_res *iter = v;struct ocfs2_lock_res *dummy = &priv->p_iter_res; + (*pos)++;spin_lock (&ocfs2_dlm_tracking_lock); iter =ocfs2_dlm_next_res (iter, priv);list_del_init (&dummy->l_debug_list);
Greg Kroah-Hartman
maintainerPATCH 468/565 iommu/arm-smmu: Defer probe of clients after smmu device bound
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Brahma <[email protected]>
commit 229e6ee43d2a160a1592b83aad620d6027084aad upstream.
Null pointer dereference occurs due to a race between smmu driver probe and client driver probe, when of_dma_configure() for client is called after the iommu_device_register() for smmu driver probe has executed but before the driver_bound() for smmu driver has been called.
Following is how the race occurs:
T1:Smmu device probe T2: Client device probe
really_probe()arm_smmu_device_probe()iommu_device_register()
really_probe() platform_dma_configure() of_dma_configure() of_dma_configure_id() of_iommu_configure() iommu_probe_device() iommu_init_device() arm_smmu_probe_device() arm_smmu_get_by_fwnode() driver_find_device_by_fwnode() driver_find_device() next_device() klist_next() /* null ptr assigned to smmu */ /* null ptr dereference while smmu->streamid_mask */
driver_bound()
klist_add_tail()
When this null smmu pointer is dereferenced later in arm_smmu_probe_device, the device crashes.
Fix this by deferring the probe of the client device until the smmu device has bound to the arm smmu driver.
--- drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/iommu/arm/arm-smmu/arm-smmu.c +11 -0
@@ -1375,6 +1375,17 @@ static struct iommu_device *arm_smmu_pro goto out_free; }else if (fwspec && fwspec->ops == &arm_smmu_ops) { smmu =arm_smmu_get_by_fwnode (fwspec->iommu_fwnode); + +/* +* Defer probe if the relevant SMMU instance hasn't finished +* probing yet. This is a fragile hack and we'd ideally +* avoid this race in the core code. Until that's ironed +* out, however, this is the most pragmatic option on the +* table. +*/ +if (!smmu) +return ERR_PTR (dev_err_probe (dev, -EPROBE_DEFER , +"smmu dev has not bound yet\n" )); }else {return ERR_PTR (-ENODEV ); }
Greg Kroah-Hartman
maintainerPATCH 469/565 epoll: annotate racy check
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 6474353a5e3d0b2cf610153cea0c61f576a36d0a ]
Epoll relies on a racy fastpath check during __fput() in eventpoll_release() to avoid the hit of pointlessly acquiring a semaphore. Annotate that race by using WRITE_ONCE() and READ_ONCE().
--- fs/eventpoll.c | 6 ++++-- include/linux/eventpoll.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
fs/eventpoll.c +4 -2
@@ -696,7 +696,8 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi) to_free =NULL ; head = file->f_ep;if (head->first == &epi->fllink && !epi->fllink.next) { - file->f_ep =NULL ; +/* See eventpoll_release() for details. */ +WRITE_ONCE (file->f_ep,NULL );if (!is_file_epoll (file)) {struct epitems_head *v; v = container_of(head, struct epitems_head, epitems);
@@ -1460,7 +1461,8 @@ static int attach_epitem(struct file *file, struct epitem *epi)spin_unlock (&file->f_lock); goto allocate; } - file->f_ep = head; +/* See eventpoll_release() for details. */ +WRITE_ONCE (file->f_ep, head); to_free =NULL ; }hlist_add_head_rcu (&epi->fllink, file->f_ep);
include/linux/eventpoll.h +1 -1
@@ -42,7 +42,7 @@ static inline void eventpoll_release(struct file *file)* because the file in on the way to be removed and nobody ( but * eventpoll ) has still a reference to this file. */ -if (likely (!file->f_ep)) +if (likely (!READ_ONCE (file->f_ep)))return ;/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 470/565 s390/cpum_sf: Handle CPU hotplug remove during sampling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit a0bd7dacbd51c632b8e2c0500b479af564afadf3 ]
CPU hotplug remove handling triggers the following function call sequence:
CPUHP_AP_PERF_S390_SF_ONLINE --> s390_pmu_sf_offline_cpu()
...
CPUHP_AP_PERF_ONLINE --> perf_event_exit_cpu()
The s390 CPUMF sampling CPU hotplug handler invokes:
s390_pmu_sf_offline_cpu()
+--> cpusf_pmu_setup()
+--> setup_pmc_cpu()
+--> deallocate_buffers()This function de-allocates all sampling data buffers (SDBs) allocated for that CPU at event initialization. It also clears the PMU_F_RESERVED bit. The CPU is gone and can not be sampled.
With the event still being active on the removed CPU, the CPU event hotplug support in kernel performance subsystem triggers the following function calls on the removed CPU:
perf_event_exit_cpu()
+--> perf_event_exit_cpu_context()
+--> __perf_event_exit_context()
+--> __perf_remove_from_context()
+--> event_sched_out()
+--> cpumsf_pmu_del()
+--> cpumsf_pmu_stop()
+--> hw_perf_event_update()to stop and remove the event. During removal of the event, the sampling device driver tries to read out the remaining samples from the sample data buffers (SDBs). But they have already been freed (and may have been re-assigned). This may lead to a use after free situation in which case the samples are most likely invalid. In the best case the memory has not been reassigned and still contains valid data.
Remedy this situation and check if the CPU is still in reserved state (bit PMU_F_RESERVED set). In this case the SDBs have not been released an contain valid data. This is always the case when the event is removed (and no CPU hotplug off occured). If the PMU_F_RESERVED bit is not set, the SDB buffers are gone.
--- arch/s390/kernel/perf_cpum_sf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/s390/kernel/perf_cpum_sf.c +3 -1
@@ -1896,7 +1896,9 @@ static void cpumsf_pmu_stop(struct perf_event *event, int flags) event->hw.state |=PERF_HES_STOPPED ;if ((flags &PERF_EF_UPDATE ) && !(event->hw.state &PERF_HES_UPTODATE )) { -hw_perf_event_update (event,1 ); +/* CPU hotplug off removes SDBs. No samples to extract. */ +if (cpuhw->flags &PMU_F_RESERVED ) +hw_perf_event_update (event,1 ); event->hw.state |=PERF_HES_UPTODATE ; }perf_pmu_enable (event->pmu);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 471/565 btrfs: avoid unnecessary device path update for the same device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 2e8b6bc0ab41ce41e6dfcc204b6cc01d5abbc952 ]
[PROBLEM]
It is very common for udev to trigger device scan, and every time a mounted btrfs device got re-scan from different soft links, we will get some of unnecessary device path updates, this is especially common for LVM based storage:
# lvs scratch1 test -wi-ao---- 10.00g scratch2 test -wi-a----- 10.00g scratch3 test -wi-a----- 10.00g scratch4 test -wi-a----- 10.00g scratch5 test -wi-a----- 10.00g test test -wi-a----- 10.00g
# mkfs.btrfs -f /dev/test/scratch1 # mount /dev/test/scratch1 /mnt/btrfs # dmesg -c [ 205.705234] BTRFS: device fsid 7be2602f-9e35-4ecf-a6ff-9e91d2c182c9 devid 1 transid 6 /dev/mapper/test-scratch1 (253:4) scanned by mount (1154) [ 205.710864] BTRFS info (device dm-4): first mount of filesystem 7be2602f-9e35-4ecf-a6ff-9e91d2c182c9 [ 205.711923] BTRFS info (device dm-4): using crc32c (crc32c-intel) checksum algorithm [ 205.713856] BTRFS info (device dm-4): using free-space-tree [ 205.722324] BTRFS info (device dm-4): checking UUID tree
So far so good, but even if we just touched any soft link of "dm-4", we will get quite some unnecessary device path updates.
# touch /dev/mapper/test-scratch1 # dmesg -c [ 469.295796] BTRFS info: devid 1 device path /dev/mapper/test-scratch1 changed to /dev/dm-4 scanned by (udev-worker) (1221) [ 469.300494] BTRFS info: devid 1 device path /dev/dm-4 changed to /dev/mapper/test-scratch1 scanned by (udev-worker) (1221)
Such device path rename is unnecessary and can lead to random path change due to the udev race.
[CAUSE]
Inside device_list_add(), we are using a very primitive way checking if the device has changed, strcmp().
Which can never handle links well, no matter if it's hard or soft links.
So every different link of the same device will be treated as a different device, causing the unnecessary device path update.
[FIX]
Introduce a helper, is_same_device(), and use path_equal() to properly detect the same block device.
So that the different soft links won't trigger the rename race.
--- fs/btrfs/volumes.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +37 -1
@@ -717,6 +717,42 @@ u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb)return has_metadata_uuid ? sb->metadata_uuid : sb->fsid; } +static bool is_same_device (struct btrfs_device *device,const char *new_path) +{ +struct path old = { .mnt =NULL , .dentry =NULL }; +struct path new = { .mnt =NULL , .dentry =NULL }; +char *old_path =NULL ; +bool is_same = false; +int ret; + +if (!device->name) + goto out; + + old_path =kzalloc (PATH_MAX ,GFP_NOFS ); +if (!old_path) + goto out; + +rcu_read_lock (); + ret =strscpy (old_path,rcu_str_deref (device->name),PATH_MAX ); +rcu_read_unlock (); +if (ret <0 ) + goto out; + + ret =kern_path (old_path,LOOKUP_FOLLOW , &old); +if (ret) + goto out; + ret =kern_path (new_path,LOOKUP_FOLLOW , &new); +if (ret) + goto out; +if (path_equal (&old, &new)) + is_same = true; +out: +kfree (old_path); +path_put (&old); +path_put (&new); +return is_same; +} +/* * Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices * being created with a disk that has already completed its fsid change. Such
@@ -922,7 +958,7 @@ static noinline struct btrfs_device *device_list_add(const char *path, disk_super->fsid, devid, found_transid, path, current->comm, task_pid_nr(current)); - }else if (!device->name ||strcmp (device->name->str, path)) { + }else if (!device->name || !is_same_device (device, path)) {/* * When FS is already mounted. * 1. If you are here and if the device->name is NULL that
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 472/565 kselftest/arm64: Dont leak pipe fds in pac.exec_sign_all()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit 27141b690547da5650a420f26ec369ba142a9ebb ]
The PAC exec_sign_all() test spawns some child processes, creating pipes to be stdin and stdout for the child. It cleans up most of the file descriptors that are created as part of this but neglects to clean up the parent end of the child stdin and stdout. Add the missing close() calls.
--- tools/testing/selftests/arm64/pauth/pac.c | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/arm64/pauth/pac.c +3 -0
@@ -182,6 +182,9 @@ int exec_sign_all(struct signatures *signed_vals, size_t val)return -1 ; } +close (new_stdin[1 ]); +close (new_stdout[0 ]); +return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 473/565 kcsan: Turn report_filterlist_lock into a raw_spinlock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Elver <[email protected]>
[ Upstream commit 59458fa4ddb47e7891c61b4a928d13d5f5b00aa0 ]
Ran Xiaokai reports that with a KCSAN-enabled PREEMPT_RT kernel, we can see splats like:
| BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 | in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1 | preempt_count: 10002, expected: 0 | RCU nest depth: 0, expected: 0 | no locks held by swapper/1/0. | irq event stamp: 156674 | hardirqs last enabled at (156673): [<ffffffff81130bd9>] do_idle+0x1f9/0x240 | hardirqs last disabled at (156674): [<ffffffff82254f84>] sysvec_apic_timer_interrupt+0x14/0xc0 | softirqs last enabled at (0): [<ffffffff81099f47>] copy_process+0xfc7/0x4b60 | softirqs last disabled at (0): [<0000000000000000>] 0x0 | Preemption disabled at: | [<ffffffff814a3e2a>] paint_ptr+0x2a/0x90 | CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.11.0+ #3 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 | Call Trace: | <IRQ> | dump_stack_lvl+0x7e/0xc0 | dump_stack+0x1d/0x30 | __might_resched+0x1a2/0x270 | rt_spin_lock+0x68/0x170 | kcsan_skip_report_debugfs+0x43/0xe0 | print_report+0xb5/0x590 | kcsan_report_known_origin+0x1b1/0x1d0 | kcsan_setup_watchpoint+0x348/0x650 | __tsan_unaligned_write1+0x16d/0x1d0 | hrtimer_interrupt+0x3d6/0x430 | __sysvec_apic_timer_interrupt+0xe8/0x3a0 | sysvec_apic_timer_interrupt+0x97/0xc0 | </IRQ>
On a detected data race, KCSAN's reporting logic checks if it should filter the report. That list is protected by the report_filterlist_lock *non-raw* spinlock which may sleep on RT kernels.
Since KCSAN may report data races in any context, convert it to a raw_spinlock.
This requires being careful about when to allocate memory for the filter list itself which can be done via KCSAN's debugfs interface. Concurrent modification of the filter list via debugfs should be rare: the chosen strategy is to optimistically pre-allocate memory before the critical section and discard if unused.
--- kernel/kcsan/debugfs.c | 74 ++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 38 deletions(-)
kernel/kcsan/debugfs.c +36 -38
@@ -46,14 +46,8 @@ static struct {int used;/* number of elements used */ bool sorted;/* if elements are sorted */ bool whitelist;/* if list is a blacklist or whitelist */ -} report_filterlist = { - .addrs = NULL, - .size = 8, /* small initial size */ - .used = 0, - .sorted = false, - .whitelist = false, /* default is blacklist */ -}; -static DEFINE_SPINLOCK (report_filterlist_lock); +} report_filterlist; +static DEFINE_RAW_SPINLOCK (report_filterlist_lock);/* * The microbenchmark allows benchmarking KCSAN core runtime only. To run
@@ -110,7 +104,7 @@ bool kcsan_skip_report_debugfs(unsigned long func_addr)return false; func_addr -= offset;/* Get function start */ -spin_lock_irqsave (&report_filterlist_lock, flags); +raw_spin_lock_irqsave (&report_filterlist_lock, flags);if (report_filterlist.used ==0 ) goto out;
@@ -127,7 +121,7 @@ bool kcsan_skip_report_debugfs(unsigned long func_addr) ret = !ret; out: -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags);return ret; }
@@ -135,9 +129,9 @@ static void set_report_filterlist_whitelist(bool whitelist) {unsigned long flags; -spin_lock_irqsave (&report_filterlist_lock, flags); +raw_spin_lock_irqsave (&report_filterlist_lock, flags); report_filterlist.whitelist = whitelist; -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags); }/* Returns 0 on success, error-code otherwise. */
@@ -145,6 +139,9 @@ static ssize_t insert_report_filterlist(const char *func) {unsigned long flags;unsigned long addr =kallsyms_lookup_name (func); +unsigned long *delay_free =NULL ; +unsigned long *new_addrs =NULL ; +size_t new_size =0 ;ssize_t ret =0 ;if (!addr) {
@@ -152,32 +149,33 @@ static ssize_t insert_report_filterlist(const char *func)return -ENOENT ; } -spin_lock_irqsave (&report_filterlist_lock, flags); +retry_alloc: +/* +* Check if we need an allocation, and re-validate under the lock. Since +* the report_filterlist_lock is a raw, cannot allocate under the lock. +*/ +if (data_race (report_filterlist.used == report_filterlist.size)) { + new_size = (report_filterlist.size ?:4 ) *2 ; + delay_free = new_addrs =kmalloc_array (new_size,sizeof (unsigned long ),GFP_KERNEL ); +if (!new_addrs) +return -ENOMEM ; + } -if (report_filterlist.addrs ==NULL ) { -/* initial allocation */ - report_filterlist.addrs = -kmalloc_array (report_filterlist.size, -sizeof (unsigned long ),GFP_ATOMIC ); -if (report_filterlist.addrs ==NULL ) { - ret = -ENOMEM ; - goto out; - } - }else if (report_filterlist.used == report_filterlist.size) { -/* resize filterlist */ -size_t new_size = report_filterlist.size *2 ; -unsigned long *new_addrs = -krealloc (report_filterlist.addrs, - new_size *sizeof (unsigned long ),GFP_ATOMIC ); - -if (new_addrs ==NULL ) { -/* leave filterlist itself untouched */ - ret = -ENOMEM ; - goto out; +raw_spin_lock_irqsave (&report_filterlist_lock, flags); +if (report_filterlist.used == report_filterlist.size) { +/* Check we pre-allocated enough, and retry if not. */ +if (report_filterlist.used >= new_size) { +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags); +kfree (new_addrs);/* kfree(NULL) is safe */ + delay_free = new_addrs =NULL ; + goto retry_alloc; } +if (report_filterlist.used) +memcpy (new_addrs, report_filterlist.addrs, report_filterlist.used *sizeof (unsigned long )); + delay_free = report_filterlist.addrs;/* free the old list */ + report_filterlist.addrs = new_addrs;/* switch to the new list */ report_filterlist.size = new_size; - report_filterlist.addrs = new_addrs; }/* Note: deduplicating should be done in userspace. */
@@ -185,9 +183,9 @@ static ssize_t insert_report_filterlist(const char *func)kallsyms_lookup_name (func); report_filterlist.sorted = false; -out: -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags); +kfree (delay_free);return ret; }
@@ -204,13 +202,13 @@ static int show_info(struct seq_file *file, void *v) }/* show filter functions, and filter type */ -spin_lock_irqsave (&report_filterlist_lock, flags); +raw_spin_lock_irqsave (&report_filterlist_lock, flags);seq_printf (file,"\n%s functions: %s\n" , report_filterlist.whitelist ?"whitelisted" :"blacklisted" , report_filterlist.used ==0 ?"none" :"" );for (i =0 ; i < report_filterlist.used; ++i)seq_printf (file," %ps\n" , (void *)report_filterlist.addrs[i]); -spin_unlock_irqrestore (&report_filterlist_lock, flags); +raw_spin_unlock_irqrestore (&report_filterlist_lock, flags);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 474/565 media: uvcvideo: Add a quirk for the Kaiweets KTI-W02 infrared camera
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Given <[email protected]>
[ Upstream commit b2ec92bb5605452d539a7aa1e42345b95acd8583 ]
Adds a quirk to make the NXP Semiconductors 1fc9:009b chipset work.
lsusb for the device reports:
Bus 003 Device 011: ID 1fc9:009b NXP Semiconductors IR VIDEO Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 [unknown]
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x1fc9 NXP Semiconductors
idProduct 0x009b IR VIDEO
bcdDevice 1.01
iManufacturer 1 Guide sensmart iProduct 2 IR VIDEO iSerial 0 bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x00c2
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 3 IR Camera
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 0
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.00
wTotalLength 0x0033
dwClockFrequency 6.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x00000000
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 1
iTerminal 0
VideoControl Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 5 (PROCESSING_UNIT)
Warning: Descriptor too short
bUnitID 3
bSourceID 1
wMaxMultiplier 0
bControlSize 2
bmControls 0x00000000
iProcessing 0
bmVideoStandards 0x62
NTSC - 525/60
PAL - 525/60
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
VideoStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 1
wTotalLength 0x0055
bEndpointAddress 0x82 EP 2 IN
bmInfo 0
bTerminalLink 2
bStillCaptureMethod 2
bTriggerSupport 0
bTriggerUsage 0
bControlSize 1
bmaControls( 0) 0
VideoStreaming Interface Descriptor:
bLength 27
bDescriptorType 36
bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED)
bFormatIndex 1
bNumFrameDescriptors 1
guidFormat {e436eb7b-524f-11ce-9f53-0020af0ba770}
bBitsPerPixel 16
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 1
bmCapabilities 0x00
Still image unsupported
wWidth 240
wHeight 322
dwMinBitRate 12364800
dwMaxBitRate 30912000
dwMaxVideoFrameBufferSize 154560
dwDefaultFrameInterval 400000
bFrameIntervalType 2
dwFrameInterval( 0) 400000
dwFrameInterval( 1) 1000000
VideoStreaming Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 3 (STILL_IMAGE_FRAME)
bEndpointAddress 0x00 EP 0 OUT
bNumImageSizePatterns 1
wWidth( 0) 240
wHeight( 0) 322
bNumCompressionPatterns 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 1
Device Status: 0x0001
Self Powered
--- drivers/media/usb/uvc/uvc_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +11 -0
@@ -2699,6 +2699,8 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {* The Logitech cameras listed below have their interface class set to * VENDOR_SPEC because they don't announce themselves as UVC devices, even * though they are compliant. +* +* Sort these by vendor/product ID. */ static const struct usb_device_id uvc_ids[] = {/* LogiLink Wireless Webcam */
@@ -3178,6 +3180,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceProtocol = 0, .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_PROBE_MINMAX | UVC_QUIRK_IGNORE_SELECTOR_UNIT) }, +/* NXP Semiconductors IR VIDEO */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x1fc9, + .idProduct = 0x009b, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },/* Oculus VR Positional Tracker DK2 */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 475/565 media: cx231xx: Add support for Dexatek USB Video Grabber 1d19:6108
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rohan Barar <[email protected]>
[ Upstream commit 61a830bc0ea69a05d8a4534f825c6aa618263649 ]
Add Dexatek Technology Ltd USB Video Grabber 1d19:6108 to the cx231xx driver. This device is sold under the name "BAUHN DVD Maker (DK8723)" by ALDI in Australia.
This device is similar to 1d19:6109, which is already included in cx231xx.
Both video and audio capture function correctly after installing the patched cx231xx driver.
Patch Changelog
v1:
- Initial submission.
v2:
- Fix SoB + Improve subject.
v3:
- Rephrase message to not exceed 75 characters per line.
- Removed reference to external GitHub URL.
--- drivers/media/usb/cx231xx/cx231xx-cards.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/cx231xx/cx231xx-cards.c +2 -0
@@ -994,6 +994,8 @@ const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);/* table of devices that work with this driver */ struct usb_device_id cx231xx_id_table[] = { + {USB_DEVICE (0x1D19 ,0x6108 ), + .driver_info =CX231XX_BOARD_PV_XCAPTURE_USB }, {USB_DEVICE (0x1D19 ,0x6109 ), .driver_info =CX231XX_BOARD_PV_XCAPTURE_USB }, {USB_DEVICE (0x0572 ,0x5A3C ),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 476/565 soc: imx8m: Probe the SoC driver as platform driver
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 9cc832d37799dbea950c4c8a34721b02b8b5a8ff ]
With driver_async_probe=* on kernel command line, the following trace is produced because on i.MX8M Plus hardware because the soc-imx8m.c driver calls of_clk_get_by_name() which returns -EPROBE_DEFER because the clock driver is not yet probed. This was not detected during regular testing without driver_async_probe.
Convert the SoC code to platform driver and instantiate a platform device in its current device_initcall() to probe the platform driver. Rework .soc_revision callback to always return valid error code and return SoC revision via parameter. This way, if anything in the .soc_revision callback return -EPROBE_DEFER, it gets propagated to .probe and the .probe will get retried later.
"
------------[ cut here ]------------ WARNING: CPU: 1 PID: 1 at drivers/soc/imx/soc-imx8m.c:115 imx8mm_soc_revision+0xdc/0x180 CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-next-20240924-00002-g2062bb554dea #603 Hardware name: DH electronics i.MX8M Plus DHCOM Premium Developer Kit (3) (DT) pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : imx8mm_soc_revision+0xdc/0x180 lr : imx8mm_soc_revision+0xd0/0x180
sp : ffff8000821fbcc0
x29: ffff8000821fbce0 x28: 0000000000000000 x27: ffff800081810120
x26: ffff8000818a9970 x25: 0000000000000006 x24: 0000000000824311
x23: ffff8000817f42c8 x22: ffff0000df8be210 x21: fffffffffffffdfb
x20: ffff800082780000 x19: 0000000000000001 x18: ffffffffffffffff
x17: ffff800081fff418 x16: ffff8000823e1000 x15: ffff0000c03b65e8
x14: ffff0000c00051b0 x13: ffff800082790000 x12: 0000000000000801
x11: ffff80008278ffff x10: ffff80008209d3a6 x9 : ffff80008062e95c x8 : ffff8000821fb9a0 x7 : 0000000000000000 x6 : 00000000000080e3 x5 : ffff0000df8c03d8 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000000 x1 : fffffffffffffdfb x0 : fffffffffffffdfb
Call trace: imx8mm_soc_revision+0xdc/0x180 imx8_soc_init+0xb0/0x1e0 do_one_initcall+0x94/0x1a8 kernel_init_freeable+0x240/0x2a8 kernel_init+0x28/0x140 ret_from_fork+0x10/0x20 ---[ end trace 0000000000000000 ]---
SoC: i.MX8MP revision 1.1
"
--- drivers/soc/imx/soc-imx8m.c | 107 ++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 22 deletions(-)
drivers/soc/imx/soc-imx8m.c +85 -22
@@ -30,7 +30,7 @@struct imx8_soc_data {char *name; -u32 (*soc_revision)(void ); +int (*soc_revision)(u32 *socrev); };static u64 soc_uid;
@@ -51,24 +51,29 @@ static u32 imx8mq_soc_revision_from_atf(void)static inline u32 imx8mq_soc_revision_from_atf (void ) {return 0 ; };#endif -static u32 __init imx8mq_soc_revision (void ) +static int imx8mq_soc_revision (u32 *socrev) {struct device_node *np;void __iomem *ocotp_base;u32 magic;u32 rev;struct clk *clk; +int ret; np =of_find_compatible_node (NULL ,NULL ,"fsl,imx8mq-ocotp" );if (!np) -return 0 ; +return -EINVAL ; ocotp_base =of_iomap (np,0 ); -WARN_ON (!ocotp_base); +if (!ocotp_base) { + ret = -EINVAL ; + goto err_iomap; + } + clk =of_clk_get_by_name (np,NULL );if (IS_ERR (clk)) { -WARN_ON (IS_ERR (clk)); -return 0 ; + ret =PTR_ERR (clk); + goto err_clk; }clk_prepare_enable (clk);
@@ -88,32 +93,45 @@ static u32 __init imx8mq_soc_revision(void) soc_uid <<=32 ; soc_uid |=readl_relaxed (ocotp_base +OCOTP_UID_LOW ); + *socrev = rev; +clk_disable_unprepare (clk);clk_put (clk);iounmap (ocotp_base);of_node_put (np); -return rev; +return 0 ; + +err_clk: +iounmap (ocotp_base); +err_iomap: +of_node_put (np); +return ret; } -static void __init imx8mm_soc_uid (void ) +static int imx8mm_soc_uid (void ) {void __iomem *ocotp_base;struct device_node *np;struct clk *clk; +int ret =0 ;u32 offset =of_machine_is_compatible ("fsl,imx8mp" ) ?IMX8MP_OCOTP_UID_OFFSET :0 ; np =of_find_compatible_node (NULL ,NULL ,"fsl,imx8mm-ocotp" );if (!np) -return ; +return -EINVAL ; ocotp_base =of_iomap (np,0 ); -WARN_ON (!ocotp_base); +if (!ocotp_base) { + ret = -EINVAL ; + goto err_iomap; + } + clk =of_clk_get_by_name (np,NULL );if (IS_ERR (clk)) { -WARN_ON (IS_ERR (clk)); -return ; + ret =PTR_ERR (clk); + goto err_clk; }clk_prepare_enable (clk);
@@ -124,31 +142,41 @@ static void __init imx8mm_soc_uid(void)clk_disable_unprepare (clk);clk_put (clk); + +err_clk:iounmap (ocotp_base); +err_iomap:of_node_put (np); + +return ret; } -static u32 __init imx8mm_soc_revision (void ) +static int imx8mm_soc_revision (u32 *socrev) {struct device_node *np;void __iomem *anatop_base; -u32 rev; +int ret; np =of_find_compatible_node (NULL ,NULL ,"fsl,imx8mm-anatop" );if (!np) -return 0 ; +return -EINVAL ; anatop_base =of_iomap (np,0 ); -WARN_ON (!anatop_base); +if (!anatop_base) { + ret = -EINVAL ; + goto err_iomap; + } - rev =readl_relaxed (anatop_base +ANADIG_DIGPROG_IMX8MM ); + *socrev =readl_relaxed (anatop_base +ANADIG_DIGPROG_IMX8MM );iounmap (anatop_base);of_node_put (np); -imx8mm_soc_uid (); +return imx8mm_soc_uid (); -return rev; +err_iomap: +of_node_put (np); +return ret; }static const struct imx8_soc_data imx8mq_soc_data = {
@@ -184,7 +212,7 @@ static __maybe_unused const struct of_device_id imx8_soc_match[] = { kasprintf(GFP_KERNEL, "%d.%d", (soc_rev >> 4) & 0xf, soc_rev & 0xf) : \ "unknown" -static int __init imx8_soc_init(void) +static int imx8m_soc_probe(struct platform_device *pdev) {struct soc_device_attribute *soc_dev_attr;struct soc_device *soc_dev;
@@ -212,8 +240,11 @@ static int __init imx8_soc_init(void) data = id->data;if (data) { soc_dev_attr->soc_id = data->name; -if (data->soc_revision) - soc_rev = data->soc_revision (); +if (data->soc_revision) { + ret = data->soc_revision (&soc_rev); +if (ret) + goto free_soc; + } } soc_dev_attr->revision =imx8_revision (soc_rev);
@@ -251,4 +282,36 @@ static int __init imx8_soc_init(void)kfree (soc_dev_attr);return ret; } + +static struct platform_driver imx8m_soc_driver = { + .probe = imx8m_soc_probe, + .driver = { + .name ="imx8m-soc" , + }, +}; + +static int __init imx8_soc_init (void ) +{ +struct platform_device *pdev; +int ret; + +/* No match means this is non-i.MX8M hardware, do nothing. */ +if (!of_match_node (imx8_soc_match, of_root)) +return 0 ; + + ret =platform_driver_register (&imx8m_soc_driver); +if (ret) { +pr_err ("Failed to register imx8m-soc platform driver: %d\n" , ret); +return ret; + } + + pdev =platform_device_register_simple ("imx8m-soc" ,-1 ,NULL ,0 ); +if (IS_ERR (pdev)) { +pr_err ("Failed to register imx8m-soc platform device: %ld\n" ,PTR_ERR (pdev)); +platform_driver_unregister (&imx8m_soc_driver); +return PTR_ERR (pdev); + } + +return 0 ; +}device_initcall (imx8_soc_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 477/565 drm/vc4: hvs: Set AXI panic modes for the HVS
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 014eccc9da7bfc76a3107fceea37dd60f1d63630 ]
The HVS can change AXI request mode based on how full the COB FIFOs are.
Until now the vc4 driver has been relying on the firmware to have set these to sensible values.
With HVS channel 2 now being used for live video, change the panic mode for all channels to be explicitly set by the driver, and the same for all channels.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/vc4/vc4_hvs.c +11 -0
@@ -729,6 +729,17 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC1 ); dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC2 ); +/* Set AXI panic mode. +* VC4 panics when < 2 lines in FIFO. +* VC5 panics when less than 1 line in the FIFO. +*/ + dispctrl &= ~(SCALER_DISPCTRL_PANIC0_MASK | +SCALER_DISPCTRL_PANIC1_MASK | +SCALER_DISPCTRL_PANIC2_MASK ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC0 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC1 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC2 ); +HVS_WRITE (SCALER_DISPCTRL , dispctrl); ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 478/565 drm: panel-orientation-quirks: Add quirk for AYA NEO 2 model
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joaquín Ignacio Aramendía <[email protected]>
[ Upstream commit 361ebf5ef843b0aa1704c72eb26b91cf76c3c5b7 ]
Add quirk orientation for AYA NEO 2. The name appears without spaces in DMI strings. That made it difficult to reuse the 2021 match. Also the display is larger in resolution.
Tested by the JELOS team that has been patching their own kernel for a while now and confirmed by users in the AYA NEO and ChimeraOS discord servers.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -166,6 +166,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AYANEO 2 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* AYA NEO 2021 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYADEVICE"),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 479/565 drm/mcde: Enable module autoloading
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Chen <[email protected]>
[ Upstream commit 8a16b5cdae26207ff4c22834559384ad3d7bc970 ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from of_device_id table.
--- drivers/gpu/drm/mcde/mcde_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mcde/mcde_drv.c +1 -0
@@ -475,6 +475,7 @@ static const struct of_device_id mcde_of_match[] = { }, {}, }; +MODULE_DEVICE_TABLE (of, mcde_of_match);static struct platform_driver mcde_driver = { .driver = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 480/565 drm/radeon/r600_cs: Fix possible int overflow in r600_packet3_check()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Artemiev <[email protected]>
[ Upstream commit a1e2da6a5072f8abe5b0feaa91a5bcd9dc544a04 ]
It is possible, although unlikely, that an integer overflow will occur when the result of radeon_get_ib_value() is shifted to the left.
Avoid it by casting one of the operands to larger data type (u64).
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/radeon/r600_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r600_cs.c +1 -1
@@ -2106,7 +2106,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p,return -EINVAL ; } - offset =radeon_get_ib_value (p, idx+1 ) <<8 ; + offset = (u64 )radeon_get_ib_value (p, idx+1 ) <<8 ;if (offset != track->vgt_strmout_bo_offset[idx_value]) {DRM_ERROR ("bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n" , offset, track->vgt_strmout_bo_offset[idx_value]);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 481/565 r8169: dont apply UDP padding quirk on RTL8126A
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
[ Upstream commit 87e26448dbda4523b73a894d96f0f788506d3795 ]
Vendor drivers r8125/r8126 indicate that this quirk isn't needed any longer for RTL8126A. Mimic this in r8169.
--- drivers/net/ethernet/realtek/r8169_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +10 -4
@@ -4148,8 +4148,8 @@ static unsigned int rtl8125_quirk_udp_padto(struct rtl8169_private *tp, {unsigned int padto =0 , len = skb->len; -if (rtl_is_8125 (tp) && len <128 +RTL_MIN_PATCH_LEN && -rtl_skb_is_udp (skb) &&skb_transport_header_was_set (skb)) { +if (len <128 +RTL_MIN_PATCH_LEN &&rtl_skb_is_udp (skb) && +skb_transport_header_was_set (skb)) {unsigned int trans_data_len =skb_tail_pointer (skb) -skb_transport_header (skb);
@@ -4173,9 +4173,15 @@ static unsigned int rtl8125_quirk_udp_padto(struct rtl8169_private *tp,static unsigned int rtl_quirk_packet_padto (struct rtl8169_private *tp,struct sk_buff *skb) { -unsigned int padto; +unsigned int padto =0 ; - padto =rtl8125_quirk_udp_padto (tp, skb); +switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_63: + padto =rtl8125_quirk_udp_padto (tp, skb); +break ; +default : +break ; + }switch (tp->mac_version) {case RTL_GIGA_MAC_VER_34 :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 482/565 samples/bpf: Fix a resource leak
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <[email protected]>
[ Upstream commit f3ef53174b23246fe9bc2bbc2542f3a3856fa1e2 ]
The opened file should be closed in show_sockopts(), otherwise resource leak will occur that this problem was discovered by reading code
--- samples/bpf/test_cgrp2_sock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
samples/bpf/test_cgrp2_sock.c +3 -1
@@ -174,8 +174,10 @@ static int show_sockopts(int family)return 1 ; } -if (get_bind_to_device (sd, name,sizeof (name)) <0 ) +if (get_bind_to_device (sd, name,sizeof (name)) <0 ) { +close (sd);return 1 ; + } mark =get_somark (sd); prio =get_priority (sd);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 483/565 net: fec_mpc52xx_phy: Use %pa to format resource_size_t
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Horman <[email protected]>
[ Upstream commit 020bfdc4ed94be472138c891bde4d14241cf00fd ]
The correct format string for resource_size_t is %pa which acts on the address of the variable to be formatted [1].
[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
Flagged by gcc-14 as:
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c: In function 'mpc52xx_fec_mdio_probe':drivers/net/ethernet/freescale/fec_mpc52xx_phy.c:97:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
97 | snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
| ~^ ~~~~~~~~~
| | |
| | resource_size_t {aka long long unsigned int}
| unsigned int
| %llxNo functional change intended.
Compile tested only.
--- drivers/net/ethernet/freescale/fec_mpc52xx_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c +1 -1
@@ -92,7 +92,7 @@ static int mpc52xx_fec_mdio_probe(struct platform_device *of) goto out_free; } -snprintf (bus->id,MII_BUS_ID_SIZE ,"%x" , res.start); +snprintf (bus->id,MII_BUS_ID_SIZE ,"%pa" , &res.start); bus->priv = priv; bus->parent = dev;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 484/565 net: ethernet: fs_enet: Use %pa to format resource_size_t
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Horman <[email protected]>
[ Upstream commit 45fe45fada261e1e83fce2a07fa22835aec1cf0a ]
The correct format string for resource_size_t is %pa which acts on the address of the variable to be formatted [1].
[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
Flagged by gcc-14 as:
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c: In function 'fs_mii_bitbang_init':drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:126:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
126 | snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
| ~^ ~~~~~~~~~
| | |
| | resource_size_t {aka long long unsigned int}
| unsigned int
| %llxNo functional change intended.
Compile tested only.
--- drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +1 -1
@@ -126,7 +126,7 @@ static int fs_mii_bitbang_init(struct mii_bus *bus, struct device_node *np)* we get is an int, and the odds of multiple bitbang mdio buses * is low enough that it's not worth going too crazy. */ -snprintf (bus->id,MII_BUS_ID_SIZE ,"%x" , res.start); +snprintf (bus->id,MII_BUS_ID_SIZE ,"%pa" , &res.start); data =of_get_property (np,"fsl,mdio-pin" , &len);if (!data || len !=4 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 485/565 net/sched: cbs: Fix integer overflow in cbs_set_port_rate()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Elena Salomatkina <[email protected]>
[ Upstream commit 397006ba5d918f9b74e734867e8fddbc36dc2282 ]
The subsequent calculation of port_rate = speed * 1000 * BYTES_PER_KBIT, where the BYTES_PER_KBIT is of type LL, may cause an overflow. At least when speed = SPEED_20000, the expression to the left of port_rate will be greater than INT_MAX.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/sched/sch_cbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_cbs.c +1 -1
@@ -310,7 +310,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) {struct ethtool_link_ksettings ecmd;int speed =SPEED_10 ; -int port_rate; +s64 port_rate;int err; err =__ethtool_get_link_ksettings (dev, &ecmd);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 486/565 af_packet: avoid erroring out after sock_init_data() in packet_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 46f2a11cb82b657fd15bab1c47821b635e03838b ]
After sock_init_data() the allocated sk object is attached to the provided sock object. On error, packet_create() frees the sk object leaving the dangling pointer in the sock object on return. Some other code may try to use this pointer and cause use-after-free.
--- net/packet/af_packet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/packet/af_packet.c +6 -6
@@ -3384,18 +3384,18 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,if (sock->type ==SOCK_PACKET ) sock->ops = &packet_ops_spkt; + po =pkt_sk (sk); + err =packet_alloc_pending (po); +if (err) + goto out_sk_free; +sock_init_data (sock, sk); - po =pkt_sk (sk);init_completion (&po->skb_completion); sk->sk_family =PF_PACKET ; po->num = proto; po->xmit = dev_queue_xmit; - err =packet_alloc_pending (po); -if (err) - goto out2; -packet_cached_dev_reset (po); sk->sk_destruct = packet_sock_destruct;
@@ -3428,7 +3428,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,sock_prot_inuse_add (net, &packet_proto,1 );return 0 ; -out2: +out_sk_free:sk_free (sk); out:return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 487/565 Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 7c4f78cdb8e7501e9f92d291a7d956591bf73be9 ]
bt_sock_alloc() allocates the sk object and attaches it to the provided sock object. On error l2cap_sock_alloc() frees the sk object, but the dangling pointer is still attached to the sock object, which may create use-after-free in other code.
--- net/bluetooth/l2cap_sock.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/l2cap_sock.c +1 -0
@@ -1876,6 +1876,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, chan =l2cap_chan_create ();if (!chan) {sk_free (sk); + sock->sk =NULL ;return NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 488/565 net: af_can: do not leave a dangling sk pointer in can_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 811a7ca7320c062e15d0f5b171fe6ad8592d1434 ]
On error can_create() frees the allocated sk object, but sock_init_data() has already attached it to the provided sock object. This will leave a dangling sk pointer in the sock object and may cause use-after-free later.
--- net/can/af_can.c | 1 + 1 file changed, 1 insertion(+)
net/can/af_can.c +1 -0
@@ -171,6 +171,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,/* release sk on errors */ sock_orphan (sk);sock_put (sk); + sock->sk =NULL ; } errout:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 489/565 net: ieee802154: do not leave a dangling sk pointer in ieee802154_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit b4fcd63f6ef79c73cafae8cf4a114def5fc3d80d ]
sock_init_data() attaches the allocated sk object to the provided sock object. If ieee802154_create() fails later, the allocated sk object is freed, but the dangling pointer remains in the provided sock object, which may allow use-after-free.
Clear the sk pointer in the sock object on error.
--- net/ieee802154/socket.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ieee802154/socket.c +7 -5
@@ -1046,19 +1046,21 @@ static int ieee802154_create(struct net *net, struct socket *sock,if (sk->sk_prot->hash) { rc = sk->sk_prot->hash (sk); -if (rc) { -sk_common_release (sk); - goto out; - } +if (rc) + goto out_sk_release; }if (sk->sk_prot->init) { rc = sk->sk_prot->init (sk);if (rc) -sk_common_release (sk); + goto out_sk_release; } out:return rc; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; }static const struct net_proto_family ieee802154_family_ops = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 490/565 net: inet: do not leave a dangling sk pointer in inet_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 9365fa510c6f82e3aa550a09d0c5c6b44dbc78ff ]
sock_init_data() attaches the allocated sk object to the provided sock object. If inet_create() fails later, the sk object is freed, but the sock object retains the dangling pointer, which may create use-after-free later.
Clear the sk pointer in the sock object on error.
--- net/ipv4/af_inet.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/ipv4/af_inet.c +10 -12
@@ -373,32 +373,30 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, inet->inet_sport =htons (inet->inet_num);/* Add to protocol hash chains. */ err = sk->sk_prot->hash (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (sk->sk_prot->init) { err = sk->sk_prot->init (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (!kern) { err =BPF_CGROUP_RUN_PROG_INET_SOCK (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; } out:return err; out_rcu_unlock:rcu_read_unlock (); goto out; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 491/565 net: inet6: do not leave a dangling sk pointer in inet6_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ignat Korchagin <[email protected]>
[ Upstream commit 9df99c395d0f55fb444ef39f4d6f194ca437d884 ]
sock_init_data() attaches the allocated sk pointer to the provided sock object. If inet6_create() fails later, the sk object is released, but the sock object retains the dangling sk pointer, which may cause use-after-free later.
Clear the sock sk pointer on error.
--- net/ipv6/af_inet6.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/ipv6/af_inet6.c +10 -12
@@ -258,31 +258,29 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,*/ inet->inet_sport =htons (inet->inet_num); err = sk->sk_prot->hash (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (sk->sk_prot->init) { err = sk->sk_prot->init (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (!kern) { err =BPF_CGROUP_RUN_PROG_INET_SOCK (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; } out:return err; out_rcu_unlock:rcu_read_unlock (); goto out; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; } static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 492/565 wifi: ath5k: add PCI ID for SX76X
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit da0474012402d4729b98799d71a54c35dc5c5de3 ]
This is in two devices made by Gigaset, SX762 and SX763.
--- drivers/net/wireless/ath/ath5k/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath5k/pci.c +1 -0
@@ -46,6 +46,7 @@ static const struct pci_device_id ath5k_pci_id_table[] = { { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ + { PCI_VDEVICE(ATHEROS, 0xff16) }, /* Gigaset SX76[23] AR241[34]A */ { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ { 0 } };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 493/565 wifi: ath5k: add PCI ID for Arcadyan devices
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit f3ced9bb90b0a287a1fa6184d16b0f104a78fa90 ]
Arcadyan made routers with this PCI ID containing an AR2417.
--- drivers/net/wireless/ath/ath5k/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath5k/pci.c +1 -0
@@ -47,6 +47,7 @@ static const struct pci_device_id ath5k_pci_id_table[] = { { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ { PCI_VDEVICE(ATHEROS, 0xff16) }, /* Gigaset SX76[23] AR241[34]A */ + { PCI_VDEVICE(ATHEROS, 0xff1a) }, /* Arcadyan ARV45XX AR2417 */ { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ { 0 } };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 494/565 drm/panel: simple: Add Microchip AC69T88A LVDS Display panel
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manikandan Muralidharan <[email protected]>
[ Upstream commit 40da1463cd6879f542238b36c1148f517927c595 ]
Add support for Microchip AC69T88A 5 inch TFT LCD 800x480 Display module with LVDS interface.The panel uses the Sitronix ST7262 800x480 Display driver
--- drivers/gpu/drm/panel/panel-simple.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +28 -0
@@ -4453,6 +4453,31 @@ static const struct panel_desc yes_optoelectronics_ytc700tlag_05_201c = { .connector_type = DRM_MODE_CONNECTOR_LVDS, }; +static const struct drm_display_mode mchp_ac69t88a_mode = { + .clock =25000 , + .hdisplay =800 , + .hsync_start =800 +88 , + .hsync_end =800 +88 +5 , + .htotal =800 +88 +5 +40 , + .vdisplay =480 , + .vsync_start =480 +23 , + .vsync_end =480 +23 +5 , + .vtotal =480 +23 +5 +1 , +}; + +static const struct panel_desc mchp_ac69t88a = { + .modes = &mchp_ac69t88a_mode, + .num_modes =1 , + .bpc =8 , + .size = { + .width =108 , + .height =65 , + }, + .bus_flags =DRM_BUS_FLAG_DE_HIGH , + .bus_format =MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA , + .connector_type =DRM_MODE_CONNECTOR_LVDS , +}; +static const struct drm_display_mode arm_rtsm_mode[] = { { .clock =65000 ,
@@ -4915,6 +4940,9 @@ static const struct of_device_id platform_of_match[] = { }, { .compatible = "yes-optoelectronics,ytc700tlag-05-201c", .data = &yes_optoelectronics_ytc700tlag_05_201c, + }, { + .compatible = "microchip,ac69t88a", + .data = &mchp_ac69t88a, }, { /* Must be the last entry */ .compatible = "panel-dpi",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 495/565 drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts for vega20_ih
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Lu <[email protected]>
[ Upstream commit 8b22f048331dfd45fdfbf0efdfb1d43deff7518d ]
Port this change to vega20_ih.c:
commit afbf7955ff01 ("drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts")
Original commit message:
"Why:
Setting IH_RB_WPTR register to 0 will not clear the RB_OVERFLOW bit if RB_ENABLE is not set.
How to fix:
Set WPTR_OVERFLOW_CLEAR bit after RB_ENABLE bit is set. The RB_ENABLE bit is required to be set, together with WPTR_OVERFLOW_ENABLE bit so that setting WPTR_OVERFLOW_CLEAR bit would clear the RB_OVERFLOW."
--- drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +27 -0
@@ -109,6 +109,33 @@ static int vega20_ih_toggle_ring_interrupts(struct amdgpu_device *adev, tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,RB_ENABLE , (enable ?1 :0 )); tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,RB_GPU_TS_ENABLE ,1 ); +if (enable) { +/* Unset the CLEAR_OVERFLOW bit to make sure the next step +* is switching the bit from 0 to 1 +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +if (amdgpu_sriov_vf (adev) &&amdgpu_sriov_reg_indirect_ih (adev)) { +if (psp_reg_program (&adev->psp, ih_regs->psp_reg_id, tmp)) +return -ETIMEDOUT ; + }else { +WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); + } + +/* Clear RB_OVERFLOW bit */ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 ); +if (amdgpu_sriov_vf (adev) &&amdgpu_sriov_reg_indirect_ih (adev)) { +if (psp_reg_program (&adev->psp, ih_regs->psp_reg_id, tmp)) +return -ETIMEDOUT ; + }else { +WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); + } + +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); + } +/* enable_intr field is only valid in ring0 */ if (ih == &adev->irq.ih) tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,ENABLE_INTR , (enable ?1 :0 ));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 496/565 drm/amdgpu: Dereference the ATCS ACPI buffer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
[ Upstream commit 32e7ee293ff476c67b51be006e986021967bc525 ]
Need to dereference the atcs acpi buffer after the method is executed, otherwise it will result in a memory leak.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -0
@@ -761,6 +761,7 @@ int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,return -EIO ; } +kfree (info);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 497/565 drm/amdgpu: refine error handling in amdgpu_ttm_tt_pin_userptr
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lang Yu <[email protected]>
[ Upstream commit 46186667f98fb7158c98f4ff5da62c427761ffcd ]
Free sg table when dma_map_sgtable() failed to avoid memory leak.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -1
@@ -775,7 +775,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev,/* Map SG to device */ r =dma_map_sgtable (adev->dev, ttm->sg, direction,0 );if (r) - goto release_sg; + goto release_sg_table;/* convert SG to linear array of pages and dma addresses */ drm_prime_sg_to_dma_addr_array(ttm->sg, gtt->ttm.dma_address,
@@ -783,6 +783,8 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev,return 0 ; +release_sg_table: +sg_free_table (ttm->sg); release_sg:kfree (ttm->sg); ttm->sg =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 498/565 dma-debug: fix a possible deadlock on radix_lock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Levi Yun <[email protected]>
[ Upstream commit 7543c3e3b9b88212fcd0aaf5cab5588797bdc7de ]
radix_lock() shouldn't be held while holding dma_hash_entry[idx].lock otherwise, there's a possible deadlock scenario when
dma debug API is called holding rq_lock():
CPU0 CPU1 CPU2dma_free_attrs()check_unmap() add_dma_entry() __schedule() //out
(A) rq_lock()
get_hash_bucket()
(A) dma_entry_hash
check_sync()
(A) radix_lock() (W) dma_entry_hashdma_entry_free()
(W) radix_lock()
// CPU2's one
(W) rq_lock()CPU1 situation can happen when it extending radix tree and it tries to wake up kswapd via wake_all_kswapd().
CPU2 situation can happen while perf_event_task_sched_out() (i.e. dma sync operation is called while deleting perf_event using
etm and etr tmc which are Arm Coresight hwtracing driver backends).
To remove this possible situation, call dma_entry_free() after put_hash_bucket() in check_unmap().
--- kernel/dma/debug.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/dma/debug.c +6 -2
@@ -1046,9 +1046,13 @@ static void check_unmap(struct dma_debug_entry *ref) }hash_bucket_del (entry); -dma_entry_free (entry); -put_hash_bucket (bucket, flags); + +/* +* Free the entry outside of bucket_lock to avoid ABBA deadlocks +* between that and radix_lock. +*/ +dma_entry_free (entry); } static void check_for_stack(struct device *dev,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 499/565 jfs: array-index-out-of-bounds fix in dtReadFirst
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ghanshyam Agrawal <[email protected]>
[ Upstream commit ca84a2c9be482836b86d780244f0357e5a778c46 ]
The value of stbl can be sometimes out of bounds due to a bad filesystem. Added a check with appopriate return of error code in that case.
--- fs/jfs/jfs_dtree.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/jfs/jfs_dtree.c +7 -0
@@ -3382,6 +3382,13 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack)/* get the leftmost entry */ stbl =DT_GETSTBL (p); + +if (stbl[0 ] <0 || stbl[0 ] >127 ) { +DT_PUTPAGE (mp); +jfs_error (ip->i_sb,"stbl[0] out of bound\n" ); +return -EIO ; + } + xd = (pxd_t *) & p->slot[stbl[0 ]];/* get the child page block address */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 500/565 jfs: fix shift-out-of-bounds in dbSplit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ghanshyam Agrawal <[email protected]>
[ Upstream commit a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d ]
When dmt_budmin is less than zero, it causes errors
in the later stages. Added a check to return an error beforehand in dbAllocCtl itself.
--- fs/jfs/jfs_dmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dmap.c +3 -0
@@ -1886,6 +1886,9 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)return -EIO ; dp = (struct dmap *) mp->data; +if (dp->tree.budmin <0 ) +return -EIO ; +/* try to allocate the blocks. */ rc =dbAllocDmapLev (bmp, dp, (int ) nblocks, l2nb, results);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 501/565 jfs: fix array-index-out-of-bounds in jfs_readdir
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ghanshyam Agrawal <[email protected]>
[ Upstream commit 839f102efb168f02dfdd46717b7c6dddb26b015e ]
The stbl might contain some invalid values. Added a check to return error code in that case.
--- fs/jfs/jfs_dtree.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/jfs/jfs_dtree.c +8 -0
@@ -3187,6 +3187,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) stbl =DT_GETSTBL (p);for (i = index; i < p->header.nextindex; i++) { +if (stbl[i] <0 || stbl[i] >127 ) { +jfs_err ("JFS: Invalid stbl[%d] = %d for inode %ld, block = %lld" , + i, stbl[i], (long )ip->i_ino, (long long )bn); +free_page (dirent_buf); +DT_PUTPAGE (mp); +return -EIO ; + } + d = (struct ldtentry *) & p->slot[stbl[i]]; if (((long) jfs_dirent + d->namlen + 1) >
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 502/565 jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nihar Chaithanya <[email protected]>
[ Upstream commit a174706ba4dad895c40b1d2277bade16dfacdcd9 ]
When the value of lp is 0 at the beginning of the for loop, it will become negative in the next assignment and we should bail out.
--- fs/jfs/jfs_dmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dmap.c +3 -0
@@ -2957,6 +2957,9 @@ static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)/* bubble the new value up the tree as required. */ for (k =0 ; k <le32_to_cpu (tp->dmt_height); k++) { +if (lp ==0 ) +break ; +/* get the index of the first leaf of the 4 leaf * group containing the specified leaf (leafno). */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 503/565 drm/amdgpu: skip amdgpu_device_cache_pci_state under sriov
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Zhao <[email protected]>
[ Upstream commit afe260df55ac280cd56306248cb6d8a6b0db095c ]
Under sriov, host driver will save and restore vf pci cfg space during reset. And during device init, under sriov, pci_restore_state happens after fullaccess released, and it can have race condition with mmio protection enable from host side leading to missing interrupts.
So skip amdgpu_device_cache_pci_state for sriov.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -5743,6 +5743,9 @@ bool amdgpu_device_cache_pci_state(struct pci_dev *pdev)struct amdgpu_device *adev =drm_to_adev (dev);int r; +if (amdgpu_sriov_vf (adev)) +return false; + r =pci_save_state (pdev);if (!r) {kfree (adev->pci_state);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 504/565 drm/amdgpu: set the right AMDGPU sg segment limitation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
[ Upstream commit e2e97435783979124ba92d6870415c57ecfef6a5 ]
The driver needs to set the correct max_segment_size; otherwise debug_dma_map_sg() will complain about the over-mapping of the AMDGPU sg length as following:
WARNING: CPU: 6 PID: 1964 at kernel/dma/debug.c:1178 debug_dma_map_sg+0x2dc/0x370 [ 364.049444] Modules linked in: veth amdgpu(OE) amdxcp drm_exec gpu_sched drm_buddy drm_ttm_helper ttm(OE) drm_suballoc_helper drm_display_helper drm_kms_helper i2c_algo_bit rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs lockd grace netfs xt_conntrack xt_MASQUERADE nf_conntrack_netlink xfrm_user xfrm_algo iptable_nat xt_addrtype iptable_filter br_netfilter nvme_fabrics overlay nfnetlink_cttimeout nfnetlink openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c bridge stp llc amd_atl intel_rapl_msr intel_rapl_common sunrpc sch_fq_codel snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg edac_mce_amd binfmt_misc snd_hda_codec snd_pci_acp6x snd_hda_core snd_acp_config snd_hwdep snd_soc_acpi kvm_amd snd_pcm kvm snd_seq_midi snd_seq_midi_event crct10dif_pclmul ghash_clmulni_intel sha512_ssse3 snd_rawmidi sha256_ssse3 sha1_ssse3 aesni_intel snd_seq nls_iso8859_1 crypto_simd snd_seq_device cryptd snd_timer rapl input_leds snd [ 364.049532] ipmi_devintf wmi_bmof ccp serio_raw k10temp sp5100_tco soundcore ipmi_msghandler cm32181 industrialio mac_hid msr parport_pc ppdev lp parport drm efi_pstore ip_tables x_tables pci_stub crc32_pclmul nvme ahci libahci i2c_piix4 r8169 nvme_core i2c_designware_pci realtek i2c_ccgx_ucsi video wmi hid_generic cdc_ether usbnet usbhid hid r8152 mii [ 364.049576] CPU: 6 PID: 1964 Comm: rocminfo Tainted: G OE 6.10.0-custom #492 [ 364.049579] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS RMJ1009A 06/13/2021 [ 364.049582] RIP: 0010:debug_dma_map_sg+0x2dc/0x370 [ 364.049585] Code: 89 4d b8 e8 36 b1 86 00 8b 4d b8 48 8b 55 b0 44 8b 45 a8 4c 8b 4d a0 48 89 c6 48 c7 c7 00 4b 74 bc 4c 89 4d b8 e8 b4 73 f3 ff <0f> 0b 4c 8b 4d b8 8b 15 c8 2c b8 01 85 d2 0f 85 ee fd ff ff 8b 05 [ 364.049588] RSP: 0018:ffff9ca600b57ac0 EFLAGS: 00010286 [ 364.049590] RAX: 0000000000000000 RBX: ffff88b7c132b0c8 RCX: 0000000000000027 [ 364.049592] RDX: ffff88bb0f521688 RSI: 0000000000000001 RDI: ffff88bb0f521680 [ 364.049594] RBP: ffff9ca600b57b20 R08: 000000000000006f R09: ffff9ca600b57930 [ 364.049596] R10: ffff9ca600b57928 R11: ffffffffbcb46328 R12: 0000000000000000 [ 364.049597] R13: 0000000000000001 R14: ffff88b7c19c0700 R15: ffff88b7c9059800 [ 364.049599] FS: 00007fb2d3516e80(0000) GS:ffff88bb0f500000(0000) knlGS:0000000000000000 [ 364.049601] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 364.049603] CR2: 000055610bd03598 CR3: 00000001049f6000 CR4: 0000000000350ef0 [ 364.049605] Call Trace: [ 364.049607] <TASK> [ 364.049609] ? show_regs+0x6d/0x80 [ 364.049614] ? __warn+0x8c/0x140 [ 364.049618] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049621] ? report_bug+0x193/0x1a0 [ 364.049627] ? handle_bug+0x46/0x80 [ 364.049631] ? exc_invalid_op+0x1d/0x80 [ 364.049635] ? asm_exc_invalid_op+0x1f/0x30 [ 364.049642] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049647] __dma_map_sg_attrs+0x90/0xe0 [ 364.049651] dma_map_sgtable+0x25/0x40 [ 364.049654] amdgpu_bo_move+0x59a/0x850 [amdgpu] [ 364.049935] ? srso_return_thunk+0x5/0x5f [ 364.049939] ? amdgpu_ttm_tt_populate+0x5d/0xc0 [amdgpu] [ 364.050095] ttm_bo_handle_move_mem+0xc3/0x180 [ttm] [ 364.050103] ttm_bo_validate+0xc1/0x160 [ttm] [ 364.050108] ? amdgpu_ttm_tt_get_user_pages+0xe5/0x1b0 [amdgpu] [ 364.050263] amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu+0xa12/0xc90 [amdgpu] [ 364.050473] kfd_ioctl_alloc_memory_of_gpu+0x16b/0x3b0 [amdgpu] [ 364.050680] kfd_ioctl+0x3c2/0x530 [amdgpu] [ 364.050866] ? __pfx_kfd_ioctl_alloc_memory_of_gpu+0x10/0x10 [amdgpu] [ 364.051054] ? srso_return_thunk+0x5/0x5f [ 364.051057] ? tomoyo_file_ioctl+0x20/0x30 [ 364.051063] __x64_sys_ioctl+0x9c/0xd0 [ 364.051068] x64_sys_call+0x1219/0x20d0 [ 364.051073] do_syscall_64+0x51/0x120 [ 364.051077] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 364.051081] RIP: 0033:0x7fb2d2f1a94f
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
@@ -1664,6 +1664,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)mutex_init (&adev->mman.gtt_window_lock); +dma_set_max_seg_size (adev->dev,UINT_MAX );/* No others user of address space so set it to 0 */ r = ttm_device_init(&adev->mman.bdev, &amdgpu_bo_driver, adev->dev, adev_to_drm(adev)->anon_inode->i_mapping,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 505/565 wifi: ipw2x00: libipw_rx_any(): fix bad alignment
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiapeng Chong <[email protected]>
[ Upstream commit 4fa4f049dc0d9741b16c96bcbf0108c85368a2b9 ]
This patch fixes incorrect code alignment.
./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882. ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.
--- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +4 -4
@@ -870,8 +870,8 @@ void libipw_rx_any(struct libipw_device *ieee,switch (ieee->iw_mode) {case IW_MODE_ADHOC :/* our BSS and not from/to DS */ -if (ether_addr_equal (hdr->addr3, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==0 ) { +if (ether_addr_equal (hdr->addr3, ieee->bssid) && + ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==0 )) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
@@ -885,8 +885,8 @@ void libipw_rx_any(struct libipw_device *ieee,break ;case IW_MODE_INFRA :/* our BSS (== from our AP) and from DS */ -if (ether_addr_equal (hdr->addr2, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS ) { +if (ether_addr_equal (hdr->addr2, ieee->bssid) && + ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS )) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 506/565 wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Norbert van Bolhuis <[email protected]>
[ Upstream commit 857282b819cbaa0675aaab1e7542e2c0579f52d7 ]
This patch fixes a NULL pointer dereference bug in brcmfmac that occurs when a high 'sd_sgentry_align' value applies (e.g. 512) and a lot of queued SKBs are sent from the pkt queue.
The problem is the number of entries in the pre-allocated sgtable, it is nents = max(rxglom_size, txglom_size) + max(rxglom_size, txglom_size) >> 4 + 1. Given the default [rt]xglom_size=32 it's actually 35 which is too small. Worst case, the pkt queue can end up with 64 SKBs. This occurs when a new SKB is added for each original SKB if tailroom isn't enough to hold tail_pad. At least one sg entry is needed for each SKB. So, eventually the "skb_queue_walk loop" in brcmf_sdiod_sglist_rw may run out of sg entries. This makes sg_next return NULL and this causes the oops.
The patch sets nents to max(rxglom_size, txglom_size) * 2 to be able handle the worst-case.
Btw. this requires only 64-35=29 * 16 (or 20 if CONFIG_NEED_SG_DMA_LENGTH) = 464 additional bytes of memory.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +1 -1
@@ -770,7 +770,7 @@ void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) nents =max_t (uint,BRCMF_DEFAULT_RXGLOM_SIZE , sdiodev->settings->bus.sdio.txglomsz); - nents += (nents >>4 ) +1 ; + nents *=2 ;WARN_ON (nents > sdiodev->max_segment_count);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 507/565 Bluetooth: hci_core: Fix not checking skb length on hci_acldata_packet
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 3fe288a8214e7dd784d1f9b7c9e448244d316b47 ]
This fixes not checking if skb really contains an ACL header otherwise the code may attempt to access some uninitilized/invalid memory past the valid skb->data.
--- net/bluetooth/hci_core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/bluetooth/hci_core.c +9 -4
@@ -4943,18 +4943,22 @@ static void hci_tx_work(struct work_struct *work)/* ACL data packet */ static void hci_acldata_packet (struct hci_dev *hdev,struct sk_buff *skb) { -struct hci_acl_hdr *hdr = (void *) skb->data; +struct hci_acl_hdr *hdr;struct hci_conn *conn;__u16 handle, flags; -skb_pull (skb,HCI_ACL_HDR_SIZE ); + hdr =skb_pull_data (skb,sizeof (*hdr)); +if (!hdr) { +bt_dev_err (hdev,"ACL packet too small" ); + goto drop; + } handle =__le16_to_cpu (hdr->handle); flags =hci_flags (handle); handle =hci_handle (handle); -BT_DBG ("%s len %d handle 0x%4.4x flags 0x%4.4x" , hdev->name, skb->len, - handle, flags); +bt_dev_dbg (hdev,"len %d handle 0x%4.4x flags 0x%4.4x" , skb->len, + handle, flags); hdev->stat.acl_rx++;
@@ -4973,6 +4977,7 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) handle); } +drop:kfree_skb (skb); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 508/565 ASoC: hdmi-codec: reorder channel allocation list
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 82ff5abc2edcfba0c0f1a1be807795e2876f46e9 ]
The ordering in hdmi_codec_get_ch_alloc_table_idx() results in wrong channel allocation for a number of cases, e.g. when ELD reports FL|FR|LFE|FC|RL|RR or FL|FR|LFE|FC|RL|RR|RC|RLC|RRC:
ca_id 0x01 with speaker mask FL|FR|LFE is selected instead of ca_id 0x03 with speaker mask FL|FR|LFE|FC for 4 channels
and
ca_id 0x04 with speaker mask FL|FR|RC gets selected instead of ca_id 0x0b with speaker mask FL|FR|LFE|FC|RL|RR for 6 channels
Fix this by reordering the channel allocation list with most specific speaker masks at the top.
--- sound/soc/codecs/hdmi-codec.c | 140 +++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 63 deletions(-)
sound/soc/codecs/hdmi-codec.c +77 -63
@@ -188,84 +188,97 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {/* * hdmi_codec_channel_alloc: speaker configuration available for CEA * -* This is an ordered list that must match with hdmi_codec_8ch_chmaps struct +* This is an ordered list where ca_id must exist in hdmi_codec_8ch_chmaps * The preceding ones have better chances to be selected by * hdmi_codec_get_ch_alloc_table_idx(). */ static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { { .ca_id =0x00 , .n_ch =2 , - .mask =FL |FR }, -/* 2.1 */ - { .ca_id =0x01 , .n_ch =4 , - .mask =FL |FR |LFE }, -/* Dolby Surround */ + .mask =FL |FR }, + { .ca_id =0x03 , .n_ch =4 , + .mask =FL |FR |LFE |FC }, { .ca_id =0x02 , .n_ch =4 , .mask =FL |FR |FC }, -/* surround51 */ + { .ca_id =0x01 , .n_ch =4 , + .mask =FL |FR |LFE }, { .ca_id =0x0b , .n_ch =6 , - .mask =FL |FR |LFE |FC |RL |RR }, -/* surround40 */ - { .ca_id =0x08 , .n_ch =6 , - .mask =FL |FR |RL |RR }, -/* surround41 */ - { .ca_id =0x09 , .n_ch =6 , - .mask =FL |FR |LFE |RL |RR }, -/* surround50 */ + .mask =FL |FR |LFE |FC |RL |RR }, { .ca_id =0x0a , .n_ch =6 , .mask =FL |FR |FC |RL |RR }, -/* 6.1 */ - { .ca_id =0x0f , .n_ch =8 , - .mask =FL |FR |LFE |FC |RL |RR |RC }, -/* surround71 */ + { .ca_id =0x09 , .n_ch =6 , + .mask =FL |FR |LFE |RL |RR }, + { .ca_id =0x08 , .n_ch =6 , + .mask =FL |FR |RL |RR }, + { .ca_id =0x07 , .n_ch =6 , + .mask =FL |FR |LFE |FC |RC }, + { .ca_id =0x06 , .n_ch =6 , + .mask =FL |FR |FC |RC }, + { .ca_id =0x05 , .n_ch =6 , + .mask =FL |FR |LFE |RC }, + { .ca_id =0x04 , .n_ch =6 , + .mask =FL |FR |RC }, { .ca_id =0x13 , .n_ch =8 , .mask =FL |FR |LFE |FC |RL |RR |RLC |RRC }, -/* others */ - { .ca_id =0x03 , .n_ch =8 , - .mask =FL |FR |LFE |FC }, - { .ca_id =0x04 , .n_ch =8 , - .mask =FL |FR |RC }, - { .ca_id =0x05 , .n_ch =8 , - .mask =FL |FR |LFE |RC }, - { .ca_id =0x06 , .n_ch =8 , - .mask =FL |FR |FC |RC }, - { .ca_id =0x07 , .n_ch =8 , - .mask =FL |FR |LFE |FC |RC }, - { .ca_id =0x0c , .n_ch =8 , - .mask =FL |FR |RC |RL |RR }, - { .ca_id =0x0d , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |RC }, - { .ca_id =0x0e , .n_ch =8 , - .mask =FL |FR |FC |RL |RR |RC }, - { .ca_id =0x10 , .n_ch =8 , - .mask =FL |FR |RL |RR |RLC |RRC }, - { .ca_id =0x11 , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |RLC |RRC }, + { .ca_id =0x1f , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR |FLC |FRC }, { .ca_id =0x12 , .n_ch =8 , .mask =FL |FR |FC |RL |RR |RLC |RRC }, - { .ca_id =0x14 , .n_ch =8 , - .mask =FL |FR |FLC |FRC }, - { .ca_id =0x15 , .n_ch =8 , - .mask =FL |FR |LFE |FLC |FRC }, - { .ca_id =0x16 , .n_ch =8 , - .mask =FL |FR |FC |FLC |FRC }, - { .ca_id =0x17 , .n_ch =8 , - .mask =FL |FR |LFE |FC |FLC |FRC }, - { .ca_id =0x18 , .n_ch =8 , - .mask =FL |FR |RC |FLC |FRC }, - { .ca_id =0x19 , .n_ch =8 , - .mask =FL |FR |LFE |RC |FLC |FRC }, - { .ca_id =0x1a , .n_ch =8 , - .mask =FL |FR |RC |FC |FLC |FRC }, - { .ca_id =0x1b , .n_ch =8 , - .mask =FL |FR |LFE |RC |FC |FLC |FRC }, - { .ca_id =0x1c , .n_ch =8 , - .mask =FL |FR |RL |RR |FLC |FRC }, - { .ca_id =0x1d , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |FLC |FRC }, { .ca_id =0x1e , .n_ch =8 , .mask =FL |FR |FC |RL |RR |FLC |FRC }, - { .ca_id =0x1f , .n_ch =8 , - .mask =FL |FR |LFE |FC |RL |RR |FLC |FRC }, + { .ca_id =0x11 , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |RLC |RRC }, + { .ca_id =0x1d , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |FLC |FRC }, + { .ca_id =0x10 , .n_ch =8 , + .mask =FL |FR |RL |RR |RLC |RRC }, + { .ca_id =0x1c , .n_ch =8 , + .mask =FL |FR |RL |RR |FLC |FRC }, + { .ca_id =0x0f , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR |RC }, + { .ca_id =0x1b , .n_ch =8 , + .mask =FL |FR |LFE |RC |FC |FLC |FRC }, + { .ca_id =0x0e , .n_ch =8 , + .mask =FL |FR |FC |RL |RR |RC }, + { .ca_id =0x1a , .n_ch =8 , + .mask =FL |FR |RC |FC |FLC |FRC }, + { .ca_id =0x0d , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |RC }, + { .ca_id =0x19 , .n_ch =8 , + .mask =FL |FR |LFE |RC |FLC |FRC }, + { .ca_id =0x0c , .n_ch =8 , + .mask =FL |FR |RC |RL |RR }, + { .ca_id =0x18 , .n_ch =8 , + .mask =FL |FR |RC |FLC |FRC }, + { .ca_id =0x17 , .n_ch =8 , + .mask =FL |FR |LFE |FC |FLC |FRC }, + { .ca_id =0x16 , .n_ch =8 , + .mask =FL |FR |FC |FLC |FRC }, + { .ca_id =0x15 , .n_ch =8 , + .mask =FL |FR |LFE |FLC |FRC }, + { .ca_id =0x14 , .n_ch =8 , + .mask =FL |FR |FLC |FRC }, + { .ca_id =0x0b , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR }, + { .ca_id =0x0a , .n_ch =8 , + .mask =FL |FR |FC |RL |RR }, + { .ca_id =0x09 , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR }, + { .ca_id =0x08 , .n_ch =8 , + .mask =FL |FR |RL |RR }, + { .ca_id =0x07 , .n_ch =8 , + .mask =FL |FR |LFE |FC |RC }, + { .ca_id =0x06 , .n_ch =8 , + .mask =FL |FR |FC |RC }, + { .ca_id =0x05 , .n_ch =8 , + .mask =FL |FR |LFE |RC }, + { .ca_id =0x04 , .n_ch =8 , + .mask =FL |FR |RC }, + { .ca_id =0x03 , .n_ch =8 , + .mask =FL |FR |LFE |FC }, + { .ca_id =0x02 , .n_ch =8 , + .mask =FL |FR |FC }, + { .ca_id =0x01 , .n_ch =8 , + .mask =FL |FR |LFE }, };struct hdmi_codec_priv {
@@ -374,7 +387,8 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol,struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol);struct hdmi_codec_priv *hcp = info->private_data; - map = info->chmap[hcp->chmap_idx].map; +if (hcp->chmap_idx !=HDMI_CODEC_CHMAP_IDX_UNKNOWN ) + map = info->chmap[hcp->chmap_idx].map;for (i =0 ; i < info->max_channels; i++) {if (hcp->chmap_idx ==HDMI_CODEC_CHMAP_IDX_UNKNOWN )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 509/565 rocker: fix link status detection in rocker_carrier_init()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit e64285ff41bb7a934bd815bd38f31119be62ac37 ]
Since '1 << rocker_port->pport' may be undefined for port >= 32, cast the left operand to 'unsigned long long' like it's done in 'rocker_port_set_enable()' above. Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/rocker/rocker_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/rocker/rocker_main.c +1 -1
@@ -2516,7 +2516,7 @@ static void rocker_carrier_init(const struct rocker_port *rocker_port)u64 link_status =rocker_read64 (rocker,PORT_PHYS_LINK_STATUS );bool link_up; - link_up = link_status & (1 << rocker_port->pport); + link_up = link_status & (1ULL << rocker_port->pport);if (link_up)netif_carrier_on (rocker_port->dev);else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 510/565 net/neighbor: clear error in case strict check is not set
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 0de6a472c3b38432b2f184bd64eb70d9ea36d107 ]
Commit 51183d233b5a ("net/neighbor: Update neigh_dump_info for strict data checking") added strict checking. The err variable is not cleared, so if we find no table to dump we will return the validation error even if user did not want strict checking.
I think the only way to hit this is to send an buggy request, and ask for a table which doesn't exist, so there's no point treating this as a real fix. I only noticed it because a syzbot repro depended on it to trigger another bug.
--- net/core/neighbour.c | 1 + 1 file changed, 1 insertion(+)
net/core/neighbour.c +1 -0
@@ -2738,6 +2738,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb) err =neigh_valid_dump_req (nlh, cb->strict_check, &filter, cb->extack);if (err <0 && cb->strict_check)return err; + err =0 ; s_t = cb->args[0 ];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 511/565 netpoll: Use rcu_access_pointer() in __netpoll_setup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit c69c5e10adb903ae2438d4f9c16eccf43d1fcbc1 ]
The ndev->npinfo pointer in __netpoll_setup() is RCU-protected but is being accessed directly for a NULL check. While no RCU read lock is held in this context, we should still use proper RCU primitives for consistency and correctness.
Replace the direct NULL check with rcu_access_pointer(), which is the appropriate primitive when only checking for NULL without dereferencing the pointer. This function provides the necessary ordering guarantees without requiring RCU read-side protection.
--- net/core/netpoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/netpoll.c +1 -1
@@ -636,7 +636,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) goto out; } -if (!ndev->npinfo) { +if (!rcu_access_pointer (ndev->npinfo)) { npinfo =kmalloc (sizeof (*npinfo),GFP_KERNEL );if (!npinfo) { err = -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 512/565 pinctrl: freescale: fix COMPILE_TEST error with PINCTRL_IMX_SCU
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esben Haabendal <[email protected]>
[ Upstream commit 58414a31c5713afb5449fd74a26a843d34cc62e8 ]
When PINCTRL_IMX_SCU was selected by PINCTRL_IMX8DXL or PINCTRL_IMX8QM combined with COMPILE_TEST on a non-arm platforms, the IMX_SCU dependency could not be enabled.
--- drivers/pinctrl/freescale/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/freescale/Kconfig +1 -1
@@ -9,7 +9,7 @@ config PINCTRL_IMX config PINCTRL_IMX_SCU tristate - depends on IMX_SCU + depends on IMX_SCU || COMPILE_TEST select PINCTRL_IMX config PINCTRL_IMX1_CORE
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 513/565 tracing: Use atomic64_inc_return() in trace_clock_counter()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uros Bizjak <[email protected]>
[ Upstream commit eb887c4567d1b0e7684c026fe7df44afa96589e6 ]
Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref) to use optimized implementation and ease register pressure around the primitive for targets that implement optimized variant.
--- kernel/trace/trace_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_clock.c +1 -1
@@ -154,5 +154,5 @@ static atomic64_t trace_counter;*/ u64 notrace trace_clock_counter(void) { -return atomic64_add_return (1 , &trace_counter); +return atomic64_inc_return (&trace_counter); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 514/565 scsi: hisi_sas: Add cond_resched() for no forced preemption model
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yihang Li <[email protected]>
[ Upstream commit 2233c4a0b948211743659b24c13d6bd059fa75fc ]
For no forced preemption model kernel, in the scenario where the expander is connected to 12 high performance SAS SSDs, the following call trace may occur:
[ 214.409199][ C240] watchdog: BUG: soft lockup - CPU#240 stuck for 22s! [irq/149-hisi_sa:3211] [ 214.568533][ C240] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--) [ 214.575224][ C240] pc : fput_many+0x8c/0xdc [ 214.579480][ C240] lr : fput+0x1c/0xf0 [ 214.583302][ C240] sp : ffff80002de2b900 [ 214.587298][ C240] x29: ffff80002de2b900 x28: ffff1082aa412000 [ 214.593291][ C240] x27: ffff3062a0348c08 x26: ffff80003a9f6000 [ 214.599284][ C240] x25: ffff1062bbac5c40 x24: 0000000000001000 [ 214.605277][ C240] x23: 000000000000000a x22: 0000000000000001 [ 214.611270][ C240] x21: 0000000000001000 x20: 0000000000000000 [ 214.617262][ C240] x19: ffff3062a41ae580 x18: 0000000000010000 [ 214.623255][ C240] x17: 0000000000000001 x16: ffffdb3a6efe5fc0 [ 214.629248][ C240] x15: ffffffffffffffff x14: 0000000003ffffff [ 214.635241][ C240] x13: 000000000000ffff x12: 000000000000029c [ 214.641234][ C240] x11: 0000000000000006 x10: ffff80003a9f7fd0 [ 214.647226][ C240] x9 : ffffdb3a6f0482fc x8 : 0000000000000001 [ 214.653219][ C240] x7 : 0000000000000002 x6 : 0000000000000080 [ 214.659212][ C240] x5 : ffff55480ee9b000 x4 : fffffde7f94c6554 [ 214.665205][ C240] x3 : 0000000000000002 x2 : 0000000000000020 [ 214.671198][ C240] x1 : 0000000000000021 x0 : ffff3062a41ae5b8 [ 214.677191][ C240] Call trace: [ 214.680320][ C240] fput_many+0x8c/0xdc [ 214.684230][ C240] fput+0x1c/0xf0 [ 214.687707][ C240] aio_complete_rw+0xd8/0x1fc [ 214.692225][ C240] blkdev_bio_end_io+0x98/0x140 [ 214.696917][ C240] bio_endio+0x160/0x1bc [ 214.701001][ C240] blk_update_request+0x1c8/0x3bc [ 214.705867][ C240] scsi_end_request+0x3c/0x1f0 [ 214.710471][ C240] scsi_io_completion+0x7c/0x1a0 [ 214.715249][ C240] scsi_finish_command+0x104/0x140 [ 214.720200][ C240] scsi_softirq_done+0x90/0x180 [ 214.724892][ C240] blk_mq_complete_request+0x5c/0x70 [ 214.730016][ C240] scsi_mq_done+0x48/0xac [ 214.734194][ C240] sas_scsi_task_done+0xbc/0x16c [libsas] [ 214.739758][ C240] slot_complete_v3_hw+0x260/0x760 [hisi_sas_v3_hw] [ 214.746185][ C240] cq_thread_v3_hw+0xbc/0x190 [hisi_sas_v3_hw] [ 214.752179][ C240] irq_thread_fn+0x34/0xa4 [ 214.756435][ C240] irq_thread+0xc4/0x130 [ 214.760520][ C240] kthread+0x108/0x13c [ 214.764430][ C240] ret_from_fork+0x10/0x18
This is because in the hisi_sas driver, both the hardware interrupt handler and the interrupt thread are executed on the same CPU. In the performance test scenario, function irq_wait_for_interrupt() will always return 0 if lots of interrupts occurs and the CPU will be continuously consumed. As a result, the CPU cannot run the watchdog thread. When the watchdog time exceeds the specified time, call trace occurs.
To fix it, add cond_resched() to execute the watchdog thread.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -0
@@ -2402,6 +2402,7 @@ static irqreturn_t cq_thread_v3_hw(int irq_no, void *p)/* update rd_point */ cq->rd_point = rd_point;hisi_sas_write32 (hisi_hba,COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); +cond_resched ();return IRQ_HANDLED ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 515/565 leds: class: Protect brightness_show() with led_cdev->led_access mutex
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit 4ca7cd938725a4050dcd62ae9472e931d603118d ]
There is NULL pointer issue observed if from Process A where hid device being added which results in adding a led_cdev addition and later a another call to access of led_cdev attribute from Process B can result in NULL pointer issue.
Use mutex led_cdev->led_access to protect access to led->cdev and its attribute inside brightness_show() and max_brightness_show() and also update the comment for mutex that it should be used to protect the led class device fields.
Process A Process B
kthread+0x114
worker_thread+0x244
process_scheduled_works+0x248
uhid_device_add_worker+0x24
hid_add_device+0x120
device_add+0x268
bus_probe_device+0x94
device_initial_probe+0x14
__device_attach+0xfc
bus_for_each_drv+0x10c
__device_attach_driver+0x14c
driver_probe_device+0x3c
__driver_probe_device+0xa0
really_probe+0x190
hid_device_probe+0x130
ps_probe+0x990
ps_led_register+0x94
devm_led_classdev_register_ext+0x58
led_classdev_register_ext+0x1f8
device_create_with_groups+0x48
device_create_groups_vargs+0xc8
device_add+0x244
kobject_uevent+0x14
kobject_uevent_env[jt]+0x224
mutex_unlock[jt]+0xc4
__mutex_unlock_slowpath+0xd4
wake_up_q+0x70
try_to_wake_up[jt]+0x48c
preempt_schedule_common+0x28
__schedule+0x628
__switch_to+0x174
el0t_64_sync+0x1a8/0x1ac el0t_64_sync_handler+0x68/0xbc el0_svc+0x38/0x68 do_el0_svc+0x1c/0x28 el0_svc_common+0x80/0xe0 invoke_syscall+0x58/0x114 __arm64_sys_read+0x1c/0x2c ksys_read+0x78/0xe8 vfs_read+0x1e0/0x2c8 kernfs_fop_read_iter+0x68/0x1b4 seq_read_iter+0x158/0x4ec kernfs_seq_show+0x44/0x54 sysfs_kf_seq_show+0xb4/0x130 dev_attr_show+0x38/0x74 brightness_show+0x20/0x4c dualshock4_led_get_brightness+0xc/0x74
[ 3313.874295][ T4013] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000060 [ 3313.874301][ T4013] Mem abort info: [ 3313.874303][ T4013] ESR = 0x0000000096000006 [ 3313.874305][ T4013] EC = 0x25: DABT (current EL), IL = 32 bits [ 3313.874307][ T4013] SET = 0, FnV = 0 [ 3313.874309][ T4013] EA = 0, S1PTW = 0 [ 3313.874311][ T4013] FSC = 0x06: level 2 translation fault [ 3313.874313][ T4013] Data abort info: [ 3313.874314][ T4013] ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000 [ 3313.874316][ T4013] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 3313.874318][ T4013] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 3313.874320][ T4013] user pgtable: 4k pages, 39-bit VAs, pgdp=00000008f2b0a000
..
[ 3313.874332][ T4013] Dumping ftrace buffer: [ 3313.874334][ T4013] (ftrace buffer empty) .. .. [ dd3313.874639][ T4013] CPU: 6 PID: 4013 Comm: InputReader [ 3313.874648][ T4013] pc : dualshock4_led_get_brightness+0xc/0x74 [ 3313.874653][ T4013] lr : led_update_brightness+0x38/0x60 [ 3313.874656][ T4013] sp : ffffffc0b910bbd0 .. .. [ 3313.874685][ T4013] Call trace: [ 3313.874687][ T4013] dualshock4_led_get_brightness+0xc/0x74 [ 3313.874690][ T4013] brightness_show+0x20/0x4c [ 3313.874692][ T4013] dev_attr_show+0x38/0x74 [ 3313.874696][ T4013] sysfs_kf_seq_show+0xb4/0x130 [ 3313.874700][ T4013] kernfs_seq_show+0x44/0x54 [ 3313.874703][ T4013] seq_read_iter+0x158/0x4ec [ 3313.874705][ T4013] kernfs_fop_read_iter+0x68/0x1b4 [ 3313.874708][ T4013] vfs_read+0x1e0/0x2c8 [ 3313.874711][ T4013] ksys_read+0x78/0xe8 [ 3313.874714][ T4013] __arm64_sys_read+0x1c/0x2c [ 3313.874718][ T4013] invoke_syscall+0x58/0x114 [ 3313.874721][ T4013] el0_svc_common+0x80/0xe0 [ 3313.874724][ T4013] do_el0_svc+0x1c/0x28 [ 3313.874727][ T4013] el0_svc+0x38/0x68 [ 3313.874730][ T4013] el0t_64_sync_handler+0x68/0xbc [ 3313.874732][ T4013] el0t_64_sync+0x1a8/0x1ac
--- drivers/leds/led-class.c | 14 +++++++++++--- include/linux/leds.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/leds/led-class.c +11 -3
@@ -28,11 +28,14 @@ static ssize_t brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); +unsigned int brightness; -/* no lock needed for this */ +mutex_lock (&led_cdev->led_access);led_update_brightness (led_cdev); + brightness = led_cdev->brightness; +mutex_unlock (&led_cdev->led_access); -return sprintf (buf,"%u\n" , led_cdev->brightness); +return sprintf (buf,"%u\n" , brightness); } static ssize_t brightness_store(struct device *dev,
@@ -69,8 +72,13 @@ static ssize_t max_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); +unsigned int max_brightness; + +mutex_lock (&led_cdev->led_access); + max_brightness = led_cdev->max_brightness; +mutex_unlock (&led_cdev->led_access); -return sprintf (buf,"%u\n" , led_cdev->max_brightness); +return sprintf (buf,"%u\n" , max_brightness); }static DEVICE_ATTR_RO (max_brightness);
include/linux/leds.h +1 -1
@@ -161,7 +161,7 @@ struct led_classdev {struct kernfs_node *brightness_hw_changed_kn;#endif -/* Ensures consistent access to the LED Flash Class device */ +/* Ensures consistent access to the LED class device */ struct mutex led_access; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 516/565 scsi: st: Dont modify unknown block number in MTIOCGET
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
[ Upstream commit 5bb2d6179d1a8039236237e1e94cfbda3be1ed9e ]
Struct mtget field mt_blkno -1 means it is unknown. Don't add anything to it.
--- drivers/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/st.c +1 -1
@@ -3751,7 +3751,7 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) ((STp->density <<MT_ST_DENSITY_SHIFT ) &MT_ST_DENSITY_MASK ); mt_status.mt_blkno = STps->drv_block; mt_status.mt_fileno = STps->drv_file; -if (STp->block_size !=0 ) { +if (STp->block_size !=0 && mt_status.mt_blkno >=0 ) {if (STps->rw ==ST_WRITING ) mt_status.mt_blkno += (STp->buffer)->buffer_bytes / STp->block_size;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 517/565 scsi: st: Add MTIOCGET and MTLOAD to ioctls allowed after device reset
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
[ Upstream commit 0b120edb37dc9dd8ca82893d386922eb6b16f860 ]
Most drives rewind the tape when the device is reset. Reading and writing are not allowed until something is done to make the tape position match the user's expectation (e.g., rewind the tape). Add MTIOCGET and MTLOAD to operations allowed after reset. MTIOCGET is modified to not touch the tape if pos_unknown is non-zero. The tape location is known after MTLOAD.
--- drivers/scsi/st.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/scsi/st.c +21 -8
@@ -3501,6 +3501,7 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)int i, cmd_nr, cmd_type, bt;int retval =0 ;unsigned int blk; +bool cmd_mtiocget;struct scsi_tape *STp = file->private_data;struct st_modedef *STm;struct st_partstat *STps;
@@ -3614,6 +3615,7 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)*/ if (mtc.mt_op != MTREW && mtc.mt_op != MTOFFL && + mtc.mt_op != MTLOAD && mtc.mt_op != MTRETEN && mtc.mt_op != MTERASE && mtc.mt_op != MTSEEK &&
@@ -3727,17 +3729,28 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) goto out; } + cmd_mtiocget = cmd_type ==_IOC_TYPE (MTIOCGET ) && cmd_nr ==_IOC_NR (MTIOCGET ); +if ((i =flush_buffer (STp,0 )) <0 ) { - retval = i; - goto out; - } -if (STp->can_partitions && - (i =switch_partition (STp)) <0 ) { - retval = i; - goto out; +if (cmd_mtiocget && STp->pos_unknown) { +/* flush fails -> modify status accordingly */ +reset_state (STp); + STp->pos_unknown =1 ; + }else {/* return error */ + retval = i; + goto out; + } + }else {/* flush_buffer succeeds */ +if (STp->can_partitions) { + i =switch_partition (STp); +if (i <0 ) { + retval = i; + goto out; + } + } } -if (cmd_type ==_IOC_TYPE (MTIOCGET ) && cmd_nr ==_IOC_NR (MTIOCGET )) { +if (cmd_mtiocget) {struct mtget mt_status;if (_IOC_SIZE (cmd_in) !=sizeof (struct mtget )) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 518/565 pinctrl: qcom-pmic-gpio: add support for PM8937
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Barnabás Czémán <[email protected]>
[ Upstream commit 89265a58ff24e3885c2c9ca722bc3aaa47018be9 ]
PM8937 has 8 GPIO-s with holes on GPIO3, GPIO4 and GPIO6.
--- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +2 -0
@@ -1156,6 +1156,8 @@ static const struct of_device_id pmic_gpio_of_match[] = { { .compatible = "qcom,pm8350b-gpio", .data = (void *) 8 }, { .compatible = "qcom,pm8350c-gpio", .data = (void *) 9 }, { .compatible = "qcom,pm8916-gpio", .data = (void *) 4 }, + /* pm8937 has 8 GPIOs with holes on 3, 4 and 6 */ + { .compatible = "qcom,pm8937-gpio", .data = (void *) 8 }, { .compatible = "qcom,pm8941-gpio", .data = (void *) 36 }, /* pm8950 has 8 GPIOs with holes on 3 */ { .compatible = "qcom,pm8950-gpio", .data = (void *) 8 },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 519/565 nvdimm: rectify the illogical code within nd_dax_probe()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit b61352101470f8b68c98af674e187cfaa7c43504 ]
When nd_dax is NULL, nd_pfn is consequently NULL as well. Nevertheless, it is inadvisable to perform pointer arithmetic or address-taking on a NULL pointer.
Introduce the nd_dax_devinit() function to enhance the code's logic and improve its readability.
--- drivers/nvdimm/dax_devs.c | 4 ++-- drivers/nvdimm/nd.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/nvdimm/dax_devs.c +2 -2
@@ -106,12 +106,12 @@ int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns)nvdimm_bus_lock (&ndns->dev); nd_dax =nd_dax_alloc (nd_region); - nd_pfn = &nd_dax->nd_pfn; - dax_dev =nd_pfn_devinit (nd_pfn, ndns); + dax_dev =nd_dax_devinit (nd_dax, ndns);nvdimm_bus_unlock (&ndns->dev);if (!dax_dev)return -ENOMEM ; pfn_sb =devm_kmalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); + nd_pfn = &nd_dax->nd_pfn; nd_pfn->pfn_sb = pfn_sb; rc =nd_pfn_validate (nd_pfn,DAX_SIG );dev_dbg (dev,"dax: %s\n" , rc ==0 ?dev_name (dax_dev) :"<none>" );
drivers/nvdimm/nd.h +7 -0
@@ -485,6 +485,13 @@ struct nd_dax *to_nd_dax(struct device *dev);int nd_dax_probe (struct device *dev,struct nd_namespace_common *ndns);bool is_nd_dax (struct device *dev);struct device *nd_dax_create (struct nd_region *nd_region); +static inline struct device *nd_dax_devinit (struct nd_dax *nd_dax, +struct nd_namespace_common *ndns) +{ +if (!nd_dax) +return NULL ; +return nd_pfn_devinit (&nd_dax->nd_pfn, ndns); +}#else static inline int nd_dax_probe (struct device *dev,struct nd_namespace_common *ndns)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 520/565 f2fs: fix f2fs_bug_on when uninstalling filesystem call f2fs_evict_inode.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Han <[email protected]>
[ Upstream commit d5c367ef8287fb4d235c46a2f8c8d68715f3a0ca ]
creating a large files during checkpoint disable until it runs out of space and then delete it, then remount to enable checkpoint again, and then unmount the filesystem triggers the f2fs_bug_on as below:
------------[ cut here ]------------ kernel BUG at fs/f2fs/inode.c:896! CPU: 2 UID: 0 PID: 1286 Comm: umount Not tainted 6.11.0-rc7-dirty #360 Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:f2fs_evict_inode+0x58c/0x610 Call Trace: __die_body+0x15/0x60 die+0x33/0x50 do_trap+0x10a/0x120 f2fs_evict_inode+0x58c/0x610 do_error_trap+0x60/0x80 f2fs_evict_inode+0x58c/0x610 exc_invalid_op+0x53/0x60 f2fs_evict_inode+0x58c/0x610 asm_exc_invalid_op+0x16/0x20 f2fs_evict_inode+0x58c/0x610 evict+0x101/0x260 dispose_list+0x30/0x50 evict_inodes+0x140/0x190 generic_shutdown_super+0x2f/0x150 kill_block_super+0x11/0x40 kill_f2fs_super+0x7d/0x140 deactivate_locked_super+0x2a/0x70 cleanup_mnt+0xb3/0x140 task_work_run+0x61/0x90
The root cause is: creating large files during disable checkpoint period results in not enough free segments, so when writing back root inode will failed in f2fs_enable_checkpoint. When umount the file system after enabling checkpoint, the root inode is dirty in f2fs_evict_inode function, which triggers BUG_ON. The steps to reproduce are as follows:
dd if=/dev/zero of=f2fs.img bs=1M count=55
mount f2fs.img f2fs_dir -o checkpoint=disable:10%
dd if=/dev/zero of=big bs=1M count=50
sync
rm big
mount -o remount,checkpoint=enable f2fs_dir
umount f2fs_dir
Let's redirty inode when there is not free segments during checkpoint is disable.
--- fs/f2fs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/inode.c +3 -1
@@ -724,8 +724,10 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) !is_inode_flag_set(inode, FI_DIRTY_INODE))return 0 ; -if (!f2fs_is_checkpoint_ready (sbi)) +if (!f2fs_is_checkpoint_ready (sbi)) { +f2fs_mark_inode_dirty_sync (inode, true);return -ENOSPC ; + }/* * We need to balance fs here to prevent from producing dirty node pages
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 521/565 i3c: mipi-i3c-hci: Mask ring interrupts before ring stop request
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Nikula <[email protected]>
[ Upstream commit 6ca2738174e4ee44edb2ab2d86ce74f015a0cc32 ]
Bus cleanup path in DMA mode may trigger a RING_OP_STAT interrupt when the ring is being stopped. Depending on timing between ring stop request completion, interrupt handler removal and code execution this may lead to a NULL pointer dereference in hci_dma_irq_handler() if it gets to run after the io_data pointer is set to NULL in hci_dma_cleanup().
Prevent this my masking the ring interrupts before ring stop request.
--- drivers/i3c/master/mipi-i3c-hci/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/mipi-i3c-hci/dma.c +1 -1
@@ -174,10 +174,10 @@ static void hci_dma_cleanup(struct i3c_hci *hci)for (i =0 ; i < rings->total; i++) { rh = &rings->headers[i]; +rh_reg_write (INTR_SIGNAL_ENABLE ,0 );rh_reg_write (RING_CONTROL ,0 );rh_reg_write (CR_SETUP ,0 );rh_reg_write (IBI_SETUP ,0 ); -rh_reg_write (INTR_SIGNAL_ENABLE ,0 );if (rh->xfer) dma_free_coherent(&hci->master.dev,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 522/565 PCI: Detect and trust built-in Thunderbolt chips
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esther Shimanovich <[email protected]>
[ Upstream commit 3b96b895127b7c0aed63d82c974b46340e8466c1 ]
Some computers with CPUs that lack Thunderbolt features use discrete Thunderbolt chips to add Thunderbolt functionality. These Thunderbolt chips are located within the chassis; between the Root Port labeled ExternalFacingPort and the USB-C port.
These Thunderbolt PCIe devices should be labeled as fixed and trusted, as they are built into the computer. Otherwise, security policies that rely on those flags may have unintended results, such as preventing USB-C ports from enumerating.
Detect the above scenario through the process of elimination.
1) Integrated Thunderbolt host controllers already have Thunderbolt implemented, so anything outside their external facing Root Port is removable and untrusted.
Detect them using the following properties:
- Most integrated host controllers have the "usb4-host-interface" ACPI property, as described here:
- Integrated Thunderbolt PCIe Root Ports before Alder Lake do not have the "usb4-host-interface" ACPI property. Identify those by their PCI IDs instead.
2) If a Root Port does not have integrated Thunderbolt capabilities, but has the "ExternalFacingPort" ACPI property, that means the manufacturer has opted to use a discrete Thunderbolt host controller that is built into the computer.
This host controller can be identified by virtue of being located directly below an external-facing Root Port that lacks integrated Thunderbolt. Label it as trusted and fixed.
Everything downstream from it is untrusted and removable.
The "ExternalFacingPort" ACPI property is described here:
https://learn.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports#identifying-externally-exposed-pcie-root-ports
--- arch/x86/pci/acpi.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ drivers/pci/probe.c | 30 ++++++++--- include/linux/pci.h | 6 +++ 3 files changed, 148 insertions(+), 7 deletions(-)
arch/x86/pci/acpi.c +119 -0
@@ -162,6 +162,125 @@ void __init pci_acpi_crs_quirks(void) pci_use_crs ? "nocrs" : "use_crs"); } +/* +* Check if pdev is part of a PCIe switch that is directly below the +* specified bridge. +*/ +static bool pcie_switch_directly_under (struct pci_dev *bridge, +struct pci_dev *pdev) +{ +struct pci_dev *parent =pci_upstream_bridge (pdev); + +/* If the device doesn't have a parent, it's not under anything */ +if (!parent) +return false; + +/* +* If the device has a PCIe type, check if it is below the +* corresponding PCIe switch components (if applicable). Then check +* if its upstream port is directly beneath the specified bridge. +*/ +switch (pci_pcie_type (pdev)) { +case PCI_EXP_TYPE_UPSTREAM : +return parent == bridge; + +case PCI_EXP_TYPE_DOWNSTREAM : +if (pci_pcie_type (parent) !=PCI_EXP_TYPE_UPSTREAM ) +return false; + parent =pci_upstream_bridge (parent); +return parent == bridge; + +case PCI_EXP_TYPE_ENDPOINT : +if (pci_pcie_type (parent) !=PCI_EXP_TYPE_DOWNSTREAM ) +return false; + parent =pci_upstream_bridge (parent); +if (!parent ||pci_pcie_type (parent) !=PCI_EXP_TYPE_UPSTREAM ) +return false; + parent =pci_upstream_bridge (parent); +return parent == bridge; + } + +return false; +} + +static bool pcie_has_usb4_host_interface (struct pci_dev *pdev) +{ +struct fwnode_handle *fwnode; + +/* +* For USB4, the tunneled PCIe Root or Downstream Ports are marked +* with the "usb4-host-interface" ACPI property, so we look for +* that first. This should cover most cases. +*/ + fwnode =fwnode_find_reference (dev_fwnode (&pdev->dev), +"usb4-host-interface" ,0 ); +if (!IS_ERR (fwnode)) { +fwnode_handle_put (fwnode); +return true; + } + +/* +* Any integrated Thunderbolt 3/4 PCIe Root Ports from Intel +* before Alder Lake do not have the "usb4-host-interface" +* property so we use their PCI IDs instead. All these are +* tunneled. This list is not expected to grow. +*/ +if (pdev->vendor ==PCI_VENDOR_ID_INTEL ) { +switch (pdev->device) { +/* Ice Lake Thunderbolt 3 PCIe Root Ports */ +case 0x8a1d : +case 0x8a1f : +case 0x8a21 : +case 0x8a23 : +/* Tiger Lake-LP Thunderbolt 4 PCIe Root Ports */ +case 0x9a23 : +case 0x9a25 : +case 0x9a27 : +case 0x9a29 : +/* Tiger Lake-H Thunderbolt 4 PCIe Root Ports */ +case 0x9a2b : +case 0x9a2d : +case 0x9a2f : +case 0x9a31 : +return true; + } + } + +return false; +} + +bool arch_pci_dev_is_removable (struct pci_dev *pdev) +{ +struct pci_dev *parent, *root; + +/* pdev without a parent or Root Port is never tunneled */ + parent =pci_upstream_bridge (pdev); +if (!parent) +return false; + root =pcie_find_root_port (pdev); +if (!root) +return false; + +/* Internal PCIe devices are not tunneled */ +if (!root->external_facing) +return false; + +/* Anything directly behind a "usb4-host-interface" is tunneled */ +if (pcie_has_usb4_host_interface (parent)) +return true; + +/* +* Check if this is a discrete Thunderbolt/USB4 controller that is +* directly behind the non-USB4 PCIe Root Port marked as +* "ExternalFacingPort". Those are not behind a PCIe tunnel. +*/ +if (pcie_switch_directly_under (root, pdev)) +return false; + +/* PCIe devices after the discrete chip are tunneled */ +return true; +} +#ifdef CONFIG_PCI_MMCONFIG static int check_segment (u16 seg,struct device *dev,char *estr) {
drivers/pci/probe.c +23 -7
@@ -1574,23 +1574,33 @@ static void set_pcie_thunderbolt(struct pci_dev *dev)static void set_pcie_untrusted (struct pci_dev *dev) { -struct pci_dev *parent; +struct pci_dev *parent =pci_upstream_bridge (dev); +if (!parent) +return ;/* -* If the upstream bridge is untrusted we treat this device +* If the upstream bridge is untrusted we treat this device as * untrusted as well. */ - parent =pci_upstream_bridge (dev); -if (parent && (parent->untrusted || parent->external_facing)) +if (parent->untrusted) { + dev->untrusted = true; +return ; + } + +if (arch_pci_dev_is_removable (dev)) { +pci_dbg (dev,"marking as untrusted\n" ); dev->untrusted = true; + } }static void pci_set_removable (struct pci_dev *dev) {struct pci_dev *parent =pci_upstream_bridge (dev); +if (!parent) +return ;/* -* We (only) consider everything downstream from an external_facing +* We (only) consider everything tunneled below an external_facing * device to be removable by the user. We're mainly concerned with * consumer platforms with user accessible thunderbolt ports that are * vulnerable to DMA attacks, and we expect those ports to be marked by
@@ -1600,9 +1610,15 @@ static void pci_set_removable(struct pci_dev *dev)* accessible to user / may not be removed by end user, and thus not * exposed as "removable" to userspace. */ -if (parent && - (parent->external_facing ||dev_is_removable (&parent->dev))) +if (dev_is_removable (&parent->dev)) { +dev_set_removable (&dev->dev,DEVICE_REMOVABLE ); +return ; + } + +if (arch_pci_dev_is_removable (dev)) { +pci_dbg (dev,"marking as removable\n" );dev_set_removable (&dev->dev,DEVICE_REMOVABLE ); + } }/**
include/linux/pci.h +6 -0
@@ -2403,6 +2403,12 @@ pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; }static inline bool pci_pr3_present (struct pci_dev *pdev) {return false; }#endif +#if defined(CONFIG_X86 ) && defined(CONFIG_ACPI ) +bool arch_pci_dev_is_removable (struct pci_dev *pdev); +#else +static inline bool arch_pci_dev_is_removable (struct pci_dev *pdev) {return false; } +#endif +#ifdef CONFIG_EEH static inline struct eeh_dev *pci_dev_to_eeh_dev (struct pci_dev *pdev) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 523/565 PCI: Add reset_subordinate to reset hierarchy below bridge
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 2fa046449a82a7d0f6d9721dd83e348816038444 ]
The "bus" and "cxl_bus" reset methods reset a device by asserting Secondary Bus Reset on the bridge leading to the device. These only work if the device is the only device below the bridge.
Add a sysfs 'reset_subordinate' attribute on bridges that can assert Secondary Bus Reset regardless of how many devices are below the bridge.
This resets all the devices below a bridge in a single command, including the locking and config space save/restore that reset methods normally do.
This may be the only way to reset devices that don't support other reset methods (ACPI, FLR, PM reset, etc).
--- Documentation/ABI/testing/sysfs-bus-pci | 11 +++++++++++ drivers/pci/pci-sysfs.c | 26 +++++++++++++++++++++++++ drivers/pci/pci.c | 2 +- drivers/pci/pci.h | 1 + 4 files changed, 39 insertions(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-bus-pci +11 -0
@@ -148,6 +148,17 @@ Description: will be present in sysfs. Writing 1 to this file will perform reset. +What: /sys/bus/pci/devices/.../reset_subordinate +Date: October 2024 +Contact: [email protected] +Description: + This is visible only for bridge devices. If you want to reset + all devices attached through the subordinate bus of a specific + bridge device, writing 1 to this will try to do it. This will + affect all devices attached to the system through this bridge + similiar to writing 1 to their individual "reset" file, so use + with caution. + What: /sys/bus/pci/devices/.../vpd Date: February 2008 Contact: Ben Hutchings <[email protected]>
drivers/pci/pci-sysfs.c +26 -0
@@ -496,6 +496,31 @@ static ssize_t bus_rescan_store(struct device *dev,static struct device_attribute dev_attr_bus_rescan =__ATTR (rescan,0200 ,NULL , bus_rescan_store); +static ssize_t reset_subordinate_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct pci_bus *bus = pdev->subordinate; +unsigned long val; + +if (!capable (CAP_SYS_ADMIN )) +return -EPERM ; + +if (kstrtoul (buf,0 , &val) <0 ) +return -EINVAL ; + +if (val) { +int ret =__pci_reset_bus (bus); + +if (ret) +return ret; + } + +return count; +} +static DEVICE_ATTR_WO (reset_subordinate); +#if defined(CONFIG_PM ) && defined(CONFIG_ACPI ) static ssize_t d3cold_allowed_store(struct device *dev, struct device_attribute *attr,
@@ -620,6 +645,7 @@ static struct attribute *pci_dev_attrs[] = {static struct attribute *pci_bridge_attrs[] = { &dev_attr_subordinate_bus_number.attr, &dev_attr_secondary_bus_number.attr, + &dev_attr_reset_subordinate.attr,NULL , };
drivers/pci/pci.c +1 -1
@@ -5835,7 +5835,7 @@ EXPORT_SYMBOL_GPL(pci_probe_reset_bus);* * Same as above except return -EAGAIN if the bus cannot be locked */ -static int __pci_reset_bus (struct pci_bus *bus) +int __pci_reset_bus (struct pci_bus *bus) {int rc;
drivers/pci/pci.h +1 -0
@@ -37,6 +37,7 @@ bool pci_reset_supported(struct pci_dev *dev);void pci_init_reset_methods (struct pci_dev *dev);int pci_bridge_secondary_bus_reset (struct pci_dev *dev);int pci_bus_error_reset (struct pci_dev *dev); +int __pci_reset_bus (struct pci_bus *bus);struct pci_cap_saved_data {u16 cap_nr;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 524/565 PCI: Add ACS quirk for Wangxun FF5xxx NICs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mengyuan Lou <[email protected]>
[ Upstream commit aa46a3736afcb7b0793766d22479b8b99fc1b322 ]
Wangxun FF5xxx NICs are similar to SFxxx, RP1000 and RP2000 NICs. They may be multi-function devices, but they do not advertise an ACS capability.
But the hardware does isolate FF5xxx functions as though it had an ACS capability and PCI_ACS_RR and PCI_ACS_CR were set in the ACS Control register, i.e., all peer-to-peer traffic is directed upstream instead of being routed internally.
Add ACS quirk for FF5xxx NICs in pci_quirk_wangxun_nic_acs() so the functions can be in independent IOMMU groups.
--- drivers/pci/quirks.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +9 -6
@@ -4855,18 +4855,21 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags) }/* -* Wangxun 10G/1G NICs have no ACS capability, and on multi-function -* devices, peer-to-peer transactions are not be used between the functions. -* So add an ACS quirk for below devices to isolate functions. +* Wangxun 40G/25G/10G/1G NICs have no ACS capability, but on +* multi-function devices, the hardware isolates the functions by +* directing all peer-to-peer traffic upstream as though PCI_ACS_RR and +* PCI_ACS_CR were set. * SFxxx 1G NICs(em). * RP1000/RP2000 10G NICs(sp). +* FF5xxx 40G/25G/10G NICs(aml). */ static int pci_quirk_wangxun_nic_acs (struct pci_dev *dev,u16 acs_flags) {switch (dev->device) { - case 0x0100 ... 0x010F: -case 0x1001 : -case 0x2001 : + case 0x0100 ... 0x010F: /* EM */ +case 0x1001 :case 0x2001 :/* SP */ +case 0x5010 :case 0x5025 :case 0x5040 :/* AML */ +case 0x5110 :case 0x5125 :case 0x5140 :/* AML */ return pci_acs_ctrl_enabled (acs_flags,PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 525/565 i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Defa Li <[email protected]>
[ Upstream commit 6cf7b65f7029914dc0cd7db86fac9ee5159008c6 ]
A deadlock may happen since the i3c_master_register() acquires &i3cbus->lock twice. See the log below.
Use i3cdev->desc->info instead of calling i3c_device_info() to avoid acquiring the lock twice.
v2:
- Modified the title and commit message
============================================
WARNING: possible recursive locking detected
6.11.0-mainline
--------------------------------------------
init/1 is trying to acquire lock:f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_bus_normaluse_lock
but task is already holding lock:f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_master_register
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&i3cbus->lock);
lock(&i3cbus->lock);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by init/1:
#0: fcffff809b6798f8 (&dev->mutex){....}-{3:3}, at: __driver_attach #1: f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_master_register
stack backtrace: CPU: 6 UID: 0 PID: 1 Comm: init Call trace: dump_backtrace+0xfc/0x17c show_stack+0x18/0x28 dump_stack_lvl+0x40/0xc0 dump_stack+0x18/0x24 print_deadlock_bug+0x388/0x390 __lock_acquire+0x18bc/0x32ec lock_acquire+0x134/0x2b0 down_read+0x50/0x19c i3c_bus_normaluse_lock+0x14/0x24 i3c_device_get_info+0x24/0x58 i3c_device_uevent+0x34/0xa4 dev_uevent+0x310/0x384 kobject_uevent_env+0x244/0x414 kobject_uevent+0x14/0x20 device_add+0x278/0x460 device_register+0x20/0x34 i3c_master_register_new_i3c_devs+0x78/0x154 i3c_master_register+0x6a0/0x6d4 mtk_i3c_master_probe+0x3b8/0x4d8 platform_probe+0xa0/0xe0 really_probe+0x114/0x454 __driver_probe_device+0xa0/0x15c driver_probe_device+0x3c/0x1ac __driver_attach+0xc4/0x1f0 bus_for_each_dev+0x104/0x160 driver_attach+0x24/0x34 bus_add_driver+0x14c/0x294 driver_register+0x68/0x104 __platform_driver_register+0x20/0x30 init_module+0x20/0xfe4 do_one_initcall+0x184/0x464 do_init_module+0x58/0x1ec load_module+0xefc/0x10c8 __arm64_sys_finit_module+0x238/0x33c invoke_syscall+0x58/0x10c el0_svc_common+0xa8/0xdc do_el0_svc+0x1c/0x28 el0_svc+0x50/0xac el0t_64_sync_handler+0x70/0xbc el0t_64_sync+0x1a8/0x1ac
--- drivers/i3c/master.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i3c/master.c +2 -1
@@ -279,7 +279,8 @@ static int i3c_device_uevent(struct device *dev, struct kobj_uevent_env *env)struct i3c_device_info devinfo;u16 manuf, part, ext; -i3c_device_get_info (i3cdev, &devinfo); +if (i3cdev->desc) + devinfo = i3cdev->desc->info; manuf =I3C_PID_MANUF_ID (devinfo.pid); part =I3C_PID_PART_ID (devinfo.pid); ext =I3C_PID_EXTRA_INFO (devinfo.pid);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 526/565 usb: chipidea: udc: handle USB Error Interrupt if IOC not set
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
[ Upstream commit 548f48b66c0c5d4b9795a55f304b7298cde2a025 ]
As per USBSTS register description about UEI:
When completion of a USB transaction results in an error condition, this bit is set by the Host/Device Controller. This bit is set along with the USBINT bit, if the TD on which the error interrupt occurred also had its interrupt on complete (IOC) bit set.
UI is set only when IOC set. Add checking UEI to fix miss call isr_tr_complete_handler() when IOC have not set and transfer error happen.
--- drivers/usb/chipidea/udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/chipidea/udc.c +1 -1
@@ -2030,7 +2030,7 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci) } } -if (USBi_UI & intr) +if ((USBi_UI | USBi_UEI) & intr)isr_tr_complete_handler (ci);if ((USBi_SLI & intr) && !(ci->suspended)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 527/565 MIPS: Loongson64: DTS: Really fix PCIe port nodes for ls7a
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Ruoyao <[email protected]>
[ Upstream commit 4fbd66d8254cedfd1218393f39d83b6c07a01917 ]
Fix the dtc warnings:
arch/mips/boot/dts/loongson/ls7a-pch.dtsi:68.16-416.5: Warning (interrupt_provider): /bus@10000000/pci@1a000000: '#interrupt-cells' found, but node is not an interrupt provider
arch/mips/boot/dts/loongson/ls7a-pch.dtsi:68.16-416.5: Warning (interrupt_provider): /bus@10000000/pci@1a000000: '#interrupt-cells' found, but node is not an interrupt provider
arch/mips/boot/dts/loongson/loongson64g_4core_ls7a.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'And a runtime warning introduced in commit 045b14ca5c36 ("of: WARN on deprecated #address-cells/#size-cells handling"):
WARNING: CPU: 0 PID: 1 at drivers/of/base.c:106 of_bus_n_addr_cells+0x9c/0xe0
Missing '#address-cells' in /bus@10000000/pci@1a000000/pci_bridge@9,0The fix is similar to commit d89a415ff8d5 ("MIPS: Loongson64: DTS: Fix PCIe port nodes for ls7a"), which has fixed the issue for ls2k (despite its subject mentions ls7a).
--- arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 73 +++++++++++++++++++---- 1 file changed, 60 insertions(+), 13 deletions(-)
arch/mips/boot/dts/loongson/ls7a-pch.dtsi +60 -13
@@ -63,7 +63,6 @@ device_type = "pci"; #address-cells = <3>; #size-cells = <2>; - #interrupt-cells = <2>; msi-parent = <&msi>; reg = <0 0x1a000000 0 0x02000000>,
@@ -227,7 +226,7 @@ }; }; - pci_bridge@9,0 { + pcie@9,0 { compatible = "pci0014,7a19.1", "pci0014,7a19", "pciclass060400",
@@ -237,12 +236,16 @@ interrupts = <32 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 32 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@a,0 { + pcie@a,0 { compatible = "pci0014,7a09.1", "pci0014,7a09", "pciclass060400",
@@ -252,12 +255,16 @@ interrupts = <33 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 33 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@b,0 { + pcie@b,0 { compatible = "pci0014,7a09.1", "pci0014,7a09", "pciclass060400",
@@ -267,12 +274,16 @@ interrupts = <34 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 34 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@c,0 { + pcie@c,0 { compatible = "pci0014,7a09.1", "pci0014,7a09", "pciclass060400",
@@ -282,12 +293,16 @@ interrupts = <35 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 35 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@d,0 { + pcie@d,0 { compatible = "pci0014,7a19.1", "pci0014,7a19", "pciclass060400",
@@ -297,12 +312,16 @@ interrupts = <36 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 36 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@e,0 { + pcie@e,0 { compatible = "pci0014,7a09.1", "pci0014,7a09", "pciclass060400",
@@ -312,12 +331,16 @@ interrupts = <37 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 37 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@f,0 { + pcie@f,0 { compatible = "pci0014,7a29.1", "pci0014,7a29", "pciclass060400",
@@ -327,12 +350,16 @@ interrupts = <40 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 40 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@10,0 { + pcie@10,0 { compatible = "pci0014,7a19.1", "pci0014,7a19", "pciclass060400",
@@ -342,12 +369,16 @@ interrupts = <41 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 41 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@11,0 { + pcie@11,0 { compatible = "pci0014,7a29.1", "pci0014,7a29", "pciclass060400",
@@ -357,12 +388,16 @@ interrupts = <42 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 42 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@12,0 { + pcie@12,0 { compatible = "pci0014,7a19.1", "pci0014,7a19", "pciclass060400",
@@ -372,12 +407,16 @@ interrupts = <43 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 43 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@13,0 { + pcie@13,0 { compatible = "pci0014,7a29.1", "pci0014,7a29", "pciclass060400",
@@ -387,12 +426,16 @@ interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 38 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; - pci_bridge@14,0 { + pcie@14,0 { compatible = "pci0014,7a19.1", "pci0014,7a19", "pciclass060400",
@@ -402,9 +445,13 @@ interrupts = <39 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&pic>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &pic 39 IRQ_TYPE_LEVEL_HIGH>; + ranges; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 528/565 powerpc/prom_init: Fixup missing powermac #size-cells
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit cf89c9434af122f28a3552e6f9cc5158c33ce50a ]
On some powermacs escc nodes are missing #size-cells properties, which is deprecated and now triggers a warning at boot since commit 045b14ca5c36 ("of: WARN on deprecated #address-cells/#size-cells handling").
For example:
Missing '#size-cells' in /pci@f2000000/mac-io@c/escc@13000
WARNING: CPU: 0 PID: 0 at drivers/of/base.c:133 of_bus_n_size_cells+0x98/0x108
Hardware name: PowerMac3,1 7400 0xc0209 PowerMac
...
Call Trace:
of_bus_n_size_cells+0x98/0x108 (unreliable)
of_bus_default_count_cells+0x40/0x60
__of_get_address+0xc8/0x21c
__of_address_to_resource+0x5c/0x228
pmz_init_port+0x5c/0x2ec
pmz_probe.isra.0+0x144/0x1e4
pmz_console_init+0x10/0x48
console_init+0xcc/0x138
start_kernel+0x5c4/0x694As powermacs boot via prom_init it's possible to add the missing properties to the device tree during boot, avoiding the warning. Note that escc-legacy nodes are also missing #size-cells properties, but they are skipped by the macio driver, so leave them alone.
Depends-on: 045b14ca5c36 ("of: WARN on deprecated #address-cells/#size-cells handling")
--- arch/powerpc/kernel/prom_init.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
arch/powerpc/kernel/prom_init.c +27 -2
@@ -2928,7 +2928,7 @@ static void __init fixup_device_tree_chrp(void)#endif #if defined(CONFIG_PPC64 ) && defined(CONFIG_PPC_PMAC ) -static void __init fixup_device_tree_pmac (void ) +static void __init fixup_device_tree_pmac64 (void ) {phandle u3, i2c, mpic;u32 u3_rev;
@@ -2968,7 +2968,31 @@ static void __init fixup_device_tree_pmac(void) &parent, sizeof(parent)); }#else -#define fixup_device_tree_pmac () +#define fixup_device_tree_pmac64 () +#endif + +#ifdef CONFIG_PPC_PMAC +static void __init fixup_device_tree_pmac (void ) +{ +__be32 val =1 ; +char type[8 ]; +phandle node; + +// Some pmacs are missing #size-cells on escc nodes +for (node =0 ;prom_next_node (&node); ) { + type[0 ] ='\0' ; +prom_getprop (node,"device_type" , type,sizeof (type)); +if (prom_strcmp (type,"escc" )) +continue ; + +if (prom_getproplen (node,"#size-cells" ) !=PROM_ERROR ) +continue ; + +prom_setprop (node,NULL ,"#size-cells" , &val,sizeof (val)); + } +} +#else +static inline void fixup_device_tree_pmac (void ) { }#endif #ifdef CONFIG_PPC_EFIKA
@@ -3193,6 +3217,7 @@ static void __init fixup_device_tree(void)fixup_device_tree_maple_memory_controller ();fixup_device_tree_chrp ();fixup_device_tree_pmac (); +fixup_device_tree_pmac64 ();fixup_device_tree_efika ();fixup_device_tree_pasemi (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 529/565 misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parker Newman <[email protected]>
[ Upstream commit 7738a7ab9d12c5371ed97114ee2132d4512e9fd5 ]
Add a quirk similar to eeprom_93xx46 to add an extra clock cycle before reading data from the EEPROM.
The 93Cx6 family of EEPROMs output a "dummy 0 bit" between the writing of the op-code/address from the host to the EEPROM and the reading of the actual data from the EEPROM.
More info can be found on page 6 of the AT93C46 datasheet (linked below). Similar notes are found in other 93xx6 datasheets.
In summary the read operation for a 93Cx6 EEPROM is:
Write to EEPROM: 110[A5-A0] (9 bits)
Read from EEPROM: 0[D15-D0] (17 bits)
Where:
110 is the start bit and READ OpCode [A5-A0] is the address to read from 0 is a "dummy bit" preceding the actual data [D15-D0] is the actual data.
Looking at the READ timing diagrams in the 93Cx6 datasheets the dummy bit should be clocked out on the last address bit clock cycle meaning it should be discarded naturally.
However, depending on the hardware configuration sometimes this dummy bit is not discarded. This is the case with Exar PCI UARTs which require an extra clock cycle between sending the address and reading the data.
Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-5193-SEEPROM-AT93C46D-Datasheet.pdf
--- drivers/misc/eeprom/eeprom_93cx6.c | 10 ++++++++++ include/linux/eeprom_93cx6.h | 11 +++++++++++ 2 files changed, 21 insertions(+)
drivers/misc/eeprom/eeprom_93cx6.c +10 -0
@@ -186,6 +186,11 @@ void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word,eeprom_93cx6_write_bits (eeprom, command,PCI_EEPROM_WIDTH_OPCODE + eeprom->width); +if (has_quirk_extra_read_cycle (eeprom)) { +eeprom_93cx6_pulse_high (eeprom); +eeprom_93cx6_pulse_low (eeprom); + } +/* * Read the requested 16 bits. */
@@ -252,6 +257,11 @@ void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, const u8 byte,eeprom_93cx6_write_bits (eeprom, command,PCI_EEPROM_WIDTH_OPCODE + eeprom->width +1 ); +if (has_quirk_extra_read_cycle (eeprom)) { +eeprom_93cx6_pulse_high (eeprom); +eeprom_93cx6_pulse_low (eeprom); + } +/* * Read the requested 8 bits. */
include/linux/eeprom_93cx6.h +11 -0
@@ -11,6 +11,8 @@Supported chipsets: 93c46, 93c56 and 93c66. */ +#include <linux/bits.h> +/* * EEPROM operation defines. */
@@ -34,6 +36,7 @@* @register_write(struct eeprom_93cx6 *eeprom): handler to * write to the eeprom register by using all reg_* fields. * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines +* @quirks: eeprom or controller quirks * @drive_data: Set if we're driving the data line. * @reg_data_in: register field to indicate data input * @reg_data_out: register field to indicate data output
@@ -50,6 +53,9 @@ struct eeprom_93cx6 {void (*register_write)(struct eeprom_93cx6 *eeprom);int width; +unsigned int quirks; +/* Some EEPROMs require an extra clock cycle before reading */ +#define PCI_EEPROM_QUIRK_EXTRA_READ_CYCLE BIT(0)char drive_data;char reg_data_in;
@@ -71,3 +77,8 @@ extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);extern void eeprom_93cx6_write (struct eeprom_93cx6 *eeprom,u8 addr,u16 data); + +static inline bool has_quirk_extra_read_cycle (struct eeprom_93cx6 *eeprom) +{ +return eeprom->quirks &PCI_EEPROM_QUIRK_EXTRA_READ_CYCLE ; +}
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 530/565 modpost: Include .text.* in TEXT_SECTIONS
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
[ Upstream commit 19331e84c3873256537d446afec1f6c507f8c4ef ]
Commit 6c730bfc894f ("modpost: handle -ffunction-sections") added ".text.*" to the OTHER_TEXT_SECTIONS macro to fix certain section mismatch warnings. Unfortunately, this makes it impossible for modpost to warn about section mismatches with LTO, which implies '-ffunction-sections', as all functions are put in their own '.text.<func_name>' sections, which may still reference functions in sections they are not supposed to, such as __init.
Fix this by moving ".text.*" into TEXT_SECTIONS, so that configurations with '-ffunction-sections' will see warnings about mismatched sections.
Stable-dep-of: 7912405643a1 ("modpost: Add .irqentry.text to OTHER_SECTIONS")
--- scripts/mod/modpost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/mod/modpost.c +2 -2
@@ -936,10 +936,10 @@ static void check_section(const char *modname, struct elf_info *elf,#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS#define DATA_SECTIONS ".data", ".data.rel" -#define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ +#define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \ ".kprobes.text", ".cpuidle.text", ".noinstr.text"#define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ - ".fixup", ".entry.text", ".exception.text", ".text.*", \ + ".fixup", ".entry.text", ".exception.text", \ ".coldtext", ".softirqentry.text"#define INIT_SECTIONS ".init.*"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 531/565 modpost: Add .irqentry.text to OTHER_SECTIONS
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit 7912405643a14b527cd4a4f33c1d4392da900888 ]
The compiler can fully inline the actual handler function of an interrupt entry into the .irqentry.text entry point. If such a function contains an access which has an exception table entry, modpost complains about a section mismatch:
WARNING: vmlinux.o(__ex_table+0x447c): Section mismatch in reference ...
The relocation at __ex_table+0x447c references section ".irqentry.text" which is not in the list of authorized sections.
Add .irqentry.text to OTHER_SECTIONS to cure the issue.
--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/mod/modpost.c +1 -1
@@ -940,7 +940,7 @@ static void check_section(const char *modname, struct elf_info *elf, ".kprobes.text", ".cpuidle.text", ".noinstr.text"#define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ ".fixup", ".entry.text", ".exception.text", \ - ".coldtext", ".softirqentry.text" + ".coldtext", ".softirqentry.text", ".irqentry.text"#define INIT_SECTIONS ".init.*"#define MEM_INIT_SECTIONS ".meminit.*"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 532/565 sched/core: Remove the unnecessary need_resched() check in nohz_csd_func()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: K Prateek Nayak <[email protected]>
[ Upstream commit ea9cffc0a154124821531991d5afdd7e8b20d7aa ]
The need_resched() check currently in nohz_csd_func() can be tracked to have been added in scheduler_ipi() back in 2011 via commit ca38062e57e9 ("sched: Use resched IPI to kick off the nohz idle balance")
Since then, it has travelled quite a bit but it seems like an idle_cpu() check currently is sufficient to detect the need to bail out from an idle load balancing. To justify this removal, consider all the following case where an idle load balancing could race with a task wakeup:
o Since commit f3dd3f674555b ("sched: Remove the limitation of WF_ON_CPU on wakelist if wakee cpu is idle") a target perceived to be idle (target_rq->nr_running == 0) will return true for ttwu_queue_cond(target) which will offload the task wakeup to the idle target via an IPI.
In all such cases target_rq->ttwu_pending will be set to 1 before queuing the wake function.
If an idle load balance races here, following scenarios are possible:
- The CPU is not in TIF_POLLING_NRFLAG mode in which case an actual IPI is sent to the CPU to wake it out of idle. If the nohz_csd_func() queues before sched_ttwu_pending(), the idle load balance will bail out since idle_cpu(target) returns 0 since target_rq->ttwu_pending is 1. If the nohz_csd_func() is queued after sched_ttwu_pending() it should see rq->nr_running to be non-zero and bail out of idle load balancing.
- The CPU is in TIF_POLLING_NRFLAG mode and instead of an actual IPI, the sender will simply set TIF_NEED_RESCHED for the target to put it out of idle and flush_smp_call_function_queue() in do_idle() will execute the call function. Depending on the ordering of the queuing of nohz_csd_func() and sched_ttwu_pending(), the idle_cpu() check in nohz_csd_func() should either see target_rq->ttwu_pending = 1 or target_rq->nr_running to be non-zero if there is a genuine task wakeup racing with the idle load balance kick.
o The waker CPU perceives the target CPU to be busy (targer_rq->nr_running != 0) but the CPU is in fact going idle and due to a series of unfortunate events, the system reaches a case where the waker CPU decides to perform the wakeup by itself in ttwu_queue() on the target CPU but target is concurrently selected for idle load balance (XXX: Can this happen? I'm not sure, but we'll consider the mother of all coincidences to estimate the worst case scenario).
ttwu_do_activate() calls enqueue_task() which would increment "rq->nr_running" post which it calls wakeup_preempt() which is responsible for setting TIF_NEED_RESCHED (via a resched IPI or by setting TIF_NEED_RESCHED on a TIF_POLLING_NRFLAG idle CPU) The key thing to note in this case is that rq->nr_running is already non-zero in case of a wakeup before TIF_NEED_RESCHED is set which would lead to idle_cpu() check returning false.
In all cases, it seems that need_resched() check is unnecessary when checking for idle_cpu() first since an impending wakeup racing with idle load balancer will either set the "rq->ttwu_pending" or indicate a newly woken task via "rq->nr_running".
Chasing the reason why this check might have existed in the first place, I came across Peter's suggestion on the fist iteration of Suresh's patch from 2011 [1] where the condition to raise the SCHED_SOFTIRQ was:
sched_ttwu_do_pending(list); if (unlikely((rq->idle == current) && rq->nohz_balance_kick && !need_resched())) raise_softirq_irqoff(SCHED_SOFTIRQ);
Since the condition to raise the SCHED_SOFIRQ was preceded by sched_ttwu_do_pending() (which is equivalent of sched_ttwu_pending()) in the current upstream kernel, the need_resched() check was necessary to catch a newly queued task. Peter suggested modifying it to:
if (idle_cpu() && rq->nohz_balance_kick && !need_resched()) raise_softirq_irqoff(SCHED_SOFTIRQ);
where idle_cpu() seems to have replaced "rq->idle == current" check.
Even back then, the idle_cpu() check would have been sufficient to catch a new task being enqueued. Since commit b2a02fc43a1f ("smp: Optimize send_call_function_single_ipi()") overloads the interpretation of TIF_NEED_RESCHED for TIF_POLLING_NRFLAG idling, remove the need_resched() check in nohz_csd_func() to raise SCHED_SOFTIRQ based on Peter's suggestion.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -1106,7 +1106,7 @@ static void nohz_csd_func(void *info)WARN_ON (!(flags &NOHZ_KICK_MASK )); rq->idle_balance =idle_cpu (cpu); -if (rq->idle_balance && !need_resched ()) { +if (rq->idle_balance) { rq->nohz_idle_balance = flags;raise_softirq_irqoff (SCHED_SOFTIRQ ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 533/565 sched/fair: Add NOHZ balancer flag for nohz.next_balance updates
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Valentin Schneider <[email protected]>
[ Upstream commit efd984c481abb516fab8bafb25bf41fd9397a43c ]
A following patch will trigger NOHZ idle balances as a means to update nohz.next_balance. Vincent noted that blocked load updates can have non-negligible overhead, which should be avoided if the intent is to only update nohz.next_balance.
Add a new NOHZ balance kick flag, NOHZ_NEXT_KICK. Gate NOHZ blocked load update by the presence of NOHZ_STATS_KICK - currently all NOHZ balance kicks will have the NOHZ_STATS_KICK flag set, so no change in behaviour is expected.
Stable-dep-of: ff47a0acfcce ("sched/fair: Check idle_cpu() before need_resched() to detect ilb CPU turning busy")
--- kernel/sched/fair.c | 24 ++++++++++++++---------- kernel/sched/sched.h | 8 +++++++- 2 files changed, 21 insertions(+), 11 deletions(-)
kernel/sched/fair.c +14 -10
@@ -10764,7 +10764,7 @@ static void nohz_balancer_kick(struct rq *rq) goto out;if (rq->nr_running >=2 ) { - flags =NOHZ_KICK_MASK ; + flags =NOHZ_STATS_KICK |NOHZ_BALANCE_KICK ; goto out; }
@@ -10778,7 +10778,7 @@ static void nohz_balancer_kick(struct rq *rq)* on. */ if (rq->cfs.h_nr_running >=1 &&check_cpu_capacity (rq, sd)) { - flags =NOHZ_KICK_MASK ; + flags =NOHZ_STATS_KICK |NOHZ_BALANCE_KICK ; goto unlock; } }
@@ -10792,7 +10792,7 @@ static void nohz_balancer_kick(struct rq *rq)*/ for_each_cpu_and (i,sched_domain_span (sd), nohz.idle_cpus_mask) {if (sched_asym_prefer (i, cpu)) { - flags =NOHZ_KICK_MASK ; + flags =NOHZ_STATS_KICK |NOHZ_BALANCE_KICK ; goto unlock; } }
@@ -10805,7 +10805,7 @@ static void nohz_balancer_kick(struct rq *rq)* to run the misfit task on. */ if (check_misfit_status (rq, sd)) { - flags =NOHZ_KICK_MASK ; + flags =NOHZ_STATS_KICK |NOHZ_BALANCE_KICK ; goto unlock; }
@@ -10832,7 +10832,7 @@ static void nohz_balancer_kick(struct rq *rq)*/ nr_busy =atomic_read (&sds->nr_busy_cpus);if (nr_busy >1 ) { - flags =NOHZ_KICK_MASK ; + flags =NOHZ_STATS_KICK |NOHZ_BALANCE_KICK ; goto unlock; } }
@@ -10994,7 +10994,8 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags,* setting the flag, we are sure to not clear the state and not * check the load of an idle cpu. */ -WRITE_ONCE (nohz.has_blocked,0 ); +if (flags &NOHZ_STATS_KICK ) +WRITE_ONCE (nohz.has_blocked,0 );/* * Ensures that if we miss the CPU, we must see the has_blocked
@@ -11016,13 +11017,15 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags,* balancing owner will pick it up. */ if (need_resched ()) { - has_blocked_load = true; +if (flags &NOHZ_STATS_KICK ) + has_blocked_load = true; goto abort; } rq =cpu_rq (balance_cpu); - has_blocked_load |=update_nohz_stats (rq); +if (flags &NOHZ_STATS_KICK ) + has_blocked_load |=update_nohz_stats (rq);/* * If time for next balance is due,
@@ -11053,8 +11056,9 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags,if (likely (update_next_balance)) nohz.next_balance = next_balance; -WRITE_ONCE (nohz.next_blocked, - now +msecs_to_jiffies (LOAD_AVG_PERIOD )); +if (flags &NOHZ_STATS_KICK ) +WRITE_ONCE (nohz.next_blocked, + now +msecs_to_jiffies (LOAD_AVG_PERIOD )); abort:/* There is still blocked load, enable periodic update */
kernel/sched/sched.h +7 -1
@@ -2739,12 +2739,18 @@ extern void cfs_bandwidth_usage_dec(void);#define NOHZ_BALANCE_KICK_BIT 0#define NOHZ_STATS_KICK_BIT 1#define NOHZ_NEWILB_KICK_BIT 2 +#define NOHZ_NEXT_KICK_BIT 3 +/* Run rebalance_domains() */ #define NOHZ_BALANCE_KICK BIT(NOHZ_BALANCE_KICK_BIT) +/* Update blocked load */ #define NOHZ_STATS_KICK BIT(NOHZ_STATS_KICK_BIT) +/* Update blocked load when entering idle */ #define NOHZ_NEWILB_KICK BIT(NOHZ_NEWILB_KICK_BIT) +/* Update nohz.next_balance */ +#define NOHZ_NEXT_KICK BIT(NOHZ_NEXT_KICK_BIT) -#define NOHZ_KICK_MASK (NOHZ_BALANCE_KICK | NOHZ_STATS_KICK) +#define NOHZ_KICK_MASK (NOHZ_BALANCE_KICK | NOHZ_STATS_KICK | NOHZ_NEXT_KICK)#define nohz_flags (cpu) (&cpu_rq(cpu)->nohz_flags)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 534/565 sched/fair: Check idle_cpu() before need_resched() to detect ilb CPU turning busy
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: K Prateek Nayak <[email protected]>
[ Upstream commit ff47a0acfcce309cf9e175149c75614491953c8f ]
Commit b2a02fc43a1f ("smp: Optimize send_call_function_single_ipi()") optimizes IPIs to idle CPUs in TIF_POLLING_NRFLAG mode by setting the TIF_NEED_RESCHED flag in idle task's thread info and relying on flush_smp_call_function_queue() in idle exit path to run the call-function. A softirq raised by the call-function is handled shortly after in do_softirq_post_smp_call_flush() but the TIF_NEED_RESCHED flag remains set and is only cleared later when schedule_idle() calls __schedule().
need_resched() check in _nohz_idle_balance() exists to bail out of load balancing if another task has woken up on the CPU currently in-charge of idle load balancing which is being processed in SCHED_SOFTIRQ context. Since the optimization mentioned above overloads the interpretation of TIF_NEED_RESCHED, check for idle_cpu() before going with the existing need_resched() check which can catch a genuine task wakeup on an idle CPU processing SCHED_SOFTIRQ from do_softirq_post_smp_call_flush(), as well as the case where ksoftirqd needs to be preempted as a result of new task wakeup or slice expiry.
In case of PREEMPT_RT or threadirqs, although the idle load balancing may be inhibited in some cases on the ilb CPU, the fact that ksoftirqd is the only fair task going back to sleep will trigger a newidle balance on the CPU which will alleviate some imbalance if it exists if idle balance fails to do so.
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
@@ -11016,7 +11016,7 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags,* work being done for other CPUs. Next load * balancing owner will pick it up. */ -if (need_resched ()) { +if (!idle_cpu (this_cpu) &&need_resched ()) {if (flags &NOHZ_STATS_KICK ) has_blocked_load = true; goto abort;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 535/565 sched/core: Prevent wakeup of ksoftirqd during idle load balance
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: K Prateek Nayak <[email protected]>
[ Upstream commit e932c4ab38f072ce5894b2851fea8bc5754bb8e5 ]
Scheduler raises a SCHED_SOFTIRQ to trigger a load balancing event on from the IPI handler on the idle CPU. If the SMP function is invoked from an idle CPU via flush_smp_call_function_queue() then the HARD-IRQ flag is not set and raise_softirq_irqoff() needlessly wakes ksoftirqd because soft interrupts are handled before ksoftirqd get on the CPU.
Adding a trace_printk() in nohz_csd_func() at the spot of raising SCHED_SOFTIRQ and enabling trace events for sched_switch, sched_wakeup, and softirq_entry (for SCHED_SOFTIRQ vector alone) helps observing the current behavior:
<idle>-0 [000] dN.1.: nohz_csd_func: Raising SCHED_SOFTIRQ from nohz_csd_func
<idle>-0 [000] dN.4.: sched_wakeup: comm=ksoftirqd/0 pid=16 prio=120 target_cpu=000
<idle>-0 [000] .Ns1.: softirq_entry: vec=7 [action=SCHED]
<idle>-0 [000] .Ns1.: softirq_exit: vec=7 [action=SCHED]
<idle>-0 [000] d..2.: sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=ksoftirqd/0 next_pid=16 next_prio=120
ksoftirqd/0-16 [000] d..2.: sched_switch: prev_comm=ksoftirqd/0 prev_pid=16 prev_prio=120 prev_state=S ==> next_comm=swapper/0 next_pid=0 next_prio=120
...Use __raise_softirq_irqoff() to raise the softirq. The SMP function call is always invoked on the requested CPU in an interrupt handler. It is guaranteed that soft interrupts are handled at the end.
Following are the observations with the changes when enabling the same set of events:
<idle>-0 [000] dN.1.: nohz_csd_func: Raising SCHED_SOFTIRQ for nohz_idle_balance
<idle>-0 [000] dN.1.: softirq_raise: vec=7 [action=SCHED]
<idle>-0 [000] .Ns1.: softirq_entry: vec=7 [action=SCHED]No unnecessary ksoftirqd wakeups are seen from idle task's context to service the softirq.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -1108,7 +1108,7 @@ static void nohz_csd_func(void *info) rq->idle_balance =idle_cpu (cpu);if (rq->idle_balance) { rq->nohz_idle_balance = flags; -raise_softirq_irqoff (SCHED_SOFTIRQ ); +__raise_softirq_irqoff (SCHED_SOFTIRQ ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 536/565 btrfs: fix missing snapshot drew unlock when root is dead during swap activation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 9c803c474c6c002d8ade68ebe99026cc39c37f85 ]
When activating a swap file we acquire the root's snapshot drew lock and then check if the root is dead, failing and returning with -EPERM if it's dead but without unlocking the root's snapshot lock. Fix this by adding the missing unlock.
--- fs/btrfs/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/inode.c +1 -0
@@ -10891,6 +10891,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,if (btrfs_root_dead (root)) {spin_unlock (&root->root_item_lock); +btrfs_drew_write_unlock (&root->snapshot_lock);btrfs_exclop_finish (fs_info); btrfs_warn(fs_info, "cannot activate swapfile because subvolume %llu is being deleted",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 537/565 tracing/eprobe: Fix to release eprobe when failed to add dyn_event
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit 494b332064c0ce2f7392fa92632bc50191c1b517 ]
Fix eprobe event to unregister event call and release eprobe when it fails to add dynamic event correctly.
--- kernel/trace/trace_eprobe.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/trace/trace_eprobe.c +5 -0
@@ -979,6 +979,11 @@ static int __trace_eprobe_create(int argc, const char *argv[]) goto error; } ret =dyn_event_add (&ep->devent, &ep->tp.event->call); +if (ret <0 ) { +trace_probe_unregister_event_call (&ep->tp); +mutex_unlock (&event_mutex); + goto error; + }mutex_unlock (&event_mutex);return ret; parse_error:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 538/565 Revert "unicode: Dont special case ignorable code points"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 231825b2e1ff6ba799c5eaf396d3ab2354e37c6b upstream.
This reverts commit 5c26d2f1d3f5e4be3e196526bead29ecb139cf91.
It turns out that we can't do this, because while the old behavior of ignoring ignorable code points was most definitely wrong, we have case-folding filesystems with on-disk hash values with that wrong behavior.
So now you can't look up those names, because they hash to something different.
Of course, it's also entirely possible that in the meantime people have created *new* files with the new ("more correct") case folding logic, and reverting will just make other things break.
The correct solution is to not do case folding in filesystems, but sadly, people seem to never really understand that. People still see it as a feature, not a bug.
--- fs/unicode/mkutf8data.c | 70 fs/unicode/utf8data.h_shipped | 6703 +++++++++++++++++++++--------------------- 2 files changed, 3427 insertions(+), 3346 deletions(-)
fs/unicode/mkutf8data.c +70 -0
@@ -2230,6 +2230,75 @@ static void nfdicf_init(void)file_fail (fold_name); } +static void ignore_init (void ) +{ +FILE *file; +unsigned int unichar; +unsigned int first; +unsigned int last; +unsigned int *um; +int count; +int ret; + +if (verbose >0 ) +printf ("Parsing %s\n" , prop_name); + file =fopen (prop_name,"r" ); +if (!file) +open_fail (prop_name, errno); +assert (file); + count =0 ; +while (fgets (line,LINESIZE , file)) { + ret =sscanf (line,"%X..%X ; %s # " , &first, &last, buf0); +if (ret ==3 ) { +if (strcmp (buf0,"Default_Ignorable_Code_Point" )) +continue ; +if (!utf32valid (first) || !utf32valid (last)) +line_fail (prop_name, line); +for (unichar = first; unichar <= last; unichar++) { +free (unicode_data[unichar].utf32nfdi); + um =malloc (sizeof (unsigned int )); + *um =0 ; + unicode_data[unichar].utf32nfdi = um; +free (unicode_data[unichar].utf32nfdicf); + um =malloc (sizeof (unsigned int )); + *um =0 ; + unicode_data[unichar].utf32nfdicf = um; + count++; + } +if (verbose >1 ) +printf (" %X..%X Default_Ignorable_Code_Point\n" , + first, last); +continue ; + } + ret =sscanf (line,"%X ; %s # " , &unichar, buf0); +if (ret ==2 ) { +if (strcmp (buf0,"Default_Ignorable_Code_Point" )) +continue ; +if (!utf32valid (unichar)) +line_fail (prop_name, line); +free (unicode_data[unichar].utf32nfdi); + um =malloc (sizeof (unsigned int )); + *um =0 ; + unicode_data[unichar].utf32nfdi = um; +free (unicode_data[unichar].utf32nfdicf); + um =malloc (sizeof (unsigned int )); + *um =0 ; + unicode_data[unichar].utf32nfdicf = um; +if (verbose >1 ) +printf (" %X Default_Ignorable_Code_Point\n" , + unichar); + count++; +continue ; + } + } +fclose (file); + +if (verbose >0 ) +printf ("Found %d entries\n" , count); +if (count ==0 ) +file_fail (prop_name); +} +static void corrections_init (void ) {FILE *file;
@@ -3327,6 +3396,7 @@ int main(int argc, char *argv[])ccc_init ();nfdi_init ();nfdicf_init (); +ignore_init ();corrections_init ();hangul_decompose ();nfdi_decompose ();
fs/unicode/utf8data.h_shipped +3357 -3346
2,918 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Greg Kroah-Hartman
maintainerPATCH 539/565 KVM: arm64: vgic-its: Add a data length check in vgic_its_save_*
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jing Zhang <[email protected]>
commit 7fe28d7e68f92cc3d0668b8f2fbdf5c303ac3022 upstream.
In all the vgic_its_save_*() functinos, they do not check whether the data length is 8 bytes before calling vgic_write_guest_lock. This patch adds the check. To prevent the kernel from being blown up when the fault occurs, KVM_BUG_ON() is used. And the other BUG_ON()s are replaced together.
--- arch/arm64/kvm/vgic/vgic-its.c | 20 ++++++++------------ arch/arm64/kvm/vgic/vgic.h | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 12 deletions(-)
arch/arm64/kvm/vgic/vgic-its.c +8 -12
@@ -2135,7 +2135,6 @@ static int scan_its_table(struct vgic_itstatic int vgic_its_save_ite (struct vgic_its *its,struct its_device *dev,struct its_ite *ite,gpa_t gpa,int ite_esz) { -struct kvm *kvm = its->dev->kvm;u32 next_offset;u64 val;
@@ -2144,7 +2143,8 @@ static int vgic_its_save_ite(struct vgic ((u64 )ite->irq->intid <<KVM_ITS_ITE_PINTID_SHIFT ) | ite->collection->collection_id; val =cpu_to_le64 (val); -return kvm_write_guest_lock (kvm, gpa, &val, ite_esz); + +return vgic_its_write_entry_lock (its, gpa, val, ite_esz); }/**
@@ -2280,7 +2280,6 @@ static int vgic_its_restore_itt(struct vstatic int vgic_its_save_dte (struct vgic_its *its,struct its_device *dev,gpa_t ptr,int dte_esz) { -struct kvm *kvm = its->dev->kvm;u64 val, itt_addr_field;u32 next_offset;
@@ -2291,7 +2290,8 @@ static int vgic_its_save_dte(struct vgic (itt_addr_field <<KVM_ITS_DTE_ITTADDR_SHIFT ) | (dev->num_eventid_bits - 1)); val =cpu_to_le64 (val); -return kvm_write_guest_lock (kvm, ptr, &val, dte_esz); + +return vgic_its_write_entry_lock (its, ptr, val, dte_esz); }/**
@@ -2471,7 +2471,8 @@ static int vgic_its_save_cte(struct vgic ((u64 )collection->target_addr <<KVM_ITS_CTE_RDBASE_SHIFT ) | collection->collection_id); val =cpu_to_le64 (val); -return kvm_write_guest_lock (its->dev->kvm, gpa, &val, esz); + +return vgic_its_write_entry_lock (its, gpa, val, esz); }static int vgic_its_restore_cte (struct vgic_its *its,gpa_t gpa,int esz)
@@ -2482,8 +2483,7 @@ static int vgic_its_restore_cte(struct vu64 val;int ret; -BUG_ON (esz >sizeof (val)); - ret =kvm_read_guest_lock (kvm, gpa, &val, esz); + ret =vgic_its_read_entry_lock (its, gpa, &val, esz);if (ret)return ret; val =le64_to_cpu (val);
@@ -2517,7 +2517,6 @@ static int vgic_its_save_collection_tablu64 baser = its->baser_coll_table;gpa_t gpa =GITS_BASER_ADDR_48_to_52 (baser);struct its_collection *collection; -u64 val;size_t max_size, filled =0 ;int ret, cte_esz = abi->cte_esz;
@@ -2541,10 +2540,7 @@ static int vgic_its_save_collection_tabl* table is not fully filled, add a last dummy element * with valid bit unset */ - val =0 ; -BUG_ON (cte_esz >sizeof (val)); - ret =kvm_write_guest_lock (its->dev->kvm, gpa, &val, cte_esz); -return ret; +return vgic_its_write_entry_lock (its, gpa,0 , cte_esz); }/**
arch/arm64/kvm/vgic/vgic.h +24 -0
@@ -6,6 +6,7 @@#define __KVM_ARM_VGIC_NEW_H__#include <linux/irqchip/arm-gic-common.h> +#include <asm/kvm_mmu.h> #define PRODUCT_ID_KVM 0x4b/* ASCII code K */ #define IMPLEMENTER_ARM 0x43b
@@ -126,6 +127,29 @@ static inline bool vgic_irq_is_multi_sgireturn vgic_irq_get_lr_count (irq) >1 ; } +static inline int vgic_its_read_entry_lock (struct vgic_its *its,gpa_t eaddr, +u64 *eval,unsigned long esize) +{ +struct kvm *kvm = its->dev->kvm; + +if (KVM_BUG_ON (esize !=sizeof (*eval), kvm)) +return -EINVAL ; + +return kvm_read_guest_lock (kvm, eaddr, eval, esize); + +} + +static inline int vgic_its_write_entry_lock (struct vgic_its *its,gpa_t eaddr, +u64 eval,unsigned long esize) +{ +struct kvm *kvm = its->dev->kvm; + +if (KVM_BUG_ON (esize !=sizeof (eval), kvm)) +return -EINVAL ; + +return kvm_write_guest_lock (kvm, eaddr, &eval, esize); +} +/* * This struct provides an intermediate representation of the fields contained * in the GICH_VMCR and ICH_VMCR registers, such that code exporting the GIC
Greg Kroah-Hartman
maintainerPATCH 540/565 KVM: arm64: vgic-its: Clear DTE when MAPD unmaps a device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunkun Jiang <[email protected]>
commit e9649129d33dca561305fc590a7c4ba8c3e5675a upstream.
vgic_its_save_device_tables will traverse its->device_list to save DTE for each device. vgic_its_restore_device_tables will traverse each entry of device table and check if it is valid. Restore if valid.
But when MAPD unmaps a device, it does not invalidate the corresponding DTE. In the scenario of continuous saves and restores, there may be a situation where a device's DTE is not saved but is restored. This is unreasonable and may cause restore to fail. This patch clears the corresponding DTE when MAPD unmaps a device.
--- arch/arm64/kvm/vgic/vgic-its.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/kvm/vgic/vgic-its.c +4 -2
@@ -1182,9 +1182,11 @@ static int vgic_its_cmd_handle_mapd(strubool valid =its_cmd_get_validbit (its_cmd);u8 num_eventid_bits =its_cmd_get_size (its_cmd);gpa_t itt_addr =its_cmd_get_ittaddr (its_cmd); +int dte_esz =vgic_its_get_abi (its)->dte_esz;struct its_device *device; +gpa_t gpa; -if (!vgic_its_check_id (its, its->baser_device_table, device_id,NULL )) +if (!vgic_its_check_id (its, its->baser_device_table, device_id, &gpa))return E_ITS_MAPD_DEVICE_OOR ;if (valid && num_eventid_bits >VITS_TYPER_IDBITS )
@@ -1205,7 +1207,7 @@ static int vgic_its_cmd_handle_mapd(stru* is an error, so we are done in any case. */ if (!valid) -return 0 ; +return vgic_its_write_entry_lock (its, gpa,0 , dte_esz); device =vgic_its_alloc_device (its, device_id, itt_addr, num_eventid_bits);
Greg Kroah-Hartman
maintainerPATCH 541/565 KVM: arm64: vgic-its: Clear ITE when DISCARD frees an ITE
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunkun Jiang <[email protected]>
commit 7602ffd1d5e8927fadd5187cb4aed2fdc9c47143 upstream.
When DISCARD frees an ITE, it does not invalidate the corresponding ITE. In the scenario of continuous saves and restores, there may be a situation where an ITE is not saved but is restored. This is unreasonable and may cause restore to fail. This patch clears the corresponding ITE when DISCARD frees an ITE.
--- arch/arm64/kvm/vgic/vgic-its.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kvm/vgic/vgic-its.c +5 -1
@@ -855,6 +855,9 @@ static int vgic_its_cmd_handle_discard(s ite =find_ite (its, device_id, event_id);if (ite &&its_is_collection_mapped (ite->collection)) { +struct its_device *device =find_its_device (its, device_id); +int ite_esz =vgic_its_get_abi (its)->ite_esz; +gpa_t gpa = device->itt_addr + ite->event_id * ite_esz;/* * Though the spec talks about removing the pending state, we * don't bother here since we clear the ITTE anyway and the
@@ -863,7 +866,8 @@ static int vgic_its_cmd_handle_discard(svgic_its_invalidate_cache (kvm);its_free_ite (kvm, ite); -return 0 ; + +return vgic_its_write_entry_lock (its, gpa,0 , ite_esz); }return E_ITS_DISCARD_UNMAPPED_INTERRUPT ;
Greg Kroah-Hartman
maintainerPATCH 542/565 jffs2: Prevent rtime decompress memory corruption
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kinsey Moore <[email protected]>
commit fe051552f5078fa02d593847529a3884305a6ffe upstream.
The rtime decompression routine does not fully check bounds during the entirety of the decompression pass and can corrupt memory outside the decompression buffer if the compressed data is corrupted. This adds the required check to prevent this failure mode.
--- fs/jffs2/compr_rtime.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jffs2/compr_rtime.c +3 -0
@@ -95,6 +95,9 @@ static int jffs2_rtime_decompress(unsign positions[value]=outpos;if (repeat) { +if ((outpos + repeat) >= destlen) { +return 1 ; + }if (backoffs + repeat >= outpos) {while (repeat) { cpage_out[outpos++] = cpage_out[backoffs++];
Greg Kroah-Hartman
maintainerPATCH 543/565 jffs2: Fix rtime decompressor
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit b29bf7119d6bbfd04aabb8d82b060fe2a33ef890 upstream.
The fix for a memory corruption contained a off-by-one error and caused the compressor to fail in legit cases.
--- fs/jffs2/compr_rtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jffs2/compr_rtime.c +1 -1
@@ -95,7 +95,7 @@ static int jffs2_rtime_decompress(unsign positions[value]=outpos;if (repeat) { -if ((outpos + repeat) >= destlen) { +if ((outpos + repeat) > destlen) {return 1 ; }if (backoffs + repeat >= outpos) {
Greg Kroah-Hartman
maintainerPATCH 544/565 mm/damon/vaddr-test: split a test function having >1024 bytes frame size
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 044cd9750fe010170f5dc812e4824d98f5ea928c upstream.
On some configuration[1], 'damon_test_split_evenly()' kunit test function has >1024 bytes frame size, so below build warning is triggered:
CC mm/damon/vaddr.o
In file included from mm/damon/vaddr.c:672:
mm/damon/vaddr-test.h: In function 'damon_test_split_evenly':
mm/damon/vaddr-test.h:309:1: warning: the frame size of 1064 bytes is larger than 1024 bytes [-Wframe-larger-than=]
309 | }
| ^
This commit fixes the warning by separating the common logic in the function.
[1] https://lore.kernel.org/linux-mm/[email protected]/
--- mm/damon/vaddr-test.h | 77 +++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 37 deletions(-)
mm/damon/vaddr-test.h +40 -37
@@ -252,59 +252,62 @@ static void damon_test_apply_three_regio new_three_regions, expected, ARRAY_SIZE(expected)); } -static void damon_test_split_evenly (struct kunit *test) +static void damon_test_split_evenly_fail (struct kunit *test, +unsigned long start,unsigned long end,unsigned int nr_pieces) { -struct damon_ctx *c =damon_new_ctx (); -struct damon_target *t; -struct damon_region *r; -unsigned long i; - -KUNIT_EXPECT_EQ (test,damon_va_evenly_split_region (NULL ,NULL ,5 ), - -EINVAL ); - - t =damon_new_target (42 ); - r =damon_new_region (0 ,100 ); -KUNIT_EXPECT_EQ (test,damon_va_evenly_split_region (t, r,0 ), -EINVAL ); +struct damon_target *t =damon_new_target (42 ); +struct damon_region *r =damon_new_region (start, end);damon_add_region (r, t); -KUNIT_EXPECT_EQ (test,damon_va_evenly_split_region (t, r,10 ),0 ); -KUNIT_EXPECT_EQ (test,damon_nr_regions (t),10u ); +KUNIT_EXPECT_EQ (test, +damon_va_evenly_split_region (t, r, nr_pieces), -EINVAL ); +KUNIT_EXPECT_EQ (test,damon_nr_regions (t),1u ); - i =0 ;damon_for_each_region (r, t) { -KUNIT_EXPECT_EQ (test, r->ar.start, i++ *10 ); -KUNIT_EXPECT_EQ (test, r->ar.end, i *10 ); +KUNIT_EXPECT_EQ (test, r->ar.start, start); +KUNIT_EXPECT_EQ (test, r->ar.end, end); } +damon_free_target (t); +} + +static void damon_test_split_evenly_succ (struct kunit *test, +unsigned long start,unsigned long end,unsigned int nr_pieces) +{ +struct damon_target *t =damon_new_target (42 ); +struct damon_region *r =damon_new_region (start, end); +unsigned long expected_width = (end - start) / nr_pieces; +unsigned long i =0 ; - t =damon_new_target (42 ); - r =damon_new_region (5 ,59 );damon_add_region (r, t); -KUNIT_EXPECT_EQ (test,damon_va_evenly_split_region (t, r,5 ),0 ); -KUNIT_EXPECT_EQ (test,damon_nr_regions (t),5u ); +KUNIT_EXPECT_EQ (test, +damon_va_evenly_split_region (t, r, nr_pieces),0 ); +KUNIT_EXPECT_EQ (test,damon_nr_regions (t), nr_pieces); - i =0 ;damon_for_each_region (r, t) { -if (i ==4 ) +if (i == nr_pieces -1 )break ; -KUNIT_EXPECT_EQ (test, r->ar.start,5 +10 * i++); -KUNIT_EXPECT_EQ (test, r->ar.end,5 +10 * i); +KUNIT_EXPECT_EQ (test, + r->ar.start, start + i++ * expected_width); +KUNIT_EXPECT_EQ (test, r->ar.end, start + i * expected_width); } -KUNIT_EXPECT_EQ (test, r->ar.start,5 +10 * i); -KUNIT_EXPECT_EQ (test, r->ar.end,59ul ); +KUNIT_EXPECT_EQ (test, r->ar.start, start + i * expected_width); +KUNIT_EXPECT_EQ (test, r->ar.end, end);damon_free_target (t); +} - t =damon_new_target (42 ); - r =damon_new_region (5 ,6 ); -damon_add_region (r, t); -KUNIT_EXPECT_EQ (test,damon_va_evenly_split_region (t, r,2 ), -EINVAL ); -KUNIT_EXPECT_EQ (test,damon_nr_regions (t),1u ); +static void damon_test_split_evenly (struct kunit *test) +{ +struct damon_ctx *c =damon_new_ctx (); + +KUNIT_EXPECT_EQ (test,damon_va_evenly_split_region (NULL ,NULL ,5 ), + -EINVAL ); + +damon_test_split_evenly_fail (test,0 ,100 ,0 ); +damon_test_split_evenly_succ (test,0 ,100 ,10 ); +damon_test_split_evenly_succ (test,5 ,59 ,5 ); +damon_test_split_evenly_fail (test,5 ,6 ,2 ); -damon_for_each_region (r, t) { -KUNIT_EXPECT_EQ (test, r->ar.start,5ul ); -KUNIT_EXPECT_EQ (test, r->ar.end,6ul ); - } -damon_free_target (t);damon_destroy_ctx (c); }
Greg Kroah-Hartman
maintainerPATCH 545/565 mm/damon/vaddr: fix issue in damon_va_evenly_split_region()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
commit f3c7a1ede435e2e45177d7a490a85fb0a0ec96d1 upstream.
Patch series "mm/damon/vaddr: Fix issue indamon_va_evenly_split_region()". v2.
According to the logic of damon_va_evenly_split_region(), currently following split case would not meet the expectation:
Suppose DAMON_MIN_REGION=0x1000,
Case: Split [0x0, 0x3000) into 2 pieces, then the result would be
acutually 3 regions:
[0x0, 0x1000), [0x1000, 0x2000), [0x2000, 0x3000)
but NOT the expected 2 regions:
[0x0, 0x1000), [0x1000, 0x3000) !!!
The root cause is that when calculating size of each split piece in damon_va_evenly_split_region():
sz_piece = ALIGN_DOWN(sz_orig / nr_pieces, DAMON_MIN_REGION);
both the dividing and the ALIGN_DOWN may cause loss of precision, then each time split one piece of size 'sz_piece' from origin 'start' to 'end' would cause more pieces are split out than expected!!!
To fix it, count for each piece split and make sure no more than 'nr_pieces'. In addition, add above case into damon_test_split_evenly().
And add 'nr_piece == 1' check in damon_va_evenly_split_region() for better code readability and add a corresponding kunit testcase.
This patch (of 2):
According to the logic of damon_va_evenly_split_region(), currently following split case would not meet the expectation:
Suppose DAMON_MIN_REGION=0x1000,
Case: Split [0x0, 0x3000) into 2 pieces, then the result would be
acutually 3 regions:
[0x0, 0x1000), [0x1000, 0x2000), [0x2000, 0x3000)
but NOT the expected 2 regions:
[0x0, 0x1000), [0x1000, 0x3000) !!!
The root cause is that when calculating size of each split piece in damon_va_evenly_split_region():
sz_piece = ALIGN_DOWN(sz_orig / nr_pieces, DAMON_MIN_REGION);
both the dividing and the ALIGN_DOWN may cause loss of precision, then each time split one piece of size 'sz_piece' from origin 'start' to 'end' would cause more pieces are split out than expected!!!
To fix it, count for each piece split and make sure no more than 'nr_pieces'. In addition, add above case into damon_test_split_evenly().
After this patch, damon-operations test passed:
# ./tools/testing/kunit/kunit.py run damon-operations [...] ============== damon-operations (6 subtests) =============== [PASSED] damon_test_three_regions_in_vmas [PASSED] damon_test_apply_three_regions1 [PASSED] damon_test_apply_three_regions2 [PASSED] damon_test_apply_three_regions3 [PASSED] damon_test_apply_three_regions4 [PASSED] damon_test_split_evenly ================ [PASSED] damon-operations =================
--- mm/damon/vaddr-test.h | 1 + mm/damon/vaddr.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
mm/damon/vaddr-test.h +1 -0
@@ -306,6 +306,7 @@ static void damon_test_split_evenly(strudamon_test_split_evenly_fail (test,0 ,100 ,0 );damon_test_split_evenly_succ (test,0 ,100 ,10 );damon_test_split_evenly_succ (test,5 ,59 ,5 ); +damon_test_split_evenly_succ (test,0 ,3 ,2 );damon_test_split_evenly_fail (test,5 ,6 ,2 );damon_destroy_ctx (c);
mm/damon/vaddr.c +2 -2
@@ -69,6 +69,7 @@ static int damon_va_evenly_split_region(unsigned long sz_orig, sz_piece, orig_end;struct damon_region *n =NULL , *next;unsigned long start; +unsigned int i;if (!r || !nr_pieces)return -EINVAL ;
@@ -82,8 +83,7 @@ static int damon_va_evenly_split_region( r->ar.end = r->ar.start + sz_piece; next =damon_next_region (r); -for (start = r->ar.end; start + sz_piece <= orig_end; - start += sz_piece) { +for (start = r->ar.end, i =1 ; i < nr_pieces; start += sz_piece, i++) { n =damon_new_region (start, start + sz_piece);if (!n)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 546/565 xhci: dbc: Fix STALL transfer event handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 9044ad57b60b0556d42b6f8aa218a68865e810a4 upstream.
Don't flush all pending DbC data requests when an endpoint halts.
An endpoint may halt and xHC DbC triggers a STALL error event if there's an issue with a bulk data transfer. The transfer should restart once xHC DbC receives a ClearFeature(ENDPOINT_HALT) request from the host.
Once xHC DbC restarts it will start from the TRB pointed to by dequeue field in the endpoint context, which might be the same TRB we got the STALL event for. Turn the TRB to a no-op in this case to make sure xHC DbC doesn't reuse and tries to retransmit this same TRB after we already handled it, and gave its corresponding data request back.
Other STALL events might be completely bogus.
Lukasz Bartosik discovered that xHC DbC might issue spurious STALL events if hosts sends a ClearFeature(ENDPOINT_HALT) request to non-halted endpoints even without any active bulk transfers.
Assume STALL event is spurious if it reports 0 bytes transferred, and the endpoint stopped on the STALLED TRB.
Don't give back the data request corresponding to the TRB in this case.
The halted status is per endpoint. Track it with a per endpoint flag instead of the driver invented DbC wide DS_STALLED state. DbC remains in DbC-Configured state even if endpoints halt. There is no Stalled state in the DbC Port state Machine (xhci section 7.6.6)
--- drivers/usb/host/xhci-dbgcap.c | 135 ++++++++++++++++++++++++----------------- drivers/usb/host/xhci-dbgcap.h | 2 2 files changed, 83 insertions(+), 54 deletions(-)
drivers/usb/host/xhci-dbgcap.c +82 -53
@@ -158,16 +158,18 @@ static void xhci_dbc_giveback(struct dbcspin_lock (&dbc->lock); } -static void xhci_dbc_flush_single_request (struct dbc_request *req) +static void trb_to_noop (union xhci_trb *trb) { -union xhci_trb *trb = req->trb; - trb->generic.field[0 ] =0 ; trb->generic.field[1 ] =0 ; trb->generic.field[2 ] =0 ; trb->generic.field[3 ] &=cpu_to_le32 (TRB_CYCLE ); trb->generic.field[3 ] |=cpu_to_le32 (TRB_TYPE (TRB_TR_NOOP )); +} +static void xhci_dbc_flush_single_request (struct dbc_request *req) +{ +trb_to_noop (req->trb);xhci_dbc_giveback (req, -ESHUTDOWN ); }
@@ -637,7 +639,6 @@ static void xhci_dbc_stop(struct xhci_dbcase DS_DISABLED :return ;case DS_CONFIGURED : -case DS_STALLED :if (dbc->driver->disconnect) dbc->driver->disconnect (dbc);break ;
@@ -658,6 +659,23 @@ static void xhci_dbc_stop(struct xhci_db }static void +handle_ep_halt_changes (struct xhci_dbc *dbc,struct dbc_ep *dep,bool halted) +{ +if (halted) { +dev_info (dbc->dev,"DbC Endpoint halted\n" ); + dep->halted =1 ; + + }else if (dep->halted) { +dev_info (dbc->dev,"DbC Endpoint halt cleared\n" ); + dep->halted =0 ; + +if (!list_empty (&dep->list_pending)) +writel (DBC_DOOR_BELL_TARGET (dep->direction), + &dbc->regs->doorbell); + } +} + +static void dbc_handle_port_status (struct xhci_dbc *dbc,union xhci_trb *event) {u32 portsc;
@@ -685,6 +703,7 @@ static void dbc_handle_xfer_event(structstruct xhci_ring *ring;int ep_id;int status; +struct xhci_ep_ctx *ep_ctx;u32 comp_code;size_t remain_length;struct dbc_request *req =NULL , *r;
@@ -694,8 +713,30 @@ static void dbc_handle_xfer_event(struct ep_id =TRB_TO_EP_ID (le32_to_cpu (event->generic.field[3 ])); dep = (ep_id ==EPID_OUT ) ?get_out_ep (dbc) :get_in_ep (dbc); + ep_ctx = (ep_id ==EPID_OUT ) ? +dbc_bulkout_ctx (dbc) :dbc_bulkin_ctx (dbc); ring = dep->ring; +/* Match the pending request: */ +list_for_each_entry (r, &dep->list_pending, list_pending) { +if (r->trb_dma == event->trans_event.buffer) { + req = r; +break ; + } +if (r->status == -COMP_STALL_ERROR ) { +dev_warn (dbc->dev,"Give back stale stalled req\n" ); + ring->num_trbs_free++; +xhci_dbc_giveback (r,0 ); + } + } + +if (!req) { +dev_warn (dbc->dev,"no matched request\n" ); +return ; + } + +trace_xhci_dbc_handle_transfer (ring, &req->trb->generic); +switch (comp_code) {case COMP_SUCCESS : remain_length =0 ;
@@ -706,31 +747,49 @@ static void dbc_handle_xfer_event(structcase COMP_TRB_ERROR :case COMP_BABBLE_DETECTED_ERROR :case COMP_USB_TRANSACTION_ERROR : -case COMP_STALL_ERROR :dev_warn (dbc->dev,"tx error %d detected\n" , comp_code); status = -comp_code;break ; +case COMP_STALL_ERROR : +dev_warn (dbc->dev,"Stall error at bulk TRB %llx, remaining %zu, ep deq %llx\n" , + event->trans_event.buffer, remain_length, ep_ctx->deq); + status =0 ; + dep->halted =1 ; + +/* +* xHC DbC may trigger a STALL bulk xfer event when host sends a +* ClearFeature(ENDPOINT_HALT) request even if there wasn't an +* active bulk transfer. +* +* Don't give back this transfer request as hardware will later +* start processing TRBs starting from this 'STALLED' TRB, +* causing TRBs and requests to be out of sync. +* +* If STALL event shows some bytes were transferred then assume +* it's an actual transfer issue and give back the request. +* In this case mark the TRB as No-Op to avoid hw from using the +* TRB again. +*/ + +if ((ep_ctx->deq & ~TRB_CYCLE ) == event->trans_event.buffer) { +dev_dbg (dbc->dev,"Ep stopped on Stalled TRB\n" ); +if (remain_length == req->length) { +dev_dbg (dbc->dev,"Spurious stall event, keep req\n" ); + req->status = -COMP_STALL_ERROR ; + req->actual =0 ; +return ; + } +dev_dbg (dbc->dev,"Give back stalled req, but turn TRB to No-op\n" ); +trb_to_noop (req->trb); + } +break ; +default :dev_err (dbc->dev,"unknown tx error %d\n" , comp_code); status = -comp_code;break ; } -/* Match the pending request: */ -list_for_each_entry (r, &dep->list_pending, list_pending) { -if (r->trb_dma == event->trans_event.buffer) { - req = r; -break ; - } - } - -if (!req) { -dev_warn (dbc->dev,"no matched request\n" ); -return ; - } - -trace_xhci_dbc_handle_transfer (ring, &req->trb->generic); - ring->num_trbs_free++; req->actual = req->length - remain_length;xhci_dbc_giveback (req, status);
@@ -750,7 +809,6 @@ static void inc_evt_deq(struct xhci_ringstatic enum evtreturn xhci_dbc_do_handle_events (struct xhci_dbc *dbc) {dma_addr_t deq; -struct dbc_ep *dep;union xhci_trb *evt;u32 ctrl, portsc;bool update_erdp = false;
@@ -802,43 +860,17 @@ static enum evtreturn xhci_dbc_do_handlereturn EVT_DISC ; } -/* Handle endpoint stall event: */ +/* Check and handle changes in endpoint halt status */ ctrl =readl (&dbc->regs->control); -if ((ctrl &DBC_CTRL_HALT_IN_TR ) || - (ctrl &DBC_CTRL_HALT_OUT_TR )) { -dev_info (dbc->dev,"DbC Endpoint stall\n" ); - dbc->state =DS_STALLED ; - -if (ctrl &DBC_CTRL_HALT_IN_TR ) { - dep =get_in_ep (dbc); -xhci_dbc_flush_endpoint_requests (dep); - } - -if (ctrl &DBC_CTRL_HALT_OUT_TR ) { - dep =get_out_ep (dbc); -xhci_dbc_flush_endpoint_requests (dep); - } - -return EVT_DONE ; - } +handle_ep_halt_changes (dbc,get_in_ep (dbc), ctrl &DBC_CTRL_HALT_IN_TR ); +handle_ep_halt_changes (dbc,get_out_ep (dbc), ctrl &DBC_CTRL_HALT_OUT_TR );/* Clear DbC run change bit: */ if (ctrl &DBC_CTRL_DBC_RUN_CHANGE ) {writel (ctrl, &dbc->regs->control); ctrl =readl (&dbc->regs->control); } -break ; -case DS_STALLED : - ctrl =readl (&dbc->regs->control); -if (!(ctrl &DBC_CTRL_HALT_IN_TR ) && - !(ctrl &DBC_CTRL_HALT_OUT_TR ) && - (ctrl &DBC_CTRL_DBC_RUN )) { - dbc->state =DS_CONFIGURED ; -break ; - } - -return EVT_DONE ;default :dev_err (dbc->dev,"Unknown DbC state %d\n" , dbc->state);break ;
@@ -941,9 +973,6 @@ static ssize_t dbc_show(struct device *dcase DS_CONFIGURED : p ="configured" ;break ; -case DS_STALLED : - p ="stalled" ; -break ;default : p ="unknown" ; }
drivers/usb/host/xhci-dbgcap.h +1 -1
@@ -81,7 +81,6 @@ enum dbc_state {DS_ENABLED ,DS_CONNECTED , DS_CONFIGURED, - DS_STALLED, }; struct dbc_ep {
@@ -89,6 +88,7 @@ struct dbc_ep {struct list_head list_pending;struct xhci_ring *ring; unsigned int direction:1; + unsigned int halted:1; };#define DBC_QUEUE_SIZE 16
Greg Kroah-Hartman
maintainerPATCH 547/565 mmc: mtk-sd: Fix error handle of probe function
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy-ld Lu <[email protected]>
commit 291220451c775a054cedc4fab4578a1419eb6256 upstream.
In the probe function, it goes to 'release_mem' label and returns after some procedure failure. But if the clocks (partial or all) have been enabled previously, they would not be disabled in msdc_runtime_suspend, since runtime PM is not yet enabled for this case.
That cause mmc related clocks always on during system suspend and block suspend flow. Below log is from a SDCard issue of MT8196 chromebook, it returns -ETIMEOUT while polling clock stable in the msdc_ungate_clock() and probe failed, but the enabled clocks could not be disabled anyway.
[ 129.059253] clk_chk_dev_pm_suspend() [ 129.350119] suspend warning: msdcpll is on [ 129.354494] [ck_msdc30_1_sel : enabled, 1, 1, 191999939, ck_msdcpll_d2] [ 129.362787] [ck_msdcpll_d2 : enabled, 1, 1, 191999939, msdcpll] [ 129.371041] [ck_msdc30_1_ck : enabled, 1, 1, 191999939, ck_msdc30_1_sel] [ 129.379295] [msdcpll : enabled, 1, 1, 383999878, clk26m]
Add a new 'release_clk' label and reorder the error handle functions to make sure the clocks be disabled after probe failure.
Message-ID: <[email protected]>
--- drivers/mmc/host/mtk-sd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/host/mtk-sd.c +5 -4
@@ -2612,7 +2612,7 @@ static int msdc_drv_probe(struct platfor ret =msdc_ungate_clock (host);if (ret) {dev_err (&pdev->dev,"Cannot ungate clocks!\n" ); - goto release_mem; + goto release_clk; }msdc_init_hw (host);
@@ -2622,14 +2622,14 @@ static int msdc_drv_probe(struct platfor GFP_KERNEL);if (!host->cq_host) { ret = -ENOMEM ; - goto host_free; + goto release; } host->cq_host->caps |=CQHCI_TASK_DESC_SZ_128 ; host->cq_host->mmio = host->base +0x800 ; host->cq_host->ops = &msdc_cmdq_ops; ret =cqhci_init (host->cq_host, mmc, true);if (ret) - goto host_free; + goto release; mmc->max_segs =128 ;/* cqhci 16bit length */ /* 0 size, means 65536 so we don't have to -1 here */
@@ -2654,9 +2654,10 @@ static int msdc_drv_probe(struct platfor end:pm_runtime_disable (host->dev); release: -platform_set_drvdata (pdev,NULL );msdc_deinit_hw (host); +release_clk:msdc_gate_clock (host); +platform_set_drvdata (pdev,NULL ); release_mem:if (host->dma.gpd) dma_free_coherent(&pdev->dev,
Greg Kroah-Hartman
maintainerPATCH 548/565 drm/amd/display: Check BIOS images before it is used
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Hung <[email protected]>
commit 8b0ddf19cca2a352b2a7e01d99d3ba949a99c84c upstream.
BIOS images may fail to load and null checks are added before they are used.
This fixes 6 NULL_RETURNS issues reported by Coverity.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +14 -0
@@ -664,6 +664,9 @@ static enum bp_result get_ss_info_v3_1( ss_table_header_include =GET_IMAGE (ATOM_ASIC_INTERNAL_SS_INFO_V3 ,DATA_TABLES (ASIC_InternalSS_Info)); +if (!ss_table_header_include) +return BP_RESULT_UNSUPPORTED ; + table_size = (le16_to_cpu (ss_table_header_include->sHeader.usStructureSize) -sizeof (ATOM_COMMON_TABLE_HEADER ))
@@ -1031,6 +1034,8 @@ static enum bp_result get_ss_info_from_i header =GET_IMAGE (ATOM_ASIC_INTERNAL_SS_INFO_V2 ,DATA_TABLES (ASIC_InternalSS_Info)); +if (!header) +return result;memset (info,0 ,sizeof (struct spread_spectrum_info ));
@@ -1104,6 +1109,8 @@ static enum bp_result get_ss_info_from_sget_atom_data_table_revision (header, &revision); tbl =GET_IMAGE (ATOM_SPREAD_SPECTRUM_INFO ,DATA_TABLES (SS_Info)); +if (!tbl) +return result;if (1 != revision.major ||2 > revision.minor)return result;
@@ -1631,6 +1638,8 @@ static uint32_t get_ss_entry_number_from tbl =GET_IMAGE (ATOM_SPREAD_SPECTRUM_INFO ,DATA_TABLES (SS_Info)); +if (!tbl) +return number;if (1 != revision.major ||2 > revision.minor)return number;
@@ -1711,6 +1720,8 @@ static uint32_t get_ss_entry_number_from header_include =GET_IMAGE (ATOM_ASIC_INTERNAL_SS_INFO_V2 ,DATA_TABLES (ASIC_InternalSS_Info)); +if (!header_include) +return 0 ; size = (le16_to_cpu (header_include->sHeader.usStructureSize) -sizeof (ATOM_COMMON_TABLE_HEADER ))
@@ -1748,6 +1759,9 @@ static uint32_t get_ss_entry_number_from header_include =GET_IMAGE (ATOM_ASIC_INTERNAL_SS_INFO_V3 ,DATA_TABLES (ASIC_InternalSS_Info)); +if (!header_include) +return number; + size = (le16_to_cpu (header_include->sHeader.usStructureSize) -sizeof (ATOM_COMMON_TABLE_HEADER )) /sizeof (ATOM_ASIC_SS_ASSIGNMENT_V3 );
Greg Kroah-Hartman
maintainerPATCH 549/565 ocfs2: Revert "ocfs2: fix the la space leak when unmounting an ocfs2 volume"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heming Zhao <[email protected]>
This reverts commit dfe6c5692fb5 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume").
In commit dfe6c5692fb5, the commit log "This bug has existed since the initial OCFS2 code." is wrong. The correct introduction commit is 30dd3478c3cd ("ocfs2: correctly use ocfs2_find_next_zero_bit()").
The influence of commit dfe6c5692fb5 is that it provides a correct fix for the latest kernel. however, it shouldn't be pushed to stable branches. Let's use this commit to revert all branches that include dfe6c5692fb5 and use a new fix method to fix commit 30dd3478c3cd.
--- fs/ocfs2/localalloc.c | 19 ------------------- 1 file changed, 19 deletions(-)
fs/ocfs2/localalloc.c +0 -19
@@ -1008,25 +1008,6 @@ static int ocfs2_sync_local_to_main(stru start = bit_off +1 ; } -/* clear the contiguous bits until the end boundary */ -if (count) { - blkno = la_start_blk + -ocfs2_clusters_to_blocks (osb->sb, - start - count); - -trace_ocfs2_sync_local_to_main_free ( - count, start - count, - (unsigned long long )la_start_blk, - (unsigned long long )blkno); - - status =ocfs2_release_clusters (handle, - main_bm_inode, - main_bm_bh, blkno, - count); -if (status <0 ) -mlog_errno (status); - } - bail:if (status)mlog_errno (status);
Greg Kroah-Hartman
maintainerPATCH 550/565 crypto: hisilicon/qm - inject error before stopping queue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weili Qian <[email protected]>
commit b04f06fc0243600665b3b50253869533b7938468 upstream.
The master ooo cannot be completely closed when the accelerator core reports memory error. Therefore, the driver needs to inject the qm error to close the master ooo. Currently, the qm error is injected after stopping queue, memory may be released immediately after stopping queue, causing the device to access the released memory. Therefore, error is injected to close master ooo before stopping queue to ensure that the device does not access the released memory.
--- drivers/crypto/hisilicon/qm.c | 51 +++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 27 deletions(-)
drivers/crypto/hisilicon/qm.c +24 -27
@@ -4638,6 +4638,28 @@ static int qm_set_vf_mse(struct hisi_qmreturn -ETIMEDOUT ; } +static void qm_dev_ecc_mbit_handle (struct hisi_qm *qm) +{ +u32 nfe_enb =0 ; + +/* Kunpeng930 hardware automatically close master ooo when NFE occurs */ +if (qm->ver >=QM_HW_V3 ) +return ; + +if (!qm->err_status.is_dev_ecc_mbit && + qm->err_status.is_qm_ecc_mbit && + qm->err_ini->close_axi_master_ooo) { + qm->err_ini->close_axi_master_ooo (qm); + }else if (qm->err_status.is_dev_ecc_mbit && + !qm->err_status.is_qm_ecc_mbit && + !qm->err_ini->close_axi_master_ooo) { + nfe_enb =readl (qm->io_base +QM_RAS_NFE_ENABLE ); +writel (nfe_enb &QM_RAS_NFE_MBIT_DISABLE , + qm->io_base +QM_RAS_NFE_ENABLE ); +writel (QM_ECC_MBIT , qm->io_base +QM_ABNORMAL_INT_SET ); + } +} +static int qm_vf_reset_prepare (struct hisi_qm *qm,enum qm_stop_reason stop_reason) {
@@ -4742,6 +4764,8 @@ static int qm_controller_reset_prepare(sreturn ret; } +qm_dev_ecc_mbit_handle (qm); +/* PF obtains the information of VF by querying the register. */ qm_cmd_uninit (qm);
@@ -4766,31 +4790,6 @@ static int qm_controller_reset_prepare(sreturn 0 ; } -static void qm_dev_ecc_mbit_handle (struct hisi_qm *qm) -{ -u32 nfe_enb =0 ; - -/* Kunpeng930 hardware automatically close master ooo when NFE occurs */ -if (qm->ver >=QM_HW_V3 ) -return ; - -if (!qm->err_status.is_dev_ecc_mbit && - qm->err_status.is_qm_ecc_mbit && - qm->err_ini->close_axi_master_ooo) { - - qm->err_ini->close_axi_master_ooo (qm); - - }else if (qm->err_status.is_dev_ecc_mbit && - !qm->err_status.is_qm_ecc_mbit && - !qm->err_ini->close_axi_master_ooo) { - - nfe_enb =readl (qm->io_base +QM_RAS_NFE_ENABLE ); -writel (nfe_enb &QM_RAS_NFE_MBIT_DISABLE , - qm->io_base +QM_RAS_NFE_ENABLE ); -writel (QM_ECC_MBIT , qm->io_base +QM_ABNORMAL_INT_SET ); - } -} -static int qm_soft_reset (struct hisi_qm *qm) {struct pci_dev *pdev = qm->pdev;
@@ -4816,8 +4815,6 @@ static int qm_soft_reset(struct hisi_qmreturn ret; } -qm_dev_ecc_mbit_handle (qm); -/* OOO register set and check */ writel (ACC_MASTER_GLOBAL_CTRL_SHUTDOWN , qm->io_base +ACC_MASTER_GLOBAL_CTRL );
Greg Kroah-Hartman
maintainerPATCH 551/565 ima: Fix use-after-free on a dentrys dname.name
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Berger <[email protected]>
commit be84f32bb2c981ca670922e047cdde1488b233de upstream.
->d_name.name can change on rename and the earlier value can be freed; there are conditions sufficient to stabilize it (->d_lock on dentry, ->d_lock on its parent, ->i_rwsem exclusive on the parent's inode, rename_lock), but none of those are met at any of the sites. Take a stable snapshot of the name instead.
--- security/integrity/ima/ima_api.c | 16 ++++++++++++---- security/integrity/ima/ima_template_lib.c | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-)
security/integrity/ima/ima_api.c +12 -4
@@ -217,7 +217,7 @@ int ima_collect_measurement(struct integconst char *audit_cause ="failed" ;struct inode *inode =file_inode (file);struct inode *real_inode =d_real_inode (file_dentry (file)); -const char *filename = file->f_path.dentry->d_name.name; +struct name_snapshot filename;int result =0 ;int length;void *tmpbuf;
@@ -280,9 +280,13 @@ out:if (file->f_flags &O_DIRECT ) audit_cause ="failed(directio)" ; +take_dentry_name_snapshot (&filename, file->f_path.dentry); +integrity_audit_msg (AUDIT_INTEGRITY_DATA , inode, - filename,"collect_data" , audit_cause, - result,0 ); + filename.name.name,"collect_data" , + audit_cause, result,0 ); + +release_dentry_name_snapshot (&filename); }return result; }
@@ -395,6 +399,7 @@ out:*/ const char *ima_d_path (const struct path *path,char **pathbuf,char *namebuf) { +struct name_snapshot filename;char *pathname =NULL ; *pathbuf =__getname ();
@@ -408,7 +413,10 @@ const char *ima_d_path(const struct path }if (!pathname) { -strlcpy (namebuf, path->dentry->d_name.name,NAME_MAX ); +take_dentry_name_snapshot (&filename, path->dentry); +strscpy (namebuf, filename.name.name,NAME_MAX ); +release_dentry_name_snapshot (&filename); + pathname = namebuf; }
security/integrity/ima/ima_template_lib.c +14 -3
@@ -426,7 +426,10 @@ static int ima_eventname_init_common(str bool size_limit) {const char *cur_filename =NULL ; +struct name_snapshot filename;u32 cur_filename_len =0 ; +bool snapshot = false; +int ret;BUG_ON (event_data->filename ==NULL && event_data->file ==NULL );
@@ -439,7 +442,10 @@ static int ima_eventname_init_common(str }if (event_data->file) { - cur_filename = event_data->file->f_path.dentry->d_name.name; +take_dentry_name_snapshot (&filename, + event_data->file->f_path.dentry); + snapshot = true; + cur_filename = filename.name.name; cur_filename_len =strlen (cur_filename); }else /*
@@ -448,8 +454,13 @@ static int ima_eventname_init_common(str*/ cur_filename_len =IMA_EVENT_NAME_LEN_MAX ; out: -return ima_write_template_field_data (cur_filename, cur_filename_len, -DATA_FMT_STRING , field_data); + ret =ima_write_template_field_data (cur_filename, cur_filename_len, +DATA_FMT_STRING , field_data); + +if (snapshot) +release_dentry_name_snapshot (&filename); + +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 552/565 fou: remove warn in gue_gro_receive on unsupported protocol
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
commit dd89a81d850fa9a65f67b4527c0e420d15bf836c upstream.
Drop the WARN_ON_ONCE inn gue_gro_receive if the encapsulated type is not known or does not have a GRO handler.
Such a packet is easily constructed. Syzbot generates them and sets off this warning.
Remove the warning as it is expected and not actionable.
The warning was previously reduced from WARN_ON to WARN_ON_ONCE in commit 270136613bf7 ("fou: Do WARN_ON_ONCE in gue_gro_receive for bad proto callbacks").
--- net/ipv4/fou.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fou.c +1 -1
@@ -453,7 +453,7 @@ next_proto: offloads =NAPI_GRO_CB (skb)->is_ipv6 ? inet6_offloads : inet_offloads; ops =rcu_dereference (offloads[proto]); -if (WARN_ON_ONCE (!ops || !ops->callbacks.gro_receive)) +if (!ops || !ops->callbacks.gro_receive) goto out; pp =call_gro_receive (ops->callbacks.gro_receive, head, skb);
Greg Kroah-Hartman
maintainerPATCH 553/565 Revert "drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Zekun <[email protected]>
This reverts commit aaf6160a4b7f9ee3cd91aa5b3251f5dbe2170f42.
The origin mainline patch fix a buffer overflow issue in amdgpu_debugfs_gprwave_read(), but it has not been introduced in kernel 6.1 and older kernels. This patch add a check in a wrong function in the same file.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -1
@@ -401,7 +401,7 @@ static ssize_t amdgpu_debugfs_regs_didt_ssize_t result =0 ;int r; -if (size >4096 || size &0x3 || *pos &0x3 ) +if (size &0x3 || *pos &0x3 )return -EINVAL ;if (!adev->didt_wreg)
Greg Kroah-Hartman
maintainerPATCH 554/565 scsi: core: Fix scsi_mode_select() buffer length handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit a7d6840bed0c2b16ac3071b74b5fcf08fc488241 upstream.
The MODE SELECT(6) command allows handling mode page buffers that are up to 255 bytes, including the 4 byte header needed in front of the page buffer. For requests larger than this limit, automatically use the MODE SELECT(10) command.
In both cases, since scsi_mode_select() adds the mode select page header, checks on the buffer length value must include this header size to avoid overflows of the command CDB allocation length field.
While at it, use put_unaligned_be16() for setting the header block descriptor length and CDB allocation length when using MODE SELECT(10).
[mkp: fix MODE SENSE vs. MODE SELECT confusion]
--- drivers/scsi/scsi_lib.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/scsi/scsi_lib.c +13 -8
@@ -2044,8 +2044,15 @@ scsi_mode_select(struct scsi_device *sdememset (cmd,0 ,sizeof (cmd)); cmd[1 ] = (pf ?0x10 :0 ) | (sp ?0x01 :0 ); -if (sdev->use_10_for_ms) { -if (len >65535 ) +/* +* Use MODE SELECT(10) if the device asked for it or if the mode page +* and the mode select header cannot fit within the maximumm 255 bytes +* of the MODE SELECT(6) command. +*/ +if (sdev->use_10_for_ms || + len +4 >255 || + data->block_descriptor_length >255 ) { +if (len >65535 -8 )return -EINVAL ; real_buffer =kmalloc (8 + len,GFP_KERNEL );if (!real_buffer)
@@ -2058,15 +2065,13 @@ scsi_mode_select(struct scsi_device *sde real_buffer[3 ] = data->device_specific; real_buffer[4 ] = data->longlba ?0x01 :0 ; real_buffer[5 ] =0 ; - real_buffer[6 ] = data->block_descriptor_length >>8 ; - real_buffer[7 ] = data->block_descriptor_length; +put_unaligned_be16 (data->block_descriptor_length, + &real_buffer[6 ]); cmd[0 ] =MODE_SELECT_10 ; - cmd[7 ] = len >>8 ; - cmd[8 ] = len; +put_unaligned_be16 (len, &cmd[7 ]); }else { -if (len >255 || data->block_descriptor_length >255 || - data->longlba) +if (data->longlba)return -EINVAL ; real_buffer =kmalloc (4 + len,GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 555/565 gve: Fixes for napi_poll when budget is 0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziwei Xiao <[email protected]>
commit 278a370c1766060d2144d6cf0b06c101e1043b6d upstream.
Netpoll will explicilty pass the polling call with a budget of 0 to indicate it's clearing the Tx path only. For the gve_rx_poll and gve_xdp_poll, they were mistakenly taking the 0 budget as the indication to do all the work. Add check to avoid the rx path and xdp path being called when budget is 0. And also avoid napi_complete_done being called when budget is 0 for netpoll.
--- drivers/net/ethernet/google/gve/gve_main.c | 7 +++++++ drivers/net/ethernet/google/gve/gve_rx.c | 4 ---- drivers/net/ethernet/google/gve/gve_tx.c | 4 ---- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +7 -0
@@ -201,6 +201,10 @@ static int gve_napi_poll(struct napi_strif (block->tx) reschedule |=gve_tx_poll (block, budget); + +if (!budget) +return 0 ; +if (block->rx) reschedule |=gve_rx_poll (block, budget);
@@ -236,6 +240,9 @@ static int gve_napi_poll_dqo(struct napiif (block->tx) reschedule |=gve_tx_poll_dqo (block,/*do_clean=*/ true); +if (!budget) +return 0 ; +if (block->rx) { work_done =gve_rx_poll_dqo (block, budget); reschedule |= work_done == budget;
drivers/net/ethernet/google/gve/gve_rx.c +0 -4
@@ -606,10 +606,6 @@ bool gve_rx_poll(struct gve_notify_block feat = block->napi.dev->features; -/* If budget is 0, do all the work */ -if (budget ==0 ) - budget =INT_MAX ; -if (budget >0 ) repoll |=gve_clean_rx_done (rx, budget, feat);else
drivers/net/ethernet/google/gve/gve_tx.c +0 -4
@@ -686,10 +686,6 @@ bool gve_tx_poll(struct gve_notify_blocku32 nic_done;u32 to_do; -/* If budget is 0, do all the work */ -if (budget ==0 ) - budget =INT_MAX ; -/* Find out how much work there is to be done */ tx->last_nic_done =gve_tx_load_event_counter (priv, tx); nic_done =be32_to_cpu (tx->last_nic_done);
Greg Kroah-Hartman
maintainerPATCH 556/565 arm64/sve: Discard stale CPU state when handling SVE traps
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 751ecf6afd6568adc98f2a6052315552c0483d18 upstream.
The logic for handling SVE traps manipulates saved FPSIMD/SVE state incorrectly, and a race with preemption can result in a task having TIF_SVE set and TIF_FOREIGN_FPSTATE clear even though the live CPU state is stale (e.g. with SVE traps enabled). This has been observed to result in warnings from do_sve_acc() where SVE traps are not expected while TIF_SVE is set:
| if (test_and_set_thread_flag(TIF_SVE))
| WARN_ON(1); /* SVE access shouldn't have trapped */
Warnings of this form have been reported intermittently, e.g.
https://lore.kernel.org/linux-arm-kernel/CA+G9fYtEGe_DhY2Ms7+L7NKsLYUomGsgqpdBj+QwDLeSg=JhGg@mail.gmail.com/
https://lore.kernel.org/linux-arm-kernel/[email protected]/
The race can occur when the SVE trap handler is preempted before and after manipulating the saved FPSIMD/SVE state, starting and ending on the same CPU, e.g.
| void do_sve_acc(unsigned long esr, struct pt_regs *regs)
| {
| // Trap on CPU 0 with TIF_SVE clear, SVE traps enabled
| // task->fpsimd_cpu is 0.
| // per_cpu_ptr(&fpsimd_last_state, 0) is task.
|
| ...
|
| // Preempted; migrated from CPU 0 to CPU 1.
| // TIF_FOREIGN_FPSTATE is set.
|
| get_cpu_fpsimd_context();
|
| if (test_and_set_thread_flag(TIF_SVE))
| WARN_ON(1); /* SVE access shouldn't have trapped */
|
| sve_init_regs() {
| if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) {
| ...
| } else {
| fpsimd_to_sve(current);
| current->thread.fp_type = FP_STATE_SVE;
| }
| }
|
| put_cpu_fpsimd_context();
|
| // Preempted; migrated from CPU 1 to CPU 0.
| // task->fpsimd_cpu is still 0
| // If per_cpu_ptr(&fpsimd_last_state, 0) is still task then:
| // - Stale HW state is reused (with SVE traps enabled)
| // - TIF_FOREIGN_FPSTATE is cleared
| // - A return to userspace skips HW state restore
| }Fix the case where the state is not live and TIF_FOREIGN_FPSTATE is set by calling fpsimd_flush_task_state() to detach from the saved CPU state. This ensures that a subsequent context switch will not reuse the stale CPU state, and will instead set TIF_FOREIGN_FPSTATE, forcing the new state to be reloaded from memory prior to a return to userspace.
--- arch/arm64/kernel/fpsimd.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/fpsimd.c +1 -0
@@ -964,6 +964,7 @@ void do_sve_acc(unsigned long esr, strucfpsimd_bind_task_to_cpu (); }else {fpsimd_to_sve (current); +fpsimd_flush_task_state (current); }put_cpu_fpsimd_context ();
Greg Kroah-Hartman
maintainerPATCH 557/565 arm64: smccc: Remove broken support for SMCCCv1.3 SVE discard hint
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 8c462d56487e3abdbf8a61cedfe7c795a54f4a78 upstream.
SMCCCv1.3 added a hint bit which callers can set in an SMCCC function ID (AKA "FID") to indicate that it is acceptable for the SMCCC implementation to discard SVE and/or SME state over a specific SMCCC call. The kernel support for using this hint is broken and SMCCC calls may clobber the SVE and/or SME state of arbitrary tasks, though FPSIMD state is unaffected.
The kernel support is intended to use the hint when there is no SVE or SME state to save, and to do this it checks whether TIF_FOREIGN_FPSTATE is set or TIF_SVE is clear in assembly code:
| ldr <flags>, [<current_task>, #TSK_TI_FLAGS] | tbnz <flags>, #TIF_FOREIGN_FPSTATE, 1f // Any live FP state? | tbnz <flags>, #TIF_SVE, 2f // Does that state include SVE? | | 1: orr <fid>, <fid>, ARM_SMCCC_1_3_SVE_HINT | 2: | << SMCCC call using FID >>
This is not safe as-is:
(1) SMCCC calls can be made in a preemptible context and preemption can result in TIF_FOREIGN_FPSTATE being set or cleared at arbitrary points in time. Thus checking for TIF_FOREIGN_FPSTATE provides no guarantee.
(2) TIF_FOREIGN_FPSTATE only indicates that the live FP/SVE/SME state in the CPU does not belong to the current task, and does not indicate that clobbering this state is acceptable.
When the live CPU state is clobbered it is necessary to update fpsimd_last_state.st to ensure that a subsequent context switch will reload FP/SVE/SME state from memory rather than consuming the clobbered state. This and the SMCCC call itself must happen in a critical section with preemption disabled to avoid races.
(3) Live SVE/SME state can exist with TIF_SVE clear (e.g. with only TIF_SME set), and checking TIF_SVE alone is insufficient.
Remove the broken support for the SMCCCv1.3 SVE saving hint. This is effectively a revert of commits:
* cfa7ff959a78 ("arm64: smccc: Support SMCCC v1.3 SVE register saving hint")
* a7c3acca5380 ("arm64: smccc: Save lr before calling __arm_smccc_sve_check()")
... leaving behind the ARM_SMCCC_VERSION_1_3 and ARM_SMCCC_1_3_SVE_HINT definitions, since these are simply definitions from the SMCCC specification, and the latter is used in KVM via ARM_SMCCC_CALL_HINTS.
If we want to bring this back in future, we'll probably want to handle this logic in C where we can use all the usual FPSIMD/SVE/SME helper functions, and that'll likely require some rework of the SMCCC code and/or its callers.
--- arch/arm64/kernel/smccc-call.S | 35 +++-------------------------------- drivers/firmware/smccc/smccc.c | 4 ---- include/linux/arm-smccc.h | 30 ++---------------------------- 3 files changed, 5 insertions(+), 64 deletions(-)
arch/arm64/kernel/smccc-call.S +3 -32
@@ -7,48 +7,19 @@ #include <asm/asm-offsets.h> #include <asm/assembler.h> -#include <asm/thread_info.h> - -/* - * If we have SMCCC v1.3 and (as is likely) no SVE state in - * the registers then set the SMCCC hint bit to say there's no - * need to preserve it. Do this by directly adjusting the SMCCC - * function value which is already stored in x0 ready to be called. - */ -SYM_FUNC_START(__arm_smccc_sve_check) - - ldr_l x16, smccc_has_sve_hint - cbz x16, 2f - - get_current_task x16 - ldr x16, [x16, #TSK_TI_FLAGS] - tbnz x16, #TIF_FOREIGN_FPSTATE, 1f // Any live FP state? - tbnz x16, #TIF_SVE, 2f // Does that state include SVE? - -1: orr x0, x0, ARM_SMCCC_1_3_SVE_HINT - -2: ret -SYM_FUNC_END(__arm_smccc_sve_check) -EXPORT_SYMBOL(__arm_smccc_sve_check) .macro SMCCC instr - stp x29, x30, [sp, #-16]! - mov x29, sp -alternative_if ARM64_SVE - bl __arm_smccc_sve_check -alternative_else_nop_endif \instr #0 - ldr x4, [sp, #16] + ldr x4, [sp] stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS] stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS] - ldr x4, [sp, #24] + ldr x4, [sp, #8] cbz x4, 1f /* no quirk structure */ ldr x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS] cmp x9, #ARM_SMCCC_QUIRK_QCOM_A6 b.ne 1f str x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS] -1: ldp x29, x30, [sp], #16 - ret +1: ret .endm /*
drivers/firmware/smccc/smccc.c +0 -4
@@ -16,7 +16,6 @@ static u32 smccc_version = ARM_SMCCC_VERstatic enum arm_smccc_conduit smccc_conduit =SMCCC_CONDUIT_NONE ;bool __ro_after_init smccc_trng_available = false; -u64 __ro_after_init smccc_has_sve_hint = false;void __init arm_smccc_version_init (u32 version,enum arm_smccc_conduit conduit) {
@@ -24,9 +23,6 @@ void __init arm_smccc_version_init(u32 v smccc_conduit = conduit; smccc_trng_available =smccc_probe_trng (); -if (IS_ENABLED (CONFIG_ARM64_SVE ) && - smccc_version >=ARM_SMCCC_VERSION_1_3 ) - smccc_has_sve_hint = true; }enum arm_smccc_conduit arm_smccc_1_1_get_conduit (void )
include/linux/arm-smccc.h +2 -28
@@ -224,8 +224,6 @@ u32 arm_smccc_get_version(void);void __init arm_smccc_version_init (u32 version,enum arm_smccc_conduit conduit); -extern u64 smccc_has_sve_hint; -/** * struct arm_smccc_res - Result from SMC/HVC call * @a0-a3 result values from registers 0 to 3
@@ -306,15 +304,6 @@ struct arm_smccc_quirk { };/** -* __arm_smccc_sve_check() - Set the SVE hint bit when doing SMC calls -* -* Sets the SMCCC hint bit to indicate if there is live state in the SVE -* registers, this modifies x0 in place and should never be called from C -* code. -*/ -asmlinkage unsigned long __arm_smccc_sve_check (unsigned long x0); - -/** * __arm_smccc_smc() - make SMC calls * @a0-a7: arguments passed in registers 0 to 7 * @res: result values from registers 0 to 3
@@ -381,20 +370,6 @@ asmlinkage void __arm_smccc_hvc(unsigned#endif -/* nVHE hypervisor doesn't have a current thread so needs separate checks */ -#if defined(CONFIG_ARM64_SVE ) && !defined(__KVM_NVHE_HYPERVISOR__) - -#define SMCCC_SVE_CHECK ALTERNATIVE("nop \n", "bl __arm_smccc_sve_check \n", \ - ARM64_SVE) -#define smccc_sve_clobbers "x16", "x30", "cc", - -#else - -#define SMCCC_SVE_CHECK -#define smccc_sve_clobbers - -#endif -#define ___count_args (_0, _1, _2, _3, _4, _5, _6, _7, _8, x, ...) x#define __count_args (...) \
@@ -462,7 +437,7 @@ asmlinkage void __arm_smccc_hvc(unsigned#define ___constraints (count) \ : __constraint_read_ ## count \ - : smccc_sve_clobbers "memory" + : "memory"#define __constraints (count) ___constraints(count)/*
@@ -477,8 +452,7 @@ asmlinkage void __arm_smccc_hvc(unsigned registerunsigned long r2 asm("r2" ); \ registerunsigned long r3 asm("r3" ); \__declare_args (__count_args (__VA_ARGS__), __VA_ARGS__); \ - asmvolatile (SMCCC_SVE_CHECK \ - inst "\n" : \ + asmvolatile (inst"\n" : \"=r" (r0),"=r" (r1),"=r" (r2),"=r" (r3) \ __constraints(__count_args(__VA_ARGS__))); \if (___res) \
Greg Kroah-Hartman
maintainerPATCH 558/565 Bluetooth: L2CAP: Fix uaf in l2cap_connect
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
commit 333b4fd11e89b29c84c269123f871883a30be586 upstream.
[Syzbot reported]
BUG: KASAN: slab-use-after-free in l2cap_connect.constprop.0+0x10d8/0x1270 net/bluetooth/l2cap_core.c:3949 Read of size 8 at addr ffff8880241e9800 by task kworker/u9:0/54 CPU: 0 UID: 0 PID: 54 Comm: kworker/u9:0 Not tainted 6.11.0-rc6-syzkaller-00268-g788220eee30d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Workqueue: hci2 hci_rx_work Call Trace: <TASK> __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 l2cap_connect.constprop.0+0x10d8/0x1270 net/bluetooth/l2cap_core.c:3949 l2cap_connect_req net/bluetooth/l2cap_core.c:4080 [inline] l2cap_bredr_sig_cmd net/bluetooth/l2cap_core.c:4772 [inline] l2cap_sig_channel net/bluetooth/l2cap_core.c:5543 [inline] l2cap_recv_frame+0xf0b/0x8eb0 net/bluetooth/l2cap_core.c:6825 l2cap_recv_acldata+0x9b4/0xb70 net/bluetooth/l2cap_core.c:7514 hci_acldata_packet net/bluetooth/hci_core.c:3791 [inline] hci_rx_work+0xaab/0x1610 net/bluetooth/hci_core.c:4028 process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
...
Freed by task 5245: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2256 [inline] slab_free mm/slub.c:4477 [inline] kfree+0x12a/0x3b0 mm/slub.c:4598 l2cap_conn_free net/bluetooth/l2cap_core.c:1810 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_conn_put net/bluetooth/l2cap_core.c:1822 [inline] l2cap_conn_del+0x59d/0x730 net/bluetooth/l2cap_core.c:1802 l2cap_connect_cfm+0x9e6/0xf80 net/bluetooth/l2cap_core.c:7241 hci_connect_cfm include/net/bluetooth/hci_core.h:1960 [inline] hci_conn_failed+0x1c3/0x370 net/bluetooth/hci_conn.c:1265 hci_abort_conn_sync+0x75a/0xb50 net/bluetooth/hci_sync.c:5583 abort_conn_sync+0x197/0x360 net/bluetooth/hci_conn.c:2917 hci_cmd_sync_work+0x1a4/0x410 net/bluetooth/hci_sync.c:328 process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
--- net/bluetooth/hci_core.c | 2 ++ net/bluetooth/hci_event.c | 2 +- net/bluetooth/l2cap_core.c | 9 --------- 3 files changed, 3 insertions(+), 10 deletions(-)
net/bluetooth/hci_core.c +2 -0
@@ -4964,6 +4964,8 @@ static void hci_acldata_packet(struct hchci_dev_lock (hdev); conn =hci_conn_hash_lookup_handle (hdev, handle); +if (conn &&hci_dev_test_flag (hdev,HCI_MGMT )) +mgmt_device_connected (hdev, conn,NULL ,0 );hci_dev_unlock (hdev);if (conn) {
net/bluetooth/hci_event.c +1 -1
@@ -3338,7 +3338,7 @@ static void hci_remote_features_evt(stru goto unlock; } -if (!ev->status && !test_bit (HCI_CONN_MGMT_CONNECTED , &conn->flags)) { +if (!ev->status) {struct hci_cp_remote_name_req cp;memset (&cp,0 ,sizeof (cp));bacpy (&cp.bdaddr, &conn->dst);
net/bluetooth/l2cap_core.c +0 -9
@@ -4276,18 +4276,9 @@ sendresp:static int l2cap_connect_req (struct l2cap_conn *conn,struct l2cap_cmd_hdr *cmd,u16 cmd_len,u8 *data) { -struct hci_dev *hdev = conn->hcon->hdev; -struct hci_conn *hcon = conn->hcon; -if (cmd_len <sizeof (struct l2cap_conn_req ))return -EPROTO ; -hci_dev_lock (hdev); -if (hci_dev_test_flag (hdev,HCI_MGMT ) && - !test_and_set_bit (HCI_CONN_MGMT_CONNECTED , &hcon->flags)) -mgmt_device_connected (hdev, hcon,NULL ,0 ); -hci_dev_unlock (hdev); -l2cap_connect (conn, cmd, data,L2CAP_CONN_RSP ,0 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 559/565 net: dsa: microchip: correct KSZ8795 static MAC table access
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristram Ha <[email protected]>
commit 4bdf79d686b49ac49373b36466acfb93972c7d7c upstream.
The KSZ8795 driver code was modified to use on KSZ8863/73, which has different register definitions. Some of the new KSZ8795 register information are wrong compared to previous code.
KSZ8795 also behaves differently in that the STATIC_MAC_TABLE_USE_FID and STATIC_MAC_TABLE_FID bits are off by 1 when doing MAC table reading than writing. To compensate that a special code was added to shift the register value by 1 before applying those bits. This is wrong when the code is running on KSZ8863, so this special code is only executed when KSZ8795 is detected.
--- drivers/net/dsa/microchip/ksz8795.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/net/dsa/microchip/ksz8795.c +13 -5
@@ -25,6 +25,8 @@#include "ksz8795_reg.h" #include "ksz8.h" +#define KSZ8795_CHIP_ID 0x09 +static const u8 ksz8795_regs[] = { [REG_IND_CTRL_0 ] =0x6E , [REG_IND_DATA_8 ] =0x70 ,
@@ -52,13 +54,13 @@ static const u32 ksz8795_masks[] = { [STATIC_MAC_TABLE_VALID] = BIT(21), [STATIC_MAC_TABLE_USE_FID] = BIT(23), [STATIC_MAC_TABLE_FID] = GENMASK(30, 24), - [STATIC_MAC_TABLE_OVERRIDE] = BIT(26), - [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(24, 20), + [STATIC_MAC_TABLE_OVERRIDE] = BIT(22), + [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(20, 16), [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(6, 0), - [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(8), + [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(7), [DYNAMIC_MAC_TABLE_NOT_READY] = BIT(7), [DYNAMIC_MAC_TABLE_ENTRIES] = GENMASK(31, 29), - [DYNAMIC_MAC_TABLE_FID] = GENMASK(26, 20), + [DYNAMIC_MAC_TABLE_FID] = GENMASK(22, 16), [DYNAMIC_MAC_TABLE_SRC_PORT] = GENMASK(26, 24), [DYNAMIC_MAC_TABLE_TIMESTAMP] = GENMASK(28, 27), };
@@ -601,7 +603,13 @@ static int ksz8_r_sta_mac_table(struct k shifts[STATIC_MAC_FWD_PORTS ]; alu->is_override = (data_hi & masks[STATIC_MAC_TABLE_OVERRIDE ]) ?1 :0 ; - data_hi >>=1 ; + +/* KSZ8795 family switches have STATIC_MAC_TABLE_USE_FID and +* STATIC_MAC_TABLE_FID definitions off by 1 when doing read on the +* static MAC table compared to doing write. +*/ +if (dev->chip_id ==KSZ8795_CHIP_ID ) + data_hi >>=1 ; alu->is_static = true; alu->is_use_fid = (data_hi & masks[STATIC_MAC_TABLE_USE_FID ]) ?1 :0 ;
Greg Kroah-Hartman
maintainerPATCH 560/565 drm/amd/display: Correct the defined value for AMDGPU_DMUB_NOTIFICATION_MAX
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Lin <[email protected]>
commit ad28d7c3d989fc5689581664653879d664da76f0 upstream.
[Why & How]
It actually exposes '6' types in enum dmub_notification_type. Not 5. Using smaller number to create array dmub_callback & dmub_thread_offload has potential to access item out of array bound. Fix it.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -1
@@ -48,7 +48,7 @@#define AMDGPU_DM_MAX_NUM_EDP 2 -#define AMDGPU_DMUB_NOTIFICATION_MAX 5 +#define AMDGPU_DMUB_NOTIFICATION_MAX 6/* #include "include/amdgpu_dal_power_if.h" #include "amdgpu_dm_irq.h"
Greg Kroah-Hartman
maintainerPATCH 561/565 drm/amdgpu: rework resume handling for display (v2)
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 73dae652dcac776296890da215ee7dec357a1032 upstream.
Split resume into a 3rd step to handle displays when DCC is enabled on DCN 4.0.1. Move display after the buffer funcs have been re-enabled so that the GPU will do the move and properly set the DCC metadata for DCN.
v2: fix fence irq resume ordering
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 45 +++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +43 -2
@@ -3197,7 +3197,7 @@ static int amdgpu_device_ip_resume_phase* * @adev: amdgpu_device pointer * -* First resume function for hardware IPs. The list of all the hardware +* Second resume function for hardware IPs. The list of all the hardware * IPs that make up the asic is walked and the resume callbacks are run for * all blocks except COMMON, GMC, and IH. resume puts the hardware into a * functional state after a suspend and updates the software state as
@@ -3215,6 +3215,7 @@ static int amdgpu_device_ip_resume_phaseif (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_COMMON || adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_GMC || adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_IH || + adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_DCE || adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_PSP )continue ; r = adev->ip_blocks[i].version->funcs->resume (adev);
@@ -3239,6 +3240,36 @@ static int amdgpu_device_ip_resume_phase }/** +* amdgpu_device_ip_resume_phase3 - run resume for hardware IPs +* +* @adev: amdgpu_device pointer +* +* Third resume function for hardware IPs. The list of all the hardware +* IPs that make up the asic is walked and the resume callbacks are run for +* all DCE. resume puts the hardware into a functional state after a suspend +* and updates the software state as necessary. This function is also used +* for restoring the GPU after a GPU reset. +* +* Returns 0 on success, negative error code on failure. +*/ +static int amdgpu_device_ip_resume_phase3 (struct amdgpu_device *adev) +{ +int i, r; + +for (i =0 ; i < adev->num_ip_blocks; i++) { +if (!adev->ip_blocks[i].status.valid || adev->ip_blocks[i].status.hw) +continue ; +if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_DCE ) { + r = adev->ip_blocks[i].version->funcs->resume (adev); +if (r) +return r; + } + } + +return 0 ; +} + +/** * amdgpu_device_ip_resume - run resume for hardware IPs * * @adev: amdgpu_device pointer
@@ -3268,6 +3299,13 @@ static int amdgpu_device_ip_resume(struc r =amdgpu_device_ip_resume_phase2 (adev); +if (r) +return r; + +amdgpu_fence_driver_hw_init (adev); + + r =amdgpu_device_ip_resume_phase3 (adev); +return r; }
@@ -4160,7 +4198,6 @@ int amdgpu_device_resume(struct drm_devidev_err (adev->dev,"amdgpu_device_ip_resume failed (%d).\n" , r);return r; } -amdgpu_fence_driver_hw_init (adev); r =amdgpu_device_ip_late_init (adev);if (r)
@@ -4806,6 +4843,10 @@ int amdgpu_do_asic_reset(struct list_heaif (r) goto out; + r =amdgpu_device_ip_resume_phase3 (tmp_adev); +if (r) + goto out; +if (vram_lost)amdgpu_device_fill_reset_magic (tmp_adev);
Greg Kroah-Hartman
maintainerPATCH 562/565 serial: amba-pl011: fix build regression
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit b5a23a60e8ab5711f4952912424347bf3864ce8d upstream.
When CONFIG_DMA_ENGINE is disabled, the driver now fails to build:
drivers/tty/serial/amba-pl011.c: In function 'pl011_unthrottle_rx':drivers/tty/serial/amba-pl011.c:1822:16: error: 'struct uart_amba_port' has no member named 'using_rx_dma'
1822 | if (uap->using_rx_dma) {
| ^~drivers/tty/serial/amba-pl011.c:1823:20: error: 'struct uart_amba_port' has no member named 'dmacr'
1823 | uap->dmacr |= UART011_RXDMAE;
| ^~drivers/tty/serial/amba-pl011.c:1824:32: error: 'struct uart_amba_port' has no member named 'dmacr'
1824 | pl011_write(uap->dmacr, uap, REG_DMACR);
| ^~
Add the missing #ifdef check around these field accesses, matching what other parts of this driver do.
--- drivers/tty/serial/amba-pl011.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/amba-pl011.c +2 -0
@@ -1842,10 +1842,12 @@ static void pl011_unthrottle_rx(struct upl011_write (uap->im, uap,REG_IMSC ); +#ifdef CONFIG_DMA_ENGINE if (uap->using_rx_dma) { uap->dmacr |=UART011_RXDMAE ;pl011_write (uap->dmacr, uap,REG_DMACR ); } +#endif uart_port_unlock_irqrestore (&uap->port, flags); }
Greg Kroah-Hartman
maintainerPATCH 563/565 media: venus: vdec: fixed possible memory leak issue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ameer Hamza <[email protected]>
commit 8403fdd775858a7bf04868d43daea0acbe49ddfc upstream.
The venus_helper_alloc_dpb_bufs() implementation allows an early return on an error path when checking the id from ida_alloc_min() which would not release the earlier buffer allocation.
Move the direct kfree() from the error checking of dma_alloc_attrs() to the common fail path to ensure that allocations are released on all error paths in this function.
Addresses-Coverity: 1494120 ("Resource leak")
--- drivers/media/platform/qcom/venus/helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/venus/helpers.c +1 -1
@@ -189,7 +189,6 @@ int venus_helper_alloc_dpb_bufs(struct v buf->va =dma_alloc_attrs (dev, buf->size, &buf->da,GFP_KERNEL , buf->attrs);if (!buf->va) { -kfree (buf); ret = -ENOMEM ; goto fail; }
@@ -209,6 +208,7 @@ int venus_helper_alloc_dpb_bufs(struct vreturn 0 ; fail: +kfree (buf);venus_helper_free_dpb_bufs (inst);return ret; }
Greg Kroah-Hartman
maintainerPATCH 564/565 net/smc: Fix af_ops of child socket pointing to released memory
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karsten Graul <[email protected]>
commit 49b7d376abe54a49e8bd5e64824032b7c97c62d4 upstream.
Child sockets may inherit the af_ops from the parent listen socket. When the listen socket is released then the af_ops of the child socket points to released memory.
Solve that by restoring the original af_ops for child sockets which inherited the parent af_ops. And clear any inherited user_data of the parent socket.
--- net/smc/af_smc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/smc/af_smc.c +12 -2
@@ -79,6 +79,7 @@ static struct sock *smc_tcp_syn_recv_soc bool *own_req) {struct smc_sock *smc; +struct sock *child; smc =smc_clcsock_user_data (sk);
@@ -92,8 +93,17 @@ static struct sock *smc_tcp_syn_recv_soc }/* passthrough to original syn recv sock fct */ -return smc->ori_af_ops->syn_recv_sock (sk, skb, req, dst, req_unhash, - own_req); + child = smc->ori_af_ops->syn_recv_sock (sk, skb, req, dst, req_unhash, + own_req); +/* child must not inherit smc or its ops */ +if (child) { +rcu_assign_sk_user_data (child,NULL ); + +/* v4-mapped sockets don't inherit parent ops. Don't restore. */ +if (inet_csk (child)->icsk_af_ops ==inet_csk (sk)->icsk_af_ops) +inet_csk (child)->icsk_af_ops = smc->ori_af_ops; + } +return child; drop:dst_release (dst);
Greg Kroah-Hartman
maintainerPATCH 565/565 Bluetooth: hci_core: Fix calling mgmt_device_connected
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
commit 7967dc8f797f454d4f4acec15c7df0cdf4801617 upstream.
Since 61a939c68ee0 ("Bluetooth: Queue incoming ACL data until BT_CONNECTED state is reached") there is no long the need to call mgmt_device_connected as ACL data will be queued until BT_CONNECTED state.
--- net/bluetooth/hci_core.c | 2 -- 1 file changed, 2 deletions(-)
net/bluetooth/hci_core.c +0 -2
@@ -4964,8 +4964,6 @@ static void hci_acldata_packet(struct hchci_dev_lock (hdev); conn =hci_conn_hash_lookup_handle (hdev, handle); -if (conn &&hci_dev_test_flag (hdev,HCI_MGMT )) -mgmt_device_connected (hdev, conn,NULL ,0 );hci_dev_unlock (hdev);if (conn) {
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.174 release. There are 565 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 Sat, 14 Dec 2024 14:41:35 +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/v5.x/stable-review/patch-5.15.174-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.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
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.174 release. There are 565 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 Sat, 14 Dec 2024 14:41:35 +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/v5.x/stable-review/patch-5.15.174-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.15:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
101 tests: 101 pass, 0 failLinux version: 5.15.174-rc1-g4b281055ccfb
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon