Skip to contentSkip to conversation

drivers: tty: vt: vt.c: fix NULL dereference crash

PATCH In review Hassan Shahbazi 4 participants 6 messages Mar 7, 2021 – Mar 13, 2021 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: tty: vt: vt.c: fix NULL dereference crash

Fix a NULL deference crash on hiding the cursor.

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

---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/vt/vt.c +3 -1
index 284b07224c55..8c3e83c81341 100644
@@ -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);
 }
 
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 28 lines · Hassan Shahbazi

Fix a NULL deference crash on hiding the cursor.

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

---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/vt/vt.c +3 -1
index 284b07224c55..8c3e83c81341 100644
@@ -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);
 }
 
Signature · 1 line
2.26.2

Are you sure this actually fixes the problem? How did you test it? Did syzbot test this?

I had a few reports of this patch _not_ solving the problem, so getting confirmation of this would be good.

thanks,

greg k-h

#2 lore raw
Quoted 34 lines · Greg KH
Quoted 28 lines · Hassan Shahbazi

Fix a NULL deference crash on hiding the cursor.

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

---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/vt/vt.c +3 -1
index 284b07224c55..8c3e83c81341 100644
@@ -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);
 }
 
Signature · 1 line
2.26.2

Are you sure this actually fixes the problem? How did you test it? Did
syzbot test this?

Quoted 7 lines

I had a few reports of this patch _not_ solving the problem, so getting
confirmation of this would be good.

thanks,

greg k-h

Hi,

I've tested the patch on upstream using the .config and the C reproducer reported by syzbot. It seems that the patch doesn't fix the issue.

Maybe you can send a patch test request to syzbot to validate the patch.

Thanks,
Fatih

#3 lore raw

PATCH 1/1 drivers: tty: vt: vt.c: fix NULL dereference crash

Hi Fatih,
I just found out that the section [Patch testing requests] on
https://syzkaller.appspot.com/bug?id=defb47bf56e1c14d5687280c7bb91ce7b608b94b,
indicates that you did not attach the patch when sending email to syzbot. syzbot was simply testing the vallina upstream with repro.c, so it failed as expected.

Anyway, I resent the test email *with the patch* from Hassan to syzbot, and let's see the result.

Regards,
Du Cheng

#4 lore raw
In reply to Greg KH
Quoted 33 lines · Greg KH
Quoted 28 lines · Hassan Shahbazi

Fix a NULL deference crash on hiding the cursor.

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

---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/vt/vt.c +3 -1
index 284b07224c55..8c3e83c81341 100644
@@ -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);
 }
 
Signature · 1 line
2.26.2

Are you sure this actually fixes the problem? How did you test it? Did syzbot test this?

Quoted 6 lines

I had a few reports of this patch _not_ solving the problem, so getting confirmation of this would be good.

thanks,

greg k-h

Unfortunately, it seems the patch has not fixed the bug. I drop this patch and will continue working on a newer one.

Thanks for the feedback,
Hassan Shahbazi

#5 lore raw

PATCH 1/1 drivers: tty: vt: vt.c: fix NULL dereference crash

In reply to Hassan Shahbazi

Hi Hassan Shahbazi,

I also tested your patch locally with qemu, but it did not fix the crashing.

I sent test command to syzbot on upstream linux and am waiting for result.

Regards,
Du Cheng