5.7.10-rc1 review
Greg Kroah-Hartman
maintainerPATCH 204/244 intel_th: Fix a NULL dereference when hub driver is not loaded
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit e78e1fdb282726beaf88aa75943682217e6ded0e upstream.
Connecting master to an output port when GTH driver module is not loaded triggers a NULL dereference:
Quoted 5 lines
RIP: 0010:intel_th_set_output+0x35/0x70 [intel_th] Call Trace: ? sth_stm_link+0x12/0x20 [intel_th_sth] stm_source_link_store+0x164/0x270 [stm_core] dev_attr_store+0x17/0x30
Quoted 8 lines
sysfs_kf_write+0x3e/0x50 kernfs_fop_write+0xda/0x1b0 __vfs_write+0x1b/0x40 vfs_write+0xb9/0x1a0 ksys_write+0x67/0xe0 __x64_sys_write+0x1a/0x20 do_syscall_64+0x57/0x1d0 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Make sure the module in question is loaded and return an error if not.
--- drivers/hwtracing/intel_th/core.c | 21 ++++++++++++++++++--- drivers/hwtracing/intel_th/sth.c | 4 +--- 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/hwtracing/intel_th/core.c +18 -3
@@ -1021,15 +1021,30 @@ int intel_th_set_output(struct intel_th_ {struct intel_th_device *hub =to_intel_th_hub (thdev);struct intel_th_driver *hubdrv =to_intel_th_driver (hub->dev.driver); +int ret;/* In host mode, this is up to the external debugger, do nothing. */ if (hub->host_mode)return 0 ; -if (!hubdrv->set_output) -return -ENOTSUPP ; +/* +* hub is instantiated together with the source device that +* calls here, so guaranteed to be present. +*/ + hubdrv =to_intel_th_driver (hub->dev.driver); +if (!hubdrv || !try_module_get (hubdrv->driver.owner)) +return -EINVAL ; -return hubdrv->set_output (hub, master); +if (!hubdrv->set_output) { + ret = -ENOTSUPP ; + goto out; + } + + ret = hubdrv->set_output (hub, master); + +out: +module_put (hubdrv->driver.owner); +return ret; }EXPORT_SYMBOL_GPL (intel_th_set_output);
drivers/hwtracing/intel_th/sth.c +1 -3
@@ -161,9 +161,7 @@ static int sth_stm_link(struct stm_data { struct sth_device *sth = container_of(stm_data, struct sth_device, stm); -intel_th_set_output (to_intel_th_device (sth->dev), master); - -return 0 ; +return intel_th_set_output (to_intel_th_device (sth->dev), master); }static int intel_th_sw_init (struct sth_device *sth)
Greg Kroah-Hartman
maintainerPATCH 178/244 ovl: fix regression with re-formatted lower squashfs
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit a888db310195400f050b89c47673f0f8babfbb41 upstream.
Commit 9df085f3c9a2 ("ovl: relax requirement for non null uuid of lower fs") relaxed the requirement for non null uuid with single lower layer to allow enabling index and nfs_export features with single lower squashfs.
Fabian reported a regression in a setup when overlay re-uses an existing upper layer and re-formats the lower squashfs image. Because squashfs has no uuid, the origin xattr in upper layer are decoded from the new lower layer where they may resolve to a wrong origin file and user may get an ESTALE or EIO error on lookup.
To avoid the reported regression while still allowing the new features with single lower squashfs, do not allow decoding origin with lower null uuid unless user opted-in to one of the new features that require following the lower inode of non-dir upper (index, xino, metacopy).
--- fs/overlayfs/super.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/overlayfs/super.c +12 -0
@@ -1331,6 +1331,18 @@ static bool ovl_lower_uuid_ok(struct ovlif (!ofs->config.nfs_export && !ofs->upper_mnt)return true; +/* +* We allow using single lower with null uuid for index and nfs_export +* for example to support those features with single lower squashfs. +* To avoid regressions in setups of overlay with re-formatted lower +* squashfs, do not allow decoding origin with lower null uuid unless +* user opted-in to one of the new features that require following the +* lower inode of non-dir upper. +*/ +if (!ofs->config.index && !ofs->config.metacopy && !ofs->config.xino && +uuid_is_null (uuid)) +return false; +for (i =0 ; i < ofs->numfs; i++) {/* * We use uuid to associate an overlay lower file handle with a
Greg Kroah-Hartman
maintainerPATCH 177/244 serial: core: fix sysrq overhead regression
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 08d5470308ac3598e7709d08b8979ce6e9de8da2 upstream.
Commit 8e20fc391711 ("serial_core: Move sysrq functions from header file") converted the inline sysrq helpers to exported functions which are now called for every received character, interrupt and break signal also on systems without CONFIG_MAGIC_SYSRQ_SERIAL instead of being optimised away by the compiler.
Inlining these helpers again also avoids the function call overhead when CONFIG_MAGIC_SYSRQ_SERIAL is enabled (e.g. when the port is not used as a console).
--- drivers/tty/serial/serial_core.c | 99 ------------------------------------- include/linux/serial_core.h | 103 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 100 insertions(+), 102 deletions(-)
drivers/tty/serial/serial_core.c +2 -97
@@ -41,8 +41,6 @@ static struct lock_class_key port_lock_k#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) -#define SYSRQ_TIMEOUT (HZ * 5) -static void uart_change_speed (struct tty_struct *tty,struct uart_state *state,struct ktermios *old_termios);static void uart_wait_until_sent (struct tty_struct *tty,int timeout);
@@ -3175,7 +3173,7 @@ static DECLARE_WORK(sysrq_enable_work, u* Returns false if @ch is out of enabling sequence and should be * handled some other way, true if @ch was consumed. */ -static bool uart_try_toggle_sysrq (struct uart_port *port,unsigned int ch) +bool uart_try_toggle_sysrq (struct uart_port *port,unsigned int ch) {int sysrq_toggle_seq_len =strlen (sysrq_toggle_seq);
@@ -3198,102 +3196,9 @@ static bool uart_try_toggle_sysrq(struct port->sysrq =0 ; return true; } -#else -static inline bool uart_try_toggle_sysrq (struct uart_port *port,unsigned int ch) -{ -return false; -} +EXPORT_SYMBOL_GPL (uart_try_toggle_sysrq);#endif -int uart_handle_sysrq_char (struct uart_port *port,unsigned int ch) -{ -if (!IS_ENABLED (CONFIG_MAGIC_SYSRQ_SERIAL )) -return 0 ; - -if (!port->has_sysrq || !port->sysrq) -return 0 ; - -if (ch &&time_before (jiffies, port->sysrq)) { -if (sysrq_mask ()) { -handle_sysrq (ch); - port->sysrq =0 ; -return 1 ; - } -if (uart_try_toggle_sysrq (port, ch)) -return 1 ; - } - port->sysrq =0 ; - -return 0 ; -} -EXPORT_SYMBOL_GPL (uart_handle_sysrq_char); - -int uart_prepare_sysrq_char (struct uart_port *port,unsigned int ch) -{ -if (!IS_ENABLED (CONFIG_MAGIC_SYSRQ_SERIAL )) -return 0 ; - -if (!port->has_sysrq || !port->sysrq) -return 0 ; - -if (ch &&time_before (jiffies, port->sysrq)) { -if (sysrq_mask ()) { - port->sysrq_ch = ch; - port->sysrq =0 ; -return 1 ; - } -if (uart_try_toggle_sysrq (port, ch)) -return 1 ; - } - port->sysrq =0 ; - -return 0 ; -} -EXPORT_SYMBOL_GPL (uart_prepare_sysrq_char); - -void uart_unlock_and_check_sysrq (struct uart_port *port,unsigned long irqflags) -{ -int sysrq_ch; - -if (!port->has_sysrq) { -spin_unlock_irqrestore (&port->lock, irqflags); -return ; - } - - sysrq_ch = port->sysrq_ch; - port->sysrq_ch =0 ; - -spin_unlock_irqrestore (&port->lock, irqflags); - -if (sysrq_ch) -handle_sysrq (sysrq_ch); -} -EXPORT_SYMBOL_GPL (uart_unlock_and_check_sysrq); - -/* -* We do the SysRQ and SAK checking like this... -*/ -int uart_handle_break (struct uart_port *port) -{ -struct uart_state *state = port->state; - -if (port->handle_break) - port->handle_break (port); - -if (port->has_sysrq &&uart_console (port)) { -if (!port->sysrq) { - port->sysrq = jiffies +SYSRQ_TIMEOUT ; -return 1 ; - } - port->sysrq =0 ; - } - -if (port->flags &UPF_SAK ) -do_SAK (state->port.tty); -return 0 ; -} -EXPORT_SYMBOL_GPL (uart_handle_break); -EXPORT_SYMBOL (uart_write_wakeup);EXPORT_SYMBOL (uart_register_driver);EXPORT_SYMBOL (uart_unregister_driver);
include/linux/serial_core.h +98 -5
109 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 179/244 ovl: inode reference leak in ovl_is_inuse true case.
In reply to Greg Kroah-HartmanFrom: youngjun <[email protected]>
commit 24f14009b8f1754ec2ae4c168940c01259b0f88a upstream.
When "ovl_is_inuse" true case, trap inode reference not put. plus adding the comment explaining sequence of ovl_is_inuse after ovl_setup_trap.
--- fs/overlayfs/super.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/overlayfs/super.c +10 -1
@@ -1450,14 +1450,23 @@ static int ovl_get_layers(struct super_bif (err <0 ) goto out; +/* +* Check if lower root conflicts with this overlay layers before +* checking if it is in-use as upperdir/workdir of "another" +* mount, because we do not bother to check in ovl_is_inuse() if +* the upperdir/workdir is in fact in-use by our +* upperdir/workdir. +*/ err =ovl_setup_trap (sb, stack[i].dentry, &trap,"lowerdir" );if (err) goto out;if (ovl_is_inuse (stack[i].dentry)) { err =ovl_report_in_use (ofs,"lowerdir" ); -if (err) +if (err) { +iput (trap); goto out; + } } mnt =clone_private_mount (&stack[i]);
Greg Kroah-Hartman
maintainerPATCH 180/244 ovl: relax WARN_ON() when decoding lower directory file handle
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit 124c2de2c0aee96271e4ddab190083d8aa7aa71a upstream.
Decoding a lower directory file handle to overlay path with cold inode/dentry cache may go as follows:
1. Decode real lower file handle to lower dir path
2. Check if lower dir is indexed (was copied up)
3. If indexed, get the upper dir path from index
4. Lookup upper dir path in overlay
5. If overlay path found, verify that overlay lower is the lower dir from step 1
On failure to verify step 5 above, user will get an ESTALE error and a WARN_ON will be printed.
A mismatch in step 5 could be a result of lower directory that was renamed while overlay was offline, after that lower directory has been copied up and indexed.
This is a scripted reproducer based on xfstest overlay/052:
# Create lower subdir
create_dirs
create_test_files $lower/lowertestdir/subdir
mount_dirs
# Copy up lower dir and encode lower subdir file handle touch $SCRATCH_MNT/lowertestdir
test_file_handles $SCRATCH_MNT/lowertestdir/subdir -p -o $tmp.fhandle # Rename lower dir offline
unmount_dirs
mv $lower/lowertestdir $lower/lowertestdir.new/
mount_dirs
# Attempt to decode lower subdir file handle test_file_handles $SCRATCH_MNT -p -i $tmp.fhandle
Since this WARN_ON() can be triggered by user we need to relax it.
--- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/export.c +1 -1
@@ -478,7 +478,7 @@ static struct dentry *ovl_lookup_real_inif (IS_ERR_OR_NULL (this))return this; -if (WARN_ON (ovl_dentry_real_at (this, layer->idx) != real)) { +if (ovl_dentry_real_at (this, layer->idx) != real) {dput (this); this =ERR_PTR (-EIO ); }
Greg Kroah-Hartman
maintainerPATCH 181/244 ovl: fix unneeded call to ovl_change_flags()
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit 81a33c1ee941c3bb9ffc6bac8f676be13351344e upstream.
The check if user has changed the overlay file was wrong, causing unneeded call to ovl_change_flags() including taking f_lock on every file access.
--- fs/overlayfs/file.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/overlayfs/file.c +6 -4
@@ -32,13 +32,16 @@ static char ovl_whatisit(struct inode *ireturn 'm' ; } +/* No atime modificaton nor notify on underlying */ +#define OVL_OPEN_FLAGS (O_NOATIME | FMODE_NONOTIFY) +static struct file *ovl_open_realfile (const struct file *file,struct inode *realinode) {struct inode *inode =file_inode (file);struct file *realfile;const struct cred *old_cred; -int flags = file->f_flags |O_NOATIME |FMODE_NONOTIFY ; +int flags = file->f_flags |OVL_OPEN_FLAGS ; old_cred =ovl_override_creds (inode->i_sb); realfile = open_with_fake_path(&file->f_path, flags, realinode,
@@ -59,8 +62,7 @@ static int ovl_change_flags(struct filestruct inode *inode =file_inode (file);int err; -/* No atime modificaton on underlying */ - flags |=O_NOATIME |FMODE_NONOTIFY ; + flags |=OVL_OPEN_FLAGS ;/* If some flag changed that cannot be changed then something's amiss */ if (WARN_ON ((file->f_flags ^ flags) & ~OVL_SETFL_MASK ))
@@ -113,7 +115,7 @@ static int ovl_real_fdget_meta(const str }/* Did the flags change since open? */ -if (unlikely ((file->f_flags ^ real->file->f_flags) & ~O_NOATIME )) +if (unlikely ((file->f_flags ^ real->file->f_flags) & ~OVL_OPEN_FLAGS ))return ovl_change_flags (real->file, file->f_flags);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 215/244 arm64: dts: stratix10: increase QSPI reg address in nand dts file
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
commit 3bf9b8ffc8980c1090bdd3a5570cf42420620838 upstream.
Match the QSPI reg address in the socfpga_stratix10_socdk.dts file.
--- arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts +3 -3
@@ -212,12 +212,12 @@ qspi_boot: partition@0 { label = "Boot and fpga data"; - reg = <0x0 0x034B0000>; + reg = <0x0 0x03FE0000>; }; - qspi_rootfs: partition@4000000 { + qspi_rootfs: partition@3FE0000 { label = "Root Filesystem - JFFS2"; - reg = <0x034B0000 0x0EB50000>; + reg = <0x03FE0000 0x0C020000>; }; }; };
Greg Kroah-Hartman
maintainerPATCH 172/244 tty: serial: cpm_uart: Fix behaviour for non existing GPIOs
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 311eab8d5900ea9088513d4c6b4570058958edb5 upstream.
devm_gpiod_get_index() doesn't return NULL but -ENOENT when the requested GPIO doesn't exist, leading to the following messages:
[ 2.742468] gpiod_direction_input: invalid GPIO (errorpointer) [ 2.748147] can't set direction for gpio #2: -2 [ 2.753081] gpiod_direction_input: invalid GPIO (errorpointer) [ 2.758724] can't set direction for gpio #3: -2 [ 2.763666] gpiod_direction_output: invalid GPIO (errorpointer) [ 2.769394] can't set direction for gpio #4: -2 [ 2.774341] gpiod_direction_input: invalid GPIO (errorpointer) [ 2.779981] can't set direction for gpio #5: -2 [ 2.784545] ff000a20.serial: ttyCPM1 at MMIO 0xfff00a20 (irq = 39, base_baud = 8250000) is a CPM UART
Use devm_gpiod_get_index_optional() instead.
At the same time, handle the error case and properly exit with an error.
--- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/tty/serial/cpm_uart/cpm_uart_core.c +8 -1
@@ -1215,7 +1215,12 @@ static int cpm_uart_init_port(struct dev pinfo->gpios[i] =NULL ; - gpiod =devm_gpiod_get_index (dev,NULL , i,GPIOD_ASIS ); + gpiod =devm_gpiod_get_index_optional (dev,NULL , i,GPIOD_ASIS ); + +if (IS_ERR (gpiod)) { + ret =PTR_ERR (gpiod); + goto out_irq; + }if (gpiod) {if (i ==GPIO_RTS || i ==GPIO_DTR )
@@ -1237,6 +1242,8 @@ static int cpm_uart_init_port(struct devreturn cpm_uart_request_port (&pinfo->port); +out_irq: +irq_dispose_mapping (pinfo->port.irq); out_pram:cpm_uart_unmap_pram (pinfo, pram); out_mem:
Greg Kroah-Hartman
maintainerPATCH 206/244 dmaengine: fsl-edma: Fix NULL pointer exception in fsl_edma_tx_handler
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit f5e5677c420346b4e9788051c2e4d750996c428c upstream.
NULL pointer exception happens occasionally on serial output initiated by login timeout. This was reproduced only if kernel was built with significant debugging options and EDMA driver is used with serial console.
col-vf50 login: root
Password:
Login timed out after 60 seconds.
Unable to handle kernel NULL pointer dereference at virtual address 00000044
Internal error: Oops: 5 [#1] ARM
CPU: 0 PID: 157 Comm: login Not tainted 5.7.0-next-20200610-dirty #4
Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
(fsl_edma_tx_handler) from [<8016eb10>] (__handle_irq_event_percpu+0x64/0x304)
(__handle_irq_event_percpu) from [<8016eddc>] (handle_irq_event_percpu+0x2c/0x7c)
(handle_irq_event_percpu) from [<8016ee64>] (handle_irq_event+0x38/0x5c)
(handle_irq_event) from [<801729e4>] (handle_fasteoi_irq+0xa4/0x160)
(handle_fasteoi_irq) from [<8016ddcc>] (generic_handle_irq+0x34/0x44)
(generic_handle_irq) from [<8016e40c>] (__handle_domain_irq+0x54/0xa8)
(__handle_domain_irq) from [<80508bc8>] (gic_handle_irq+0x4c/0x80)
(gic_handle_irq) from [<80100af0>] (__irq_svc+0x70/0x98)
Exception stack(0x8459fe80 to 0x8459fec8)
fe80: 72286b00 e3359f64 00000001 0000412d a0070013 85c98840 85c98840 a0070013
fea0: 8054e0d4 00000000 00000002 00000000 00000002 8459fed0 8081fbe8 8081fbec
fec0: 60070013 ffffffff
(__irq_svc) from [<8081fbec>] (_raw_spin_unlock_irqrestore+0x30/0x58)
(_raw_spin_unlock_irqrestore) from [<8056cb48>] (uart_flush_buffer+0x88/0xf8)
(uart_flush_buffer) from [<80554e60>] (tty_ldisc_hangup+0x38/0x1ac)
(tty_ldisc_hangup) from [<8054c7f4>] (__tty_hangup+0x158/0x2bc)
(__tty_hangup) from [<80557b90>] (disassociate_ctty.part.1+0x30/0x23c)
(disassociate_ctty.part.1) from [<8011fc18>] (do_exit+0x580/0xba0)
(do_exit) from [<801214f8>] (do_group_exit+0x3c/0xb4)
(do_group_exit) from [<80121580>] (__wake_up_parent+0x0/0x14)Issue looks like race condition between interrupt handler fsl_edma_tx_handler() (called as result of fsl_edma_xfer_desc()) and terminating the transfer with fsl_edma_terminate_all().
The fsl_edma_tx_handler() handles interrupt for a transfer with already freed edesc and idle==true.
--- drivers/dma/fsl-edma.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/dma/fsl-edma.c +7 -0
@@ -45,6 +45,13 @@ static irqreturn_t fsl_edma_tx_handler(i fsl_chan = &fsl_edma->chans[ch];spin_lock (&fsl_chan->vchan.lock); + +if (!fsl_chan->edesc) { +/* terminate_all called before */ +spin_unlock (&fsl_chan->vchan.lock); +continue ; + } +if (!fsl_chan->edesc->iscyclic) {list_del (&fsl_chan->edesc->vdesc.node);vchan_cookie_complete (&fsl_chan->edesc->vdesc);
Greg Kroah-Hartman
maintainerPATCH 216/244 arm64: ptrace: Override SPSR.SS when single-stepping is enabled
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 3a5a4366cecc25daa300b9a9174f7fdd352b9068 upstream.
Luis reports that, when reverse debugging with GDB, single-step does not function as expected on arm64:
| I've noticed, under very specific conditions, that a PTRACE_SINGLESTEP | request by GDB won't execute the underlying instruction. As a consequence, | the PC doesn't move, but we return a SIGTRAP just like we would for a | regular successful PTRACE_SINGLESTEP request.
The underlying problem is that when the CPU register state is restored as part of a reverse step, the SPSR.SS bit is cleared and so the hardware single-step state can transition to the "active-pending" state, causing an unexpected step exception to be taken immediately if a step operation is attempted.
In hindsight, we probably shouldn't have exposed SPSR.SS in the pstate accessible by the GPR regset, but it's a bit late for that now. Instead, simply prevent userspace from configuring the bit to a value which is inconsistent with the TIF_SINGLESTEP state for the task being traced.
--- arch/arm64/include/asm/debug-monitors.h | 2 ++ arch/arm64/kernel/debug-monitors.c | 20 ++++++++++++++++---- arch/arm64/kernel/ptrace.c | 4 ++-- 3 files changed, 20 insertions(+), 6 deletions(-)
arch/arm64/include/asm/debug-monitors.h +2 -0
@@ -109,6 +109,8 @@ void disable_debug_monitors(enum dbg_actvoid user_rewind_single_step (struct task_struct *task);void user_fastforward_single_step (struct task_struct *task); +void user_regs_reset_single_step (struct user_pt_regs *regs, +struct task_struct *task);void kernel_enable_single_step (struct pt_regs *regs);void kernel_disable_single_step (void );
arch/arm64/kernel/debug-monitors.c +16 -4
@@ -141,17 +141,20 @@ postcore_initcall(debug_monitors_init);/* * Single step API and exception handling. */ -static void set_regs_spsr_ss (struct pt_regs *regs) +static void set_user_regs_spsr_ss (struct user_pt_regs *regs) { regs->pstate |=DBG_SPSR_SS ; } -NOKPROBE_SYMBOL (set_regs_spsr_ss); +NOKPROBE_SYMBOL (set_user_regs_spsr_ss); -static void clear_regs_spsr_ss (struct pt_regs *regs) +static void clear_user_regs_spsr_ss (struct user_pt_regs *regs) { regs->pstate &= ~DBG_SPSR_SS ; } -NOKPROBE_SYMBOL (clear_regs_spsr_ss); +NOKPROBE_SYMBOL (clear_user_regs_spsr_ss); + +#define set_regs_spsr_ss (r) set_user_regs_spsr_ss(&(r)->user_regs) +#define clear_regs_spsr_ss (r) clear_user_regs_spsr_ss(&(r)->user_regs)static DEFINE_SPINLOCK (debug_hook_lock);static LIST_HEAD (user_step_hook);
@@ -404,6 +407,15 @@ void user_fastforward_single_step(structclear_regs_spsr_ss (task_pt_regs (task)); } +void user_regs_reset_single_step (struct user_pt_regs *regs, +struct task_struct *task) +{ +if (test_tsk_thread_flag (task,TIF_SINGLESTEP )) +set_user_regs_spsr_ss (regs); +else +clear_user_regs_spsr_ss (regs); +} +/* Kernel API */ void kernel_enable_single_step (struct pt_regs *regs) {
arch/arm64/kernel/ptrace.c +2 -2
@@ -1935,8 +1935,8 @@ static int valid_native_regs(struct user*/ int valid_user_regs (struct user_pt_regs *regs,struct task_struct *task) { -if (!test_tsk_thread_flag (task,TIF_SINGLESTEP )) - regs->pstate &= ~DBG_SPSR_SS ; +/* https://lore.kernel.org/lkml/20191118131525.GA4180@willie-the-truck */ +user_regs_reset_single_step (regs, task);if (is_compat_thread (task_thread_info (task)))return valid_compat_regs (regs);
Greg Kroah-Hartman
maintainerPATCH 218/244 arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 15956689a0e60aa0c795174f3c310b60d8794235 upstream.
Although we zero the upper bits of x0 on entry to the kernel from an AArch32 task, we do not clear them on the exception return path and can therefore expose 64-bit sign extended syscall return values to userspace via interfaces such as the 'perf_regs' ABI, which deal exclusively with 64-bit registers.
Explicitly clear the upper 32 bits of x0 on return from a compat system call.
--- arch/arm64/include/asm/syscall.h | 12 +++++++++++- arch/arm64/kernel/syscall.c | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-)
arch/arm64/include/asm/syscall.h +11 -1
@@ -34,6 +34,10 @@ static inline long syscall_get_error(str struct pt_regs *regs) {unsigned long error = regs->regs[0 ]; + +if (is_compat_thread (task_thread_info (task))) + error =sign_extend64 (error,31 ); +return IS_ERR_VALUE (error) ? error :0 ; }
@@ -47,7 +51,13 @@ static inline void syscall_set_return_vastruct pt_regs *regs, int error, long val) { - regs->regs[0] = (long) error ? error : val; + if (error) + val = error; + +if (is_compat_thread (task_thread_info (task))) + val =lower_32_bits (val); + + regs->regs[0 ] = val; }#define SYSCALL_MAX_ARGS 6
arch/arm64/kernel/syscall.c +3 -0
@@ -50,6 +50,9 @@ static void invoke_syscall(struct pt_reg ret =do_ni_syscall (regs, scno); } +if (is_compat_task ()) + ret =lower_32_bits (ret); + regs->regs[0 ] = ret; }
Greg Kroah-Hartman
maintainerPATCH 219/244 sched: Fix unreliable rseq cpu_id for new tasks
In reply to Greg Kroah-HartmanFrom: Mathieu Desnoyers <[email protected]>
commit ce3614daabea8a2d01c1dd17ae41d1ec5e5ae7db upstream.
While integrating rseq into glibc and replacing glibc's sched_getcpu implementation with rseq, glibc's tests discovered an issue with incorrect __rseq_abi.cpu_id field value right after the first time a newly created process issues sched_setaffinity.
For the records, it triggers after building glibc and running tests, and then issuing:
for x in {1..2000} ; do posix/tst-affinity-static & done
and shows up as:
error: Unexpected CPU 2, expected 0
error: Unexpected CPU 2, expected 0
error: Unexpected CPU 2, expected 0
error: Unexpected CPU 2, expected 0
error: Unexpected CPU 138, expected 0
error: Unexpected CPU 138, expected 0
error: Unexpected CPU 138, expected 0
error: Unexpected CPU 138, expected 0
This is caused by the scheduler invoking __set_task_cpu() directly from sched_fork() and wake_up_new_task(), thus bypassing rseq_migrate() which is done by set_task_cpu().
Add the missing rseq_migrate() to both functions. The only other direct use of __set_task_cpu() is done by init_idle(), which does not involve a user-space task.
Based on my testing with the glibc test-case, just adding rseq_migrate() to wake_up_new_task() is sufficient to fix the observed issue. Also add it to sched_fork() to keep things consistent.
The reason why this never triggered so far with the rseq/basic_test selftest is unclear.
The current use of sched_getcpu(3) does not typically require it to be always accurate. However, use of the __rseq_abi.cpu_id field within rseq critical sections requires it to be accurate. If it is not accurate, it can cause corruption in the per-cpu data targeted by rseq critical sections in user-space.
--- kernel/sched/core.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sched/core.c +2 -0
@@ -2876,6 +2876,7 @@ int sched_fork(unsigned long clone_flags* Silence PROVE_RCU. */ raw_spin_lock_irqsave (&p->pi_lock, flags); +rseq_migrate (p);/* * We're setting the CPU for the first time, we don't migrate, * so use __set_task_cpu().
@@ -2940,6 +2941,7 @@ void wake_up_new_task(struct task_struct* as we're not fully set-up yet. */ p->recent_used_cpu =task_cpu (p); +rseq_migrate (p);__set_task_cpu (p,select_task_rq (p,task_cpu (p),SD_BALANCE_FORK ,0 ));#endif rq =__task_rq_lock (p, &rf);
Greg Kroah-Hartman
maintainerPATCH 220/244 sched/fair: handle case of task_h_load() returning 0
In reply to Greg Kroah-HartmanFrom: Vincent Guittot <[email protected]>
commit 01cfcde9c26d8555f0e6e9aea9d6049f87683998 upstream.
task_h_load() can return 0 in some situations like running stress-ng mmapfork, which forks thousands of threads, in a sched group on a 224 cores system. The load balance doesn't handle this correctly because env->imbalance never decreases and it will stop pulling tasks only after reaching loop_max, which can be equal to the number of running tasks of the cfs. Make sure that imbalance will be decreased by at least 1.
misfit task is the other feature that doesn't handle correctly such situation although it's probably more difficult to face the problem because of the smaller number of CPUs and running tasks on heterogenous system.
We can't simply ensure that task_h_load() returns at least one because it would imply to handle underflow in other places.
--- kernel/sched/fair.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
kernel/sched/fair.c +13 -2
@@ -4033,7 +4033,11 @@ static inline void update_misfit_status( return; } - rq->misfit_task_load =task_h_load (p); +/* +* Make sure that misfit_task_load will not be null even if +* task_h_load() returns 0. +*/ + rq->misfit_task_load = max_t(unsigned long, task_h_load(p), 1); }#else /* CONFIG_SMP */
@@ -7633,7 +7637,14 @@ static int detach_tasks(struct lb_env *eswitch (env->migration_type) {case migrate_load: - load =task_h_load (p); +/* +* Depending of the number of CPUs and tasks and the +* cgroup hierarchy, task_h_load() can return a null +* value. Make sure that env->imbalance decreases +* otherwise detach_tasks() will stop only after +* detaching up to loop_max tasks. +*/ + load = max_t(unsigned long, task_h_load(p), 1);if (sched_feat (LB_MIN ) && load <16 && !env->sd->nr_balance_failed)
Greg Kroah-Hartman
maintainerPATCH 222/244 genirq/affinity: Handle affinity setting on inactive interrupts correctly
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit baedb87d1b53532f81b4bd0387f83b05d4f7eb9a upstream.
Setting interrupt affinity on inactive interrupts is inconsistent when hierarchical irq domains are enabled. The core code should just store the affinity and not call into the irq chip driver for inactive interrupts because the chip drivers may not be in a state to handle such requests.
X86 has a hacky workaround for that but all other irq chips have not which causes problems e.g. on GIC V3 ITS.
Instead of adding more ugly hacks all over the place, solve the problem in the core code. If the affinity is set on an inactive interrupt then:
- Store it in the irq descriptors affinity mask
- Update the effective affinity to reflect that so user space has a consistent view
- Don't call into the irq chip driver
This is the core equivalent of the X86 workaround and works correctly because the affinity setting is established in the irq chip when the interrupt is activated later on.
Note, that this is only effective when hierarchical irq domains are enabled by the architecture. Doing it unconditionally would break legacy irq chip implementations.
For hierarchial irq domains this works correctly as none of the drivers can have a dependency on affinity setting in inactive state by design.
Remove the X86 workaround as it is not longer required.
--- arch/x86/kernel/apic/vector.c | 22 +++++----------------- kernel/irq/manage.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 19 deletions(-)
arch/x86/kernel/apic/vector.c +5 -17
@@ -446,12 +446,10 @@ static int x86_vector_activate(struct irtrace_vector_activate (irqd->irq, apicd->is_managed, apicd->can_reserve, reserve); -/* Nothing to do for fixed assigned vectors */ -if (!apicd->can_reserve && !apicd->is_managed) -return 0 ; -raw_spin_lock_irqsave (&vector_lock, flags); -if (reserve ||irqd_is_managed_and_shutdown (irqd)) +if (!apicd->can_reserve && !apicd->is_managed) +assign_irq_vector_any_locked (irqd); +else if (reserve ||irqd_is_managed_and_shutdown (irqd))vector_assign_managed_shutdown (irqd);else if (apicd->is_managed) ret =activate_managed (irqd);
@@ -775,20 +773,10 @@ void lapic_offline(void)static int apic_set_affinity (struct irq_data *irqd,const struct cpumask *dest,bool force) { -struct apic_chip_data *apicd =apic_chip_data (irqd);int err; -/* -* Core code can call here for inactive interrupts. For inactive -* interrupts which use managed or reservation mode there is no -* point in going through the vector assignment right now as the -* activation will assign a vector which fits the destination -* cpumask. Let the core code store the destination mask and be -* done with it. -*/ -if (!irqd_is_activated (irqd) && - (apicd->is_managed || apicd->can_reserve)) -return IRQ_SET_MASK_OK ; +if (WARN_ON_ONCE (!irqd_is_activated (irqd))) +return -EIO ;raw_spin_lock (&vector_lock);cpumask_and (vector_searchmask, dest, cpu_online_mask);
kernel/irq/manage.c +35 -2
@@ -195,9 +195,9 @@ void irq_set_thread_affinity(struct irq_set_bit (IRQTF_AFFINITY , &action->thread_flags); } +#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK static void irq_validate_effective_affinity (struct irq_data *data) { -#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK const struct cpumask *m =irq_data_get_effective_affinity_mask (data);struct irq_chip *chip =irq_data_get_irq_chip (data);
@@ -205,9 +205,19 @@ static void irq_validate_effective_affinreturn ;pr_warn_once ("irq_chip %s did not update eff. affinity mask of irq %u\n" , chip->name, data->irq); -#endif } +static inline void irq_init_effective_affinity (struct irq_data *data, +const struct cpumask *mask) +{ +cpumask_copy (irq_data_get_effective_affinity_mask (data), mask); +} +#else +static inline void irq_validate_effective_affinity (struct irq_data *data) { } +static inline void irq_init_effective_affinity (struct irq_data *data, +const struct cpumask *mask) { } +#endif +int irq_do_set_affinity (struct irq_data *data,const struct cpumask *mask,bool force) {
@@ -304,6 +314,26 @@ static int irq_try_set_affinity(struct ireturn ret; } +static bool irq_set_affinity_deactivated (struct irq_data *data, +const struct cpumask *mask,bool force) +{ +struct irq_desc *desc =irq_data_to_desc (data); + +/* +* If the interrupt is not yet activated, just store the affinity +* mask and do not call the chip driver at all. On activation the +* driver has to make sure anyway that the interrupt is in a +* useable state so startup works. +*/ +if (!IS_ENABLED (CONFIG_IRQ_DOMAIN_HIERARCHY ) ||irqd_is_activated (data)) +return false; + +cpumask_copy (desc->irq_common_data.affinity, mask); +irq_init_effective_affinity (data, mask); +irqd_set (data,IRQD_AFFINITY_SET ); +return true; +} +int irq_set_affinity_locked (struct irq_data *data,const struct cpumask *mask,bool force) {
@@ -314,6 +344,9 @@ int irq_set_affinity_locked(struct irq_dif (!chip || !chip->irq_set_affinity)return -EINVAL ; +if (irq_set_affinity_deactivated (data, mask, force)) +return 0 ; +if (irq_can_move_pcntxt (data) && !irqd_is_setaffinity_pending (data)) { ret =irq_try_set_affinity (data, mask, force); }else {
Greg Kroah-Hartman
maintainerPATCH 221/244 x86/ioperm: Fix io bitmap invalidation on Xen PV
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit cadfad870154e14f745ec845708bc17d166065f2 upstream.
tss_invalidate_io_bitmap() wasn't wired up properly through the pvop machinery, so the TSS and Xen's io bitmap would get out of sync whenever disabling a valid io bitmap.
Add a new pvop for tss_invalidate_io_bitmap() to fix it.
This is XSA-329.
--- arch/x86/include/asm/io_bitmap.h | 16 ++++++++++++++++ arch/x86/include/asm/paravirt.h | 5 +++++ arch/x86/include/asm/paravirt_types.h | 1 + arch/x86/kernel/paravirt.c | 3 ++- arch/x86/kernel/process.c | 18 ++---------------- arch/x86/xen/enlighten_pv.c | 12 ++++++++++++ 6 files changed, 38 insertions(+), 17 deletions(-)
arch/x86/include/asm/io_bitmap.h +16 -0
@@ -19,12 +19,28 @@ struct task_struct;void io_bitmap_share (struct task_struct *tsk);void io_bitmap_exit (struct task_struct *tsk); +static inline void native_tss_invalidate_io_bitmap (void ) +{ +/* +* Invalidate the I/O bitmap by moving io_bitmap_base outside the +* TSS limit so any subsequent I/O access from user space will +* trigger a #GP. +* +* This is correct even when VMEXIT rewrites the TSS limit +* to 0x67 as the only requirement is that the base points +* outside the limit. +*/ +this_cpu_write (cpu_tss_rw.x86_tss.io_bitmap_base, +IO_BITMAP_OFFSET_INVALID ); +} +void native_tss_update_io_bitmap (void );#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else #define tss_update_io_bitmap native_tss_update_io_bitmap +#define tss_invalidate_io_bitmap native_tss_invalidate_io_bitmap#endif #else
arch/x86/include/asm/paravirt.h +5 -0
@@ -296,6 +296,11 @@ static inline void write_idt_entry(gate_ }#ifdef CONFIG_X86_IOPL_IOPERM +static inline void tss_invalidate_io_bitmap (void ) +{ +PVOP_VCALL0 (cpu.invalidate_io_bitmap); +} +static inline void tss_update_io_bitmap (void ) {PVOP_VCALL0 (cpu.update_io_bitmap);
arch/x86/include/asm/paravirt_types.h +1 -0
@@ -141,6 +141,7 @@ struct pv_cpu_ops {void (*load_sp0)(unsigned long sp0);#ifdef CONFIG_X86_IOPL_IOPERM +void (*invalidate_io_bitmap)(void );void (*update_io_bitmap)(void );#endif
arch/x86/kernel/paravirt.c +2 -1
@@ -343,7 +343,8 @@ struct paravirt_patch_template pv_ops = .cpu.swapgs = native_swapgs, #ifdef CONFIG_X86_IOPL_IOPERM - .cpu.update_io_bitmap = native_tss_update_io_bitmap, + .cpu.invalidate_io_bitmap = native_tss_invalidate_io_bitmap, + .cpu.update_io_bitmap = native_tss_update_io_bitmap, #endif .cpu.start_context_switch = paravirt_nop,
arch/x86/kernel/process.c +2 -16
@@ -322,20 +322,6 @@ void arch_setup_new_exec(void) }#ifdef CONFIG_X86_IOPL_IOPERM -static inline void tss_invalidate_io_bitmap (struct tss_struct *tss) -{ -/* -* Invalidate the I/O bitmap by moving io_bitmap_base outside the -* TSS limit so any subsequent I/O access from user space will -* trigger a #GP. -* -* This is correct even when VMEXIT rewrites the TSS limit -* to 0x67 as the only requirement is that the base points -* outside the limit. -*/ - tss->x86_tss.io_bitmap_base =IO_BITMAP_OFFSET_INVALID ; -} -static inline void switch_to_bitmap (unsigned long tifp) {/*
@@ -346,7 +332,7 @@ static inline void switch_to_bitmap(unsi* user mode. */ if (tifp & _TIF_IO_BITMAP) -tss_invalidate_io_bitmap (this_cpu_ptr (&cpu_tss_rw)); +tss_invalidate_io_bitmap (); }static void tss_copy_io_bitmap (struct tss_struct *tss,struct io_bitmap *iobm)
@@ -380,7 +366,7 @@ void native_tss_update_io_bitmap(void)u16 *base = &tss->x86_tss.io_bitmap_base;if (!test_thread_flag (TIF_IO_BITMAP )) { -tss_invalidate_io_bitmap (tss); +native_tss_invalidate_io_bitmap ();return ; }
arch/x86/xen/enlighten_pv.c +12 -0
@@ -841,6 +841,17 @@ static void xen_load_sp0(unsigned long s }#ifdef CONFIG_X86_IOPL_IOPERM +static void xen_invalidate_io_bitmap (void ) +{ +struct physdev_set_iobitmap iobitmap = { + .bitmap =0 , + .nr_ports =0 , + }; + +native_tss_invalidate_io_bitmap (); +HYPERVISOR_physdev_op (PHYSDEVOP_set_iobitmap, &iobitmap); +} +static void xen_update_io_bitmap (void ) {struct physdev_set_iobitmap iobitmap;
@@ -1070,6 +1081,7 @@ static const struct pv_cpu_ops xen_cpu_o .load_sp0 = xen_load_sp0, #ifdef CONFIG_X86_IOPL_IOPERM + .invalidate_io_bitmap = xen_invalidate_io_bitmap, .update_io_bitmap = xen_update_io_bitmap, #endif .io_delay = xen_io_delay,
Greg Kroah-Hartman
maintainerPATCH 207/244 dmaengine: mcf-edma: Fix NULL pointer exception in mcf_edma_tx_handler
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 8995aa3d164ddd9200e6abcf25c449cf5298c858 upstream.
On Toradex Colibri VF50 (Vybrid VF5xx) with fsl-edma driver NULL pointer exception happens occasionally on serial output initiated by login timeout.
This was reproduced only if kernel was built with significant debugging options and EDMA driver is used with serial console.
Issue looks like a race condition between interrupt handler fsl_edma_tx_handler() (called as a result of fsl_edma_xfer_desc()) and terminating the transfer with fsl_edma_terminate_all().
The fsl_edma_tx_handler() handles interrupt for a transfer with already freed edesc and idle==true.
The mcf-edma driver shares design and lot of code with fsl-edma. It looks like being affected by same problem. Fix this pattern the same way as fix for fsl-edma driver.
--- drivers/dma/mcf-edma.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/dma/mcf-edma.c +7 -0
@@ -35,6 +35,13 @@ static irqreturn_t mcf_edma_tx_handler(i mcf_chan = &mcf_edma->chans[ch];spin_lock (&mcf_chan->vchan.lock); + +if (!mcf_chan->edesc) { +/* terminate_all called before */ +spin_unlock (&mcf_chan->vchan.lock); +continue ; + } +if (!mcf_chan->edesc->iscyclic) {list_del (&mcf_chan->edesc->vdesc.node);vchan_cookie_complete (&mcf_chan->edesc->vdesc);
Greg Kroah-Hartman
maintainerPATCH 224/244 drm/amdgpu/powerplay: Modify SMC message name for setting power profile mode
In reply to Greg Kroah-HartmanFrom: chen gong <[email protected]>
commit 98a34cf931e848f8489d3fb15a8f5fc03802ad65 upstream.
I consulted Cai Land([email protected]), he told me corresponding smc message name to fSMC_MSG_SetWorkloadMask() is "PPSMC_MSG_ActiveProcessNotify" in firmware code of Renoir.
Strange though it may seem, but it's a fact.
--- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +1 -1
@@ -687,7 +687,7 @@ static int renoir_set_power_profile_modereturn -EINVAL ; } - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask, + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_ActiveProcessNotify,1 << workload_type,NULL );if (ret) {
Greg Kroah-Hartman
maintainerPATCH 226/244 drm/amd/display: handle failed allocation during stream construction
In reply to Greg Kroah-HartmanFrom: Josip Pavic <[email protected]>
commit be73e608ae2711dc8a1ab8b9549d9e348061b2ee upstream.
[Why]
Failing to allocate a transfer function during stream construction leads to a null pointer dereference
[How]
Handle the failed allocation by failing the stream construction
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +16 -3
@@ -56,7 +56,7 @@ void update_stream_signal(struct dc_stre } } -static void dc_stream_construct (struct dc_stream_state *stream, +static bool dc_stream_construct (struct dc_stream_state *stream,struct dc_sink *dc_sink_data) {uint32_t i =0 ;
@@ -118,11 +118,17 @@ static void dc_stream_construct(struct dupdate_stream_signal (stream, dc_sink_data); stream->out_transfer_func =dc_create_transfer_func (); +if (stream->out_transfer_func ==NULL ) { +dc_sink_release (dc_sink_data); +return false; + } stream->out_transfer_func->type =TF_TYPE_BYPASS ; stream->out_transfer_func->ctx = stream->ctx; stream->stream_id = stream->ctx->dc_stream_id_count; stream->ctx->dc_stream_id_count++; + +return true; }static void dc_stream_destruct (struct dc_stream_state *stream)
@@ -164,13 +170,20 @@ struct dc_stream_state *dc_create_stream stream =kzalloc (sizeof (struct dc_stream_state ),GFP_KERNEL );if (stream ==NULL ) -return NULL ; + goto alloc_fail; -dc_stream_construct (stream, sink); +if (dc_stream_construct (stream, sink) == false) + goto construct_fail;kref_init (&stream->refcount);return stream; + +construct_fail: +kfree (stream); + +alloc_fail: +return NULL ; }struct dc_stream_state *dc_copy_stream (const struct dc_stream_state *stream)
Greg Kroah-Hartman
maintainerPATCH 227/244 drm/amd/display: OLED panel backlight adjust not work with external display connected
In reply to Greg Kroah-HartmanFrom: hersen wu <[email protected]>
commit b448d30b0c303d5454ea572b772d1ffae96bc6e7 upstream.
[Why]amdgpu_dm->backlight_caps is for single eDP only. the caps are upddated for very connector. Real eDP caps will be overwritten by other external display. For OLED panel, caps->aux_support is set to 1 for OLED pnael. after external connected, caps+.aux_support is set to 0. This causes OLED backlight adjustment not work.
[How]
within update_conector_ext_caps, backlight caps will be updated only for eDP connector.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
@@ -1804,6 +1804,7 @@ static void update_connector_ext_caps(ststruct amdgpu_display_manager *dm;struct drm_connector *conn_base;struct amdgpu_device *adev; +struct dc_link *link =NULL ;static const u8 pre_computed_values[] = {50 ,51 ,52 ,53 ,55 ,56 ,57 ,58 ,59 ,61 ,62 ,63 ,65 ,66 ,68 ,69 ,71 ,72 ,74 ,75 ,77 ,79 ,81 ,82 ,84 ,86 ,88 ,90 ,92 ,94 ,96 ,98 };
@@ -1811,6 +1812,10 @@ static void update_connector_ext_caps(stif (!aconnector || !aconnector->dc_link)return ; + link = aconnector->dc_link; +if (link->connector_signal !=SIGNAL_TYPE_EDP ) +return ; + conn_base = &aconnector->base; adev = conn_base->dev->dev_private; dm = &adev->dm;
Greg Kroah-Hartman
maintainerPATCH 228/244 drm/amdgpu/display: create fake mst encoders ahead of time (v4)
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 3168470142e0a82b5732c04ed4c031a9322ae170 upstream.
Prevents a warning in the MST create connector case.
v2: create global fake encoders rather per connector fake encoders to avoid running out of encoder indices.
v3: use the actual number of crtcs on the asic rather than the max to conserve encoders.
v4: v3 plus missing hunk I forgot to git add.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 11 ++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 57 +++++------- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h | 3 4 files changed, 50 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -0
@@ -956,6 +956,9 @@ static int amdgpu_dm_init(struct amdgpu_/* Update the actual used number of crtc */ adev->mode_info.num_crtc = adev->dm.display_indexes_num; +/* create fake encoders for MST */ +dm_dp_create_fake_mst_encoders (adev); +/* TODO: Add_display_info? */ /* TODO use dynamic cursor width */
@@ -979,6 +982,12 @@ error:static void amdgpu_dm_fini (struct amdgpu_device *adev) { +int i; + +for (i =0 ; i < adev->dm.display_indexes_num; i++) { +drm_encoder_cleanup (&adev->dm.mst_encoders[i].base); + } +amdgpu_dm_audio_fini (adev);amdgpu_dm_destroy_drm_device (&adev->dm);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +10 -1
@@ -43,6 +43,9 @@*/ #define AMDGPU_DM_MAX_DISPLAY_INDEX 31 + +#define AMDGPU_DM_MAX_CRTC 6 +/* #include "include/amdgpu_dal_power_if.h" #include "amdgpu_dm_irq.h"
@@ -327,6 +330,13 @@ struct amdgpu_display_manager {* available in FW */ const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; + +/** +* @mst_encoders: +* +* fake encoders used for DP MST. +*/ +struct amdgpu_encoder mst_encoders[AMDGPU_DM_MAX_CRTC ]; };struct amdgpu_dm_connector {
@@ -355,7 +365,6 @@ struct amdgpu_dm_connector {struct amdgpu_dm_dp_aux dm_dp_aux;struct drm_dp_mst_port *port;struct amdgpu_dm_connector *mst_port; -struct amdgpu_encoder *mst_encoder;struct drm_dp_aux *dsc_aux;/* TODO see if we can merge with ddc_bus or make a dm_connector */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +28 -29
94 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +3 -0
@@ -35,6 +35,9 @@ void amdgpu_dm_initialize_dp_connector(sstruct amdgpu_dm_connector *aconnector, int link_index); +void +dm_dp_create_fake_mst_encoders (struct amdgpu_device *adev); +#if defined(CONFIG_DRM_AMD_DC_DCN )bool compute_mst_dsc_configs_for_state (struct drm_atomic_state *state,struct dc_state *dc_state);
Greg Kroah-Hartman
maintainerPATCH 230/244 drm/i915/gt: Ignore irq enabling on the virtual engines
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 858f1299fd6f7518ddef19ddd304c8398ac79fa5 upstream.
We do not use the virtual engines for interrupts (they have physical components), but we do use them to decouple the fence signaling during submission. Currently, when we submit a completed request, we try to enable the interrupt handler for the virtual engine, but we never disarm it. A quick fix is then to mark the irq as enabled, and it will then remain enabled -- and this prevents us from waking the device and never letting it sleep again.
--- drivers/gpu/drm/i915/gt/intel_lrc.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
@@ -5188,6 +5188,7 @@ intel_execlists_create_virtual(struct inintel_engine_init_active (&ve->base,ENGINE_VIRTUAL );intel_engine_init_breadcrumbs (&ve->base);intel_engine_init_execlists (&ve->base); + ve->base.breadcrumbs.irq_armed = true;/* fake HW, used for irq_work */ ve->base.cops = &virtual_context_ops; ve->base.request_alloc = execlists_request_alloc;
Greg Kroah-Hartman
maintainerPATCH 231/244 drm/i915/gt: Only swap to a random sibling once upon creation
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 110f9efa858f584c6bed177cd48d0c0f526940e1 upstream.
The danger in switching at random upon intel_context_pin is that the context may still actually be inflight, as it will not be scheduled out until a context switch after it is complete -- that may be a long time after we do a final intel_context_unpin.
--- drivers/gpu/drm/i915/gt/intel_lrc.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +4 -14
@@ -4897,13 +4897,8 @@ static void virtual_engine_initial_hint(* typically be the first we inspect for submission. */ swp =prandom_u32_max (ve->num_siblings); -if (!swp) -return ; - -swap (ve->siblings[swp], ve->siblings[0 ]); -if (!intel_engine_has_relative_mmio (ve->siblings[0 ])) -virtual_update_register_offsets (ve->context.lrc_reg_state, - ve->siblings[0 ]); +if (swp) +swap (ve->siblings[swp], ve->siblings[0 ]); }static int virtual_context_alloc (struct intel_context *ce)
@@ -4916,15 +4911,9 @@ static int virtual_context_alloc(structstatic int virtual_context_pin (struct intel_context *ce) {struct virtual_engine *ve =container_of (ce,typeof (*ve), context); -int err;/* Note: we must use a real engine class for setting up reg state */ - err =__execlists_context_pin (ce, ve->siblings[0 ]); -if (err) -return err; - -virtual_engine_initial_hint (ve); -return 0 ; +return __execlists_context_pin (ce, ve->siblings[0 ]); }static void virtual_context_enter (struct intel_context *ce)
@@ -5270,6 +5259,7 @@ intel_execlists_create_virtual(struct in ve->base.flags |=I915_ENGINE_IS_VIRTUAL ; +virtual_engine_initial_hint (ve);return &ve->context; err_put:
Greg Kroah-Hartman
maintainerPATCH 232/244 libceph: dont omit recovery_deletes in target_copy()
In reply to Greg Kroah-HartmanFrom: Ilya Dryomov <[email protected]>
commit 2f3fead62144002557f322c2a7c15e1255df0653 upstream.
Currently target_copy() is used only for sending linger pings, so this doesn't come up, but generally omitting recovery_deletes can result in unneeded resends (force_resend in calc_target()).
--- net/ceph/osd_client.c | 1 + 1 file changed, 1 insertion(+)
net/ceph/osd_client.c +1 -0
@@ -445,6 +445,7 @@ static void target_copy(struct ceph_osd_ dest->size = src->size; dest->min_size = src->min_size; dest->sort_bitwise = src->sort_bitwise; + dest->recovery_deletes = src->recovery_deletes; dest->flags = src->flags; dest->paused = src->paused;
Greg Kroah-Hartman
maintainerPATCH 233/244 RISC-V: Acquire mmap lock before invoking walk_page_range
In reply to Greg Kroah-HartmanFrom: Atish Patra <[email protected]>
commit 0e2c09011d4de4161f615ff860a605a9186cf62a upstream.
As per walk_page_range documentation, mmap lock should be acquired by the caller before invoking walk_page_range. mmap_assert_locked gets triggered without that. The details can be found here.
http://lists.infradead.org/pipermail/linux-riscv/2020-June/010335.html
--- arch/riscv/mm/pageattr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
arch/riscv/mm/pageattr.c +12 -2
@@ -151,6 +151,7 @@ int set_memory_nx(unsigned long addr, inint set_direct_map_invalid_noflush (struct page *page) { +int ret;unsigned long start = (unsigned long )page_address (page);unsigned long end = start +PAGE_SIZE ;struct pageattr_masks masks = {
@@ -158,11 +159,16 @@ int set_direct_map_invalid_noflush(struc .clear_mask = __pgprot(_PAGE_PRESENT) }; -return walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_lock (&init_mm); + ret =walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_unlock (&init_mm); + +return ret; }int set_direct_map_default_noflush (struct page *page) { +int ret;unsigned long start = (unsigned long )page_address (page);unsigned long end = start +PAGE_SIZE ;struct pageattr_masks masks = {
@@ -170,7 +176,11 @@ int set_direct_map_default_noflush(struc .clear_mask = __pgprot(0) }; -return walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_lock (&init_mm); + ret =walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_unlock (&init_mm); + +return ret; }void __kernel_map_pages (struct page *page,int numpages,int enable)
Greg Kroah-Hartman
maintainerPATCH 208/244 dmaengine: fsl-edma-common: correct DSIZE_32BYTE
In reply to Greg Kroah-HartmanFrom: Robin Gong <[email protected]>
commit e142087b15960a4e1e5932942e5abae1f49d2318 upstream.
Correct EDMA_TCD_ATTR_DSIZE_32BYTE define since it's broken by the below:
'0x0005 --> BIT(3) | BIT(0))'
--- drivers/dma/fsl-edma-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/fsl-edma-common.h +1 -1
@@ -33,7 +33,7 @@#define EDMA_TCD_ATTR_DSIZE_16BIT BIT(0)#define EDMA_TCD_ATTR_DSIZE_32BIT BIT(1)#define EDMA_TCD_ATTR_DSIZE_64BIT (BIT(0) | BIT(1)) -#define EDMA_TCD_ATTR_DSIZE_32BYTE (BIT(3) | BIT(0)) +#define EDMA_TCD_ATTR_DSIZE_32BYTE (BIT(2) | BIT(0))#define EDMA_TCD_ATTR_SSIZE_8BIT 0#define EDMA_TCD_ATTR_SSIZE_16BIT (EDMA_TCD_ATTR_DSIZE_16BIT << 8)#define EDMA_TCD_ATTR_SSIZE_32BIT (EDMA_TCD_ATTR_DSIZE_32BIT << 8)
Greg Kroah-Hartman
maintainerPATCH 236/244 ionic: no link check while resetting queues
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
commit 3103b6feb4454646558eedc50ece728bc469f341 upstream.
If the driver is busy resetting queues after a change in MTU or queue parameters, don't bother checking the link, wait until the next watchdog cycle.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +2 -1
@@ -85,7 +85,8 @@ static void ionic_link_status_check(struu16 link_status;bool link_up; -if (!test_bit (IONIC_LIF_F_LINK_CHECK_REQUESTED , lif->state)) +if (!test_bit (IONIC_LIF_F_LINK_CHECK_REQUESTED , lif->state) || +test_bit (IONIC_LIF_F_QUEUE_RESET , lif->state))return ;if (lif->ionic->is_mgmt_nic)
Greg Kroah-Hartman
maintainerPATCH 237/244 ionic: export features for vlans to use
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
commit ef7232da6bcd4294cbb2d424bc35885721570f01 upstream.
Set up vlan_features for use by any vlans above us.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -0
@@ -1236,6 +1236,7 @@ static int ionic_init_nic_features(struc netdev->hw_features |= netdev->hw_enc_features; netdev->features |= netdev->hw_features; + netdev->vlan_features |= netdev->features & ~NETIF_F_VLAN_FEATURES ; netdev->priv_flags |=IFF_UNICAST_FLT |IFF_LIVE_ADDR_CHANGE ;
Greg Kroah-Hartman
maintainerPATCH 235/244 spi: sprd: switch the sequence of setting WDG_LOAD_LOW and _HIGH
In reply to Greg Kroah-HartmanFrom: Lingling Xu <[email protected]>
commit 8bdd79dae1ff5397351b95e249abcae126572617 upstream.
The watchdog counter consists of WDG_LOAD_LOW and WDG_LOAD_HIGH, which would be loaded to watchdog counter once writing WDG_LOAD_LOW.
--- drivers/spi/spi-sprd-adi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-sprd-adi.c +1 -1
@@ -389,9 +389,9 @@ static int sprd_adi_restart_handler(strusprd_adi_write (sadi, sadi->slave_pbase +REG_WDG_CTRL , val);/* Load the watchdog timeout value, 50ms is always enough. */ +sprd_adi_write (sadi, sadi->slave_pbase +REG_WDG_LOAD_HIGH ,0 );sprd_adi_write (sadi, sadi->slave_pbase +REG_WDG_LOAD_LOW ,WDG_LOAD_VAL &WDG_LOAD_MASK ); -sprd_adi_write (sadi, sadi->slave_pbase +REG_WDG_LOAD_HIGH ,0 );/* Start the watchdog to reset system */ sprd_adi_read (sadi, sadi->slave_pbase +REG_WDG_CTRL , &val);
Greg Kroah-Hartman
maintainerPATCH 209/244 misc: atmel-ssc: lock with mutex instead of spinlock
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
commit b037d60a3b1d1227609fd858fa34321f41829911 upstream.
Uninterruptible context is not needed in the driver and causes lockdep warning because of mutex taken in of_alias_get_id(). Convert the lock to mutex to avoid the issue.
--- drivers/misc/atmel-ssc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/misc/atmel-ssc.c +12 -12
@@ -10,7 +10,7 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> -#include <linux/spinlock.h> +#include <linux/mutex.h> #include <linux/atmel-ssc.h> #include <linux/slab.h> #include <linux/module.h>
@@ -20,7 +20,7 @@#include "../../sound/soc/atmel/atmel_ssc_dai.h" /* Serialize access to ssc_list and user count */ -static DEFINE_SPINLOCK (user_lock); +static DEFINE_MUTEX (user_lock);static LIST_HEAD (ssc_list);struct ssc_device *ssc_request (unsigned int ssc_num)
@@ -28,7 +28,7 @@ struct ssc_device *ssc_request(unsignedint ssc_valid =0 ;struct ssc_device *ssc; -spin_lock (&user_lock); +mutex_lock (&user_lock);list_for_each_entry (ssc, &ssc_list, list) {if (ssc->pdev->dev.of_node) { if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc")
@@ -44,18 +44,18 @@ struct ssc_device *ssc_request(unsigned }if (!ssc_valid) { -spin_unlock (&user_lock); +mutex_unlock (&user_lock);pr_err ("ssc: ssc%d platform device is missing\n" , ssc_num);return ERR_PTR (-ENODEV ); }if (ssc->user) { -spin_unlock (&user_lock); +mutex_unlock (&user_lock);dev_dbg (&ssc->pdev->dev,"module busy\n" );return ERR_PTR (-EBUSY ); } ssc->user++; -spin_unlock (&user_lock); +mutex_unlock (&user_lock);clk_prepare (ssc->clk);
@@ -67,14 +67,14 @@ void ssc_free(struct ssc_device *ssc) {bool disable_clk = true; -spin_lock (&user_lock); +mutex_lock (&user_lock);if (ssc->user) ssc->user--;else { disable_clk = false;dev_dbg (&ssc->pdev->dev,"device already free\n" ); } -spin_unlock (&user_lock); +mutex_unlock (&user_lock);if (disable_clk)clk_unprepare (ssc->clk);
@@ -237,9 +237,9 @@ static int ssc_probe(struct platform_devreturn -ENXIO ; } -spin_lock (&user_lock); +mutex_lock (&user_lock);list_add_tail (&ssc->list, &ssc_list); -spin_unlock (&user_lock); +mutex_unlock (&user_lock);platform_set_drvdata (pdev, ssc);
@@ -258,9 +258,9 @@ static int ssc_remove(struct platform_dessc_sound_dai_remove (ssc); -spin_lock (&user_lock); +mutex_lock (&user_lock);list_del (&ssc->list); -spin_unlock (&user_lock); +mutex_unlock (&user_lock);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 210/244 dmabuf: use spinlock to access dmabuf->name
In reply to Greg Kroah-HartmanFrom: Charan Teja Kalla <[email protected]>
commit 6348dd291e3653534a9e28e6917569bc9967b35b upstream.
There exists a sleep-while-atomic bug while accessing the dmabuf->name under mutex in the dmabuffs_dname(). This is caused from the SELinux permissions checks on a process where it tries to validate the inherited files from fork() by traversing them through iterate_fd() (which traverse files under spin_lock) and call match_file(security/selinux/hooks.c) where the permission checks happen. This audit information is logged using dump_common_audit_data() where it calls d_path() to get the file path name. If the file check happen on the dmabuf's fd, then it ends up in ->dmabuffs_dname() and use mutex to access dmabuf->name. The flow will be like below:flush_unauthorized_files()
iterate_fd()
spin_lock() --> Start of the atomic section.
match_file()
file_has_perm()
avc_has_perm()
avc_audit()
slow_avc_audit()
common_lsm_audit()
dump_common_audit_data()
audit_log_d_path()
d_path()
dmabuffs_dname()
mutex_lock()--> Sleep while atomic.Call trace captured (on 4.19 kernels) is below:
___might_sleep+0x204/0x208 __might_sleep+0x50/0x88 __mutex_lock_common+0x5c/0x1068 __mutex_lock_common+0x5c/0x1068 mutex_lock_nested+0x40/0x50 dmabuffs_dname+0xa0/0x170 d_path+0x84/0x290 audit_log_d_path+0x74/0x130 common_lsm_audit+0x334/0x6e8 slow_avc_audit+0xb8/0xf8 avc_has_perm+0x154/0x218 file_has_perm+0x70/0x180 match_file+0x60/0x78 iterate_fd+0x128/0x168 selinux_bprm_committing_creds+0x178/0x248 security_bprm_committing_creds+0x30/0x48 install_exec_creds+0x1c/0x68 load_elf_binary+0x3a4/0x14e0 search_binary_handler+0xb0/0x1e0
So, use spinlock to access dmabuf->name to avoid sleep-while-atomic.
--- drivers/dma-buf/dma-buf.c | 11 +++++++---- include/linux/dma-buf.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/dma-buf/dma-buf.c +7 -4
@@ -45,10 +45,10 @@ static char *dmabuffs_dname(struct dentrsize_t ret =0 ; dmabuf = dentry->d_fsdata; -dma_resv_lock (dmabuf->resv,NULL ); +spin_lock (&dmabuf->name_lock);if (dmabuf->name) ret =strlcpy (name, dmabuf->name,DMA_BUF_NAME_LEN ); -dma_resv_unlock (dmabuf->resv); +spin_unlock (&dmabuf->name_lock);return dynamic_dname (dentry, buffer, buflen,"/%s:%s" , dentry->d_name.name, ret >0 ? name :"" );
@@ -338,8 +338,10 @@ static long dma_buf_set_name(struct dma_kfree (name); goto out_unlock; } +spin_lock (&dmabuf->name_lock);kfree (dmabuf->name); dmabuf->name = name; +spin_unlock (&dmabuf->name_lock); out_unlock:dma_resv_unlock (dmabuf->resv);
@@ -402,10 +404,10 @@ static void dma_buf_show_fdinfo(struct s/* Don't count the temporary reference taken inside procfs seq_show */ seq_printf (m,"count:\t%ld\n" ,file_count (dmabuf->file) -1 );seq_printf (m,"exp_name:\t%s\n" , dmabuf->exp_name); -dma_resv_lock (dmabuf->resv,NULL ); +spin_lock (&dmabuf->name_lock);if (dmabuf->name)seq_printf (m,"name:\t%s\n" , dmabuf->name); -dma_resv_unlock (dmabuf->resv); +spin_unlock (&dmabuf->name_lock); }static const struct file_operations dma_buf_fops = {
@@ -542,6 +544,7 @@ struct dma_buf *dma_buf_export(const str dmabuf->size = exp_info->size; dmabuf->exp_name = exp_info->exp_name; dmabuf->owner = exp_info->owner; +spin_lock_init (&dmabuf->name_lock);init_waitqueue_head (&dmabuf->poll); dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll; dmabuf->cb_excl.active = dmabuf->cb_shared.active =0 ;
include/linux/dma-buf.h +1 -0
@@ -311,6 +311,7 @@ struct dma_buf {void *vmap_ptr;const char *exp_name;const char *name; +spinlock_t name_lock;/* spinlock to protect name access */ struct module *owner;struct list_head list_node;void *priv;
Greg Kroah-Hartman
maintainerPATCH 212/244 ARM: dts: imx6qdl-gw551x: fix audio SSI
In reply to Greg Kroah-HartmanFrom: Tim Harvey <[email protected]>
commit 4237c625304b212a3f30adf787901082082511ec upstream.
The audio codec on the GW551x routes to ssi1. It fixes audio capture on the device.
--- arch/arm/boot/dts/imx6qdl-gw551x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl-gw551x.dtsi +1 -1
@@ -110,7 +110,7 @@ simple-audio-card,frame-master = <&sound_codec>; sound_cpu: simple-audio-card,cpu { - sound-dai = <&ssi2>; + sound-dai = <&ssi1>; }; sound_codec: simple-audio-card,codec {
Greg Kroah-Hartman
maintainerPATCH 214/244 arm64: dts: stratix10: add status to qspi dts node
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
commit 263a0269a59c0b4145829462a107fe7f7327105f upstream.
Add status = "okay" to QSPI node.
--- arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts | 1 + arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts | 1 + 2 files changed, 2 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +1 -0
@@ -155,6 +155,7 @@ }; &qspi { + status = "okay"; flash@0 { #address-cells = <1>; #size-cells = <1>;
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts +1 -0
@@ -188,6 +188,7 @@ }; &qspi { + status = "okay"; flash@0 { #address-cells = <1>; #size-cells = <1>;
Greg Kroah-Hartman
maintainerPATCH 205/244 opp: Increase parsed_static_opps in _of_add_opp_table_v1()
In reply to Greg Kroah-HartmanFrom: Walter Lozano <[email protected]>
commit 6544abc520f0fff701e9da382110dc29676c683a upstream.
Currently, when using _of_add_opp_table_v2 parsed_static_opps is increased and this value is used in _opp_remove_all_static() to check if there are static opp entries that need to be freed. Unfortunately this does not happen when using _of_add_opp_table_v1(), which leads to warnings.
This patch increases parsed_static_opps in _of_add_opp_table_v1() in a similar way as in _of_add_opp_table_v2().
[ Viresh: Do the operation with lock held and set the value to 1 instead
of incrementing it ]
--- drivers/opp/of.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/opp/of.c +4 -0
@@ -733,6 +733,10 @@ static int _of_add_opp_table_v1(struct dreturn -EINVAL ; } +mutex_lock (&opp_table->lock); + opp_table->parsed_static_opps =1 ; +mutex_unlock (&opp_table->lock); + val = prop->value;while (nr) {unsigned long freq =be32_to_cpup (val++) *1000 ;
Greg Kroah-Hartman
maintainerPATCH 239/244 mm/memory.c: properly pte_offset_map_lock/unlock in vm_insert_pages()
In reply to Greg Kroah-HartmanFrom: Arjun Roy <[email protected]>
commit 7f70c2a68a51496289df163f6969d4db7c383f30 upstream.
Calls to pte_offset_map() in vm_insert_pages() are erroneously not matched with a call to pte_unmap(). This would cause problems on architectures where that is not a no-op.
This patch does away with the non-traditional locking in the existing code, and instead uses pte_offset_map_lock/unlock() as usual, incrementing PTE as necessary. The PTE pointer is kept within bounds since we clamp it with PTRS_PER_PTE.
--- mm/memory.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
mm/memory.c +11 -10
@@ -1501,7 +1501,7 @@ out: }#ifdef pte_index -static int insert_page_in_batch_locked (struct mm_struct *mm,pmd_t *pmd, +static int insert_page_in_batch_locked (struct mm_struct *mm,pte_t *pte,unsigned long addr,struct page *page,pgprot_t prot) {int err;
@@ -1509,8 +1509,9 @@ static int insert_page_in_batch_locked(sif (!page_count (page))return -EINVAL ; err =validate_page_before_insert (page); -return err ? err :insert_page_into_pte_locked ( - mm,pte_offset_map (pmd, addr), addr, page, prot); +if (err) +return err; +return insert_page_into_pte_locked (mm, pte, addr, page, prot); }/* insert_pages() amortizes the cost of spinlock operations
@@ -1520,7 +1521,8 @@ static int insert_pages(struct vm_area_s struct page **pages, unsigned long *num, pgprot_t prot) { pmd_t *pmd = NULL; -spinlock_t *pte_lock =NULL ; +pte_t *start_pte, *pte; +spinlock_t *pte_lock;struct mm_struct *const mm = vma->vm_mm;unsigned long curr_page_idx =0 ;unsigned long remaining_pages_total = *num;
@@ -1539,18 +1541,17 @@ more: ret = -ENOMEM ;if (pte_alloc (mm, pmd)) goto out; - pte_lock =pte_lockptr (mm, pmd);while (pages_to_write_in_pmd) {int pte_idx =0 ;const int batch_size =min_t (int, pages_to_write_in_pmd,8 ); -spin_lock (pte_lock); -for (; pte_idx < batch_size; ++pte_idx) { -int err =insert_page_in_batch_locked (mm, pmd, + start_pte =pte_offset_map_lock (mm, pmd, addr, &pte_lock); +for (pte = start_pte; pte_idx < batch_size; ++pte, ++pte_idx) { +int err =insert_page_in_batch_locked (mm, pte, addr, pages[curr_page_idx], prot);if (unlikely (err)) { -spin_unlock (pte_lock); +pte_unmap_unlock (start_pte, pte_lock); ret = err; remaining_pages_total -= pte_idx; goto out;
@@ -1558,7 +1559,7 @@ more: addr +=PAGE_SIZE ; ++curr_page_idx; } -spin_unlock (pte_lock); +pte_unmap_unlock (start_pte, pte_lock); pages_to_write_in_pmd -= batch_size; remaining_pages_total -= batch_size; }
Greg Kroah-Hartman
maintainerPATCH 240/244 drm/i915/gvt: Fix two CFL MMIO handling caused by regression.
In reply to Greg Kroah-HartmanFrom: Colin Xu <[email protected]>
commit fccd0f7cf4d532674d727c7f204f038456675dee upstream.
D_CFL was incorrectly removed for:GAMT_CHKN_BIT_REGGEN9_CTX_PREEMPT_REG
V2: Update commit message.
V3: Rebase and split Fixes and mis-handled MMIO.
--- drivers/gpu/drm/i915/gvt/handlers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gvt/handlers.c +2 -2
@@ -3131,8 +3131,8 @@ static int init_skl_mmio_info(struct intMMIO_DFH (GEN9_WM_CHICKEN3 ,D_SKL_PLUS ,F_MODE_MASK |F_CMD_ACCESS ,NULL ,NULL ); -MMIO_D (GAMT_CHKN_BIT_REG ,D_KBL ); -MMIO_D (GEN9_CTX_PREEMPT_REG ,D_KBL |D_SKL ); +MMIO_D (GAMT_CHKN_BIT_REG ,D_KBL |D_CFL ); +MMIO_D (GEN9_CTX_PREEMPT_REG ,D_SKL_PLUS );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 241/244 gpio: pca953x: disable regmap locking for automatic address incrementing
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
commit ec3decd21380081e3b5de4ba8d85d90a95f201a0 upstream.
It's a repetition of the commit aa58a21ae378
("gpio: pca953x: disable regmap locking")
which states the following:
This driver uses its own locking but regmap silently uses a mutex for all operations too. Add the option to disable locking to the regmap config struct.
--- drivers/gpio/gpio-pca953x.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-pca953x.c +1 -0
@@ -399,6 +399,7 @@ static const struct regmap_config pca953 .writeable_reg = pca953x_writeable_register, .volatile_reg = pca953x_volatile_register, + .disable_locking = true, .cache_type = REGCACHE_RBTREE, .max_register = 0x7f, };
Greg Kroah-Hartman
maintainerPATCH 242/244 bpf: sockmap: Check value of unused args to BPF_PROG_ATTACH
In reply to Greg Kroah-HartmanFrom: Lorenz Bauer <[email protected]>
commit 9b2b09717e1812e450782a43ca0c2790651cf380 upstream.
Using BPF_PROG_ATTACH on a sockmap program currently understands no flags or replace_bpf_fd, but accepts any value. Return EINVAL instead.
--- net/core/sock_map.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/sock_map.c +3 -0
@@ -70,6 +70,9 @@ int sock_map_get_from_fd(const union bpfstruct fd f;int ret; +if (attr->attach_flags || attr->replace_bpf_fd) +return -EINVAL ; + f =fdget (ufd); map =__bpf_map_get (f);if (IS_ERR (map))
Greg Kroah-Hartman
maintainerPATCH 243/244 bpf: sockmap: Require attach_bpf_fd when detaching a program
In reply to Greg Kroah-HartmanFrom: Lorenz Bauer <[email protected]>
commit bb0de3131f4c60a9bf976681e0fe4d1e55c7a821 upstream.
The sockmap code currently ignores the value of attach_bpf_fd when detaching a program. This is contrary to the usual behaviour of checking that attach_bpf_fd represents the currently attached program.
Ensure that attach_bpf_fd is indeed the currently attached program. It turns out that all sockmap selftests already do this, which indicates that this is unlikely to cause breakage.
--- include/linux/bpf.h | 13 +++++++++++-- include/linux/skmsg.h | 13 +++++++++++++ kernel/bpf/syscall.c | 2 +- net/core/sock_map.c | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 70 insertions(+), 8 deletions(-)
include/linux/bpf.h +11 -2
@@ -1444,13 +1444,16 @@ static inline void bpf_map_offload_map_f#endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */ #if defined(CONFIG_BPF_STREAM_PARSER ) -int sock_map_prog_update (struct bpf_map *map,struct bpf_prog *prog,u32 which); +int sock_map_prog_update (struct bpf_map *map,struct bpf_prog *prog, +struct bpf_prog *old,u32 which);int sock_map_get_from_fd (const union bpf_attr *attr,struct bpf_prog *prog); +int sock_map_prog_detach (const union bpf_attr *attr,enum bpf_prog_type ptype);void sock_map_unhash (struct sock *sk);void sock_map_close (struct sock *sk,long timeout);#else static inline int sock_map_prog_update (struct bpf_map *map, -struct bpf_prog *prog,u32 which) +struct bpf_prog *prog, +struct bpf_prog *old,u32 which) {return -EOPNOTSUPP ; }
@@ -1460,6 +1463,12 @@ static inline int sock_map_get_from_fd(c {return -EINVAL ; } + +static inline int sock_map_prog_detach (const union bpf_attr *attr, +enum bpf_prog_type ptype) +{ +return -EOPNOTSUPP ; +}#endif /* CONFIG_BPF_STREAM_PARSER */ #if defined(CONFIG_INET ) && defined(CONFIG_BPF_SYSCALL )
include/linux/skmsg.h +13 -0
@@ -430,6 +430,19 @@ static inline void psock_set_prog(structbpf_prog_put (prog); } +static inline int psock_replace_prog (struct bpf_prog **pprog, +struct bpf_prog *prog, +struct bpf_prog *old) +{ +if (cmpxchg (pprog, old, prog) != old) +return -ENOENT ; + +if (old) +bpf_prog_put (old); + +return 0 ; +} +static inline void psock_progs_drop (struct sk_psock_progs *progs) {psock_set_prog (&progs->msg_parser,NULL );
kernel/bpf/syscall.c +1 -1
@@ -2695,7 +2695,7 @@ static int bpf_prog_detach(const union bswitch (ptype) {case BPF_PROG_TYPE_SK_MSG :case BPF_PROG_TYPE_SK_SKB : -return sock_map_get_from_fd (attr,NULL ); +return sock_map_prog_detach (attr, ptype);case BPF_PROG_TYPE_LIRC_MODE2 :return lirc_prog_detach (attr);case BPF_PROG_TYPE_FLOW_DISSECTOR :
net/core/sock_map.c +45 -5
79 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 244/244 drm/i915/perf: Use GTT when saving/restoring engine GPR
In reply to Greg Kroah-HartmanFrom: Umesh Nerlige Ramappa <[email protected]>
commit aee62e02c48bd62b9b07f5e297ecfc9aaa964937 upstream.
MI_STORE_REGISTER_MEM and MI_LOAD_REGISTER_MEM need to know which translation to use when saving restoring the engine general purpose registers to and from the GT scratch. Since GT scratch is mapped to ggtt, we need to set an additional bit in the command to use GTT.
--- drivers/gpu/drm/i915/i915_perf.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_perf.c +1 -0
@@ -1645,6 +1645,7 @@ static u32 *save_restore_register(structu32 d; cmd = save ?MI_STORE_REGISTER_MEM :MI_LOAD_REGISTER_MEM ; + cmd |=MI_SRM_LRM_GLOBAL_GTT ;if (INTEL_GEN (stream->perf->i915) >=8 ) cmd++;
Greg Kroah-Hartman
maintainerPATCH 238/244 iommu/vt-d: Make Intel SVM code 64-bit only
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
commit 9486727f5981a5ec5c0b699fb1777451bd6786e4 upstream.
Current Intel SVM is designed by setting the pgd_t of the processor page table to FLPTR field of the PASID entry. The first level translation only supports 4 and 5 level paging structures, hence it's infeasible for the IOMMU to share a processor's page table when it's running in 32-bit mode. Let's disable 32bit support for now and claim support only when all the missing pieces are ready in the future.
--- drivers/iommu/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/Kconfig +1 -1
@@ -211,7 +211,7 @@ config INTEL_IOMMU_DEBUGFS config INTEL_IOMMU_SVM bool "Support for Shared Virtual Memory with Intel IOMMU" - depends on INTEL_IOMMU && X86 + depends on INTEL_IOMMU && X86_64 select PCI_PASID select PCI_PRI select MMU_NOTIFIER
Greg Kroah-Hartman
maintainerPATCH 213/244 arm64: dts: agilex: add status to qspi dts node
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
commit 60176e6be0bb6f629b15aea7dcab5a95ecb158e9 upstream.
Add status = "okay" to QSPI node.
--- arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts +1 -0
@@ -98,6 +98,7 @@ }; &qspi { + status = "okay"; flash@0 { #address-cells = <1>; #size-cells = <1>;
Greg Kroah-Hartman
maintainerPATCH 211/244 thermal: int3403_thermal: Downgrade error message
In reply to Greg Kroah-HartmanFrom: Alex Hung <[email protected]>
commit f3d7fb38976b1b0a8462ba1c7cbd404ddfaad086 upstream.
Downgrade "Unsupported event" message from dev_err to dev_dbg to avoid flooding with this message on some platforms.
--- drivers/thermal/intel/int340x_thermal/int3403_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/int340x_thermal/int3403_thermal.c +1 -1
@@ -74,7 +74,7 @@ static void int3403_notify(acpi_handle h THERMAL_TRIP_CHANGED);break ;default : -dev_err (&priv->pdev->dev,"Unsupported event [0x%x]\n" , event); +dev_dbg (&priv->pdev->dev,"Unsupported event [0x%x]\n" , event);break ; } }
Greg Kroah-Hartman
maintainerPATCH 234/244 rxrpc: Fix trace string
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
commit aadf9dcef9d4cd68c73a4ab934f93319c4becc47 upstream.
The trace symbol printer (__print_symbolic()) ignores symbols that map to an empty string and prints the hex value instead.
Fix the symbol for rxrpc_cong_no_change to " -" instead of "" to avoid this.
--- include/trace/events/rxrpc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/rxrpc.h +1 -1
@@ -400,7 +400,7 @@ enum rxrpc_tx_point { EM(rxrpc_cong_begin_retransmission, " Retrans") \ EM(rxrpc_cong_cleared_nacks, " Cleared") \ EM(rxrpc_cong_new_low_nack, " NewLowN") \ - EM(rxrpc_cong_no_change, "") \ + EM(rxrpc_cong_no_change, " -") \ EM(rxrpc_cong_progress, " Progres") \ EM(rxrpc_cong_retransmit_again, " ReTxAgn") \EM (rxrpc_cong_rtt_window_end," RttWinE" ) \
Greg Kroah-Hartman
maintainerPATCH 225/244 drm/amdgpu/sdma5: fix wptr overwritten in ->get_wptr()
In reply to Greg Kroah-HartmanFrom: Xiaojie Yuan <[email protected]>
commit 05051496b2622e4d12e2036b35165969aa502f89 upstream.
"u64 *wptr" points to the the wptr value in write back buffer and "*wptr = (*wptr) >> 2;" results in the value being overwritten each time when ->get_wptr() is called.
umr uses /sys/kernel/debug/dri/0/amdgpu_ring_sdma0 to get rptr/wptr and decode ring content and it is affected by this issue.
fix and simplify the logic similar as sdma_v4_0_ring_get_wptr().
v2: fix for sdma5.2 as well
v3: drop sdma 5.2 changes for 5.8 and stable
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +8 -18
@@ -286,30 +286,20 @@ static uint64_t sdma_v5_0_ring_get_rptr(static uint64_t sdma_v5_0_ring_get_wptr (struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev; -u64 *wptr =NULL ; -uint64_t local_wptr =0 ; +u64 wptr;if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - wptr = ((u64 *)&adev->wb.wb[ring->wptr_offs]); -DRM_DEBUG ("wptr/doorbell before shift == 0x%016llx\n" , *wptr); - *wptr = (*wptr) >>2 ; -DRM_DEBUG ("wptr/doorbell after shift == 0x%016llx\n" , *wptr); + wptr =READ_ONCE (*((u64 *)&adev->wb.wb[ring->wptr_offs])); +DRM_DEBUG ("wptr/doorbell before shift == 0x%016llx\n" , wptr); }else { -u32 lowbit, highbit; - - wptr = &local_wptr; - lowbit =RREG32 (sdma_v5_0_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_WPTR)) >>2 ; - highbit =RREG32 (sdma_v5_0_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI)) >>2 ; - -DRM_DEBUG ("wptr [%i]high== 0x%08x low==0x%08x\n" , - ring->me, highbit, lowbit); - *wptr = highbit; - *wptr = (*wptr) <<32 ; - *wptr |= lowbit; + wptr =RREG32 (sdma_v5_0_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI)); + wptr = wptr <<32 ; + wptr |=RREG32 (sdma_v5_0_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_WPTR)); +DRM_DEBUG ("wptr before shift [%i] wptr == 0x%016llx\n" , ring->me, wptr); } -return *wptr; +return wptr >>2 ; }/**
Greg Kroah-Hartman
maintainerPATCH 229/244 drm/i915: Move cec_notifier to intel_hdmi_connector_unregister, v2.
In reply to Greg Kroah-HartmanFrom: Maarten Lankhorst <[email protected]>
commit 6647e6cdba753e71170be7da2acfead7154f56d8 upstream.
This fixes the following KASAN splash on module reload:
[ 145.136327] ================================================================== [ 145.136502] BUG: KASAN: use-after-free in intel_hdmi_destroy+0x74/0x80 [i915] [ 145.136514] Read of size 8 at addr ffff888216641830 by task kworker/1:1/134
[ 145.136535] CPU: 1 PID: 134 Comm: kworker/1:1 Tainted: G U T 5.5.0-rc7-valkyria+ #5783 [ 145.136539] Hardware name: GIGABYTE GB-BKi3A-7100/MFLP3AP-00, BIOS F1 07/27/2016 [ 145.136546] Workqueue: events drm_connector_free_work_fn [ 145.136551] Call Trace: [ 145.136560] dump_stack+0xa1/0xe0 [ 145.136571] print_address_description.constprop.0+0x1e/0x210 [ 145.136639] ? intel_hdmi_destroy+0x74/0x80 [i915] [ 145.136703] ? intel_hdmi_destroy+0x74/0x80 [i915] [ 145.136710] __kasan_report.cold+0x1b/0x37 [ 145.136790] ? intel_hdmi_destroy+0x74/0x80 [i915] [ 145.136863] ? intel_hdmi_destroy+0x74/0x80 [i915] [ 145.136870] kasan_report+0x27/0x30 [ 145.136881] __asan_report_load8_noabort+0x1c/0x20 [ 145.136946] intel_hdmi_destroy+0x74/0x80 [i915] [ 145.136954] drm_connector_free_work_fn+0xd1/0x100 [ 145.136967] process_one_work+0x86e/0x1610 [ 145.136987] ? pwq_dec_nr_in_flight+0x2f0/0x2f0 [ 145.137004] ? move_linked_works+0x128/0x2c0 [ 145.137021] worker_thread+0x63e/0xc90 [ 145.137048] kthread+0x2f6/0x3f0 [ 145.137054] ? calculate_sigpending+0x81/0xa0 [ 145.137059] ? process_one_work+0x1610/0x1610 [ 145.137064] ? kthread_bind+0x40/0x40 [ 145.137075] ret_from_fork+0x24/0x30
[ 145.137111] Allocated by task 0: [ 145.137119] (stack is not available)
[ 145.137137] Freed by task 5053: [ 145.137147] save_stack+0x28/0x90 [ 145.137152] __kasan_slab_free+0x136/0x180 [ 145.137157] kasan_slab_free+0x26/0x30 [ 145.137161] kfree+0xe6/0x350 [ 145.137242] intel_ddi_encoder_destroy+0x60/0x80 [i915] [ 145.137252] drm_mode_config_cleanup+0x11d/0x8f0 [ 145.137329] intel_modeset_driver_remove+0x1f5/0x350 [i915] [ 145.137403] i915_driver_remove+0xc4/0x130 [i915] [ 145.137482] i915_pci_remove+0x3e/0x90 [i915] [ 145.137489] pci_device_remove+0x108/0x2d0 [ 145.137494] device_release_driver_internal+0x1e6/0x4a0 [ 145.137499] driver_detach+0xcb/0x198 [ 145.137503] bus_remove_driver+0xde/0x204 [ 145.137508] driver_unregister+0x6d/0xa0 [ 145.137513] pci_unregister_driver+0x2e/0x230 [ 145.137576] i915_exit+0x1f/0x26 [i915] [ 145.137157] kasan_slab_free+0x26/0x30 [ 145.137161] kfree+0xe6/0x350 [ 145.137242] intel_ddi_encoder_destroy+0x60/0x80 [i915] [ 145.137252] drm_mode_config_cleanup+0x11d/0x8f0 [ 145.137329] intel_modeset_driver_remove+0x1f5/0x350 [i915] [ 145.137403] i915_driver_remove+0xc4/0x130 [i915] [ 145.137482] i915_pci_remove+0x3e/0x90 [i915] [ 145.137489] pci_device_remove+0x108/0x2d0 [ 145.137494] device_release_driver_internal+0x1e6/0x4a0 [ 145.137499] driver_detach+0xcb/0x198 [ 145.137503] bus_remove_driver+0xde/0x204 [ 145.137508] driver_unregister+0x6d/0xa0 [ 145.137513] pci_unregister_driver+0x2e/0x230 [ 145.137576] i915_exit+0x1f/0x26 [i915] [ 145.137581] __x64_sys_delete_module+0x35b/0x470 [ 145.137586] do_syscall_64+0x99/0x4e0 [ 145.137591] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 145.137606] The buggy address belongs to the object at ffff888216640000
which belongs to the cache kmalloc-8k of size 8192
[ 145.137618] The buggy address is located 6192 bytes inside of
8192-byte region [ffff888216640000, ffff888216642000)
[ 145.137630] The buggy address belongs to the page:
[ 145.137640] page:ffffea0008599000 refcount:1 mapcount:0 mapping:ffff888107c02a80 index:0xffff888216644000 compound_mapcount: 0
[ 145.137647] raw: 0200000000010200 0000000000000000 0000000100000001 ffff888107c02a80
[ 145.137652] raw: ffff888216644000 0000000080020001 00000001ffffffff 0000000000000000
[ 145.137656] page dumped because: kasan: bad access detected[ 145.137668] Memory state around the buggy address: [ 145.137678] ffff888216641700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 145.137687] ffff888216641780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 145.137697] >ffff888216641800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 145.137706] ^ [ 145.137715] ffff888216641880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 145.137724] ffff888216641900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 145.137733] ================================================================== [ 145.137742] Disabling lock debugging due to kernel taint
Changes since v1:
- Add fixes tags.
- Use early unregister.
--- drivers/gpu/drm/i915/display/intel_hdmi.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -8
@@ -2821,19 +2821,13 @@ intel_hdmi_connector_register(struct drmreturn ret; } -static void intel_hdmi_destroy (struct drm_connector *connector) +static void intel_hdmi_connector_unregister (struct drm_connector *connector) {struct cec_notifier *n =intel_attached_hdmi (to_intel_connector (connector))->cec_notifier;cec_notifier_conn_unregister (n); -intel_connector_destroy (connector); -} - -static void intel_hdmi_connector_unregister (struct drm_connector *connector) -{intel_hdmi_remove_i2c_symlink (connector); -intel_connector_unregister (connector); }
@@ -2845,7 +2839,7 @@ static const struct drm_connector_funcs .atomic_set_property = intel_digital_connector_atomic_set_property, .late_register = intel_hdmi_connector_register, .early_unregister = intel_hdmi_connector_unregister, - .destroy = intel_hdmi_destroy, + .destroy = intel_connector_destroy, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_duplicate_state = intel_digital_connector_duplicate_state, };
Greg Kroah-Hartman
maintainerPATCH 223/244 drm/vmwgfx: fix update of display surface when resolution changes
In reply to Greg Kroah-HartmanFrom: Roland Scheidegger <[email protected]>
commit 1f054fd26e29784d373c3d29c348ee48f1c41fb2 upstream.
The assignment of metadata overwrote the new display resolution values, hence we'd miss the size actually changed and wouldn't redefine the surface. This would then lead to command buffer error when trying to update the screen target (due to the size mismatch), and result in a VM with black screen.
--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +4 -4
@@ -1069,10 +1069,6 @@ vmw_stdu_primary_plane_prepare_fb(structif (new_content_type !=SAME_AS_DISPLAY ) {struct vmw_surface_metadata metadata = {0 }; - metadata.base_size.width = hdisplay; - metadata.base_size.height = vdisplay; - metadata.base_size.depth =1 ; -/* * If content buffer is a buffer object, then we have to * construct surface info
@@ -1104,6 +1100,10 @@ vmw_stdu_primary_plane_prepare_fb(struct metadata = new_vfbs->surface->metadata; } + metadata.base_size.width = hdisplay; + metadata.base_size.height = vdisplay; + metadata.base_size.depth =1 ; +if (vps->surf) {struct drm_vmw_size cur_base_size = vps->surf->metadata.base_size;
Greg Kroah-Hartman
maintainerPATCH 217/244 arm64: ptrace: Consistently use pseudo-singlestep exceptions
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit ac2081cdc4d99c57f219c1a6171526e0fa0a6fff upstream.
Although the arm64 single-step state machine can be fast-forwarded in cases where we wish to generate a SIGTRAP without actually executing an instruction, this has two major limitations outside of simply skipping an instruction due to emulation.
1. Stepping out of a ptrace signal stop into a signal handler where SIGTRAP is blocked. Fast-forwarding the stepping state machine in this case will result in a forced SIGTRAP, with the handler reset to SIG_DFL.
2. The hardware implicitly fast-forwards the state machine when executing an SVC instruction for issuing a system call. This can interact badly with subsequent ptrace stops signalled during the execution of the system call (e.g. SYSCALL_EXIT or seccomp traps), as they may corrupt the stepping state by updating the PSTATE for the tracee.
Resolve both of these issues by injecting a pseudo-singlestep exception on entry to a signal handler and also on return to userspace following a system call.
--- arch/arm64/include/asm/thread_info.h | 1 + arch/arm64/kernel/ptrace.c | 27 ++++++++++++++++++++------- arch/arm64/kernel/signal.c | 11 ++--------- arch/arm64/kernel/syscall.c | 2 +- 4 files changed, 24 insertions(+), 17 deletions(-)
arch/arm64/include/asm/thread_info.h +1 -0
@@ -89,6 +89,7 @@ void arch_release_task_struct(struct tas#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)#define _TIF_UPROBE (1 << TIF_UPROBE)#define _TIF_FSCHECK (1 << TIF_FSCHECK) +#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)#define _TIF_32BIT (1 << TIF_32BIT)#define _TIF_SVE (1 << TIF_SVE)
arch/arm64/kernel/ptrace.c +20 -7
@@ -1819,12 +1819,23 @@ static void tracehook_report_syscall(str saved_reg = regs->regs[regno]; regs->regs[regno] = dir; -if (dir ==PTRACE_SYSCALL_EXIT ) +if (dir ==PTRACE_SYSCALL_ENTER ) { +if (tracehook_report_syscall_entry (regs)) +forget_syscall (regs); + regs->regs[regno] = saved_reg; + }else if (!test_thread_flag (TIF_SINGLESTEP )) {tracehook_report_syscall_exit (regs,0 ); -else if (tracehook_report_syscall_entry (regs)) -forget_syscall (regs); - - regs->regs[regno] = saved_reg; + regs->regs[regno] = saved_reg; + }else { + regs->regs[regno] = saved_reg; + +/* +* Signal a pseudo-step exception since we are stepping but +* tracer modifications to the registers may have rewound the +* state machine. +*/ +tracehook_report_syscall_exit (regs,1 ); + } }int syscall_trace_enter (struct pt_regs *regs)
@@ -1852,12 +1863,14 @@ int syscall_trace_enter(struct pt_regs *void syscall_trace_exit (struct pt_regs *regs) { +unsigned long flags =READ_ONCE (current_thread_info ()->flags); +audit_syscall_exit (regs); -if (test_thread_flag (TIF_SYSCALL_TRACEPOINT )) +if (flags & _TIF_SYSCALL_TRACEPOINT)trace_sys_exit (regs,regs_return_value (regs)); -if (test_thread_flag (TIF_SYSCALL_TRACE )) +if (flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP))tracehook_report_syscall (regs,PTRACE_SYSCALL_EXIT );rseq_syscall (regs);
arch/arm64/kernel/signal.c +2 -9
@@ -784,7 +784,6 @@ static void setup_restart_syscall(struct*/ static void handle_signal (struct ksignal *ksig,struct pt_regs *regs) { -struct task_struct *tsk = current;sigset_t *oldset =sigmask_to_save ();int usig = ksig->sig;int ret;
@@ -808,14 +807,8 @@ static void handle_signal(struct ksignal*/ ret |= !valid_user_regs (®s->user_regs, current); -/* -* Fast forward the stepping logic so we step into the signal -* handler. -*/ -if (!ret) -user_fastforward_single_step (tsk); - -signal_setup_done (ret, ksig,0 ); +/* Step into the signal handler if we are stepping */ +signal_setup_done (ret, ksig,test_thread_flag (TIF_SINGLESTEP )); }/*
arch/arm64/kernel/syscall.c +1 -1
@@ -121,7 +121,7 @@ static void el0_svc_common(struct pt_regif (!has_syscall_work (flags) && !IS_ENABLED (CONFIG_DEBUG_RSEQ )) {local_daif_mask (); flags =current_thread_info ()->flags; -if (!has_syscall_work (flags)) { +if (!has_syscall_work (flags) && !(flags & _TIF_SINGLESTEP)) {/* * We're off to userspace, where interrupts are * always enabled after we restore the flags from
Greg Kroah-Hartman
maintainerPATCH 199/244 powerpc/book3s64/pkeys: Fix pkey_access_permitted() for execute disable pkey
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
commit 192b6a780598976feb7321ff007754f8511a4129 upstream.
Even if the IAMR value denies execute access, the current code returns true from pkey_access_permitted() for an execute permission check, if the AMR read pkey bit is cleared.
This results in repeated page fault loop with a test like below:
#define _GNU_SOURCE #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <inttypes.h> #include <assert.h> #include <malloc.h> #include <unistd.h> #include <pthread.h> #include <sys/mman.h> #ifdef SYS_pkey_mprotect #undef SYS_pkey_mprotect #endif #ifdef SYS_pkey_alloc #undef SYS_pkey_alloc #endif #ifdef SYS_pkey_free #undef SYS_pkey_free #endif #undef PKEY_DISABLE_EXECUTE #define PKEY_DISABLE_EXECUTE 0x4 #define SYS_pkey_mprotect 386 #define SYS_pkey_alloc 384 #define SYS_pkey_free 385 #define PPC_INST_NOP 0x60000000 #define PPC_INST_BLR 0x4e800020 #define PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC)
static int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey) {
return syscall(SYS_pkey_mprotect, addr, len, prot, pkey);
}
static int sys_pkey_alloc(unsigned long flags, unsigned long access_rights)
{
return syscall(SYS_pkey_alloc, flags, access_rights);
}
static int sys_pkey_free(int pkey)
{
return syscall(SYS_pkey_free, pkey);
}
static void do_execute(void *region)
{
/* jump to region */
asm volatile(
"mtctr %0;"
"bctrl"
: : "r"(region) : "ctr", "lr");
}
static void do_protect(void *region)
{
size_t pgsize;
int i, pkey;
pgsize = getpagesize();
pkey = sys_pkey_alloc(0, PKEY_DISABLE_EXECUTE);
assert (pkey > 0);
/* perform mprotect */
assert(!sys_pkey_mprotect(region, pgsize, PROT_RWX, pkey));
do_execute(region);
/* free pkey */
assert(!sys_pkey_free(pkey));
}
int main(int argc, char **argv)
{
size_t pgsize, numinsns;
unsigned int *region;
int i;
/* allocate memory region to protect */
pgsize = getpagesize();
region = memalign(pgsize, pgsize);
assert(region != NULL);
assert(!mprotect(region, pgsize, PROT_RWX));
/* fill page with NOPs with a BLR at the end */
numinsns = pgsize / sizeof(region[0]);
for (i = 0; i < numinsns - 1; i++)
region[i] = PPC_INST_NOP;
region[i] = PPC_INST_BLR;
do_protect(region);
return EXIT_SUCCESS;
}The fix is to only check the IAMR for an execute check, the AMR value is not relevant.
--- arch/powerpc/mm/book3s64/pkeys.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/powerpc/mm/book3s64/pkeys.c +7 -5
@@ -357,12 +357,14 @@ static bool pkey_access_permitted(int pkreturn true; pkey_shift =pkeyshift (pkey); -if (execute && !(read_iamr () & (IAMR_EX_BIT << pkey_shift))) -return true; +if (execute) +return !(read_iamr () & (IAMR_EX_BIT << pkey_shift)); + + amr =read_amr (); +if (write) +return !(amr & (AMR_WR_BIT << pkey_shift)); - amr =read_amr ();/* Delay reading amr until absolutely needed */ -return ((!write && !(amr & (AMR_RD_BIT << pkey_shift))) || - (write && !(amr & (AMR_WR_BIT << pkey_shift)))); +return !(amr & (AMR_RD_BIT << pkey_shift)); }bool arch_pte_access_permitted (u64 pte,bool write,bool execute)
Greg Kroah-Hartman
maintainerPATCH 192/244 uio_pdrv_genirq: fix use without device tree and no interrupt
In reply to Greg Kroah-HartmanFrom: Esben Haabendal <[email protected]>
commit bf12fdf0ab728ca8e5933aac46dd972c0dd0421e upstream.
While e3a3c3a20555 ("UIO: fix uio_pdrv_genirq with device tree but no interrupt") added support for using uio_pdrv_genirq for devices without interrupt for device tree platforms, the removal of uio_pdrv in 26dac3c49d56 ("uio: Remove uio_pdrv and use uio_pdrv_genirq instead") broke the support for non device tree platforms.
This change fixes this, so that uio_pdrv_genirq can be used without interrupt on all platforms.
This still leaves the support that uio_pdrv had for custom interrupt handler lacking, as uio_pdrv_genirq does not handle it (yet).
--- drivers/uio/uio_pdrv_genirq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/uio/uio_pdrv_genirq.c +1 -1
@@ -161,7 +161,7 @@ static int uio_pdrv_genirq_probe(structif (!uioinfo->irq) { ret =platform_get_irq_optional (pdev,0 ); uioinfo->irq = ret; -if (ret == -ENXIO && pdev->dev.of_node) +if (ret == -ENXIO ) uioinfo->irq =UIO_IRQ_NONE ;else if (ret == -EPROBE_DEFER )return ret;
Greg Kroah-Hartman
maintainerPATCH 174/244 serial: sh-sci: Initialize spinlock for uart console
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
commit f38278e9b810b06aff2981d505267be984423ba3 upstream.
serial core expects the spinlock to be initialized by the controller driver for serial console, this patch makes sure the spinlock is initialized, fixing the below issue:
[ 0.865928] BUG: spinlock bad magic on CPU#0, swapper/0/1 [ 0.865945] lock: sci_ports+0x0/0x4c80, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 [ 0.865955] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.8.0-rc1+ #112 [ 0.865961] Hardware name: HopeRun HiHope RZ/G2H with sub board (DT) [ 0.865968] Call trace: [ 0.865979] dump_backtrace+0x0/0x1d8 [ 0.865985] show_stack+0x14/0x20 [ 0.865996] dump_stack+0xe8/0x130 [ 0.866006] spin_dump+0x6c/0x88 [ 0.866012] do_raw_spin_lock+0xb0/0xf8 [ 0.866023] _raw_spin_lock_irqsave+0x80/0xa0 [ 0.866032] uart_add_one_port+0x3a4/0x4e0 [ 0.866039] sci_probe+0x504/0x7c8 [ 0.866048] platform_drv_probe+0x50/0xa0 [ 0.866059] really_probe+0xdc/0x330 [ 0.866066] driver_probe_device+0x58/0xb8 [ 0.866072] device_driver_attach+0x6c/0x90 [ 0.866078] __driver_attach+0x88/0xd0 [ 0.866085] bus_for_each_dev+0x74/0xc8 [ 0.866091] driver_attach+0x20/0x28 [ 0.866098] bus_add_driver+0x14c/0x1f8 [ 0.866104] driver_register+0x60/0x110 [ 0.866109] __platform_driver_register+0x40/0x48 [ 0.866119] sci_init+0x2c/0x34 [ 0.866127] do_one_initcall+0x88/0x428 [ 0.866137] kernel_init_freeable+0x2c0/0x328 [ 0.866143] kernel_init+0x10/0x108 [ 0.866150] ret_from_fork+0x10/0x18
--- drivers/tty/serial/sh-sci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/sh-sci.c +3 -0
@@ -3301,6 +3301,9 @@ static int sci_probe_single(struct platf sciport->port.flags |=UPF_HARD_FLOW ; } +if (sci_uart_driver.cons->index == sciport->port.line) +spin_lock_init (&sciport->port.lock); + ret =uart_add_one_port (&sci_uart_driver, &sciport->port);if (ret) {sci_cleanup_single (sciport);
Greg Kroah-Hartman
maintainerPATCH 184/244 fuse: Fix parameter for FS_IOC_{GET,SET}FLAGS
In reply to Greg Kroah-HartmanFrom: Chirantan Ekbote <[email protected]>
commit 31070f6ccec09f3bd4f1e28cd1e592fa4f3ba0b6 upstream.
The ioctl encoding for this parameter is a long but the documentation says it should be an int and the kernel drivers expect it to be an int. If the fuse driver treats this as a long it might end up scribbling over the stack of a userspace process that only allocated enough space for an int.
This was previously discussed in [1] and a patch for fuse was proposed in [2]. From what I can tell the patch in [2] was nacked in favor of adding new, "fixed" ioctls and using those from userspace. However there is still no "fixed" version of these ioctls and the fact is that it's sometimes infeasible to change all userspace to use the new one.
Handling the ioctls specially in the fuse driver seems like the most pragmatic way for fuse servers to support them without causing crashes in userspace applications that call them.
[1]: https://lore.kernel.org/linux-fsdevel/[email protected]/T/
[2]: https://sourceforge.net/p/fuse/mailman/message/31771759/
--- fs/fuse/file.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/fuse/file.c +11 -1
@@ -18,6 +18,7 @@#include <linux/swap.h> #include <linux/falloc.h> #include <linux/uio.h> +#include <linux/fs.h> static struct page **fuse_pages_alloc (unsigned int npages,gfp_t flags,struct fuse_page_desc **desc)
@@ -2758,7 +2759,16 @@ long fuse_do_ioctl(struct file *file, unstruct iovec *iov = iov_page; iov->iov_base = (void __user *)arg; - iov->iov_len =_IOC_SIZE (cmd); + +switch (cmd) { +case FS_IOC_GETFLAGS : +case FS_IOC_SETFLAGS : + iov->iov_len =sizeof (int ); +break ; +default : + iov->iov_len =_IOC_SIZE (cmd); +break ; + }if (_IOC_DIR (cmd) & _IOC_WRITE) { in_iov = iov;
Greg Kroah-Hartman
maintainerPATCH 183/244 fuse: use ->reconfigure() instead of ->remount_fs()
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 0189a2d367f49729622fdafaef5da73161591859 upstream.
s_op->remount_fs() is only called from legacy_reconfigure(), which is not used after being converted to the new API.
Convert to using ->reconfigure(). This restores the previous behavior of syncing the filesystem and rejecting MS_MANDLOCK on remount.
--- fs/fuse/inode.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/fuse/inode.c +5 -3
@@ -121,10 +121,12 @@ static void fuse_evict_inode(struct inod } } -static int fuse_remount_fs (struct super_block *sb,int *flags,char *data) +static int fuse_reconfigure (struct fs_context *fc) { +struct super_block *sb = fc->root->d_sb; +sync_filesystem (sb); -if (*flags &SB_MANDLOCK ) +if (fc->sb_flags &SB_MANDLOCK )return -EINVAL ;return 0 ;
@@ -817,7 +819,6 @@ static const struct super_operations fus .evict_inode = fuse_evict_inode, .write_inode = fuse_write_inode, .drop_inode = generic_delete_inode, - .remount_fs = fuse_remount_fs, .put_super = fuse_put_super, .umount_begin = fuse_umount_begin, .statfs = fuse_statfs,
@@ -1291,6 +1292,7 @@ static int fuse_get_tree(struct fs_contestatic const struct fs_context_operations fuse_context_ops = { .free = fuse_free_fc, .parse_param = fuse_parse_param, + .reconfigure = fuse_reconfigure, .get_tree = fuse_get_tree, };
Greg Kroah-Hartman
maintainerPATCH 139/244 mtd: rawnand: brcmnand: fix CS0 layout
In reply to Greg Kroah-HartmanFrom: Álvaro Fernández Rojas <[email protected]>
commit 3d3fb3c5be9ce07fa85d8f67fb3922e4613b955b upstream.
Only v3.3-v5.0 have a different CS0 layout. Controllers before v3.3 use the same layout for every CS.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3 -2
@@ -606,8 +606,9 @@ static int brcmnand_revision_init(struct }else { ctrl->cs_offsets = brcmnand_cs_offsets; -/* v5.0 and earlier has a different CS0 offset layout */ -if (ctrl->nand_version <=0x0500 ) +/* v3.3-5.0 have a different CS0 offset layout */ +if (ctrl->nand_version >=0x0303 && + ctrl->nand_version <=0x0500 ) ctrl->cs0_offsets = brcmnand_cs_offsets_cs0; }
Greg Kroah-Hartman
maintainerPATCH 148/244 HID: magicmouse: do not set up autorepeat
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
commit 6363d2065cd399cf9d6dc9d08c437f8658831100 upstream.
Neither the trackpad, nor the mouse want input core to generate autorepeat events for their buttons, so let's reset the bit (as hid-input sets it for these devices based on the usage vendor code).
--- drivers/hid/hid-magicmouse.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hid/hid-magicmouse.c +6 -0
@@ -535,6 +535,12 @@ static int magicmouse_setup_input(struct__set_bit (MSC_RAW , input->mscbit); } +/* +* hid-input may mark device as using autorepeat, but neither +* the trackpad, nor the mouse actually want it. +*/ +__clear_bit (EV_REP , input->evbit); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 147/244 HID: logitech-hidpp: avoid repeated "multiplier = " log messages
In reply to Greg Kroah-HartmanFrom: Maciej S. Szmigiero <[email protected]>
commit e13762abf38ead29071407f32b9dcec38f21dc34 upstream.
These messages appear each time the mouse wakes from sleep, in my case (Logitech M705), every minute or so.
Let's downgrade them to the "debug" level so they don't fill the kernel log by default.
While we are at it, let's make clear that this is a wheel multiplier (and not, for example, XY movement multiplier).
--- drivers/hid/hid-logitech-hidpp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +1 -1
@@ -3146,7 +3146,7 @@ static int hi_res_scroll_enable(struct h multiplier =1 ; hidpp->vertical_wheel_counter.wheel_multiplier = multiplier; -hid_info (hidpp->hid_dev,"multiplier = %d\n" , multiplier); +hid_dbg (hidpp->hid_dev,"wheel multiplier = %d\n" , multiplier);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 142/244 mtd: rawnand: oxnas: Release all devices in the _remove() path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 0a5f45e57e35d0840bedb816974ce2e63406cd8b upstream.
oxnans_nand_remove() should release all MTD devices and clean all NAND devices, not only the first one registered.
--- drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/oxnas_nand.c +6 -2
@@ -177,9 +177,13 @@ err_clk_unprepare:static int oxnas_nand_remove (struct platform_device *pdev) {struct oxnas_nand_ctrl *oxnas =platform_get_drvdata (pdev); +struct nand_chip *chip; +int i; -if (oxnas->chips[0 ]) -nand_release (oxnas->chips[0 ]); +for (i =0 ; i < oxnas->nchips; i++) { + chip = oxnas->chips[i]; +nand_release (chip); + }clk_disable_unprepare (oxnas->clk);
Greg Kroah-Hartman
maintainerPATCH 141/244 mtd: rawnand: oxnas: Unregister all devices on error
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit b60391eb17b2956ff2fc4c348e5a464da21ff9cb upstream.
On error, the oxnas probe path just frees the device which failed and aborts the probe, leaving unreleased resources.
Fix this situation by calling mtd_device_unregister()/nand_cleanup() on these.
--- drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mtd/nand/raw/oxnas_nand.c +8 -0
@@ -82,6 +82,7 @@ static int oxnas_nand_probe(struct platfstruct resource *res;int count =0 ;int err =0 ; +int i;/* Allocate memory for the device structure (and zero it) */ oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
@@ -161,6 +162,13 @@ err_cleanup_nand:nand_cleanup (chip); err_release_child:of_node_put (nand_np); + +for (i =0 ; i < oxnas->nchips; i++) { + chip = oxnas->chips[i]; +WARN_ON (mtd_device_unregister (nand_to_mtd (chip))); +nand_cleanup (chip); + } + err_clk_unprepare:clk_disable_unprepare (oxnas->clk);return err;
Greg Kroah-Hartman
maintainerPATCH 157/244 ALSA: hda/realtek - Enable Speaker for ASUS UX533 and UX534
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
commit 473fbe13fd6f9082e413aea37e624ecbce5463cc upstream.
ASUS UX533 and UX534 speaker still can't output. End User feedback speaker didn't have output. Add this COEF value will enable it.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -7101,6 +7101,8 @@ static const struct hda_fixup alc269_fix/* Set EAPD high */ { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 }, { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 }, + { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 }, { } }, .chained = true,
Greg Kroah-Hartman
maintainerPATCH 153/244 ALSA: usb-audio: Fix race against the error recovery URB submission
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 9b7e5208a941e2e491a83eb5fa83d889e888fa2f upstream.
USB MIDI driver has an error recovery mechanism to resubmit the URB in the delayed timer handler, and this may race with the standard start / stop operations. Although both start and stop operations themselves don't race with each other due to the umidi->mutex protection, but this isn't applied to the timer handler.
For fixing this potential race, the following changes are applied:
- Since the timer handler can't use the mutex, we apply the umidi->disc_lock protection at each input stream URB submission; this also needs to change the GFP flag to GFP_ATOMIC
- Add a check of the URB refcount and skip if already submitted
- Move the timer cancel call at disconnection to the beginning of the procedure; this assures the in-flight timer handler is gone properly before killing all pending URBs
--- sound/usb/midi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
sound/usb/midi.c +12 -5
@@ -1499,6 +1499,8 @@ void snd_usbmidi_disconnect(struct list_spin_unlock_irq (&umidi->disc_lock);up_write (&umidi->disc_rwsem); +del_timer_sync (&umidi->error_timer); +for (i =0 ; i <MIDI_MAX_ENDPOINTS ; ++i) {struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i];if (ep->out)
@@ -1525,7 +1527,6 @@ void snd_usbmidi_disconnect(struct list_ ep->in =NULL ; } } -del_timer_sync (&umidi->error_timer); }EXPORT_SYMBOL (snd_usbmidi_disconnect);
@@ -2301,16 +2302,22 @@ void snd_usbmidi_input_stop(struct list_ }EXPORT_SYMBOL (snd_usbmidi_input_stop); -static void snd_usbmidi_input_start_ep (struct snd_usb_midi_in_endpoint *ep) +static void snd_usbmidi_input_start_ep (struct snd_usb_midi *umidi, +struct snd_usb_midi_in_endpoint *ep) {unsigned int i; +unsigned long flags;if (!ep)return ;for (i =0 ; i <INPUT_URBS ; ++i) {struct urb *urb = ep->urbs[i]; - urb->dev = ep->umidi->dev; -snd_usbmidi_submit_urb (urb,GFP_KERNEL ); +spin_lock_irqsave (&umidi->disc_lock, flags); +if (!atomic_read (&urb->use_count)) { + urb->dev = ep->umidi->dev; +snd_usbmidi_submit_urb (urb,GFP_ATOMIC ); + } +spin_unlock_irqrestore (&umidi->disc_lock, flags); } }
@@ -2326,7 +2333,7 @@ void snd_usbmidi_input_start(struct listif (umidi->input_running || !umidi->opened[1 ])return ;for (i =0 ; i <MIDI_MAX_ENDPOINTS ; ++i) -snd_usbmidi_input_start_ep (umidi->endpoints[i].in); +snd_usbmidi_input_start_ep (umidi, umidi->endpoints[i].in); umidi->input_running =1 ; }EXPORT_SYMBOL (snd_usbmidi_input_start);
Greg Kroah-Hartman
maintainerPATCH 150/244 HID: quirks: Ignore Simply Automated UPB PIM
In reply to Greg Kroah-HartmanFrom: James Hilliard <[email protected]>
commit 1ee1369b46de1083238fced60ff718f59de4b8aa upstream.
As this is a cypress HID->COM RS232 style device that is handled by the cypress_M8 driver we also need to add it to the ignore list in hid-quirks.
--- drivers/hid/hid-ids.h | 2 ++ drivers/hid/hid-quirks.c | 1 + 2 files changed, 3 insertions(+)
drivers/hid/hid-ids.h +2 -0
@@ -1006,6 +1006,8 @@#define USB_DEVICE_ID_ROCCAT_RYOS_MK_PRO 0x3232#define USB_DEVICE_ID_ROCCAT_SAVU 0x2d5a +#define USB_VENDOR_ID_SAI 0x17dd +#define USB_VENDOR_ID_SAITEK 0x06a3#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17#define USB_DEVICE_ID_SAITEK_PS1000 0x0621
drivers/hid/hid-quirks.c +1 -0
@@ -833,6 +833,7 @@ static const struct hid_device_id hid_ig { HID_USB_DEVICE(USB_VENDOR_ID_PETZL, USB_DEVICE_ID_PETZL_HEADLAMP) }, { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SAI, USB_DEVICE_ID_CYPRESS_HIDCOM) }, #if IS_ENABLED(CONFIG_MOUSE_SYNAPTICS_USB) { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP) }, { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_INT_TP) },
Greg Kroah-Hartman
maintainerPATCH 149/244 HID: quirks: Always poll Obins Anne Pro 2 keyboard
In reply to Greg Kroah-HartmanFrom: Sebastian Parschauer <[email protected]>
commit ca28aff0e1dc7dce9e12a7fd9276b7118ce5e73a upstream.
The Obins Anne Pro 2 keyboard (04d9:a293) disconnects after a few minutes of inactivity when using it wired and typing does not result in any input events any more. This is a common firmware flaw. So add the ALWAYS_POLL quirk for this device.
GitHub user Dietrich Moerman (dietrichm) tested the quirk and requested my help in my project
https://github.com/sriemer/fix-linux-mouse issue 22 to provide this patch.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -624,6 +624,7 @@#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2 0xa0c2#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096 0xa096 +#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A293 0xa293#define USB_VENDOR_ID_IMATION 0x0718#define USB_DEVICE_ID_DISC_STAKKA 0xd000
drivers/hid/hid-quirks.c +1 -0
@@ -88,6 +88,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A293), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
Greg Kroah-Hartman
maintainerPATCH 111/244 xprtrdma: fix incorrect header size calculations
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 912288442cb2f431bf3c8cb097a5de83bc6dbac1 ]
Currently the header size calculations are using an assignment operator instead of a += operator when accumulating the header size leading to incorrect sizes. Fix this by using the correct operator.
Addresses-Coverity: ("Unused value")
--- net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/rpc_rdma.c +2 -2
@@ -71,7 +71,7 @@ static unsigned int rpcrdma_max_call_header_size(unsigned int maxsegs) size =RPCRDMA_HDRLEN_MIN ;/* Maximum Read list size */ - size = maxsegs * rpcrdma_readchunk_maxsz *sizeof (__be32); + size += maxsegs * rpcrdma_readchunk_maxsz *sizeof (__be32);/* Minimal Read chunk size */ size +=sizeof (__be32);/* segment count */
@@ -94,7 +94,7 @@ static unsigned int rpcrdma_max_reply_header_size(unsigned int maxsegs) size =RPCRDMA_HDRLEN_MIN ;/* Maximum Write list size */ - size =sizeof (__be32);/* segment count */ + size +=sizeof (__be32);/* segment count */ size += maxsegs * rpcrdma_segment_maxsz *sizeof (__be32); size +=sizeof (__be32);/* list discriminator */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 135/244 mtd: rawnand: marvell: Use nand_cleanup() when the device is not yet registered
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 7a0c18fb5c71c6ac7d4662a145e4227dcd4a36a3 upstream.
Do not call nand_release() while the MTD device has not been registered, use nand_cleanup() instead.
--- drivers/mtd/nand/raw/marvell_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/marvell_nand.c +1 -1
@@ -2664,7 +2664,7 @@ static int marvell_nand_chip_init(struct ret =mtd_device_register (mtd,NULL ,0 );if (ret) {dev_err (dev,"failed to register mtd device: %d\n" , ret); -nand_release (chip); +nand_cleanup (chip);return ret; }
Greg Kroah-Hartman
maintainerPATCH 132/244 mtd: spi-nor: winbond: Fix 4-byte opcode support for w25q256
In reply to Greg Kroah-HartmanFrom: Mantas Pucka <[email protected]>
commit e8aec15dd5842b5b11b0e621a2293348d3574a61 upstream.
There are 2 different chips (w25q256fv and w25q256jv) that share the same JEDEC ID. Only w25q256jv fully supports 4-byte opcodes. Use SFDP header version to differentiate between them.
--- drivers/mtd/spi-nor/sfdp.c | 4 ---- drivers/mtd/spi-nor/sfdp.h | 6 ++++++ drivers/mtd/spi-nor/winbond.c | 29 +++++++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 6 deletions(-)
drivers/mtd/spi-nor/sfdp.c +0 -4
@@ -21,10 +21,6 @@#define SFDP_4BAIT_ID 0xff84/* 4-byte Address Instruction Table */ #define SFDP_SIGNATURE 0x50444653U -#define SFDP_JESD216_MAJOR 1 -#define SFDP_JESD216_MINOR 0 -#define SFDP_JESD216A_MINOR 5 -#define SFDP_JESD216B_MINOR 6struct sfdp_header {u32 signature;/* Ox50444653U <=> "SFDP" */
drivers/mtd/spi-nor/sfdp.h +6 -0
@@ -7,6 +7,12 @@#ifndef __LINUX_MTD_SFDP_H#define __LINUX_MTD_SFDP_H +/* SFDP revisions */ +#define SFDP_JESD216_MAJOR 1 +#define SFDP_JESD216_MINOR 0 +#define SFDP_JESD216A_MINOR 5 +#define SFDP_JESD216B_MINOR 6 +/* Basic Flash Parameter Table */ /*
drivers/mtd/spi-nor/winbond.c +27 -2
@@ -8,6 +8,31 @@#include "core.h" +static int +w25q256_post_bfpt_fixups (struct spi_nor *nor, +const struct sfdp_parameter_header *bfpt_header, +const struct sfdp_bfpt *bfpt, +struct spi_nor_flash_parameter *params) +{ +/* +* W25Q256JV supports 4B opcodes but W25Q256FV does not. +* Unfortunately, Winbond has re-used the same JEDEC ID for both +* variants which prevents us from defining a new entry in the parts +* table. +* To differentiate between W25Q256JV and W25Q256FV check SFDP header +* version: only JV has JESD216A compliant structure (version 5). +*/ +if (bfpt_header->major ==SFDP_JESD216_MAJOR && + bfpt_header->minor ==SFDP_JESD216A_MINOR ) + nor->flags |=SNOR_F_4B_OPCODES ; + +return 0 ; +} + +static struct spi_nor_fixups w25q256_fixups = { + .post_bfpt = w25q256_post_bfpt_fixups, +}; +static const struct flash_info winbond_parts[] = {/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ {"w25x05" ,INFO (0xef3010 ,0 ,64 *1024 ,1 ,SECT_4K ) },
@@ -53,8 +78,8 @@ static const struct flash_info winbond_p { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, -SECT_4K |SPI_NOR_DUAL_READ |SPI_NOR_QUAD_READ | - SPI_NOR_4B_OPCODES) }, +SECT_4K |SPI_NOR_DUAL_READ |SPI_NOR_QUAD_READ ) + .fixups = &w25q256_fixups }, { "w25q256jvm", INFO(0xef7019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512,
Greg Kroah-Hartman
maintainerPATCH 128/244 soc: qcom: rpmh-rsc: Clear active mode configuration for wake TCS
In reply to Greg Kroah-HartmanFrom: Raju P.L.S.S.S.N <[email protected]>
commit 15b3bf61b8d48f8e0ccd9d7f1bcb468b543da396 upstream.
For RSCs that have sleep & wake TCS but no dedicated active TCS, wake TCS can be re-purposed to send active requests. Once the active requests are sent and response is received, the active mode configuration needs to be cleared so that controller can use wake TCS for sending wake requests.
Introduce enable_tcs_irq() to enable completion IRQ for repurposed TCSes.
--- drivers/soc/qcom/rpmh-rsc.c | 77 ++++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 23 deletions(-)
drivers/soc/qcom/rpmh-rsc.c +54 -23
@@ -201,6 +201,42 @@ static const struct tcs_request *get_reqreturn NULL ; } +static void __tcs_set_trigger (struct rsc_drv *drv,int tcs_id,bool trigger) +{ +u32 enable; + +/* +* HW req: Clear the DRV_CONTROL and enable TCS again +* While clearing ensure that the AMC mode trigger is cleared +* and then the mode enable is cleared. +*/ + enable =read_tcs_reg (drv,RSC_DRV_CONTROL , tcs_id,0 ); + enable &= ~TCS_AMC_MODE_TRIGGER ; +write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); + enable &= ~TCS_AMC_MODE_ENABLE ; +write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); + +if (trigger) { +/* Enable the AMC mode on the TCS and then trigger the TCS */ + enable =TCS_AMC_MODE_ENABLE ; +write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); + enable |=TCS_AMC_MODE_TRIGGER ; +write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); + } +} + +static void enable_tcs_irq (struct rsc_drv *drv,int tcs_id,bool enable) +{ +u32 data; + + data =read_tcs_reg (drv,RSC_DRV_IRQ_ENABLE ,0 ,0 ); +if (enable) + data |=BIT (tcs_id); +else + data &= ~BIT (tcs_id); +write_tcs_reg (drv,RSC_DRV_IRQ_ENABLE ,0 , data); +} +/** * tcs_tx_done: TX Done interrupt handler */
@@ -237,6 +273,14 @@ static irqreturn_t tcs_tx_done(int irq, }trace_rpmh_tx_done (drv, i, req, err); + +/* +* If wake tcs was re-purposed for sending active +* votes, clear AMC trigger & enable modes and +* disable interrupt for this TCS +*/ +if (!drv->tcs[ACTIVE_TCS ].num_tcs) +__tcs_set_trigger (drv, i, false); skip:/* Reclaim the TCS */ write_tcs_reg (drv,RSC_DRV_CMD_ENABLE , i,0 );
@@ -244,6 +288,13 @@ skip:write_tcs_reg (drv,RSC_DRV_IRQ_CLEAR ,0 ,BIT (i));spin_lock (&drv->lock);clear_bit (i, drv->tcs_in_use); +/* +* Disable interrupt for WAKE TCS to avoid being +* spammed with interrupts coming when the solver +* sends its wake votes. +*/ +if (!drv->tcs[ACTIVE_TCS ].num_tcs) +enable_tcs_irq (drv, i, false);spin_unlock (&drv->lock);if (req)rpmh_tx_done (req, err);
@@ -285,28 +336,6 @@ static void __tcs_buffer_write(struct rswrite_tcs_reg (drv,RSC_DRV_CMD_ENABLE , tcs_id, cmd_enable); } -static void __tcs_trigger (struct rsc_drv *drv,int tcs_id) -{ -u32 enable; - -/* -* HW req: Clear the DRV_CONTROL and enable TCS again -* While clearing ensure that the AMC mode trigger is cleared -* and then the mode enable is cleared. -*/ - enable =read_tcs_reg (drv,RSC_DRV_CONTROL , tcs_id,0 ); - enable &= ~TCS_AMC_MODE_TRIGGER ; -write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); - enable &= ~TCS_AMC_MODE_ENABLE ; -write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); - -/* Enable the AMC mode on the TCS and then trigger the TCS */ - enable =TCS_AMC_MODE_ENABLE ; -write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); - enable |=TCS_AMC_MODE_TRIGGER ; -write_tcs_reg_sync (drv,RSC_DRV_CONTROL , tcs_id, enable); -} -static int check_for_req_inflight (struct rsc_drv *drv,struct tcs_group *tcs,const struct tcs_request *msg) {
@@ -377,10 +406,12 @@ static int tcs_write(struct rsc_drv *drv tcs->req[tcs_id - tcs->offset] = msg;set_bit (tcs_id, drv->tcs_in_use); +if (msg->state ==RPMH_ACTIVE_ONLY_STATE && tcs->type !=ACTIVE_TCS ) +enable_tcs_irq (drv, tcs_id, true);spin_unlock (&drv->lock);__tcs_buffer_write (drv, tcs_id,0 , msg); -__tcs_trigger (drv, tcs_id); +__tcs_set_trigger (drv, tcs_id, true); done_write:spin_unlock_irqrestore (&tcs->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 107/244 NFS: Fix interrupted slots by sending a solo SEQUENCE operation
In reply to Greg Kroah-HartmanFrom: Anna Schumaker <[email protected]>
[ Upstream commit 913fadc5b105c3619d9e8d0fe8899ff1593cc737 ]
We used to do this before 3453d5708b33, but this was changed to better handle the NFS4ERR_SEQ_MISORDERED error code. This commit fixed the slot re-use case when the server doesn't receive the interrupted operation, but if the server does receive the operation then it could still end up replying to the client with mis-matched operations from the reply cache.
We can fix this by sending a SEQUENCE to the server while recovering from a SEQ_MISORDERED error when we detect that we are in an interrupted slot situation.
--- fs/nfs/nfs4proc.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +18 -2
@@ -774,6 +774,14 @@ static void nfs4_slot_sequence_acked(struct nfs4_slot *slot, slot->seq_nr_last_acked = seqnr; } +static void nfs4_probe_sequence (struct nfs_client *client,const struct cred *cred, +struct nfs4_slot *slot) +{ +struct rpc_task *task =_nfs41_proc_sequence (client, cred, slot, true); +if (!IS_ERR (task)) +rpc_put_task_async (task); +} +static int nfs41_sequence_process (struct rpc_task *task,struct nfs4_sequence_res *res) {
@@ -790,6 +798,7 @@ static int nfs41_sequence_process(struct rpc_task *task, goto out; session = slot->table->session; + clp = session->clp;trace_nfs4_sequence_done (session, res);
@@ -804,7 +813,6 @@ static int nfs41_sequence_process(struct rpc_task *task,nfs4_slot_sequence_acked (slot, slot->seq_nr);/* Update the slot's sequence and clientid lease timer */ slot->seq_done =1 ; - clp = session->clp;do_renew_lease (clp, res->sr_timestamp);/* Check sequence flags */ nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags,
@@ -852,10 +860,18 @@ static int nfs41_sequence_process(struct rpc_task *task,/* * Were one or more calls using this slot interrupted? * If the server never received the request, then our -* transmitted slot sequence number may be too high. +* transmitted slot sequence number may be too high. However, +* if the server did receive the request then it might +* accidentally give us a reply with a mismatched operation. +* We can sort this out by sending a lone sequence operation +* to the server on the same slot. */ if ((s32)(slot->seq_nr - slot->seq_nr_last_acked) >1 ) { slot->seq_nr--; +if (task->tk_msg.rpc_proc != &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE ]) { +nfs4_probe_sequence (clp, task->tk_msg.rpc_cred, slot); + res->sr_slot =NULL ; + } goto retry_nowait; }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 117/244 copy_xstate_to_kernel: Fix typo which caused GDB regression
In reply to Greg Kroah-HartmanFrom: Kevin Buettner <[email protected]>
commit 5714ee50bb4375bd586858ad800b1d9772847452 upstream.
This fixes a regression encountered while running the gdb.base/corefile.exp test in GDB's test suite.
In my testing, the typo prevented the sw_reserved field of struct fxregs_state from being output to the kernel XSAVES area. Thus the correct mask corresponding to XCR0 was not present in the core file for GDB to interrogate, resulting in the following behavior:
[kev@f32-1 gdb]$ ./gdb -q testsuite/outputs/gdb.base/corefile/corefile testsuite/outputs/gdb.base/corefile/corefile.core Reading symbols from testsuite/outputs/gdb.base/corefile/corefile...
[New LWP 232880]
warning: Unexpected size of section `.reg-xstate/232880' in core file.
With the typo fixed, the test works again as expected.
--- arch/x86/kernel/fpu/xstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/fpu/xstate.c +1 -1
@@ -1022,7 +1022,7 @@ int copy_xstate_to_kernel(void *kbuf, stcopy_part (offsetof(struct fxregs_state , st_space),128 , &xsave->i387.st_space, &kbuf, &offset_start, &count);if (header.xfeatures &XFEATURE_MASK_SSE ) -copy_part (xstate_offsets[XFEATURE_MASK_SSE ],256 , +copy_part (xstate_offsets[XFEATURE_SSE ],256 , &xsave->i387.xmm_space, &kbuf, &offset_start, &count);/* * Fill xsave->i387.sw_reserved value for ptrace frame:
Greg Kroah-Hartman
maintainerPATCH 118/244 arm: dts: mt7623: add phy-mode property for gmac2
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
commit ff5b89c2858f28006f9f9c0a88c55a679488192c upstream.
Add phy-mode property required by phylink on gmac2
--- arch/arm/boot/dts/mt7623n-rfb-emmc.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/mt7623n-rfb-emmc.dts +1 -0
@@ -138,6 +138,7 @@ mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; + phy-mode = "rgmii"; phy-handle = <&phy5>; };
Greg Kroah-Hartman
maintainerPATCH 76/244 Input: mms114 - add extra compatible for mms345l
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 7842087b0196d674ed877d768de8f2a34d7fdc53 ]
MMS345L is another first generation touch screen from Melfas, which uses mostly the same registers as MMS152.
However, there is some garbage printed during initialization. Apparently MMS345L does not have the MMS152_COMPAT_GROUP register that is read+printed during initialization.
TSP FW Rev: bootloader 0x6 / core 0x26 / config 0x26, Compat group: \x06
On earlier kernel versions the compat group was actually printed as an ASCII control character, seems like it gets escaped now.
But we probably shouldn't print something from a random register.
Add a separate "melfas,mms345l" compatible that avoids reading from the MMS152_COMPAT_GROUP register. This might also help in case there is some other device-specific quirk in the future.
--- drivers/input/touchscreen/mms114.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/input/touchscreen/mms114.c +15 -2
@@ -54,6 +54,7 @@enum mms_type {TYPE_MMS114 =114 ,TYPE_MMS152 =152 , +TYPE_MMS345L =345 , };struct mms114_data {
@@ -250,6 +251,15 @@ static int mms114_get_version(struct mms114_data *data)int error;switch (data->type) { +case TYPE_MMS345L : + error =__mms114_read_reg (data,MMS152_FW_REV ,3 , buf); +if (error) +return error; + +dev_info (dev,"TSP FW Rev: bootloader 0x%x / core 0x%x / config 0x%x\n" , + buf[0 ], buf[1 ], buf[2 ]); +break ; +case TYPE_MMS152 : error =__mms114_read_reg (data,MMS152_FW_REV ,3 , buf);if (error)
@@ -287,8 +297,8 @@ static int mms114_setup_regs(struct mms114_data *data)if (error <0 )return error; -/* MMS152 has no configuration or power on registers */ -if (data->type ==TYPE_MMS152 ) +/* Only MMS114 has configuration and power on registers */ +if (data->type !=TYPE_MMS114 )return 0 ; error =mms114_set_active (data, true);
@@ -597,6 +607,9 @@ static const struct of_device_id mms114_dt_match[] = { }, { .compatible = "melfas,mms152", .data = (void *)TYPE_MMS152, + }, { + .compatible = "melfas,mms345l", + .data = (void *)TYPE_MMS345L, }, { } };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 103/244 xprtrdma: Fix double-free in rpcrdma_ep_create()
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 85bfd71bc34e20d9fadb745131f6314c36d0f75b ]
In the error paths, there's no need to call kfree(ep) after calling rpcrdma_ep_put(ep).
--- net/sunrpc/xprtrdma/verbs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/sunrpc/xprtrdma/verbs.c +2 -5
@@ -404,8 +404,8 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) id =rpcrdma_create_id (r_xprt, ep);if (IS_ERR (id)) { - rc =PTR_ERR (id); - goto out_free; +kfree (ep); +return PTR_ERR (id); }__module_get (THIS_MODULE ); device = id->device;
@@ -504,9 +504,6 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) out_destroy:rpcrdma_ep_put (ep);rdma_destroy_id (id); -out_free: -kfree (ep); - r_xprt->rx_ep =NULL ;return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 99/244 staging: comedi: verify array index is correct before using it
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ef75e14a6c935eec82abac07ab68e388514e39bc ]
This code reads from the array before verifying that "trig" is a valid index. If the index is wildly out of bounds then reading from an invalid address could lead to an Oops.
--- drivers/staging/comedi/drivers/addi_apci_1500.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1500.c +7 -3
@@ -456,9 +456,9 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,unsigned int lo_mask = data[5 ] << shift;unsigned int chan_mask = hi_mask | lo_mask;unsigned int old_mask = (1 << shift) -1 ; -unsigned int pm = devpriv->pm[trig] & old_mask; -unsigned int pt = devpriv->pt[trig] & old_mask; -unsigned int pp = devpriv->pp[trig] & old_mask; +unsigned int pm; +unsigned int pt; +unsigned int pp;if (trig >1 ) { dev_dbg(dev->class_dev,
@@ -471,6 +471,10 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,return -EINVAL ; } + pm = devpriv->pm[trig] & old_mask; + pt = devpriv->pt[trig] & old_mask; + pp = devpriv->pp[trig] & old_mask; +switch (data[2 ]) {case COMEDI_DIGITAL_TRIG_DISABLE :/* clear trigger configuration */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 101/244 clk: mvebu: ARMADA_AP_CPU_CLK needs to select ARMADA_AP_CP_HELPER
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 8e3709d7e3a67e2d3f42bd1fc2052353a5678944 ]
When building arm32 allmodconfig:
ld.lld: error: undefined symbol: ap_cp_unique_name
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
ap-cpu-clk.c
clk/mvebu/ap-cpu-clk.o:(ap_cpu_clock_probe) in archivedrivers/built-in.a
ap_cp_unique_name is only compiled into the kernel image when CONFIG_ARMADA_AP_CP_HELPER is selected (as it is not user selectable). However, CONFIG_ARMADA_AP_CPU_CLK does not select it.
This has been a problem since the driver was added to the kernel but it was not built before commit c318ea261749 ("cpufreq: ap806: fix cpufreq driver needs ap cpu clk") so it was never noticed.
--- drivers/clk/mvebu/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/clk/mvebu/Kconfig +1 -0
@@ -42,6 +42,7 @@ config ARMADA_AP806_SYSCON config ARMADA_AP_CPU_CLK bool + select ARMADA_AP_CP_HELPER config ARMADA_CP110_SYSCON bool
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 74/244 spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI transfer
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 3c525b69e8c1a9a6944e976603c7a1a713e728f9 ]
During shutdown, the driver should unregister the SPI controller and stop the hardware. Otherwise the dspi_transfer_one_message() could wait on completion infinitely.
Additionally, calling spi_unregister_controller() first in device shutdown reverse-matches the probe function, where SPI controller is registered at the end.
--- drivers/spi/spi-fsl-dspi.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/spi/spi-fsl-dspi.c +1 -14
@@ -1461,20 +1461,7 @@ static int dspi_remove(struct platform_device *pdev)static void dspi_shutdown (struct platform_device *pdev) { -struct spi_controller *ctlr =platform_get_drvdata (pdev); -struct fsl_dspi *dspi =spi_controller_get_devdata (ctlr); - -/* Disable RX and TX */ -regmap_update_bits (dspi->regmap,SPI_MCR , -SPI_MCR_DIS_TXF |SPI_MCR_DIS_RXF , -SPI_MCR_DIS_TXF |SPI_MCR_DIS_RXF ); - -/* Stop Running */ -regmap_update_bits (dspi->regmap,SPI_MCR ,SPI_MCR_HALT ,SPI_MCR_HALT ); - -dspi_release_dma (dspi); -clk_disable_unprepare (dspi->clk); -spi_unregister_controller (dspi->ctlr); +dspi_remove (pdev); }static struct platform_driver fsl_dspi_driver = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 89/244 dmaengine: idxd: cleanup workqueue config after disabling
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit da32b28c95a79e399e18c03f8178f41aec9c66e4 ]
After disabling a device, we should clean up the internal state for the wqs and zero out the configuration registers. Without doing so can cause issues when the user reprogram the wqs.
--- drivers/dma/idxd/device.c | 25 +++++++++++++++++++++++++ drivers/dma/idxd/idxd.h | 1 + drivers/dma/idxd/sysfs.c | 5 +++++ 3 files changed, 31 insertions(+)
drivers/dma/idxd/device.c +25 -0
@@ -320,6 +320,31 @@ void idxd_wq_unmap_portal(struct idxd_wq *wq)devm_iounmap (dev, wq->dportal); } +void idxd_wq_disable_cleanup (struct idxd_wq *wq) +{ +struct idxd_device *idxd = wq->idxd; +struct device *dev = &idxd->pdev->dev; +int i, wq_offset; + +lockdep_assert_held (&idxd->dev_lock); +memset (&wq->wqcfg,0 ,sizeof (wq->wqcfg)); + wq->type =IDXD_WQT_NONE ; + wq->size =0 ; + wq->group =NULL ; + wq->threshold =0 ; + wq->priority =0 ; +clear_bit (WQ_FLAG_DEDICATED , &wq->flags); +memset (wq->name,0 ,WQ_NAME_SIZE ); + +for (i =0 ; i <8 ; i++) { + wq_offset = idxd->wqcfg_offset + wq->id *32 + i *sizeof (u32); +iowrite32 (0 , idxd->reg_base + wq_offset); +dev_dbg (dev,"WQ[%d][%d][%#x]: %#x\n" , + wq->id, i, wq_offset, +ioread32 (idxd->reg_base + wq_offset)); + } +} +/* Device control bits */ static inline bool idxd_is_enabled (struct idxd_device *idxd) {
drivers/dma/idxd/idxd.h +1 -0
@@ -290,6 +290,7 @@ int idxd_wq_enable(struct idxd_wq *wq);int idxd_wq_disable (struct idxd_wq *wq);int idxd_wq_map_portal (struct idxd_wq *wq);void idxd_wq_unmap_portal (struct idxd_wq *wq); +void idxd_wq_disable_cleanup (struct idxd_wq *wq);/* submission */ int idxd_submit_desc (struct idxd_wq *wq,struct idxd_desc *desc);
drivers/dma/idxd/sysfs.c +5 -0
@@ -315,6 +315,11 @@ static int idxd_config_bus_remove(struct device *dev)idxd_unregister_dma_device (idxd);spin_lock_irqsave (&idxd->dev_lock, flags); rc =idxd_device_disable (idxd); +for (i =0 ; i < idxd->max_wqs; i++) { +struct idxd_wq *wq = &idxd->wqs[i]; + +idxd_wq_disable_cleanup (wq); + }spin_unlock_irqrestore (&idxd->dev_lock, flags);module_put (THIS_MODULE );if (rc <0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 84/244 dmaengine: sh: usb-dmac: set tx_result parameters
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit 466257d9968ac79575831250b039dc07566c7b13 ]
A client driver (renesas_usbhs) assumed that dmaengine_tx_status() could return the residue even if the transfer was completed. However, this was not correct usage [1] and this caused to break getting the residue after the commit 24461d9792c2 ("dmaengine: virt-dma: Fix access after free in vchan_complete()") actually. So, this is possible to get wrong received size if the usb controller gets a short packet. For example, g_zero driver causes "bad OUT byte" errors.
To use the tx_result from the renesas_usbhs driver when the transfer is completed, set the tx_result parameters.
Notes that the renesas_usbhs driver needs to update for it.
[1]
https://lore.kernel.org/dmaengine/20200616165550.GP2324254@vkoul-mobl/
--- drivers/dma/sh/usb-dmac.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/sh/usb-dmac.c +2 -0
@@ -586,6 +586,8 @@ static void usb_dmac_isr_transfer_end(struct usb_dmac_chan *chan) desc->residue =usb_dmac_get_current_residue (chan, desc, desc->sg_index -1 ); desc->done_cookie = desc->vd.tx.cookie; + desc->vd.tx_result.result =DMA_TRANS_NOERROR ; + desc->vd.tx_result.residue = desc->residue;vchan_cookie_complete (&desc->vd);/* Restart the next transfer if this driver has a next desc */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 44/244 dt-bindings: fix error in make clean after make dt_binding_check
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit fa714cf58c7c09a454ff9fda2ee8318591128eb6 ]
We are having more and more schema files.
Commit 8b6b80218b01 ("dt-bindings: Fix command line length limit calling dt-mk-schema") fixed the 'Argument list too long' error of the schema checks, but the same error happens while cleaning too.
'make clean' after 'make dt_binding_check' fails as follows:
$ make dt_binding_check
[ snip ]
$ make clean
make[2]: execvp: /bin/sh: Argument list too long
make[2]: *** [scripts/Makefile.clean:52: __clean] Error 127
make[1]: *** [scripts/Makefile.clean:66: Documentation/devicetree/bindings] Error 2
make: *** [Makefile:1763: _clean_Documentation] Error 2'make dt_binding_check' generates so many .example.dts, .dt.yaml files, which are passed to the 'rm' command when you run 'make clean'.
I added a small hack to use the 'find' command to clean up most of the build artifacts before they are processed by scripts/Makefile.clean
--- Documentation/devicetree/bindings/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/Makefile +5 -0
@@ -45,3 +45,8 @@ $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE $(call if_changed,mk_schema) extra-y += processed-schema.yaml + +# Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of +# build artifacts here before they are processed by scripts/Makefile.clean +clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \ + -name '*.example.dt.yaml' \) -delete 2>/dev/null)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 69/244 arm64: Add missing sentinel to erratum_1463225
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 09c717c92b52df54918e12cbfe6a4658233fda69 ]
When the erratum_1463225 array was introduced a sentinel at the end was missing thus causing a KASAN: global-out-of-bounds in is_affected_midr_range_list on arm64 error.
--- arch/arm64/kernel/cpu_errata.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/cpu_errata.c +1 -0
@@ -778,6 +778,7 @@ static const struct midr_range erratum_1463225[] = {MIDR_RANGE (MIDR_CORTEX_A76 ,0 ,0 ,3 ,1 ),/* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */ MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf), + {}, };#endif
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 41/244 m68k: mm: fix node memblock init
In reply to Greg Kroah-HartmanFrom: Angelo Dureghello <[email protected]>
[ Upstream commit c43e55796dd4d13f4855971a4d7970ce2cd94db4 ]
After pulling 5.7.0 (linux-next merge), mcf5441x mmu boot was hanging silently.
memblock_add() seems not appropriate, since using MAX_NUMNODES as node id, while memblock_add_node() sets up memory for node id 0.
--- arch/m68k/mm/mcfmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/mm/mcfmmu.c +1 -1
@@ -178,7 +178,7 @@ void __init cf_bootmem_alloc(void) m68k_memory[0 ].addr = _rambase; m68k_memory[0 ].size = _ramend - _rambase; -memblock_add (m68k_memory[0 ].addr, m68k_memory[0 ].size); +memblock_add_node (m68k_memory[0 ].addr, m68k_memory[0 ].size,0 );/* compute total pages in system */ num_pages =PFN_DOWN (_ramend - _rambase);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 56/244 arm64: Add KRYO4XX gold CPU cores to erratum list 1463225 and 1418040
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit a9e821b89daa55cc940c546b124101939d3f0451 ]
KRYO4XX gold/big CPU core revisions r0p0 to r3p1 are affected by erratum 1463225 and 1418040, so add them to the respective list. The variant and revision bits are implementation defined and are different from the their Cortex CPU counterparts on which they are based on, i.e., (r0p0 to r3p1) is equivalent to (rcpe to rfpf).
--- Documentation/arm64/silicon-errata.rst | 4 ++++ arch/arm64/kernel/cpu_errata.c | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
Documentation/arm64/silicon-errata.rst +4 -0
@@ -147,6 +147,10 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | Qualcomm Tech. | Falkor v{1,2} | E1041 | QCOM_FALKOR_ERRATUM_1041 | +----------------+-----------------+-----------------+-----------------------------+ +| Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1463225 | ++----------------+-----------------+-----------------+-----------------------------+ +| Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1418040 | ++----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ | Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 | +----------------+-----------------+-----------------+-----------------------------+
arch/arm64/kernel/cpu_errata.c +13 -6
@@ -472,12 +472,7 @@ static bool has_cortex_a76_erratum_1463225(const struct arm64_cpu_capabilities *entry, int scope) { -u32 midr =read_cpuid_id (); -/* Cortex-A76 r0p0 - r3p1 */ -struct midr_range range =MIDR_RANGE (MIDR_CORTEX_A76 ,0 ,0 ,3 ,1 ); - -WARN_ON (scope !=SCOPE_LOCAL_CPU ||preemptible ()); -return is_midr_in_range (midr, &range) &&is_kernel_in_hyp_mode (); + return is_affected_midr_range_list(entry, scope) && is_kernel_in_hyp_mode(); }#endif
@@ -728,6 +723,8 @@ static const struct midr_range erratum_1418040_list[] = {MIDR_RANGE (MIDR_CORTEX_A76 ,0 ,0 ,3 ,1 ),/* Neoverse-N1 r0p0 to r3p1 */ MIDR_RANGE (MIDR_NEOVERSE_N1 ,0 ,0 ,3 ,1 ), +/* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */ + MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf), {}, };#endif
@@ -773,6 +770,15 @@ static const struct midr_range erratum_speculative_at_vhe_list[] = { };#endif +#ifdef CONFIG_ARM64_ERRATUM_1463225 +static const struct midr_range erratum_1463225[] = { +/* Cortex-A76 r0p0 - r3p1 */ +MIDR_RANGE (MIDR_CORTEX_A76 ,0 ,0 ,3 ,1 ), +/* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */ +MIDR_RANGE (MIDR_QCOM_KRYO_4XX_GOLD ,0xc ,0xe ,0xf ,0xf ), +}; +#endif + const struct arm64_cpu_capabilities arm64_errata[] = {#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE {
@@ -912,6 +918,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = { .capability = ARM64_WORKAROUND_1463225, .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, .matches = has_cortex_a76_erratum_1463225, + .midr_range_list = erratum_1463225, },#endif #ifdef CONFIG_CAVIUM_TX2_ERRATUM_219
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 53/244 gfs2: When freezing gfs2, use GL_EXACT and not GL_NOCACHE
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
[ Upstream commit 623ba664b74a20f22a2ef7ebd71e171d2d7c626f ]
Before this patch, the freeze code in gfs2 specified GL_NOCACHE in several places. That's wrong because we always want to know the state of whether the file system is frozen.
There was also a problem with freeze/thaw transitioning the glock from frozen (EX) to thawed (SH) because gfs2 will normally grant glocks in EX to processes that request it in SH mode, unless GL_EXACT is specified. Therefore, the freeze/thaw code, which tried to reacquire the glock in SH mode would get the glock in EX mode, and miss the transition from EX to SH. That made it think the thaw had completed normally, but since the glock was still cached in EX, other nodes could not freeze again.
This patch removes the GL_NOCACHE flag to allow the freeze glock to be cached. It also adds the GL_EXACT flag so the glock is fully transitioned from EX to SH, thereby allowing future freeze operations.
--- fs/gfs2/recovery.c | 4 ++-- fs/gfs2/super.c | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-)
fs/gfs2/recovery.c +2 -2
@@ -364,8 +364,8 @@ void gfs2_recover_func(struct work_struct *work)/* Acquire a shared hold on the freeze lock */ error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_SHARED , -LM_FLAG_NOEXP |LM_FLAG_PRIORITY , - &thaw_gh); +LM_FLAG_NOEXP |LM_FLAG_PRIORITY | +GL_EXACT , &thaw_gh);if (error) goto fail_gunlock_ji;
fs/gfs2/super.c +7 -9
@@ -167,7 +167,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)if (error)return error; - error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_SHARED ,0 , + error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_SHARED ,GL_EXACT , &freeze_gh);if (error) goto fail_threads;
@@ -203,7 +203,6 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)return 0 ; fail: - freeze_gh.gh_flags |=GL_NOCACHE ;gfs2_glock_dq_uninit (&freeze_gh); fail_threads:if (sdp->sd_quotad_process)
@@ -430,7 +429,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp) } error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_EXCLUSIVE , -GL_NOCACHE , &sdp->sd_freeze_gh); +0 , &sdp->sd_freeze_gh);if (error) goto out;
@@ -613,13 +612,14 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) !gfs2_glock_is_locked_by_me(sdp->sd_freeze_gl)) {if (!log_write_allowed) { error =gfs2_glock_nq_init (sdp->sd_freeze_gl, -LM_ST_SHARED ,GL_NOCACHE | -LM_FLAG_TRY , &freeze_gh); +LM_ST_SHARED , +LM_FLAG_TRY |GL_EXACT , + &freeze_gh);if (error ==GLR_TRYFAILED ) error =0 ; }else { error =gfs2_glock_nq_init (sdp->sd_freeze_gl, -LM_ST_SHARED ,GL_NOCACHE , +LM_ST_SHARED ,GL_EXACT , &freeze_gh);if (error && !gfs2_withdrawn (sdp))return error;
@@ -761,7 +761,7 @@ void gfs2_freeze_func(struct work_struct *work)struct super_block *sb = sdp->sd_vfs;atomic_inc (&sb->s_active); - error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_SHARED ,0 , + error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_SHARED ,GL_EXACT , &freeze_gh);if (error) {fs_info (sdp,"GFS2: couldn't get freeze lock : %d\n" , error);
@@ -774,8 +774,6 @@ void gfs2_freeze_func(struct work_struct *work) error);gfs2_assert_withdraw (sdp,0 ); } -if (!test_bit (SDF_JOURNAL_LIVE , &sdp->sd_flags)) - freeze_gh.gh_flags |=GL_NOCACHE ;gfs2_glock_dq_uninit (&freeze_gh); }deactivate_super (sb);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 15/244 tcp: make sure listeners dont initialize congestion-control state
In reply to Greg Kroah-HartmanFrom: Christoph Paasch <[email protected]>
[ Upstream commit ce69e563b325f620863830c246a8698ccea52048 ]
syzkaller found its way into setsockopt with TCP_CONGESTION "cdg". tcp_cdg_init() does a kcalloc to store the gradients. As sk_clone_lock just copies all the memory, the allocated pointer will be copied as well, if the app called setsockopt(..., TCP_CONGESTION) on the listener. If now the socket will be destroyed before the congestion-control has properly been initialized (through a call to tcp_init_transfer), we will end up freeing memory that does not belong to that particular socket, opening the door to a double-free:
[ 11.413102] ================================================================== [ 11.414181] BUG: KASAN: double-free or invalid-free in tcp_cleanup_congestion_control+0x58/0xd0 [ 11.415329] [ 11.415560] CPU: 3 PID: 4884 Comm: syz-executor.5 Not tainted 5.8.0-rc2 #80 [ 11.416544] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [ 11.418148] Call Trace: [ 11.418534] <IRQ> [ 11.418834] dump_stack+0x7d/0xb0 [ 11.419297] print_address_description.constprop.0+0x1a/0x210 [ 11.422079] kasan_report_invalid_free+0x51/0x80 [ 11.423433] __kasan_slab_free+0x15e/0x170 [ 11.424761] kfree+0x8c/0x230 [ 11.425157] tcp_cleanup_congestion_control+0x58/0xd0 [ 11.425872] tcp_v4_destroy_sock+0x57/0x5a0 [ 11.426493] inet_csk_destroy_sock+0x153/0x2c0 [ 11.427093] tcp_v4_syn_recv_sock+0xb29/0x1100 [ 11.427731] tcp_get_cookie_sock+0xc3/0x4a0 [ 11.429457] cookie_v4_check+0x13d0/0x2500 [ 11.433189] tcp_v4_do_rcv+0x60e/0x780 [ 11.433727] tcp_v4_rcv+0x2869/0x2e10 [ 11.437143] ip_protocol_deliver_rcu+0x23/0x190 [ 11.437810] ip_local_deliver+0x294/0x350 [ 11.439566] __netif_receive_skb_one_core+0x15d/0x1a0 [ 11.441995] process_backlog+0x1b1/0x6b0 [ 11.443148] net_rx_action+0x37e/0xc40 [ 11.445361] __do_softirq+0x18c/0x61a [ 11.445881] asm_call_on_stack+0x12/0x20 [ 11.446409] </IRQ> [ 11.446716] do_softirq_own_stack+0x34/0x40 [ 11.447259] do_softirq.part.0+0x26/0x30 [ 11.447827] __local_bh_enable_ip+0x46/0x50 [ 11.448406] ip_finish_output2+0x60f/0x1bc0 [ 11.450109] __ip_queue_xmit+0x71c/0x1b60 [ 11.451861] __tcp_transmit_skb+0x1727/0x3bb0 [ 11.453789] tcp_rcv_state_process+0x3070/0x4d3a [ 11.456810] tcp_v4_do_rcv+0x2ad/0x780 [ 11.457995] __release_sock+0x14b/0x2c0 [ 11.458529] release_sock+0x4a/0x170 [ 11.459005] __inet_stream_connect+0x467/0xc80 [ 11.461435] inet_stream_connect+0x4e/0xa0 [ 11.462043] __sys_connect+0x204/0x270 [ 11.465515] __x64_sys_connect+0x6a/0xb0 [ 11.466088] do_syscall_64+0x3e/0x70 [ 11.466617] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 11.467341] RIP: 0033:0x7f56046dc469 [ 11.467844] Code: Bad RIP value. [ 11.468282] RSP: 002b:00007f5604dccdd8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a [ 11.469326] RAX: ffffffffffffffda RBX: 000000000068bf00 RCX: 00007f56046dc469 [ 11.470379] RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000004 [ 11.471311] RBP: 00000000ffffffff R08: 0000000000000000 R09: 0000000000000000 [ 11.472286] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 11.473341] R13: 000000000041427c R14: 00007f5604dcd5c0 R15: 0000000000000003 [ 11.474321] [ 11.474527] Allocated by task 4884: [ 11.475031] save_stack+0x1b/0x40 [ 11.475548] __kasan_kmalloc.constprop.0+0xc2/0xd0 [ 11.476182] tcp_cdg_init+0xf0/0x150 [ 11.476744] tcp_init_congestion_control+0x9b/0x3a0 [ 11.477435] tcp_set_congestion_control+0x270/0x32f [ 11.478088] do_tcp_setsockopt.isra.0+0x521/0x1a00 [ 11.478744] __sys_setsockopt+0xff/0x1e0 [ 11.479259] __x64_sys_setsockopt+0xb5/0x150 [ 11.479895] do_syscall_64+0x3e/0x70 [ 11.480395] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 11.481097] [ 11.481321] Freed by task 4872: [ 11.481783] save_stack+0x1b/0x40 [ 11.482230] __kasan_slab_free+0x12c/0x170 [ 11.482839] kfree+0x8c/0x230 [ 11.483240] tcp_cleanup_congestion_control+0x58/0xd0 [ 11.483948] tcp_v4_destroy_sock+0x57/0x5a0 [ 11.484502] inet_csk_destroy_sock+0x153/0x2c0 [ 11.485144] tcp_close+0x932/0xfe0 [ 11.485642] inet_release+0xc1/0x1c0 [ 11.486131] __sock_release+0xc0/0x270 [ 11.486697] sock_close+0xc/0x10 [ 11.487145] __fput+0x277/0x780 [ 11.487632] task_work_run+0xeb/0x180 [ 11.488118] __prepare_exit_to_usermode+0x15a/0x160 [ 11.488834] do_syscall_64+0x4a/0x70 [ 11.489326] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Wei Wang fixed a part of these CDG-malloc issues with commit c12014440750 ("tcp: memset ca_priv data to 0 properly").
This patch here fixes the listener-scenario: We make sure that listeners setting the congestion-control through setsockopt won't initialize it (thus CDG never allocates on listeners). For those who use AF_UNSPEC to reuse a socket, tcp_disconnect() is changed to cleanup afterwards.
(The issue can be reproduced at least down to v4.4.x.)
--- net/ipv4/tcp.c | 3 +++ net/ipv4/tcp_cong.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +3 -0
@@ -2635,6 +2635,9 @@ int tcp_disconnect(struct sock *sk, int tp->window_clamp =0 ; tp->delivered =0 ; tp->delivered_ce =0 ; +if (icsk->icsk_ca_ops->release) + icsk->icsk_ca_ops->release (sk); +memset (icsk->icsk_ca_priv,0 ,sizeof (icsk->icsk_ca_priv));tcp_set_ca_state (sk, TCP_CA_Open); tp->is_sack_reneg =0 ;tcp_clear_retrans (tp);
net/ipv4/tcp_cong.c +1 -1
@@ -197,7 +197,7 @@ static void tcp_reinit_congestion_contro icsk->icsk_ca_setsockopt =1 ;memset (icsk->icsk_ca_priv,0 ,sizeof (icsk->icsk_ca_priv)); -if (sk->sk_state !=TCP_CLOSE ) +if (!((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN )))tcp_init_congestion_control (sk); }
Greg Kroah-Hartman
maintainerPATCH 37/244 thermal/drivers: imx: Fix missing of_node_put() at probe time
In reply to Greg Kroah-HartmanFrom: Anson Huang <[email protected]>
[ Upstream commit b45fd13be340e4ed0a2a9673ba299eb2a71ba829 ]
After finishing using cpu node got from of_get_cpu_node(), of_node_put() needs to be called.
--- drivers/thermal/imx_thermal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/thermal/imx_thermal.c +4 -3
@@ -649,7 +649,7 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match);static int imx_thermal_register_legacy_cooling (struct imx_thermal_data *data) {struct device_node *np; -int ret; +int ret =0 ; data->policy =cpufreq_cpu_get (0 );if (!data->policy) {
@@ -664,11 +664,12 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)if (IS_ERR (data->cdev)) { ret =PTR_ERR (data->cdev);cpufreq_cpu_put (data->policy); -return ret; } } -return 0 ; +of_node_put (np); + +return ret; }static void imx_thermal_unregister_legacy_cooling (struct imx_thermal_data *data)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 10/244 net: qrtr: free flow in __qrtr_node_release
In reply to Greg Kroah-HartmanFrom: Carl Huang <[email protected]>
[ Upstream commit 28541f3d324f6de1e545e2875283b6cef95c5d36 ]
The flow is allocated in qrtr_tx_wait, but not freed when qrtr node is released. (*slot) becomes NULL after radix_tree_iter_delete is called in __qrtr_node_release. The fix is to save (*slot) to a vairable and then free it.
This memory leak is catched when kmemleak is enabled in kernel, the report looks like below:
unreferenced object 0xffffa0de69e08420 (size 32):
comm "kworker/u16:3", pid 176, jiffies 4294918275 (age 82858.876s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 28 84 e0 69 de a0 ff ff ........(..i....
28 84 e0 69 de a0 ff ff 03 00 00 00 00 00 00 00 (..i............
backtrace:
[<00000000e252af0a>] qrtr_node_enqueue+0x38e/0x400 [qrtr]
[<000000009cea437f>] qrtr_sendmsg+0x1e0/0x2a0 [qrtr]
[<000000008bddbba4>] sock_sendmsg+0x5b/0x60
[<0000000003beb43a>] qmi_send_message.isra.3+0xbe/0x110 [qmi_helpers]
[<000000009c9ae7de>] qmi_send_request+0x1c/0x20 [qmi_helpers]--- net/qrtr/qrtr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/qrtr/qrtr.c +3 -1
@@ -166,6 +166,7 @@ static void __qrtr_node_release(struct k { struct qrtr_node *node = container_of(kref, struct qrtr_node, ref);struct radix_tree_iter iter; +struct qrtr_tx_flow *flow;unsigned long flags;void __rcu **slot;
@@ -181,8 +182,9 @@ static void __qrtr_node_release(struct k/* Free tx flow counters */ radix_tree_for_each_slot (slot, &node->qrtr_tx_flow, &iter,0 ) { + flow = *slot;radix_tree_iter_delete (&node->qrtr_tx_flow, &iter, slot); -kfree (*slot); +kfree (flow); }kfree (node); }
Greg Kroah-Hartman
maintainerPATCH 38/244 ACPI: DPTF: Add battery participant for TigerLake
In reply to Greg Kroah-HartmanFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit 1e05daca83bb42cde569f75f3bd7c8828b1ef30f ]
Add DPTF battery participant ACPI ID for platforms based on the Intel TigerLake SoC.
--- drivers/acpi/dptf/dptf_power.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/dptf/dptf_power.c +1 -0
@@ -99,6 +99,7 @@ static int dptf_power_remove(struct platform_device *pdev)static const struct acpi_device_id int3407_device_ids[] = { {"INT3407" ,0 }, {"INTC1047" ,0 }, + {"INTC1050" ,0 }, {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3407_device_ids);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 9/244 net: dsa: microchip: set the correct number of ports
In reply to Greg Kroah-HartmanFrom: Codrin Ciubotariu <[email protected]>
[ Upstream commit af199a1a9cb02ec0194804bd46c174b6db262075 ]
The number of ports is incorrectly set to the maximum available for a DSA switch. Even if the extra ports are not used, this causes some functions to be called later, like port_disable() and port_stp_state_set(). If the driver doesn't check the port index, it will end up modifying unknown registers.
--- drivers/net/dsa/microchip/ksz8795.c | 3 +++ drivers/net/dsa/microchip/ksz9477.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/dsa/microchip/ksz8795.c +3 -0
@@ -1271,6 +1271,9 @@ static int ksz8795_switch_init(struct ks/* set the real number of ports */ dev->ds->num_ports = dev->port_cnt; +/* set the real number of ports */ + dev->ds->num_ports = dev->port_cnt; +return 0 ; }
drivers/net/dsa/microchip/ksz9477.c +3 -0
@@ -516,6 +516,9 @@ static int ksz9477_port_vlan_filtering(s PORT_VLAN_LOOKUP_VID_0, false); } +/* set the real number of ports */ + dev->ds->num_ports = dev->port_cnt; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 29/244 mptcp: fix DSS map generation on fin retransmission
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 9c29e36152748fd623fcff6cc8f538550f9eeafc ]
The RFC 8684 mandates that no-data DATA FIN packets should carry a DSS with 0 sequence number and data len equal to 1. Currently, on FIN retransmission we re-use the existing mapping; if the previous fin transmission was part of a partially acked data packet, we could end-up writing in the egress packet a non-compliant DSS.
The above will be detected by a "Bad mapping" warning on the receiver side.
This change addresses the issue explicitly checking for 0 len packet when adding the DATA_FIN option.
--- net/mptcp/options.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/options.c +3 -3
@@ -449,9 +449,9 @@ static bool mptcp_established_options_mp }static void mptcp_write_data_fin (struct mptcp_subflow_context *subflow, -struct mptcp_ext *ext) +struct sk_buff *skb,struct mptcp_ext *ext) { -if (!ext->use_map) { +if (!ext->use_map || !skb->len) {/* RFC6824 requires a DSS mapping with specific values * if DATA_FIN is set but no data payload is mapped */
@@ -503,7 +503,7 @@ static bool mptcp_established_options_ds opts->ext_copy = *mpext;if (skb && tcp_fin && subflow->data_fin_tx_enable) -mptcp_write_data_fin (subflow, &opts->ext_copy); +mptcp_write_data_fin (subflow, skb, &opts->ext_copy); ret = true; }
Greg Kroah-Hartman
maintainerPATCH 20/244 tcp: md5: allow changing MD5 keys in all socket states
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 1ca0fafd73c5268e8fc4b997094b8bb2bfe8deea ]
This essentially reverts commit 721230326891 ("tcp: md5: reject TCP_MD5SIG or TCP_MD5SIG_EXT on established sockets")
Mathieu reported that many vendors BGP implementations can actually switch TCP MD5 on established flows.
Quoting Mathieu :
Here is a list of a few network vendors along with their behavior with respect to TCP MD5:
- Cisco: Allows for password to be changed, but within the hold-down
timer (~180 seconds).
- Juniper: When password is initially set on active connection it will reset, but after that any subsequent password changes no network resets.
- Nokia: No notes on if they flap the tcp connection or not.
- Ericsson/RedBack: Allows for 2 password (old/new) to co-exist until both sides are ok with new passwords.
- Meta-Switch: Expects the password to be set before a connection is attempted, but no further info on whether they reset the TCP connection on a change.
- Avaya: Disable the neighbor, then set password, then re-enable.
- Zebos: Would normally allow the change when socket connected.
We can revert my prior change because commit 9424e2e7ad93 ("tcp: md5: fix potential overestimation of TCP option space") removed the leak of 4 kernel bytes to the wire that was the main reason for my patch.
While doing my investigations, I found a bug when a MD5 key is changed, leading to these commits that stable teams want to consider before backporting this revert :
Commit 6a2febec338d ("tcp: md5: add missing memory barriers in tcp_md5_do_add()/tcp_md5_hash_key()") Commit e6ced831ef11 ("tcp: md5: refine tcp_md5_do_add()/tcp_md5_hash_key() barriers")
--- net/ipv4/tcp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/ipv4/tcp.c +1 -4
@@ -3093,10 +3093,7 @@ static int do_tcp_setsockopt(struct sock#ifdef CONFIG_TCP_MD5SIG case TCP_MD5SIG :case TCP_MD5SIG_EXT : -if ((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN )) - err = tp->af_specific->md5_parse (sk, optname, optval, optlen); -else - err = -EINVAL ; + err = tp->af_specific->md5_parse (sk, optname, optval, optlen);break ;#endif case TCP_USER_TIMEOUT :
Greg Kroah-Hartman
maintainerPATCH 18/244 vlan: consolidate VLAN parsing code and limit max parsing depth
In reply to Greg Kroah-HartmanFrom: "Toke H�iland-J�rgensen" <[email protected]>
[ Upstream commit 469aceddfa3ed16e17ee30533fae45e90f62efd8 ]
Toshiaki pointed out that we now have two very similar functions to extract the L3 protocol number in the presence of VLAN tags. And Daniel pointed out that the unbounded parsing loop makes it possible for maliciously crafted packets to loop through potentially hundreds of tags.
Fix both of these issues by consolidating the two parsing functions and limiting the VLAN tag parsing to a max depth of 8 tags. As part of this, switch over __vlan_get_protocol() to use skb_header_pointer() instead of pskb_may_pull(), to avoid the possible side effects of the latter and keep the skb pointer 'const' through all the parsing functions.
v2:
- Use limit of 8 tags instead of 32 (matching XMIT_RECURSION_LIMIT)
--- include/linux/if_vlan.h | 57 ++++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 35 deletions(-)
include/linux/if_vlan.h +22 -35
@@ -25,6 +25,8 @@#define VLAN_ETH_DATA_LEN 1500/* Max. octets in payload */ #define VLAN_ETH_FRAME_LEN 1518/* Max. octets in frame sans FCS */ +#define VLAN_MAX_DEPTH 8/* Max. number of nested VLAN tags parsed */ +/* * struct vlan_hdr - vlan header * @h_vlan_TCI: priority and VLAN ID
@@ -308,34 +310,6 @@ static inline bool eth_type_vlan(__be16 } } -/* A getter for the SKB protocol field which will handle VLAN tags consistently -* whether VLAN acceleration is enabled or not. -*/ -static inline __be16 skb_protocol (const struct sk_buff *skb,bool skip_vlan) -{ -unsigned int offset =skb_mac_offset (skb) +sizeof (struct ethhdr ); -__be16 proto = skb->protocol; - -if (!skip_vlan) -/* VLAN acceleration strips the VLAN header from the skb and -* moves it to skb->vlan_proto -*/ -return skb_vlan_tag_present (skb) ? skb->vlan_proto : proto; - -while (eth_type_vlan (proto)) { -struct vlan_hdr vhdr, *vh; - - vh =skb_header_pointer (skb, offset,sizeof (vhdr), &vhdr); -if (!vh) -break ; - - proto = vh->h_vlan_encapsulated_proto; - offset +=sizeof (vhdr); - } - -return proto; -} -static inline bool vlan_hw_offload_capable (netdev_features_t features,__be16 proto) {
@@ -605,10 +579,10 @@ static inline int vlan_get_tag(const str* Returns the EtherType of the packet, regardless of whether it is * vlan encapsulated (normal or hardware accelerated) or not. */ -static inline __be16 __vlan_get_protocol (struct sk_buff *skb,__be16 type, +static inline __be16 __vlan_get_protocol (const struct sk_buff *skb,__be16 type,int *depth) { -unsigned int vlan_depth = skb->mac_len; +unsigned int vlan_depth = skb->mac_len, parse_depth =VLAN_MAX_DEPTH ;/* if type is 802.1Q/AD then the header should already be * present at mac_len - VLAN_HLEN (if mac_len > 0), or at
@@ -623,13 +597,12 @@ static inline __be16 __vlan_get_protocol vlan_depth =ETH_HLEN ; }do { -struct vlan_hdr *vh; +struct vlan_hdr vhdr, *vh; -if (unlikely (!pskb_may_pull (skb, - vlan_depth +VLAN_HLEN ))) + vh =skb_header_pointer (skb, vlan_depth,sizeof (vhdr), &vhdr); +if (unlikely (!vh || !--parse_depth))return 0 ; - vh = (struct vlan_hdr *)(skb->data + vlan_depth); type = vh->h_vlan_encapsulated_proto; vlan_depth +=VLAN_HLEN ; }while (eth_type_vlan (type));
@@ -648,11 +621,25 @@ static inline __be16 __vlan_get_protocol* Returns the EtherType of the packet, regardless of whether it is * vlan encapsulated (normal or hardware accelerated) or not. */ -static inline __be16 vlan_get_protocol (struct sk_buff *skb) +static inline __be16 vlan_get_protocol (const struct sk_buff *skb) {return __vlan_get_protocol (skb, skb->protocol,NULL ); } +/* A getter for the SKB protocol field which will handle VLAN tags consistently +* whether VLAN acceleration is enabled or not. +*/ +static inline __be16 skb_protocol (const struct sk_buff *skb,bool skip_vlan) +{ +if (!skip_vlan) +/* VLAN acceleration strips the VLAN header from the skb and +* moves it to skb->vlan_proto +*/ +return skb_vlan_tag_present (skb) ? skb->vlan_proto : skb->protocol; + +return vlan_get_protocol (skb); +} +static inline void vlan_set_encap_proto (struct sk_buff *skb,struct vlan_hdr *vhdr) {
Re: [PATCH 5.7 021/244] cgroup: fix cgroup_sk_alloc() for sk_clone_lock()
In reply to Greg Kroah-HartmanQuoted 3 lines · Greg Kroah-Hartman
From: Cong Wang <[email protected]>
[ Upstream commit
ad0f75e5f57ccbceec13274e1e242f2b5a6397ed]
Hi Greg!
There is a fix for this commit:14b032b8f8fc ("cgroup: Fix sock_cgroup_data on big-endian.")
Can you, please, grab it too?
Thanks!
Quoted 162 lines
When we clone a socket in
sk_clone_lock(), itssk_cgrp_datais copied, so the cgroup refcnt must be taken too. And, unlike thesk_alloc()path,sock_update_netprioidx()is not called here. Therefore, it is safe and necessary to grab the cgroup refcnt even whencgroup_sk_allocis disabled.
sk_clone_lock()is in BH context anyway, thein_interrupt()would terminate this function if called there. And forsk_alloc()skcd->valis always zero. So it's safe to factor out the code to make it more readable.The global variable '
cgroup_sk_alloc_disabled' is used to determine whether to take these reference counts. It is impossible to make the reference counting correct unless we save this bit of information inskcd->val. So, add a new bit there to record whether the socket has already taken the reference counts. This obviously relies onkmalloc()to align cgroup pointers to at least 4 bytes,ARCH_KMALLOC_MINALIGNis certainly larger than that.This bug seems to be introduced since the beginning, commit
d979a39d7242("cgroup: duplicate cgroup reference when cloning sockets") tried to fix it but not compeletely. It seems not easy to trigger until the recent commit090e28b229af
("netprio_cgroup: Fix unlimited memory leak of v2 cgroups") was merged.Fixes bd1060a1d671 ("sock, cgroup: add sock->sk_cgroup")Reported-by Cameron Berkenpas <[email protected]>Reported-by Peter Geis <[email protected]>Reported-by Lu Fengqi <[email protected]>Reported-by Daniël Sonck <[email protected]>Reported-by Zhang Qiang <[email protected]>Tested-by Cameron Berkenpas <[email protected]>Tested-by Peter Geis <[email protected]>Tested-by Thomas Lamprecht <[email protected]>Cc Daniel Borkmann <[email protected]>Cc Zefan Li <[email protected]>Cc Tejun Heo <[email protected]>Cc Roman Gushchin <[email protected]>Signed-off-by Cong Wang <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/cgroup-defs.h | 6 ++++-- include/linux/cgroup.h | 4 +++- kernel/cgroup/cgroup.c | 31 +++++++++++++++++++------------ net/core/sock.c | 2 +- 4 files changed, 27 insertions(+), 16 deletions(-)include/linux/cgroup-defs.h +4
-2@@ -790,7 +790,8 @@ struct sock_cgroup_data { union { #ifdef __LITTLE_ENDIAN struct { - u8 is_data; + u8 is_data : 1; + u8 no_refcnt : 1; u8 padding; u16 prioidx; u32 classid;@@ -800,7 +801,8 @@ struct sock_cgroup_data {u32 classid;u16 prioidx;u8 padding; - u8 is_data; + u8 no_refcnt : 1; + u8 is_data : 1; } __packed;#endif u64 val;include/linux/cgroup.h +3
-1@@ -822,6 +822,7 @@ extern spinlock_t cgroup_sk_update_lock;void cgroup_sk_alloc_disable (void );void cgroup_sk_alloc (struct sock_cgroup_data *skcd); +void cgroup_sk_clone (struct sock_cgroup_data *skcd);void cgroup_sk_free (struct sock_cgroup_data *skcd);static inline struct cgroup *sock_cgroup_ptr (struct sock_cgroup_data *skcd)@@ -835,7 +836,7 @@ static inline struct cgroup *sock_cgroup*/ v =READ_ONCE (skcd->val); -if (v &1 ) +if (v &3 )return &cgrp_dfl_root.cgrp;return (struct cgroup *)(unsigned long )v ?: &cgrp_dfl_root.cgrp;@@ -847,6 +848,7 @@ static inline struct cgroup *sock_cgroup#else /* CONFIG_CGROUP_DATA */ static inline void cgroup_sk_alloc (struct sock_cgroup_data *skcd) {} +static inline void cgroup_sk_clone (struct sock_cgroup_data *skcd) {}static inline void cgroup_sk_free (struct sock_cgroup_data *skcd) {}#endif /* CONFIG_CGROUP_DATA */ kernel/cgroup/cgroup.c +19
-12@@ -6447,18 +6447,8 @@ void cgroup_sk_alloc_disable(void)void cgroup_sk_alloc (struct sock_cgroup_data *skcd) { -if (cgroup_sk_alloc_disabled) -return ; - -/* Socket clone path */ -if (skcd->val) { -/* -* We might be cloning a socket which is left in an empty -* cgroup and the cgroup might have already been rmdir'd. -* Don't use cgroup_get_live(). -*/ -cgroup_get (sock_cgroup_ptr (skcd)); -cgroup_bpf_get (sock_cgroup_ptr (skcd)); +if (cgroup_sk_alloc_disabled) { + skcd->no_refcnt =1 ;return ; }@@ -6483,10 +6473,27 @@ void cgroup_sk_alloc(struct sock_cgroup_rcu_read_unlock (); } +void cgroup_sk_clone (struct sock_cgroup_data *skcd) +{ +if (skcd->val) { +if (skcd->no_refcnt) +return ; +/* +* We might be cloning a socket which is left in an empty +* cgroup and the cgroup might have already been rmdir'd. +* Don't use cgroup_get_live(). +*/ +cgroup_get (sock_cgroup_ptr (skcd)); +cgroup_bpf_get (sock_cgroup_ptr (skcd)); + } +} +void cgroup_sk_free (struct sock_cgroup_data *skcd) {struct cgroup *cgrp =sock_cgroup_ptr (skcd); +if (skcd->no_refcnt) +return ;cgroup_bpf_put (cgrp);cgroup_put (cgrp); }net/core/sock.c +1
-1@@ -1837,7 +1837,7 @@ struct sock *sk_clone_lock(const struct/* sk->sk_memcg will be populated at accept() time */ newsk->sk_memcg =NULL ; -cgroup_sk_alloc (&newsk->sk_cgrp_data); +cgroup_sk_clone (&newsk->sk_cgrp_data);rcu_read_lock (); filter =rcu_dereference (sk->sk_filter);
Re: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
In reply to Greg Kroah-HartmanRISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.
Quoted 33 lines · Greg Kroah-Hartman
From: Atish Patra <[email protected]>
commit
0e2c09011d4de4161f615ff860a605a9186cf62aupstream.As per
walk_page_rangedocumentation, mmap lock should be acquired by the caller before invokingwalk_page_range.mmap_assert_lockedgets triggered without that. The details can be found here.http://lists.infradead.org/pipermail/linux-riscv/2020-June/010335.html
Fixes 395a21ff859c(riscv: add ARCH_HAS_SET_DIRECT_MAP support)Signed-off-by Atish Patra <[email protected]>Reviewed-by Michel Lespinasse <[email protected]>Reviewed-by Zong Li <[email protected]>Signed-off-by Palmer Dabbelt <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/riscv/mm/pageattr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)arch/riscv/mm/pageattr.c +1
-0@@ -151,6 +151,7 @@ int set_memory_nx(unsigned long addr, inint set_direct_map_invalid_noflush (struct page *page) { +int ret;unsigned long start = (unsigned long )page_address (page);unsigned long end = start +PAGE_SIZE ;struct pageattr_masks masks = {
arch/riscv/mm/pageattr.c int set_direct_map_invalid_noflush(struc · line 164
Quoted 7 lines
arch/riscv/mm/pageattr.c +3
-1@@ -158,11 +159,16 @@ int set_direct_map_invalid_noflush(struc .clear_mask = __pgprot(_PAGE_PRESENT) }; -return walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_lock (&init_mm); + ret =walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_unlock (&init_mm);
make -sk KBUILD_BUILD_USER=TuxBuild -C/linux ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- HOSTCC=gcc CC="sccache riscv64-linux-gnu-gcc" O=build defconfig
#
#
make -sk KBUILD_BUILD_USER=TuxBuild -C/linux -j32 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- HOSTCC=gcc CC="sccache riscv64-linux-gnu-gcc" O=build
#../arch/riscv/mm/pageattr.c: In function ‘set_direct_map_invalid_noflush’:../arch/riscv/mm/pageattr.c:162:2: error: implicit declaration of function ‘mmap_read_lock’; did you mean ‘_raw_read_lock’? [-Werror=implicit-function-declaration]
162 | mmap_read_lock(&init_mm);
| ^~~~~~~~~~~~~~
| _raw_read_lock
../arch/riscv/mm/pageattr.c:164:2: error: implicit declaration of
function ‘mmap_read_unlock’; did you mean ‘_raw_read_unlock’?
[-Werror=implicit-function-declaration]
164 | mmap_read_unlock(&init_mm);
| ^~~~~~~~~~~~~~~~
| _raw_read_unlockcc1: some warnings being treated as errors
Quoted 14 lines
arch/riscv/mm/pageattr.c +3
-0+ +return ret; }int set_direct_map_default_noflush (struct page *page) { +int ret;unsigned long start = (unsigned long )page_address (page);unsigned long end = start +PAGE_SIZE ;struct pageattr_masks masks = {@@ -170,7 +176,11 @@ int set_direct_map_default_noflush(struc .clear_mask = __pgprot(0) };
arch/riscv/mm/pageattr.c int set_direct_map_default_noflush(struc · line 186
Quoted 10 lines
arch/riscv/mm/pageattr.c +5
-1-return walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_lock (&init_mm); + ret =walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_unlock (&init_mm); + +return ret; }void __kernel_map_pages (struct page *page,int numpages,int enable)
ref:
full build log with default config.
https://gitlab.com/Linaro/lkft/kernel-runs/-/jobs/647154950
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Re: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
Quoted 3 lines · Naresh Kamboju
RISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.
Sorry for the compilation issue.
mmap_read_lock was intrdouced in the following commit.
commit 9740ca4e95b4
Author: Michel Lespinasse <[email protected]> Date: Mon Jun 8 21:33:14 2020 -0700
mmap locking API: initial implementation as rwsem wrappers
The following two commits replaced the usage of mmap_sem rwsem calls with mmap_lock.
d8ed45c5dcd4 (mmap locking API: use coccinelle to convert mmap_sem rwsem call sites)89154dd5313f (mmap locking API: convert mmap_sem call sites missed by coccinelle)
The first commit is not present in stale 5.7-y for obvious reasons.
Do we need to send a separate patch only for stable branch with mmap_sem ? I am not sure if that will cause a conflict again in future.
Quoted 103 lines
Quoted 34 lines · Greg Kroah-Hartman
From: Atish Patra <[email protected]>
commit
0e2c09011d4de4161f615ff860a605a9186cf62aupstream.As per
walk_page_rangedocumentation, mmap lock should be acquired by the
caller before invokingwalk_page_range.mmap_assert_lockedgets triggered
without that. The details can be found here.http://lists.infradead.org/pipermail/linux-riscv/2020-June/010335.html
Fixes 395a21ff859c(riscv: add ARCH_HAS_SET_DIRECT_MAP support)Signed-off-by Atish Patra <[email protected]>Reviewed-by Michel Lespinasse <[email protected]>Reviewed-by Zong Li <[email protected]>Signed-off-by Palmer Dabbelt <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/riscv/mm/pageattr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)arch/riscv/mm/pageattr.c +1
-0@@ -151,6 +151,7 @@ int set_memory_nx(unsigned long addr, inint set_direct_map_invalid_noflush (struct page *page) { +int ret;unsigned long start = (unsigned long )page_address (page);unsigned long end = start +PAGE_SIZE ;struct pageattr_masks masks = {arch/riscv/mm/pageattr.c int set_direct_map_invalid_noflush(struc · line 166
Quoted 9 lines
arch/riscv/mm/pageattr.c +3
-1@@ -158,11 +159,16 @@ int set_direct_map_invalid_noflush(struc .clear_mask = __pgprot(_PAGE_PRESENT) }; -return walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_lock (&init_mm); + ret =walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_unlock (&init_mm);make -sk KBUILD_BUILD_USER=TuxBuild -C/linux ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- HOSTCC=gcc CC="sccache riscv64-linux-gnu-gcc" O=build defconfig
#
#
make -sk KBUILD_BUILD_USER=TuxBuild -C/linux -j32 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- HOSTCC=gcc CC="sccache riscv64-linux-gnu-gcc" O=build
#../arch/riscv/mm/pageattr.c: In function ‘set_direct_map_invalid_noflush’:../arch/riscv/mm/pageattr.c:162:2: error: implicit declaration of function ‘mmap_read_lock’; did you mean ‘_raw_read_lock’? [-Werror=implicit-function-declaration]162 | mmap_read_lock(&init_mm); | ^~~~~~~~~~~~~~ | _raw_read_lock ../arch/riscv/mm/pageattr.c:164:2: error: implicit declaration of function ‘mmap_read_unlock’; did you mean ‘_raw_read_unlock’? [-Werror=implicit-function-declaration] 164 | mmap_read_unlock(&init_mm); | ^~~~~~~~~~~~~~~~ | _raw_read_unlockcc1: some warnings being treated as errors
Quoted 24 lines
arch/riscv/mm/pageattr.c +3
-0+ +return ret; }int set_direct_map_default_noflush (struct page *page) { +int ret;unsigned long start = (unsigned long )page_address (page);unsigned long end = start + PAGE_SIZE; struct pageattr_masks masks = {arch/riscv/mm/pageattr.c +5
-1@@ -170,7 +176,11 @@ int set_direct_map_default_noflush(struc .clear_mask = __pgprot(0) }; -return walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_lock (&init_mm); + ret =walk_page_range (&init_mm, start, end, &pageattr_ops, &masks); +mmap_read_unlock (&init_mm); + +return ret; }Quoted 3 lines
void __kernel_map_pages(struct page *page, int numpages, int
enable)ref:
full build log with default config.
https://gitlab.com/Linaro/lkft/kernel-runs/-/jobs/647154950
Signature · 2 lines
Regards, Atish
[email protected]
maintainerRe: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
Quoted 23 lines · Atish Patra
Quoted 3 lines · Naresh Kamboju
RISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.Sorry for the compilation issue.
mmap_read_lockwas intrdouced in the following commit.commit
9740ca4e95b4Author: Michel Lespinasse <[email protected]> Date: Mon Jun 8 21:33:14 2020 -0700mmap locking API: initial implementation as rwsem wrappers
The following two commits replaced the usage of
mmap_semrwsem calls withmmap_lock.
d8ed45c5dcd4(mmap locking API: use coccinelle to convertmmap_semrwsem call sites)89154dd5313f(mmap locking API: convertmmap_semcall sites missed by coccinelle)
Quoted 4 lines
The first commit is not present in stale 5.7-y for obvious reasons.
Do we need to send a separate patch only for stable branch with
mmap_sem? I am not sure if that will cause a conflict again in future.
I do not like taking odd backports, and would rather take the real patch that is upstream.
I will drop this patch from the tree now, so everyone can figure out what they want to do in the future :)
thanks,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 5.7 021/244] cgroup: fix cgroup_sk_alloc() for sk_clone_lock()
In reply to Roman GushchinQuoted 11 lines · Roman Gushchin
Quoted 3 lines · Greg Kroah-Hartman
From: Cong Wang <[email protected]>
[ Upstream commit
ad0f75e5f57ccbceec13274e1e242f2b5a6397ed]Hi Greg!
There is a fix for this commit:
14b032b8f8fc("cgroup: Fixsock_cgroup_dataon big-endian.")Can you, please, grab it too?
It is already queued up in this series :)
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.7.10 release. There are 244 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 Wed, 22 Jul 2020 15:27:31 +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.7.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.7.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.7:
11 builds: 11 pass, 0 fail
26 boots: 26 pass, 0 fail
56 tests: 56 pass, 0 failLinux version: 5.7.10-rc1-gd3c98742b46c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Cheers,
Thierry
Re: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
In reply to [email protected]Quoted 24 lines · Greg KH
Quoted 23 lines · Atish Patra
Quoted 3 lines · Naresh Kamboju
RISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.Sorry for the compilation issue.
mmap_read_lockwas intrdouced in the following commit.commit
9740ca4e95b4Author: Michel Lespinasse <[email protected]> Date: Mon Jun 8 21:33:14 2020 -0700mmap locking API: initial implementation as rwsem wrappers
The following two commits replaced the usage of
mmap_semrwsem calls withmmap_lock.
d8ed45c5dcd4(mmap locking API: use coccinelle to convertmmap_semrwsem call sites)89154dd5313f(mmap locking API: convertmmap_semcall sites missed by coccinelle)
Quoted 7 lines
Quoted 4 lines
The first commit is not present in stale 5.7-y for obvious reasons.
Do we need to send a separate patch only for stable branch with
mmap_sem? I am not sure if that will cause a conflict again in future.I do not like taking odd backports, and would rather take the real patch that is upstream.
I guess I'm a bit new to stable backports so I'm not sure what's expected here. The failing patch fixes a bug by using a new interface. The smallest diff fix for the stable kernels would be to construct a similar fix without the new interface, which in this case is very easy as the new interface just converted some generic locking calls to one-line functions. It seems somewhat circuitous to land that in Linus' tree, though, as it would require breaking our port before fixing it to use the old interfaces and then cleaning it up to use the new interfaces.
Are we expected to pull the new interface onto stable in addition to this fix? The new interface doesn't actually fix anything itself, but it would allow a functional kernel to be constructed that consisted of only backports from Linus' tree (which would also make further fixes easier). It seems safe to just pull in 9740ca4e95b4 ("mmap locking API: initial implementation as rwsem wrappers") before this failing patch, as in this case the new interface will function correctly with only a subset of callers having been converted. Of course that's not a generally true statement so I don't know if future code will behave that way, but pulling in those conversion patches is definitely unnecessary diff right now.
Quoted 2 lines
I will drop this patch from the tree now, so everyone can figure out what they want to do in the future :)
That certainly seems like the right way to go for now, thanks!
Greg KH
maintainerRe: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
Quoted 42 lines · Palmer Dabbelt
Quoted 24 lines · Greg KH
Quoted 23 lines · Atish Patra
Quoted 3 lines · Naresh Kamboju
RISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.Sorry for the compilation issue.
mmap_read_lockwas intrdouced in the following commit.commit
9740ca4e95b4Author: Michel Lespinasse <[email protected]> Date: Mon Jun 8 21:33:14 2020 -0700mmap locking API: initial implementation as rwsem wrappers
The following two commits replaced the usage of
mmap_semrwsem calls withmmap_lock.
d8ed45c5dcd4(mmap locking API: use coccinelle to convertmmap_semrwsem call sites)89154dd5313f(mmap locking API: convertmmap_semcall sites missed by coccinelle)Quoted 7 lines
Quoted 4 lines
The first commit is not present in stale 5.7-y for obvious reasons.
Do we need to send a separate patch only for stable branch with
mmap_sem? I am not sure if that will cause a conflict again in future.I do not like taking odd backports, and would rather take the real patch that is upstream.
I guess I'm a bit new to stable backports so I'm not sure what's expected here. The failing patch fixes a bug by using a new interface. The smallest diff fix for the stable kernels would be to construct a similar fix without the new interface, which in this case is very easy as the new interface just converted some generic locking calls to one-line functions. It seems somewhat circuitous to land that in Linus' tree, though, as it would require breaking our port before fixing it to use the old interfaces and then cleaning it up to use the new interfaces.
Quoted 1 line
Are we expected to pull the new interface onto stable in addition to this fix?
If it really does fix a big issue, yes, that is fine to do.
Quoted 3 lines
The new interface doesn't actually fix anything itself, but it would allow a functional kernel to be constructed that consisted of only backports from Linus' tree (which would also make further fixes easier).
That's fine.
Quoted 7 lines
It seems safe to
just pull in9740ca4e95b4("mmap locking API: initial implementation as rwsem wrappers") before this failing patch, as in this case the new interface will function correctly with only a subset of callers having been converted. Of course that's not a generally true statement so I don't know if future code will behave that way, but pulling in those conversion patches is definitely unnecessary diff right now.
If someone wants to send me a full set of the git ids that need to be pulled in, I will be glad to do so.
thanks,
greg k-h
Re: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
Quoted 56 lines · Greg KH
Quoted 55 lines · Palmer Dabbelt
Quoted 30 lines · Greg KH
Quoted 29 lines · Atish Patra
Quoted 3 lines · Naresh Kamboju
RISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.Sorry for the compilation issue.
mmap_read_lockwas intrdouced in the following commit.commit
9740ca4e95b4Author: Michel Lespinasse <[email protected]> Date: Mon Jun 8 21:33:14 2020 -0700mmap locking API: initial implementation as rwsem wrappers
The following two commits replaced the usage of
mmap_semrwsem calls
withmmap_lock.
d8ed45c5dcd4(mmap locking API: use coccinelle to convertmmap_sem
rwsem call sites)89154dd5313f(mmap locking API: convertmmap_semcall sites missed by
coccinelle)The first commit is not present in stale 5.7-y for obvious reasons.
Quoted 7 lines
Quoted 3 lines
Do we need to send a separate patch only for stable branch with
mmap_sem? I am not sure if that will cause a conflict again in future.I do not like taking odd backports, and would rather take the real patch
that is upstream.I guess I'm a bit new to stable backports so I'm not sure what's expected here.
The failing patch fixes a bug by using a new interface. The smallest diff fix
for the stable kernels would be to construct a similar fix without the new
interface, which in this case is very easy as the new interface just converted
some generic locking calls to one-line functions. It seems somewhat circuitous
to land that in Linus' tree, though, as it would require breaking our port
before fixing it to use the old interfaces and then cleaning it up to use the
new interfaces.
Quoted 5 lines
Quoted 2 lines
Are we expected to pull the new interface onto stable in addition to this fix?
If it really does fix a big issue, yes, that is fine to do.
The original issue was manifests only for certain rootfs with CONFIG_DEBUG_VM enabled in kernel. I am not sure if that qualfies for a big issue :). But there was a similar fix for OpenRISC as well.
+stafford (who fixed the issue for OpenRISC)
@stafford Was there a request to backport the fix to stable ?
I can combine all the git ids that needs to be pulled in.
Quoted 27 lines
Quoted 5 lines
The new interface doesn't actually fix anything itself, but it would allow a
functional kernel to be constructed that consisted of only backports from
Linus' tree (which would also make further fixes easier).That's fine.
Quoted 4 lines
It seems safe to
just pull in9740ca4e95b4("mmap locking API: initial implementation as rwsem
wrappers") before this failing patch, as in this case the newQuoted 8 lines
interface will
function correctly with only a subset of callers having been converted. Of
course that's not a generally true statement so I don't know if future code
will behave that way, but pulling in those conversion patches is definitely
unnecessary diff right now.If someone wants to send me a full set of the git ids that need to be pulled in, I will be glad to do so.
thanks,
greg k-h
Signature · 2 lines
Regards, Atish
Re: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
Quoted 63 lines · Atish Patra
Quoted 56 lines · Greg KH
Quoted 55 lines · Palmer Dabbelt
Quoted 30 lines · Greg KH
Quoted 29 lines · Atish Patra
Quoted 3 lines · Naresh Kamboju
RISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.Sorry for the compilation issue.
mmap_read_lockwas intrdouced in the following commit.commit
9740ca4e95b4Author: Michel Lespinasse <[email protected]> Date: Mon Jun 8 21:33:14 2020 -0700mmap locking API: initial implementation as rwsem wrappers
The following two commits replaced the usage of
mmap_semrwsem calls
withmmap_lock.
d8ed45c5dcd4(mmap locking API: use coccinelle to convertmmap_sem
rwsem call sites)89154dd5313f(mmap locking API: convertmmap_semcall sites missed by
coccinelle)The first commit is not present in stale 5.7-y for obvious reasons.
Quoted 7 lines
Quoted 3 lines
Do we need to send a separate patch only for stable branch with
mmap_sem? I am not sure if that will cause a conflict again in future.I do not like taking odd backports, and would rather take the real patch
that is upstream.I guess I'm a bit new to stable backports so I'm not sure what's expected here.
The failing patch fixes a bug by using a new interface. The smallest diff fix
for the stable kernels would be to construct a similar fix without the new
interface, which in this case is very easy as the new interface just converted
some generic locking calls to one-line functions. It seems somewhat circuitous
to land that in Linus' tree, though, as it would require breaking our port
before fixing it to use the old interfaces and then cleaning it up to use the
new interfaces.Quoted 5 lines
Quoted 2 lines
Are we expected to pull the new interface onto stable in addition to this fix?
If it really does fix a big issue, yes, that is fine to do.
Quoted 7 lines
The original issue was manifests only for certain rootfs with
CONFIG_DEBUG_VMenabled in kernel. I am not sure if that qualfies for a big issue :). But there was a similar fix for OpenRISC as well.+stafford (who fixed the issue for OpenRISC)
@stafford Was there a request to backport the fix to stable ?
I have not requested pulling my patch to stable. Mine is this one:
313a5257b84c2 ("openrisc: fix boot oops when DEBUG_VM is enabled")
If you cat request that would be great.
Quoted 1 line
I can combine all the git ids that needs to be pulled in.
Note, mine lists:
while your's lists:
That is when the code was introduced to the riscv port, but not the commit that broke booting.
I think if you list the Fixes as I did when backporting to stable Greg, or his tools, would also know that the patch depends on the the 42fc541404f2 commit.
Also, I guess there is no problem with listing 2 "Fixes" in the future.
Thanks Atish and Palmer.
-Stafford
Quoted 31 lines
Quoted 27 lines
Quoted 5 lines
The new interface doesn't actually fix anything itself, but it would allow a
functional kernel to be constructed that consisted of only backports from
Linus' tree (which would also make further fixes easier).That's fine.
Quoted 4 lines
It seems safe to
just pull in9740ca4e95b4("mmap locking API: initial implementation as rwsem
wrappers") before this failing patch, as in this case the newQuoted 8 lines
interface will
function correctly with only a subset of callers having been converted. Of
course that's not a generally true statement so I don't know if future code
will behave that way, but pulling in those conversion patches is definitely
unnecessary diff right now.If someone wants to send me a full set of the git ids that need to be pulled in, I will be glad to do so.
thanks,
greg k-h
Signature · 2 lines
Regards, Atish
Re: [PATCH 5.7 233/244] RISC-V: Acquire mmap lock before invoking walk_page_range
Quoted 103 lines · Stafford Horne
Quoted 72 lines · Atish Patra
Quoted 64 lines · Greg KH
Quoted 63 lines · Palmer Dabbelt
Quoted 38 lines · Greg KH
Quoted 28 lines · Atish Patra
Quoted 3 lines · Naresh Kamboju
RISC-V build breaks on stable-rc 5.7 branch.
build failed with gcc-8, gcc-9 and gcc-9.Sorry for the compilation issue.
mmap_read_lockwas intrdouced in the following commit.commit
9740ca4e95b4Author: Michel Lespinasse <[email protected]> Date: Mon Jun 8 21:33:14 2020 -0700mmap locking API: initial implementation as rwsem
wrappersThe following two commits replaced the usage of
mmap_semrwsem
calls
withmmap_lock.
d8ed45c5dcd4(mmap locking API: use coccinelle to convertmmap_sem
rwsem call sites)89154dd5313f(mmap locking API: convertmmap_semcall sites missed by
coccinelle)Quoted 8 lines
The first commit is not present in stale 5.7-y for obvious reasons.
Do we need to send a separate patch only for stable branch with
mmap_sem? I am not sure if that will cause a conflict again in
future.Quoted 3 lines
I do not like taking odd backports, and would rather take the real patch
that is upstream.I guess I'm a bit new to stable backports so I'm not sure what's
expected here.
The failing patch fixes a bug by using a new interface. The smallest diff fix
for the stable kernels would be to construct a similar fix without
the new
interface, which in this case is very easy as the new interface just converted
some generic locking calls to one-line functions. It seems somewhat circuitous
to land that in Linus' tree, though, as it would require breaking
our port
before fixing it to use the old interfaces and then cleaning it up
to use the
new interfaces.Quoted 6 lines
Quoted 3 lines
Are we expected to pull the new interface onto stable in addition
to this fix?If it really does fix a big issue, yes, that is fine to do.
Quoted 8 lines
The original issue was manifests only for certain rootfs with
CONFIG_DEBUG_VMenabled in kernel. I am not sure if that qualfies for a
big issue :). But there was a similar fix for OpenRISC as well.+stafford (who fixed the issue for OpenRISC)
@stafford Was there a request to backport the fix to stable ?
I have not requested pulling my patch to stable. Mine is this one:
313a5257b84c2("openrisc: fix boot oops whenDEBUG_VMis enabled")If you cat request that would be great.
Quoted 1 line
I can combine all the git ids that needs to be pulled in.
Note, mine lists:
Fixes 42fc541404f2 ("mmap locking API: add mmap_assert_locked()and
mmap_assert_write_locked()")while your's lists:
Fixes 395a21ff859c(riscv: add ARCH_HAS_SET_DIRECT_MAP support)That is when the code was introduced to the riscv port, but not the commit that
broke booting.
Quoted 8 lines
I think if you list the Fixes as I did when backporting to stable Greg, or his
tools, would also know that the patch depends on the the42fc541404f2commit.Also, I guess there is no problem with listing 2 "Fixes" in the future.
Thanks. I will keep that in mind in future.
Backporting the RISC-V fix would require the original commit to be backported as well.
commit 9740ca4e95b4 (mmap locking API: initial implementation as rwsem wrappers)
However, that is the first commit for big cleanup 12 patch series.
https://lkml.org/lkml/2020/5/20/56
While backporting the first commit (9740ca4e95b4) would solve the problem for RISC-V, all other architecture fixes won't be there. Do we want that in stable tree?
Quoted 37 lines
Thanks Atish and Palmer.
-Stafford
Quoted 33 lines
Quoted 29 lines
Quoted 5 lines
The new interface doesn't actually fix anything itself, but it would allow a
functional kernel to be constructed that consisted of only backports from
Linus' tree (which would also make further fixes easier).That's fine.
Quoted 5 lines
It seems safe to
just pull in9740ca4e95b4("mmap locking API: initial implementation as rwsem
wrappers") before this failing patch, as in this case the new interface willQuoted 8 lines
function correctly with only a subset of callers having been converted. Of
course that's not a generally true statement so I don't know if future code
will behave that way, but pulling in those conversion patches is
definitely
unnecessary diff right now.If someone wants to send me a full set of the git ids that need to be
pulled in, I will be glad to do so.thanks,
greg k-h
Signature · 2 lines
Regards, Atish
Signature · 2 lines
Regards, Atish