From: Avi Weiss <thnkslprpt@gmail.com>
To: Chris Down <chris@chrisdown.name>, Petr Mladek <pmladek@suse.com>,
John Ogness <john.ogness@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
printk@lists.linux.dev, linux-kernel@vger.kernel.org,
Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] printk: Fix skipped entries after index iterator restart
Date: Mon, 16 Nov 2026 10:56:10 +0200 [thread overview]
Message-ID: <20261116085609.476250-2-thnkslprpt@gmail.com> (raw)
seq_read_iter() can advance the iterator before the next record
fits in the read buffer. When iteration resumes, pi_start() calls
pi_next() at the saved position and advances past the pending printk
index entry. As a result, index reads can silently omit formats.
Return the entry corresponding to the saved position without
advancing the iterator.
Fixes: 337015573718 ("printk: Userspace format indexing support")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
kernel/printk/index.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/printk/index.c b/kernel/printk/index.c
index a6b27526baaf6..642640a36abe1 100644
--- a/kernel/printk/index.c
+++ b/kernel/printk/index.c
@@ -59,7 +59,7 @@ static void *pi_start(struct seq_file *s, loff_t *pos)
if (*pos == 0)
return SEQ_START_TOKEN;
- return pi_next(s, NULL, pos);
+ return pi_get_entry(s->file->f_inode->i_private, *pos - 1);
}
/*
base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
--
2.43.0
next reply other threads:[~2026-11-16 8:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 8:56 Avi Weiss [this message]
2026-11-16 9:15 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116085609.476250-2-thnkslprpt@gmail.com \
--to=thnkslprpt@gmail.com \
--cc=chris@chrisdown.name \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=printk@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®