From: Sasha Levin Date: Mon, 13 May 2019 18:42:40 +0000 (-0400) Subject: autosel fixes for 4.9 X-Git-Tag: v5.1.2~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27d6b7f2059104738c1310a2c2d4a7b714b6b5d9;p=thirdparty%2Fkernel%2Fstable-queue.git autosel fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/drm-sun4i-set-device-driver-data-at-bind-time-for-us.patch b/queue-4.9/drm-sun4i-set-device-driver-data-at-bind-time-for-us.patch new file mode 100644 index 00000000000..74a3f99022a --- /dev/null +++ b/queue-4.9/drm-sun4i-set-device-driver-data-at-bind-time-for-us.patch @@ -0,0 +1,37 @@ +From b4787790280e2c76e53c6cb0c456a072921fee92 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski +Date: Thu, 18 Apr 2019 15:27:26 +0200 +Subject: drm/sun4i: Set device driver data at bind time for use in unbind + +[ Upstream commit 02b92adbe33e6dbd15dc6e32540b22f47c4ff0a2 ] + +Our sun4i_drv_unbind gets the drm device using dev_get_drvdata. +However, that driver data is never set in sun4i_drv_bind. + +Set it there to avoid getting a NULL pointer at unbind time. + +Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") +Signed-off-by: Paul Kocialkowski +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20190418132727.5128-3-paul.kocialkowski@bootlin.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/sun4i/sun4i_drv.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c +index 97828faf2a1ff..d58991b06a470 100644 +--- a/drivers/gpu/drm/sun4i/sun4i_drv.c ++++ b/drivers/gpu/drm/sun4i/sun4i_drv.c +@@ -137,6 +137,8 @@ static int sun4i_drv_bind(struct device *dev) + ret = -ENOMEM; + goto free_drm; + } ++ ++ dev_set_drvdata(dev, drm); + drm->dev_private = drv; + + drm_vblank_init(drm, 1); +-- +2.20.1 + diff --git a/queue-4.9/gpu-ipu-v3-dp-fix-csc-handling.patch b/queue-4.9/gpu-ipu-v3-dp-fix-csc-handling.patch new file mode 100644 index 00000000000..cc9a3105ec6 --- /dev/null +++ b/queue-4.9/gpu-ipu-v3-dp-fix-csc-handling.patch @@ -0,0 +1,69 @@ +From 0b5b4177bc2f089f363c8e04f0290e533c68c962 Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Fri, 12 Apr 2019 17:59:40 +0200 +Subject: gpu: ipu-v3: dp: fix CSC handling + +[ Upstream commit d4fad0a426c6e26f48c9a7cdd21a7fe9c198d645 ] + +Initialize the flow input colorspaces to unknown and reset to that value +when the channel gets disabled. This avoids the state getting mixed up +with a previous mode. + +Also keep the CSC settings for the background flow intact when disabling +the foreground flow. + +Root-caused-by: Jonathan Marek +Signed-off-by: Lucas Stach +Signed-off-by: Philipp Zabel +Signed-off-by: Sasha Levin +--- + drivers/gpu/ipu-v3/ipu-dp.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/ipu-v3/ipu-dp.c b/drivers/gpu/ipu-v3/ipu-dp.c +index 98686edbcdbb0..33de3a1bac49f 100644 +--- a/drivers/gpu/ipu-v3/ipu-dp.c ++++ b/drivers/gpu/ipu-v3/ipu-dp.c +@@ -195,7 +195,8 @@ int ipu_dp_setup_channel(struct ipu_dp *dp, + ipu_dp_csc_init(flow, flow->foreground.in_cs, flow->out_cs, + DP_COM_CONF_CSC_DEF_BOTH); + } else { +- if (flow->foreground.in_cs == flow->out_cs) ++ if (flow->foreground.in_cs == IPUV3_COLORSPACE_UNKNOWN || ++ flow->foreground.in_cs == flow->out_cs) + /* + * foreground identical to output, apply color + * conversion on background +@@ -261,6 +262,8 @@ void ipu_dp_disable_channel(struct ipu_dp *dp) + struct ipu_dp_priv *priv = flow->priv; + u32 reg, csc; + ++ dp->in_cs = IPUV3_COLORSPACE_UNKNOWN; ++ + if (!dp->foreground) + return; + +@@ -268,8 +271,9 @@ void ipu_dp_disable_channel(struct ipu_dp *dp) + + reg = readl(flow->base + DP_COM_CONF); + csc = reg & DP_COM_CONF_CSC_DEF_MASK; +- if (csc == DP_COM_CONF_CSC_DEF_FG) +- reg &= ~DP_COM_CONF_CSC_DEF_MASK; ++ reg &= ~DP_COM_CONF_CSC_DEF_MASK; ++ if (csc == DP_COM_CONF_CSC_DEF_BOTH || csc == DP_COM_CONF_CSC_DEF_BG) ++ reg |= DP_COM_CONF_CSC_DEF_BG; + + reg &= ~DP_COM_CONF_FG_EN; + writel(reg, flow->base + DP_COM_CONF); +@@ -350,6 +354,8 @@ int ipu_dp_init(struct ipu_soc *ipu, struct device *dev, unsigned long base) + mutex_init(&priv->mutex); + + for (i = 0; i < IPUV3_NUM_FLOWS; i++) { ++ priv->flow[i].background.in_cs = IPUV3_COLORSPACE_UNKNOWN; ++ priv->flow[i].foreground.in_cs = IPUV3_COLORSPACE_UNKNOWN; + priv->flow[i].foreground.foreground = true; + priv->flow[i].base = priv->base + ipu_dp_flow_base[i]; + priv->flow[i].priv = priv; +-- +2.20.1 + diff --git a/queue-4.9/hid-input-add-mapping-for-expose-overview-key.patch b/queue-4.9/hid-input-add-mapping-for-expose-overview-key.patch new file mode 100644 index 00000000000..1fcb5efd5e8 --- /dev/null +++ b/queue-4.9/hid-input-add-mapping-for-expose-overview-key.patch @@ -0,0 +1,37 @@ +From ce3872da90c2f51b726163b5bda1d4f5ead51a56 Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Fri, 18 Jan 2019 13:59:08 -0800 +Subject: HID: input: add mapping for Expose/Overview key +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ Upstream commit 96dd86871e1fffbc39e4fa61c9c75ec54ee9af0f ] + +According to HUTRR77 usage 0x29f from the consumer page is reserved for +the Desktop application to present all running user’s application windows. +Linux defines KEY_SCALE to request Compiz Scale (Expose) mode, so let's +add the mapping. + +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-input.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c +index fc7ada26457e8..d31725c4e7b1e 100644 +--- a/drivers/hid/hid-input.c ++++ b/drivers/hid/hid-input.c +@@ -932,6 +932,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel + case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; + case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; + ++ case 0x29f: map_key_clear(KEY_SCALE); break; ++ + default: map_key_clear(KEY_UNKNOWN); + } + break; +-- +2.20.1 + diff --git a/queue-4.9/hid-input-add-mapping-for-keyboard-brightness-up-dow.patch b/queue-4.9/hid-input-add-mapping-for-keyboard-brightness-up-dow.patch new file mode 100644 index 00000000000..0715ea747cd --- /dev/null +++ b/queue-4.9/hid-input-add-mapping-for-keyboard-brightness-up-dow.patch @@ -0,0 +1,34 @@ +From 58ca8fe01df409ebcbd6a289dbc4b837c9f54192 Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Fri, 18 Jan 2019 14:05:52 -0800 +Subject: HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys + +[ Upstream commit 7975a1d6a7afeb3eb61c971a153d24dd8fa032f3 ] + +According to HUTRR73 usages 0x79, 0x7a and 0x7c from the consumer page +correspond to Brightness Up/Down/Toggle keys, so let's add the mappings. + +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-input.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c +index d31725c4e7b1e..302a24931147b 100644 +--- a/drivers/hid/hid-input.c ++++ b/drivers/hid/hid-input.c +@@ -802,6 +802,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel + case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; + case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; + ++ case 0x079: map_key_clear(KEY_KBDILLUMUP); break; ++ case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break; ++ case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break; ++ + case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; + case 0x083: map_key_clear(KEY_LAST); break; + case 0x084: map_key_clear(KEY_ENTER); break; +-- +2.20.1 + diff --git a/queue-4.9/hid-input-add-mapping-for-toggle-display-key.patch b/queue-4.9/hid-input-add-mapping-for-toggle-display-key.patch new file mode 100644 index 00000000000..ac5930731d0 --- /dev/null +++ b/queue-4.9/hid-input-add-mapping-for-toggle-display-key.patch @@ -0,0 +1,39 @@ +From c7ecc3c23595c548487cbc0ed32e60285cf070f3 Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Fri, 18 Jan 2019 14:35:45 -0800 +Subject: HID: input: add mapping for "Toggle Display" key + +[ Upstream commit c01908a14bf735b871170092807c618bb9dae654 ] + +According to HUT 1.12 usage 0xb5 from the generic desktop page is reserved +for switching between external and internal display, so let's add the +mapping. + +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-input.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c +index 302a24931147b..9f7b1cf726a8d 100644 +--- a/drivers/hid/hid-input.c ++++ b/drivers/hid/hid-input.c +@@ -607,6 +607,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel + break; + } + ++ if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ ++ switch (usage->hid & 0xf) { ++ case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break; ++ default: goto ignore; ++ } ++ break; ++ } ++ + /* + * Some lazy vendors declare 255 usages for System Control, + * leading to the creation of ABS_X|Y axis and too many others. +-- +2.20.1 + diff --git a/queue-4.9/iio-adc-xilinx-fix-potential-use-after-free-on-remov.patch b/queue-4.9/iio-adc-xilinx-fix-potential-use-after-free-on-remov.patch new file mode 100644 index 00000000000..b2c43f7082f --- /dev/null +++ b/queue-4.9/iio-adc-xilinx-fix-potential-use-after-free-on-remov.patch @@ -0,0 +1,38 @@ +From 4b4eea5cd1ff45ba74de8370e6f47f610db1dad2 Mon Sep 17 00:00:00 2001 +From: Sven Van Asbroeck +Date: Sun, 10 Mar 2019 14:58:24 -0400 +Subject: iio: adc: xilinx: fix potential use-after-free on remove + +[ Upstream commit 62039b6aef63380ba7a37c113bbaeee8a55c5342 ] + +When cancel_delayed_work() returns, the delayed work may still +be running. This means that the core could potentially free +the private structure (struct xadc) while the delayed work +is still using it. This is a potential use-after-free. + +Fix by calling cancel_delayed_work_sync(), which waits for +any residual work to finish before returning. + +Signed-off-by: Sven Van Asbroeck +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/adc/xilinx-xadc-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c +index 56cf5907a5f01..143894a315d9b 100644 +--- a/drivers/iio/adc/xilinx-xadc-core.c ++++ b/drivers/iio/adc/xilinx-xadc-core.c +@@ -1299,7 +1299,7 @@ static int xadc_remove(struct platform_device *pdev) + } + free_irq(irq, indio_dev); + clk_disable_unprepare(xadc->clk); +- cancel_delayed_work(&xadc->zynq_unmask_work); ++ cancel_delayed_work_sync(&xadc->zynq_unmask_work); + kfree(xadc->data); + kfree(indio_dev->channels); + +-- +2.20.1 + diff --git a/queue-4.9/init-initialize-jump-labels-before-command-line-opti.patch b/queue-4.9/init-initialize-jump-labels-before-command-line-opti.patch new file mode 100644 index 00000000000..c8f20f8324c --- /dev/null +++ b/queue-4.9/init-initialize-jump-labels-before-command-line-opti.patch @@ -0,0 +1,79 @@ +From 354a56e088acf6dac7a381f6d1f603a5aac3f562 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Thu, 18 Apr 2019 17:50:44 -0700 +Subject: init: initialize jump labels before command line option parsing + +[ Upstream commit 6041186a32585fc7a1d0f6cfe2f138b05fdc3c82 ] + +When a module option, or core kernel argument, toggles a static-key it +requires jump labels to be initialized early. While x86, PowerPC, and +ARM64 arrange for jump_label_init() to be called before parse_args(), +ARM does not. + + Kernel command line: rdinit=/sbin/init page_alloc.shuffle=1 panic=-1 console=ttyAMA0,115200 page_alloc.shuffle=1 + ------------[ cut here ]------------ + WARNING: CPU: 0 PID: 0 at ./include/linux/jump_label.h:303 + page_alloc_shuffle+0x12c/0x1ac + static_key_enable(): static key 'page_alloc_shuffle_key+0x0/0x4' used + before call to jump_label_init() + Modules linked in: + CPU: 0 PID: 0 Comm: swapper Not tainted + 5.1.0-rc4-next-20190410-00003-g3367c36ce744 #1 + Hardware name: ARM Integrator/CP (Device Tree) + [] (unwind_backtrace) from [] (show_stack+0x10/0x18) + [] (show_stack) from [] (dump_stack+0x18/0x24) + [] (dump_stack) from [] (__warn+0xe0/0x108) + [] (__warn) from [] (warn_slowpath_fmt+0x44/0x6c) + [] (warn_slowpath_fmt) from [] + (page_alloc_shuffle+0x12c/0x1ac) + [] (page_alloc_shuffle) from [] (shuffle_store+0x28/0x48) + [] (shuffle_store) from [] (parse_args+0x1f4/0x350) + [] (parse_args) from [] (start_kernel+0x1c0/0x488) + +Move the fallback call to jump_label_init() to occur before +parse_args(). + +The redundant calls to jump_label_init() in other archs are left intact +in case they have static key toggling use cases that are even earlier +than option parsing. + +Link: http://lkml.kernel.org/r/155544804466.1032396.13418949511615676665.stgit@dwillia2-desk3.amr.corp.intel.com +Signed-off-by: Dan Williams +Reported-by: Guenter Roeck +Reviewed-by: Kees Cook +Cc: Mathieu Desnoyers +Cc: Thomas Gleixner +Cc: Mike Rapoport +Cc: Russell King +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + init/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/init/main.c b/init/main.c +index 3c7f71d8e7046..148843e627a06 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -516,6 +516,8 @@ asmlinkage __visible void __init start_kernel(void) + page_alloc_init(); + + pr_notice("Kernel command line: %s\n", boot_command_line); ++ /* parameters may set static keys */ ++ jump_label_init(); + parse_early_param(); + after_dashes = parse_args("Booting kernel", + static_command_line, __start___param, +@@ -525,8 +527,6 @@ asmlinkage __visible void __init start_kernel(void) + parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, + NULL, set_init_arg); + +- jump_label_init(); +- + /* + * These use large bootmem allocations and must precede + * kmem_cache_init() +-- +2.20.1 + diff --git a/queue-4.9/input-synaptics-rmi4-fix-possible-double-free.patch b/queue-4.9/input-synaptics-rmi4-fix-possible-double-free.patch new file mode 100644 index 00000000000..2262ebf6d3a --- /dev/null +++ b/queue-4.9/input-synaptics-rmi4-fix-possible-double-free.patch @@ -0,0 +1,45 @@ +From 73b146767ef79c827d525da82220577822b3a5b1 Mon Sep 17 00:00:00 2001 +From: Pan Bian +Date: Fri, 19 Apr 2019 07:39:00 +0000 +Subject: Input: synaptics-rmi4 - fix possible double free + +[ Upstream commit bce1a78423961fce676ac65540a31b6ffd179e6d ] + +The RMI4 function structure has been released in rmi_register_function +if error occurs. However, it will be released again in the function +rmi_create_function, which may result in a double-free bug. + +Signed-off-by: Pan Bian +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/rmi4/rmi_driver.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c +index 4a88312fbd254..65038dcc7613e 100644 +--- a/drivers/input/rmi4/rmi_driver.c ++++ b/drivers/input/rmi4/rmi_driver.c +@@ -772,7 +772,7 @@ static int rmi_create_function(struct rmi_device *rmi_dev, + + error = rmi_register_function(fn); + if (error) +- goto err_put_fn; ++ return error; + + if (pdt->function_number == 0x01) + data->f01_container = fn; +@@ -780,10 +780,6 @@ static int rmi_create_function(struct rmi_device *rmi_dev, + list_add_tail(&fn->node, &data->function_list); + + return RMI_SCAN_CONTINUE; +- +-err_put_fn: +- put_device(&fn->dev); +- return error; + } + + int rmi_driver_suspend(struct rmi_device *rmi_dev) +-- +2.20.1 + diff --git a/queue-4.9/ipvs-do-not-schedule-icmp-errors-from-tunnels.patch b/queue-4.9/ipvs-do-not-schedule-icmp-errors-from-tunnels.patch new file mode 100644 index 00000000000..5b24efdf162 --- /dev/null +++ b/queue-4.9/ipvs-do-not-schedule-icmp-errors-from-tunnels.patch @@ -0,0 +1,38 @@ +From aac1b07909352dcd28f63d1b1d36379451fc63d6 Mon Sep 17 00:00:00 2001 +From: Julian Anastasov +Date: Sun, 31 Mar 2019 13:24:52 +0300 +Subject: ipvs: do not schedule icmp errors from tunnels + +[ Upstream commit 0261ea1bd1eb0da5c0792a9119b8655cf33c80a3 ] + +We can receive ICMP errors from client or from +tunneling real server. While the former can be +scheduled to real server, the latter should +not be scheduled, they are decapsulated only when +existing connection is found. + +Fixes: 6044eeffafbe ("ipvs: attempt to schedule icmp packets") +Signed-off-by: Julian Anastasov +Signed-off-by: Simon Horman +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/ipvs/ip_vs_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c +index fd186b011a999..8475e8692ff04 100644 +--- a/net/netfilter/ipvs/ip_vs_core.c ++++ b/net/netfilter/ipvs/ip_vs_core.c +@@ -1643,7 +1643,7 @@ ip_vs_in_icmp(struct netns_ipvs *ipvs, struct sk_buff *skb, int *related, + if (!cp) { + int v; + +- if (!sysctl_schedule_icmp(ipvs)) ++ if (ipip || !sysctl_schedule_icmp(ipvs)) + return NF_ACCEPT; + + if (!ip_vs_try_to_schedule(ipvs, AF_INET, skb, pd, &v, &cp, &ciph)) +-- +2.20.1 + diff --git a/queue-4.9/kvm-x86-avoid-misreporting-level-triggered-irqs-as-e.patch b/queue-4.9/kvm-x86-avoid-misreporting-level-triggered-irqs-as-e.patch new file mode 100644 index 00000000000..18a6f9fb2ad --- /dev/null +++ b/queue-4.9/kvm-x86-avoid-misreporting-level-triggered-irqs-as-e.patch @@ -0,0 +1,51 @@ +From 2892067bf61adbc11ebb2b213e8692f54adc8fec Mon Sep 17 00:00:00 2001 +From: Vitaly Kuznetsov +Date: Wed, 27 Mar 2019 15:12:20 +0100 +Subject: KVM: x86: avoid misreporting level-triggered irqs as edge-triggered + in tracing + +[ Upstream commit 7a223e06b1a411cef6c4cd7a9b9a33c8d225b10e ] + +In __apic_accept_irq() interface trig_mode is int and actually on some code +paths it is set above u8: + +kvm_apic_set_irq() extracts it from 'struct kvm_lapic_irq' where trig_mode +is u16. This is done on purpose as e.g. kvm_set_msi_irq() sets it to +(1 << 15) & e->msi.data + +kvm_apic_local_deliver sets it to reg & (1 << 15). + +Fix the immediate issue by making 'tm' into u16. We may also want to adjust +__apic_accept_irq() interface and use proper sizes for vector, level, +trig_mode but this is not urgent. + +Signed-off-by: Vitaly Kuznetsov +Signed-off-by: Paolo Bonzini +Signed-off-by: Sasha Levin +--- + arch/x86/kvm/trace.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h +index 0a6cc6754ec5a..ea618b713b6f2 100644 +--- a/arch/x86/kvm/trace.h ++++ b/arch/x86/kvm/trace.h +@@ -434,13 +434,13 @@ TRACE_EVENT(kvm_apic_ipi, + ); + + TRACE_EVENT(kvm_apic_accept_irq, +- TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec), ++ TP_PROTO(__u32 apicid, __u16 dm, __u16 tm, __u8 vec), + TP_ARGS(apicid, dm, tm, vec), + + TP_STRUCT__entry( + __field( __u32, apicid ) + __field( __u16, dm ) +- __field( __u8, tm ) ++ __field( __u16, tm ) + __field( __u8, vec ) + ), + +-- +2.20.1 + diff --git a/queue-4.9/libnvdimm-btt-fix-a-kmemdup-failure-check.patch b/queue-4.9/libnvdimm-btt-fix-a-kmemdup-failure-check.patch new file mode 100644 index 00000000000..380d72d8ce5 --- /dev/null +++ b/queue-4.9/libnvdimm-btt-fix-a-kmemdup-failure-check.patch @@ -0,0 +1,59 @@ +From 09ee1a4caba2073849e07721cb08d9c55345d951 Mon Sep 17 00:00:00 2001 +From: Aditya Pakki +Date: Mon, 25 Mar 2019 16:55:27 -0500 +Subject: libnvdimm/btt: Fix a kmemdup failure check + +[ Upstream commit 486fa92df4707b5df58d6508728bdb9321a59766 ] + +In case kmemdup fails, the fix releases resources and returns to +avoid the NULL pointer dereference. + +Signed-off-by: Aditya Pakki +Signed-off-by: Dan Williams +Signed-off-by: Sasha Levin +--- + drivers/nvdimm/btt_devs.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c +index 97dd2925ed6e9..5d2c766828488 100644 +--- a/drivers/nvdimm/btt_devs.c ++++ b/drivers/nvdimm/btt_devs.c +@@ -190,14 +190,15 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, + return NULL; + + nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL); +- if (nd_btt->id < 0) { +- kfree(nd_btt); +- return NULL; +- } ++ if (nd_btt->id < 0) ++ goto out_nd_btt; + + nd_btt->lbasize = lbasize; +- if (uuid) ++ if (uuid) { + uuid = kmemdup(uuid, 16, GFP_KERNEL); ++ if (!uuid) ++ goto out_put_id; ++ } + nd_btt->uuid = uuid; + dev = &nd_btt->dev; + dev_set_name(dev, "btt%d.%d", nd_region->id, nd_btt->id); +@@ -212,6 +213,13 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, + return NULL; + } + return dev; ++ ++out_put_id: ++ ida_simple_remove(&nd_region->btt_ida, nd_btt->id); ++ ++out_nd_btt: ++ kfree(nd_btt); ++ return NULL; + } + + struct device *nd_btt_create(struct nd_region *nd_region) +-- +2.20.1 + diff --git a/queue-4.9/libnvdimm-namespace-fix-a-potential-null-pointer-der.patch b/queue-4.9/libnvdimm-namespace-fix-a-potential-null-pointer-der.patch new file mode 100644 index 00000000000..7ccae3cc625 --- /dev/null +++ b/queue-4.9/libnvdimm-namespace-fix-a-potential-null-pointer-der.patch @@ -0,0 +1,38 @@ +From 7a47db31380b65bcc2aedffb39509f8ca936d8f6 Mon Sep 17 00:00:00 2001 +From: Kangjie Lu +Date: Tue, 12 Mar 2019 03:20:34 -0500 +Subject: libnvdimm/namespace: Fix a potential NULL pointer dereference + +[ Upstream commit 55c1fc0af29a6c1b92f217b7eb7581a882e0c07c ] + +In case kmemdup fails, the fix goes to blk_err to avoid NULL +pointer dereference. + +Signed-off-by: Kangjie Lu +Signed-off-by: Dan Williams +Signed-off-by: Sasha Levin +--- + drivers/nvdimm/namespace_devs.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c +index 9bc5f555ee686..cf4a90b50f8b8 100644 +--- a/drivers/nvdimm/namespace_devs.c ++++ b/drivers/nvdimm/namespace_devs.c +@@ -2028,9 +2028,12 @@ struct device *create_namespace_blk(struct nd_region *nd_region, + if (!nsblk->uuid) + goto blk_err; + memcpy(name, nd_label->name, NSLABEL_NAME_LEN); +- if (name[0]) ++ if (name[0]) { + nsblk->alt_name = kmemdup(name, NSLABEL_NAME_LEN, + GFP_KERNEL); ++ if (!nsblk->alt_name) ++ goto blk_err; ++ } + res = nsblk_add_resource(nd_region, ndd, nsblk, + __le64_to_cpu(nd_label->dpa)); + if (!res) +-- +2.20.1 + diff --git a/queue-4.9/mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch b/queue-4.9/mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch new file mode 100644 index 00000000000..45c16223359 --- /dev/null +++ b/queue-4.9/mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch @@ -0,0 +1,33 @@ +From f5ea9e1a8ddb47162be6d5133bde1d4973c61cd4 Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Wed, 13 Mar 2019 18:54:27 +0100 +Subject: mac80211: fix unaligned access in mesh table hash function + +[ Upstream commit 40586e3fc400c00c11151804dcdc93f8c831c808 ] + +The pointer to the last four bytes of the address is not guaranteed to be +aligned, so we need to use __get_unaligned_cpu32 here + +Signed-off-by: Felix Fietkau +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/mesh_pathtbl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c +index 197753ad50b4e..8c17d498df301 100644 +--- a/net/mac80211/mesh_pathtbl.c ++++ b/net/mac80211/mesh_pathtbl.c +@@ -23,7 +23,7 @@ static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path *mpath); + static u32 mesh_table_hash(const void *addr, u32 len, u32 seed) + { + /* Use last four bytes of hw addr as hash index */ +- return jhash_1word(*(u32 *)(addr+2), seed); ++ return jhash_1word(__get_unaligned_cpu32((u8 *)addr + 2), seed); + } + + static const struct rhashtable_params mesh_rht_params = { +-- +2.20.1 + diff --git a/queue-4.9/mips-perf-ath79-fix-perfcount-irq-assignment.patch b/queue-4.9/mips-perf-ath79-fix-perfcount-irq-assignment.patch new file mode 100644 index 00000000000..6d24cb195f6 --- /dev/null +++ b/queue-4.9/mips-perf-ath79-fix-perfcount-irq-assignment.patch @@ -0,0 +1,118 @@ +From 6a75db562a9dc988e8f2bbd521a3cd754b6a44a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Fri, 12 Apr 2019 23:08:32 +0200 +Subject: MIPS: perf: ath79: Fix perfcount IRQ assignment +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ Upstream commit a1e8783db8e0d58891681bc1e6d9ada66eae8e20 ] + +Currently it's not possible to use perf on ath79 due to genirq flags +mismatch happening on static virtual IRQ 13 which is used for +performance counters hardware IRQ 5. + +On TP-Link Archer C7v5: + + CPU0 + 2: 0 MIPS 2 ath9k + 4: 318 MIPS 4 19000000.eth + 7: 55034 MIPS 7 timer + 8: 1236 MISC 3 ttyS0 + 12: 0 INTC 1 ehci_hcd:usb1 + 13: 0 gpio-ath79 2 keys + 14: 0 gpio-ath79 5 keys + 15: 31 AR724X PCI 1 ath10k_pci + + $ perf top + genirq: Flags mismatch irq 13. 00014c83 (mips_perf_pmu) vs. 00002003 (keys) + +On TP-Link Archer C7v4: + + CPU0 + 4: 0 MIPS 4 19000000.eth + 5: 7135 MIPS 5 1a000000.eth + 7: 98379 MIPS 7 timer + 8: 30 MISC 3 ttyS0 + 12: 90028 INTC 0 ath9k + 13: 5520 INTC 1 ehci_hcd:usb1 + 14: 4623 INTC 2 ehci_hcd:usb2 + 15: 32844 AR724X PCI 1 ath10k_pci + 16: 0 gpio-ath79 16 keys + 23: 0 gpio-ath79 23 keys + + $ perf top + genirq: Flags mismatch irq 13. 00014c80 (mips_perf_pmu) vs. 00000080 (ehci_hcd:usb1) + +This problem is happening, because currently statically assigned virtual +IRQ 13 for performance counters is not claimed during the initialization +of MIPS PMU during the bootup, so the IRQ subsystem doesn't know, that +this interrupt isn't available for further use. + +So this patch fixes the issue by simply booking hardware IRQ 5 for MIPS PMU. + +Tested-by: Kevin 'ldir' Darbyshire-Bryant +Signed-off-by: Petr Štetiar +Acked-by: John Crispin +Acked-by: Marc Zyngier +Signed-off-by: Paul Burton +Cc: linux-mips@vger.kernel.org +Cc: Ralf Baechle +Cc: James Hogan +Cc: Thomas Gleixner +Cc: Jason Cooper +Signed-off-by: Sasha Levin +--- + arch/mips/ath79/setup.c | 6 ------ + drivers/irqchip/irq-ath79-misc.c | 11 +++++++++++ + 2 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c +index 26a058d58d37b..c7c31e2148136 100644 +--- a/arch/mips/ath79/setup.c ++++ b/arch/mips/ath79/setup.c +@@ -183,12 +183,6 @@ const char *get_system_type(void) + return ath79_sys_type; + } + +-int get_c0_perfcount_int(void) +-{ +- return ATH79_MISC_IRQ(5); +-} +-EXPORT_SYMBOL_GPL(get_c0_perfcount_int); +- + unsigned int get_c0_compare_int(void) + { + return CP0_LEGACY_COMPARE_IRQ; +diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c +index aa72907846360..0390603170b40 100644 +--- a/drivers/irqchip/irq-ath79-misc.c ++++ b/drivers/irqchip/irq-ath79-misc.c +@@ -22,6 +22,15 @@ + #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 + + #define ATH79_MISC_IRQ_COUNT 32 ++#define ATH79_MISC_PERF_IRQ 5 ++ ++static int ath79_perfcount_irq; ++ ++int get_c0_perfcount_int(void) ++{ ++ return ath79_perfcount_irq; ++} ++EXPORT_SYMBOL_GPL(get_c0_perfcount_int); + + static void ath79_misc_irq_handler(struct irq_desc *desc) + { +@@ -113,6 +122,8 @@ static void __init ath79_misc_intc_domain_init( + { + void __iomem *base = domain->host_data; + ++ ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ); ++ + /* Disable and clear all interrupts */ + __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); + __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); +-- +2.20.1 + diff --git a/queue-4.9/misdn-check-address-length-before-reading-address-fa.patch b/queue-4.9/misdn-check-address-length-before-reading-address-fa.patch new file mode 100644 index 00000000000..23abf95a2ca --- /dev/null +++ b/queue-4.9/misdn-check-address-length-before-reading-address-fa.patch @@ -0,0 +1,37 @@ +From c05804566350e9abffda4621dd6dfd12e2473c2b Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Fri, 12 Apr 2019 19:52:36 +0900 +Subject: mISDN: Check address length before reading address family + +[ Upstream commit 238ffdc49ef98b15819cfd5e3fb23194e3ea3d39 ] + +KMSAN will complain if valid address length passed to bind() is shorter +than sizeof("struct sockaddr_mISDN"->family) bytes. + +Signed-off-by: Tetsuo Handa +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/isdn/mISDN/socket.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c +index 99e5f9751e8b1..f96b8f2bdf743 100644 +--- a/drivers/isdn/mISDN/socket.c ++++ b/drivers/isdn/mISDN/socket.c +@@ -712,10 +712,10 @@ base_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) + struct sock *sk = sock->sk; + int err = 0; + +- if (!maddr || maddr->family != AF_ISDN) ++ if (addr_len < sizeof(struct sockaddr_mISDN)) + return -EINVAL; + +- if (addr_len < sizeof(struct sockaddr_mISDN)) ++ if (!maddr || maddr->family != AF_ISDN) + return -EINVAL; + + lock_sock(sk); +-- +2.20.1 + diff --git a/queue-4.9/s390-3270-fix-lockdep-false-positive-on-view-lock.patch b/queue-4.9/s390-3270-fix-lockdep-false-positive-on-view-lock.patch new file mode 100644 index 00000000000..6ad03016379 --- /dev/null +++ b/queue-4.9/s390-3270-fix-lockdep-false-positive-on-view-lock.patch @@ -0,0 +1,122 @@ +From e4aa5c0ea49d39fef959fe4bcf5ad728504b5c4f Mon Sep 17 00:00:00 2001 +From: Martin Schwidefsky +Date: Wed, 3 Apr 2019 09:13:34 +0200 +Subject: s390/3270: fix lockdep false positive on view->lock + +[ Upstream commit 5712f3301a12c0c3de9cc423484496b0464f2faf ] + +The spinlock in the raw3270_view structure is used by con3270, tty3270 +and fs3270 in different ways. For con3270 the lock can be acquired in +irq context, for tty3270 and fs3270 the highest context is bh. + +Lockdep sees the view->lock as a single class and if the 3270 driver +is used for the console the following message is generated: + +WARNING: inconsistent lock state +5.1.0-rc3-05157-g5c168033979d #12 Not tainted +-------------------------------- +inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. +swapper/0/1 [HC0[0]:SC1[1]:HE1:SE0] takes: +(____ptrval____) (&(&view->lock)->rlock){?.-.}, at: tty3270_update+0x7c/0x330 + +Introduce a lockdep subclass for the view lock to distinguish bh from +irq locks. + +Signed-off-by: Martin Schwidefsky + +Signed-off-by: Sasha Levin +--- + drivers/s390/char/con3270.c | 2 +- + drivers/s390/char/fs3270.c | 3 ++- + drivers/s390/char/raw3270.c | 3 ++- + drivers/s390/char/raw3270.h | 4 +++- + drivers/s390/char/tty3270.c | 3 ++- + 5 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c +index 285b4006f44bb..5d5e78afde88a 100644 +--- a/drivers/s390/char/con3270.c ++++ b/drivers/s390/char/con3270.c +@@ -628,7 +628,7 @@ con3270_init(void) + (void (*)(unsigned long)) con3270_read_tasklet, + (unsigned long) condev->read); + +- raw3270_add_view(&condev->view, &con3270_fn, 1); ++ raw3270_add_view(&condev->view, &con3270_fn, 1, RAW3270_VIEW_LOCK_IRQ); + + INIT_LIST_HEAD(&condev->freemem); + for (i = 0; i < CON3270_STRING_PAGES; i++) { +diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c +index 85eca1cef0630..04a6810a4298c 100644 +--- a/drivers/s390/char/fs3270.c ++++ b/drivers/s390/char/fs3270.c +@@ -462,7 +462,8 @@ fs3270_open(struct inode *inode, struct file *filp) + + init_waitqueue_head(&fp->wait); + fp->fs_pid = get_pid(task_pid(current)); +- rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); ++ rc = raw3270_add_view(&fp->view, &fs3270_fn, minor, ++ RAW3270_VIEW_LOCK_BH); + if (rc) { + fs3270_free_view(&fp->view); + goto out; +diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c +index a2da898ce90fd..1ebf632e327b9 100644 +--- a/drivers/s390/char/raw3270.c ++++ b/drivers/s390/char/raw3270.c +@@ -919,7 +919,7 @@ raw3270_deactivate_view(struct raw3270_view *view) + * Add view to device with minor "minor". + */ + int +-raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) ++raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor, int subclass) + { + unsigned long flags; + struct raw3270 *rp; +@@ -941,6 +941,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) + view->cols = rp->cols; + view->ascebc = rp->ascebc; + spin_lock_init(&view->lock); ++ lockdep_set_subclass(&view->lock, subclass); + list_add(&view->list, &rp->view_list); + rc = 0; + spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); +diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h +index 56519cbb165c7..7577d7d0ad486 100644 +--- a/drivers/s390/char/raw3270.h ++++ b/drivers/s390/char/raw3270.h +@@ -149,6 +149,8 @@ struct raw3270_fn { + struct raw3270_view { + struct list_head list; + spinlock_t lock; ++#define RAW3270_VIEW_LOCK_IRQ 0 ++#define RAW3270_VIEW_LOCK_BH 1 + atomic_t ref_count; + struct raw3270 *dev; + struct raw3270_fn *fn; +@@ -157,7 +159,7 @@ struct raw3270_view { + unsigned char *ascebc; /* ascii -> ebcdic table */ + }; + +-int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int); ++int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int, int); + int raw3270_activate_view(struct raw3270_view *); + void raw3270_del_view(struct raw3270_view *); + void raw3270_deactivate_view(struct raw3270_view *); +diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c +index 272cb6cd1b2ac..6dd6f9ff7de56 100644 +--- a/drivers/s390/char/tty3270.c ++++ b/drivers/s390/char/tty3270.c +@@ -978,7 +978,8 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) + return PTR_ERR(tp); + + rc = raw3270_add_view(&tp->view, &tty3270_fn, +- tty->index + RAW3270_FIRSTMINOR); ++ tty->index + RAW3270_FIRSTMINOR, ++ RAW3270_VIEW_LOCK_BH); + if (rc) { + tty3270_free_view(tp); + return rc; +-- +2.20.1 + diff --git a/queue-4.9/s390-ctcm-fix-ctcm_new_device-error-return-code.patch b/queue-4.9/s390-ctcm-fix-ctcm_new_device-error-return-code.patch new file mode 100644 index 00000000000..55ff95977d6 --- /dev/null +++ b/queue-4.9/s390-ctcm-fix-ctcm_new_device-error-return-code.patch @@ -0,0 +1,53 @@ +From 9c28e481f832b4509c5059acebccd3a0febafba8 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 17 Apr 2019 18:29:13 +0200 +Subject: s390: ctcm: fix ctcm_new_device error return code + +[ Upstream commit 27b141fc234a3670d21bd742c35d7205d03cbb3a ] + +clang points out that the return code from this function is +undefined for one of the error paths: + +../drivers/s390/net/ctcm_main.c:1595:7: warning: variable 'result' is used uninitialized whenever 'if' condition is true + [-Wsometimes-uninitialized] + if (priv->channel[direction] == NULL) { + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../drivers/s390/net/ctcm_main.c:1638:9: note: uninitialized use occurs here + return result; + ^~~~~~ +../drivers/s390/net/ctcm_main.c:1595:3: note: remove the 'if' if its condition is always false + if (priv->channel[direction] == NULL) { + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../drivers/s390/net/ctcm_main.c:1539:12: note: initialize the variable 'result' to silence this warning + int result; + ^ + +Make it return -ENODEV here, as in the related failure cases. +gcc has a known bug in underreporting some of these warnings +when it has already eliminated the assignment of the return code +based on some earlier optimization step. + +Reviewed-by: Nathan Chancellor +Signed-off-by: Arnd Bergmann +Signed-off-by: Julian Wiedmann +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/s390/net/ctcm_main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c +index ad17fc5883f61..e22b9ac3e564f 100644 +--- a/drivers/s390/net/ctcm_main.c ++++ b/drivers/s390/net/ctcm_main.c +@@ -1595,6 +1595,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) + if (priv->channel[direction] == NULL) { + if (direction == CTCM_WRITE) + channel_free(priv->channel[CTCM_READ]); ++ result = -ENODEV; + goto out_dev; + } + priv->channel[direction]->netdev = dev; +-- +2.20.1 + diff --git a/queue-4.9/s390-dasd-fix-capacity-calculation-for-large-volumes.patch b/queue-4.9/s390-dasd-fix-capacity-calculation-for-large-volumes.patch new file mode 100644 index 00000000000..6473ea83a04 --- /dev/null +++ b/queue-4.9/s390-dasd-fix-capacity-calculation-for-large-volumes.patch @@ -0,0 +1,59 @@ +From da65e3a21e4a2c98fd540b36784205a0baaff38b Mon Sep 17 00:00:00 2001 +From: Peter Oberparleiter +Date: Fri, 22 Mar 2019 16:01:17 +0100 +Subject: s390/dasd: Fix capacity calculation for large volumes + +[ Upstream commit 2cc9637ce825f3a9f51f8f78af7474e9e85bfa5f ] + +The DASD driver incorrectly limits the maximum number of blocks of ECKD +DASD volumes to 32 bit numbers. Volumes with a capacity greater than +2^32-1 blocks are incorrectly recognized as smaller volumes. + +This results in the following volume capacity limits depending on the +formatted block size: + + BLKSIZE MAX_GB MAX_CYL + 512 2047 5843492 + 1024 4095 8676701 + 2048 8191 13634816 + 4096 16383 23860929 + +The same problem occurs when a volume with more than 17895697 cylinders +is accessed in raw-track-access mode. + +Fix this problem by adding an explicit type cast when calculating the +maximum number of blocks. + +Signed-off-by: Peter Oberparleiter +Reviewed-by: Stefan Haberland +Signed-off-by: Martin Schwidefsky +Signed-off-by: Sasha Levin +--- + drivers/s390/block/dasd_eckd.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c +index 11c6335b19516..9d772201e3347 100644 +--- a/drivers/s390/block/dasd_eckd.c ++++ b/drivers/s390/block/dasd_eckd.c +@@ -2054,14 +2054,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block) + blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); + + raw: +- block->blocks = (private->real_cyl * ++ block->blocks = ((unsigned long) private->real_cyl * + private->rdc_data.trk_per_cyl * + blk_per_trk); + + dev_info(&device->cdev->dev, +- "DASD with %d KB/block, %d KB total size, %d KB/track, " ++ "DASD with %u KB/block, %lu KB total size, %u KB/track, " + "%s\n", (block->bp_block >> 10), +- ((private->real_cyl * ++ (((unsigned long) private->real_cyl * + private->rdc_data.trk_per_cyl * + blk_per_trk * (block->bp_block >> 9)) >> 1), + ((blk_per_trk * block->bp_block) >> 10), +-- +2.20.1 + diff --git a/queue-4.9/selftests-net-correct-the-return-value-for-run_netso.patch b/queue-4.9/selftests-net-correct-the-return-value-for-run_netso.patch new file mode 100644 index 00000000000..baa7b0cb607 --- /dev/null +++ b/queue-4.9/selftests-net-correct-the-return-value-for-run_netso.patch @@ -0,0 +1,44 @@ +From 1c71c371a139e3644b049c4a22b4453484e6d005 Mon Sep 17 00:00:00 2001 +From: Po-Hsu Lin +Date: Thu, 18 Apr 2019 19:57:25 +0800 +Subject: selftests/net: correct the return value for run_netsocktests + +[ Upstream commit 30c04d796b693e22405c38e9b78e9a364e4c77e6 ] + +The run_netsocktests will be marked as passed regardless the actual test +result from the ./socket: + + selftests: net: run_netsocktests + ======================================== + -------------------- + running socket test + -------------------- + [FAIL] + ok 1..6 selftests: net: run_netsocktests [PASS] + +This is because the test script itself has been successfully executed. +Fix this by exit 1 when the test failed. + +Signed-off-by: Po-Hsu Lin +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/run_netsocktests | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/net/run_netsocktests b/tools/testing/selftests/net/run_netsocktests +index 16058bbea7a85..c195b44786627 100755 +--- a/tools/testing/selftests/net/run_netsocktests ++++ b/tools/testing/selftests/net/run_netsocktests +@@ -6,7 +6,7 @@ echo "--------------------" + ./socket + if [ $? -ne 0 ]; then + echo "[FAIL]" ++ exit 1 + else + echo "[PASS]" + fi +- +-- +2.20.1 + diff --git a/queue-4.9/selftests-netfilter-check-icmp-pkttoobig-errors-are-.patch b/queue-4.9/selftests-netfilter-check-icmp-pkttoobig-errors-are-.patch new file mode 100644 index 00000000000..07c381d4b0b --- /dev/null +++ b/queue-4.9/selftests-netfilter-check-icmp-pkttoobig-errors-are-.patch @@ -0,0 +1,333 @@ +From d5e74eeb60427b511968526bf661a6fccbee4919 Mon Sep 17 00:00:00 2001 +From: Florian Westphal +Date: Mon, 25 Mar 2019 23:11:53 +0100 +Subject: selftests: netfilter: check icmp pkttoobig errors are set as related + +[ Upstream commit becf2319f320cae43e20cf179cc51a355a0deb5f ] + +When an icmp error such as pkttoobig is received, conntrack checks +if the "inner" header (header of packet that did not fit link mtu) +is matches an existing connection, and, if so, sets that packet as +being related to the conntrack entry it found. + +It was recently reported that this "related" setting also works +if the inner header is from another, different connection (i.e., +artificial/forged icmp error). + +Add a test, followup patch will add additional "inner dst matches +outer dst in reverse direction" check before setting related state. + +Link: https://www.synacktiv.com/posts/systems/icmp-reachable.html +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/netfilter/Makefile | 2 +- + .../netfilter/conntrack_icmp_related.sh | 283 ++++++++++++++++++ + 2 files changed, 284 insertions(+), 1 deletion(-) + create mode 100755 tools/testing/selftests/netfilter/conntrack_icmp_related.sh + +diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile +index c9ff2b47bd1ca..a37cb1192c6a6 100644 +--- a/tools/testing/selftests/netfilter/Makefile ++++ b/tools/testing/selftests/netfilter/Makefile +@@ -1,6 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0 + # Makefile for netfilter selftests + +-TEST_PROGS := nft_trans_stress.sh nft_nat.sh ++TEST_PROGS := nft_trans_stress.sh nft_nat.sh conntrack_icmp_related.sh + + include ../lib.mk +diff --git a/tools/testing/selftests/netfilter/conntrack_icmp_related.sh b/tools/testing/selftests/netfilter/conntrack_icmp_related.sh +new file mode 100755 +index 0000000000000..b48e1833bc896 +--- /dev/null ++++ b/tools/testing/selftests/netfilter/conntrack_icmp_related.sh +@@ -0,0 +1,283 @@ ++#!/bin/bash ++# ++# check that ICMP df-needed/pkttoobig icmp are set are set as related ++# state ++# ++# Setup is: ++# ++# nsclient1 -> nsrouter1 -> nsrouter2 -> nsclient2 ++# MTU 1500, except for nsrouter2 <-> nsclient2 link (1280). ++# ping nsclient2 from nsclient1, checking that conntrack did set RELATED ++# 'fragmentation needed' icmp packet. ++# ++# In addition, nsrouter1 will perform IP masquerading, i.e. also ++# check the icmp errors are propagated to the correct host as per ++# nat of "established" icmp-echo "connection". ++ ++# Kselftest framework requirement - SKIP code is 4. ++ksft_skip=4 ++ret=0 ++ ++nft --version > /dev/null 2>&1 ++if [ $? -ne 0 ];then ++ echo "SKIP: Could not run test without nft tool" ++ exit $ksft_skip ++fi ++ ++ip -Version > /dev/null 2>&1 ++if [ $? -ne 0 ];then ++ echo "SKIP: Could not run test without ip tool" ++ exit $ksft_skip ++fi ++ ++cleanup() { ++ for i in 1 2;do ip netns del nsclient$i;done ++ for i in 1 2;do ip netns del nsrouter$i;done ++} ++ ++ipv4() { ++ echo -n 192.168.$1.2 ++} ++ ++ipv6 () { ++ echo -n dead:$1::2 ++} ++ ++check_counter() ++{ ++ ns=$1 ++ name=$2 ++ expect=$3 ++ local lret=0 ++ ++ cnt=$(ip netns exec $ns nft list counter inet filter "$name" | grep -q "$expect") ++ if [ $? -ne 0 ]; then ++ echo "ERROR: counter $name in $ns has unexpected value (expected $expect)" 1>&2 ++ ip netns exec $ns nft list counter inet filter "$name" 1>&2 ++ lret=1 ++ fi ++ ++ return $lret ++} ++ ++check_unknown() ++{ ++ expect="packets 0 bytes 0" ++ for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do ++ check_counter $n "unknown" "$expect" ++ if [ $? -ne 0 ] ;then ++ return 1 ++ fi ++ done ++ ++ return 0 ++} ++ ++for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do ++ ip netns add $n ++ ip -net $n link set lo up ++done ++ ++DEV=veth0 ++ip link add $DEV netns nsclient1 type veth peer name eth1 netns nsrouter1 ++DEV=veth0 ++ip link add $DEV netns nsclient2 type veth peer name eth1 netns nsrouter2 ++ ++DEV=veth0 ++ip link add $DEV netns nsrouter1 type veth peer name eth2 netns nsrouter2 ++ ++DEV=veth0 ++for i in 1 2; do ++ ip -net nsclient$i link set $DEV up ++ ip -net nsclient$i addr add $(ipv4 $i)/24 dev $DEV ++ ip -net nsclient$i addr add $(ipv6 $i)/64 dev $DEV ++done ++ ++ip -net nsrouter1 link set eth1 up ++ip -net nsrouter1 link set veth0 up ++ ++ip -net nsrouter2 link set eth1 up ++ip -net nsrouter2 link set eth2 up ++ ++ip -net nsclient1 route add default via 192.168.1.1 ++ip -net nsclient1 -6 route add default via dead:1::1 ++ ++ip -net nsclient2 route add default via 192.168.2.1 ++ip -net nsclient2 route add default via dead:2::1 ++ ++i=3 ++ip -net nsrouter1 addr add 192.168.1.1/24 dev eth1 ++ip -net nsrouter1 addr add 192.168.3.1/24 dev veth0 ++ip -net nsrouter1 addr add dead:1::1/64 dev eth1 ++ip -net nsrouter1 addr add dead:3::1/64 dev veth0 ++ip -net nsrouter1 route add default via 192.168.3.10 ++ip -net nsrouter1 -6 route add default via dead:3::10 ++ ++ip -net nsrouter2 addr add 192.168.2.1/24 dev eth1 ++ip -net nsrouter2 addr add 192.168.3.10/24 dev eth2 ++ip -net nsrouter2 addr add dead:2::1/64 dev eth1 ++ip -net nsrouter2 addr add dead:3::10/64 dev eth2 ++ip -net nsrouter2 route add default via 192.168.3.1 ++ip -net nsrouter2 route add default via dead:3::1 ++ ++sleep 2 ++for i in 4 6; do ++ ip netns exec nsrouter1 sysctl -q net.ipv$i.conf.all.forwarding=1 ++ ip netns exec nsrouter2 sysctl -q net.ipv$i.conf.all.forwarding=1 ++done ++ ++for netns in nsrouter1 nsrouter2; do ++ip netns exec $netns nft -f - </dev/null ++if [ $? -ne 0 ]; then ++ echo "ERROR: netns ip routing/connectivity broken" 1>&2 ++ cleanup ++ exit 1 ++fi ++ip netns exec nsclient1 ping6 -q -c 1 -s 1000 dead:2::2 >/dev/null ++if [ $? -ne 0 ]; then ++ echo "ERROR: netns ipv6 routing/connectivity broken" 1>&2 ++ cleanup ++ exit 1 ++fi ++ ++check_unknown ++if [ $? -ne 0 ]; then ++ ret=1 ++fi ++ ++expect="packets 0 bytes 0" ++for netns in nsrouter1 nsrouter2 nsclient1;do ++ check_counter "$netns" "related" "$expect" ++ if [ $? -ne 0 ]; then ++ ret=1 ++ fi ++done ++ ++expect="packets 2 bytes 2076" ++check_counter nsclient2 "new" "$expect" ++if [ $? -ne 0 ]; then ++ ret=1 ++fi ++ ++ip netns exec nsclient1 ping -q -c 1 -s 1300 -M do 192.168.2.2 > /dev/null ++if [ $? -eq 0 ]; then ++ echo "ERROR: ping should have failed with PMTU too big error" 1>&2 ++ ret=1 ++fi ++ ++# nsrouter2 should have generated the icmp error, so ++# related counter should be 0 (its in forward). ++expect="packets 0 bytes 0" ++check_counter "nsrouter2" "related" "$expect" ++if [ $? -ne 0 ]; then ++ ret=1 ++fi ++ ++# but nsrouter1 should have seen it, same for nsclient1. ++expect="packets 1 bytes 576" ++for netns in nsrouter1 nsclient1;do ++ check_counter "$netns" "related" "$expect" ++ if [ $? -ne 0 ]; then ++ ret=1 ++ fi ++done ++ ++ip netns exec nsclient1 ping6 -c 1 -s 1300 dead:2::2 > /dev/null ++if [ $? -eq 0 ]; then ++ echo "ERROR: ping6 should have failed with PMTU too big error" 1>&2 ++ ret=1 ++fi ++ ++expect="packets 2 bytes 1856" ++for netns in nsrouter1 nsclient1;do ++ check_counter "$netns" "related" "$expect" ++ if [ $? -ne 0 ]; then ++ ret=1 ++ fi ++done ++ ++if [ $ret -eq 0 ];then ++ echo "PASS: icmp mtu error had RELATED state" ++else ++ echo "ERROR: icmp error RELATED state test has failed" ++fi ++ ++cleanup ++exit $ret +-- +2.20.1 + diff --git a/queue-4.9/series b/queue-4.9/series index eebc79aaf92..ef4502131f0 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -3,3 +3,27 @@ bpf-fix-struct-htab_elem-layout.patch bpf-convert-htab-map-to-hlist_nulls.patch platform-x86-sony-laptop-fix-unintentional-fall-through.patch usb-serial-fix-unthrottle-races.patch +iio-adc-xilinx-fix-potential-use-after-free-on-remov.patch +libnvdimm-namespace-fix-a-potential-null-pointer-der.patch +hid-input-add-mapping-for-expose-overview-key.patch +hid-input-add-mapping-for-keyboard-brightness-up-dow.patch +hid-input-add-mapping-for-toggle-display-key.patch +libnvdimm-btt-fix-a-kmemdup-failure-check.patch +s390-dasd-fix-capacity-calculation-for-large-volumes.patch +mac80211-fix-unaligned-access-in-mesh-table-hash-fun.patch +s390-3270-fix-lockdep-false-positive-on-view-lock.patch +misdn-check-address-length-before-reading-address-fa.patch +x86-reboot-efi-use-efi-reboot-for-acer-travelmate-x5.patch +kvm-x86-avoid-misreporting-level-triggered-irqs-as-e.patch +tools-lib-traceevent-fix-missing-equality-check-for-.patch +init-initialize-jump-labels-before-command-line-opti.patch +selftests-netfilter-check-icmp-pkttoobig-errors-are-.patch +ipvs-do-not-schedule-icmp-errors-from-tunnels.patch +mips-perf-ath79-fix-perfcount-irq-assignment.patch +s390-ctcm-fix-ctcm_new_device-error-return-code.patch +drm-sun4i-set-device-driver-data-at-bind-time-for-us.patch +selftests-net-correct-the-return-value-for-run_netso.patch +gpu-ipu-v3-dp-fix-csc-handling.patch +spi-micrel-eth-switch-declare-missing-of-table.patch +spi-st-st95hf-nfc-declare-missing-of-table.patch +input-synaptics-rmi4-fix-possible-double-free.patch diff --git a/queue-4.9/spi-micrel-eth-switch-declare-missing-of-table.patch b/queue-4.9/spi-micrel-eth-switch-declare-missing-of-table.patch new file mode 100644 index 00000000000..03eef9161d3 --- /dev/null +++ b/queue-4.9/spi-micrel-eth-switch-declare-missing-of-table.patch @@ -0,0 +1,66 @@ +From 6dfaa675cf8de5a26d6d18e82355b50e31f417d5 Mon Sep 17 00:00:00 2001 +From: Daniel Gomez +Date: Mon, 22 Apr 2019 21:08:03 +0200 +Subject: spi: Micrel eth switch: declare missing of table + +[ Upstream commit 2f23a2a768bee7ad2ff1e9527c3f7e279e794a46 ] + +Add missing table for SPI driver relying on SPI +device match since compatible is in a DT binding or in a DTS. + +Before this patch: +modinfo drivers/net/phy/spi_ks8995.ko | grep alias +alias: spi:ksz8795 +alias: spi:ksz8864 +alias: spi:ks8995 + +After this patch: +modinfo drivers/net/phy/spi_ks8995.ko | grep alias +alias: spi:ksz8795 +alias: spi:ksz8864 +alias: spi:ks8995 +alias: of:N*T*Cmicrel,ksz8795C* +alias: of:N*T*Cmicrel,ksz8795 +alias: of:N*T*Cmicrel,ksz8864C* +alias: of:N*T*Cmicrel,ksz8864 +alias: of:N*T*Cmicrel,ks8995C* +alias: of:N*T*Cmicrel,ks8995 + +Reported-by: Javier Martinez Canillas +Signed-off-by: Daniel Gomez +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/spi_ks8995.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c +index 1e2d4f1179da3..45df03673e010 100644 +--- a/drivers/net/phy/spi_ks8995.c ++++ b/drivers/net/phy/spi_ks8995.c +@@ -162,6 +162,14 @@ static const struct spi_device_id ks8995_id[] = { + }; + MODULE_DEVICE_TABLE(spi, ks8995_id); + ++static const struct of_device_id ks8895_spi_of_match[] = { ++ { .compatible = "micrel,ks8995" }, ++ { .compatible = "micrel,ksz8864" }, ++ { .compatible = "micrel,ksz8795" }, ++ { }, ++ }; ++MODULE_DEVICE_TABLE(of, ks8895_spi_of_match); ++ + static inline u8 get_chip_id(u8 val) + { + return (val >> ID1_CHIPID_S) & ID1_CHIPID_M; +@@ -529,6 +537,7 @@ static int ks8995_remove(struct spi_device *spi) + static struct spi_driver ks8995_driver = { + .driver = { + .name = "spi-ks8995", ++ .of_match_table = of_match_ptr(ks8895_spi_of_match), + }, + .probe = ks8995_probe, + .remove = ks8995_remove, +-- +2.20.1 + diff --git a/queue-4.9/spi-st-st95hf-nfc-declare-missing-of-table.patch b/queue-4.9/spi-st-st95hf-nfc-declare-missing-of-table.patch new file mode 100644 index 00000000000..3373a3da0af --- /dev/null +++ b/queue-4.9/spi-st-st95hf-nfc-declare-missing-of-table.patch @@ -0,0 +1,56 @@ +From 102c0ad1f0c10ef5f46bb2ff07fda651c32c3a51 Mon Sep 17 00:00:00 2001 +From: Daniel Gomez +Date: Mon, 22 Apr 2019 21:08:04 +0200 +Subject: spi: ST ST95HF NFC: declare missing of table + +[ Upstream commit d04830531d0c4a99c897a44038e5da3d23331d2f ] + +Add missing table for SPI driver relying on SPI +device match since compatible is in a DT binding or in a DTS. + +Before this patch: +modinfo drivers/nfc/st95hf/st95hf.ko | grep alias +alias: spi:st95hf + +After this patch: +modinfo drivers/nfc/st95hf/st95hf.ko | grep alias +alias: spi:st95hf +alias: of:N*T*Cst,st95hfC* +alias: of:N*T*Cst,st95hf + +Reported-by: Javier Martinez Canillas +Signed-off-by: Daniel Gomez +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/nfc/st95hf/core.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c +index c2840e4129624..850e75571c8ee 100644 +--- a/drivers/nfc/st95hf/core.c ++++ b/drivers/nfc/st95hf/core.c +@@ -1074,6 +1074,12 @@ static const struct spi_device_id st95hf_id[] = { + }; + MODULE_DEVICE_TABLE(spi, st95hf_id); + ++static const struct of_device_id st95hf_spi_of_match[] = { ++ { .compatible = "st,st95hf" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, st95hf_spi_of_match); ++ + static int st95hf_probe(struct spi_device *nfc_spi_dev) + { + int ret; +@@ -1260,6 +1266,7 @@ static struct spi_driver st95hf_driver = { + .driver = { + .name = "st95hf", + .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(st95hf_spi_of_match), + }, + .id_table = st95hf_id, + .probe = st95hf_probe, +-- +2.20.1 + diff --git a/queue-4.9/tools-lib-traceevent-fix-missing-equality-check-for-.patch b/queue-4.9/tools-lib-traceevent-fix-missing-equality-check-for-.patch new file mode 100644 index 00000000000..5d93e786989 --- /dev/null +++ b/queue-4.9/tools-lib-traceevent-fix-missing-equality-check-for-.patch @@ -0,0 +1,59 @@ +From b1b35e8f610d3d007ae3a13d0e6bdb8bc9269499 Mon Sep 17 00:00:00 2001 +From: Rikard Falkeborn +Date: Tue, 9 Apr 2019 11:15:29 +0200 +Subject: tools lib traceevent: Fix missing equality check for strcmp + +[ Upstream commit f32c2877bcb068a718bb70094cd59ccc29d4d082 ] + +There was a missing comparison with 0 when checking if type is "s64" or +"u64". Therefore, the body of the if-statement was entered if "type" was +"u64" or not "s64", which made the first strcmp() redundant since if +type is "u64", it's not "s64". + +If type is "s64", the body of the if-statement is not entered but since +the remainder of the function consists of if-statements which will not +be entered if type is "s64", we will just return "val", which is +correct, albeit at the cost of a few more calls to strcmp(), i.e., it +will behave just as if the if-statement was entered. + +If type is neither "s64" or "u64", the body of the if-statement will be +entered incorrectly and "val" returned. This means that any type that is +checked after "s64" and "u64" is handled the same way as "s64" and +"u64", i.e., the limiting of "val" to fit in for example "s8" is never +reached. + +This was introduced in the kernel tree when the sources were copied from +trace-cmd in commit f7d82350e597 ("tools/events: Add files to create +libtraceevent.a"), and in the trace-cmd repo in 1cdbae6035cei +("Implement typecasting in parser") when the function was introduced, +i.e., it has always behaved the wrong way. + +Detected by cppcheck. + +Signed-off-by: Rikard Falkeborn +Reviewed-by: Steven Rostedt (VMware) +Cc: Tzvetomir Stoyanov +Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a") +Link: http://lkml.kernel.org/r/20190409091529.2686-1-rikard.falkeborn@gmail.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/lib/traceevent/event-parse.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c +index 700c74b0aed02..def61125ac36d 100644 +--- a/tools/lib/traceevent/event-parse.c ++++ b/tools/lib/traceevent/event-parse.c +@@ -2204,7 +2204,7 @@ eval_type_str(unsigned long long val, const char *type, int pointer) + return val & 0xffffffff; + + if (strcmp(type, "u64") == 0 || +- strcmp(type, "s64")) ++ strcmp(type, "s64") == 0) + return val; + + if (strcmp(type, "s8") == 0) +-- +2.20.1 + diff --git a/queue-4.9/x86-reboot-efi-use-efi-reboot-for-acer-travelmate-x5.patch b/queue-4.9/x86-reboot-efi-use-efi-reboot-for-acer-travelmate-x5.patch new file mode 100644 index 00000000000..deb796ca2e5 --- /dev/null +++ b/queue-4.9/x86-reboot-efi-use-efi-reboot-for-acer-travelmate-x5.patch @@ -0,0 +1,102 @@ +From b1b93ae6629c6f960829b1b7c9b87ab4cda72d3d Mon Sep 17 00:00:00 2001 +From: Jian-Hong Pan +Date: Fri, 12 Apr 2019 16:01:53 +0800 +Subject: x86/reboot, efi: Use EFI reboot for Acer TravelMate X514-51T + +[ Upstream commit 0082517fa4bce073e7cf542633439f26538a14cc ] + +Upon reboot, the Acer TravelMate X514-51T laptop appears to complete the +shutdown process, but then it hangs in BIOS POST with a black screen. + +The problem is intermittent - at some points it has appeared related to +Secure Boot settings or different kernel builds, but ultimately we have +not been able to identify the exact conditions that trigger the issue to +come and go. + +Besides, the EFI mode cannot be disabled in the BIOS of this model. + +However, after extensive testing, we observe that using the EFI reboot +method reliably avoids the issue in all cases. + +So add a boot time quirk to use EFI reboot on such systems. + +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=203119 +Signed-off-by: Jian-Hong Pan +Signed-off-by: Daniel Drake +Cc: Ard Biesheuvel +Cc: Borislav Petkov +Cc: Linus Torvalds +Cc: Matt Fleming +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Cc: linux-efi@vger.kernel.org +Cc: linux@endlessm.com +Link: http://lkml.kernel.org/r/20190412080152.3718-1-jian-hong@endlessm.com +[ Fix !CONFIG_EFI build failure, clarify the code and the changelog a bit. ] +Signed-off-by: Ingo Molnar +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/reboot.c | 21 +++++++++++++++++++++ + include/linux/efi.h | 7 ++++++- + 2 files changed, 27 insertions(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c +index 4a12362a194af..c55b11fe8e9f6 100644 +--- a/arch/x86/kernel/reboot.c ++++ b/arch/x86/kernel/reboot.c +@@ -82,6 +82,19 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) + return 0; + } + ++/* ++ * Some machines don't handle the default ACPI reboot method and ++ * require the EFI reboot method: ++ */ ++static int __init set_efi_reboot(const struct dmi_system_id *d) ++{ ++ if (reboot_type != BOOT_EFI && !efi_runtime_disabled()) { ++ reboot_type = BOOT_EFI; ++ pr_info("%s series board detected. Selecting EFI-method for reboot.\n", d->ident); ++ } ++ return 0; ++} ++ + void __noreturn machine_real_restart(unsigned int type) + { + local_irq_disable(); +@@ -167,6 +180,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"), + }, + }, ++ { /* Handle reboot issue on Acer TravelMate X514-51T */ ++ .callback = set_efi_reboot, ++ .ident = "Acer TravelMate X514-51T", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"), ++ }, ++ }, + + /* Apple */ + { /* Handle problems with rebooting on Apple MacBook5 */ +diff --git a/include/linux/efi.h b/include/linux/efi.h +index 80b1b8faf503f..e6711bf9f0d12 100644 +--- a/include/linux/efi.h ++++ b/include/linux/efi.h +@@ -1433,7 +1433,12 @@ efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, + struct screen_info *si, efi_guid_t *proto, + unsigned long size); + +-bool efi_runtime_disabled(void); ++#ifdef CONFIG_EFI ++extern bool efi_runtime_disabled(void); ++#else ++static inline bool efi_runtime_disabled(void) { return true; } ++#endif ++ + extern void efi_call_virt_check_flags(unsigned long flags, const char *call); + + /* +-- +2.20.1 +