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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 10 Jun 2022 14:45:32 +0530
From:   "Alim Akhtar" <alim.akhtar@...sung.com>
To:     <linux-kernel@...r.kernel.org>, <linux-phy@...ts.infradead.org>
Cc:     <krzysztof.kozlowski+dt@...aro.org>, <vkoul@...nel.org>,
        <chanho61.park@...sung.com>, <pankaj.dubey@...sung.com>
Subject: RE: [PATCH -next] phy: samsung-ufs: fix NULL pointer dereference

Sorry for the noise.

Please ignore this patch

>-----Original Message-----
>From: Alim Akhtar [mailto:alim.akhtar@...sung.com]
>Sent: Friday, June 10, 2022 12:36 PM
>To: linux-kernel@...r.kernel.org; linux-phy@...ts.infradead.org
>Cc: krzysztof.kozlowski+dt@...aro.org; vkoul@...nel.org;
>chanho61.park@...sung.com; pankaj.dubey@...sung.com; Alim Akhtar
><alim.akhtar@...sung.com>
>Subject: [PATCH -next] phy: samsung-ufs: fix NULL pointer dereference
>
>commit f86c1d0a58b1f63a ("phy: samsung: ufs: remove drvdata from struct
>samsung_ufs_phy")
>
>removes _drvdata_ initialization which resulting in NULL pointer
>dereferencing in samsung_ufs_phy_wait_for_lock_acq(). Fix this by initializing
>drvdata.
>
>The said commit also duplicate "has_symbol_clk" both in drvdata struct and in
>samsung_ufs_phy struct, let's go back and use only one "has_symbol_clk".
>
>Fixes: f86c1d0a58b1 phy: samsung: ufs: remove drvdata from struct
>samsung_ufs_phy
>Signed-off-by: Alim Akhtar <alim.akhtar@...sung.com>
>---
> drivers/phy/samsung/phy-samsung-ufs.c | 6 +++---
>drivers/phy/samsung/phy-samsung-ufs.h | 1 -
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/phy/samsung/phy-samsung-ufs.c
>b/drivers/phy/samsung/phy-samsung-ufs.c
>index 206a79c69a6c..6708877b20d7 100644
>--- a/drivers/phy/samsung/phy-samsung-ufs.c
>+++ b/drivers/phy/samsung/phy-samsung-ufs.c
>@@ -207,7 +207,7 @@ static int samsung_ufs_phy_init(struct phy *phy)
> 	ss_phy->lane_cnt = phy->attrs.bus_width;
> 	ss_phy->ufs_phy_state = CFG_PRE_INIT;
>
>-	if (ss_phy->has_symbol_clk) {
>+	if (ss_phy->drvdata->has_symbol_clk) {
> 		ret = samsung_ufs_phy_symbol_clk_init(ss_phy);
> 		if (ret)
> 			dev_err(ss_phy->dev, "failed to set ufs phy symbol
>clocks\n"); @@ -259,7 +259,7 @@ static int samsung_ufs_phy_exit(struct phy
>*phy)
>
> 	clk_disable_unprepare(ss_phy->ref_clk);
>
>-	if (ss_phy->has_symbol_clk) {
>+	if (ss_phy->drvdata->has_symbol_clk) {
> 		clk_disable_unprepare(ss_phy->tx0_symbol_clk);
> 		clk_disable_unprepare(ss_phy->rx0_symbol_clk);
> 		clk_disable_unprepare(ss_phy->rx1_symbol_clk);
>@@ -327,8 +327,8 @@ static int samsung_ufs_phy_probe(struct
>platform_device *pdev)
>
> 	drvdata = match->data;
> 	phy->dev = dev;
>+	phy->drvdata = drvdata;
> 	phy->cfgs = drvdata->cfgs;
>-	phy->has_symbol_clk = drvdata->has_symbol_clk;
> 	memcpy(&phy->isol, &drvdata->isol, sizeof(phy->isol));
>
> 	if (!of_property_read_u32_index(dev->of_node, "samsung,pmu-
>syscon", 1, diff --git a/drivers/phy/samsung/phy-samsung-ufs.h
>b/drivers/phy/samsung/phy-samsung-ufs.h
>index 854b53bdf347..b9144586daf5 100644
>--- a/drivers/phy/samsung/phy-samsung-ufs.h
>+++ b/drivers/phy/samsung/phy-samsung-ufs.h
>@@ -125,7 +125,6 @@ struct samsung_ufs_phy {
> 	const struct samsung_ufs_phy_drvdata *drvdata;
> 	const struct samsung_ufs_phy_cfg * const *cfgs;
> 	struct samsung_ufs_phy_pmu_isol isol;
>-	bool has_symbol_clk;
> 	u8 lane_cnt;
> 	int ufs_phy_state;
> 	enum phy_mode mode;
>
>base-commit: ff539ac73ea559a8c146d99ab14bfcaddd30547a
>--
>2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ