mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: "Komal Shah" <komal_shah802003@yahoo.com>
Cc: akpm@osdl.org, juha.yrjola@solidboot.com, tony@atomide.com,
	ext-timo.teras@nokia.com, r-woodruff2@ti.com,
	linux-input@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org, dbrownell@users.sourceforge.net,
	kjh@hilman.org
Subject: Re: [PATCH 1/2] OMAP: Add keypad driver
Date: Wed, 26 Jul 2006 09:19:24 -0400	[thread overview]
Message-ID: <d120d5000607260619j6019d0ffh59fca33032cb5b6e@mail.gmail.com> (raw)
In-Reply-To: <1153915433.13733.266905718@webmail.messagingengine.com>

On 7/26/06, Komal Shah <komal_shah802003@yahoo.com> wrote:
> Andrew/Tony/Richard/Dmitry,
>
> This is a revised patch as per the review comments from the Dmitry
> on thread:
>
> http://lkml.org/lkml/2006/7/25/279
>
> Please review it and give me the Ack if looks ok.
>

Komal,

You may not call input_free_device() after calling
input_unregister_device() in the error path because unregister will
drop the reference to the device and since it was the last (and only)
reference it will free the device. input_free_device() coming after
that will try to free already freed memory.

You have several options:
1. Have separate error paths for before and after input_register_device()
2. Set input_dev = NULL after calling input_unregister_device() -
input-free-device() handles NULLs just fine.
3. Take an extra reference with input_get_device() before calling
input_unregister_device(). This way the device won't actually be freed
until you call input_free_device() later.

-- 
Dmitry

      reply	other threads:[~2006-07-26 13:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-26 12:03 Komal Shah
2006-07-26 13:19 ` Dmitry Torokhov [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=d120d5000607260619j6019d0ffh59fca33032cb5b6e@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=akpm@osdl.org \
    --cc=dbrownell@users.sourceforge.net \
    --cc=ext-timo.teras@nokia.com \
    --cc=juha.yrjola@solidboot.com \
    --cc=kjh@hilman.org \
    --cc=komal_shah802003@yahoo.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=r-woodruff2@ti.com \
    --cc=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®