]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Mar 2020 09:33:30 +0000 (10:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Mar 2020 09:33:30 +0000 (10:33 +0100)
added patches:
alsa-hda-realtek-fix-pop-noise-on-alc225.patch
arm64-smp-fix-smp_send_stop-behaviour.patch
staging-greybus-loopback_test-fix-potential-path-truncation.patch
staging-greybus-loopback_test-fix-potential-path-truncations.patch

queue-4.9/alsa-hda-realtek-fix-pop-noise-on-alc225.patch [new file with mode: 0644]
queue-4.9/arm64-smp-fix-smp_send_stop-behaviour.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/staging-greybus-loopback_test-fix-potential-path-truncation.patch [new file with mode: 0644]
queue-4.9/staging-greybus-loopback_test-fix-potential-path-truncations.patch [new file with mode: 0644]

diff --git a/queue-4.9/alsa-hda-realtek-fix-pop-noise-on-alc225.patch b/queue-4.9/alsa-hda-realtek-fix-pop-noise-on-alc225.patch
new file mode 100644 (file)
index 0000000..b0ba515
--- /dev/null
@@ -0,0 +1,36 @@
+From 3b36b13d5e69d6f51ff1c55d1b404a74646c9757 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Date: Wed, 11 Mar 2020 14:13:28 +0800
+Subject: ALSA: hda/realtek: Fix pop noise on ALC225
+
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+
+commit 3b36b13d5e69d6f51ff1c55d1b404a74646c9757 upstream.
+
+Commit 317d9313925c ("ALSA: hda/realtek - Set default power save node to
+0") makes the ALC225 have pop noise on S3 resume and cold boot.
+
+So partially revert this commit for ALC225 to fix the regression.
+
+Fixes: 317d9313925c ("ALSA: hda/realtek - Set default power save node to 0")
+BugLink: https://bugs.launchpad.net/bugs/1866357
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Link: https://lore.kernel.org/r/20200311061328.17614-1-kai.heng.feng@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -4212,6 +4212,8 @@ static void alc_determine_headset_type(s
+               is_ctia = (val & 0x1c02) == 0x1c02;
+               break;
+       case 0x10ec0225:
++              codec->power_save_node = 1;
++              /* fall through */
+       case 0x10ec0295:
+       case 0x10ec0299:
+               alc_process_coef_fw(codec, coef0225);
diff --git a/queue-4.9/arm64-smp-fix-smp_send_stop-behaviour.patch b/queue-4.9/arm64-smp-fix-smp_send_stop-behaviour.patch
new file mode 100644 (file)
index 0000000..4b7eb7d
--- /dev/null
@@ -0,0 +1,115 @@
+From d0bab0c39e32d39a8c5cddca72e5b4a3059fe050 Mon Sep 17 00:00:00 2001
+From: Cristian Marussi <cristian.marussi@arm.com>
+Date: Wed, 11 Mar 2020 17:12:44 +0000
+Subject: arm64: smp: fix smp_send_stop() behaviour
+
+From: Cristian Marussi <cristian.marussi@arm.com>
+
+commit d0bab0c39e32d39a8c5cddca72e5b4a3059fe050 upstream.
+
+On a system with only one CPU online, when another one CPU panics while
+starting-up, smp_send_stop() will fail to send any STOP message to the
+other already online core, resulting in a system still responsive and
+alive at the end of the panic procedure.
+
+[  186.700083] CPU3: shutdown
+[  187.075462] CPU2: shutdown
+[  187.162869] CPU1: shutdown
+[  188.689998] ------------[ cut here ]------------
+[  188.691645] kernel BUG at arch/arm64/kernel/cpufeature.c:886!
+[  188.692079] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
+[  188.692444] Modules linked in:
+[  188.693031] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 5.6.0-rc4-00001-g338d25c35a98 #104
+[  188.693175] Hardware name: Foundation-v8A (DT)
+[  188.693492] pstate: 200001c5 (nzCv dAIF -PAN -UAO)
+[  188.694183] pc : has_cpuid_feature+0xf0/0x348
+[  188.694311] lr : verify_local_elf_hwcaps+0x84/0xe8
+[  188.694410] sp : ffff800011b1bf60
+[  188.694536] x29: ffff800011b1bf60 x28: 0000000000000000
+[  188.694707] x27: 0000000000000000 x26: 0000000000000000
+[  188.694801] x25: 0000000000000000 x24: ffff80001189a25c
+[  188.694905] x23: 0000000000000000 x22: 0000000000000000
+[  188.694996] x21: ffff8000114aa018 x20: ffff800011156a38
+[  188.695089] x19: ffff800010c944a0 x18: 0000000000000004
+[  188.695187] x17: 0000000000000000 x16: 0000000000000000
+[  188.695280] x15: 0000249dbde5431e x14: 0262cbe497efa1fa
+[  188.695371] x13: 0000000000000002 x12: 0000000000002592
+[  188.695472] x11: 0000000000000080 x10: 00400032b5503510
+[  188.695572] x9 : 0000000000000000 x8 : ffff800010c80204
+[  188.695659] x7 : 00000000410fd0f0 x6 : 0000000000000001
+[  188.695750] x5 : 00000000410fd0f0 x4 : 0000000000000000
+[  188.695836] x3 : 0000000000000000 x2 : ffff8000100939d8
+[  188.695919] x1 : 0000000000180420 x0 : 0000000000180480
+[  188.696253] Call trace:
+[  188.696410]  has_cpuid_feature+0xf0/0x348
+[  188.696504]  verify_local_elf_hwcaps+0x84/0xe8
+[  188.696591]  check_local_cpu_capabilities+0x44/0x128
+[  188.696666]  secondary_start_kernel+0xf4/0x188
+[  188.697150] Code: 52805001 72a00301 6b01001f 54000ec0 (d4210000)
+[  188.698639] ---[ end trace 3f12ca47652f7b72 ]---
+[  188.699160] Kernel panic - not syncing: Attempted to kill the idle task!
+[  188.699546] Kernel Offset: disabled
+[  188.699828] CPU features: 0x00004,20c02008
+[  188.700012] Memory Limit: none
+[  188.700538] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
+
+[root@arch ~]# echo Helo
+Helo
+[root@arch ~]# cat /proc/cpuinfo | grep proce
+processor      : 0
+
+Make smp_send_stop() account also for the online status of the calling CPU
+while evaluating how many CPUs are effectively online: this way, the right
+number of STOPs is sent, so enforcing a proper freeze of the system at the
+end of panic even under the above conditions.
+
+Fixes: 08e875c16a16c ("arm64: SMP support")
+Reported-by: Dave Martin <Dave.Martin@arm.com>
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/smp.c |   17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+--- a/arch/arm64/kernel/smp.c
++++ b/arch/arm64/kernel/smp.c
+@@ -901,11 +901,22 @@ void tick_broadcast(const struct cpumask
+ }
+ #endif
++/*
++ * The number of CPUs online, not counting this CPU (which may not be
++ * fully online and so not counted in num_online_cpus()).
++ */
++static inline unsigned int num_other_online_cpus(void)
++{
++      unsigned int this_cpu_online = cpu_online(smp_processor_id());
++
++      return num_online_cpus() - this_cpu_online;
++}
++
+ void smp_send_stop(void)
+ {
+       unsigned long timeout;
+-      if (num_online_cpus() > 1) {
++      if (num_other_online_cpus()) {
+               cpumask_t mask;
+               cpumask_copy(&mask, cpu_online_mask);
+@@ -919,10 +930,10 @@ void smp_send_stop(void)
+       /* Wait up to one second for other CPUs to stop */
+       timeout = USEC_PER_SEC;
+-      while (num_online_cpus() > 1 && timeout--)
++      while (num_other_online_cpus() && timeout--)
+               udelay(1);
+-      if (num_online_cpus() > 1)
++      if (num_other_online_cpus())
+               pr_warning("SMP: failed to stop secondary CPUs %*pbl\n",
+                          cpumask_pr_args(cpu_online_mask));
+ }
index 77ae38d27304c4243803013a73b0b7f870323cba..7651e2213080700208a6edd0486d5cbda32994ee 100644 (file)
@@ -30,3 +30,7 @@ usb-cdc-acm-fix-rounding-error-in-tiocsserial.patch
 kbuild-disable-wpointer-to-enum-cast.patch
 futex-fix-inode-life-time-issue.patch
 futex-unbreak-futex-hashing.patch
+alsa-hda-realtek-fix-pop-noise-on-alc225.patch
+arm64-smp-fix-smp_send_stop-behaviour.patch
+staging-greybus-loopback_test-fix-potential-path-truncation.patch
+staging-greybus-loopback_test-fix-potential-path-truncations.patch
diff --git a/queue-4.9/staging-greybus-loopback_test-fix-potential-path-truncation.patch b/queue-4.9/staging-greybus-loopback_test-fix-potential-path-truncation.patch
new file mode 100644 (file)
index 0000000..1337c29
--- /dev/null
@@ -0,0 +1,46 @@
+From f16023834863932f95dfad13fac3fc47f77d2f29 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Thu, 12 Mar 2020 12:01:50 +0100
+Subject: staging: greybus: loopback_test: fix potential path truncation
+
+From: Johan Hovold <johan@kernel.org>
+
+commit f16023834863932f95dfad13fac3fc47f77d2f29 upstream.
+
+Newer GCC warns about a possible truncation of a generated sysfs path
+name as we're concatenating a directory path with a file name and
+placing the result in a buffer that is half the size of the maximum
+length of the directory path (which is user controlled).
+
+loopback_test.c: In function 'open_poll_files':
+loopback_test.c:651:31: warning: '%s' directive output may be truncated writing up to 511 bytes into a region of size 255 [-Wformat-truncation=]
+  651 |   snprintf(buf, sizeof(buf), "%s%s", dev->sysfs_entry, "iteration_count");
+      |                               ^~
+loopback_test.c:651:3: note: 'snprintf' output between 16 and 527 bytes into a destination of size 255
+  651 |   snprintf(buf, sizeof(buf), "%s%s", dev->sysfs_entry, "iteration_count");
+      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Fix this by making sure the buffer is large enough the concatenated
+strings.
+
+Fixes: 6b0658f68786 ("greybus: tools: Add tools directory to greybus repo and add loopback")
+Fixes: 9250c0ee2626 ("greybus: Loopback_test: use poll instead of inotify")
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Link: https://lore.kernel.org/r/20200312110151.22028-3-johan@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/greybus/tools/loopback_test.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/staging/greybus/tools/loopback_test.c
++++ b/drivers/staging/greybus/tools/loopback_test.c
+@@ -646,7 +646,7 @@ baddir:
+ static int open_poll_files(struct loopback_test *t)
+ {
+       struct loopback_device *dev;
+-      char buf[MAX_STR_LEN];
++      char buf[MAX_SYSFS_PATH + MAX_STR_LEN];
+       char dummy;
+       int fds_idx = 0;
+       int i;
diff --git a/queue-4.9/staging-greybus-loopback_test-fix-potential-path-truncations.patch b/queue-4.9/staging-greybus-loopback_test-fix-potential-path-truncations.patch
new file mode 100644 (file)
index 0000000..9a1f49a
--- /dev/null
@@ -0,0 +1,94 @@
+From ae62cf5eb2792d9a818c2d93728ed92119357017 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Thu, 12 Mar 2020 12:01:51 +0100
+Subject: staging: greybus: loopback_test: fix potential path truncations
+
+From: Johan Hovold <johan@kernel.org>
+
+commit ae62cf5eb2792d9a818c2d93728ed92119357017 upstream.
+
+Newer GCC warns about possible truncations of two generated path names as
+we're concatenating the configurable sysfs and debugfs path prefixes
+with a filename and placing the results in buffers of the same size as
+the maximum length of the prefixes.
+
+       snprintf(d->name, MAX_STR_LEN, "gb_loopback%u", dev_id);
+
+       snprintf(d->sysfs_entry, MAX_SYSFS_PATH, "%s%s/",
+                t->sysfs_prefix, d->name);
+
+       snprintf(d->debugfs_entry, MAX_SYSFS_PATH, "%sraw_latency_%s",
+                t->debugfs_prefix, d->name);
+
+Fix this by separating the maximum path length from the maximum prefix
+length and reducing the latter enough to fit the generated strings.
+
+Note that we also need to reduce the device-name buffer size as GCC
+isn't smart enough to figure out that we ever only used MAX_STR_LEN
+bytes of it.
+
+Fixes: 6b0658f68786 ("greybus: tools: Add tools directory to greybus repo and add loopback")
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Link: https://lore.kernel.org/r/20200312110151.22028-4-johan@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/greybus/tools/loopback_test.c |   15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+--- a/drivers/staging/greybus/tools/loopback_test.c
++++ b/drivers/staging/greybus/tools/loopback_test.c
+@@ -20,6 +20,7 @@
+ #include <signal.h>
+ #define MAX_NUM_DEVICES 10
++#define MAX_SYSFS_PREFIX 0x80
+ #define MAX_SYSFS_PATH        0x200
+ #define CSV_MAX_LINE  0x1000
+ #define SYSFS_MAX_INT 0x20
+@@ -68,7 +69,7 @@ struct loopback_results {
+ };
+ struct loopback_device {
+-      char name[MAX_SYSFS_PATH];
++      char name[MAX_STR_LEN];
+       char sysfs_entry[MAX_SYSFS_PATH];
+       char debugfs_entry[MAX_SYSFS_PATH];
+       struct loopback_results results;
+@@ -94,8 +95,8 @@ struct loopback_test {
+       int stop_all;
+       int poll_count;
+       char test_name[MAX_STR_LEN];
+-      char sysfs_prefix[MAX_SYSFS_PATH];
+-      char debugfs_prefix[MAX_SYSFS_PATH];
++      char sysfs_prefix[MAX_SYSFS_PREFIX];
++      char debugfs_prefix[MAX_SYSFS_PREFIX];
+       struct timespec poll_timeout;
+       struct loopback_device devices[MAX_NUM_DEVICES];
+       struct loopback_results aggregate_results;
+@@ -917,10 +918,10 @@ int main(int argc, char *argv[])
+                       t.iteration_max = atoi(optarg);
+                       break;
+               case 'S':
+-                      snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
++                      snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg);
+                       break;
+               case 'D':
+-                      snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
++                      snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg);
+                       break;
+               case 'm':
+                       t.mask = atol(optarg);
+@@ -971,10 +972,10 @@ int main(int argc, char *argv[])
+       }
+       if (!strcmp(t.sysfs_prefix, ""))
+-              snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix);
++              snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", sysfs_prefix);
+       if (!strcmp(t.debugfs_prefix, ""))
+-              snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", debugfs_prefix);
++              snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", debugfs_prefix);
+       ret = find_loopback_devices(&t);
+       if (ret)