Re: [PATCH] HID: wacom: check input_dev->absinfo in wacom_bpt3_touch_msg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 May 2021, Yiyuan GUO wrote:

> The function wacom_bpt3_touch_msg calls input_abs_get_res(input,
> ABS_MT_POSITION_X) to obtain x_res, which may equal to 0 if
> input->absinfo is NULL. Since x_res is used as a divisor, this
> may lead to divide by zero problem.
> 
> Signed-off-by: Yiyuan GUO <yguoaz@xxxxxxxxxx>
> ---
>  drivers/hid/wacom_wac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 81d7d12bc..a5a6fb8bc 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -2892,7 +2892,7 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
>  	bool touch = data[1] & 0x80;
>  	int slot = input_mt_get_slot_by_key(input, data[0]);
>  
> -	if (slot < 0)
> +	if (slot < 0 || !input->absinfo)
>  		return;
>  
>  	touch = touch && report_touch_events(wacom);

CCing Wacom driver maintainers in order to get their ack.

-- 
Jiri Kosina
SUSE Labs




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux