From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jiri Kosina <jkosina@suse.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
sre@kernel.org, linux-pm@vger.kernel.org,
"H.J. Lu" <hjl.tools@gmail.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind
Date: Wed, 29 Jul 2015 10:46:19 -0700 [thread overview]
Message-ID: <20150729174619.GC23178@dtor-ws> (raw)
In-Reply-To: <alpine.LNX.2.00.1507291506500.925@pobox.suse.cz>
On Wed, Jul 29, 2015 at 03:07:04PM +0200, Jiri Kosina wrote:
> On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote:
>
> > During unbinding the driver was dereferencing a pointer to memory
> > already freed by power_supply_unregister().
> >
> > Driver was freeing its internal description of battery through pointers
> > stored in power_supply structure. However, because the core owns the
> > power supply instance, after calling power_supply_unregister() the
> > driver cannot access these members.
> >
> > Fix this by using resource-managed allocations so internal data will be
> > freed by pointers stored in resource-managed core.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Reported-by: H.J. Lu <hjl.tools@gmail.com>
> > Fixes: 297d716f6260 ("power_supply: Change ownership from driver to core")
> > Cc: <stable@vger.kernel.org>
>
> Applied to for-4.2/upstream-fixes, thanks.
Wait, what guarantees do we have that this is only called in probe()
paths? Don't we allow hid_hw_start() be deferred to open() calls?
In general we need to be careful with devm* conversions in core code.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2015-07-29 17:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 0:16 [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind Krzysztof Kozlowski
2015-07-29 13:07 ` Jiri Kosina
2015-07-29 17:46 ` Dmitry Torokhov [this message]
2015-07-29 23:42 ` Krzysztof Kozlowski
2015-07-30 0:10 ` Dmitry Torokhov
2015-08-01 12:11 ` Jiri Kosina
2015-08-02 5:09 ` Krzysztof Kozlowski
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=20150729174619.GC23178@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=hjl.tools@gmail.com \
--cc=jkosina@suse.com \
--cc=k.kozlowski@samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@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;
as well as URLs for NNTP newsgroup(s).