* [PATCH] usb: isp1760: Add missing error check for platform_get_resource()
@ 2026-02-10 9:02 Chen Ni
2026-02-10 9:35 ` Laurent Pinchart
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chen Ni @ 2026-02-10 9:02 UTC (permalink / raw)
To: rui.silva, gregkh, laurent.pinchart, balbi
Cc: linux-usb, linux-kernel, Chen Ni
Check the return value of platform_get_resource() to prevent potential
NULL pointer dereference when the memory resource is unavailable.
Fixes: 7ef077a8ad35 ("usb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/usb/isp1760/isp1760-if.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/isp1760/isp1760-if.c b/drivers/usb/isp1760/isp1760-if.c
index a64190addba6..60f81ec81373 100644
--- a/drivers/usb/isp1760/isp1760-if.c
+++ b/drivers/usb/isp1760/isp1760-if.c
@@ -196,6 +196,8 @@ static int isp1760_plat_probe(struct platform_device *pdev)
int ret;
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!mem_res)
+ return -EINVAL;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: isp1760: Add missing error check for platform_get_resource()
2026-02-10 9:02 [PATCH] usb: isp1760: Add missing error check for platform_get_resource() Chen Ni
@ 2026-02-10 9:35 ` Laurent Pinchart
2026-02-10 13:45 ` Sergey Shtylyov
2026-02-10 13:55 ` Sergey Shtylyov
2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2026-02-10 9:35 UTC (permalink / raw)
To: Chen Ni; +Cc: rui.silva, gregkh, balbi, linux-usb, linux-kernel
On Tue, Feb 10, 2026 at 05:02:02PM +0800, Chen Ni wrote:
> Check the return value of platform_get_resource() to prevent potential
> NULL pointer dereference when the memory resource is unavailable.
>
> Fixes: 7ef077a8ad35 ("usb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/usb/isp1760/isp1760-if.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/isp1760/isp1760-if.c b/drivers/usb/isp1760/isp1760-if.c
> index a64190addba6..60f81ec81373 100644
> --- a/drivers/usb/isp1760/isp1760-if.c
> +++ b/drivers/usb/isp1760/isp1760-if.c
> @@ -196,6 +196,8 @@ static int isp1760_plat_probe(struct platform_device *pdev)
> int ret;
>
> mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!mem_res)
> + return -EINVAL;
>
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: isp1760: Add missing error check for platform_get_resource()
2026-02-10 9:02 [PATCH] usb: isp1760: Add missing error check for platform_get_resource() Chen Ni
2026-02-10 9:35 ` Laurent Pinchart
@ 2026-02-10 13:45 ` Sergey Shtylyov
2026-02-10 14:00 ` Rui Miguel Silva
2026-02-10 13:55 ` Sergey Shtylyov
2 siblings, 1 reply; 5+ messages in thread
From: Sergey Shtylyov @ 2026-02-10 13:45 UTC (permalink / raw)
To: Chen Ni, rui.silva, gregkh, laurent.pinchart, balbi
Cc: linux-usb, linux-kernel
On 2/10/26 12:02 PM, Chen Ni wrote:
> Check the return value of platform_get_resource() to prevent potential
> NULL pointer dereference when the memory resource is unavailable.
>
> Fixes: 7ef077a8ad35 ("usb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> drivers/usb/isp1760/isp1760-if.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/isp1760/isp1760-if.c b/drivers/usb/isp1760/isp1760-if.c
> index a64190addba6..60f81ec81373 100644
> --- a/drivers/usb/isp1760/isp1760-if.c
> +++ b/drivers/usb/isp1760/isp1760-if.c
> @@ -196,6 +196,8 @@ static int isp1760_plat_probe(struct platform_device *pdev)
> int ret;
>
> mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!mem_res)
> + return -EINVAL;
Isn't it already checked in __devm_ioremap_resource(), called later on?
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: isp1760: Add missing error check for platform_get_resource()
2026-02-10 9:02 [PATCH] usb: isp1760: Add missing error check for platform_get_resource() Chen Ni
2026-02-10 9:35 ` Laurent Pinchart
2026-02-10 13:45 ` Sergey Shtylyov
@ 2026-02-10 13:55 ` Sergey Shtylyov
2 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2026-02-10 13:55 UTC (permalink / raw)
To: Chen Ni, rui.silva, gregkh, laurent.pinchart, balbi
Cc: linux-usb, linux-kernel
On 2/10/26 12:02 PM, Chen Ni wrote:
> Check the return value of platform_get_resource() to prevent potential
> NULL pointer dereference when the memory resource is unavailable.
>
> Fixes: 7ef077a8ad35 ("usb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/")
BTW, I seriously doubt this is the correct commit...
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: isp1760: Add missing error check for platform_get_resource()
2026-02-10 13:45 ` Sergey Shtylyov
@ 2026-02-10 14:00 ` Rui Miguel Silva
0 siblings, 0 replies; 5+ messages in thread
From: Rui Miguel Silva @ 2026-02-10 14:00 UTC (permalink / raw)
To: Sergey Shtylyov, Chen Ni, rui.silva, gregkh, laurent.pinchart,
balbi
Cc: linux-usb, linux-kernel
Hi,
On Tue Feb 10, 2026 at 1:45 PM WET, Sergey Shtylyov wrote:
> On 2/10/26 12:02 PM, Chen Ni wrote:
>
>> Check the return value of platform_get_resource() to prevent potential
>> NULL pointer dereference when the memory resource is unavailable.
>>
>> Fixes: 7ef077a8ad35 ("usb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/")
>> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
>> ---
>> drivers/usb/isp1760/isp1760-if.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/usb/isp1760/isp1760-if.c b/drivers/usb/isp1760/isp1760-if.c
>> index a64190addba6..60f81ec81373 100644
>> --- a/drivers/usb/isp1760/isp1760-if.c
>> +++ b/drivers/usb/isp1760/isp1760-if.c
>> @@ -196,6 +196,8 @@ static int isp1760_plat_probe(struct platform_device *pdev)
>> int ret;
>>
>> mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + if (!mem_res)
>> + return -EINVAL;
>
> Isn't it already checked in __devm_ioremap_resource(), called later on?
Yes, agree, I do not see where the pointer could be NULL dereferenced.
It is validated in devm_ioremap_resource, and the same error propagated.
Cheers,
Rui
>
> [...]
>
> MBR, Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-10 14:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 9:02 [PATCH] usb: isp1760: Add missing error check for platform_get_resource() Chen Ni
2026-02-10 9:35 ` Laurent Pinchart
2026-02-10 13:45 ` Sergey Shtylyov
2026-02-10 14:00 ` Rui Miguel Silva
2026-02-10 13:55 ` Sergey Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox