From nobody Fri Apr 3 06:28:33 2026 Received: from air.basealt.ru (air.basealt.ru [193.43.8.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4BC034107E; Tue, 24 Feb 2026 21:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.43.8.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771970120; cv=none; b=S11sZu5ZBvK+xbIH+a5Gs7cs14YFUFntvgTVgsAx5R/OyQtrA4hYhOlkIvSeq0DOWMxqeP3me/zThUN2UWoQl/cWL737f6xA7khLO4kqjfWuoDUXxCNR/rdyCkhXxZfXjvg+skHrqqg3yD7UzMGDxr/IePmq61hL5whLPb2VP/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771970120; c=relaxed/simple; bh=CNk9HIZSLGI29vt9avohT0zTyP+ESDDVU4T46jgcJBg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZOf7knZw3qvy31tUPg/nWG8zgkEM4C9901Lhaj/Ysec3DceIVxM3hNxUxOeAwk9aBp9D08MP+M0F36rzFN9ZF6VRmE0JwNIRcBZszaMps5Z/LOr/JT0zLwWKUvQO9ga5vrPNOOj6d3DmNAXQTx+dFwB0mNaJbTspz/8mpYR7HFQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org; spf=pass smtp.mailfrom=altlinux.org; arc=none smtp.client-ip=193.43.8.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=altlinux.org Received: from altlinux.ipa.basealt.ru (unknown [193.43.11.2]) (Authenticated sender: kovalevvv) by air.basealt.ru (Postfix) with ESMTPSA id 6843C2338D; Wed, 25 Feb 2026 00:55:10 +0300 (MSK) From: Vasiliy Kovalev To: Thomas Winischhofer , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, kovalev@altlinux.org Subject: [PATCH v2 2/2] USB: sisusbvga: Fix NULL pointer dereference in sisusb_read_mem_bulk Date: Wed, 25 Feb 2026 00:55:07 +0300 Message-Id: <20260224215507.1736020-3-kovalev@altlinux.org> X-Mailer: git-send-email 2.33.8 In-Reply-To: <20260224215507.1736020-1-kovalev@altlinux.org> References: <20260224215507.1736020-1-kovalev@altlinux.org> 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" sisusb_read_mem_bulk() accepts two buffer parameters: kernbuffer for kernel-space data and userbuffer for userspace data. The function's logic assumes at least one of them is non-NULL: if (userbuffer) { /* userspace path */ } else { /* kernel buffer path - dereferences kernbuffer */ swap32 =3D *((u32 *)kernbuffer); } However, when called from sisusb_read() with buffer =3D=3D NULL, both kernbuffer and userbuffer are NULL, causing immediate kernel panic: Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 3 UID: 0 PID: 370 Comm: sisusbvga-fops- Not tainted 6.19.0-next-2026= 0217 #1 RIP: 0010:sisusb_read_mem_bulk.constprop.0 (drivers/usb/misc/sisusbvga/si= susbvga.c:1171) Call Trace: __pfx_sisusb_read_mem_bulk.constprop.0 (drivers/usb/misc/sisusbvga/sisus= bvga.c:1092) sisusb_read (drivers/usb/misc/sisusbvga/sisusbvga.c:2396) vfs_read (fs/read_write.c:572) ksys_read (fs/read_write.c:718) do_syscall_64 (arch/x86/entry/syscall_64.c:94) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) RIP: 0033:0x7f335af3fefc Add parameter validation at the API level: reject the call with -EINVAL if both buffers are NULL. Found by Linux Verification Center (linuxtesting.org) with Svace. Tested with 'USB Gadget Tests'[1]: $ TEST=3Dsisusbvga-fops-svace-null-deref $ echo $TEST > tests/list.txt && make && sudo ./check.sh [1] Link: https://github.com/kovalev0/usb-gadget-tests Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Suggested-by: Fedor Pchelkin Cc: Signed-off-by: Vasiliy Kovalev --- v2: Move NULL check into sisusb_read_mem_bulk() and return -EINVAL (suggested by Fedor Pchelkin) v1: https://lore.kernel.org/all/20260218005523.1259725-3-kovalev@altlinux.o= rg/ --- drivers/usb/misc/sisusbvga/sisusbvga.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/misc/sisusbvga/sisusbvga.c b/drivers/usb/misc/sisu= sbvga/sisusbvga.c index 89d566d192aa..abda425199ee 100644 --- a/drivers/usb/misc/sisusbvga/sisusbvga.c +++ b/drivers/usb/misc/sisusbvga/sisusbvga.c @@ -1098,6 +1098,9 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_dat= a *sisusb, u32 addr, u16 swap16; u32 swap32; =20 + if (!kernbuffer && !userbuffer) + return -EINVAL; + (*bytes_read =3D 0); =20 length &=3D 0x00ffffff; --=20 2.50.1