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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  2 Nov 2023 00:53:32 +0100
From:   dimadrumspro@...il.com
To:     dimaac@...ru
Cc:     linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
        dimaaac <dimadrumspro@...il.com>
Subject: [PATCH 2/2] drivers: tty: vt: vt.c: fixed segmentation fault in vt.c

From: dimaaac <dimadrumspro@...il.com>

The previous code lacked proper synchronization, leading to potential data corruption and crashes. Added a spin lock to protect shared variable 'scrollback_delta' to prevent concurrent access.

Signed-off-by: dimaaac <dimaac@...ru>
---
 drivers/tty/vt/vt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 5c47f77804f0..29cf7fe11662 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -301,12 +301,13 @@ static inline unsigned short *screenpos(const struct vc_data *vc, int offset,
 }
 
 /* Called  from the keyboard irq path.. */
+static DEFINE_SPINLOCK(scrolldelta_lock);
+
 static inline void scrolldelta(int lines)
 {
-	/* FIXME */
-	/* scrolldelta needs some kind of consistency lock, but the BKL was
-	   and still is not protecting versus the scheduled back end */
+	spin_lock(&scrolldelta_lock);
 	scrollback_delta += lines;
+	spin_unlock(&scrolldelta_lock);
 	schedule_console_callback();
 }
 
-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ