All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hassan Shahbazi <h.shahbazi.git@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, Hassan Shahbazi <h.shahbazi.git@gmail.com>
Subject: [PATCH] drivers: tty: vt: vt.c: fix NULL dereference crash
Date: Sun,  7 Mar 2021 12:56:43 +0200	[thread overview]
Message-ID: <20210307105642.112572-1-h.shahbazi.git@gmail.com> (raw)

Fix a NULL deference crash on hiding the cursor.

Reported by: syzbot
https://syzkaller.appspot.com/bug?id=defb47bf56e1c14d5687280c7bb91ce7b608b94b

Signed-off-by: Hassan Shahbazi <h.shahbazi.git@gmail.com>
---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 284b07224c55..8c3e83c81341 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -904,7 +904,9 @@ static void hide_cursor(struct vc_data *vc)
 	if (vc_is_sel(vc))
 		clear_selection();
 
-	vc->vc_sw->con_cursor(vc, CM_ERASE);
+	if (vc->vc_sw)
+		vc->vc_sw->con_cursor(vc, CM_ERASE);
+
 	hide_softcursor(vc);
 }
 
-- 
2.26.2


             reply	other threads:[~2021-03-07 10:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 10:56 Hassan Shahbazi [this message]
2021-03-12  8:33 ` [PATCH] drivers: tty: vt: vt.c: fix NULL dereference crash Greg KH
2021-03-12  9:07   ` Fatih Yildirim
2021-03-12 15:43     ` Du Cheng
2021-03-13  9:12   ` Hassan Shahbazi
2021-03-12 15:05 ` Du Cheng

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=20210307105642.112572-1-h.shahbazi.git@gmail.com \
    --to=h.shahbazi.git@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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.