Allow the __rcu-annotated wacom_wac->shared->touch_input to be accessed inside an RCU read-side critical section by using rcu_dereference(). Cc: stable@vger.kernel.org Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202610180015.KsRqmoTE-lkp@intel.com/ Fixes: 9183319a5ba4 ("Input: wacom - Setup SW_MUTE_DEVICE according to the order of input registration") Suggested-by: Dmitry Torokhov Signed-off-by: Ping Cheng --- The patch is based on for-7.4/wacom branch --- drivers/hid/wacom_wac.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index cf459c16b39a..ef6480338b2c 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -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; -- 2.56.0