public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Arthur Borsboom <arthurborsboom@gmail.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Jason Andryuk" <jandryuk@gmail.com>,
	"Helge Deller" <deller@gmx.de>, "Arnd Bergmann" <arnd@arndb.de>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	xen-devel@lists.xenproject.org,
	"Jason Andryuk" <jason.andryuk@amd.com>,
	stable@vger.kernel.org, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fbdev/xen-fbfront: Assign fb_info->device
Date: Tue, 10 Sep 2024 14:22:21 +0200	[thread overview]
Message-ID: <2024091004-destitute-excusably-1eb5@gregkh> (raw)
In-Reply-To: <CALUcmUn30tPxjToysLBVBmibMaQUWW=GqFoqduP-W5QwQ-VriQ@mail.gmail.com>

On Tue, Sep 10, 2024 at 02:18:35PM +0200, Arthur Borsboom wrote:
> On Tue, 10 Sept 2024 at 10:33, Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Tue, Sep 10, 2024 at 10:13:01AM +0200, Roger Pau Monné wrote:
> > > On Tue, Sep 10, 2024 at 09:29:30AM +0200, Thomas Zimmermann wrote:
> > > > Hi
> > > >
> > > > Am 10.09.24 um 09:22 schrieb Roger Pau Monné:
> > > > > On Mon, Sep 09, 2024 at 10:09:16PM -0400, Jason Andryuk wrote:
> > > > > > From: Jason Andryuk <jason.andryuk@amd.com>
> > > > > >
> > > > > > Probing xen-fbfront faults in video_is_primary_device().  The passed-in
> > > > > > struct device is NULL since xen-fbfront doesn't assign it and the
> > > > > > memory is kzalloc()-ed.  Assign fb_info->device to avoid this.
> > > > > >
> > > > > > This was exposed by the conversion of fb_is_primary_device() to
> > > > > > video_is_primary_device() which dropped a NULL check for struct device.
> > > > > >
> > > > > > Fixes: f178e96de7f0 ("arch: Remove struct fb_info from video helpers")
> > > > > > Reported-by: Arthur Borsboom <arthurborsboom@gmail.com>
> > > > > > Closes: https://lore.kernel.org/xen-devel/CALUcmUncX=LkXWeiSiTKsDY-cOe8QksWhFvcCneOKfrKd0ZajA@mail.gmail.com/
> > > > > > Tested-by: Arthur Borsboom <arthurborsboom@gmail.com>
> > > > > > CC: stable@vger.kernel.org
> > > > > > Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
> > > > > Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
> > > > >
> > > > > > ---
> > > > > > The other option would be to re-instate the NULL check in
> > > > > > video_is_primary_device()
> > > > > I do think this is needed, or at least an explanation.  The commit
> > > > > message in f178e96de7f0 doesn't mention anything about
> > > > > video_is_primary_device() not allowing being passed a NULL device
> > > > > (like it was possible with fb_is_primary_device()).
> > > > >
> > > > > Otherwise callers of video_is_primary_device() would need to be
> > > > > adjusted to check for device != NULL.
> > > >
> > > > The helper expects a non-NULL pointer. We might want to document this.
> > >
> > > A BUG_ON(!dev); might be enough documentation that the function
> > > expected a non-NULL dev IMO.
> >
> > No need for that, don't check for things that will never happen.
> 
> And yet, here we are, me reporting a kernel/VM crash due to a thing
> that will never happen, see 'Closes' above.
> 
> I don't want to suggest BUG_ON is the right approach; I have no idea.
> I just want to mention that (!dev) did happen. :-)

A BUG_ON() will cause the same crash, so I don't see your point, sorry.

greg k-h

  reply	other threads:[~2024-09-10 12:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10  2:09 [PATCH] fbdev/xen-fbfront: Assign fb_info->device Jason Andryuk
2024-09-10  7:22 ` Roger Pau Monné
2024-09-10  7:29   ` Thomas Zimmermann
2024-09-10  8:13     ` Roger Pau Monné
2024-09-10  8:33       ` Greg KH
2024-09-10 12:18         ` Arthur Borsboom
2024-09-10 12:22           ` Greg KH [this message]
2024-09-10  7:26 ` Thomas Zimmermann
2024-09-11  5:59 ` Helge Deller

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=2024091004-destitute-excusably-1eb5@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=arthurborsboom@gmail.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jandryuk@gmail.com \
    --cc=jason.andryuk@amd.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.pau@citrix.com \
    --cc=sam@ravnborg.org \
    --cc=stable@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=xen-devel@lists.xenproject.org \
    /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