ima: fix hash algorithm initialization
Subsystems (2)
PATCH 4/24 staging: greybus: loopback: Fix iteration count on async path
In reply to [email protected]From: Bryan O'Donoghue <[email protected]>
[ Upstream commit 44b02da39210e6dd67e39ff1f48d30c56d384240 ]
Commit 12927835d211 ("greybus: loopback: Add asynchronous bi-directional support") does what it says on the tin - namely, adds support for asynchronous bi-directional loopback operations.
What it neglects to do though is increment the per-connection gb->iteration_count on an asynchronous operation error. This patch fixes that omission.
--- drivers/staging/greybus/loopback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/greybus/loopback.c +3 -1
@@ -1034,8 +1034,10 @@ static int gb_loopback_fn(void *data) error =gb_loopback_async_sink (gb, size); } -if (error) +if (error) { gb->error++; + gb->iteration_count++; + } }else {/* We are effectively single threaded here */ if (type ==GB_LOOPBACK_TYPE_PING )
Signature · 1 line
2.11.0
PATCH 5/24 m68k: fix ColdFire node shift size calculation
In reply to [email protected]From: Greg Ungerer <[email protected]>
[ Upstream commit f55ab8f27548ff3431a6567d400c6757c49fd520 ]
The m68k pg_data_table is a fix size array defined in arch/m68k/mm/init.c. Index numbers within it are defined based on memory size. But for Coldfire these don't take into account a non-zero physical RAM base address, and this causes us to access past the end of this array at system start time.
Change the node shift calculation so that we keep the index inside its range.
--- arch/m68k/mm/mcfmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/mm/mcfmmu.c +1 -1
@@ -169,7 +169,7 @@ void __init cf_bootmem_alloc(void) max_pfn = max_low_pfn =PFN_DOWN (_ramend); high_memory = (void *)_ramend; - m68k_virt_to_node_shift =fls (_ramend - _rambase -1 ) -6 ; + m68k_virt_to_node_shift =fls (_ramend -1 ) -6 ;module_fixup (NULL , __start_fixup, __stop_fixup);/* setup bootmem data */
Signature · 1 line
2.11.0
PATCH 8/24 spi: sh-msiof: Fix DMA transfer size check
In reply to [email protected]From: Hiromitsu Yamasaki <[email protected]>
[ Upstream commit 36735783fdb599c94b9c86824583df367c65900b ]
DMA supports 32-bit words only,
even if BITLEN1 of SITMDR2 register is 16bit.
--- drivers/spi/spi-sh-msiof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-sh-msiof.c +1 -1
@@ -862,7 +862,7 @@ static int sh_msiof_transfer_one(struct spi_master *master,break ; copy32 = copy_bswap32; }else if (bits <=16 ) { -if (l &1 ) +if (l &3 )break ; copy32 = copy_wswap32; }else {
Signature · 1 line
2.11.0
PATCH 9/24 spi: spi-axi: fix potential use-after-free after deregistration
In reply to [email protected]From: Johan Hovold <[email protected]>
[ Upstream commit 4d5e0689dc9d5640ad46cdfbe1896b74d8df1661 ]
Take an extra reference to the controller before deregistering it to prevent use-after-free in the interrupt handler in case an interrupt fires before the line is disabled.
--- drivers/spi/spi-axi-spi-engine.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-axi-spi-engine.c +3 -1
@@ -553,7 +553,7 @@ static int spi_engine_probe(struct platform_device *pdev)static int spi_engine_remove (struct platform_device *pdev) { -struct spi_master *master =platform_get_drvdata (pdev); +struct spi_master *master =spi_master_get (platform_get_drvdata (pdev));struct spi_engine *spi_engine =spi_master_get_devdata (master);int irq =platform_get_irq (pdev,0 );
@@ -561,6 +561,8 @@ static int spi_engine_remove(struct platform_device *pdev)free_irq (irq, master); +spi_master_put (master); +writel_relaxed (0xff , spi_engine->base +SPI_ENGINE_REG_INT_PENDING );writel_relaxed (0x00 , spi_engine->base +SPI_ENGINE_REG_INT_ENABLE );writel_relaxed (0x01 , spi_engine->base +SPI_ENGINE_REG_RESET );
Signature · 1 line
2.11.0
PATCH 13/24 usb: phy: tahvo: fix error handling in tahvo_usb_probe()
In reply to [email protected]From: Alexey Khoroshilov <[email protected]>
[ Upstream commit ce035409bfa892a2fabb89720b542e1b335c3426 ]
If devm_extcon_dev_allocate() fails, we should disable clk before return.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/phy/phy-tahvo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/phy/phy-tahvo.c +2 -1
@@ -368,7 +368,8 @@ static int tahvo_usb_probe(struct platform_device *pdev) tu->extcon =devm_extcon_dev_allocate (&pdev->dev, tahvo_cable);if (IS_ERR (tu->extcon)) {dev_err (&pdev->dev,"failed to allocate memory for extcon\n" ); -return -ENOMEM ; + ret =PTR_ERR (tu->extcon); + goto err_disable_clk; } ret =devm_extcon_dev_register (&pdev->dev, tu->extcon);
Signature · 1 line
2.11.0
PATCH 14/24 serial: 8250: Preserve DLD[7:4] for PORT_XR17V35X
In reply to [email protected]From: Aaron Sierra <[email protected]>
[ Upstream commit 0ab84da2e076948c49d36197ee7d254125c53eab ]
The upper four bits of the XR17V35x fractional divisor register (DLD) control general chip function (RS-485 direction pin polarity, multidrop mode, XON/XOFF parity check, and fast IR mode). Don't allow these bits to be clobbered when setting the baudrate.
--- drivers/tty/serial/8250/8250_port.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +4 -1
@@ -2526,8 +2526,11 @@ static void serial8250_set_divisor(struct uart_port *port, unsigned int baud,serial_dl_write (up, quot);/* XR17V35x UARTs have an extra fractional divisor register (DLD) */ -if (up->port.type ==PORT_XR17V35X ) +if (up->port.type ==PORT_XR17V35X ) { +/* Preserve bits not related to baudrate; DLD[7:4]. */ + quot_frac |=serial_port_in (port,0x2 ) &0xf0 ;serial_port_out (port,0x2 , quot_frac); + } } static unsigned int serial8250_get_baud_rate(struct uart_port *port,
Signature · 1 line
2.11.0
PATCH 15/24 kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y
In reply to [email protected]From: Masami Hiramatsu <[email protected]>
[ Upstream commit a30b85df7d599f626973e9cd3056fe755bd778e0 ]
We want to wait for all potentially preempted kprobes trampoline execution to have completed. This guarantees that any freed trampoline memory is not in use by any task in the system anymore. synchronize_rcu_tasks() gives such a guarantee, so use it.
Also, this guarantees to wait for all potentially preempted tasks on the instructions which will be replaced with a jump.
Since this becomes a problem only when CONFIG_PREEMPT=y, enable CONFIG_TASKS_RCU=y for synchronize_rcu_tasks() in that case.
--- arch/Kconfig | 2 +- kernel/kprobes.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-)
arch/Kconfig +1 -1
@@ -83,7 +83,7 @@ config STATIC_KEYS_SELFTEST config OPTPROBES def_bool y depends on KPROBES && HAVE_OPTPROBES - depends on !PREEMPT + select TASKS_RCU if PREEMPT config KPROBES_ON_FTRACE def_bool y
kernel/kprobes.c +8 -6
@@ -540,13 +540,15 @@ static void kprobe_optimizer(struct work_struct *work)do_unoptimize_kprobes ();/* -* Step 2: Wait for quiesence period to ensure all running interrupts -* are done. Because optprobe may modify multiple instructions -* there is a chance that Nth instruction is interrupted. In that -* case, running interrupt can return to 2nd-Nth byte of jump -* instruction. This wait is for avoiding it. +* Step 2: Wait for quiesence period to ensure all potentially +* preempted tasks to have normally scheduled. Because optprobe +* may modify multiple instructions, there is a chance that Nth +* instruction is preempted. In that case, such tasks can return +* to 2nd-Nth byte of jump instruction. This wait is for avoiding it. +* Note that on non-preemptive kernel, this is transparently converted +* to synchronoze_sched() to wait for all interrupts to have completed. */ -synchronize_sched (); +synchronize_rcu_tasks ();/* Step 3: Optimize kprobes after quiesence period */ do_optimize_kprobes ();
Signature · 1 line
2.11.0
PATCH 18/24 EDAC, sb_edac: Fix missing break in switch
In reply to [email protected]From: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit a8e9b186f153a44690ad0363a56716e7077ad28c ]
Add missing break statement in order to prevent the code from falling through.
--- drivers/edac/sb_edac.c | 1 + 1 file changed, 1 insertion(+)
drivers/edac/sb_edac.c +1 -0
@@ -2510,6 +2510,7 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info *mci,break ;case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA : pvt->pci_ta = pdev; +break ;case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_RAS : pvt->pci_ras = pdev;break ;
PATCH 10/24 mmc: sdhci-msm: fix issue with power irq
In reply to [email protected]From: Subhash Jadavani <[email protected]>
[ Upstream commit c7ccee224d2d551f712752c4a16947f6529d6506 ]
SDCC controller reset (SW_RST) during probe may trigger power irq if previous status of PWRCTL was either BUS_ON or IO_HIGH_V. So before we enable the power irq interrupt in GIC (by registering the interrupt handler), we need to ensure that any pending power irq interrupt status is acknowledged otherwise power irq interrupt handler would be fired prematurely.
--- drivers/mmc/host/sdhci-msm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/mmc/host/sdhci-msm.c +18 -0
@@ -642,6 +642,21 @@ static int sdhci_msm_probe(struct platform_device *pdev) CORE_VENDOR_SPEC_CAPABILITIES0); } +/* +* Power on reset state may trigger power irq if previous status of +* PWRCTL was either BUS_ON or IO_HIGH_V. So before enabling pwr irq +* interrupt in GIC, any pending power irq interrupt should be +* acknowledged. Otherwise power irq interrupt handler would be +* fired prematurely. +*/ +sdhci_msm_voltage_switch (host); + +/* +* Ensure that above writes are propogated before interrupt enablement +* in GIC. +*/ +mb (); +/* Setup IRQ for handling power/voltage tasks with PMIC */ msm_host->pwr_irq =platform_get_irq_byname (pdev,"pwr_irq" );if (msm_host->pwr_irq <0 ) {
@@ -651,6 +666,9 @@ static int sdhci_msm_probe(struct platform_device *pdev) goto clk_disable; } +/* Enable pwr irq interrupts */ +writel_relaxed (INT_MASK , msm_host->core_mem +CORE_PWRCTL_MASK ); + ret =devm_request_threaded_irq (&pdev->dev, msm_host->pwr_irq,NULL , sdhci_msm_pwr_irq,IRQF_ONESHOT ,dev_name (&pdev->dev), host);
Signature · 1 line
2.11.0
PATCH 11/24 usb: dwc2: Fix UDC state tracking
In reply to [email protected]From: John Stultz <[email protected]>
[ Upstream commit ce2b21a4e5ce042c0a42c9db8fa9e0f849427d5e ]
It has been noticed that the dwc2 udc state reporting doesn't seem to work (at least on HiKey boards). Where after the initial setup, the sysfs /sys/class/udc/f72c0000.usb/state file would report "configured" no matter the state of the OTG port.
This patch adds a call so that we report to the UDC layer when the gadget device is disconnected.
This patch does depend on the previous patch ("usb: dwc2:
Improve gadget state disconnection handling") in this patch set in order to properly work.
--- drivers/usb/dwc2/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc2/gadget.c +2 -0
@@ -2467,6 +2467,8 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)call_gadget (hsotg, disconnect); hsotg->lx_state =DWC2_L3 ; + +usb_gadget_set_state (&hsotg->gadget,USB_STATE_NOTATTACHED ); }/**
Signature · 1 line
2.11.0
PATCH 12/24 usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode
In reply to [email protected]From: John Stultz <[email protected]>
[ Upstream commit 9b481092c2a31a6b630aff9c28f0145bf6683787 ]
We've found that while in host mode, using Android, if one runs the command:
stop adbd
The existing usb devices being utilized in host mode are disconnected. This is most visible with usb networking devices.
This seems to be due to adbd closing the file:
/dev/usb-ffs/adb/ep0
Which calls ffs_ep0_release() and the following backtrace:
[<ffffff800875a430>] dwc2_hsotg_ep_disable+0x148/0x150 [<ffffff800875a498>] dwc2_hsotg_udc_stop+0x60/0x110 [<ffffff8008787950>] usb_gadget_remove_driver+0x58/0x78 [<ffffff80087879e4>] usb_gadget_unregister_driver+0x74/0xe8 [<ffffff80087850c0>] unregister_gadget+0x28/0x58 [<ffffff800878511c>] unregister_gadget_item+0x2c/0x40 [<ffffff8008790ea8>] ffs_data_clear+0xe8/0xf8 [<ffffff8008790ed8>] ffs_data_reset+0x20/0x58 [<ffffff8008793218>] ffs_data_closed+0x98/0xe8 [<ffffff80087932d8>] ffs_ep0_release+0x20/0x30
Then when dwc2_hsotg_ep_disable() is called, we call kill_all_requests() which causes a bunch of the following messages:
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
init: Service 'adbd' (pid 1915) killed by signal 9
init: Sending signal 9 to service 'adbd' (pid 1915) process group...
init: Successfully killed process cgroup uid 0 pid 1915 in 0ms
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15) dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 8 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 15 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason is unknown dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_update_urb_state_abn(): trimming xfer length
And the usb devices connected are basically hung at this point.
It seems like if we're in host mode, we probably shouldn't run the dwc2_hostg_ep_disable logic, so this patch returns an error in that case.
With this patch (along with the previous patch in this set), we avoid the mismatched interrupts and connected usb devices continue to function.
I'm not sure if some other solution would be better here, but this seems to work, so I wanted to send it out for input on what the right approach should be.
--- drivers/usb/dwc2/gadget.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/dwc2/gadget.c +5 -0
@@ -3117,6 +3117,11 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep)return -EINVAL ; } +if (hsotg->op_state !=OTG_STATE_B_PERIPHERAL ) { +dev_err (hsotg->dev,"%s: called in host mode?\n" , __func__); +return -EINVAL ; + } + epctrl_reg = dir_in ?DIEPCTL (index) :DOEPCTL (index);spin_lock_irqsave (&hsotg->lock, flags);
Signature · 1 line
2.11.0
PATCH 16/24 x86/entry: Use SYSCALL_DEFINE() macros for sys_modify_ldt()
In reply to [email protected]From: Dave Hansen <[email protected]>
[ Upstream commit da20ab35180780e4a6eadc804544f1fa967f3567 ]
We do not have tracepoints for sys_modify_ldt() because we define it directly instead of using the normal SYSCALL_DEFINEx() macros.
However, there is a reason sys_modify_ldt() does not use the macros:
it has an 'int' return type instead of 'unsigned long'. This is a bug, but it's a bug cemented in the ABI.
What does this mean? If we return -EINVAL from a function that returns 'int', we have 0x00000000ffffffea in %rax. But, if we return -EINVAL from a function returning 'unsigned long', we end up with 0xffffffffffffffea in %rax, which is wrong.
To work around this and maintain the 'int' behavior while using the SYSCALL_DEFINEx() macros, so we add a cast to 'unsigned int' in both implementations of sys_modify_ldt().
--- arch/x86/include/asm/syscalls.h | 2 +- arch/x86/kernel/ldt.c | 16 +++++++++++++--- arch/x86/um/ldt.c | 7 +++++-- 3 files changed, 19 insertions(+), 6 deletions(-)
arch/x86/include/asm/syscalls.h +1 -1
@@ -21,7 +21,7 @@ asmlinkage long sys_ioperm(unsigned long, unsigned long, int);asmlinkage long sys_iopl (unsigned int );/* kernel/ldt.c */ -asmlinkage int sys_modify_ldt(int, void __user *, unsigned long); +asmlinkage long sys_modify_ldt (int ,void __user *,unsigned long );/* kernel/signal.c */ asmlinkage long sys_rt_sigreturn (void );
arch/x86/kernel/ldt.c +13 -3
@@ -12,6 +12,7 @@#include <linux/string.h> #include <linux/mm.h> #include <linux/smp.h> +#include <linux/syscalls.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/uaccess.h>
@@ -271,8 +272,8 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)return error; } -asmlinkage int sys_modify_ldt(int func, void __user *ptr, -unsigned long bytecount) +SYSCALL_DEFINE3(modify_ldt, int , func , void __user * , ptr , + unsigned long , bytecount) {int ret = -ENOSYS ;
@@ -290,5 +291,14 @@ asmlinkage int sys_modify_ldt(int func, void __user *ptr, ret =write_ldt (ptr, bytecount,0 );break ; } -return ret; +/* +* The SYSCALL_DEFINE() macros give us an 'unsigned long' +* return type, but tht ABI for sys_modify_ldt() expects +* 'int'. This cast gives us an int-sized value in %rax +* for the return code. The 'unsigned' is necessary so +* the compiler does not try to sign-extend the negative +* return codes into the high half of the register when +* taking the value from int->long. +*/ +return (unsigned int )ret; }
arch/x86/um/ldt.c +5 -2
@@ -6,6 +6,7 @@#include <linux/mm.h> #include <linux/sched.h> #include <linux/slab.h> +#include <linux/syscalls.h> #include <linux/uaccess.h> #include <asm/unistd.h> #include <os.h>
@@ -369,7 +370,9 @@ void free_ldt(struct mm_context *mm) mm->arch.ldt.entry_count =0 ; } -int sys_modify_ldt (int func,void __user *ptr,unsigned long bytecount) +SYSCALL_DEFINE3(modify_ldt, int , func , void __user * , ptr , + unsigned long , bytecount) { -return do_modify_ldt_skas (func, ptr, bytecount); +/* See non-um modify_ldt() for why we do this cast */ +return (unsigned int )do_modify_ldt_skas (func, ptr, bytecount); }
Signature · 1 line
2.11.0
PATCH 17/24 irqchip/gic: Make quirks matching conditional on init return value
In reply to [email protected]From: Ard Biesheuvel <[email protected]>
[ Upstream commit 9d111d49106b61f5a652d5418e85d8741b1a0427 ]
As it turns out, the IIDR is not sufficient to distinguish between GICv3 implementations when it comes to enabling quirks. So update the prototype of the init() hook to return a bool, and interpret a 'false' return value as no match, in which case the 'enabling workaround' log message should not be printed.
--- drivers/irqchip/irq-gic-common.c | 5 +++-- drivers/irqchip/irq-gic-common.h | 2 +- drivers/irqchip/irq-gic-v3-its.c | 12 +++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-)
drivers/irqchip/irq-gic-common.c +3 -2
@@ -40,8 +40,9 @@ void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks,for (; quirks->desc; quirks++) {if (quirks->iidr != (quirks->mask & iidr))continue ; - quirks->init (data); -pr_info ("GIC: enabling workaround for %s\n" , quirks->desc); +if (quirks->init (data)) +pr_info ("GIC: enabling workaround for %s\n" , + quirks->desc); } }
drivers/irqchip/irq-gic-common.h +1 -1
@@ -23,7 +23,7 @@struct gic_quirk {const char *desc; -void (*init)(void *data); +bool (*init)(void *data);u32 iidr;u32 mask; };
drivers/irqchip/irq-gic-v3-its.c +9 -3
@@ -1584,26 +1584,32 @@ static int its_force_quiescent(void __iomem *base) } } -static void __maybe_unused its_enable_quirk_cavium_22375 (void *data) +static bool __maybe_unused its_enable_quirk_cavium_22375 (void *data) {struct its_node *its = data; its->flags |=ITS_FLAGS_WORKAROUND_CAVIUM_22375 ; + +return true; } -static void __maybe_unused its_enable_quirk_cavium_23144 (void *data) +static bool __maybe_unused its_enable_quirk_cavium_23144 (void *data) {struct its_node *its = data; its->flags |=ITS_FLAGS_WORKAROUND_CAVIUM_23144 ; + +return true; } -static void __maybe_unused its_enable_quirk_qdf2400_e0065 (void *data) +static bool __maybe_unused its_enable_quirk_qdf2400_e0065 (void *data) {struct its_node *its = data;/* On QDF2400, the size of the ITE is 16Bytes */ its->ite_size =16 ; + +return true; }static const struct gic_quirk its_quirks[] = {
Signature · 1 line
2.11.0
PATCH 19/24 sysrq : fix Show Regs call trace on ARM
In reply to [email protected]From: Jibin Xu <[email protected]>
[ Upstream commit b00bebbc301c8e1f74f230dc82282e56b7e7a6db ]
When kernel configuration SMP,PREEMPT and DEBUG_PREEMPT are enabled, echo 1 >/proc/sys/kernel/sysrq
echo p >/proc/sysrq-trigger
kernel will print call trace as below:
sysrq: SysRq : Show Regs
BUG: using __this_cpu_read() in preemptible [00000000] code: sh/435 caller is __this_cpu_preempt_check+0x18/0x20 Call trace: [<ffffff8008088e80>] dump_backtrace+0x0/0x1d0 [<ffffff8008089074>] show_stack+0x24/0x30 [<ffffff8008447970>] dump_stack+0x90/0xb0 [<ffffff8008463950>] check_preemption_disabled+0x100/0x108 [<ffffff8008463998>] __this_cpu_preempt_check+0x18/0x20 [<ffffff80084c9194>] sysrq_handle_showregs+0x1c/0x40 [<ffffff80084c9c7c>] __handle_sysrq+0x12c/0x1a0 [<ffffff80084ca140>] write_sysrq_trigger+0x60/0x70 [<ffffff8008251e00>] proc_reg_write+0x90/0xd0 [<ffffff80081f1788>] __vfs_write+0x48/0x90 [<ffffff80081f241c>] vfs_write+0xa4/0x190 [<ffffff80081f3354>] SyS_write+0x54/0xb0 [<ffffff80080833f0>] el0_svc_naked+0x24/0x28
This can be seen on a common board like an r-pi3. This happens because when echo p >/proc/sysrq-trigger, get_irq_regs() is called outside of IRQ context, if preemption is enabled in this situation,kernel will print the call trace. Since many prior discussions on the mailing lists have made it clear that get_irq_regs either just returns NULL or stale data when used outside of IRQ context,we simply avoid calling it outside of IRQ context.
--- drivers/tty/sysrq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/tty/sysrq.c +7 -2
@@ -243,8 +243,10 @@ static void sysrq_handle_showallcpus(int key)* architecture has no support for it: */ if (!trigger_all_cpu_backtrace ()) { -struct pt_regs *regs =get_irq_regs (); +struct pt_regs *regs =NULL ; +if (in_irq ()) + regs =get_irq_regs ();if (regs) {pr_info ("CPU%d:\n" ,smp_processor_id ());show_regs (regs);
@@ -263,7 +265,10 @@ static struct sysrq_key_op sysrq_showallcpus_op = {static void sysrq_handle_showregs (int key) { -struct pt_regs *regs =get_irq_regs (); +struct pt_regs *regs =NULL ; + +if (in_irq ()) + regs =get_irq_regs ();if (regs)show_regs (regs);perf_event_print_debug ();
Signature · 1 line
2.11.0
PATCH 20/24 usbip: tools: Install all headers needed for libusbip development
In reply to [email protected]From: Ben Hutchings <[email protected]>
[ Upstream commit c15562c0dcb2c7f26e891923b784cf1926b8c833 ]
usbip_host_driver.h now depends on several additional headers, which need to be installed along with it.
--- tools/usb/usbip/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/usb/usbip/Makefile.am +2 -1
@@ -1,6 +1,7 @@ SUBDIRS := libsrc src includedir = @includedir@/usbip include_HEADERS := $(addprefix libsrc/, \ - usbip_common.h vhci_driver.h usbip_host_driver.h) + usbip_common.h vhci_driver.h usbip_host_driver.h \ + list.h sysfs_utils.h usbip_host_common.h) dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8)
Signature · 1 line
2.11.0
PATCH 21/24 perf test attr: Fix ignored test case result
In reply to [email protected]From: Thomas Richter <[email protected]>
[ Upstream commit 22905582f6dd4bbd0c370fe5732c607452010c04 ]
Command perf test -v 16 (Setup struct perf_event_attr test) always reports success even if the test case fails. It works correctly if you also specify -F (for don't fork).
root@s35lp76 perf]# ./perf test -v 16
15: Setup struct perf_event_attr :
--- start ---
running './tests/attr/test-record-no-delay'
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.002 MB /tmp/tmp4E1h7R/perf.data
(1 samples) ]
expected task=0, got 1
expected precise_ip=0, got 3
expected wakeup_events=1, got 0
FAILED './tests/attr/test-record-no-delay' - match failure test child finished with 0
---- end ----
Setup struct perf_event_attr: Ok
The reason for the wrong error reporting is the return value of the system() library call. It is called in run_dir() file tests/attr.c and returns the exit status, in above case 0xff00.
This value is given as parameter to the exit() function which can only handle values 0-0xff.
The child process terminates with exit value of 0 and the parent does not detect any error.
This patch corrects the error reporting and prints the correct test result.
LPU-Reference: [email protected]
--- tools/perf/tests/attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/attr.c +1 -1
@@ -150,7 +150,7 @@ static int run_dir(const char *d, const char *perf)snprintf (cmd,3 *PATH_MAX ,PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s" , d, d, perf, vcnt, v); -return system (cmd); +return system (cmd) ?TEST_FAIL :TEST_OK ; }int test__attr (int subtest__maybe_unused )
Signature · 1 line
2.11.0
PATCH 22/24 kprobes/x86: Disable preemption in ftrace-based jprobes
In reply to [email protected]From: Masami Hiramatsu <[email protected]>
[ Upstream commit 5bb4fc2d8641219732eb2bb654206775a4219aca ]
Disable preemption in ftrace-based jprobe handlers as described in Documentation/kprobes.txt:
"Probe handlers are run with preemption disabled."
This will fix jprobes behavior when CONFIG_PREEMPT=y.
--- arch/x86/kernel/kprobes/ftrace.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
arch/x86/kernel/kprobes/ftrace.c +14 -9
@@ -26,7 +26,7 @@#include "common.h" static nokprobe_inline -int __skip_singlestep(struct kprobe *p, struct pt_regs *regs, +void __skip_singlestep(struct kprobe *p, struct pt_regs *regs,struct kprobe_ctlblk *kcb,unsigned long orig_ip) {/*
@@ -41,20 +41,21 @@ int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,__this_cpu_write (current_kprobe,NULL );if (orig_ip) regs->ip = orig_ip; -return 1 ; }int skip_singlestep (struct kprobe *p,struct pt_regs *regs,struct kprobe_ctlblk *kcb) { -if (kprobe_ftrace (p)) -return __skip_singlestep (p, regs, kcb,0 ); -else -return 0 ; +if (kprobe_ftrace (p)) { +__skip_singlestep (p, regs, kcb,0 ); +preempt_enable_no_resched (); +return 1 ; + } +return 0 ; }NOKPROBE_SYMBOL (skip_singlestep); -/* Ftrace callback handler for kprobes */ +/* Ftrace callback handler for kprobes -- called under preepmt disabed */ void kprobe_ftrace_handler (unsigned long ip,unsigned long parent_ip,struct ftrace_ops *ops,struct pt_regs *regs) {
@@ -77,13 +78,17 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,/* Kprobe handler expects regs->ip = ip + 1 as breakpoint hit */ regs->ip = ip +sizeof (kprobe_opcode_t); +/* To emulate trap based kprobes, preempt_disable here */ +preempt_disable ();__this_cpu_write (current_kprobe, p); kcb->kprobe_status =KPROBE_HIT_ACTIVE ; -if (!p->pre_handler || !p->pre_handler (p, regs)) +if (!p->pre_handler || !p->pre_handler (p, regs)) {__skip_singlestep (p, regs, kcb, orig_ip); +preempt_enable_no_resched (); + }/* * If pre_handler returns !0, it sets regs->ip and -* resets current kprobe. +* resets current kprobe, and keep preempt count +1. */ } end:
Signature · 1 line
2.11.0
PATCH 1/24 ima: fix hash algorithm initialization
From: Boshi Wang <[email protected]>
[ Upstream commit ebe7c0a7be92bbd34c6ff5b55810546a0ee05bee ]
The hash_setup function always sets the hash_setup_done flag, even when the hash algorithm is invalid. This prevents the default hash algorithm defined as CONFIG_IMA_DEFAULT_HASH from being used.
This patch sets hash_setup_done flag only for valid hash algorithms.
algorithms"
--- security/integrity/ima/ima_main.c | 4 ++++ 1 file changed, 4 insertions(+)
security/integrity/ima/ima_main.c +4 -0
@@ -51,6 +51,8 @@ static int __init hash_setup(char *str) ima_hash_algo =HASH_ALGO_SHA1 ; else if (strncmp(str, "md5", 3) == 0) ima_hash_algo =HASH_ALGO_MD5 ; + else + return 1; goto out; }
@@ -60,6 +62,8 @@ static int __init hash_setup(char *str)break ; } } +if (i ==HASH_ALGO__LAST ) +return 1 ; out: hash_setup_done =1 ;return 1 ;
Signature · 1 line
2.11.0
PATCH 2/24 s390/pci: do not require AIS facility
From: Christian Borntraeger <[email protected]>
[ Upstream commit 48070c73058be6de9c0d754d441ed7092dfc8f12 ]
As of today QEMU does not provide the AIS facility to its guest. This prevents Linux guests from using PCI devices as the ais facility is checked during init. As this is just a performance optimization, we can move the ais check into the code where we need it (calling the SIC instruction). This is used at initialization and on interrupt. Both places do not require any serialization, so we can simply skip the instruction.
Since we will now get all interrupts, we can also avoid the 2nd scan. As we can have multiple interrupts in parallel we might trigger spurious irqs more often for the non-AIS case but the core code can handle that.
--- arch/s390/include/asm/pci_insn.h | 2 +- arch/s390/pci/pci.c | 5 +++-- arch/s390/pci/pci_insn.c | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-)
arch/s390/include/asm/pci_insn.h +1 -1
@@ -81,6 +81,6 @@ int zpci_refresh_trans(u64 fn, u64 addr, u64 range);int zpci_load (u64 *data,u64 req,u64 offset);int zpci_store (u64 data,u64 req,u64 offset);int zpci_store_block (const u64 *data,u64 req,u64 offset); -void zpci_set_irq_ctrl (u16 ctl,char *unused,u8 isc); +int zpci_set_irq_ctrl (u16 ctl,char *unused,u8 isc);#endif
arch/s390/pci/pci.c +3 -2
@@ -354,7 +354,8 @@ static void zpci_irq_handler(struct airq_struct *airq)/* End of second scan with interrupts on. */ break ;/* First scan complete, reenable interrupts. */ -zpci_set_irq_ctrl (SIC_IRQ_MODE_SINGLE ,NULL ,PCI_ISC ); +if (zpci_set_irq_ctrl (SIC_IRQ_MODE_SINGLE ,NULL ,PCI_ISC )) +break ; si =0 ;continue ; }
@@ -928,7 +929,7 @@ static int __init pci_base_init(void)if (!s390_pci_probe)return 0 ; -if (!test_facility (69 ) || !test_facility (71 ) || !test_facility (72 )) +if (!test_facility (69 ) || !test_facility (71 ))return 0 ; rc =zpci_debug_init ();
arch/s390/pci/pci_insn.c +5 -1
@@ -7,6 +7,7 @@#include <linux/export.h> #include <linux/errno.h> #include <linux/delay.h> +#include <asm/facility.h> #include <asm/pci_insn.h> #include <asm/pci_debug.h> #include <asm/processor.h>
@@ -91,11 +92,14 @@ int zpci_refresh_trans(u64 fn, u64 addr, u64 range) }/* Set Interruption Controls */ -void zpci_set_irq_ctrl (u16 ctl,char *unused,u8 isc) +int zpci_set_irq_ctrl (u16 ctl,char *unused,u8 isc) { +if (!test_facility (72 )) +return -EIO ; asmvolatile (" .insn rsy,0xeb00000000d1,%[ctl],%[isc],%[u]\n" : : [ctl]"d" (ctl), [isc]"d" (isc <<27 ), [u]"Q" (*unused)); +return 0 ; }/* PCI Load */
Signature · 1 line
2.11.0
PATCH 3/24 selftests/x86/ldt_get: Add a few additional tests for limits
In reply to [email protected]From: Andy Lutomirski <[email protected]>
[ Upstream commit fec8f5ae1715a01c72ad52cb2ecd8aacaf142302 ]
We weren't testing the .limit and .limit_in_pages fields very well. Add more tests.
This addition seems to trigger the "bits 16:19 are undefined" issue that was fixed in an earlier patch. I think that, at least on my CPU, the high nibble of the limit ends in LAR bits 16:19.
--- tools/testing/selftests/x86/ldt_gdt.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/ldt_gdt.c +16 -1
@@ -360,9 +360,24 @@ static void do_simple_tests(void)install_invalid (&desc, false); desc.seg_not_present =0 ; - desc.read_exec_only =0 ; desc.seg_32bit =1 ; + desc.read_exec_only =0 ; + desc.limit =0xfffff ; +install_valid (&desc,AR_DPL3 |AR_TYPE_RWDATA |AR_S |AR_P |AR_DB ); + + desc.limit_in_pages =1 ; + +install_valid (&desc,AR_DPL3 |AR_TYPE_RWDATA |AR_S |AR_P |AR_DB |AR_G ); + desc.read_exec_only =1 ; +install_valid (&desc,AR_DPL3 |AR_TYPE_RODATA |AR_S |AR_P |AR_DB |AR_G ); + desc.contents =1 ; + desc.read_exec_only =0 ; +install_valid (&desc,AR_DPL3 |AR_TYPE_RWDATA_EXPDOWN |AR_S |AR_P |AR_DB |AR_G ); + desc.read_exec_only =1 ; +install_valid (&desc,AR_DPL3 |AR_TYPE_RODATA_EXPDOWN |AR_S |AR_P |AR_DB |AR_G ); + + desc.limit =0 ;install_invalid (&desc, true); }
Signature · 1 line
2.11.0
PATCH 7/24 staging: rtl8188eu: avoid a null dereference on pmlmepriv
In reply to [email protected]From: Colin Ian King <[email protected]>
[ Upstream commit 123c0aab0050cd0e07ce18e453389fbbb0a5a425 ]
There is a check on pmlmepriv before dereferencing it when vfree'ing pmlmepriv->free_bss_buf however the previous call to rtw_free_mlme_priv_ie_data deferences pmlmepriv causing a null pointer deference if it is null. Avoid this by also calling rtw_free_mlme_priv_ie_data if the pointer is non-null.
Detected by CoverityScan, CID#1230262 ("Dereference before null check")
--- drivers/staging/rtl8188eu/core/rtw_mlme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +3 -3
@@ -107,10 +107,10 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv) { -rtw_free_mlme_priv_ie_data (pmlmepriv); - -if (pmlmepriv) +if (pmlmepriv) { +rtw_free_mlme_priv_ie_data (pmlmepriv);vfree (pmlmepriv->free_bss_buf); + } }struct wlan_network *_rtw_alloc_network (struct mlme_priv *pmlmepriv)
Signature · 1 line
2.11.0
PATCH 6/24 serial: 8250_fintek: Fix rs485 disablement on invalid ioctl()
In reply to [email protected]From: Lukas Wunner <[email protected]>
[ Upstream commit 3236a965486ba0c6043cf2c7b51943d8b382ae29 ]
This driver's ->rs485_config callback checks if SER_RS485_RTS_ON_SEND and SER_RS485_RTS_AFTER_SEND have the same value. If they do, it means the user has passed in invalid data with the TIOCSRS485 ioctl() since RTS must have a different polarity when sending and when not sending. In this case, rs485 mode is not enabled (the RS485_URA bit is not set in the RS485 Enable Register) and this is supposed to be signaled back to the user by clearing the SER_RS485_ENABLED bit in struct serial_rs485 ... except a missing tilde character is preventing that from happening.
--- drivers/tty/serial/8250/8250_fintek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_fintek.c +1 -1
@@ -118,7 +118,7 @@ static int fintek_8250_rs485_config(struct uart_port *port,if ((!!(rs485->flags &SER_RS485_RTS_ON_SEND )) == (!!(rs485->flags &SER_RS485_RTS_AFTER_SEND ))) - rs485->flags &=SER_RS485_ENABLED ; + rs485->flags &= ~SER_RS485_ENABLED ;else config |=RS485_URA ;
Signature · 1 line
2.11.0
PATCH 24/24 iio: adc: ti-ads1015: add 10% to conversion wait time
In reply to [email protected]From: Ladislav Michl <[email protected]>
[ Upstream commit fe895ac88b9fbdf2026f0bfd56c82747bb9d7c48 ]
As user's guide "ADS1015EVM, ADS1115EVM, ADS1015EVM-PDK, ADS1115EVM-PDK User Guide (Rev. B)" (http://www.ti.com/lit/ug/sbau157b/sbau157b.pdf)
states at page 16:
"Note that both the ADS1115 and ADS1015 have internal clocks with a ±10% accuracy. If performing FFT tests, frequencies may appear to be incorrect as a result of this tolerance range.", add those 10% to converion wait time.
--- drivers/iio/adc/ti-ads1015.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/ti-ads1015.c +1 -0
@@ -269,6 +269,7 @@ int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val) conv_time =DIV_ROUND_UP (USEC_PER_SEC , data->data_rate[dr_old]); conv_time +=DIV_ROUND_UP (USEC_PER_SEC , data->data_rate[dr]); + conv_time += conv_time /10 ;/* 10% internal clock inaccuracy */ usleep_range (conv_time, conv_time +1 ); data->conv_invalid = false; }
Signature · 1 line
2.11.0
PATCH 23/24 tools include: Do not use poison with C++
In reply to [email protected]From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 6ae8eefc6c8fe050f057781b70a83262eb0a61ee ]
LIST_POISON[12] are used to initialize list_head and hlist_node pointers, and do void pointer arithmetic, which C++ doesn't like, so, to avoid drifting from the kernel by introducing some HLIST_POISON to do away with void pointer math, just make those poisoned pointers be NULL when building it with a C++ compiler.
Noticed with:
$ make LLVM_CONFIG=/usr/bin/llvm-config-3.9 LIBCLANGLLVM=1
CXX util/c++/clang.o
CXX util/c++/clang-test.o
In file included from /home/lizj/linux/tools/include/linux/list.h:5:0,
from /home/lizj/linux/tools/perf/util/namespaces.h:13,
from /home/lizj/linux/tools/perf/util/util.h:15,
from /home/lizj/linux/tools/perf/util/util-cxx.h:20,
from util/c++/clang-c.h:5,
from util/c++/clang-test.cpp:2:
/home/lizj/linux/tools/include/linux/list.h: In function ‘void list_del(list_head*)’:
/home/lizj/linux/tools/include/linux/poison.h:14:31: error: pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith]
# define POISON_POINTER_DELTA 0
^
/home/lizj/linux/tools/include/linux/poison.h:22:41: note: in expansion of macro ‘POISON_POINTER_DELTA’
#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA)
^
/home/lizj/linux/tools/include/linux/list.h:107:16: note: in expansion of macro ‘LIST_POISON1’
entry->next = LIST_POISON1;
^
In file included from /home/lizj/linux/tools/perf/util/namespaces.h:13:0,
from /home/lizj/linux/tools/perf/util/util.h:15,
from /home/lizj/linux/tools/perf/util/util-cxx.h:20,
from util/c++/clang-c.h:5,
from util/c++/clang-test.cpp:2:
/home/lizj/linux/tools/include/linux/list.h:107:14: error: invalid conversion from ‘void*’ to ‘list_head*’ [-fpermissive]--- tools/include/linux/poison.h | 5 +++++ 1 file changed, 5 insertions(+)
tools/include/linux/poison.h +5 -0
@@ -14,6 +14,10 @@# define POISON_POINTER_DELTA 0#endif +#ifdef __cplusplus +#define LIST_POISON1 NULL +#define LIST_POISON2 NULL +#else /* * These are non-NULL pointers that will result in page faults * under normal circumstances, used to verify that nobody uses
@@ -21,6 +25,7 @@*/ #define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA)#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA) +#endif /********** include/linux/timer.h **********/ /*
Signature · 1 line
2.11.0