From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
Matthew Garrett <matthew.garrett@nebula.com>,
stable@vger.kernel.org
Subject: Re: [RFT PATCH v2 2/2] compal-laptop: Check return value of power_supply_register
Date: Fri, 20 Feb 2015 14:12:02 +0100 [thread overview]
Message-ID: <1424437922.1870.1.camel@AMDC1943> (raw)
In-Reply-To: <1424437480-22364-2-git-send-email-k.kozlowski@samsung.com>
On pią, 2015-02-20 at 14:04 +0100, Krzysztof Kozlowski wrote:
> The return value of power_supply_register() call was not checked and
> even on error probe() function returned 0. If registering failed then
> during unbind the driver tried to unregister power supply which was not
> actually registered.
>
> This could lead to memory corruption because power_supply_unregister()
> unconditionally cleans up given power supply.
>
> Fix this by checking return status of power_supply_register() call. In
> case of failure, clean up sysfs entries and fail the probe.
>
(...)
>
> @@ -1072,6 +1074,7 @@ static int compal_remove(struct platform_device *pdev)
>
> data = platform_get_drvdata(pdev);
> power_supply_unregister(&data->psy);
> + /* FIXME: missing hwmon_device_unregister() */
>
> sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
Crap, I forgot to remove the FIXME note. It is no longer needed because
patch 1 fixes this.
I'll resend. Sorry for the noise.
prev parent reply other threads:[~2015-02-20 13:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-20 13:04 [RFT PATCH v2 1/2] compal-laptop: Fix leaking hwmon device Krzysztof Kozlowski
2015-02-20 13:04 ` [RFT PATCH v2 2/2] compal-laptop: Check return value of power_supply_register Krzysztof Kozlowski
2015-02-20 13:12 ` Krzysztof Kozlowski [this message]
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=1424437922.1870.1.camel@AMDC1943 \
--to=k.kozlowski@samsung.com \
--cc=cezary.jackiewicz@gmail.com \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=matthew.garrett@nebula.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@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