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: 13941782 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 0869922B8A2 for ; Thu, 16 Jan 2025 14:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038971; cv=none; b=DqGM6P/1QE2OCj793Vjkcc+fnCKdkHkstcM9Gj1i0wBCz5xo/onMvaiuNSISQoL8tSG1LTFpmsuiJafz7uF1tOSDtuT1uG7hXh9rQje1DMzQWDomf3oxsCodYyPYwKd9kmTH1h7+PikNWyZjUQuQjYhBFlw+/6ZW9A6b4jl7uDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038971; c=relaxed/simple; bh=yQnJYX0uPLjPaWJCg5DBrwaaox/zrNkiPK9/oReRrBQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bAiSC1KSsIFPRx5ZX3os88HAxn5cV5SUikizbP5LOmGgeevzamwhkaHBoy7yV1td/2aJwa2SUc3IySfBmKT8rvm6pgqMwYX8iRoqBsxnpnsPs/2c8ES13LYMyKITlzU1JJPXauHu7EMqSdSw8CQnsUB6tyhiCvkxfMtHz5rgrBU= 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.45 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-f45.google.com with SMTP id 5b1f17b1804b1-43623f0c574so6603655e9.2 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=g5XIl7i7X1P6u26px75mPvFQggE6prAbfvPsnI2KqOGSin/KT94UNqEeiPkKhInUWx HiH/dUTZjr2qURGus4IdKzdy/gPOKVOTQRHbMDYsKdkB9T0+GedWD8hmhsfm/WfUcTes dUpGUQZQLW+53kk5FAiI2wRS9UBbKxZojZsJ/fgIIceisDv2UbPHOK2CvSPYNZaEHb90 sb22Tp2GZomGrJStGAFRBCV3c1ShIU7Ycnqq0RfQMokr9axHYCYhqPXZi34KMmPzRNPG 9UCNC89A8Rag9jUaUHqpSMFkB500bcx5gwEhvMDDCNhRlZK8PN+4lt2eP+38Z0oAFdWE lISw== X-Forwarded-Encrypted: i=1; AJvYcCUEJFToYRagSmOiF0TjQONOZd7xN9Pn3jL6aJleThSTrjfc/x7awkCDmIx71quJ2ark6ctIg1K57do=@vger.kernel.org X-Gm-Message-State: AOJu0YyXbiKjHfTQ4aL9xWaafq035F344vOcNRfomQSvMuKlhOWZtw3e vde1VTw6f5cOBF+RRYI0ja5lMgbZ7YCph3iZONR1TKkRB3dcgcx5IhKhJYSPWj8= X-Gm-Gg: ASbGncupBan03IHLP4EDo8SlbUQaefbiC+JxsDYt2U4z+zF7RUhVpSk7R1u3SAZN+hh BKuA7LJfhlcAG2sNN5+uZi5pnf6MP1bYYn9hlcSRvwJrWxKQ2LUPXv3O0FodIzcBjthiKXJoikz e0JwNQFZMyIPyhIUButL+9I5vNGTtSjkyFc9ri11DqDLtan3Pmd0QNKcXVaQnNVnWlbR1BbN7JL S9AAcoC1SHT2uiC4R6NFDfpvK5zDPM+eGPDOL5DqbVLAIc4Pcb638r3KNvkY58OHC5eA/V52vg8 qeqcU3V4lZtGjoqsvlBGhj12agOx/gYbLosZ 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-mmc@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: 13941783 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.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 C46CA22B8B4 for ; Thu, 16 Jan 2025 14:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038972; cv=none; b=hfsmkS4Sl6ShKEL0LcP3THioCBYKTT3hpDJwjZ5zNpLbAkO6EFAHVoMPT4EcBiCUTY9xf13i5QVtQbciEBY4YCVAdTgwE55DuUH0zB55+tqSA8BDPXCUnhhBQIfScgQMv2qS9eP2nZSkTPaYVRX5gfp9ZLBzXg3PehgdroFP94Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038972; c=relaxed/simple; bh=Wje1BciONDqQrKQyhp/R22j+9s7pjT1C1mQYS4XxTmo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c8RNtS0yrmrKY2W2iot3MJsBst1QBGmAIdBSLGxaty0PXFw2lUqCGKQAFtx6fH/WIQ1iNoLJw+ok03rCrxRg7btb5Tr7ZyHPG9JbC8m8uD2sMGXpEHg2Tsw82jox3eUYZ1A1lVQkiVj6G/Zk1U+qBhUJx99E8pnE7Lrk2kp6Nss= 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.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="cj4BxhIO" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3862d161947so572481f8f.3 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=AvS2JIKXrPVA1tzmbShgWgfdXMFqNgfCImMKjVBm8r2VARHzE+Ryew+eS7Zu9l8+8z kXifuUfHXbsh4t5st9WCg7warYupo0mBF/+RdqeYNZ4INw1KPwiWnPBC12TIn+R4P20u qOeWV0kjQDGXC69GQkKLrlFLgntI6NFDwIKXD8gVKna6km+N/GBnTeTq5tx0RC5DaALU 5qTptI0eX4xx42eqRw2fCu4E+lU3N5gAOmVWpR9WkKPf8jPx8nUNSEFFQHztTWLo+VZf 3zfksSHIi7yTqRgSXrFCrcWCthEpf/Zq43Jmg8nRlq8hJOiOxsuif/SGfTrS7utkTnw9 rvgQ== X-Forwarded-Encrypted: i=1; AJvYcCWuGOdYIozcU1AWKTk9QrE/YpNvkFkmsvWhb400tUWDnJIqJZFldFBZZxL38LjmVk4didp8AeijpwU=@vger.kernel.org X-Gm-Message-State: AOJu0YwUb4gD2dVED9ILR04QegEwnx2gaSzYO3F58MC8vZSh3YmsjfES ZcnYK4ltzlrRcUSliz/+20+AK6qBuJXefPuievMovC1H2e5sYC70WI+fEfgfjfg= X-Gm-Gg: ASbGnctRAyfzNwC8oSvadcb2srbVoh1uXte9csWMY6VHGU0DqSclWurXEC/+tu0qbnv 0n3JUTeC32tJMgepamC/FDo3xbUxeR7pwig/R/8X7rjj0Q6aWOXODVSjdNdI+8Loa5vCbQlM7S2 a2TtrdbC6Pyc5eJKGasSThAegA8Dhbw031Gs4tZKhW0dLCes87ZOVgsTJ10QI7+FnmfZsFNDS0G C/4fZE+w07zu5jmMZqm5cJPUp47AsBSersCGz9dJB1leY3bcU+i/idIBN9zm15E4ppE34KO6oNp xplda948XCy5KHOnCSvRdMtStiWRSBYODXbC 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-mmc@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: 13941784 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 9910D22B8D9 for ; Thu, 16 Jan 2025 14:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038973; cv=none; b=k7w7YLpdaZFe+9oRO12GCxxoZVoXH+ByyMEHyIqhY0DYfiy7ig0Y4ewKpMVUbBOVrWLblLMrmYzuybdKOlLrOmGRhx0NOuB4nOg5w8fQLSufDSvbWqTVj+D/EPnWaSNTz5WAFbSQEmD7kEWiyyH5zB+MIaY5ctPwps0S2Qhk2PY= 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.46 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-f46.google.com with SMTP id ffacd0b85a97d-385e06af753so565286f8f.2 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=aqspNT9EGXDku5nzSz05mP+YdLW5A4f8XgImoMHmZIGcF+oar5qxDxNA4KC3armXXS VUlhrpPOTuWGy654XcHgGOKJ/FpmLZi3nDJeVEH1PaFNy9oOZArPnuiDwFRhVI+DmWak y1Vr1pluffXazh8MLA5+lo4uxt4hg+b0vzWKktvfPXtGMb78zbRsuPDRxRh889D144JB Na/7tDAA8c7AGrvXPkvyPKDu9XZEgWs9JBKP2fNZlWy1QMedej8UyJv9KCDv/1s+VMU5 pNazQ9tXGdbR5pzEV7oe4PM5LVguCroWRArcYLOX/Qv7aaUwT64Mpv18icaviZAF5E09 6ypQ== X-Forwarded-Encrypted: i=1; AJvYcCWKHaS+sQusVxDJ1ADfCE+Jx3aVDTpRYx5fau+Abytwqy0I28NLe37ng8QqTu/a5gyt1YKroPLXx6Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2Ae8A6h0InXLhVfx8YcFArvDJFohfRJbTcyTm1C6DoPb+7W14 25kcbSurERfsUiqkW+hdBhPdIbwxk13m6JaY4BxnFTM5bxTteQUlpCEjbUfbU0o= X-Gm-Gg: ASbGncucDbd/56oQfOEuNAZRJYgEluw1j8LGBctFnMA0W1z+Pr9pOlo9/gTqzc64eiP k0kC2b3SZtTEiyKhVpQukxQCp2XI0bEah5Y5tTshR1Ru+2IeC4410T2Rfijn13KUyArUemsuiZN 4osJjgUZXkTwMH4d7U6DKNEdvLI2fB0LeyvPlWacZHe3NgUvAKJ6hH8hNBd/HcU/FBNEIotLM4A 4jLX7Xt60Fii761GXL8mJsRjHIUbcx0l5vKVWWvUlOEOSIXo8fyeBysN8VSrsJchYS+evK1Datg dsAp4o5BgEXnP1Sa8gg6FBYsxe0QGztpqaQ8 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-mmc@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: 13941785 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.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 7833122C9E0 for ; Thu, 16 Jan 2025 14:49:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737038973; cv=none; b=cuthqqRJc/9Ot3o7oPpmMCfBbFOg4Mi5NW21BKBsCUwfw8ZzW03dVfMF/H5GkZiKR5iTxII6FGYROREVEdWrZAAxxoBrPx5n8XE795JLUEDqM6COyJICd1pv31tJpE95/FovEAs91oSZARPdOWdJHQTn8wBlcXkjFOaW18bXt2Q= 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.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="k+paxNDI" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3863c36a731so885214f8f.1 for ; Thu, 16 Jan 2025 06:49:31 -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=DBfEL387OrysqwyU/Th0iST2T/U+GvZ1xhCbYyvmUsE+59MmXFlEzqCrVSf5DSD4fB uJ+ot28dF207ySh+ewQWKjD1suEm+d4BWsAYq+06gnKehNv3y14n1JbhrrmWTzteclCk sUhugYaS5LvuIA3OE6a06GLzF5TvBqaCiDSvb0+ND1ip4CXFCt6niD/LqzFq4VTxxkWh U5X2rBvcHyYtcjRAWI8EdqcL47XaTT1slKeVNF16nMv586z+LTpJXdQDKF/PTp2jrXif zZbSaITohko47N4oInaF8c+73iuTDCYGk16TzC8p8AJDvx7G3Gpj8g7Md5bx9FfZBl8g AXQg== X-Forwarded-Encrypted: i=1; AJvYcCUFFDi5AvMAWogFVh1WiIoe956516C3kuLrw06QhzFImeBzK0DEPW2W6zZbKffEQfpjMwRQbbDdRoI=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6J6pKOXIfHyar315+b/b/yA9rVsTCWOCN5g3ZQy2Ul/04Ri5g LV943iTj70gNUuS9qVIrB3q0sEQrKk7Ottdn7HyOReCf/9V6U8CVwUoGGadUNUE= X-Gm-Gg: ASbGnctmam4ykyMhmNaa1/zweoML4yAre0WaZQVsP8AtzPSfwXYGKuMaBkSRIy0KFoL bgh+TXMPEOJgAS73Y0yaa7+iKfLGIZ3bRXY32RPvroVqM+EwHsLiCzE6t7Ag+Aj/8EU1csP3ZxC lHabR6OGahb+O23UtZ6nnyr8DUrmrYBjwbJf7prn4InNwySCpaDMvevFbUV5MEDw9gE+TyDdIsd j8dNwjOdSA8mz7x2+CoyLKugC2AlVkck+vZ5AivT0pFci7LxlV6DGoZDQ/i6Y1PVewWWFJ/7w2B O7uB6WoDp3dn3UrNZIJ7tk5uzPggiITEXqMT 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-mmc@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__ */