The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: WeitaoWang-oc <WeitaoWang-oc@zhaoxin.com>
To: Alex Williamson <alex.williamson@redhat.com>,
	WeitaoWang-oc <WeitaoWang-oc@zhaoxin.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"mathias.nyman@linux.intel.com" <mathias.nyman@linux.intel.com>,
	"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	"vkoul@kernel.org" <vkoul@kernel.org>,
	"hslester96@gmail.com" <hslester96@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Carsten_Schmid@mentor.com" <Carsten_Schmid@mentor.com>,
	"efremov@linux.com" <efremov@linux.com>,
	"Tony W. Wang(XA-RD)" <TonyWWang@zhaoxin.com>,
	"Cobe Chen(BJ-RD)" <CobeChen@zhaoxin.com>,
	"Tim Guo(BJ-RD)" <TimGuo@zhaoxin.com>,
	"wwt8723@163.com" <wwt8723@163.com>
Subject: 答复: [PATCH] USB:Fix kernel NULL pointer when unbind UHCI form vfio-pci
Date: Thu, 23 Jul 2020 08:36:25 +0000	[thread overview]
Message-ID: <371b3697614e4034aed8e9f340a7dbf1@zhaoxin.com> (raw)
In-Reply-To: <20200722215313.5a842b93@x1.home>


On Thu,23 July 2020 04:18:00 +0000 Alex wrote:
> On Wed, 22 Jul 2020 19:57:48 +0800
> WeitaoWangoc <WeitaoWang-oc@zhaoxin.com> wrote:
> 
> >  drivers/usb/core/hcd-pci.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
> > index 1547aa6..484f2a0 100644
> > --- a/drivers/usb/core/hcd-pci.c
> > +++ b/drivers/usb/core/hcd-pci.c
> > @@ -34,6 +34,7 @@ static DECLARE_RWSEM(companions_rwsem);
> >  #define CL_OHCI                PCI_CLASS_SERIAL_USB_OHCI
> >  #define CL_EHCI                PCI_CLASS_SERIAL_USB_EHCI
> >
> > +#define PCI_DEV_DRV_FLAG       2
> >  static inline int is_ohci_or_uhci(struct pci_dev *pdev)  {
> >         return pdev->class == CL_OHCI || pdev->class == CL_UHCI; @@
> > -68,6 +69,8 @@ static void for_each_companion(struct pci_dev *pdev, struct
> usb_hcd *hcd,
> >                 if (companion->class != CL_UHCI && companion->class !=
> CL_OHCI &&
> >                                 companion->class != CL_EHCI)
> >                         continue;
> > +               if (!(companion->priv_flags & PCI_DEV_DRV_FLAG))
> 
> But pci_dev.priv_flags is private data for the driver that currently
> owns the device, which could be vfio-pci.  This is really no different
> than assuming the structure at device.driver_data.  If vfio-pci were to
> make legitimate use of pci_dev.priv_flags, this could simply blow up
> again.  Should there instead be some sort of registration interface
> where hcd complaint drivers register their devices and only those
> registered devices can have their driver private data arbitrarily poked
> by another driver?  Thanks,

Thanks for your explanation. Set pci_dev.priv_flags is really not a 
reasonable approach. Are there any more detailed suggestions 
to patch this issue?

Thanks
Weitaowang

  reply	other threads:[~2020-07-23  8:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 11:57 [PATCH] USB:Fix kernel NULL pointer when unbind UHCI form vfio-pci WeitaoWangoc
2020-07-22 12:44 ` Greg KH
2020-07-22 14:59   ` Alan Stern
2020-07-23  2:59     ` 答复: " Weitao Wang(BJ-RD)
2020-07-23  4:18       ` Alex Williamson
2020-07-23 15:38         ` Alan Stern
2020-07-23 16:17           ` Alex Williamson
2020-07-23 16:38             ` Alan Stern
2020-07-24 12:57               ` 答复: " WeitaoWang-oc
2020-07-24 19:17                 ` Alex Williamson
2020-07-28  5:53                   ` 答复: " WeitaoWang-oc
2020-08-19  3:23               ` TimGuo-oc
2020-07-23  5:25       ` Greg KH
2020-07-23  2:58   ` Weitao Wang(BJ-RD)
2020-07-23  3:53 ` Alex Williamson
2020-07-23  8:36   ` WeitaoWang-oc [this message]
2020-07-23  8:41     ` 答复: " gregkh

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=371b3697614e4034aed8e9f340a7dbf1@zhaoxin.com \
    --to=weitaowang-oc@zhaoxin.com \
    --cc=Carsten_Schmid@mentor.com \
    --cc=CobeChen@zhaoxin.com \
    --cc=TimGuo@zhaoxin.com \
    --cc=TonyWWang@zhaoxin.com \
    --cc=alex.williamson@redhat.com \
    --cc=efremov@linux.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hslester96@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vkoul@kernel.org \
    --cc=wwt8723@163.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