From patchwork Tue Sep 28 13:30:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 214922 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8SDWu2Q012319 for ; Tue, 28 Sep 2010 13:33:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754933Ab0I1Ncu (ORCPT ); Tue, 28 Sep 2010 09:32:50 -0400 Received: from smtp204.alice.it ([82.57.200.100]:44047 "EHLO smtp204.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754781Ab0I1Ncs (ORCPT ); Tue, 28 Sep 2010 09:32:48 -0400 Received: from jcn (82.60.124.103) by smtp204.alice.it (8.5.124.08) (authenticated as fospite@alice.it) id 4C88E33B017FE9D8; Tue, 28 Sep 2010 15:30:19 +0200 Date: Tue, 28 Sep 2010 15:30:11 +0200 From: Antonio Ospite To: Alan Ott Cc: Jiri Kosina , Stefan Achatz , Alexey Dobriyan , Tejun Heo , Alan Stern , Greg Kroah-Hartman , Marcel Holtmann , Stephane Chatty , Michael Poole , "David S. Miller" , Bastien Nocera , Eric Dumazet , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v4 1/2] HID: Add Support for Setting and Getting Feature Reports from hidraw Message-Id: <20100928153011.32750e5d.ospite@studenti.unina.it> In-Reply-To: <1281990059-3562-2-git-send-email-alan@signal11.us> References: <1281442367.12579.206.camel@localhost.localdomain> <1281990059-3562-2-git-send-email-alan@signal11.us> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Mime-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 28 Sep 2010 13:33:18 +0000 (UTC) diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 7df1310..3c040c6 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -322,6 +322,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, mutex_lock(&minors_lock); dev = hidraw_table[minor]; + if (!dev) { + ret = -ENODEV; + goto out; + } switch (cmd) { case HIDIOCGRDESCSIZE: @@ -412,6 +416,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, ret = -ENOTTY; } +out: mutex_unlock(&minors_lock); return ret; }