[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAN+gG=ESjWJDfHN4KmMAnLUko-wCa8r0VzQmFYqDme5Jg+FszA@mail.gmail.com>
Date: Thu, 30 May 2013 15:21:02 +0200
From: Benjamin Tissoires <benjamin.tissoires@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Henrik Rydberg <rydberg@...omail.se>,
Jiri Kosina <jkosina@...e.cz>,
Stephane Chatty <chatty@...c.fr>,
linux-input <linux-input@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] HID: multitouch: prevent memleak with the allocated name
Hi Andy,
On Wed, May 29, 2013 at 10:12 PM, Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Wed, May 29, 2013 at 11:45 AM, Benjamin Tissoires
> <benjamin.tissoires@...hat.com> wrote:
>> mt_free_input_name() was never called during .remove():
>> hid_hw_stop() removes the hid_input items in hdev->inputs, and so the
>> list is therefore empty after the call. In the end, we never free the
>> special names that has been allocated during .probe().
>>
>> Restore the original name before freeing it to avoid acessing already
>> freed pointer.
>>
>
>> I just spotted this one yesterday... My guess is that this way is safe (without
>> a locking mechanism to prevent accessing hi->input->name), but I'm not 100% sure.
>
> Hi Jiri, Benjamin.
>
> What do you think about patch I just sent?
Thanks for looking at this. My very first concern is that none of the
HID part has been devm-ized (this is on my todo-if-I-have-some-time
list). The input susbsystem has been devm-ized quite recently, so this
should be possible now.
So, basically, I honestly don't know if using part of devm mallocs in
hid-multitouch is safe and if it will work as expected. Maybe Jiri
will have a better idea.
I have a few comments on your patch if Jiri wants to include it.
>
> P.S. Benjamin, I re-used your commit message, I think you have no objections.
No objections :)
Cheers,
Benjamin
--
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