[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d120d5000607260619j6019d0ffh59fca33032cb5b6e@mail.gmail.com>
Date: Wed, 26 Jul 2006 09:19:24 -0400
From: "Dmitry Torokhov" <dmitry.torokhov@...il.com>
To: "Komal Shah" <komal_shah802003@...oo.com>
Cc: akpm@...l.org, juha.yrjola@...idboot.com, tony@...mide.com,
ext-timo.teras@...ia.com, r-woodruff2@...com,
linux-input@...ey.karlin.mff.cuni.cz, linux-kernel@...r.kernel.org,
dbrownell@...rs.sourceforge.net, kjh@...man.org
Subject: Re: [PATCH 1/2] OMAP: Add keypad driver
On 7/26/06, Komal Shah <komal_shah802003@...oo.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists