From: "Alim Akhtar" <alim.akhtar@samsung.com>
To: <linux-kernel@vger.kernel.org>, <linux-phy@lists.infradead.org>
Cc: <krzysztof.kozlowski+dt@linaro.org>, <vkoul@kernel.org>,
<chanho61.park@samsung.com>, <pankaj.dubey@samsung.com>
Subject: RE: [PATCH -next] phy: samsung-ufs: fix NULL pointer dereference
Date: Fri, 10 Jun 2022 14:45:32 +0530 [thread overview]
Message-ID: <000501d87caa$a3ebe520$ebc3af60$@samsung.com> (raw)
In-Reply-To: <20220610070547.71193-1-alim.akhtar@samsung.com>
Sorry for the noise.
Please ignore this patch
>-----Original Message-----
>From: Alim Akhtar [mailto:alim.akhtar@samsung.com]
>Sent: Friday, June 10, 2022 12:36 PM
>To: linux-kernel@vger.kernel.org; linux-phy@lists.infradead.org
>Cc: krzysztof.kozlowski+dt@linaro.org; vkoul@kernel.org;
>chanho61.park@samsung.com; pankaj.dubey@samsung.com; Alim Akhtar
><alim.akhtar@samsung.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@samsung.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
prev parent reply other threads:[~2022-06-10 9:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220610070811epcas5p3c62ef9ad9c82092deac59ff9be896677@epcas5p3.samsung.com>
2022-06-10 7:05 ` [PATCH -next] phy: samsung-ufs: fix NULL pointer dereference Alim Akhtar
2022-06-10 8:15 ` Chanho Park
2022-06-10 9:16 ` Alim Akhtar
2022-06-10 9:15 ` Alim Akhtar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000501d87caa$a3ebe520$ebc3af60$@samsung.com' \
--to=alim.akhtar@samsung.com \
--cc=chanho61.park@samsung.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=pankaj.dubey@samsung.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox