From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D0C1C0015E for ; Tue, 25 Jul 2023 11:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234454AbjGYLWn (ORCPT ); Tue, 25 Jul 2023 07:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234453AbjGYLWm (ORCPT ); Tue, 25 Jul 2023 07:22:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DA1119F for ; Tue, 25 Jul 2023 04:22:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 37AD36169A for ; Tue, 25 Jul 2023 11:22:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B72EC433C9; Tue, 25 Jul 2023 11:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690284151; bh=VowWUhe9JxkD6iG82r9Vu0Ecl5wkllRwo3nYHuSbFhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qk9OOlFiKNWVley6fYTOSB/XowVYRCfEnjeeY3hb+rt7ilErCOq7hiFdZgS+t+v3F w+Wa4iCcQvcY7OcK501O5fVIpOpGUwISJ97DlX3yy6xzo+eXF6HF1cnWAYFC1rcAMV 8TUflwLFvYNX2KUwXMfCY+00vEgWlGw1qXgoNPE0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, EJ Hsu , Haotien Hsu , Thierry Reding , Jon Hunter , Vinod Koul Subject: [PATCH 5.10 214/509] phy: tegra: xusb: Clear the driver reference in usb-phy dev Date: Tue, 25 Jul 2023 12:42:33 +0200 Message-ID: <20230725104603.525765729@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104553.588743331@linuxfoundation.org> References: <20230725104553.588743331@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: EJ Hsu commit c0c2fcb1325d0d4f3b322b5ee49385f8eca2560d upstream. For the dual-role port, it will assign the phy dev to usb-phy dev and use the port dev driver as the dev driver of usb-phy. When we try to destroy the port dev, it will destroy its dev driver as well. But we did not remove the reference from usb-phy dev. This might cause the use-after-free issue in KASAN. Fixes: e8f7d2f409a1 ("phy: tegra: xusb: Add usb-phy support") Cc: stable@vger.kernel.org Signed-off-by: EJ Hsu Signed-off-by: Haotien Hsu Acked-by: Thierry Reding Acked-by: Jon Hunter Link: https://lore.kernel.org/r/20230609062932.3276509-1-haotienh@nvidia.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/phy/tegra/xusb.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c @@ -556,6 +556,7 @@ static void tegra_xusb_port_unregister(s usb_role_switch_unregister(port->usb_role_sw); cancel_work_sync(&port->usb_phy_work); usb_remove_phy(&port->usb_phy); + port->usb_phy.dev->driver = NULL; } if (port->ops->remove)