From: dimadrumspro@gmail.com
To: dimaac@bk.ru
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
dimaaac <dimadrumspro@gmail.com>
Subject: [PATCH 2/2] drivers: tty: vt: vt.c: fixed segmentation fault in vt.c
Date: Thu, 2 Nov 2023 00:53:32 +0100 [thread overview]
Message-ID: <20231101235332.4314-1-dimadrumspro@gmail.com> (raw)
From: dimaaac <dimadrumspro@gmail.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@bk.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
next reply other threads:[~2023-11-01 23:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 23:53 dimadrumspro [this message]
2023-11-02 5:45 ` [PATCH 2/2] drivers: tty: vt: vt.c: fixed segmentation fault in vt.c Greg KH
-- strict thread matches above, loose matches on Subject: below --
2023-11-02 11:39 dimadrumspro
2023-11-02 11:42 ` Greg KH
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=20231101235332.4314-1-dimadrumspro@gmail.com \
--to=dimadrumspro@gmail.com \
--cc=dimaac@bk.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.