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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1367867448.2953.52.camel@lorien>
Date:	Mon, 6 May 2013 19:10:47 +0000
From:	Shuah Khan <shuah.kh@...sung.com>
To:	Pavel Machek <pavel@....cz>
CC:	"Rafael J. Wysocki" <rjw@...k.pl>,
	"len.brown@...el.com" <len.brown@...el.com>,
	"rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"shuahkhan@...il.com" <shuahkhan@...il.com>
Subject: Re: [PATCH] PM: Fix dev_pm_put_subsys_data() to not call kfree()
 while holding device power lock

On Mon, 2013-05-06 at 08:00 -0600, Shuah Khan wrote:
> On Mon, 2013-05-06 at 14:09 +0200, Pavel Machek wrote:
> > Hi!
> > 
> > > > Wow, that function is fragile. It returns 0/1/-EINVAL, while being
> > > > documented for 0/1...
> > > 
> > > Oh, it generally should return 1 for !psd.
> > > 
> > > > Patch does not look obviously wrong, but maybe 
> > > > 
> > > > @@ -73,13 +73,17 @@ int dev_pm_put_subsys_data(struct device *dev)
> > > >  
> > > >  	if (--psd->refcount == 0) {
> > > >  		dev->power.subsys_data = NULL;
> > > > +		spin_unlock_irq(&dev->power.lock);
> > > > -		kfree(psd);
> > > > - 		ret = 1;
> > > > +		return 1;
> > > >  	}
> > > > 
> > > > Would be cleaner.
> > > 
> > > What about this:
> > 
> > Looks good to me.
> > 
> > Reviewed-by: Pavel Machek <pavel@....cz>
> 
> Rafael/Pavel,
> 
> I redid the patch based on Pavel's comments and just about to send it
> and then I saw your exchange. This version looks good to me. Do you want
> me to test the patch and resend?
> 
> thanks,
> -- Shuah

I sent v2 patch that incorporates the comments from Rafael and Pavel.

thanks,

-- Shuah

Shuah Khan Lead Kernel Developer - Open Source Group 
Samsung Research America (Silicon Valley)
shuah.kh@...sung.com | (970) 672-0658

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ