lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170315114357.14446-1-j.neuschaefer@gmx.net>
Date:   Wed, 15 Mar 2017 12:43:56 +0100
From:   Jonathan Neuschäfer <j.neuschaefer@....net>
To:     linux-arm-msm@...r.kernel.org
Cc:     Bjorn Andersson <bjorn.andersson@...aro.org>,
        linux-soc@...r.kernel.org, Andy Gross <andy.gross@...aro.org>,
        David Brown <david.brown@...aro.org>,
        linux-kernel@...r.kernel.org,
        Jonathan Neuschäfer <j.neuschaefer@....net>
Subject: [PATCH 1/2] soc: qcom: smsm: Handle probe deferral

If qcom_smem_get or qcom_smem_alloc return -EPROBE_DEFER, let the caller
the caller handle it, instead of treating it as an error.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@....net>

---
v1:
- TODO: Reading qcom_smsm_probe, I noticed memory leaks in error paths:
  smsm, smsm->entries, etc. are allocated (with devm_kzalloc), but not
  freed when the function returns early. This should be addressed at
  some point (in a separate patch).
---
 drivers/soc/qcom/smsm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index d0337b2a71c8..3918645e5708 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -439,7 +439,9 @@ static int smsm_get_size_info(struct qcom_smsm *smsm)
 	} *info;
 
 	info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SIZE_INFO, &size);
-	if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) {
+	if (PTR_ERR(info) == -EPROBE_DEFER) {
+		return PTR_ERR(info);
+	} else if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) {
 		dev_warn(smsm->dev, "no smsm size info, using defaults\n");
 		smsm->num_entries = SMSM_DEFAULT_NUM_ENTRIES;
 		smsm->num_hosts = SMSM_DEFAULT_NUM_HOSTS;
@@ -515,7 +517,9 @@ static int qcom_smsm_probe(struct platform_device *pdev)
 	/* Acquire the main SMSM state vector */
 	ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SHARED_STATE,
 			      smsm->num_entries * sizeof(u32));
-	if (ret < 0 && ret != -EEXIST) {
+	if (ret == -EPROBE_DEFER) {
+		return ret;
+	} else if (ret < 0 && ret != -EEXIST) {
 		dev_err(&pdev->dev, "unable to allocate shared state entry\n");
 		return ret;
 	}
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ