]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 15:51:52 +0000 (16:51 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 15:51:52 +0000 (16:51 +0100)
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

queue-4.4/arm-8950-1-ftrace-recordmcount-filter-relocation-types.patch [new file with mode: 0644]
queue-4.4/hwmon-adt7475-make-volt2reg-return-same-reg-as-reg2volt-input.patch [new file with mode: 0644]
queue-4.4/input-keyspan-remote-fix-control-message-timeouts.patch [new file with mode: 0644]
queue-4.4/mmc-sdhci-fix-minimum-clock-rate-for-v3-controller.patch [new file with mode: 0644]
queue-4.4/series

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 (file)
index 0000000..1355b91
--- /dev/null
@@ -0,0 +1,129 @@
+From 927d780ee371d7e121cea4fc7812f6ef2cea461c Mon Sep 17 00:00:00 2001
+From: Alex Sverdlin <alexander.sverdlin@nokia.com>
+Date: Wed, 8 Jan 2020 15:57:47 +0100
+Subject: ARM: 8950/1: ftrace/recordmcount: filter relocation types
+
+From: Alex Sverdlin <alexander.sverdlin@nokia.com>
+
+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 <prealloc_fixed_plts>:
+ 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
+...
+[<c0314e3d>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
+[<c03115e9>] (show_stack) from [<c051a7f1>] (dump_stack+0x81/0xa8)
+[<c051a7f1>] (dump_stack) from [<c0321c5d>] (warn_slowpath_common+0x69/0x90)
+[<c0321c5d>] (warn_slowpath_common) from [<c0321cf3>] (warn_slowpath_null+0x17/0x1c)
+[<c0321cf3>] (warn_slowpath_null) from [<c038ee9d>] (ftrace_bug+0x1ad/0x230)
+[<c038ee9d>] (ftrace_bug) from [<c038f1f9>] (ftrace_process_locs+0x27d/0x444)
+[<c038f1f9>] (ftrace_process_locs) from [<c08915bd>] (ftrace_init+0x91/0xe8)
+[<c08915bd>] (ftrace_init) from [<c0885a67>] (start_kernel+0x34b/0x358)
+[<c0885a67>] (start_kernel) from [<00308095>] (0x308095)
+---[ end trace cb88537fdc8fa200 ]---
+ftrace failed to modify [<c031266c>] 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
+[<c0010a24>] (unwind_backtrace) from [<c000ecb0>] (show_stack+0x20/0x2c)
+[<c000ecb0>] (show_stack) from [<c03c72e8>] (dump_stack+0x20/0x30)
+[<c03c72e8>] (dump_stack) from [<c0021c18>] (__warn+0xdc/0x104)
+[<c0021c18>] (__warn) from [<c0021d7c>] (warn_slowpath_null+0x4c/0x5c)
+[<c0021d7c>] (warn_slowpath_null) from [<c0095360>] (ftrace_bug+0x204/0x310)
+[<c0095360>] (ftrace_bug) from [<c04dabac>] (ftrace_init+0x3b4/0x4d4)
+[<c04dabac>] (ftrace_init) from [<c04cef4c>] (start_kernel+0x20c/0x410)
+[<c04cef4c>] (start_kernel) from [<00000000>] (  (null))
+---[ end trace 0506a2f5dae6b341 ]---
+ftrace failed to modify
+[<c000c350>] 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 <alexander.sverdlin@nokia.com>
+Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..fb21584
--- /dev/null
@@ -0,0 +1,44 @@
+From cf3ca1877574a306c0207cbf7fdf25419d9229df Mon Sep 17 00:00:00 2001
+From: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>
+Date: Fri, 6 Dec 2019 12:16:59 +1300
+Subject: hwmon: (adt7475) Make volt2reg return same reg as reg2volt input
+
+From: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>
+
+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 <luuk.paulussen@alliedtelesis.co.nz>
+Link: https://lore.kernel.org/r/20191205231659.1301-1-luuk.paulussen@alliedtelesis.co.nz
+cc: stable@vger.kernel.org
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..4422a3c
--- /dev/null
@@ -0,0 +1,63 @@
+From ba9a103f40fc4a3ec7558ec9b0b97d4f92034249 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Mon, 13 Jan 2020 10:38:57 -0800
+Subject: Input: keyspan-remote - fix control-message timeouts
+
+From: Johan Hovold <johan@kernel.org>
+
+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 <johan@kernel.org>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: stable <stable@vger.kernel.org>     # 2.6.13
+Link: https://lore.kernel.org/r/20200113171715.30621-1-johan@kernel.org
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..8ebcef7
--- /dev/null
@@ -0,0 +1,55 @@
+From 2a187d03352086e300daa2044051db00044cd171 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= <mirq-linux@rere.qmqm.pl>
+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 <mirq-linux@rere.qmqm.pl>
+
+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: <stable@vger.kernel.org> # 4f6aa3264af4: mmc: tegra: Only advertise UHS modes if IO regulator is present
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/ffb489519a446caffe7a0a05c4b9372bd52397bb.1579082031.git.mirq-linux@rere.qmqm.pl
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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;
index 06512474092f98ddc47e9de362f7fc5727427a7a..042bf7dbc86e389a39f8ffc12963147e16e6da38 100644 (file)
@@ -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