From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796038366; b=edyzBQBgsYQRenc4nm4Znb8eqZMVqVu0E6ho/ic9i8X76OncOsO/8q64caOvn5yRF/j+ 7mKUjBLiDrsjzW5npNwmjO5owzoowHXHqzI4gntV/a2ax72wenL2VMiTKD2z76ZD2B02M rZdSpnQL+Y6NuxjhL1Rj/Nk300WJXZmME7oQj23Jvz25OoISiz+Y9sI1IEHCs41rZRLmT peHKAX+SI4e1QjEON+rWdEM9cgOt+5tyq8i3/FW04mIWLqyezgbv9OE3AfEZd0dpzIfMd tUQBAjVDgff+lPk3NUdty539Smy8ez+TwKb4ItXQfRS79Pn2ThZEl/oaUrCx+LcGjog== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796038366; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=dzBgHnuTIDBFeI/1PDg9b68DjGgjpTCt5jWuGt+njkg=; b=EagP0Kv3SS4vIknOW/AgoYAc60Ha++OBLS5NCUNORZsr6Tvb2yjZ55ofn4ivo9VWpPjB vyTviFHXEinMQBPtIAnKtKqPi6xmwrNQ3+ZGtraPE41kO71FMThmX0zTB/2CbuH1LqfKD t0bgMSmrREhvjUhIFVhf+V5TqGoyuV38osZ1HGf+rDhwWSbFyQ/Q5eHNW3x5H9P7JaWK2 wQyQPDScDnohk1qmVB8etD7ruOGNYM1zVeCplJZk0HlO69Prjy4QHZceXU9UTZM8mOX1r F0C1ivTReSAKi08Cx4P3Zin1BZjyUuNHDeEvD1h8vnUTJKqzIhlyvxWGhI73XvbTKbA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=evUmjiIO; arc=none smtp.remote-ip=209.85.210.181 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E4B1606A682 for ; Mon, 30 Nov 2026 11:32:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7E4B1606A682 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.a=rsa-sha256 header.s=20260707 header.b=evUmjiIO Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-8a0880a46e7so6061870b3a.1 for ; Mon, 30 Nov 2026 03:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796038362; x=1796643162; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=dzBgHnuTIDBFeI/1PDg9b68DjGgjpTCt5jWuGt+njkg=; b=evUmjiIODhlV4Gb6tKfSbGaFrT4j+NJuZs6Cis/udNbB8fesW1I1JwKRqwNGuJsCel ZqY7fxMphW9Rd/fa/zorGox5AR92P9nsMDILvZTRYHNWLDuWvgCNO4Zos0TjWkV5GqDy ngveTq0lHvHhtHq5JTY74IFAu1HGGzJZaHbB5bnmFB3aovrPXWQp+OwtF7NcX/hQaSQp vlN3aNHlYRdmMe0sfWrnQJd+q7e6vYPpj5c94vRpDAP96vWw6GS1UbU5ZK3DkpiEB82Q jXvZ1oKZGpKaaT16RCLttX6AnzOIJT9CJWcEiB0zikDvM4EB5nR4gUFr6IZh0HjpQzLi Mk3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796038362; x=1796643162; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dzBgHnuTIDBFeI/1PDg9b68DjGgjpTCt5jWuGt+njkg=; b=przo1WTlsJ3KJ1Li4ws7PbgUekEeSWlNsLFg9MxBAwh4ZMEu6OW6jiQp9bcJSe6VK5 qgImkT7yuYaE09Gl4kLWNd9+PyCGAsnK46N2YpQEH9ot3zcnqEoVjIV8lWayhM2KVqr+ ABvprx6/PYgV6nbTnqZycuLtLR1LfHuBch95DV65pHJdddG/R15HEVHpIBxDGMr1FqD1 l1TIDK+qIoR7Jzu1/O+4AxvD1yIfSFqh+X6pkRX+M/iazW7tk0dN9S/BV/L78+0jiG4H KCyzYRjTJYyaoeSti9GN1Yxw9RiW01tfzRmqdvAcH6kVpyUspOJEM39ItKnEaSqhqJjY MCQg== X-Gm-Message-State: APuU4Z/faokLwAZ+Y+g5527JiAroEzK1FtpqqlTj/jgOLy1uaPp+qBxi xoRUPoWDcM2g5VZHggskXEBoU8z3jpzmPtLUkyA11/jckhBaGtqn+jATRr665A== X-Gm-Gg: AZFdTZeM7skWXzaRCsVaHRRehkve2W6cAj08DsY7/lL7/RAPIRg9SoD5X7yhNrxOdDt GkfUZscZgW7aTXq1B34/+l4asW3+5DU7AMCfqE8iq85EqlceNI8C0C1WUyERSrroAmM5y6Z+OJr YItSLIcHWiemsrQpozLLskWO1z558FvNcIDw6zoGA1kK5tL7mfFdog8VAdhndi/PddwsvjlvB0K ZgH3zoh5t8OiCtpgLxUAbIuNNthlYyS6s7KEIvu9t8Msxz7wJz8GWK04FZySsxh5/zaF3XcBlrc 3EdCQIZxU1n93ZLXBDizVq0yrvvW6YhRYnMCzszvP9ojw0lOvaINACDnG0plx2VpzSULXgmKhSW 1GRBjUGA2XjZCcz1iv2N7ZdwKAFVp/lbN8ZgSztNz81xWMuIV0vp3LioZkC6ZTzP2kSIEYEThXC v/obGKBq4XwpGzXRD4yc9pHIRCGCEDL9kSY+Eqd1fxAY+2GsPMYjZxUziQXCejJDYbA/XJLvani 2pfYHI+medmUhCrnv/+sQ68HerHxTd5DYh+RdPHf5Jb8TyftNNCDQ7c3gpQhR9GnL1pdpnKfnyb ja2EDwGIPCMY9Tlowz2LNbnT0c6bHCIVTfiI19VaQQK9NVnWIlQl4U0= X-Received: by 2002:a05:6a00:3003:b0:8a0:550f:bb43 with SMTP id d2e1a72fcca58-8c7ddfb0281mr23202110b3a.34.1796038361724; Mon, 30 Nov 2026 03:32:41 -0800 (PST) Received: from csl-conti-dell7858.ntu.edu.sg ([155.69.195.57]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87077944bsm17773128b3a.2.2026.11.30.03.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 03:32:41 -0800 (PST) From: Maoyi Xie To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Christoph Jung Subject: [PATCH v2] USB: iowarrior: use kzalloc() for the interrupt-in buffer Date: Mon, 30 Nov 2026 19:32:37 +0800 Message-Id: <20261130113237.2371847-1-maoyixie.tju@gmail.com> X-Mailer: git-send-email 2.34.1 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit iowarrior_callback() copies report_size bytes of the interrupt-in buffer into the read queue. It never looks at urb->actual_length. The buffer comes from kmalloc(). After a short report the bytes past actual_length can be uninitialized. iowarrior_read() copies them to user space. Allocate the buffer with kzalloc(). A short report is passed on as before. It can still carry bytes of an earlier report. Found with a CodeQL-based static analysis tool that we are developing. Reproduced in a userspace harness and with an emulated device on dummy_hcd. Not tested on hardware. Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.") Suggested-by: Greg Kroah-Hartman Cc: stable@vger.kernel.org Signed-off-by: Maoyi Xie --- I used an LLM to help write the harness, the device emulation and this patch. v2: Keep short reports and allocate the buffer with kzalloc() (Greg). v1: https://lore.kernel.org/all/20261128084355.721820-1-maoyixie.tju@gmail.com/ drivers/usb/misc/iowarrior.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index de2b236ef903..53e0e68682b6 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -829,7 +829,7 @@ static int iowarrior_probe(struct usb_interface *interface, dev->int_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->int_in_urb) goto error; - dev->int_in_buffer = kmalloc(dev->report_size, GFP_KERNEL); + dev->int_in_buffer = kzalloc(dev->report_size, GFP_KERNEL); if (!dev->int_in_buffer) goto error; usb_fill_int_urb(dev->int_in_urb, dev->udev, -- 2.34.1