From patchwork Mon Nov 2 23:41:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 7538941 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5979ABEEA4 for ; Mon, 2 Nov 2015 23:41:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61421205E3 for ; Mon, 2 Nov 2015 23:41:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E79C2061A for ; Mon, 2 Nov 2015 23:41:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751568AbbKBXlv (ORCPT ); Mon, 2 Nov 2015 18:41:51 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34426 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbbKBXlu (ORCPT ); Mon, 2 Nov 2015 18:41:50 -0500 Received: by padec8 with SMTP id ec8so65386pad.1 for ; Mon, 02 Nov 2015 15:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=1UMbuEk2gd5bObswR7gCgkAbyELG5FiStJOveHhhhDE=; b=xHbvp9R69s52iOpGy5W4y2SZIgduki8oc3rAJc75r2579XGVAfaeXt+V5yBVNs39Oi zW+RAUzKlA14W7nBqU6KkcTGsNjdIrM8k9jFir0RzoirBBHtYsjSDa0l3FOwB2X3eQSG BxHM1QO1onn76KQ/sROPU1IdhQfPcPlbDxsZl/EelB4m7UNO5ndWhtxAQ+VDmF9U3/r/ kJD4LCe1AHUHKWlv7ktukNPHU07cRoU0ETWIq6Scb8cwMEdZAMixPB4Eg20YJMQ7zCzK kAH5LWvNkhQlJORO20NnIFGvE+9TuGgjHwTbGhRelvRfJCwizu8k8arBS+K8Ec/zdOWo QwZA== X-Received: by 10.69.14.68 with SMTP id fe4mr5051760pbd.166.1446507708136; Mon, 02 Nov 2015 15:41:48 -0800 (PST) Received: from wacom-arch2.corp.onewacom.com ([67.51.163.2]) by smtp.gmail.com with ESMTPSA id kw16sm14294885pab.34.2015.11.02.15.41.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Nov 2015 15:41:47 -0800 (PST) From: Jason Gerecke To: linux-input@vger.kernel.org Cc: Jiri Kosina , Ping Cheng , Aaron Skomra , Benjamin Tissoires , Jason Gerecke , Jason Gerecke Subject: [PATCH 1/3] HID: wacom: Call 'wacom_query_tablet_data' only after 'hid_hw_start' Date: Mon, 2 Nov 2015 15:41:11 -0800 Message-Id: <1446507673-4458-1-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.6.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When connecting the Cintiq Companion 2 as an external tablet (i.e., using it in "hybrid" mode) it has been seen to cause the kernel of the machine it is connected to to Oops. The cause has been traced to us attempting to switch the tablet's mode prior to actually starting HID device (resulting in the eventual dereference of the uninitialized control URB). This has not been an issue in the past since we've historically used 'hid_hw_raw_request' to perform the mode switch. HID_GENERIC devices, however use 'hid_hw_request' which assumes that 'hid_hw_start' has already been called. That we've not encountered problems beforehand seems to be entirely due to luck. Since the timing of the mode switch is not critical, we can simply move it to occur after the call to 'hid_hw_start'. Alternately, we could have potentially modified 'wacom_hid_set_device_mode' to use 'hid_hw_raw_reqest'. Signed-off-by: Jason Gerecke --- Jiri, Please mark this for stable since it possible other HID_GENERIC devices may trigger this Oops as well. Thanks, Jason drivers/hid/wacom_sys.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index b4de325..45656e8 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1778,9 +1778,6 @@ static int wacom_probe(struct hid_device *hdev, features->device_type |= WACOM_DEVICETYPE_PEN; } - /* Note that if query fails it is not a hard failure */ - wacom_query_tablet_data(hdev, features); - /* touch only Bamboo doesn't support pen */ if ((features->type == BAMBOO_TOUCH) && (features->device_type & WACOM_DEVICETYPE_PEN)) { @@ -1833,6 +1830,9 @@ static int wacom_probe(struct hid_device *hdev, goto fail_hw_start; } + /* Note that if query fails it is not a hard failure */ + wacom_query_tablet_data(hdev, features); + if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) error = hid_hw_open(hdev);