LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] HID: wacom: check for wacom->shared before following the pointer
@ 2015-03-05 22:36 Benjamin Tissoires
2015-03-06 1:54 ` Ping Cheng
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2015-03-05 22:36 UTC (permalink / raw)
To: Jiri Kosina, Ping Cheng, Jason Gerecke; +Cc: linux-input, linux-kernel
486b908 (HID: wacom: do not send pen events before touch is up/forced out)
introduces a kernel oops when plugging a tablet without touch.
wacom->shared is null for these devices so this leads to a null pointer
exception.
Change the condition to make it clear that what we need is wacom->shared
not NULL.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
Hi Jiri,
this one should be pulled in 4.0. Or we will have surprised users :)
Cheers,
Benjamin
drivers/hid/wacom_wac.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index ff9a7ab..9739a4c 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -564,11 +564,12 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
(features->type == CINTIQ && !(data[1] & 0x40)))
return 1;
- if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
+ if (wacom->shared) {
wacom->shared->stylus_in_proximity = true;
- if (wacom->shared->touch_down)
- return 1;
+ if (wacom->shared->touch_down)
+ return 1;
+ }
/* in Range while exiting */
if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: wacom: check for wacom->shared before following the pointer
2015-03-05 22:36 [PATCH] HID: wacom: check for wacom->shared before following the pointer Benjamin Tissoires
@ 2015-03-06 1:54 ` Ping Cheng
2015-03-06 19:10 ` Benjamin Tissoires
0 siblings, 1 reply; 3+ messages in thread
From: Ping Cheng @ 2015-03-06 1:54 UTC (permalink / raw)
To: Benjamin Tissoires; +Cc: Jiri Kosina, Jason Gerecke, linux-input, linux-kernel
On Thu, Mar 5, 2015 at 2:36 PM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
> 486b908 (HID: wacom: do not send pen events before touch is up/forced out)
> introduces a kernel oops when plugging a tablet without touch.
Thank you for the catch. You must have tried an Intuos 4 or earlier
model. WACOM_QUIRK_MULTI_INPUT is only set for I5 and later.
> wacom->shared is null for these devices so this leads to a null pointer
> exception.
The root cause is "if (wacom->shared->touch_down)" was added outside
of "if (features->quirks & WACOM_QUIRK_MULTI_INPUT)". A consistent fix
would be:
----
@@ -555,8 +555,11 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
(features->type == CINTIQ && !(data[1] & 0x40)))
return 1;
- if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
+ if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
wacom->shared->stylus_in_proximity = true;
+ if (wacom->shared->touch_down)
+ return 1;
+ }
/* in Range while exiting */
if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
----
Cheers,
Ping
> Change the condition to make it clear that what we need is wacom->shared
> not NULL.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> Hi Jiri,
>
> this one should be pulled in 4.0. Or we will have surprised users :)
>
> Cheers,
> Benjamin
>
> drivers/hid/wacom_wac.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index ff9a7ab..9739a4c 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -564,11 +564,12 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
> (features->type == CINTIQ && !(data[1] & 0x40)))
> return 1;
>
> - if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
> + if (wacom->shared) {
> wacom->shared->stylus_in_proximity = true;
>
> - if (wacom->shared->touch_down)
> - return 1;
> + if (wacom->shared->touch_down)
> + return 1;
> + }
>
> /* in Range while exiting */
> if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: wacom: check for wacom->shared before following the pointer
2015-03-06 1:54 ` Ping Cheng
@ 2015-03-06 19:10 ` Benjamin Tissoires
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2015-03-06 19:10 UTC (permalink / raw)
To: Ping Cheng
Cc: Benjamin Tissoires, Jiri Kosina, Jason Gerecke, linux-input,
linux-kernel
On Thu, Mar 5, 2015 at 8:54 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> On Thu, Mar 5, 2015 at 2:36 PM, Benjamin Tissoires
> <benjamin.tissoires@redhat.com> wrote:
>> 486b908 (HID: wacom: do not send pen events before touch is up/forced out)
>> introduces a kernel oops when plugging a tablet without touch.
>
> Thank you for the catch. You must have tried an Intuos 4 or earlier
> model. WACOM_QUIRK_MULTI_INPUT is only set for I5 and later.
>
>> wacom->shared is null for these devices so this leads to a null pointer
>> exception.
>
> The root cause is "if (wacom->shared->touch_down)" was added outside
> of "if (features->quirks & WACOM_QUIRK_MULTI_INPUT)". A consistent fix
> would be:
> ----
> @@ -555,8 +555,11 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
> (features->type == CINTIQ && !(data[1] & 0x40)))
> return 1;
>
> - if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
> + if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
> wacom->shared->stylus_in_proximity = true;
> + if (wacom->shared->touch_down)
> + return 1;
> + }
Yes, no, maybe :)
that was my first approach. But then I switched to "if
(wacom->shared)" to actually remember the hackers that wacom->shared
is not always valid and that we should not assume it is.
I don't have any preference except that this needs to be fixed in 4.0 final.
Jiri, do you prefer that I resend the patch? or do you amend it? or do
you keep my first version?
Cheers,
Benjamin
>
> /* in Range while exiting */
> if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
> ----
>
> Cheers,
>
> Ping
>
>> Change the condition to make it clear that what we need is wacom->shared
>> not NULL.
>>
>> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>> ---
>>
>> Hi Jiri,
>>
>> this one should be pulled in 4.0. Or we will have surprised users :)
>>
>> Cheers,
>> Benjamin
>>
>> drivers/hid/wacom_wac.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
>> index ff9a7ab..9739a4c 100644
>> --- a/drivers/hid/wacom_wac.c
>> +++ b/drivers/hid/wacom_wac.c
>> @@ -564,11 +564,12 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
>> (features->type == CINTIQ && !(data[1] & 0x40)))
>> return 1;
>>
>> - if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
>> + if (wacom->shared) {
>> wacom->shared->stylus_in_proximity = true;
>>
>> - if (wacom->shared->touch_down)
>> - return 1;
>> + if (wacom->shared->touch_down)
>> + return 1;
>> + }
>>
>> /* in Range while exiting */
>> if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
>> --
>> 2.1.0
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-06 19:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05 22:36 [PATCH] HID: wacom: check for wacom->shared before following the pointer Benjamin Tissoires
2015-03-06 1:54 ` Ping Cheng
2015-03-06 19:10 ` Benjamin Tissoires
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).