summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0017-printk-nbcon-Ensure-ownership-release-on-failed-emit.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:59 +0000
commit27d3313807296c3943a96ceef8c2b7279cb56962 (patch)
tree7d08e78c36ab6437b403fc7cd8c23e41f135c7a3 /debian/patches-rt/0017-printk-nbcon-Ensure-ownership-release-on-failed-emit.patch
parentMerging upstream version 6.7.7. (diff)
downloadlinux-27d3313807296c3943a96ceef8c2b7279cb56962.tar.xz
linux-27d3313807296c3943a96ceef8c2b7279cb56962.zip
Adding debian version 6.7.7-1.debian/6.7.7-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0017-printk-nbcon-Ensure-ownership-release-on-failed-emit.patch')
-rw-r--r--debian/patches-rt/0017-printk-nbcon-Ensure-ownership-release-on-failed-emit.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/patches-rt/0017-printk-nbcon-Ensure-ownership-release-on-failed-emit.patch b/debian/patches-rt/0017-printk-nbcon-Ensure-ownership-release-on-failed-emit.patch
new file mode 100644
index 0000000000..65553848f5
--- /dev/null
+++ b/debian/patches-rt/0017-printk-nbcon-Ensure-ownership-release-on-failed-emit.patch
@@ -0,0 +1,57 @@
+From: John Ogness <john.ogness@linutronix.de>
+Date: Fri, 20 Oct 2023 09:52:59 +0000
+Subject: [PATCH 17/50] printk: nbcon: Ensure ownership release on failed emit
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.7/older/patches-6.7-rt6.tar.xz
+
+Until now it was assumed that ownership has been lost when the
+write_atomic() callback fails. nbcon_emit_next_record() only
+returns false when ownership has been lost.
+
+Ensure ownership has been lost before reporting failure by
+explicitly attempting a release. If the current context is not
+the owner, the release has no effect.
+
+Signed-off-by: John Ogness <john.ogness@linutronix.de>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/printk/nbcon.c | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+--- a/kernel/printk/nbcon.c
++++ b/kernel/printk/nbcon.c
+@@ -852,7 +852,7 @@ static bool nbcon_emit_next_record(struc
+ unsigned long con_dropped;
+ struct nbcon_state cur;
+ unsigned long dropped;
+- bool done;
++ bool done = false;
+
+ /*
+ * The printk buffers are filled within an unsafe section. This
+@@ -891,17 +891,18 @@ static bool nbcon_emit_next_record(struc
+ nbcon_state_read(con, &cur);
+ wctxt->unsafe_takeover = cur.unsafe_takeover;
+
+- if (con->write_atomic) {
++ if (con->write_atomic)
+ done = con->write_atomic(con, wctxt);
+- } else {
+- nbcon_context_release(ctxt);
+- WARN_ON_ONCE(1);
+- done = false;
+- }
+
+- /* If not done, the emit was aborted. */
+- if (!done)
++ if (!done) {
++ /*
++ * The emit was aborted, probably due to a loss of ownership.
++ * Ensure ownership was lost or released before reporting the
++ * loss.
++ */
++ nbcon_context_release(ctxt);
+ return false;
++ }
+
+ /*
+ * Since any dropped message was successfully output, reset the