Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp683465rdb; Fri, 17 Nov 2023 09:38:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhuH004SJrO3FYTGx08BvInpXUnHYGBqT0I6TeuxotOQQnwwW+eEt83yxExXf7WOJhCvcg X-Received: by 2002:a05:6a00:e07:b0:6c5:e1f:184a with SMTP id bq7-20020a056a000e0700b006c50e1f184amr134814pfb.28.1700242723377; Fri, 17 Nov 2023 09:38:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700242723; cv=none; d=google.com; s=arc-20160816; b=Sh/2Eoih4fmY+ZDg4LRX6ebCGcPVkqqqdR0fZJ3v4THZGey+GM00/uN1DW91I4z+LT xtMOFpPcIOPZm7E2XoQ6PJ2ky++Xs66u2x4jT1xpJQRUym6TF1w/ffoyCc8D/UDF93yj ThGVkkwH7fXJ7n2HiVQASVo0OUtiAdZUKEyn1boGVy8N17RUj/gS9RIwAmLeQJYvAPpK OUt6Cio76Bs/vL+a4ec9/E33sDpGglgNprd3mJ5kAREJjDR/w+R2zVJ4OtM1gh5MGlH7 TJyfmxQvPK0e3vz3+LkgAcG/n7UPO+q/dPzkT/s1Cn/IZ0by+a9c2rt3N+XzyeOA0Nvm QqfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dtknzUBNyHIzO0D/ezpK3laFhc8XHpoPK40QZZLHzyw=; fh=xkTAmBK9+vJY2MDBsOlLlAvgjZehyO2QOXQKwGBu6Kc=; b=LYLZnCa7hXH4yQoz++Ory8enyIQVjKPG6YnnMWUu4GEtYOG3AbrLRQwHE7QL9ATC01 rmPA7mxBsPgXv5oSm4WXRTHzQIT9jTu2Pcn262AfhU33043FfhxiVy4QtmU/02FLbCAe goGErgEgtDZBkhpm7WdMgBm8cucwDNoJFEOr3YZL51vC/qghoDeiqMKaeChV8h8BuqDX VF7nmrqUPyUQuIbEnPVbDKccwbarV8mNDCV4FOVUnqEwSfI5/9QZph2ak9f43q0IQPYJ OGM6f5Ot8oJ/zWry232pQ+VewQctYZqL9CbJr+OKKmJr0tp8jIOVWu+stP3hXPCaBfIe nX5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZN2wNnnk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b6-20020a056a000cc600b006c339f9f3a1si2383328pfv.240.2023.11.17.09.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 09:38:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZN2wNnnk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9BEC68089E4B; Fri, 17 Nov 2023 09:38:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346186AbjKQRiP (ORCPT + 99 others); Fri, 17 Nov 2023 12:38:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346177AbjKQRiN (ORCPT ); Fri, 17 Nov 2023 12:38:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C32DE10E0; Fri, 17 Nov 2023 09:38:09 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68A93C433C8; Fri, 17 Nov 2023 17:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700242689; bh=sDWfI3dfDm/XeUFimA2vIUoCw4maHSxqpQcHwRZvnSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZN2wNnnk3BLjE4zbhrKriuJksBjzbf+xiebRKjnCpC0d3WWBLcvR1uK6QDOAlZ6Xr RUxdKJIHybOW+/mYS3foJCR4yhiVV94gDS96rYESDbdeELsnw8vFsxDxHFLxS9LRMH qGc+9ZT0p0vgWr8zRYuXpZMudUGCL4tCukmM1wUwRKLovKxQnx1pciCew7XXFAXra4 QpWvCV8/zcFgkLhPWK57lw2OmZXYmfpYufBRVVtLeIWQTDWfSArgwQW0A9XDaREv64 vnE0FE80NEGld3vr6D+8EdHkEYobniucaqA6wRuji3j2+5dVe/a6/r4jjJWvAD4Bat 1hVIuVxe9oHKw== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1r42nF-0005Vs-0v; Fri, 17 Nov 2023 18:38:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Thinh Nguyen , Krishna Kurapati PSSNV , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Heikki Krogerus Subject: [PATCH 2/3] USB: dwc3: qcom: fix software node leak on probe errors Date: Fri, 17 Nov 2023 18:36:49 +0100 Message-ID: <20231117173650.21161-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231117173650.21161-1-johan+linaro@kernel.org> References: <20231117173650.21161-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 17 Nov 2023 09:38:37 -0800 (PST) Make sure to remove the software node also on (ACPI) probe errors to avoid leaking the underlying resources. Note that the software node is only used for ACPI probe so the driver unbind tear down is updated to match probe. Fixes: 8dc6e6dd1bee ("usb: dwc3: qcom: Constify the software node") Cc: stable@vger.kernel.org # 5.12 Cc: Heikki Krogerus Signed-off-by: Johan Hovold --- drivers/usb/dwc3/dwc3-qcom.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 00c3021b43ce..0703f9b85cda 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -932,10 +932,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev) interconnect_exit: dwc3_qcom_interconnect_exit(qcom); depopulate: - if (np) + if (np) { of_platform_depopulate(&pdev->dev); - else + } else { + device_remove_software_node(&qcom->dwc3->dev); platform_device_del(qcom->dwc3); + } platform_device_put(qcom->dwc3); clk_disable: for (i = qcom->num_clocks - 1; i >= 0; i--) { @@ -955,11 +957,12 @@ static void dwc3_qcom_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; int i; - device_remove_software_node(&qcom->dwc3->dev); - if (np) + if (np) { of_platform_depopulate(&pdev->dev); - else + } else { + device_remove_software_node(&qcom->dwc3->dev); platform_device_del(qcom->dwc3); + } platform_device_put(qcom->dwc3); for (i = qcom->num_clocks - 1; i >= 0; i--) { -- 2.41.0