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 952E235C1B4; Wed, 8 Apr 2026 19:01:30 +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=1775674890; cv=none; b=pPcFQonzq56RhBk6weeKB/6QwwDyYLM8en7ChhXY8cXEKIXoSKnHM8gBrlm3gRmVynHaUiJLBXtoX+wXqLj4F+dD02oTnOHUbmvQbYJHN8xhOvjA5FLzg7zZP3WMpQW0o/k2uC9ZNehUnHIXdergp7tynF4A/9dGL9/fgOZIbpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775674890; c=relaxed/simple; bh=Z1aCAHQgnEaM1oxOyrFKyzrYGf7trL/J/TYeJ1OU4x4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JaBadUPtn8Z30SwtKd/b9f7U7x3T1UbVdE74kQ5qm7JZ0MURU0a8uSJTfjpjmdzUgteSySNGbUASCr5FQsuGKXaM8dFJGmk7Me9qKoCuovGbdFmTRv8ZHAixdsUedSHhweF4h3DiwoWmtcWBXWutgNo9ukDhbu3M0OHpHT6EOr8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gMNeIkRu; 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="gMNeIkRu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2C61C4AF09; Wed, 8 Apr 2026 19:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775674889; bh=Z1aCAHQgnEaM1oxOyrFKyzrYGf7trL/J/TYeJ1OU4x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMNeIkRu+yH4DI19GT1myg51ufrOPI0ZSu30gI++iv3Ke4bgpR5gFKRIDG5erfcqj o0hsXVv/+iaGU6zVY6rk8m9l/JlSD3skZ8NmqFye7PTL4vbHMBclZI7FZu0C+GUj1a BELsGqMAluUFOIXUmhAoaDq0Ta4RRjdKUd/rZOU8= 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.19 245/311] usb: cdns3: gadget: fix NULL pointer dereference in ep_queue Date: Wed, 8 Apr 2026 20:04:05 +0200 Message-ID: <20260408175948.540077122@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175939.393281918@linuxfoundation.org> References: <20260408175939.393281918@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.19-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);