Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753591Ab3IWLuA (ORCPT ); Mon, 23 Sep 2013 07:50:00 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:6727 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753233Ab3IWLt6 convert rfc822-to-8bit (ORCPT ); Mon, 23 Sep 2013 07:49:58 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 23 Sep 2013 04:49:58 -0700 From: Manoj Chourasia To: Peter Wu , Jiri Kosina CC: "linux-kernel@vger.kernel.org" Date: Mon, 23 Sep 2013 17:19:58 +0530 Subject: RE: [PATCH] hidraw: correctly deallocate memory on device disconnect Thread-Topic: [PATCH] hidraw: correctly deallocate memory on device disconnect Thread-Index: Ac6dr4eYxkZARg7JRwqzhqat90mdewanENBw Message-ID: References: <1707995.vN5QlUzrT9@al> In-Reply-To: <1707995.vN5QlUzrT9@al> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1647 Lines: 37 Hi Jiri, What is the final proposed fix for this issue? Thanks -Manoj -----Original Message----- From: Peter Wu [mailto:lekensteyn@gmail.com] Sent: Tuesday, August 20, 2013 7:44 PM To: Jiri Kosina Cc: Manoj Chourasia; linux-kernel@vger.kernel.org Subject: Re: [PATCH] hidraw: correctly deallocate memory on device disconnect On Friday 09 August 2013 11:31:15 Jiri Kosina wrote: > On Mon, 22 Jul 2013, Manoj Chourasia wrote: > > This is mail is in regard to your commit for hidaw devices. We were > > seeing kernel crashes while connect and disconnect a hidraw device > > and we were hitting rb tree corruption in vmalloc and kernel was > > crashing because of null pointer de-reference. Later we figure out > > that was because the hid device disconnect is freeing memory which > > later got access by hidraw_read and hid_write. > > Now applied, thanks Manoj, thanks Peter. I just noticed an issue with this patch, after playing with some receivers I saw 8 hidraw device nodes. Every USB receiver creates two hidraw nodes, one for the receiver and one for the paired device. UPower seems to keep the file descriptor open which prevents the hidraw device from being removed. Shouldn't the implementation of hidraw be changed to separate open file descriptors from the actual HID devices? That should allow /dev/hidrawX devices to get removed whenever a HID device is gone. Regards, Peter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/