Re: [PATCH 1/2] platform/x86: ISST: Optimize CPU to PCI device mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
> > 




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux