arm64: Do not forget syscall when starting a new thread.
Subsystems (4)
Sasha Levin
maintainerPATCH 9/12 ACPI: LPSS: Fix missing check in register_device_clock()
In reply to Sasha LevinFrom: huhai <[email protected]>
[ Upstream commit b4f1f61ed5928b1128e60e38d0dffa16966f06dc ]
register_device_clock() misses a check for platform_device_register_simple(). Add a check to fix it.
--- drivers/acpi/acpi_lpss.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpi_lpss.c +3 -0
@@ -396,6 +396,9 @@ static int register_device_clock(struct acpi_device *adev,if (!lpss_clk_dev)lpt_register_clock_device (); +if (IS_ERR (lpss_clk_dev)) +return PTR_ERR (lpss_clk_dev); + clk_data =platform_get_drvdata (lpss_clk_dev);if (!clk_data)return -ENODEV ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/12 ARM: dts: imx6ul: add missing properties for sram
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 5655699cf5cff9f4c4ee703792156bdd05d1addf ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6ul.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6ul.dtsi +3 -0
@@ -152,6 +152,9 @@ pmu { ocram: sram@00900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; dma_apbh: dma-apbh@01804000 {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/12 ARM: dts: imx6ul: fix qspi node compatible
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 0c6cf86e1ab433b2d421880fdd9c6e954f404948 ]
imx6ul is not compatible to imx6sx, both have different erratas. Fixes the dt_binding_check warning:
spi@21e0000: compatible: 'oneOf' conditional failed, one must be fixed:
['fsl,imx6ul-qspi', 'fsl,imx6sx-qspi'] is too long Additional items are not allowed ('fsl,imx6sx-qspi' was unexpected) 'fsl,imx6ul-qspi' is not one of ['fsl,ls1043a-qspi'] 'fsl,imx6ul-qspi' is not one of ['fsl,imx8mq-qspi'] 'fsl,ls1021a-qspi' was expected
'fsl,imx7d-qspi' was expected
--- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6ul.dtsi +1 -1
@@ -883,7 +883,7 @@ lcdif: lcdif@021c8000 { qspi: qspi@021e0000 { #address-cells = <1>; #size-cells = <0>; - compatible = "fsl,imx6ul-qspi", "fsl,imx6sx-qspi"; + compatible = "fsl,imx6ul-qspi"; reg = <0x021e0000 0x4000>, <0x60000000 0x10000000>; reg-names = "QuadSPI", "QuadSPI-memory"; interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/12 ARM: OMAP2+: display: Fix refcount leak bug
In reply to Sasha LevinFrom: Liang He <[email protected]>
[ Upstream commit 50b87a32a79bca6e275918a711fb8cc55e16d739 ]
In omapdss_init_fbdev(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
Message-Id: <[email protected]>
--- arch/arm/mach-omap2/display.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/display.c +1 -0
@@ -218,6 +218,7 @@ static int __init omapdss_init_fbdev(void) node =of_find_node_by_name (NULL ,"omap4_padconf_global" );if (node) omap4_dsi_mux_syscon =syscon_node_to_regmap (node); +of_node_put (node);return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/12 PM: hibernate: defer device probing when resuming from hibernation
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 8386c414e27caba8501119948e9551e52b527f59 ]
syzbot is reporting hung task at misc_open() [1], for there is a race window of AB-BA deadlock which involves probe_count variable. Currently wait_for_device_probe() from snapshot_open() from misc_open() can sleep forever with misc_mtx held if probe_count cannot become 0.
When a device is probed by hub_event() work function, probe_count is incremented before the probe function starts, and probe_count is decremented after the probe function completed.
There are three cases that can prevent probe_count from dropping to 0.
(a) A device being probed stopped responding (i.e. broken/malicious hardware).
(b) A process emulating a USB device using /dev/raw-gadget interface stopped responding for some reason.
(c) New device probe requests keeps coming in before existing device probe requests complete.
The phenomenon syzbot is reporting is (b). A process which is holding system_transition_mutex and misc_mtx is waiting for probe_count to become 0 inside wait_for_device_probe(), but the probe function which is called
from hub_event() work function is waiting for the processes which are
blocked at mutex_lock(&misc_mtx) to respond via /dev/raw-gadget interface.
This patch mitigates (b) by deferring wait_for_device_probe() from snapshot_open() to snapshot_write() and snapshot_ioctl(). Please note that the possibility of (b) remains as long as any thread which is emulating a USB device via /dev/raw-gadget interface can be blocked by uninterruptible blocking operations (e.g. mutex_lock()).
Please also note that (a) and (c) are not addressed. Regarding (c), we should change the code to wait for only one device which contains the image for resuming from hibernation. I don't know how to address (a), for use of timeout for wait_for_device_probe() might result in loss of user data in the image. Maybe we should require the userland to wait for the image device before opening /dev/snapshot interface.
--- kernel/power/user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
kernel/power/user.c +12 -1
@@ -29,6 +29,7 @@#include "power.h" +static bool need_wait;#define SNAPSHOT_MINOR 231
@@ -82,7 +83,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)* Resuming. We may need to wait for the image device to * appear. */ -wait_for_device_probe (); + need_wait = true; data->swap =-1 ; data->mode =O_WRONLY ;
@@ -174,6 +175,11 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,ssize_t res;loff_t pg_offp = *offp & ~PAGE_MASK ; +if (need_wait) { +wait_for_device_probe (); + need_wait = false; + } +lock_system_sleep (); data = filp->private_data;
@@ -209,6 +215,11 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,loff_t size;sector_t offset; +if (need_wait) { +wait_for_device_probe (); + need_wait = false; + } +if (_IOC_TYPE (cmd) !=SNAPSHOT_IOC_MAGIC )return -ENOTTY ;if (_IOC_NR (cmd) >SNAPSHOT_IOC_MAXNR )
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 1/12 arm64: Do not forget syscall when starting a new thread.
From: Francis Laniel <[email protected]>
[ Upstream commit de6921856f99c11d3986c6702d851e1328d4f7f6 ]
Enable tracing of the execve*() system calls with the syscalls:sys_exit_execve tracepoint by removing the call to forget_syscall() when starting a new thread and preserving the value of regs->syscallno across exec.
--- arch/arm64/include/asm/processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/processor.h +2 -1
@@ -143,8 +143,9 @@ void tls_preserve_current_state(void);static inline void start_thread_common (struct pt_regs *regs,unsigned long pc) { +s32 previous_syscall = regs->syscallno;memset (regs,0 ,sizeof (*regs)); -forget_syscall (regs); + regs->syscallno = previous_syscall; regs->pc = pc; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/12 hwmon: (sht15) Fix wrong assumptions in device remove callback
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 7d4edccc9bbfe1dcdff641343f7b0c6763fbe774 ]
Taking a lock at the beginning of .remove() doesn't prevent new readers. With the existing approach it can happen, that a read occurs just when the lock was taken blocking the reader until the lock is released at the end of the remove callback which then accessed *data that is already freed then.
To actually fix this problem the hwmon core needs some adaption. Until this is implemented take the optimistic approach of assuming that all readers are gone after hwmon_device_unregister() and sysfs_remove_group() as most other drivers do. (And once the core implements that, taking the lock would deadlock.)
So drop the lock, move the reset to after device unregistration to keep the device in a workable state until it's deregistered. Also add a error message in case the reset fails and return 0 anyhow. (Returning an error code, doesn't stop the platform device unregistration and only results in a little helpful error message before the devm cleanup handlers are called.)
--- drivers/hwmon/sht15.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/hwmon/sht15.c +6 -11
@@ -1095,25 +1095,20 @@ static int sht15_probe(struct platform_device *pdev)static int sht15_remove (struct platform_device *pdev) {struct sht15_data *data =platform_get_drvdata (pdev); +int ret; -/* -* Make sure any reads from the device are done and -* prevent new ones beginning -*/ -mutex_lock (&data->read_lock); -if (sht15_soft_reset (data)) { -mutex_unlock (&data->read_lock); -return -EFAULT ; - }hwmon_device_unregister (data->hwmon_dev);sysfs_remove_group (&pdev->dev.kobj, &sht15_attr_group); + + ret =sht15_soft_reset (data); +if (ret) +dev_err (&pdev->dev,"Failed to reset device (%pe)\n" ,ERR_PTR (ret)); +if (!IS_ERR (data->reg)) {regulator_unregister_notifier (data->reg, &data->nb);regulator_disable (data->reg); } -mutex_unlock (&data->read_lock); -return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/12 ext2: Add more validity checks for inode counts
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit fa78f336937240d1bc598db817d638086060e7e9 ]
Add checks verifying number of inodes stored in the superblock matches the number computed from number of inodes per group. Also verify we have at least one block worth of inodes per group. This prevents crashes on corrupted filesystems.
--- fs/ext2/super.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/ext2/super.c +10 -2
@@ -1072,9 +1072,10 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sbi->s_frags_per_group); goto failed_mount; } -if (sbi->s_inodes_per_group > sb->s_blocksize *8 ) { +if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || + sbi->s_inodes_per_group > sb->s_blocksize *8 ) {ext2_msg (sb,KERN_ERR , -"error: #inodes per group too big: %lu" , +"error: invalid #inodes per group: %lu" , sbi->s_inodes_per_group); goto failed_mount; }
@@ -1084,6 +1085,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sbi->s_groups_count = ((le32_to_cpu (es->s_blocks_count) -le32_to_cpu (es->s_first_data_block) -1 ) /EXT2_BLOCKS_PER_GROUP (sb)) +1 ; +if ((u64 )sbi->s_groups_count * sbi->s_inodes_per_group != +le32_to_cpu (es->s_inodes_count)) { +ext2_msg (sb,KERN_ERR ,"error: invalid #inodes: %u vs computed %llu" , +le32_to_cpu (es->s_inodes_count), + (u64 )sbi->s_groups_count * sbi->s_inodes_per_group); + goto failed_mount; + } db_count = (sbi->s_groups_count +EXT2_DESC_PER_BLOCK (sb) -1 ) /EXT2_DESC_PER_BLOCK (sb); sbi->s_group_desc =kmalloc (db_count *sizeof (struct buffer_head *),GFP_KERNEL );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/12 arm64: fix oops in concurrently setting insn_emulation sysctls
In reply to Sasha LevinFrom: haibinzhang (张海斌) <[email protected]>
[ Upstream commit af483947d472eccb79e42059276c4deed76f99a6 ]
emulation_proc_handler() changes table->data for proc_dointvec_minmax and can generate the following Oops if called concurrently with itself:
| Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010 | Internal error: Oops: 96000006 [#1] SMP | Call trace: | update_insn_emulation_mode+0xc0/0x148 | emulation_proc_handler+0x64/0xb8 | proc_sys_call_handler+0x9c/0xf8 | proc_sys_write+0x18/0x20 | __vfs_write+0x20/0x48 | vfs_write+0xe4/0x1d0 | ksys_write+0x70/0xf8 | __arm64_sys_write+0x20/0x28 | el0_svc_common.constprop.0+0x7c/0x1c0 | el0_svc_handler+0x2c/0xa0 | el0_svc+0x8/0x200
To fix this issue, keep the table->data as &insn->current_mode and use container_of() to retrieve the insn pointer. Another mutex is used to protect against the current_mode update but not for retrieving insn_emulation as table->data is no longer changing.
--- arch/arm64/kernel/armv8_deprecated.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm64/kernel/armv8_deprecated.c +5 -4
@@ -63,6 +63,7 @@ struct insn_emulation {static LIST_HEAD (insn_emulation);static int nr_insn_emulated__initdata ;static DEFINE_RAW_SPINLOCK (insn_emulation_lock); +static DEFINE_MUTEX (insn_emulation_mutex);static void register_emulation_hooks (struct insn_emulation_ops *ops) {
@@ -208,10 +209,10 @@ static int emulation_proc_handler(struct ctl_table *table, int write, loff_t *ppos) {int ret =0 ; -struct insn_emulation *insn = (struct insn_emulation *) table->data; + struct insn_emulation *insn = container_of(table->data, struct insn_emulation, current_mode);enum insn_emulation_mode prev_mode = insn->current_mode; - table->data = &insn->current_mode; +mutex_lock (&insn_emulation_mutex); ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (ret || !write || prev_mode == insn->current_mode)
@@ -224,7 +225,7 @@ static int emulation_proc_handler(struct ctl_table *table, int write,update_insn_emulation_mode (insn,INSN_UNDEF ); } ret: - table->data = insn; +mutex_unlock (&insn_emulation_mutex);return ret; }
@@ -254,7 +255,7 @@ static void __init register_insn_emulation_sysctl(struct ctl_table *table) sysctl->maxlen =sizeof (int ); sysctl->procname = insn->ops->name; - sysctl->data = insn; + sysctl->data = &insn->current_mode; sysctl->extra1 = &insn->min; sysctl->extra2 = &insn->max; sysctl->proc_handler = emulation_proc_handler;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/12 genirq: GENERIC_IRQ_IPI depends on SMP
In reply to Sasha LevinFrom: Samuel Holland <[email protected]>
[ Upstream commit 0f5209fee90b4544c58b4278d944425292789967 ]
The generic IPI code depends on the IRQ affinity mask being allocated and initialized. This will not be the case if SMP is disabled. Fix up the remaining driver that selected GENERIC_IRQ_IPI in a non-SMP config.
--- drivers/irqchip/Kconfig | 2 +- kernel/irq/Kconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +1 -1
@@ -138,7 +138,7 @@ config IMGPDC_IRQ config IRQ_MIPS_CPU bool select GENERIC_IRQ_CHIP - select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING + select GENERIC_IRQ_IPI if SMP && SYS_SUPPORTS_MULTITHREADING select IRQ_DOMAIN select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI select GENERIC_IRQ_EFFECTIVE_AFF_MASK
kernel/irq/Kconfig +1 -0
@@ -80,6 +80,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS # Generic IRQ IPI support config GENERIC_IRQ_IPI bool + depends on SMP select IRQ_DOMAIN_HIERARCHY # Generic MSI interrupt support
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/12 ACPI: PM: save NVS memory for Lenovo G40-45
In reply to Sasha LevinFrom: Manyi Li <[email protected]>
[ Upstream commit 4b7ef7b05afcde44142225c184bf43a0cd9e2178 ]
[821d6f0359b0614792ab8e2fb93b503e25a65079] is to make machines produced from 2012 to now not saving NVS region to accelerate S3.
But, Lenovo G40-45, a platform released in 2015, still needs NVS memory saving during S3. A quirk is introduced for this platform.
--- drivers/acpi/sleep.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/sleep.c +8 -0
@@ -359,6 +359,14 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "80E3"), }, }, + { + .callback = init_nvs_save_s3, + .ident = "Lenovo G40-45", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "80E1"), + }, + },/* * https://bugzilla.kernel.org/show_bug.cgi?id=196907 * Some Dell XPS13 9360 cannot do suspend-to-idle using the Low Power
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/12 selinux: Add boundary check in put_entry()
In reply to Sasha LevinFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit 15ec76fb29be31df2bccb30fc09875274cba2776 ]
Just like next_entry(), boundary check is necessary to prevent memory out-of-bound access.
--- security/selinux/ss/policydb.h | 2 ++ 1 file changed, 2 insertions(+)
security/selinux/ss/policydb.h +2 -0
@@ -360,6 +360,8 @@ static inline int put_entry(const void *buf, size_t bytes, int num, struct polic {size_t len = bytes * num; +if (len > fp->len) +return -EINVAL ;memcpy (fp->data, buf, len); fp->data += len; fp->len -= len;
Signature · 1 line
2.35.1