[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <027101d65397$cf7ef760$6e7ce620$@samsung.com>
Date: Mon, 6 Jul 2020 18:47:30 +0530
From: "Sriram Dash" <sriram.dash@...sung.com>
To: "'Lorenzo Pieralisi'" <lorenzo.pieralisi@....com>
Cc: "'Kishon Vijay Abraham I'" <kishon@...com>,
"'Shradha Todi'" <shradha.t@...sung.com>, <bhelgaas@...gle.com>,
<pankaj.dubey@...sung.com>, <linux-pci@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] PCI: endpoint: Fix NULL pointer dereference for
->get_features()
> From: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
> Sent: 06 July 2020 16:47
> Subject: Re: [PATCH] PCI: endpoint: Fix NULL pointer dereference for -
> >get_features()
>
> On Thu, Apr 02, 2020 at 08:01:59PM +0530, Sriram Dash wrote:
>
> [...]
>
> > > So the patch itself is correct though the commit log has to be
> > > fixed. You should also check if all the endpoint controller drivers
> > > existing currently provides epc_features.
> >
> > At the moment, there is no issue for existing controller drivers as I
> > can see almost all drivers are providing epc_features. But, this is
> > not a mandatory feature and some controller drivers may not have
> > epc_features implemented, may be in the near future. But because we
> > are dealing with the configfs, the application need not bother about
> > the driver details underneath.
> >
> > IMO, the code should be fixed regardless and should not cause panic in
> > any case.
>
> What's this patch status please ?
>
Its not in the mainline tree as of now. However, we feel its important for
the drivers not using epc_features.
> Thanks,
> Lorenzo
>
> > > Thanks
> > > Kishon
> > > >
> > > >
> > > >> drivers/pci/endpoint/functions/pci-epf-test.c | 15
> > > >> +++++++++------
> > > >> 1 file changed, 9 insertions(+), 6 deletions(-)
> > > >>
> > > >> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c
> > > >> b/drivers/pci/endpoint/functions/pci-epf-test.c
> > > >> index c9121b1b9fa9..af4537a487bf 100644
> > > >> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> > > >> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> > > >> @@ -510,14 +510,17 @@ static int pci_epf_test_bind(struct pci_epf
*epf)
> > > >> return -EINVAL;
> > > >>
> > > >> epc_features = pci_epc_get_features(epc, epf->func_no);
> > > >> - if (epc_features) {
> > > >> - linkup_notifier = epc_features->linkup_notifier;
> > > >> - msix_capable = epc_features->msix_capable;
> > > >> - msi_capable = epc_features->msi_capable;
> > > >> - test_reg_bar =
pci_epc_get_first_free_bar(epc_features);
> > > >> - pci_epf_configure_bar(epf, epc_features);
> > > >> + if (!epc_features) {
> > > >> + dev_err(dev, "epc_features not implemented\n");
> > > >> + return -ENOTSUPP;
> > > >> }
> > > >>
> > > >> + linkup_notifier = epc_features->linkup_notifier;
> > > >> + msix_capable = epc_features->msix_capable;
> > > >> + msi_capable = epc_features->msi_capable;
> > > >> + test_reg_bar = pci_epc_get_first_free_bar(epc_features);
> > > >> + pci_epf_configure_bar(epf, epc_features);
> > > >> +
> > > >> epf_test->test_reg_bar = test_reg_bar;
> > > >> epf_test->epc_features = epc_features;
> > > >>
> > > >> --
> > > >> 2.17.1
> > > >
> > > >
> >
Powered by blists - more mailing lists