From: Mukesh Ojha <quic_mojha@quicinc.com>
To: <linux-kernel@vger.kernel.org>
Cc: <john.ogness@linutronix.de>, <rostedt@goodmis.org>,
<senozhatsky@chromium.org>, <pmladek@suse.com>,
Mukesh Ojha <quic_mojha@quicinc.com>
Subject: [PATCH] printk: Fix seq check inside devkmsg_read()
Date: Tue, 18 Jan 2022 17:04:48 +0530 [thread overview]
Message-ID: <1642505688-1194-1-git-send-email-quic_mojha@quicinc.com> (raw)
prb_read_valid() could return a record whose seq number can be
newer than the requested one. In that case, we allow the reading
of the data instead of erroring out.
This commit fixes this by correcting the check.
Fixes: ce6de43a547b6e01a3 ("printk: avoid prb_first_valid_seq() where possible")
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
---
kernel/printk/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 155229f..53b09b98 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -738,7 +738,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
goto out;
}
- if (r->info->seq != atomic64_read(&user->seq)) {
+ if (r->info->seq < atomic64_read(&user->seq)) {
/* our last seen message is gone, return error and reset */
atomic64_set(&user->seq, r->info->seq);
ret = -EPIPE;
--
2.7.4
next reply other threads:[~2022-01-18 11:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 11:34 Mukesh Ojha [this message]
2022-01-18 13:20 ` John Ogness
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=1642505688-1194-1-git-send-email-quic_mojha@quicinc.com \
--to=quic_mojha@quicinc.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--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®