public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Tong Zhang <ztong0001@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge
Date: Tue, 11 May 2021 19:57:29 +0200	[thread overview]
Message-ID: <YJrFib6BD8JcX3DM@kroah.com> (raw)
In-Reply-To: <CAA5qM4CWNsjupqOy+-xKuhT7wSK33r5m_VtvxUikkTi+LA8rHA@mail.gmail.com>

On Tue, May 11, 2021 at 10:17:12AM -0700, Tong Zhang wrote:
> On Tue, May 11, 2021 at 12:03 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Mon, May 10, 2021 at 03:20:02PM -0700, Tong Zhang wrote:
> > > On Mon, May 10, 2021 at 7:36 AM Greg Kroah-Hartman
> > > <gregkh@linuxfoundation.org> wrote:
> > > >
> > > > On Mon, Apr 26, 2021 at 06:07:27PM -0400, Tong Zhang wrote:
> > > > > the PCI bridge might be NULL, so we'd better check before use it
> > > >
> > > > I do not understand, how can pci ever be NULL?  There is only 1 way this
> > >
> > > Hi Greg,
> > > I think the problem is with
> > >     priv->parent_pdev = pdev->bus->self
> > > where bus->self can be NULL. when bus->self is NULL, calling
> >
> > How can bus->self be NULL?
> 
> Hi Greg,
> Please correct me if I am wrong,
> when bus->self is not NULL, it means there is a bridge,
> However, a device can be directly attached to the port on the root
> complex. In this case, the bus->self is NULL.

Does that ever happen with a device on the root like that?

> > Did you see this on a real system?  How did you duplicate the error
> > listed here?
> I did this in QEMU. If QEMU is considered not real, then I haven't
> seen an alcor controller configured in this way in a real system.
> That being said, this kind of configuration is still legit IMHO.

Ah, ok, that makes more sense, this is a virtual system.

I suggest, again, steping back up and just not calling this function if
you are on the root, as it does not make any sense to do so for a device
that is not there.

thanks,

greg k-h

  reply	other threads:[~2021-05-11 17:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 22:07 [PATCH] misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge Tong Zhang
2021-05-10 14:36 ` Greg Kroah-Hartman
2021-05-10 22:20   ` Tong Zhang
2021-05-11  7:03     ` Greg Kroah-Hartman
2021-05-11 17:17       ` Tong Zhang
2021-05-11 17:57         ` Greg Kroah-Hartman [this message]
2021-05-11 21:29           ` [PATCH v2] " Tong Zhang
2021-05-12  6:24             ` Greg Kroah-Hartman
2021-05-12 16:24               ` Tong Zhang
2021-05-12 16:41                 ` Greg Kroah-Hartman
2021-05-13  4:07                   ` [PATCH v3] " Tong Zhang
2021-05-19  8:40                     ` Dan Carpenter
2021-05-19 20:20                       ` Tong Zhang
2021-05-13  4:09                   ` [PATCH v2] " Tong Zhang
2021-05-11 21:32           ` [PATCH] " Tong Zhang

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=YJrFib6BD8JcX3DM@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ztong0001@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