From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796354808; b=Pr2VNG6WYeav/rR0Qnbi5f7RwlqyUjd+x8TEcn6PvlrCPbLDMf/oY00uwcyUrKTBLfJR ol/DoYl9sbhIJbVG6rI2rZacvgL8WCAZfhw7nQPz74bPqGSfQs1e4fRRVGwE1yp0iS0cW xSptldwRX6yGb2J7oqY1diLxVfcH/6fbXZNCbbZ1jvTdJ7N2UpMC+Hlc4ErX7THnejcpz 9GOiq1yWaPYOt1YuLPJPtXvi0jZmL+ClbPOUtveI+naxMykbHSmli7FZ8TVih8cbQZcED 4vamZqaLV/cWHNNB+Zxzht/MBHlp0bGp/rQPrZ7bNQr+ohmrRPrWy0le7OVGDf34hgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796354808; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ceD7OG0AlDvhjxWaR7nCZj1gzs1DL3j/O1SmZnBcU1w=; b=YyjDiq7FV4KR6mPN5EG26sch53gNZvJAtRZizoZ0TMlNkZUwQd7FKr9p/jv6DycVVghf E6m/4qC+eFWZLvdke6YtC+hmjttHQNvGaNPtD3SDBGjlMab3dpj4mDj8thX0eHN0i7b4Q ZE2jG8miXQtATLbHp0BvRrr0BuwzVvgJIS1chuOpG4H4LZdQuBTNQmLcIML+g15gSZB2v q/CYUnmciNJDqOoauWtVC++ro6gubfKC02Ylg0EMt1yR2CK8xivLCJGbWkRR32luTCMDm dozQOaUedMZGUa1HQxmj59PGoiHnOSEuAEOdA3yQk22zk08y3WbaN6nggmwVmpPbohw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WHEZXYBJ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30144606A322 for ; Fri, 4 Dec 2026 03:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WHEZXYBJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7C0D1F000CE; Fri, 4 Dec 2026 03:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796354807; bh=ceD7OG0AlDvhjxWaR7nCZj1gzs1DL3j/O1SmZnBcU1w=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=WHEZXYBJnQrIltkv61XpOi0cVi9s5yQhcU5JH4ESpb6EKNAdwVjm5HXG+dxtlOqeC RfeGh9n9v+VfhfMK6QNzJqGY8VRq/3sQD8UMNjvyIBYYhm0n0rGa0qVGuclDpzVMAl iq1I7PRb34Vk9ztb8UraPSq6BW0adGfx7mfiu4ESkUT4PHnN2HVdtRwnB17FU1Jcbx iI3dCFeTsg0j6mbXhz8UgAzK9xeGX6NMkrfxA3nU5nzcWczLBmT75rSvT1OO/AKY6n eABi9K32UqzyZsc0meEkuOozvGxBqk/soCQsM+LHDFu5PjqCmf/eqAk0yQF9RKz6Oj XC5k7ovLG0qww== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] usbip: vudc: check ep0->req_queue before list_last_entry() in get_gadget_descs() Reply-To: sashiko-reviews@lists.linux.dev To: "Ziheng Wei" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261204031417.1758713-1-zihengw03@163.com> References: <20261204031417.1758713-1-zihengw03@163.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 03:26:47 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > get_gadget_descs() drops udc->lock to invoke udc->driver->setup(), > reacquires the lock, and unconditionally calls list_last_entry() on > &ep0->req_queue. If setup() did not queue a request or the queue was > emptied while the lock was released, list_last_entry() computes an > invalid struct vrequest pointer from the list head, leading to memory > corruption in list_del() and usb_gadget_giveback_request(). >=20 > Check list_empty(&ep0->req_queue) after reacquiring udc->lock and return > -EPROTO if no request is queued. >=20 > Found by LLM-assisted static analysis. Compile-tested on x86_64. >=20 > Fixes: ea6873a45a22 ("usbip: vudc: Add SysFS infrastructure for VUDC") > Cc: stable@vger.kernel.org > Signed-off-by: Ziheng Wei Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204031417.1758= 713-1-zihengw03@163.com?part=3D1