dri-devel Archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
@ 2021-03-12  8:14 Du Cheng
  2021-03-12  8:36 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Du Cheng @ 2021-03-12  8:14 UTC (permalink / raw
  To: Greg Kroah-Hartman
  Cc: Daniel Vetter, syzbot+b67aaae8d3a927f68d20, dri-devel, Du Cheng

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

Reported-by: syzbot+b67aaae8d3a927f68d20@syzkaller.appspotmail.com
Signed-off-by: Du Cheng <ducheng2@gmail.com>
---
 drivers/video/fbdev/core/fbcon.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 44a5cd2f54cc..3406067985b1 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -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));
 }
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
  2021-03-12  8:14 [PATCH] drivers: video: fbcon: fix NULL dereference in fbcon_cursor() Du Cheng
@ 2021-03-12  8:36 ` Greg Kroah-Hartman
  2021-03-12  9:13   ` Du Cheng
  2021-03-13  0:23   ` Du Cheng
  0 siblings, 2 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-03-12  8:36 UTC (permalink / raw
  To: Du Cheng; +Cc: Daniel Vetter, syzbot+b67aaae8d3a927f68d20, dri-devel

On Fri, Mar 12, 2021 at 04:14:21PM +0800, Du Cheng wrote:
> add null-check on function pointer before dereference on ops->cursor
> 
> Reported-by: syzbot+b67aaae8d3a927f68d20@syzkaller.appspotmail.com
> Signed-off-by: Du Cheng <ducheng2@gmail.com>
> ---
>  drivers/video/fbdev/core/fbcon.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 44a5cd2f54cc..3406067985b1 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -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));
>  }
> -- 
> 2.27.0
> 

Is this the same issue reported here:
	https://lore.kernel.org/r/20210307105642.112572-1-h.shahbazi.git@gmail.com

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

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
  2021-03-12  8:36 ` Greg Kroah-Hartman
@ 2021-03-12  9:13   ` Du Cheng
  2021-03-13  0:23   ` Du Cheng
  1 sibling, 0 replies; 4+ messages in thread
From: Du Cheng @ 2021-03-12  9:13 UTC (permalink / raw
  To: Greg Kroah-Hartman; +Cc: Daniel Vetter, syzbot+b67aaae8d3a927f68d20, dri-devel

On Fri, Mar 12, 2021 at 09:36:42AM +0100, Greg Kroah-Hartman wrote:
> On Fri, Mar 12, 2021 at 04:14:21PM +0800, Du Cheng wrote:
> > add null-check on function pointer before dereference on ops->cursor
> > 
> > Reported-by: syzbot+b67aaae8d3a927f68d20@syzkaller.appspotmail.com
> > Signed-off-by: Du Cheng <ducheng2@gmail.com>
> > ---
> >  drivers/video/fbdev/core/fbcon.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> > index 44a5cd2f54cc..3406067985b1 100644
> > --- a/drivers/video/fbdev/core/fbcon.c
> > +++ b/drivers/video/fbdev/core/fbcon.c
> > @@ -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));
> >  }
> > -- 
> > 2.27.0
> > 
> 
> Is this the same issue reported here:
> 	https://lore.kernel.org/r/20210307105642.112572-1-h.shahbazi.git@gmail.com
> 
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
  2021-03-12  8:36 ` Greg Kroah-Hartman
  2021-03-12  9:13   ` Du Cheng
@ 2021-03-13  0:23   ` Du Cheng
  1 sibling, 0 replies; 4+ messages in thread
From: Du Cheng @ 2021-03-13  0:23 UTC (permalink / raw
  To: Greg Kroah-Hartman; +Cc: Daniel Vetter, syzbot+b67aaae8d3a927f68d20, dri-devel

On Fri, Mar 12, 2021 at 09:36:42AM +0100, Greg Kroah-Hartman wrote:
> On Fri, Mar 12, 2021 at 04:14:21PM +0800, Du Cheng wrote:
> > add null-check on function pointer before dereference on ops->cursor
> > 
> > Reported-by: syzbot+b67aaae8d3a927f68d20@syzkaller.appspotmail.com
> > Signed-off-by: Du Cheng <ducheng2@gmail.com>
> > ---
> >  drivers/video/fbdev/core/fbcon.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> > index 44a5cd2f54cc..3406067985b1 100644
> > --- a/drivers/video/fbdev/core/fbcon.c
> > +++ b/drivers/video/fbdev/core/fbcon.c
> > @@ -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));
> >  }
> > -- 
> > 2.27.0
> > 
> 
> Is this the same issue reported here:
> 	https://lore.kernel.org/r/20210307105642.112572-1-h.shahbazi.git@gmail.com
> 
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-13  0:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-12  8:14 [PATCH] drivers: video: fbcon: fix NULL dereference in fbcon_cursor() Du Cheng
2021-03-12  8:36 ` Greg Kroah-Hartman
2021-03-12  9:13   ` Du Cheng
2021-03-13  0:23   ` Du Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).