From: Dan Carpenter <dan.carpenter@oracle.com>
To: Marek Vasut <marex@denx.de>
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: ACER: Add support for accelerometer sensor
Date: Wed, 27 Jun 2012 18:34:47 +0300 [thread overview]
Message-ID: <20120627153447.GH3007@mwanda> (raw)
In-Reply-To: <201206271701.23890.marex@denx.de>
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.
regards,
dan carpenter
next prev parent reply other threads:[~2012-06-27 15:35 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 [this message]
2012-06-27 16:22 ` Marek Vasut
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=20120627153447.GH3007@mwanda \
--to=dan.carpenter@oracle.com \
--cc=marex@denx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox