From: Shuah Khan <shuah.kh@samsung.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
"len.brown@intel.com" <len.brown@intel.com>,
"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"shuahkhan@gmail.com" <shuahkhan@gmail.com>
Subject: Re: [PATCH] PM: Fix dev_pm_put_subsys_data() to not call kfree() while holding device power lock
Date: Mon, 6 May 2013 19:10:47 +0000 [thread overview]
Message-ID: <1367867448.2953.52.camel@lorien> (raw)
In-Reply-To: <1367848858.2953.1.camel@lorien>
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@ucw.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@samsung.com | (970) 672-0658
WARNING: multiple messages have this Message-ID (diff)
From: Shuah Khan <shuah.kh@samsung.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
"len.brown@intel.com" <len.brown@intel.com>,
"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"shuahkhan@gmail.com" <shuahkhan@gmail.com>
Subject: Re: [PATCH] PM: Fix dev_pm_put_subsys_data() to not call kfree() while holding device power lock
Date: Mon, 6 May 2013 19:10:47 +0000 [thread overview]
Message-ID: <1367867448.2953.52.camel@lorien> (raw)
In-Reply-To: <1367848858.2953.1.camel@lorien>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1399 bytes --]
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@ucw.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@samsung.com | (970) 672-0658
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2013-05-06 19:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 20:46 [PATCH] PM: Fix dev_pm_put_subsys_data() to not call kfree() while holding device power lock Shuah Khan
2013-05-03 20:46 ` Shuah Khan
2013-05-04 12:51 ` Pavel Machek
2013-05-06 12:07 ` Rafael J. Wysocki
2013-05-06 12:09 ` Pavel Machek
2013-05-06 14:01 ` Shuah Khan
2013-05-06 14:01 ` Shuah Khan
2013-05-06 19:10 ` Shuah Khan [this message]
2013-05-06 19:10 ` Shuah Khan
2013-05-06 19:04 ` [PATCH v2] " Shuah Khan
2013-05-06 19:04 ` Shuah Khan
2013-05-06 19:41 ` gregkh
2013-05-06 19:46 ` Shuah Khan
2013-05-06 19:46 ` Shuah Khan
2013-05-06 19:56 ` Rafael J. Wysocki
2013-05-06 20:33 ` gregkh
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=1367867448.2953.52.camel@lorien \
--to=shuah.kh@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@sisk.pl \
--cc=shuahkhan@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.