linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gerecke <killertofu@gmail.com>
To: linux-input@vger.kernel.org
Cc: Jiri Kosina <jkosina@suse.cz>, Ping Cheng <pinglinux@gmail.com>,
	Aaron Skomra <skomra@gmail.com>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Jason Gerecke <killertofu@gmail.com>,
	Jason Gerecke <jason.gerecke@wacom.com>
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	[thread overview]
Message-ID: <1446507673-4458-1-git-send-email-killertofu@gmail.com> (raw)

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 <jason.gerecke@wacom.com>
---
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);
 
-- 
2.6.2


             reply	other threads:[~2015-11-02 23:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 23:41 Jason Gerecke [this message]
2015-11-02 23:41 ` [PATCH 2/3] HID: wacom: Remove useless conditions from 'wacom_query_tablet_data' Jason Gerecke
2015-11-03  1:40   ` Ping Cheng
2015-11-03 13:39     ` Jiri Kosina
2015-11-02 23:41 ` [PATCH 3/3] HID: wacom: Fix ABS_MISC reporting for Cintiq Companion 2 Jason Gerecke
  -- strict thread matches above, loose matches on Subject: below --
2015-11-03  1:36 [PATCH 1/3] HID: wacom: Call 'wacom_query_tablet_data' only after 'hid_hw_start' Ping Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446507673-4458-1-git-send-email-killertofu@gmail.com \
    --to=killertofu@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jason.gerecke@wacom.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=pinglinux@gmail.com \
    --cc=skomra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).