mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	<linux-samsung-soc@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>
Subject: Re: [PATCH] phy: core: Fix error path in devm_of_phy_get()
Date: Fri, 10 Jan 2020 16:32:36 +0530	[thread overview]
Message-ID: <4c612381-55c1-635a-d40d-e1bb3aa60998@ti.com> (raw)
In-Reply-To: <20200108132342.14635-1-m.szyprowski@samsung.com>



On 08/01/20 6:53 PM, Marek Szyprowski wrote:
> Commit 5253fe05bb47 ("phy: core: Add consumer device link support") added
> support for consumer device links, but it missed proper update for error
> handling in devm_of_phy_get(). Fix this by adding proper return statement.
> 
> This patch fixes the following invalid pointer dereference on
> Exynos5250-based Arndale board with multi_v7_defconfig:
> 
> 8<--- cut here ---
> Unable to handle kernel paging request at virtual address fffffe7f
> pgd = (ptrval)
> [fffffe7f] *pgd=6ffff841, *pte=00000000, *ppte=00000000
> Internal error: Oops: 27 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc5-next-20200108 #167
> Hardware name: Samsung Exynos (Flattened Device Tree)
> PC is at device_link_add+0x68/0x4c4
> LR is at device_link_add+0x68/0x4c4
> ...
> Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
> ...
> [<c0984d70>] (device_link_add) from [<c0707e8c>] (devm_of_phy_get+0x6c/0xb0)
> [<c0707e8c>] (devm_of_phy_get) from [<c0a0deb8>] (ahci_platform_get_phy+0x28/0xe0)
> [<c0a0deb8>] (ahci_platform_get_phy) from [<c0a0e64c>] (ahci_platform_get_resources+0x398/0x48c)
> [<c0a0e64c>] (ahci_platform_get_resources) from [<c0a0daec>] (ahci_probe+0x14/0xb4)
> [<c0a0daec>] (ahci_probe) from [<c098a1ec>] (platform_drv_probe+0x48/0x9c)
> [<c098a1ec>] (platform_drv_probe) from [<c0988214>] (really_probe+0x1dc/0x33c)
> [<c0988214>] (really_probe) from [<c09884f4>] (driver_probe_device+0x60/0x164)
> [<c09884f4>] (driver_probe_device) from [<c09887a0>] (device_driver_attach+0x58/0x60)
> [<c09887a0>] (device_driver_attach) from [<c0988828>] (__driver_attach+0x80/0xbc)
> [<c0988828>] (__driver_attach) from [<c09865b4>] (bus_for_each_dev+0x68/0xb4)
> [<c09865b4>] (bus_for_each_dev) from [<c0987594>] (bus_add_driver+0x160/0x1e4)
> [<c0987594>] (bus_add_driver) from [<c09892c0>] (driver_register+0x78/0x10c)
> [<c09892c0>] (driver_register) from [<c0302f14>] (do_one_initcall+0x54/0x220)
> [<c0302f14>] (do_one_initcall) from [<c1500f4c>] (kernel_init_freeable+0x150/0x1b4)
> [<c1500f4c>] (kernel_init_freeable) from [<c0ef6b34>] (kernel_init+0x8/0x10c)
> [<c0ef6b34>] (kernel_init) from [<c03010e8>] (ret_from_fork+0x14/0x2c)

I've already merged a patch fixing this.

Thanks
Kishon

> ...
> 
> Fixes: 5253fe05bb47 ("phy: core: Add consumer device link support")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/phy/phy-core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 8dfb4868c8c3..2eb28cc2d2dc 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -799,6 +799,7 @@ struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
>  		devres_add(dev, ptr);
>  	} else {
>  		devres_free(ptr);
> +		return phy;
>  	}
>  
>  	link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
> 

      reply	other threads:[~2020-01-10 11:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200108132350eucas1p1476f4aa038dbf5ea199b84c5c82a25a5@eucas1p1.samsung.com>
2020-01-08 13:23 ` Marek Szyprowski
2020-01-10 11:02   ` Kishon Vijay Abraham I [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=4c612381-55c1-635a-d40d-e1bb3aa60998@ti.com \
    --to=kishon@ti.com \
    --cc=alexandre.torgue@st.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /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

all inboxes | Powered by JetHome®