lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200914135917.GF24441@willie-the-truck>
Date:   Mon, 14 Sep 2020 14:59:18 +0100
From:   Will Deacon <will@...nel.org>
To:     Mark Salter <msalter@...hat.com>
Cc:     Mark Rutland <mark.rutland@....com>,
        Khuong Dinh <khuong@...amperecomputing.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] drivers/perf: xgene_pmu: Fix uninitialized resource
 struct

On Mon, Sep 14, 2020 at 09:13:39AM -0400, Mark Salter wrote:
> On Mon, 2020-09-14 at 12:28 +0100, Will Deacon wrote:
> > On Sun, Sep 13, 2020 at 01:45:36PM -0400, Mark Salter wrote:
> > > @@ -1483,11 +1473,23 @@ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu,
> > >  		return NULL;
> > >  
> > >  	INIT_LIST_HEAD(&resource_list);
> > > -	rc = acpi_dev_get_resources(adev, &resource_list,
> > > -				    acpi_pmu_dev_add_resource, &res);
> > > +	rc = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
> > > +	if (rc <= 0) {
> > > +		dev_err(dev, "PMU type %d: No resources found\n", type);
> > > +		return NULL;
> > > +	}
> > > +
> > > +	list_for_each_entry(rentry, &resource_list, node) {
> > > +		if (resource_type(rentry->res) == IORESOURCE_MEM) {
> > > +			res = *rentry->res;
> > > +			rentry = NULL;
> > > +			break;
> > > +		}
> > > +	}
> > >  	acpi_dev_free_resource_list(&resource_list);
> > > -	if (rc < 0) {
> > > -		dev_err(dev, "PMU type %d: No resource address found\n", type);
> > > +
> > > +	if (rentry) {
> > 
> > I'm curious as to why you've had to change the failure logic here, setting
> > rentry to NULL instead of checking 'rentry->res' like the TX2 driver (which
> > I don't immediately understand at first glance).
> > 
> > Will
> > 
> 
> I don't fully understand the tx2 logic. I do see there's a memory leak if
> that (!rentry->res) is true. I was going to dig deeper and follow up with
> a patch for tx2. I suspect that rentry->res should never be true. And tx2
> won't detect if no memory resource is in the table.

Ah good, so it wasn't just me then! In which case, please send the two
patches as a series fixing both drivers, and I'll queue them both together.

Ta,

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ