From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 AFB55606A322 for ; Thu, 3 Dec 2026 07:27:11 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4jg5mY5Ll9z2xLG; Thu, 03 Dec 2026 18:27:09 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796282829; cv=none; b=YJrHP4pDVj6VTXVj3FC4nF8RrXW6IVIqjx2SKvqUXDQjDzP2cZjEPxgzbcehunRmD1NBzZJWQEZ4BwuQGUOi/tAt4kSoqXnugXNABt9AXYgHPIpxFvyJmNoFAnpqwFgHOYFetlHToTQ7ryMzOnrja0kJ5109eYzMrV4F4wPSnmJgGPjdUS0jaUBMHyTNM6SzBdl4VCTsocA9pP2/w/w2l6KpwsajFZDdnyd7zG8XbXL4KbQ1CsAjJV4noaCcLMcw/+kvouhKLcke42iy6P3oMTTC9HeOBJDt5o4r/pwmAtaPa6WjG6giMkPrg8LJR8vbLsv6GyKjoACPgA/8fPFr1Q== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796282829; c=relaxed/relaxed; bh=9lGD8fTsnj+2EVLhb1EgHOs4rq9mNF3IxegfgZCu1cU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cnBPqsp74hvhrMbGAHgNjhgDvuTpQkl4yDiuY6Jz8KX3Qz/EODD/Xoaq2i/H/SKXOnn+ZDHj0wVgLOl1CRUlz4s0011wxsutwkkdtHbM2lZEyUgEQgesfT2w3AWWyFlk6jqzTbgseippez81hpjsaUlZjtmVBVvSzMGRam08DfVFeO84VC3eGEe1s+UoHTJAAQwZfkrooL9NMkzvWK85T037htMPOlFmd158/G/xia15x6Jroo6PH30kTqBDxaov5+UbswcqAqcONFcWYQgc733gYsw5NptJArSfWl1AvHTe3g8ZVUMIq4DSybL8M5/11qtxwZ+6siVIQkGIySfD+w== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass (client-ip=211.20.114.72; helo=twmbx01.aspeedtech.com; envelope-from=joe_wang@aspeedtech.com; receiver=lists.ozlabs.org) smtp.mailfrom=aspeedtech.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=aspeedtech.com (client-ip=211.20.114.72; helo=twmbx01.aspeedtech.com; envelope-from=joe_wang@aspeedtech.com; receiver=lists.ozlabs.org) Received: from twmbx01.aspeedtech.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4jg5mX3ktVz2xL4 for ; Thu, 03 Dec 2026 18:27:07 +1100 (AEDT) Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Thu, 3 Dec 2026 15:26:47 +0800 Received: from mail.aspeedtech.com (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.39 via Frontend Transport; Thu, 3 Dec 2026 15:26:47 +0800 From: Joe Wang To: TAKANO Mitsuhiro CC: Neal Liu , Neill Kapron , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Ryan Chen , Billy Tsai , , , , Subject: Re: [PATCH] usb: gadget: aspeed_udc: validate pointers before dereferencing in ast_udc_ep_enable() Date: Thu, 3 Dec 2026 15:26:47 +0800 Message-ID: <20261203072647.3026031-1-joe_wang@aspeedtech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261128-b4-aspeed-udc-ep-enable-null-v1-1-26e41e0cd96b@gmail.com> References: <20261128-b4-aspeed-udc-ep-enable-null-v1-1-26e41e0cd96b@gmail.com> X-Mailing-List: linux-aspeed@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , Precedence: list X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi Takano, > In ast_udc_ep_enable(), desc and ep are dereferenced in local variable > initializers (usb_endpoint_maxp(desc), ep->udc, and usb_endpoint_num(desc)) > before checking whether _ep or desc is NULL. In addition, the error path > calls EP_DBG(ep, ...), which dereferences ep->udc and ep->ep.name when > AST_EP_DEBUG is enabled. Thanks for the patch, but I don't think this change is needed. ast_udc_ep_enable() is only reached through ep->ops->enable(), and the only caller of that is usb_ep_enable() in udc/core.c. usb_ep_enable() already dereferences ep (ep->enabled) before the call, and it returns -EINVAL with a WARN if ep->desc is NULL or its maxpacket is 0, so _ep and desc can never be NULL by the time ast_udc_ep_enable() runs. Because of that there is no NULL dereference to fix here, and the Fixes: tag does not apply. Thanks, Joe Wang