From patchwork Fri Jan 17 14:18:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13943408 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 145D870810 for ; Fri, 17 Jan 2025 14:19:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123546; cv=none; b=q26L1dSsb4VvUiLdBf87pr4e1DdxawsB+l9Xk/a/BP0IIv+4ssJJSTK67MCwivcMWcLnlzq/9DcarZjGSqcD0ZMO3PMdCxBxgVXXXdbCMIj1Yfw4Q/stRCD7sxWneyVi5LCW7UA0HelGeeD1WET4XNaOI85DuFdhMu8lpb0rubE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123546; c=relaxed/simple; bh=yG8sQ+nx9Eqw58/wd8HyjrYz0XP+TABX6QtHMArWsyc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l0jyFbP73khyvfmkd0+EZB/OOERSXI1UB6866H5po7wUyYTmsJMeshlloO6n5ZDtxm1Qhb+ykb4i47nPSrTDelESYG9FvwS/tuhrFE02fwStWDmEDnC5PcxJzthI/VWpdMVW9igG4ur+nVugT2ZXwq5cHgqNmgSCZCkXaHC0VHg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MQjFAArJ; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MQjFAArJ" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3862d6d5765so1259319f8f.3 for ; Fri, 17 Jan 2025 06:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737123543; x=1737728343; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EJPpzjW5eAxwdMtWI5K0l8mGr8BTWJyLsOuy62grEjQ=; b=MQjFAArJ1oQ+XiFb01gGlTaIwCMUZ6/eaMswdNPVP+UdM4o40QJIZ4veg5VEDYPmQr rqAfDKhj6MqIX9tbOcrFqqSazHgM4yVeVSxd/EfGt6mXhtqPCfZM5R0DLPdP8yiFCZ17 Kx9vl30rfvYaAXHn0vcf3taVGqhhTjRjDGitTyNd/hgDt4nojy7Qh/SCf+5cOAMp8CkQ 3tt2jSRMbsKP2b05Gtt2sHxfOhBm5r+cMNjiSF2FsKE/8alqqr1SWsEgCeWPtC0ZRjmU Ya/WH5kkPKpvsK8gPA+iFvsDM4+IjtZWAjF+U61lLe7x8RdrIUZ9jMpak0Pgd0skveDP VQAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737123543; x=1737728343; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EJPpzjW5eAxwdMtWI5K0l8mGr8BTWJyLsOuy62grEjQ=; b=v2nR/xrTdEyGLzt7zHa1JgsEIjwrOOWflQnvRrJKkKDlzleggeB5LtsQcRgLYKN3e4 hFLDvwEYTPt6csYW/for3qBHk3JVsSkXiiyom/veJx0rf09GPWQTGIB2IYKszTBIBWC9 Z2SoWegvUfr8jpMHM3pui7CPilMZlyIDSmbtFGqP6kBS7j0hZenhw1VTYyX6JnAGtpvH Mwad241GPwKu2JyO35UEMUfGSJxanL58XznYC4a9CmUodrY/GyketvUb2LsoNu2whyqn gM6qsTj7WEOw+dil8nCLupSmXJVGopTMjonvDU7thoMD2uOTmKEzPnV/+DS8m1olg6gI Yheg== X-Forwarded-Encrypted: i=1; AJvYcCW4npng+xQ6KWZHDFDUrVCmH5NNfrG2z/xtdlaFlBKrwpfKEHLj9B449BWs4FWUPVSBF0SsaTBslEA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8ARurHZTnWVxYG2KJTjcLCDeNs00dPC82fbNrH3Lc4Ibp0YFH 50pHVIfU/Wk59B7wOdUJR0cimQbRlgJGIuw3OadFDAHWzRZU8zMbyccFbuZbvOE= X-Gm-Gg: ASbGnctd6DmGu9j4K/KbQevVh6mBrJXSohepP71mrQarFAW7K6a01l5X0leb2x+RGyL 3mzhLGkT0gdFTrONEpDnf4ftEY0AFHcF86XC/j8rEsp08ZO6r5r5dDLweeXG1rovBfPWkZ+9rUM t0YcLqznPYIaxVUCoEcrj8Dj5NvnHPHCULAOqPsUOneE8iMy6DFddENDaGVraAPOscbOVP4jAgc 4W4/GlGwBxs3N3I4fit5mOQiz4vk7WUJyMnJxIwzubTnzd5TDTFxEXJexf4qQ4zCdVhVQAW0rN1 kVCt0sQdLzUzwRhEmatFkWMwRUv1Ds6nF6ma X-Google-Smtp-Source: AGHT+IG5K3FNsGuzWqRixT4OiMWoWe6dLCzIRKc7oOU3K/CehjLULkM8EVMs4EBMJ03fSNI8Cqn0wA== X-Received: by 2002:a5d:4e86:0:b0:38b:d824:df3 with SMTP id ffacd0b85a97d-38bf57890e3mr2043468f8f.24.1737123543332; Fri, 17 Jan 2025 06:19:03 -0800 (PST) Received: from ta2.c.googlers.com (169.178.77.34.bc.googleusercontent.com. [34.77.178.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74995f6sm96764195e9.1.2025.01.17.06.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 06:19:02 -0800 (PST) From: Tudor Ambarus Date: Fri, 17 Jan 2025 14:18:50 +0000 Subject: [PATCH v2 1/4] soc: qcom: ice: introduce devm_of_qcom_ice_get Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250117-qcom-ice-fix-dev-leak-v2-1-1ffa5b6884cb@linaro.org> References: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> In-Reply-To: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> To: Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Adrian Hunter , Ulf Hansson , Abel Vesa , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Eric Biggers Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, willmcvicker@google.com, kernel-team@android.com, Tudor Ambarus X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737123541; l=2995; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=yG8sQ+nx9Eqw58/wd8HyjrYz0XP+TABX6QtHMArWsyc=; b=XYQFpfWRMZlFbEbuuaOCZ4aYKbikkwMh7NOh050v6RV5pq7o3U3s8DytNgIi/EzzIkR8kxinl Olkd6PT8mK+CLzSZcBzMMXEmMb1XtCif7d7l2h9XI0JbH14ZTKpkBWo X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= Callers of of_qcom_ice_get() leak the device reference taken by of_find_device_by_node(). Introduce devm variant for of_qcom_ice_get(). Existing consumers need the ICE instance for the entire life of their device, thus exporting qcom_ice_put() is not required. Signed-off-by: Tudor Ambarus Reviewed-by: Krzysztof Kozlowski Reviewed-by: Abel Vesa --- drivers/soc/qcom/ice.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ include/soc/qcom/ice.h | 2 ++ 2 files changed, 50 insertions(+) diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c index 393d2d1d275f..79e04bff3e33 100644 --- a/drivers/soc/qcom/ice.c +++ b/drivers/soc/qcom/ice.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -324,6 +325,53 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev) } EXPORT_SYMBOL_GPL(of_qcom_ice_get); +static void qcom_ice_put(const struct qcom_ice *ice) +{ + struct platform_device *pdev = to_platform_device(ice->dev); + + if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "ice")) + platform_device_put(pdev); +} + +static void devm_of_qcom_ice_put(struct device *dev, void *res) +{ + qcom_ice_put(*(struct qcom_ice **)res); +} + +/** + * devm_of_qcom_ice_get() - Devres managed helper to get an ICE instance from + * a DT node. + * @dev: device pointer for the consumer device. + * + * This function will provide an ICE instance either by creating one for the + * consumer device if its DT node provides the 'ice' reg range and the 'ice' + * clock (for legacy DT style). On the other hand, if consumer provides a + * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already + * be created and so this function will return that instead. + * + * Return: ICE pointer on success, NULL if there is no ICE data provided by the + * consumer or ERR_PTR() on error. + */ +struct qcom_ice *devm_of_qcom_ice_get(struct device *dev) +{ + struct qcom_ice *ice, **dr; + + dr = devres_alloc(devm_of_qcom_ice_put, sizeof(*dr), GFP_KERNEL); + if (!dr) + return ERR_PTR(-ENOMEM); + + ice = of_qcom_ice_get(dev); + if (!IS_ERR_OR_NULL(ice)) { + *dr = ice; + devres_add(dev, dr); + } else { + devres_free(dr); + } + + return ice; +} +EXPORT_SYMBOL_GPL(devm_of_qcom_ice_get); + static int qcom_ice_probe(struct platform_device *pdev) { struct qcom_ice *engine; diff --git a/include/soc/qcom/ice.h b/include/soc/qcom/ice.h index 5870a94599a2..d5f6a228df65 100644 --- a/include/soc/qcom/ice.h +++ b/include/soc/qcom/ice.h @@ -34,4 +34,6 @@ int qcom_ice_program_key(struct qcom_ice *ice, int slot); int qcom_ice_evict_key(struct qcom_ice *ice, int slot); struct qcom_ice *of_qcom_ice_get(struct device *dev); +struct qcom_ice *devm_of_qcom_ice_get(struct device *dev); + #endif /* __QCOM_ICE_H__ */ From patchwork Fri Jan 17 14:18:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13943409 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A53513C67C for ; Fri, 17 Jan 2025 14:19:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123549; cv=none; b=kMx9ep82iAA0/NLw42JO51nib4OaXH6EsUB/uU2nhEvCTsR7VQZpkAr0frlaikD9M+XzVkmQd68dXkx1E0r50KfqnPxzkffEM6rruRcn9ZS1l2V+LVyCUOc6+pqp++kXIM1eXn8IIbMrZu13xwDwWEH/kWFi5va0M9a4LoJd3X4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123549; c=relaxed/simple; bh=GZ2r5p0dFfNcF1ZvOqiFJYmYWFEQPwiZzMJJY9diiqM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X07Ci7xfHQR1O7SyHJgYABW5qcRzQeXxGX88g+GKLYXiwvgdwOFU0ig9gMTxclqFaKbSyRlND0mmdLhVSEYW4DB4EAXJhOa4XJL+OfpLxxGdNtpddFLVpI12vzCyWgzDqzTcsTITezq99PvS1QPX77SfCuU0076xDjPs6vpVI5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=RUMtBizF; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RUMtBizF" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4362f61757fso20809835e9.2 for ; Fri, 17 Jan 2025 06:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737123544; x=1737728344; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TrQMwi+hF2C0bCOO/tTN4XbolEHkOKYGtBgFZ4HZCnE=; b=RUMtBizFVYX0qVr4FBO/0JwxgbuH49a0YsV1JJd5j9CQ29Lf7Rmmk7qaTi+lF+elXQ h2+FrVeeNJIffu4ZwhyO5Hox1KLKtaQRmlU0H74LwrMt3H9KBoOod4P5kuLXi3PxhKVB Rs/flOJ8kfJnuTXkXvdXBxFc60uztwrA6eXEVSWoqJdh5c9Dma62nhHpXJ1tjA15lqj4 UXYtfWtTwgoNmNXj24As2pjtYccfOBw5nUooFpbTHpMxcBKWygyR66Ld8+au+LyH4grm lG1mm8Di+Ua108XhybY+rBWap5F3oHy5szKaUoix5k4ELR+SMTPNkh3yN8k7tL9LU+df wdfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737123544; x=1737728344; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TrQMwi+hF2C0bCOO/tTN4XbolEHkOKYGtBgFZ4HZCnE=; b=ePe3zZvuvmlBEx51yCF9ww0E2BH6B5rFd3jIYeTnn8aeAogUh4dH2K8pzmx9wkk97T joQsU3ifrocdD1WmPLY65/36G1670x/4242ZViWZQSFUVQnwfMheoZSdUod8jM658vsQ AMigUJFcnoCSw4yJhG1u4Ti1iqMgU4d7XlA95aavzgr7OwYb7fSuF1LwT1kLLZrJl7mU EWIbamVdg1ek8V5uREN4ubW64+FP2096ToCq/U991b9274af1LnRJ2Kdzd9y6IXBTZaD hrf984ocG9aUKH15TPAsEQAeEetn8vBo9FU65eTfPPTgpq2/sAL+hR6gDBaDx8CoAnzx uWjg== X-Forwarded-Encrypted: i=1; AJvYcCWVrT/ngrskSRZtJTmA8RrZL7UfiUitlwPpOf+/nzSFYjEgM1D9reN9Yt/Rq5s8cda09zmObKmyels=@vger.kernel.org X-Gm-Message-State: AOJu0YxmyiqZklCv87kP4YpSLbTVjEmxduE9Vtmtf9Ps4BuDSSgqCHLS eIj2Y9Q+m+PS2k7ygFFc0A0eh4U8kznX5fI/jsiJvk892TWAzSTWFAbETYAi+Po= X-Gm-Gg: ASbGncsKTg+b4mdyH5zXn8wWAAAgfMYQBTZzN/r28pU6FwFByT6340bsVPSS7ehMDAL 0ATKkL6BxQmntWEvpGe7PtPCnQ/qZJolhI8bvhh0C2AYC1ZefwHQgxqyNgf1kpuvq+OPU3gRWLq RUz6sm0rjox+k9N2spPhAM+XNv9E9LVKNA8ZdHbtYJOBOlKUpe+awdETRk6XnlPXqAem3HSQsS3 b/v54kWqiY0juaZbmlLk34ua8HuZM77GplSksuwYChdaqk+ZdsPsQGJ/7FGtNmxKgGHfQBjjzIZ yZkFdSdDl8eoxtRMC1Cm3ZuMgA4XKWTFxNep X-Google-Smtp-Source: AGHT+IEfaWlQCEKKaatnAdlw13qgkLJVr8s+K3HBqqjRbB4QuuaaO9z/foSCuP32eVd4AGEznbyiWw== X-Received: by 2002:a05:600c:ccc:b0:436:1bbe:f686 with SMTP id 5b1f17b1804b1-4389141c073mr23873315e9.21.1737123544308; Fri, 17 Jan 2025 06:19:04 -0800 (PST) Received: from ta2.c.googlers.com (169.178.77.34.bc.googleusercontent.com. [34.77.178.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74995f6sm96764195e9.1.2025.01.17.06.19.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 06:19:03 -0800 (PST) From: Tudor Ambarus Date: Fri, 17 Jan 2025 14:18:51 +0000 Subject: [PATCH v2 2/4] mmc: sdhci-msm: fix dev reference leaked through of_qcom_ice_get Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250117-qcom-ice-fix-dev-leak-v2-2-1ffa5b6884cb@linaro.org> References: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> In-Reply-To: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> To: Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Adrian Hunter , Ulf Hansson , Abel Vesa , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Eric Biggers Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, willmcvicker@google.com, kernel-team@android.com, Tudor Ambarus , stable@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737123541; l=1054; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=GZ2r5p0dFfNcF1ZvOqiFJYmYWFEQPwiZzMJJY9diiqM=; b=45d3iiXT7ApSj86eCeo8o+vCQk8H9LTCNmewvtv437mzQ3nPnN5PwM2jJJAI++4mdsjm8dOa+ C8c22bdPYz+B52Him4FeCPJNwliX9YaycwJvlhaqizsV5BZY8YMv59M X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= The driver leaks the device reference taken with of_find_device_by_node(). Fix the leak by using devm_of_qcom_ice_get(). Fixes: c7eed31e235c ("mmc: sdhci-msm: Switch to the new ICE API") Cc: stable@vger.kernel.org Signed-off-by: Tudor Ambarus Reviewed-by: Krzysztof Kozlowski Acked-by: Ulf Hansson Reviewed-by: Abel Vesa --- drivers/mmc/host/sdhci-msm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 4610f067faca..559ea5af27f2 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -1824,7 +1824,7 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host, if (!(cqhci_readl(cq_host, CQHCI_CAP) & CQHCI_CAP_CS)) return 0; - ice = of_qcom_ice_get(dev); + ice = devm_of_qcom_ice_get(dev); if (ice == ERR_PTR(-EOPNOTSUPP)) { dev_warn(dev, "Disabling inline encryption support\n"); ice = NULL; From patchwork Fri Jan 17 14:18:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13943411 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB7F813D539 for ; Fri, 17 Jan 2025 14:19:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123550; cv=none; b=nfgzyGMyVvxqNAYO0xzAyyiRDbwOqt2g8IT+ZTbmGDQbW8CJXppXstS53rlj5WXRyAiPtVgIrQxqXHg6KWaRs1VtwWs7OOKOM3n86gu+4YOczzJFgtDHHnUYN+JD4PEv7c5kOQcI+G9JrLvQhVpAq/MeWFSj5XB7K/Mlwzdxlpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123550; c=relaxed/simple; bh=oCdvQb+2nS9fJzhI+yPgqLPClQAHie77kio2g2kgZyQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s2a+Zdc6/CbBA2gKTYIeg5bcwvEyTy2h8wbobN3HbD3Sd7KXvXXydzywrkJO81NDfdWZZdMWTLDOAI0b/mI/5PTZOlZCVralzcG5QFjQ0Yxle4ZWJxevBuV6o8LANQnFnhnpmaZdwpGZ5pAotBYC/8sH63dmT+QovocsD2HfPd8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Lm4m3tOZ; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Lm4m3tOZ" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso13682015e9.1 for ; Fri, 17 Jan 2025 06:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737123545; x=1737728345; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uj4Spml5sM1tLHD2FfSBP66Bq5uP7mY7z+kcAwA1e+w=; b=Lm4m3tOZgGLYku8A4Duk7FaAf91ECH+x91nGUZlOLZQK9ySCH+/GNaUwibHPg/xWCP uckObVu4HbsGiZ5woqkGSowlAjQJnXiaNys1y5E6kmy+8ADRYTbq6k/QoENr6TU+ysXi tDCfEwYnAJ56DSExAwIdvUR+B9k04bCow9iYH53HLpSCPIdDvCxfxaztGoW7wUnQL8Xc 5XVF64hudXCPCzbzRSBaphDQWBOeWcxKGT5ZsG3+0A8/LBawIRBSp6DGWbfH0pL7kTR5 JrcvcnNq9d1oxQ7sBDFycTmr3CvbN3e4Xj7Lj0AHT/rQHxou/r34wLybKvGalw/utGjX ZI5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737123545; x=1737728345; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uj4Spml5sM1tLHD2FfSBP66Bq5uP7mY7z+kcAwA1e+w=; b=dajfElDsu/FpWJVYG5fmU7nkS0d7gxqbbxqc9ag+Dr9P6oJY/DHfsFwrdWgWUcZNVh 5aZgVVWw6UPEE05gpiGIcmcrRv21mbXaC/orzhF91YW1dzEPhOIVXsCZlxo2Dug30Tun NlgSYhr3Pbo+RaYlk5VLHYd3JHoprlRcFRbmSgyHA03dGdwqFbCC0rL4CsrGUydNxIfB sUM7oR8h9GgPrsnecpvABjF8eTiqxjmKNQ2z9Z5bEIM4X+kMzdr0M29UOHcU+6GonkIp Cto60wbwXSC6onVxcKO6i7qfLhPWAJ2W0r1OKjTCrDPYvdTdecSEhWC/cdhAfqMOkcQa lFSQ== X-Forwarded-Encrypted: i=1; AJvYcCUSZacCibtuHt3g/LGrBNiDzquTC/gNJgz+CW2yO9lrC5IgREUYc8ZxfB7R/PHQdR7Gq1DZkVa4ZWY=@vger.kernel.org X-Gm-Message-State: AOJu0YyU9QfXTCAb/xyA5Vi+oWkfRGc+Am+iVZ9gw8aVrOMiWYKKqov1 MQDuTlpWS4rFQa+xrmk+P7nyDTWc9i8Hf99PQuvbAxF2fVoHIeSz1a4FLcPXoW4= X-Gm-Gg: ASbGnctQdcAsxEnLuCGpCfJtrwuw/6rhkL8u9dBrblExYC+yh/HSXY3bqIXgq24/5dQ bJ3CdR79T1ogXSNsDB32BX2oapZC6zH1PwVvGDAon9eEdCAeOnV8Do0Xj0OZMNxvyjPH+ptuqdD r6y9BjhC8/Tiyi0U1U4DqG92o435uzkHB67ml+kIlsZ1eLWZlw/D6uoH+v2u0mrcUf1J256w9mV ppaC4Tyk+3BwUK8S5TcuLysyxV1hBBABVDts5VTTOIJHwjtB4PEYe+uZCZal0lc/3DebugdUfdu C0HHZz86imnqMIsJz6qI6EPSBz3k22satEYc X-Google-Smtp-Source: AGHT+IHtJFuj1A/6iNliKs9eQH9rrj4V+OnOFmOpiyVc7p4nqfhLVN5vCbRzSx6Je0dj2NPJh1Qeww== X-Received: by 2002:a05:600c:698c:b0:434:f9ad:7222 with SMTP id 5b1f17b1804b1-438918d3bdcmr26936585e9.7.1737123544993; Fri, 17 Jan 2025 06:19:04 -0800 (PST) Received: from ta2.c.googlers.com (169.178.77.34.bc.googleusercontent.com. [34.77.178.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74995f6sm96764195e9.1.2025.01.17.06.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 06:19:04 -0800 (PST) From: Tudor Ambarus Date: Fri, 17 Jan 2025 14:18:52 +0000 Subject: [PATCH v2 3/4] scsi: ufs: qcom: fix dev reference leaked through of_qcom_ice_get Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250117-qcom-ice-fix-dev-leak-v2-3-1ffa5b6884cb@linaro.org> References: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> In-Reply-To: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> To: Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Adrian Hunter , Ulf Hansson , Abel Vesa , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Eric Biggers Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, willmcvicker@google.com, kernel-team@android.com, Tudor Ambarus , stable@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737123541; l=948; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=oCdvQb+2nS9fJzhI+yPgqLPClQAHie77kio2g2kgZyQ=; b=163Vcmfi+CsUVQeVZqwtnnkJb23luP5Bc+ZhUo0gynzhVHSf6qNM8NDwwDFi+n47kS2Sd6yOD wnJaevqnGsfBUfI2PFwXCIqHHI8DVN8amrNysqTsb/QFG8nJx2n07F5 X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= The driver leaks the device reference taken with of_find_device_by_node(). Fix the leak by using devm_of_qcom_ice_get(). Fixes: 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API") Cc: stable@vger.kernel.org Signed-off-by: Tudor Ambarus Reviewed-by: Krzysztof Kozlowski Reviewed-by: Abel Vesa --- drivers/ufs/host/ufs-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 23b9f6efa047..a455a95f65fc 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -125,7 +125,7 @@ static int ufs_qcom_ice_init(struct ufs_qcom_host *host) int err; int i; - ice = of_qcom_ice_get(dev); + ice = devm_of_qcom_ice_get(dev); if (ice == ERR_PTR(-EOPNOTSUPP)) { dev_warn(dev, "Disabling inline encryption support\n"); ice = NULL; From patchwork Fri Jan 17 14:18:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13943410 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B686B14386D for ; Fri, 17 Jan 2025 14:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123550; cv=none; b=Y8L5LX1uj303SJ56uOd8w+BhC/IYTaYKvCFxFwmNlk6MHaC0viVvEBxa6E+3iXdKEJsBkLJTDihjqT51a7Nj4j/MpmlH/4ZBMtObrVVSARpeWqmdnQHtRT0YCsP3n1CadaS2x2OxLR5No9SPhNBXR6UwfBuUrRlhGOA7efd8oH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737123550; c=relaxed/simple; bh=rkN16KFyfCGbANv1URyC5pgmPDjOKr7gcHvrAmLZiGk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dUfOCT48ZNuqg5mBY1IiiKmDJ+EZ4oMHUaLmV1jC1HI9qFeKL4diCHtc101A98kq/EH2OicKZo90+1oEGh4O141OOQF+0bdwcpO1tM7E3TWxihtjmsdGDJH6cuFM34DqzgxJU7waRM/RjZoeJ9laHl+MA3z99zcmihhnLPTZPIk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=RFLZapW2; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RFLZapW2" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43635796b48so13816815e9.0 for ; Fri, 17 Jan 2025 06:19:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737123546; x=1737728346; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Iw3hbPMx3DDHttAVH5KXQAb7aC6TLapsYr3FJPMUjSk=; b=RFLZapW2iKxxI8T3dcu5OKvgO6KtaG5AFr2Y+YZdn+ocSk+15Efbz7fjDPCQauc/Of 5MqGBrnQdmdpO/oyYETWL4wb3lcTg1qkbriLA/qjqAM+xF3w476xErqlA/GMrEEk9pcc pRuLppqbLvw3kDNiVQ/+Fx+dxMu/uq5tuMlMWCj3ek68UzP1bRzR0wzWG7XNRp0xqocd WmCfCOxjtcKqpB+2UpVUPBuCzejZbjsUjK556UQ8BrBLiRTRCpuj0VVk2b/Jc5CeiH8z 2U9+PqEa5p7kpPDyHiWSMLJzlA+vKfKkHqmgcxtCbUQs8J80AEQyijVB6GKLnrS9+hWj dD9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737123546; x=1737728346; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iw3hbPMx3DDHttAVH5KXQAb7aC6TLapsYr3FJPMUjSk=; b=CKKq47Z/vRBPNf+JDdAXqUWMNXwVtIIdyantdL8K6UN09g7UCVS6nR0IlZsxsZUeYn HAF21GZThiwBv7V5QD65tFagniuw2PCGMC4Lm12tVhK2a5aYQILD/1yk6NoUlh3/5Vqj l6OTx84tt+cnAEiGRuJNSrWFDlEWyWKkXPr0xbtE3fbx/RsFzn5Jla1n3CbUlpDzGyZL 6gQoTkPM1NXEUig9xgUcrms7c1C09JKctco1Q1EksbiB7G4xU5LXIdCvZuUo0B+qqypx c46O/knFfc3SAEU/ajhr0Y2u9zHxSoD6spDzcnXJrsalp2Pbej8rO6nKRNsxPd7hFEWy y+/Q== X-Forwarded-Encrypted: i=1; AJvYcCVkVYz2Z60+bBwD8TDfhHIWOoL+nCZLIPe0rap/3xlZ48s8RFrNgovOWLZDREF6uwlDpSGJeDCSQhM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+mkDSvPRJT3Qb1FlGcAiIw+dOR8FsJSTQMN0qTQ2UPMsjUFl0 4nLJ3Xa/AHLuSsFNTJ2wy3TOBW+pCI0HiXN7vJFNjgY+j4PzZ3N3cFstaLWCOr0= X-Gm-Gg: ASbGncu4pCZZkfm9SOjFPLwqPg6/ss5MpyYVtIFAkGvuw60t/YHqjBMmGxqRhp3I/gL jUtBbLnCLq05HkJZd/siRIFAMbPAhVlC8iwbMl1sNkP2f8lFU9SCsZ+qQAL5MCu8QFGt/LFP/oK pXewdEdpLUZYixi36elmS+Dr6wx4seZFb8fDBfbX2hMThFGfKRJaTxQDqXBx7Cn6ZdM6ux8q23l CoLxsceJCzl5iNMGelMhStZReQ8U3h+2mUL7j3iG7METOVv9/0GwoxTIV3jSyiGintPvnLOiL6e +9nzw9BH7geFrsCVzlLlbGBBOkDs5L3awDUH X-Google-Smtp-Source: AGHT+IETblMrx8KIRmwK9VCr83hmCG0f17UdDxWZUvSUIiOhoWXqGDdx+je3BMGMgRQiM12epULhgw== X-Received: by 2002:a05:600c:698c:b0:434:f9ad:7222 with SMTP id 5b1f17b1804b1-438918d3bdcmr26937075e9.7.1737123545938; Fri, 17 Jan 2025 06:19:05 -0800 (PST) Received: from ta2.c.googlers.com (169.178.77.34.bc.googleusercontent.com. [34.77.178.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74995f6sm96764195e9.1.2025.01.17.06.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 06:19:05 -0800 (PST) From: Tudor Ambarus Date: Fri, 17 Jan 2025 14:18:53 +0000 Subject: [PATCH v2 4/4] soc: qcom: ice: make of_qcom_ice_get() static Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250117-qcom-ice-fix-dev-leak-v2-4-1ffa5b6884cb@linaro.org> References: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> In-Reply-To: <20250117-qcom-ice-fix-dev-leak-v2-0-1ffa5b6884cb@linaro.org> To: Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Adrian Hunter , Ulf Hansson , Abel Vesa , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Eric Biggers Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, willmcvicker@google.com, kernel-team@android.com, Tudor Ambarus , Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737123541; l=1621; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=rkN16KFyfCGbANv1URyC5pgmPDjOKr7gcHvrAmLZiGk=; b=GkVvea3pMVMpJEOFkCogbzhGJLadWWc2COyDHp4IFtQvqwN8HlMWhUl0amrJXjGiMy0W2cgM3 AqCC1xa+8FLC3UvoQfVuAwJIX32Ugg/vLxSxUTTBxQ4yk/FSRFpuR10 X-Developer-Key: i=tudor.ambarus@linaro.org; a=ed25519; pk=uQzE0NXo3dIjeowMTOPCpIiPHEz12IA/MbyzrZVh9WI= There's no consumer calling it left, make the method static. Signed-off-by: Tudor Ambarus Reviewed-by: Krzysztof Kozlowski Reviewed-by: Abel Vesa --- drivers/soc/qcom/ice.c | 3 +-- include/soc/qcom/ice.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c index 79e04bff3e33..2310afa77b76 100644 --- a/drivers/soc/qcom/ice.c +++ b/drivers/soc/qcom/ice.c @@ -262,7 +262,7 @@ static struct qcom_ice *qcom_ice_create(struct device *dev, * Return: ICE pointer on success, NULL if there is no ICE data provided by the * consumer or ERR_PTR() on error. */ -struct qcom_ice *of_qcom_ice_get(struct device *dev) +static struct qcom_ice *of_qcom_ice_get(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct qcom_ice *ice; @@ -323,7 +323,6 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev) return ice; } -EXPORT_SYMBOL_GPL(of_qcom_ice_get); static void qcom_ice_put(const struct qcom_ice *ice) { diff --git a/include/soc/qcom/ice.h b/include/soc/qcom/ice.h index d5f6a228df65..fdf1b5c21eb9 100644 --- a/include/soc/qcom/ice.h +++ b/include/soc/qcom/ice.h @@ -33,7 +33,6 @@ int qcom_ice_program_key(struct qcom_ice *ice, const u8 crypto_key[], u8 data_unit_size, int slot); int qcom_ice_evict_key(struct qcom_ice *ice, int slot); -struct qcom_ice *of_qcom_ice_get(struct device *dev); struct qcom_ice *devm_of_qcom_ice_get(struct device *dev); #endif /* __QCOM_ICE_H__ */