linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Zhouyi Zhou <zhouzhouyi@gmail.com>
Cc: daniel@ffwll.ch, deller@gmx.de, sam@ravnborg.org,
	linux@roeck-us.net, willy@infradead.org,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, paulmck@kernel.org,
	rcu@vger.kernel.org
Subject: Re: [PATCH linux-next] video: fbdev: fbmem: fix pointer reference to null device field
Date: Fri, 11 Feb 2022 14:34:55 +0100	[thread overview]
Message-ID: <74bc6234-1b95-7a0a-6ee7-b27fb80a12d4@molgen.mpg.de> (raw)
In-Reply-To: <20220210065824.368355-1-zhouzhouyi@gmail.com>

Dear Zhouyi,


Am 10.02.22 um 07:58 schrieb Zhouyi Zhou:
> In function do_remove_conflicting_framebuffers, if device is NULL, there
> will be null pointer reference. The patch add a check to the if expression.
> 
> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> ---
> Dear Linux folks
> 
> I discover this bug in the PowerPC VM provided by
> Open source lab of Oregon State University:
> 
> https://lkml.org/lkml/2022/2/8/1145
> 
> I found that the root cause of null device field is in offb_init_fb:
> info = framebuffer_alloc(sizeof(u32) * 16, NULL);
> 
> I have tested the patch in the PowerPC VM. Hope my patch can be correct.
> 
> Many Thanks
> Zhouyi
> --
>   drivers/video/fbdev/core/fbmem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 34d6bb1bf82e..422b1fc01722 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1579,7 +1579,7 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
>   			 * If it's not a platform device, at least print a warning. A
>   			 * fix would add code to remove the device from the system.
>   			 */
> -			if (dev_is_platform(device)) {
> +			if (device && dev_is_platform(device)) {
>   				registered_fb[i]->forced_out = true;
>   				platform_device_unregister(to_platform_device(device));
>   			} else {

Looks reasonable.

Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul


PS: Please note, this should be unrelated to my problem though, as I 
didn’t use linux-next. (Let’s continue in the other thread though.)

      parent reply	other threads:[~2022-02-11 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10  6:58 [PATCH linux-next] video: fbdev: fbmem: fix pointer reference to null device field Zhouyi Zhou
2022-02-11  1:26 ` Paul E. McKenney
2022-02-11 13:34 ` Paul Menzel [this message]

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=74bc6234-1b95-7a0a-6ee7-b27fb80a12d4@molgen.mpg.de \
    --to=pmenzel@molgen.mpg.de \
    --cc=daniel@ffwll.ch \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=willy@infradead.org \
    --cc=zhouzhouyi@gmail.com \
    /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 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 NNTP newsgroup(s).