From patchwork Thu Jan 16 14:49:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13941788 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 E75F7146D40 for ; Thu, 16 Jan 2025 14:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038972; cv=none; b=heNTDpUGIbjWTqIAVAfl+Z8obMq0ha79MIwFuVc7VV2Pl8hw1ZXirTWjIOdN17/dNGnx9H+SZjzvnVGZ9U+nS0jFi+RXSHp2D5jIB5YgrWWaVt3RwqfuzjC3IArRl78lY9RL0cs4WhA6R99GYhNuTeTiABH5S/ClQR1rjs8gZAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038972; c=relaxed/simple; bh=yQnJYX0uPLjPaWJCg5DBrwaaox/zrNkiPK9/oReRrBQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SfrQMmcC+YYhkShbII0DtSeTXMVeBMLANKB9h9YUzOp6MFzuyGY/igcRSUpVvhRTEenhsu+L1t1gJ3AJasrlLcegk/hSPk+nPZA/JIANKol/4nIaOvRSRlR++nq8jtjkd8EPNrzOhvqQ9oCz+plSqzaBy+bP2sh05OoDM0qVJHg= 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=l2e090i0; arc=none smtp.client-ip=209.85.128.54 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="l2e090i0" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso6592665e9.3 for ; Thu, 16 Jan 2025 06:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737038967; x=1737643767; 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=IQqtN2LlHzbsYqCaGCM4YS8VgGj6g0tDMtNz77m0JDs=; b=l2e090i0Q8lcEfoEJsWtJ99BHhcbAEsb55xutF1JLErna75gulQL3KLZKfyrms7Mxw fR/DY1GEeSTmhcyJnlEqIWAvRyUhDLs2cKkqSUDI3hemWKNT+oYSuIbHO4YFihycpBZ3 ulB/Dmw9iA4XV65snB9l8q3jAXkcrHgwCRFB7LhKNJGkXMuym7Sj+i8NwRYl1qGDnhz6 NZA9sCEkf1DS8Y1Mzug0Ij410SYnAx90Yql8W0UlZnfN4BaxMgAl6DkJNXpjFZDn0n/7 GU6NBLnKxBTMLctNwHWMamjSH+GjjYjiMrV3ECy//vU34uqgIFlgI+W1BaHOKQweXeiB mRtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737038967; x=1737643767; 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=IQqtN2LlHzbsYqCaGCM4YS8VgGj6g0tDMtNz77m0JDs=; b=rae0yLn99lVEW2BhUOzbZHJLDHNFEwz3nWkyYVKw/laVwW2r2mLBVhkJUfH5V2KWUE 4gCjEF6mh1iTyy7GOceXrpqqTara+xUc8iniI9a0EmRHyfFOWFklzQku8R9oGLDnl9vR qcN3rlMr02hHi5AKV8kMBNzAGrvBa3t6DbV+whsVmAwNat+JlDRgTwgKIkU5WBO5peO1 AwReF3oPyBpY3FBj5F4pzD/v+QasA6mvmMhFR+IoC7wGcUvCaMmr876D5lyougL3UnWt +KgmNdf7iBzaD8i34xb5LL2ELoe9JjQQCfUf9PgOI//lX9CeMIxPiRIOm//npq3EZ0Wd X7IQ== X-Gm-Message-State: AOJu0YwpjUhWcvSgNKL6LqDwqQnPGzzGHghGzFsOhLP0qiUM43aMx7mR qYelVgh0tCPOPTZBoqvtsST0XEEm7fnk6R6b1Av3magWXsSC/qb0YQ1N061cWLI= X-Gm-Gg: ASbGnctknn8b9mM4CKBnaQ3YLdz65INqbHXDH2yBsjMheqcCzeXWAyb/EYZg9lbgzUn rS/uMqgh61aZEHG6XVz3J9WpRmhuoLedRdP5loo8/zUTrDrYrEP1b19rWu1n0Zew20oZ156nDVs uZ+pwcvXTapoES6sHcvln+nCHYtRHUGiSZhiD25A0TklAMd/nzF56pDdwkUd/lySTMauiwYsZuY cCu++cU0W+4/+NXRclqfF3ltSa6R4oPwTCqTRVr9WU1SZdzSKtJr4U2dF22kpR5OwkF93zYCoDb rqJ8Hb8z+nP3w8eK6K0rqscSSk5Cs9zbCHMh X-Google-Smtp-Source: AGHT+IHRJ4zrdb1ZRXErSV709NTqBsRUMyS0Kfg5tPapw4Kqm0cLHb/MJRkLo19NNccX4K+54bKn3Q== X-Received: by 2002:a05:600c:3c82:b0:434:a10f:c3 with SMTP id 5b1f17b1804b1-436e2696082mr301334975e9.9.1737038967196; Thu, 16 Jan 2025 06:49:27 -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 ffacd0b85a97d-38bf321508esm70310f8f.10.2025.01.16.06.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 06:49:26 -0800 (PST) From: Tudor Ambarus Date: Thu, 16 Jan 2025 14:49:05 +0000 Subject: [PATCH 1/4] soc: qcom: ice: introduce devm_of_qcom_ice_get Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250116-qcom-ice-fix-dev-leak-v1-1-84d937683790@linaro.org> References: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@linaro.org> In-Reply-To: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@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=1737038965; l=2250; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=yQnJYX0uPLjPaWJCg5DBrwaaox/zrNkiPK9/oReRrBQ=; b=dvOHW0gq57zT7su0+EvrZUYQUdDDd52T/OiLXmz9qbseW7TNEx8fJuXgbrcX10BK9uz7fBYdf xSVXGVPO2zLA8oEk6fKZbw1aWt2g8ht6yA1GYf/x52/vAjCy7Zwwvs+ 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() to spare consumers of an extra call to put the dev reference. Signed-off-by: Tudor Ambarus --- drivers/soc/qcom/ice.c | 34 ++++++++++++++++++++++++++++++++++ include/soc/qcom/ice.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c index 393d2d1d275f..9cdf0acba6d1 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,39 @@ 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); +} + +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 Thu Jan 16 14:49:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13941787 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 CDBA122B8C2 for ; Thu, 16 Jan 2025 14:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038971; cv=none; b=C5+zbBCajLTCcIdm8RFhXI8HGzVEvX3732SNlX+SCeR8NH6W5iW5ZlVHAB9ytAUzxDnNDF1B9Ddj3Qhgw4hr3DjwhLC+qITteCfF7PBT78jummk5fZYpzu0DTZcJC06WVsE6aLCq/ZsKJpLifDYK+0zf8EdZs8lkw/dw/KeRPAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038971; c=relaxed/simple; bh=Wje1BciONDqQrKQyhp/R22j+9s7pjT1C1mQYS4XxTmo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HUY3O79xLCnFVqxGJrK7+di2kRNhLFPXg+s2GD0pjrJ6w2rAwBtzBLYpb/vgT92uQTRW9G9r8Euin5Hp2VZsfFkI9k9Xh9UVmshnv3Xom3lTrWmJVwFMH7QF2+t+/ylwpWjticMAdBcqj28FGJAsb6Ran9wouCzeD9VwD5xPcJA= 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=cj4BxhIO; arc=none smtp.client-ip=209.85.221.48 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="cj4BxhIO" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-385e3621518so483730f8f.1 for ; Thu, 16 Jan 2025 06:49:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737038968; x=1737643768; 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=rbb6Ezfzp9O8O/V6bl6D5LDxeK+r+UlRD6ckNgY/1gU=; b=cj4BxhIOazRcHCNPKjsyeoxRxz3FuQ4Ok7sBqmWmD1tVSWnG27HKkfrR/NoN8ftx2I VEsUNWMd6b8voWUmiayk67a6BwE6ZAuE7BLfM+cLRX5WUTiB2o5I6CKQIv1MhopaLRoC MbFd3V/x5dGnX6EqIcbFKwDV9pKahE+HZAyFHgsWmGDJO/esypA1uxFBJcqvJyKK0fyS o510CMK33n9WCSv6mOZBx7P5/vALGzjjUF1l1nHVARra/93O7A3uAQYoUxDNpiHmI+jP y4uE6Jb54xEwxChGoUvFhn4IbFLt1eWx5J5my2duEQmmgdzOuX6I1nV9VjwtwTeLFoOQ 2p/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737038968; x=1737643768; 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=rbb6Ezfzp9O8O/V6bl6D5LDxeK+r+UlRD6ckNgY/1gU=; b=ccNRdI0zTXhZRpWOFJ6oROwP5Jkxf5p1GHLS8FHhtnsojeUrJnKmpG89YmxXGonDen XTxUVa5PvgxBAC2jlJXiuJotuPnllCSTnyrJVSQG5TgHkwtG00VHiK9ywbWJsk7qTnSy ts+klNP+86O+fOLib8yvkNkBKeqWq0jRpCQs3JsggGen/vBbaBlDLWAeKx9cS8/VhiF9 OZ7xgPzg2HIpAmUmqNJkdKFlBgKeX7cQWQXH13tfJgjAN8A6i0KW0AdmOXVXZQqF5boN s0vEtUbC3elvtGdyGwc0IZCUCuTQjRV9i/r7zV8htNFHot6XJvY+tfb4NqEQ2CRn5R7k wZ/A== X-Gm-Message-State: AOJu0Yx6IMI9WlPS7+WGNcNK7WxIACg5lm4Oq9ctwxgxLyWvISlAxGeM LD72VFz2rDNFwb/v8gizL4WHaI2HArqH2fmoQG3bko6qEOcJNCAmDYpf076YrSI= X-Gm-Gg: ASbGncuH8lTesuJNFeP0XJBp63dipFQ5UR00mIjzRfO/vfPEdVutivTp3h6WUWea3sN jBCOreLRtevFx5dUYr/SbSocQbra6de41G0xws72VHXA1b5QRZf0tmht8wv1PVK5MsuJ7qsJ2YQ 4b3Xij6bTpyQFkXlthLbJShkPaGZYoK8nOG1Aa2z3nKJCt5N0c67jNuYku8a7Tgvl7wnib6bUtR ixjR6nC3g7VglOSFvxTJwigUyX86G2L402yhiRYBhCYW/02cmF+QIc5BUfwRZu5gddBlZJjOodA WQKqR7pH6HsdiI7xjwD/wuBu6q66alIfyocm X-Google-Smtp-Source: AGHT+IH9TQuJ8S6VwCv/DsUwUueSrMwmdIaON0G+tCnVqhp1ubDleE7CO0HW5JVWQ93mm1BDZ5rH1g== X-Received: by 2002:a05:6000:18a4:b0:38a:a043:eacc with SMTP id ffacd0b85a97d-38aa043ee63mr16034591f8f.1.1737038967915; Thu, 16 Jan 2025 06:49:27 -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 ffacd0b85a97d-38bf321508esm70310f8f.10.2025.01.16.06.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 06:49:27 -0800 (PST) From: Tudor Ambarus Date: Thu, 16 Jan 2025 14:49:06 +0000 Subject: [PATCH 2/4] mmc: sdhci-msm: fix dev reference leaked through of_qcom_ice_get Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250116-qcom-ice-fix-dev-leak-v1-2-84d937683790@linaro.org> References: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@linaro.org> In-Reply-To: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737038965; l=939; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=Wje1BciONDqQrKQyhp/R22j+9s7pjT1C1mQYS4XxTmo=; b=aMMD3l+fSYmaasELHSb630GvEIX81VeJMVo3eY8nHViIArWh5G7STBR9Qc3WZpAaFDvitRjk8 m9LNmbtOIdmDxHTkSnPmHvYOH/JFRZpvuMIE8UrP0vRAQpXFltqIOPi 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 --- 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 Thu Jan 16 14:49:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13941789 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.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 9FED522B8DC for ; Thu, 16 Jan 2025 14:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038973; cv=none; b=NUxKlVxMKUBrVxlOmzo7BGhDNW1VNpYf6hCD2NaCO33c9PvvC6WiTDl/U6agJYGpR9ZqlXp5qUC5qRV+HyK4cut24XgG9y2MqQ2v1/crzlpzwBn5ik8j20HU0MsDVPx1ZiMifjbzET6Jdl6uTCUW1YRlt6OIRxEMRGqomc2v9OA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038973; c=relaxed/simple; bh=mMqcSmFFvw2TkkbHF0Z/tBSpa/sSu9tnGHtQ8tATY60=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cPR6UFi8uNwEy11E0VGUexYGZXFeoIPMdk0qmXSJlnfFuWkABHpF5CUTddnC3xzgx40nYwfGhKWzdsnfAb4BmMe6+lz23XzeMd4gevXySDnBnCB448QUFqMYiE2QuQKetLI3ppt8whqXEDzYFqeCS3+dQ4jz47bTQBJZMvMVc3I= 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=klpmnC8R; arc=none smtp.client-ip=209.85.221.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="klpmnC8R" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-38789e5b6a7so593779f8f.1 for ; Thu, 16 Jan 2025 06:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737038969; x=1737643769; 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=3VDvVHb7Hz9aOiJJ+fFlf31oRvekJW72ufAgH10hVdw=; b=klpmnC8Rc29mih5tU+C64KE486W9gvyUUxMcSb97BRBkhino/vFeLzUI8xBK0L38PU rsDc0fEadxBOI8D7Lsi8p3zd7fGZ9LN7/zPnEXYFG80/3km/cFgrMoNWt4dcqTUoauLM fIt7I8wSz+iOMWpgpjGWqnBLUYpQ2gELlTV/rJaG9XNdx3hp8Zo1XHdK/E6RbcGimMsW fsNpZlE4YpPp89c8WycXOK7qeqeui/tGTxRT+5CqSwF6pnIcarc1gQ0+1Kg+OEJyQG2D WpbACsVqQz9XusnUwJDRTQAh1iqKXCKdhYvniLrFnLVD/ylonoTL90TX9hJJ4sbCZMte UWNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737038969; x=1737643769; 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=3VDvVHb7Hz9aOiJJ+fFlf31oRvekJW72ufAgH10hVdw=; b=HAO74C39TeomC5SoGBZQ4KwWUMSMTSYeBipnZlWMqncFU7XEN37hiIs+AJM+kif7I3 R4oHFu2g21eoG54nJuPZ9CUCJ/SUUY/v+V6wbJm0h53bBzDcr/CPUawO63KTEz7xugtP uCHYkM/hkOG80/J6mHVfSaIcY1cse9C84DAQ/Ns75Jgs0LBNNYCxf06w4Ny2U2H0VbaA fbDqruZl+e2oVKP8hvAo7fuEiyQcEI1Z5mGNDEmR17opNP7icNkL/QxrtUtLz09Vh9zs 139wSmXxFZ1HsNNzNVp/NYZeTYE8ivE2bCBVNCIQazZJfnAcgpWjkq9kh6qVubZ3sNer ydZA== X-Gm-Message-State: AOJu0YxT43g1T5c0Cg0exz8ZxKPYFwLCsbLmJx9j8oyKKgvSrbM4KOyI YcukpyNecbsLYDnh31qMHbxw4AFk3T3ZXUV1DXG9IftFITb4UU4zmRgZsUdISlw= X-Gm-Gg: ASbGnctN/hpsgeTr2bS9ZpoQBsO7ha+Hlvg/MODm0e5VylXr18ABTXM0Fnf7GXFRFU1 fuvy+m3wlrasjLi6R9v0NrpEvXCLyThvuzJRpCBr86x/o4s29kfySYdgjLf3ztWrXtCPAYXewKW ZgCEl6lU4HKE4dE8QAYNETVfN9qAaZWb4ezTH/CXw7IBcTHfmIGRTPfSNhpohqknRZ5UEwJLRH9 NAMBbjmIXFMD/IjMp6gw6j9Hu9jLE4CnNhq2049gpZBOjHBNP/CgFZmedeNGuq7wK9Zb36bnGWN LnKDn+NE7rN94jJa7M6RIYoafGqQbKwQjHu4 X-Google-Smtp-Source: AGHT+IEYjm37I0xC5oyYW1bza4Imter6m0Ap3ye3A3KaXLIpUrnXkIdWfDmQraHXh7LXwIvTqWenkQ== X-Received: by 2002:a05:6000:1862:b0:38a:41a3:218 with SMTP id ffacd0b85a97d-38a8733899emr28060936f8f.36.1737038968835; Thu, 16 Jan 2025 06:49:28 -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 ffacd0b85a97d-38bf321508esm70310f8f.10.2025.01.16.06.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 06:49:28 -0800 (PST) From: Tudor Ambarus Date: Thu, 16 Jan 2025 14:49:07 +0000 Subject: [PATCH 3/4] scsi: ufs: qcom: fix dev reference leaked through of_qcom_ice_get Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250116-qcom-ice-fix-dev-leak-v1-3-84d937683790@linaro.org> References: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@linaro.org> In-Reply-To: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737038965; l=881; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=mMqcSmFFvw2TkkbHF0Z/tBSpa/sSu9tnGHtQ8tATY60=; b=ckw/p8Yr8OAqf94ouXfHUwYbbzLskOGYomyFslWm+iFcOpDzJC0mlpKDWKk8wbQ91TJMNb+5E nC9f+glXfEdCGF3iseCm7YkfK5PJU3TI7PKc9l6rqwoy5fHLepwJFWH 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 --- 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 Thu Jan 16 14:49:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13941790 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 7C1C822C9E2 for ; Thu, 16 Jan 2025 14:49:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038973; cv=none; b=Of1QAXLGDiJJ8+fEnkCT0IRJYUmYe3d7YbSoFU+ZdI9X9IolW3EuQ8tUbVJn28Vu1r3i7eUfq+5oXiky7ZxuQCTyON7/pDEMbgCMlF68lUL7td5yGLwRVpgr9q3WBjJ9mKhZ/zoHqKMWw+t6je49oL2UJMHRhHcBZQ9aW/o9iNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038973; c=relaxed/simple; bh=SLPk0X7feJzjbp6iNB5msnLoDstFDxW+7yuOzADYOIY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DpvY443RxiiBQSCJZowggW1W1C3QLw2F+/oj6hprqbNMy8zwuJxfQDbxl8fNRpL4aDhGJIXoNrukaQytrg2ZeCN/4S6zw2NE5QHNJEveyiaT6pcf6x5p5LLs5iY/kpVZ7ODTq/S5MUKnvP0HBSNIxd1aquwdy5eGxjO4XQmcbxo= 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=k+paxNDI; arc=none smtp.client-ip=209.85.221.50 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="k+paxNDI" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-38634c35129so861153f8f.3 for ; Thu, 16 Jan 2025 06:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737038969; x=1737643769; 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=e7cRMSVWB1iA1Z/E9hbzESrNuj3mM1/u3MbHi16H2W4=; b=k+paxNDIjOxDJgPjAQG1KtidazknNY471iVzSHZQNe6EgPboggEra9/7VcAlUw7/o8 fY5tDLXNNxoIfYERctcld0qybKoLCBy5gfdMaWR2LpefZTo6J+Z9ytcHocx+O3VDxInC 3mqZxcLEemohTrWZBpxHrbvB8ONTmm4gUXB5vvzEr7WQXl6ESFPiuc/U2XhUZRLI/9bS IPm3I83AR8ub4NYD2Z8WBUJN+aoZToBv0cvpiiNvGzhH3d6zPrEGQGFtaZt30uHSYO/9 q706kNsf99ulZQCS0aOYibKgTuvitR7LNS8OblVZLa3PkQLGDhGcu78k/OzPWbIrgbeH u6qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737038969; x=1737643769; 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=e7cRMSVWB1iA1Z/E9hbzESrNuj3mM1/u3MbHi16H2W4=; b=GB0J4oOcZYajwNckjI5NAAW/Y5+clYufusg7lw+X306AS8QRk2MT0WsqdlGhUPr27N 70WJxI207QGT2cZqWmRWCDaSPdNTDMsF8rtWWRX2VzY6R3/YFBRZuSaV0eB3b6ljfalL QuxVfpfBquQ9W32PcAZBZjXT5jcx/J1E8CbHQ8s5A03WFi1PdW336ArtBkP/TSWCkG3N FpCRAjRCsAJ7ny6XhWLFVAMLB8imcMD6OXYHQy/PKUMsJnfXoOk13Pn0mPFEZY9VpFND qdDNsiuGvV/j/0fQNw6Nifd9tPhAZHBJ3BGADRxBeOIGSYXZ0By5Hf/QMB1AI0NQTWv5 1uWA== X-Gm-Message-State: AOJu0YwTpR1mMjc6iU/WpsmR9l1hE5qCsw0N7ObsRRn/w2Vj2E6ZuE3R bN03VZczwAVzrmr8U4VqieueS9kVHkh284J9BX26dTY9MYs116MqBZu4uO/dWvY= X-Gm-Gg: ASbGncvg7LnKq160iH7z8v/8z/zLBU+R/2zJLWn5CpI2uX0EgjnbbkUMFeVinWM8LQP cNAa0T1jecYCTI6EyV5XjD7Xr1a+baJ5x8PHmrfJWGdfJWc79SYlJAAxjd8VtK3TN9GA/8Kc20p +yBkAbXkvKrTclNRA36vUbvQq1vpvK3mT8szXEmNGJnf6Hr712eCuhW3Myy1STmli+N8pLIkQo4 l5utMQ8lmZ16Gdars+QgS6eKZGMy9y75jelE65+OKTll9rJFGABDjjflBH/MilB+G8N5XwqjGFW 0UkGBuYoho77uV3rARkpHaslL++x23WYcKUG X-Google-Smtp-Source: AGHT+IGuLmvbYhQXQ99Ngdjm7P7XXhs6Xz5bChZGEdZB5e+12utWg4WoIKuw3R2n6RN9NlrJ92GEfA== X-Received: by 2002:adf:a3c7:0:b0:38a:88d0:18d6 with SMTP id ffacd0b85a97d-38a88d018dcmr19384870f8f.42.1737038969571; Thu, 16 Jan 2025 06:49:29 -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 ffacd0b85a97d-38bf321508esm70310f8f.10.2025.01.16.06.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 06:49:29 -0800 (PST) From: Tudor Ambarus Date: Thu, 16 Jan 2025 14:49:08 +0000 Subject: [PATCH 4/4] soc: qcom: ice: make of_qcom_ice_get() static Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250116-qcom-ice-fix-dev-leak-v1-4-84d937683790@linaro.org> References: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@linaro.org> In-Reply-To: <20250116-qcom-ice-fix-dev-leak-v1-0-84d937683790@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=1737038965; l=1554; i=tudor.ambarus@linaro.org; s=20241212; h=from:subject:message-id; bh=SLPk0X7feJzjbp6iNB5msnLoDstFDxW+7yuOzADYOIY=; b=G8iEARZbH9wv6CQbJi1hOS5u+HYxxskB3G6McP5l6dHKR3FG9vTnp5n4BD0jqXTdLl4BSdAzC 4JF38mDEPEmDQ7SXoKyDlewZGuD6XTgwZIpVqagkG1RWcJfa0FQRTzo 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 --- 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 9cdf0acba6d1..1a2f77cc7175 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__ */