lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1642505688-1194-1-git-send-email-quic_mojha@quicinc.com>
Date:   Tue, 18 Jan 2022 17:04:48 +0530
From:   Mukesh Ojha <quic_mojha@...cinc.com>
To:     <linux-kernel@...r.kernel.org>
CC:     <john.ogness@...utronix.de>, <rostedt@...dmis.org>,
        <senozhatsky@...omium.org>, <pmladek@...e.com>,
        Mukesh Ojha <quic_mojha@...cinc.com>
Subject: [PATCH] printk: Fix seq check inside devkmsg_read()

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@...cinc.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ