All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Manuel Ebner" <manuelebnerli@mailbox.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] drivers/hid: fix brackets in comments
Date: Sat, 21 Nov 2026 09:02:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-226852@kernel.org> (raw)
In-Reply-To: <20261121085628.1430330-2-manuelebnerli@mailbox.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] HID: wacom: null pointer dereference in wacom_intuos_irq()
  [1]
--

commit fe38a9c78cbb9c5469865293835934f3d81cedd9
Author: Manuel Ebner <manuelebnerli@mailbox.org>

drivers/hid: fix brackets in comments

This commit removes unmatched closing parentheses and adds a missing
opening parenthesis in comments in the AMD SFH and Wacom HID drivers.

> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 361738bb87253..0273299454b74 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -558,7 +558,7 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)
>  		 * physically implemented as a touchstrip. Each button
>  		 * is approximately 3 bits wide with a 2 bit spacing.
>  		 * The raw touchstrip bits are stored at:
> -		 *    ((data[3] & 0x1f) << 8) | data[4])
> +		 *    (((data[3] & 0x1f) << 8) | data[4])
>  		 */
>  		nkeys = 3;
>  		keys = ((data[3] & 0x1C) ? 1<<2 : 0) |

[Severity: Critical]
This problem wasn't introduced by this patch, but can wacom_intuos_pad()
and wacom_intuos_irq() dereference a NULL wacom->pad_input or
wacom->pen_input pointer [1]?

When a device interface lacks pen or pad capabilities, the driver does not
allocate the corresponding input_dev, leaving wacom->pen_input or
wacom->pad_input NULL.  If a report arrives on that interface,
wacom_intuos_irq() dereferences wacom->pen_input in dev_dbg() on unknown
report IDs, or dispatches recognized reports to wacom_intuos_pad() and
wacom_intuos_general(), which report events through wacom->pad_input and
wacom->pen_input without checking whether they were allocated:

drivers/hid/wacom_wac.c:wacom_intuos_irq() {
	unsigned char *data = wacom->data;
	struct input_dev *input = wacom->pen_input;
	int result;

	if (data[0] != WACOM_REPORT_PENABLED &&
	    ...
	    data[0] != WACOM_REPORT_INTUOS5PAD) {
		dev_dbg(input->dev.parent,
			"%s: received unknown report #%d\n", __func__, data[0]);
		return 0;
	}

	/* process pad events */
	result = wacom_intuos_pad(wacom);
	if (result)
		return result;
    ...
	/* process general packets */
	result = wacom_intuos_general(wacom);
    ...
}

Receiving a crafted report on an interface without the corresponding
input_dev triggers a NULL pointer dereference and crashes the kernel.

[1] https://sashiko.dev/#/bug/linux-4a2bc3f1-bd42-421b-b885-0a54a4969fdf

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261121085628.1430330-2-manuelebnerli@mailbox.org?part=1

      reply	other threads:[~2026-11-21  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  8:56 [PATCH] drivers/hid: fix brackets in comments Manuel Ebner
2026-11-21  9:02 ` sashiko-bot [this message]

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=sashiko-outbox-226852@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=manuelebnerli@mailbox.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.