Skip to contentSkip to conversation

HID: wacom: Access shared touch input by rcu_dereference()

PATCH Applied Ping Cheng 3 participants 3 messages Nov 4 – Nov 19

Subsystems (3)
lore
Share & tools
lore

Ping Cheng

author
#0 lore raw

PATCH 1/1 HID: wacom: Access shared touch input by rcu_dereference()

Allow the __rcu-annotated wacom_wac->shared->touch_input to be accessed inside an RCU read-side critical section by using rcu_dereference().

Fixes 9183319a5ba4 ("Input: wacom - Setup SW_MUTE_DEVICE according to the order of input registration")

---
The patch is based on for-7.4/wacom branch

---
 drivers/hid/wacom_wac.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/hid/wacom_wac.c +7 -6
index cf459c16b39a..ef6480338b2c 100644
@@ -4414,7 +4414,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
 		break;
 
 	case HID_GENERIC:
-		if (wacom_wac->shared) {
+		if (wacom_wac->shared && wacom_wac->has_mute_touch_switch) {
 			/*
 			 * The setup of touch switch capability can only be done
 			 * here for those devices, such as Cintiq Pro 13 and 16,
@@ -4425,11 +4425,12 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
 			 * stylus first or touch first. This path covers the touch
 			 * input first case.
 			 */
-			if (wacom_wac->has_mute_touch_switch &&
-			    wacom_wac->shared->touch_input) {
-				input_set_capability(wacom_wac->shared->touch_input,
-				    EV_SW, SW_MUTE_DEVICE);
-			}
+                        struct input_dev *touch_input;
+
+                        guard(rcu)();
+                        touch_input = rcu_dereference(wacom_wac->shared->touch_input);
+			if (touch_input)
+				input_set_capability(touch_input, EV_SW, SW_MUTE_DEVICE);
 		}
 		break;
 
Signature · 1 line
2.56.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ping Cheng

Allow the __rcu-annotated wacom_wac->shared->touch_input to be accessed inside an RCU read-side critical section by using rcu_dereference().

Fixes 9183319a5ba4 ("Input: wacom - Setup SW_MUTE_DEVICE according to the order of input registration")

Thanks.

Signature · 1 line
Dmitry
maintainer Applied
#2 lore raw
In reply to Ping Cheng
Quoted 9 lines · Ping Cheng

Allow the __rcu-annotated wacom_wac->shared->touch_input to be accessed inside an RCU read-side critical section by using rcu_dereference().

Fixes 9183319a5ba4 ("Input: wacom - Setup SW_MUTE_DEVICE according to the order of input registration")

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs