From 88287e2b7e53b857f3323cccffc4a3b06db8c218 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 27 Jan 2020 16:51:52 +0100 Subject: [PATCH] 4.4-stable patches added patches: arm-8950-1-ftrace-recordmcount-filter-relocation-types.patch hwmon-adt7475-make-volt2reg-return-same-reg-as-reg2volt-input.patch input-keyspan-remote-fix-control-message-timeouts.patch mmc-sdhci-fix-minimum-clock-rate-for-v3-controller.patch --- ...recordmcount-filter-relocation-types.patch | 129 ++++++++++++++++++ ...eg-return-same-reg-as-reg2volt-input.patch | 44 ++++++ ...-remote-fix-control-message-timeouts.patch | 63 +++++++++ ...minimum-clock-rate-for-v3-controller.patch | 55 ++++++++ queue-4.4/series | 4 + 5 files changed, 295 insertions(+) create mode 100644 queue-4.4/arm-8950-1-ftrace-recordmcount-filter-relocation-types.patch create mode 100644 queue-4.4/hwmon-adt7475-make-volt2reg-return-same-reg-as-reg2volt-input.patch create mode 100644 queue-4.4/input-keyspan-remote-fix-control-message-timeouts.patch create mode 100644 queue-4.4/mmc-sdhci-fix-minimum-clock-rate-for-v3-controller.patch diff --git a/queue-4.4/arm-8950-1-ftrace-recordmcount-filter-relocation-types.patch b/queue-4.4/arm-8950-1-ftrace-recordmcount-filter-relocation-types.patch new file mode 100644 index 00000000000..1355b913ef3 --- /dev/null +++ b/queue-4.4/arm-8950-1-ftrace-recordmcount-filter-relocation-types.patch @@ -0,0 +1,129 @@ +From 927d780ee371d7e121cea4fc7812f6ef2cea461c Mon Sep 17 00:00:00 2001 +From: Alex Sverdlin +Date: Wed, 8 Jan 2020 15:57:47 +0100 +Subject: ARM: 8950/1: ftrace/recordmcount: filter relocation types + +From: Alex Sverdlin + +commit 927d780ee371d7e121cea4fc7812f6ef2cea461c upstream. + +Scenario 1, ARMv7 +================= + +If code in arch/arm/kernel/ftrace.c would operate on mcount() pointer +the following may be generated: + +00000230 : + 230: b5f8 push {r3, r4, r5, r6, r7, lr} + 232: b500 push {lr} + 234: f7ff fffe bl 0 <__gnu_mcount_nc> + 234: R_ARM_THM_CALL __gnu_mcount_nc + 238: f240 0600 movw r6, #0 + 238: R_ARM_THM_MOVW_ABS_NC __gnu_mcount_nc + 23c: f8d0 1180 ldr.w r1, [r0, #384] ; 0x180 + +FTRACE currently is not able to deal with it: + +WARNING: CPU: 0 PID: 0 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1ad/0x230() +... +CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.116-... #1 +... +[] (unwind_backtrace) from [] (show_stack+0x11/0x14) +[] (show_stack) from [] (dump_stack+0x81/0xa8) +[] (dump_stack) from [] (warn_slowpath_common+0x69/0x90) +[] (warn_slowpath_common) from [] (warn_slowpath_null+0x17/0x1c) +[] (warn_slowpath_null) from [] (ftrace_bug+0x1ad/0x230) +[] (ftrace_bug) from [] (ftrace_process_locs+0x27d/0x444) +[] (ftrace_process_locs) from [] (ftrace_init+0x91/0xe8) +[] (ftrace_init) from [] (start_kernel+0x34b/0x358) +[] (start_kernel) from [<00308095>] (0x308095) +---[ end trace cb88537fdc8fa200 ]--- +ftrace failed to modify [] prealloc_fixed_plts+0x8/0x60 + actual: 44:f2:e1:36 +ftrace record flags: 0 + (0) expected tramp: c03143e9 + +Scenario 2, ARMv4T +================== + +ftrace: allocating 14435 entries in 43 pages +------------[ cut here ]------------ +WARNING: CPU: 0 PID: 0 at kernel/trace/ftrace.c:2029 ftrace_bug+0x204/0x310 +CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.5 #1 +Hardware name: Cirrus Logic EDB9302 Evaluation Board +[] (unwind_backtrace) from [] (show_stack+0x20/0x2c) +[] (show_stack) from [] (dump_stack+0x20/0x30) +[] (dump_stack) from [] (__warn+0xdc/0x104) +[] (__warn) from [] (warn_slowpath_null+0x4c/0x5c) +[] (warn_slowpath_null) from [] (ftrace_bug+0x204/0x310) +[] (ftrace_bug) from [] (ftrace_init+0x3b4/0x4d4) +[] (ftrace_init) from [] (start_kernel+0x20c/0x410) +[] (start_kernel) from [<00000000>] ( (null)) +---[ end trace 0506a2f5dae6b341 ]--- +ftrace failed to modify +[] perf_trace_sys_exit+0x5c/0xe8 + actual: 1e:ff:2f:e1 +Initializing ftrace call sites +ftrace record flags: 0 + (0) + expected tramp: c000fb24 + +The analysis for this problem has been already performed previously, +refer to the link below. + +Fix the above problems by allowing only selected reloc types in +__mcount_loc. The list itself comes from the legacy recordmcount.pl +script. + +Link: https://lore.kernel.org/lkml/56961010.6000806@pengutronix.de/ +Cc: stable@vger.kernel.org +Fixes: ed60453fa8f8 ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount") +Signed-off-by: Alexander Sverdlin +Acked-by: Steven Rostedt (VMware) +Signed-off-by: Russell King +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/recordmcount.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/scripts/recordmcount.c ++++ b/scripts/recordmcount.c +@@ -53,6 +53,10 @@ + #define R_AARCH64_ABS64 257 + #endif + ++#define R_ARM_PC24 1 ++#define R_ARM_THM_CALL 10 ++#define R_ARM_CALL 28 ++ + static int fd_map; /* File descriptor for file being modified. */ + static int mmap_failed; /* Boolean flag. */ + static char gpfx; /* prefix for global symbol name (sometimes '_') */ +@@ -372,6 +376,18 @@ is_mcounted_section_name(char const *con + #define RECORD_MCOUNT_64 + #include "recordmcount.h" + ++static int arm_is_fake_mcount(Elf32_Rel const *rp) ++{ ++ switch (ELF32_R_TYPE(w(rp->r_info))) { ++ case R_ARM_THM_CALL: ++ case R_ARM_CALL: ++ case R_ARM_PC24: ++ return 0; ++ } ++ ++ return 1; ++} ++ + /* 64-bit EM_MIPS has weird ELF64_Rela.r_info. + * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf + * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40] +@@ -461,6 +477,7 @@ do_file(char const *const fname) + break; + case EM_ARM: reltype = R_ARM_ABS32; + altmcount = "__gnu_mcount_nc"; ++ is_fake_mcount32 = arm_is_fake_mcount; + break; + case EM_AARCH64: + reltype = R_AARCH64_ABS64; diff --git a/queue-4.4/hwmon-adt7475-make-volt2reg-return-same-reg-as-reg2volt-input.patch b/queue-4.4/hwmon-adt7475-make-volt2reg-return-same-reg-as-reg2volt-input.patch new file mode 100644 index 00000000000..fb21584692f --- /dev/null +++ b/queue-4.4/hwmon-adt7475-make-volt2reg-return-same-reg-as-reg2volt-input.patch @@ -0,0 +1,44 @@ +From cf3ca1877574a306c0207cbf7fdf25419d9229df Mon Sep 17 00:00:00 2001 +From: Luuk Paulussen +Date: Fri, 6 Dec 2019 12:16:59 +1300 +Subject: hwmon: (adt7475) Make volt2reg return same reg as reg2volt input + +From: Luuk Paulussen + +commit cf3ca1877574a306c0207cbf7fdf25419d9229df upstream. + +reg2volt returns the voltage that matches a given register value. +Converting this back the other way with volt2reg didn't return the same +register value because it used truncation instead of rounding. + +This meant that values read from sysfs could not be written back to sysfs +to set back the same register value. + +With this change, volt2reg will return the same value for every voltage +previously returned by reg2volt (for the set of possible input values) + +Signed-off-by: Luuk Paulussen +Link: https://lore.kernel.org/r/20191205231659.1301-1-luuk.paulussen@alliedtelesis.co.nz +cc: stable@vger.kernel.org +Signed-off-by: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwmon/adt7475.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/hwmon/adt7475.c ++++ b/drivers/hwmon/adt7475.c +@@ -268,9 +268,10 @@ static inline u16 volt2reg(int channel, + long reg; + + if (bypass_attn & (1 << channel)) +- reg = (volt * 1024) / 2250; ++ reg = DIV_ROUND_CLOSEST(volt * 1024, 2250); + else +- reg = (volt * r[1] * 1024) / ((r[0] + r[1]) * 2250); ++ reg = DIV_ROUND_CLOSEST(volt * r[1] * 1024, ++ (r[0] + r[1]) * 2250); + return clamp_val(reg, 0, 1023) & (0xff << 2); + } + diff --git a/queue-4.4/input-keyspan-remote-fix-control-message-timeouts.patch b/queue-4.4/input-keyspan-remote-fix-control-message-timeouts.patch new file mode 100644 index 00000000000..4422a3ce752 --- /dev/null +++ b/queue-4.4/input-keyspan-remote-fix-control-message-timeouts.patch @@ -0,0 +1,63 @@ +From ba9a103f40fc4a3ec7558ec9b0b97d4f92034249 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 13 Jan 2020 10:38:57 -0800 +Subject: Input: keyspan-remote - fix control-message timeouts + +From: Johan Hovold + +commit ba9a103f40fc4a3ec7558ec9b0b97d4f92034249 upstream. + +The driver was issuing synchronous uninterruptible control requests +without using a timeout. This could lead to the driver hanging on probe +due to a malfunctioning (or malicious) device until the device is +physically disconnected. While sleeping in probe the driver prevents +other devices connected to the same hub from being added to (or removed +from) the bus. + +The USB upper limit of five seconds per request should be more than +enough. + +Fixes: 99f83c9c9ac9 ("[PATCH] USB: add driver for Keyspan Digital Remote") +Signed-off-by: Johan Hovold +Reviewed-by: Greg Kroah-Hartman +Cc: stable # 2.6.13 +Link: https://lore.kernel.org/r/20200113171715.30621-1-johan@kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/input/misc/keyspan_remote.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/input/misc/keyspan_remote.c ++++ b/drivers/input/misc/keyspan_remote.c +@@ -344,7 +344,8 @@ static int keyspan_setup(struct usb_devi + int retval = 0; + + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), +- 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); ++ 0x11, 0x40, 0x5601, 0x0, NULL, 0, ++ USB_CTRL_SET_TIMEOUT); + if (retval) { + dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", + __func__, retval); +@@ -352,7 +353,8 @@ static int keyspan_setup(struct usb_devi + } + + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), +- 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); ++ 0x44, 0x40, 0x0, 0x0, NULL, 0, ++ USB_CTRL_SET_TIMEOUT); + if (retval) { + dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", + __func__, retval); +@@ -360,7 +362,8 @@ static int keyspan_setup(struct usb_devi + } + + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), +- 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); ++ 0x22, 0x40, 0x0, 0x0, NULL, 0, ++ USB_CTRL_SET_TIMEOUT); + if (retval) { + dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", + __func__, retval); diff --git a/queue-4.4/mmc-sdhci-fix-minimum-clock-rate-for-v3-controller.patch b/queue-4.4/mmc-sdhci-fix-minimum-clock-rate-for-v3-controller.patch new file mode 100644 index 00000000000..8ebcef715a9 --- /dev/null +++ b/queue-4.4/mmc-sdhci-fix-minimum-clock-rate-for-v3-controller.patch @@ -0,0 +1,55 @@ +From 2a187d03352086e300daa2044051db00044cd171 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= +Date: Wed, 15 Jan 2020 10:54:35 +0100 +Subject: mmc: sdhci: fix minimum clock rate for v3 controller +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michał Mirosław + +commit 2a187d03352086e300daa2044051db00044cd171 upstream. + +For SDHCIv3+ with programmable clock mode, minimal clock frequency is +still base clock / max(divider). Minimal programmable clock frequency is +always greater than minimal divided clock frequency. Without this patch, +SDHCI uses out-of-spec initial frequency when multiplier is big enough: + +mmc1: mmc_rescan_try_freq: trying to init card at 468750 Hz +[for 480 MHz source clock divided by 1024] + +The code in sdhci_calc_clk() already chooses a correct SDCLK clock mode. + +Fixes: c3ed3877625f ("mmc: sdhci: add support for programmable clock mode") +Cc: # 4f6aa3264af4: mmc: tegra: Only advertise UHS modes if IO regulator is present +Cc: +Signed-off-by: Michał Mirosław +Acked-by: Adrian Hunter +Link: https://lore.kernel.org/r/ffb489519a446caffe7a0a05c4b9372bd52397bb.1579082031.git.mirq-linux@rere.qmqm.pl +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/sdhci.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/drivers/mmc/host/sdhci.c ++++ b/drivers/mmc/host/sdhci.c +@@ -3096,11 +3096,13 @@ int sdhci_add_host(struct sdhci_host *ho + if (host->ops->get_min_clock) + mmc->f_min = host->ops->get_min_clock(host); + else if (host->version >= SDHCI_SPEC_300) { +- if (host->clk_mul) { +- mmc->f_min = (host->max_clk * host->clk_mul) / 1024; ++ if (host->clk_mul) + max_clk = host->max_clk * host->clk_mul; +- } else +- mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; ++ /* ++ * Divided Clock Mode minimum clock rate is always less than ++ * Programmable Clock Mode minimum clock rate. ++ */ ++ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; + } else + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; + diff --git a/queue-4.4/series b/queue-4.4/series index 06512474092..042bf7dbc86 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -164,3 +164,7 @@ net-ip_tunnel-fix-namespaces-move.patch net_sched-fix-datalen-for-ematch.patch net-sysfs-fix-reference-count-leak.patch net-usb-lan78xx-add-.ndo_features_check.patch +hwmon-adt7475-make-volt2reg-return-same-reg-as-reg2volt-input.patch +input-keyspan-remote-fix-control-message-timeouts.patch +arm-8950-1-ftrace-recordmcount-filter-relocation-types.patch +mmc-sdhci-fix-minimum-clock-rate-for-v3-controller.patch -- 2.47.3