From: Marek Vasut <marex@denx.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: ACER: Add support for accelerometer sensor
Date: Wed, 27 Jun 2012 18:22:23 +0200 [thread overview]
Message-ID: <201206271822.23987.marex@denx.de> (raw)
In-Reply-To: <20120627153447.GH3007@mwanda>
Dear Dan Carpenter,
> On Wed, Jun 27, 2012 at 05:01:23PM +0200, Marek Vasut wrote:
> > Dear Dan Carpenter,
> >
> > > On Wed, Jun 27, 2012 at 03:59:16PM +0200, Marek Vasut wrote:
> > > > Dear Dan Carpenter,
> > > >
> > > > > On Wed, Jun 27, 2012 at 03:32:12PM +0200, Marek Vasut wrote:
> > > > > > Dear Dan Carpenter,
> > > > > >
> > > > > > > Hello Marek Vasut,
> > > > > > >
> > > > > > > The patch 6ae3a0876185: "ACER: Add support for accelerometer
> > > > > > > sensor" from Jun 1, 2012, leads to the following Smatch
> > > > > > > warning: drivers/platform/x86/acer-wmi.c:1886
> > > > > > > acer_wmi_accel_destroy()
> > > > > > >
> > > > > > > error: don't call input_free_device() after
> > > > > > > input_unregister_device()
> > > > > > >
> > > > > > > drivers/platform/x86/acer-wmi.c
> > > > > > >
> > > > > > > 1883 static void acer_wmi_accel_destroy(void)
> > > > > > > 1884 {
> > > > > > > 1885 input_unregister_device(acer_wmi_accel_dev);
> > > > > > > 1886 input_free_device(acer_wmi_accel_dev);
> > > > > > > 1887 }
> > > > > > >
> > > > > > > It is a double free.
> > > > > >
> > > > > > I see, understood ... shall I submit subsequent patch?
> > > > >
> > > > > Yes, please. Could you give me a:
> > > > >
> > > > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > >
> > > > Looking through input_unregister_device(), that call doesn't free the
> > > > structure. Actually, many drivers call explicitly kfree() on it.
> > > >
> > > > Where do you see the double_free() ?
> > >
> > > It's been a while since I looked at this code...
> > >
> > > This is described in the comments for input_unregister_device().
> > > It's a refcounted thing. It is freed when the last reference is
> > > dropped.
> >
> > So kfree() eg. in here drivers/input/joystick/magellan.c is also wrong?
>
> You are talking about this:?
>
> input_unregister_device(magellan->dev);
> kfree(magellan);
>
> The kfree() is fine. It's just the ->dev pointer that you are not
> allowed to touch again after the unregister.
Ah, now it makes sense. Thanks for explaining :)
> regards,
> dan carpenter
Best regards,
Marek Vasut
prev parent reply other threads:[~2012-06-27 16:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-27 13:15 ACER: Add support for accelerometer sensor Dan Carpenter
2012-06-27 13:32 ` Marek Vasut
2012-06-27 13:43 ` Dan Carpenter
2012-06-27 13:59 ` Marek Vasut
2012-06-27 14:19 ` Dan Carpenter
2012-06-27 15:01 ` Marek Vasut
2012-06-27 15:34 ` Dan Carpenter
2012-06-27 16:22 ` Marek Vasut [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=201206271822.23987.marex@denx.de \
--to=marex@denx.de \
--cc=dan.carpenter@oracle.com \
--cc=platform-driver-x86@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 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.