From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9DB4033121F; Wed, 8 Apr 2026 18:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775673986; cv=none; b=WGPUMZvwcr6LbJlAwuBl6daPHuSEWFL+hr9xMekCLdJ4Z24oNv0hRhRu3ihJd7XUt8mXQBJMZYcVGkc24gnljgWzS/7nCw1Uq6DIsfhWx6BQNaHpadXa3N00bmV9AfVIlh+5qbQ9ZAqP0dl/ZO2kI4CElY4fzrwl2UJjwplitRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775673986; c=relaxed/simple; bh=ImiOu7plNoN7e1M+Z9rUoIXZ8Ce16SVswk82XVTbaEA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SUQ3kJdq7qGu2lSNmJytbvIv5uVamu3iQ89JgkL1Ch0CEWWiM2F6wX3ihPjXsjhUjKbfy41R6fOLkqDVbBFOY7WFmufLStD/YfpJlhw6vA/rmnzHrdbwA2NBgPcI9gEAtGEpbhqPhKO0HEm2ssXK9fx0cQXlQuXeueHQDOpca0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=be6ODjaR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="be6ODjaR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34D30C19425; Wed, 8 Apr 2026 18:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775673986; bh=ImiOu7plNoN7e1M+Z9rUoIXZ8Ce16SVswk82XVTbaEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=be6ODjaRSHh8HIX3FD/Nim+IE9souxtDGRxLU3JHpazT67Z6UW/b8/RWLiuwCtIzN kVSYN0iaT3JUO6qETi4pehA+dAGhJpKnzj7s6Ky73auV4si9kYJNXoJvMbm3oOYdu5 Poyanit/m2yTpOU+juEcybVTGj18SFL1RlDEPytU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Yongchao Wu , Peter Chen Subject: [PATCH 6.12 165/242] usb: cdns3: gadget: fix NULL pointer dereference in ep_queue Date: Wed, 8 Apr 2026 20:03:25 +0200 Message-ID: <20260408175933.264440910@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175927.064985309@linuxfoundation.org> References: <20260408175927.064985309@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yongchao Wu commit 7f6f127b9bc34bed35f56faf7ecb1561d6b39000 upstream. When the gadget endpoint is disabled or not yet configured, the ep->desc pointer can be NULL. This leads to a NULL pointer dereference when __cdns3_gadget_ep_queue() is called, causing a kernel crash. Add a check to return -ESHUTDOWN if ep->desc is NULL, which is the standard return code for unconfigured endpoints. This prevents potential crashes when ep_queue is called on endpoints that are not ready. Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") Cc: stable Signed-off-by: Yongchao Wu Acked-by: Peter Chen Link: https://patch.msgid.link/20260331000407.613298-1-yongchao.wu@autochips.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/cdns3/cdns3-gadget.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -2589,6 +2589,9 @@ static int __cdns3_gadget_ep_queue(struc struct cdns3_request *priv_req; int ret = 0; + if (!ep->desc) + return -ESHUTDOWN; + request->actual = 0; request->status = -EINPROGRESS; priv_req = to_cdns3_request(request);