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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1374683282-17517-1-git-send-email-rklein@nvidia.com>
Date:	Wed, 24 Jul 2013 12:28:02 -0400
From:	Rhyland Klein <rklein@...dia.com>
To:	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>
CC:	Joseph Lo <josephl@...dia.com>, <linux-kernel@...r.kernel.org>,
	<linux-tegra@...r.kernel.org>, Rhyland Klein <rklein@...dia.com>
Subject: [PATCH] regulator: palmas: fix pdata ptr not be updated after it has been allocated

The pmic platform data wasn't updated to dev.platform_data after it had
been allocated. That can cause the driver crash when using it.
This patch fixes the issue.

We need to update the pdata pointer at the end of probe because if
probe should fail for some reason, for instance if an in-supply
isn't ready yet, then probe will defer. However, the pdata is allocated
with devm, and so is freed when probe is deferred.

Based on work by Joseph Lo.

Cc: Joseph Lo <josephl@...dia.com>
Signed-off-by: Rhyland Klein <rklein@...dia.com>
---
 drivers/regulator/palmas-regulator.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index d0c8785..e11b762 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -1027,6 +1027,8 @@ static int palmas_regulators_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* Store the pdata pointer after everything else passes */
+	pdev->dev.platform_data = pdata;
 
 	return 0;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ