From patchwork Tue Mar 8 02:13:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafi Rubin X-Patchwork-Id: 617101 X-Patchwork-Delegate: jikos@jikos.cz 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 p282BiRk007719 for ; Tue, 8 Mar 2011 02:13:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754984Ab1CHCNz (ORCPT ); Mon, 7 Mar 2011 21:13:55 -0500 Received: from fox.seas.upenn.edu ([158.130.68.12]:46191 "EHLO fox.seas.upenn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750754Ab1CHCNy (ORCPT ); Mon, 7 Mar 2011 21:13:54 -0500 Received: from hex.seas.upenn.edu (hex.seas.upenn.edu [158.130.62.166]) (authenticated bits=0) by fox.seas.upenn.edu (8.14.3/8.14.3) with ESMTP id p282DXuK018813 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 7 Mar 2011 21:13:37 -0500 From: Rafi Rubin To: jkosina@suse.cz, linux-input@vger.kernel.org Cc: rydberg@euromail.se, chatty@enac.fr, peter.hutterer@who-t.net, Rafi Rubin Subject: [PATCH 1/2] HID: ntrig don't dereference unclaimed hidinput Date: Mon, 7 Mar 2011 21:13:27 -0500 Message-Id: <1299550408-11457-1-git-send-email-rafi@seas.upenn.edu> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15, 1.0.148, 0.0.0000 definitions=2011-03-08_01:2011-03-08, 2011-03-08, 1970-01-01 signatures=0 X-Proofpoint-Spam-Reason: safe 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 08 Mar 2011 02:14:04 +0000 (UTC) diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index beb4034..56a88d9 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c @@ -539,8 +539,14 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, static int ntrig_event (struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) { - struct input_dev *input = field->hidinput->input; struct ntrig_data *nd = hid_get_drvdata(hid); + struct input_dev *input; + + /* Skip processing if not a claimed input */ + if (!(hid->claimed & HID_CLAIMED_INPUT)) + goto not_claimed_input; + + input = field->hidinput->input; /* No special handling needed for the pen */ if (field->application == HID_DG_PEN) @@ -810,6 +816,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, } } +not_claimed_input: + /* we have handled the hidinput part, now remains hiddev */ if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_hid_event) hid->hiddev_hid_event(hid, field, usage, value);