All of lore.kernel.org
 help / color / mirror / Atom feed
From: Selvarasu Ganesan <selvarasu.g@samsung.com>
To: "André Draszik" <andre.draszik@linaro.org>,
	vkoul@kernel.org, neil.armstrong@linaro.org, krzk@kernel.org,
	peter.griffin@linaro.org, alim.akhtar@samsung.com,
	pritam.sutar@samsung.com, kernel@lvkasz.us,
	linux-phy@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jh0801.jung@samsung.com, dh10.jung@samsung.com,
	akash.m5@samsung.com, muhammed.ali@samsung.com,
	thiagu.r@samsung.com
Subject: Re: [PATCH] phy: exynos5-usbdrd: Use dynamic phy_cfg size to prevent OOB access
Date: Fri, 18 Sep 2026 15:51:08 +0530	[thread overview]
Message-ID: <32029c62-faad-42e3-b1bb-e66772ca8ac0@samsung.com> (raw)
In-Reply-To: <950335110f9d9c22a026fa5174e492c4194299a5.camel@linaro.org>


On 9/18/2026 2:04 PM, André Draszik wrote:
> On Mon, 2026-08-31 at 12:33 +0530, Selvarasu Ganesan wrote:
>> The probe loop currently iterates using EXYNOS5_DRDPHYS_NUM (2),
>> creating both UTMI and PIPE3 PHY instances regardless of the SoC
>> capability. Several SoCs (Exynos2200, Exynos7870, Exynos850, Exynos990,
>> and ExynosAutoV920) provide phy_cfg arrays containing only a single
>> element.
>>
>> On these SoCs, when the loop reaches index 1, the driver reads past the
>> end of the rodata array, populating the second PHY instance with garbage
>> data. Since the configuration structure contains critical function
>> pointers (phy_isol, phy_init, set_refclk), any subsequent access to this
>> PHY instance via exynos5_usbdrd_phy_xlate could result in a kernel oops.
>>
>> Fix this by adding 'n_phy_cfg' to struct exynos5_usbdrd_phy_drvdata to
>> store the actual size of the phy_cfg array for each SoC. Update the
>> probe loop and the xlate function to bound their access against this
>> value instead of the hardcoded EXYNOS5_DRDPHYS_NUM.
>>
>> Assisted-by: Claude:claude-sonnet-5
> Shouldn't this be 'Assisted-by: LLM'?
You are correct. I will update the tag to 'Assisted-by: LLM' as per the 
kernel documentation in the next version.

Thank you for pointing this out.

Thanks,
Selva
>
>> Signed-off-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
>> ---
>>   drivers/phy/samsung/phy-exynos5-usbdrd.c | 17 +++++++++++++++--
>>   1 file changed, 15 insertions(+), 2 deletions(-)
> Other than that:
>
> Reviewed-by: André Draszik <andre.draszik@linaro.org>

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: Selvarasu Ganesan <selvarasu.g@samsung.com>
To: "André Draszik" <andre.draszik@linaro.org>,
	vkoul@kernel.org, neil.armstrong@linaro.org, krzk@kernel.org,
	peter.griffin@linaro.org, alim.akhtar@samsung.com,
	pritam.sutar@samsung.com, kernel@lvkasz.us,
	linux-phy@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jh0801.jung@samsung.com, dh10.jung@samsung.com,
	akash.m5@samsung.com, muhammed.ali@samsung.com,
	thiagu.r@samsung.com
Subject: Re: [PATCH] phy: exynos5-usbdrd: Use dynamic phy_cfg size to prevent OOB access
Date: Fri, 18 Sep 2026 15:51:08 +0530	[thread overview]
Message-ID: <32029c62-faad-42e3-b1bb-e66772ca8ac0@samsung.com> (raw)
In-Reply-To: <950335110f9d9c22a026fa5174e492c4194299a5.camel@linaro.org>


On 9/18/2026 2:04 PM, André Draszik wrote:
> On Mon, 2026-08-31 at 12:33 +0530, Selvarasu Ganesan wrote:
>> The probe loop currently iterates using EXYNOS5_DRDPHYS_NUM (2),
>> creating both UTMI and PIPE3 PHY instances regardless of the SoC
>> capability. Several SoCs (Exynos2200, Exynos7870, Exynos850, Exynos990,
>> and ExynosAutoV920) provide phy_cfg arrays containing only a single
>> element.
>>
>> On these SoCs, when the loop reaches index 1, the driver reads past the
>> end of the rodata array, populating the second PHY instance with garbage
>> data. Since the configuration structure contains critical function
>> pointers (phy_isol, phy_init, set_refclk), any subsequent access to this
>> PHY instance via exynos5_usbdrd_phy_xlate could result in a kernel oops.
>>
>> Fix this by adding 'n_phy_cfg' to struct exynos5_usbdrd_phy_drvdata to
>> store the actual size of the phy_cfg array for each SoC. Update the
>> probe loop and the xlate function to bound their access against this
>> value instead of the hardcoded EXYNOS5_DRDPHYS_NUM.
>>
>> Assisted-by: Claude:claude-sonnet-5
> Shouldn't this be 'Assisted-by: LLM'?
You are correct. I will update the tag to 'Assisted-by: LLM' as per the 
kernel documentation in the next version.

Thank you for pointing this out.

Thanks,
Selva
>
>> Signed-off-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
>> ---
>>   drivers/phy/samsung/phy-exynos5-usbdrd.c | 17 +++++++++++++++--
>>   1 file changed, 15 insertions(+), 2 deletions(-)
> Other than that:
>
> Reviewed-by: André Draszik <andre.draszik@linaro.org>


  reply	other threads:[~2026-09-18 10:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260831070349epcas5p4c62a4e46592dffe95723ddd51a6068e0@epcas5p4.samsung.com>
2026-08-31  7:03 ` [PATCH] phy: exynos5-usbdrd: Use dynamic phy_cfg size to prevent OOB access Selvarasu Ganesan
2026-08-31  7:03   ` Selvarasu Ganesan
2026-09-02  0:04   ` Łukasz Lebiedziński
2026-09-02  0:04     ` Łukasz Lebiedziński
2026-09-03  3:43     ` Selvarasu Ganesan
2026-09-03  3:43       ` Selvarasu Ganesan
2026-09-15  5:53   ` Alim Akhtar
2026-09-15  5:53     ` Alim Akhtar
2026-09-15 14:38   ` Peter Griffin
2026-09-15 14:38     ` Peter Griffin
2026-09-18  8:34   ` André Draszik
2026-09-18  8:34     ` André Draszik
2026-09-18 10:21     ` Selvarasu Ganesan [this message]
2026-09-18 10:21       ` Selvarasu Ganesan

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=32029c62-faad-42e3-b1bb-e66772ca8ac0@samsung.com \
    --to=selvarasu.g@samsung.com \
    --cc=akash.m5@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andre.draszik@linaro.org \
    --cc=dh10.jung@samsung.com \
    --cc=jh0801.jung@samsung.com \
    --cc=kernel@lvkasz.us \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=muhammed.ali@samsung.com \
    --cc=neil.armstrong@linaro.org \
    --cc=peter.griffin@linaro.org \
    --cc=pritam.sutar@samsung.com \
    --cc=thiagu.r@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.