mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>, mgross@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] platform/x86: ISST: Optimize CPU to PCI device mapping
Date: Thu, 17 Jun 2021 07:18:34 -0700	[thread overview]
Message-ID: <87c42db2e913df0dbb1cd772ba3fba5da59b1ed1.camel@linux.intel.com> (raw)
In-Reply-To: <b93fc0c0-77f9-a9b4-e5dd-28a781332691@redhat.com>

Hi Hans,

On Thu, 2021-06-17 at 13:37 +0200, Hans de Goede wrote:
> > 

[...]

> Hi Srinivas,
> 
> On 6/17/21 12:13 AM, Srinivas Pandruvada wrote:
> >  
> > -	bus_number = isst_cpu_info[cpu].bus_info[bus_no];
> > -	if (bus_number < 0)
> > -		return NULL;
> > +	pci_dev = isst_cpu_info[cpu].pci_dev[bus_no];
> 
> If the _isst_if_get_pci_dev() call below fails, then pci_dev might
> end up getting set to NULL here.
> 
> >  
> > -	return pci_get_domain_bus_and_slot(0, bus_number,
> > PCI_DEVFN(dev, fn));
> > +	if (pci_dev->devfn == PCI_DEVFN(dev, fn))
> 
> And then this would lead to a NULL ptr deref, I've replaced this
> the above if with:
> 
> 	if (pci_dev && pci_dev->devfn == PCI_DEVFN(dev, fn))
> 
> to avoid this.
Looks good.

Thanks for doing the change.

-Srinivas

> 
> I've applied this series with the above change
> to my review-hans  branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
> 
> Note it will show up in my review-hans branch once I've pushed my
> local branch there, which might take a while.
> 
> Once I've run some tests on this branch the patches there will be
> added to the platform-drivers-x86/for-next branch and eventually
> will be included in the pdx86 pull-request to Linus for the next
> merge-window.
> 
> Regards,
> 
> Hans
> 
> 
> 
> 
> 
> > +		return pci_dev;
> > +
> > +	return _isst_if_get_pci_dev(cpu, bus_no, dev, fn);
> >  }
> >  EXPORT_SYMBOL_GPL(isst_if_get_pci_dev);
> >  
> > @@ -327,6 +344,8 @@ static int isst_if_cpu_online(unsigned int cpu)
> >  	} else {
> >  		isst_cpu_info[cpu].bus_info[0] = data & 0xff;
> >  		isst_cpu_info[cpu].bus_info[1] = (data >> 8) & 0xff;
> > +		isst_cpu_info[cpu].pci_dev[0] =
> > _isst_if_get_pci_dev(cpu, 0, 0, 1);
> > +		isst_cpu_info[cpu].pci_dev[1] =
> > _isst_if_get_pci_dev(cpu, 1, 30, 1);
> >  	}
> >  
> >  	ret = rdmsrl_safe(MSR_THREAD_ID_INFO, &data);
> > 


  reply	other threads:[~2021-06-17 14:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 22:13 Srinivas Pandruvada
2021-06-16 22:13 ` [PATCH 2/2] platform/x86: ISST: Use numa node id for cpu pci dev mapping Srinivas Pandruvada
2021-06-17 11:37 ` [PATCH 1/2] platform/x86: ISST: Optimize CPU to PCI device mapping Hans de Goede
2021-06-17 14:18   ` Srinivas Pandruvada [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-06-16 20:18 Srinivas Pandruvada

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=87c42db2e913df0dbb1cd772ba3fba5da59b1ed1.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.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

Powered by JetHome