]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
authorDu Cheng <ducheng2@gmail.com>
Fri, 12 Mar 2021 08:14:21 +0000 (16:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Apr 2021 10:48:51 +0000 (12:48 +0200)
commit 01faae5193d6190b7b3aa93dae43f514e866d652 upstream.

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

Reported-by: syzbot+b67aaae8d3a927f68d20@syzkaller.appspotmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Du Cheng <ducheng2@gmail.com>
Link: https://lore.kernel.org/r/20210312081421.452405-1-ducheng2@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/fbdev/core/fbcon.c

index 5742a0dc774e9743deba50477c1a12b1fef74039..cf0e025416e5e4fc552acb50e59a01de91561435 100644 (file)
@@ -1306,6 +1306,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));
 }