From nobody Sun May 24 18:41:10 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 123B92DD60E for ; Sat, 23 May 2026 15:06:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779548786; cv=none; b=uF56yeHfkIMxe0eKP8JTuC/1Bw9K/FbHvMkzpEPOTcX4V5VX8OSm5UhM97OhuOlAklQn0OFzG4LXtT4BiX8djIlJBpzi4WGrJPTpUGUj6dwQdpB03OFy7X3aiTfCRp+IC0S7i6Wphe5qZ/PTdxeXHRgQjG1QA3KSSi0Hx3fCWGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779548786; c=relaxed/simple; bh=MbrqTE+oeq+dgWO/Zw/DJywvgF7NBx4P8DJejtKwW3c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xbcp9Nkdq11y09knB4QTe/Is0qSrgK4ZcXuphTrDCtMdKPXbg/JUhW2cgg0fsa900LMtNyHFe0y2cgPzUsEAe+nrXE9GEJtwnywd9NxWeHLdlXF3R2gmXd5DKXlzJgm6jSNSSFbm5VkcsugIG2oLkvTOqlDl+aWZdhyQAhUZMv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ym/pDdOe; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ym/pDdOe" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2bcd730e090so67545165ad.2 for ; Sat, 23 May 2026 08:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779548784; x=1780153584; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aaop/FfELHjwH8IoIrpe22Er/LfhYbNrGdYNh4kScCs=; b=Ym/pDdOePH7xlFlWMo1xSw2pGY+MBXPQA2FyNsd3fq31gTrXla8rdWwMuW+M/Zxqon iSqzgaC5LlbhDXu1leSXCnNGrJO3Xhc8e0NIuS5JlfWf99Zxg1taKkr8tKsyw2M4oKrb GZY0lv06+c2t3qWGj+2cr4YQS5idJ6106V9lW957IFQ/CXzBnpwJSqxHcUFpQPFJWc25 mJSw256PYG0Di9WLSI5xDWgSMpDo6LlOgAU4mwNnIn45iNPEFU/vEnQiAoZhyvtNi89/ XDd8fXHod8aDWXOOZTRVYEpRKVSImbPUtj5avdfXIx20wsAOPHckAkSMiCcA2UYopEgN 5rvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779548784; x=1780153584; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aaop/FfELHjwH8IoIrpe22Er/LfhYbNrGdYNh4kScCs=; b=PHWSLtpUHmEV0fTokL+xZsbUIedrfCAJmU1LRrVxdsLqVwYNysC6BZdpiw+3W+mjvH 0PDGO/Dw6o6de+hvvzp1IDzwrp+/CzSKq5fgo4wIjKYorW0gPVSOwcg3zOunOc3R7WQc gdI97LQauRPcuSQ1BicgR8PBBm+58d2v5bpRrnb3N/PfI/eHwMaVS6RmUi+6IZBi22zc DwaocRRfjxS8ThtqOQ4FAMwwo+MIC8XTSClI9AUYmzrIayQ+EL4F8JCiatBNbn/UrQ3y Vi/P/mVAviyKBytTwWwZ7ey7cDim1wEtMdd2jOHHHEFu/Wy9x2r2ESma9tYHK07utiI9 B6jw== X-Forwarded-Encrypted: i=1; AFNElJ9YMIt6sMz8pGnUCpoI2JOXuCzr2EqReLO98fcrOp6jVG+FDnd21xzzWgMXJ235c3drox7FS0cbRE0VdUQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2svGYhDOMHXEC6+abqLpZZ6B7urv3slz04RJjFtZVQKa/coO/ JVShWSBWLP0rfMakzZQp+NnMOt9wOsGJmjFvuNPDdWpWiVjSqwQiVfeT X-Gm-Gg: Acq92OG81qCfp/Y9/rhX/faXcfB0XUGkAQiDYdzbBpC2XrvrG/H3ATu9ylKatEdvgi8 vQCVG2AqW8xvWJ8t4OxO5GRWMw0I5EsPVy1ZIA5D6o9M9vUQWv/qnUcYnQpqr3F/dhKopPyrnJN DIhclxP/vsf+3bIX3Fo/0r26qI+hr4yHgCDTVlqI4tMgcaIPnt2FFErHSSRjGsXxGpialfw+wn1 S29ae+t6W2qB1FLsIS3QJvh5lbnjkSmJYZxbRCHlU/ZOMEN+NaVATVQzzXTavkiPe4/zo0L6Nes 9ZwCHATeV2riirfRdBJfAGv5p+ngULdF1+aaW/mXxlFrcm6F1wI2SQziy1D8lVEvMNMs8GkJRBg Kj1hsAtY0NZXQ/aci5g7K5Cy4hREYxZJsEdiINM1jiWIX6cty3aRTJS7ZSrUQsV8gEmpSCoitM0 lgYd0MuAzuVFEuy6mKwz7jZhwqANZ0BTCwMqm57+JDvCtKCUvk X-Received: by 2002:a17:902:ce92:b0:2b9:7ad1:bf2b with SMTP id d9443c01a7336-2beb06924e5mr91047545ad.29.1779548784174; Sat, 23 May 2026 08:06:24 -0700 (PDT) Received: from jmoon ([118.220.156.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2beb5695a29sm45674735ad.11.2026.05.23.08.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 08:06:22 -0700 (PDT) From: Jinmo Yang To: Ping Cheng , Jason Gerecke , Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jinmo Yang Subject: [PATCH v2] HID: wacom: fix NULL pointer dereference in wacom_intuos_pad() Date: Sun, 24 May 2026 00:06:19 +0900 Message-ID: <20260523150619.615565-1-jinmo44.yang@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260523150101.611473-1-jinmo44.yang@gmail.com> References: <20260523150101.611473-1-jinmo44.yang@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" wacom_intuos_pad() dereferences wacom->pad_input without a NULL check. When a Wacom tablet is created via UHID with parameters that route through wacom_bpt_irq() -> wacom_intuos_irq() -> wacom_intuos_pad(), but probe did not allocate pad_input, the call to wacom_report_numbered_buttons() passes a NULL input_dev, causing a general protection fault in input_get_drvdata(). Add a NULL check for pad_input at the top of wacom_intuos_pad() to bail out early when the pad input device was not set up. The bug was found by syzkaller on linux-next 7.1.0-rc4 (next-20260522): Oops: general protection fault, probably for non-canonical address 0xdfff= fc0000000052 KASAN: null-ptr-deref in range [0x0000000000000290-0x0000000000000297] RIP: 0010:input_get_drvdata include/linux/input.h:390 [inline] RIP: 0010:wacom_report_numbered_buttons+0x37/0x210 drivers/hid/wacom_wac.= c:4210 Call Trace: wacom_intuos_pad drivers/hid/wacom_wac.c:643 [inline] wacom_intuos_irq+0x29a/0x32b0 drivers/hid/wacom_wac.c:1042 wacom_bpt_irq drivers/hid/wacom_wac.c:3275 [inline] wacom_wac_irq+0x12ed/0xaef0 drivers/hid/wacom_wac.c:3545 wacom_raw_event+0x677/0xa90 drivers/hid/wacom_sys.c:184 __hid_input_report.constprop.0+0x39a/0x4d0 drivers/hid/hid-core.c:2161 uhid_dev_input2 drivers/hid/uhid.c:618 [inline] uhid_char_write+0xa8a/0xfa0 drivers/hid/uhid.c:776 Also confirmed on a Pixel 9 Pro (Android 16, kernel 6.1.124) where it causes an immediate kernel panic and reboot via /dev/uhid without requiring root privileges: KP: Oops: Fatal exception: comm:wacom_27qhdt Reboot reason: 0xbaba - Kernel PANIC Reproducer (unprivileged): open("/dev/uhid", O_RDWR) write(fd, UHID_CREATE2{vendor=3D0x056a, product=3D0x0020}) write(fd, UHID_INPUT2{report_id=3D0x0c, size=3D10}) Fixes: c7f0522a1ad1 ("HID: wacom: Slim down wacom_intuos_pad processing") Signed-off-by: Jinmo Yang --- drivers/hid/wacom_wac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index da1f0ea85..251ddda3e 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -515,7 +515,6 @@ static int wacom_intuos_pad(struct wacom_wac *wacom) struct wacom_features *features =3D &wacom->features; unsigned char *data =3D wacom->data; struct input_dev *input =3D wacom->pad_input; - int i; int buttons =3D 0, nbuttons =3D features->numbered_buttons; int keys =3D 0, nkeys =3D 0; int ring1 =3D 0, ring2 =3D 0; @@ -523,6 +522,10 @@ static int wacom_intuos_pad(struct wacom_wac *wacom) bool prox =3D false; bool wrench =3D false, keyboard =3D false, mute_touch =3D false, menu =3D= false, info =3D false; + int i; + + if (!input) + return 0; =20 /* pad packets. Works as a second tool and is always in prox */ if (!(data[0] =3D=3D WACOM_REPORT_INTUOSPAD || data[0] =3D=3D WACOM_REPOR= T_INTUOS5PAD || --=20 2.53.0