Skip to contentSkip to conversation

drivers: video: fbcon: fix NULL dereference in fbcon_cursor()

PATCH In review Du Cheng 2 participants 4 messages Mar 12, 2021 – Mar 13, 2021

Subsystems (3)
lore
Share & tools
lore

Du Cheng

author
#0 lore raw

PATCH 1/1 drivers: video: fbcon: fix NULL dereference in fbcon_cursor()

add null-check on function pointer before dereference on ops->cursor

---
 drivers/video/fbdev/core/fbcon.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbcon.c +3 -0
index 44a5cd2f54cc..3406067985b1 100644
@@ -1333,6 +1333,9 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
 
 	ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
 
+	if (!ops->cursor)
+		return;
+
 	ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
 		    get_color(vc, info, c, 0));
 }
Signature · 6 lines
2.27.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 25 lines · Du Cheng

add null-check on function pointer before dereference on ops->cursor

---
 drivers/video/fbdev/core/fbcon.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbcon.c +3 -0
index 44a5cd2f54cc..3406067985b1 100644
@@ -1333,6 +1333,9 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
 
 	ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
 
+	if (!ops->cursor)
+		return;
+
 	ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
 		    get_color(vc, info, c, 0));
 }
Signature · 1 line
2.27.0

Is this the same issue reported here:

	https://lore.kernel.org/r/[email protected]

And has syzbot testing shown that this fix does solve the issue?

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#2 lore raw
Quoted 28 lines · Greg Kroah-Hartman
Quoted 25 lines · Du Cheng

add null-check on function pointer before dereference on ops->cursor

---
 drivers/video/fbdev/core/fbcon.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbcon.c +3 -0
index 44a5cd2f54cc..3406067985b1 100644
@@ -1333,6 +1333,9 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
 
 	ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
 
+	if (!ops->cursor)
+		return;
+
 	ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
 		    get_color(vc, info, c, 0));
 }
Signature · 1 line
2.27.0

Is this the same issue reported here:

Quoted 7 lines
	https://lore.kernel.org/r/[email protected]

And has syzbot testing shown that this fix does solve the issue?

thanks,

greg k-h

Hi Greg,

I sent both my patch and that of shahbazi to syzbot to see if they resolve the bug by the id b67aaae8d3a927f68d20.

I will keep you posted of the outcomes.

Regards,
Du Cheng
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 28 lines · Greg Kroah-Hartman
Quoted 25 lines · Du Cheng

add null-check on function pointer before dereference on ops->cursor

---
 drivers/video/fbdev/core/fbcon.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbcon.c +3 -0
index 44a5cd2f54cc..3406067985b1 100644
@@ -1333,6 +1333,9 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
 
 	ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
 
+	if (!ops->cursor)
+		return;
+
 	ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
 		    get_color(vc, info, c, 0));
 }
Signature · 1 line
2.27.0

Is this the same issue reported here:

Quoted 7 lines
	https://lore.kernel.org/r/[email protected]

And has syzbot testing shown that this fix does solve the issue?

thanks,

greg k-h

Hi Greg,

After syzbot testing at
https://syzkaller.appspot.com/bug?id=26567b12e74b8791e1db50da6039ee1705e5a7ed
the results showed that shahbazi's patch did not solve this bug, but my patch passed the syzbot test.

Regards,
Du Cheng

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel