]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Nov 2022 11:18:48 +0000 (12:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Nov 2022 11:18:48 +0000 (12:18 +0100)
added patches:
alsa-usb-audio-drop-snd_bug_on-from-snd_usbmidi_output_open.patch
ftrace-fix-the-possible-incorrect-kernel-message.patch
ftrace-optimize-the-allocation-for-mcount-entries.patch
ring_buffer-do-not-deactivate-non-existant-pages.patch

queue-4.9/alsa-usb-audio-drop-snd_bug_on-from-snd_usbmidi_output_open.patch [new file with mode: 0644]
queue-4.9/ftrace-fix-the-possible-incorrect-kernel-message.patch [new file with mode: 0644]
queue-4.9/ftrace-optimize-the-allocation-for-mcount-entries.patch [new file with mode: 0644]
queue-4.9/ring_buffer-do-not-deactivate-non-existant-pages.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/alsa-usb-audio-drop-snd_bug_on-from-snd_usbmidi_output_open.patch b/queue-4.9/alsa-usb-audio-drop-snd_bug_on-from-snd_usbmidi_output_open.patch
new file mode 100644 (file)
index 0000000..99604a0
--- /dev/null
@@ -0,0 +1,41 @@
+From ad72c3c3f6eb81d2cb189ec71e888316adada5df Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Sat, 12 Nov 2022 15:12:23 +0100
+Subject: ALSA: usb-audio: Drop snd_BUG_ON() from snd_usbmidi_output_open()
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit ad72c3c3f6eb81d2cb189ec71e888316adada5df upstream.
+
+snd_usbmidi_output_open() has a check of the NULL port with
+snd_BUG_ON().  snd_BUG_ON() was used as this shouldn't have happened,
+but in reality, the NULL port may be seen when the device gives an
+invalid endpoint setup at the descriptor, hence the driver skips the
+allocation.  That is, the check itself is valid and snd_BUG_ON()
+should be dropped from there.  Otherwise it's confusing as if it were
+a real bug, as recently syzbot stumbled on it.
+
+Reported-by: syzbot+9abda841d636d86c41da@syzkaller.appspotmail.com
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/syzbot+9abda841d636d86c41da@syzkaller.appspotmail.com
+Link: https://lore.kernel.org/r/20221112141223.6144-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/midi.c |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/sound/usb/midi.c
++++ b/sound/usb/midi.c
+@@ -1148,10 +1148,8 @@ static int snd_usbmidi_output_open(struc
+                                       port = &umidi->endpoints[i].out->ports[j];
+                                       break;
+                               }
+-      if (!port) {
+-              snd_BUG();
++      if (!port)
+               return -ENXIO;
+-      }
+       substream->runtime->private_data = port;
+       port->state = STATE_UNKNOWN;
diff --git a/queue-4.9/ftrace-fix-the-possible-incorrect-kernel-message.patch b/queue-4.9/ftrace-fix-the-possible-incorrect-kernel-message.patch
new file mode 100644 (file)
index 0000000..2bd906a
--- /dev/null
@@ -0,0 +1,36 @@
+From 08948caebe93482db1adfd2154eba124f66d161d Mon Sep 17 00:00:00 2001
+From: Wang Wensheng <wangwensheng4@huawei.com>
+Date: Wed, 9 Nov 2022 09:44:32 +0000
+Subject: ftrace: Fix the possible incorrect kernel message
+
+From: Wang Wensheng <wangwensheng4@huawei.com>
+
+commit 08948caebe93482db1adfd2154eba124f66d161d upstream.
+
+If the number of mcount entries is an integer multiple of
+ENTRIES_PER_PAGE, the page count showing on the console would be wrong.
+
+Link: https://lkml.kernel.org/r/20221109094434.84046-2-wangwensheng4@huawei.com
+
+Cc: <mhiramat@kernel.org>
+Cc: <mark.rutland@arm.com>
+Cc: stable@vger.kernel.org
+Fixes: 5821e1b74f0d0 ("function tracing: fix wrong pos computing when read buffer has been fulfilled")
+Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/ftrace.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/trace/ftrace.c
++++ b/kernel/trace/ftrace.c
+@@ -5177,7 +5177,7 @@ void __init ftrace_init(void)
+       }
+       pr_info("ftrace: allocating %ld entries in %ld pages\n",
+-              count, count / ENTRIES_PER_PAGE + 1);
++              count, DIV_ROUND_UP(count, ENTRIES_PER_PAGE));
+       last_ftrace_enabled = ftrace_enabled = 1;
diff --git a/queue-4.9/ftrace-optimize-the-allocation-for-mcount-entries.patch b/queue-4.9/ftrace-optimize-the-allocation-for-mcount-entries.patch
new file mode 100644 (file)
index 0000000..0873dc3
--- /dev/null
@@ -0,0 +1,36 @@
+From bcea02b096333dc74af987cb9685a4dbdd820840 Mon Sep 17 00:00:00 2001
+From: Wang Wensheng <wangwensheng4@huawei.com>
+Date: Wed, 9 Nov 2022 09:44:33 +0000
+Subject: ftrace: Optimize the allocation for mcount entries
+
+From: Wang Wensheng <wangwensheng4@huawei.com>
+
+commit bcea02b096333dc74af987cb9685a4dbdd820840 upstream.
+
+If we can't allocate this size, try something smaller with half of the
+size. Its order should be decreased by one instead of divided by two.
+
+Link: https://lkml.kernel.org/r/20221109094434.84046-3-wangwensheng4@huawei.com
+
+Cc: <mhiramat@kernel.org>
+Cc: <mark.rutland@arm.com>
+Cc: stable@vger.kernel.org
+Fixes: a79008755497d ("ftrace: Allocate the mcount record pages as groups")
+Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/ftrace.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/trace/ftrace.c
++++ b/kernel/trace/ftrace.c
+@@ -3013,7 +3013,7 @@ static int ftrace_allocate_records(struc
+               /* if we can't allocate this size, try something smaller */
+               if (!order)
+                       return -ENOMEM;
+-              order >>= 1;
++              order--;
+               goto again;
+       }
diff --git a/queue-4.9/ring_buffer-do-not-deactivate-non-existant-pages.patch b/queue-4.9/ring_buffer-do-not-deactivate-non-existant-pages.patch
new file mode 100644 (file)
index 0000000..5094dea
--- /dev/null
@@ -0,0 +1,40 @@
+From 56f4ca0a79a9f1af98f26c54b9b89ba1f9bcc6bd Mon Sep 17 00:00:00 2001
+From: Daniil Tatianin <d-tatianin@yandex-team.ru>
+Date: Mon, 14 Nov 2022 17:31:29 +0300
+Subject: ring_buffer: Do not deactivate non-existant pages
+
+From: Daniil Tatianin <d-tatianin@yandex-team.ru>
+
+commit 56f4ca0a79a9f1af98f26c54b9b89ba1f9bcc6bd upstream.
+
+rb_head_page_deactivate() expects cpu_buffer to contain a valid list of
+->pages, so verify that the list is actually present before calling it.
+
+Found by Linux Verification Center (linuxtesting.org) with the SVACE
+static analysis tool.
+
+Link: https://lkml.kernel.org/r/20221114143129.3534443-1-d-tatianin@yandex-team.ru
+
+Cc: stable@vger.kernel.org
+Fixes: 77ae365eca895 ("ring-buffer: make lockless")
+Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/ring_buffer.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/kernel/trace/ring_buffer.c
++++ b/kernel/trace/ring_buffer.c
+@@ -1267,9 +1267,9 @@ static void rb_free_cpu_buffer(struct ri
+       free_buffer_page(cpu_buffer->reader_page);
+-      rb_head_page_deactivate(cpu_buffer);
+-
+       if (head) {
++              rb_head_page_deactivate(cpu_buffer);
++
+               list_for_each_entry_safe(bpage, tmp, head, list) {
+                       list_del_init(&bpage->list);
+                       free_buffer_page(bpage);
index 49bd7a3bc92b28d40ddc58dc5c5a8a1d99277c94..adb830ccd1cc435ba8fb4774f7e104684f5182d0 100644 (file)
@@ -43,3 +43,7 @@ net-caif-fix-double-disconnect-client-in-chnl_net_op.patch
 xen-pcpu-fix-possible-memory-leak-in-register_pcpu.patch
 net-x25-fix-skb-leak-in-x25_lapb_receive_frame.patch
 cifs-fix-wrong-return-value-checking-when-getflags.patch
+ftrace-fix-the-possible-incorrect-kernel-message.patch
+ftrace-optimize-the-allocation-for-mcount-entries.patch
+ring_buffer-do-not-deactivate-non-existant-pages.patch
+alsa-usb-audio-drop-snd_bug_on-from-snd_usbmidi_output_open.patch