linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] staging: vc04_services: vchiq_arm: Fix NULL ptr dereferences
@ 2024-04-20  9:12 Stefan Wahren
  2024-04-20 10:54 ` Laurent Pinchart
  2024-04-21  8:49 ` Umang Jain
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Wahren @ 2024-04-20  9:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Florian Fainelli
  Cc: Umang Jain, Laurent Pinchart, linux-staging, linux-arm-kernel,
	Stefan Wahren

The commit 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop
g_cache_line_size") introduced NULL pointer dereferences by
using the wrong device.

Fixes: 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop g_cache_line_size")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---

Changes in V2:
- drop cosmetic changes as noticed by Laurent

 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 502ddc0f6e46..c06232fcb0fb 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -257,7 +257,7 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf,
 	if (count >= INT_MAX - PAGE_SIZE)
 		return NULL;

-	drv_mgmt = dev_get_drvdata(instance->state->dev->parent);
+	drv_mgmt = dev_get_drvdata(instance->state->dev);

 	if (buf)
 		offset = (uintptr_t)buf & (PAGE_SIZE - 1);
@@ -436,7 +436,7 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel

 	dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, actual);

-	drv_mgmt = dev_get_drvdata(instance->state->dev->parent);
+	drv_mgmt = dev_get_drvdata(instance->state->dev);

 	/*
 	 * NOTE: dma_unmap_sg must be called before the
--
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] staging: vc04_services: vchiq_arm: Fix NULL ptr dereferences
  2024-04-20  9:12 [PATCH V2] staging: vc04_services: vchiq_arm: Fix NULL ptr dereferences Stefan Wahren
@ 2024-04-20 10:54 ` Laurent Pinchart
  2024-04-21  8:49 ` Umang Jain
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2024-04-20 10:54 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Greg Kroah-Hartman, Florian Fainelli, Umang Jain, linux-staging,
	linux-arm-kernel

Hi Stefan,

Thank you for the patch.

On Sat, Apr 20, 2024 at 11:12:40AM +0200, Stefan Wahren wrote:
> The commit 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop
> g_cache_line_size") introduced NULL pointer dereferences by
> using the wrong device.
> 
> Fixes: 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop g_cache_line_size")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> 
> Changes in V2:
> - drop cosmetic changes as noticed by Laurent
> 
>  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 502ddc0f6e46..c06232fcb0fb 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -257,7 +257,7 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf,
>  	if (count >= INT_MAX - PAGE_SIZE)
>  		return NULL;
> 
> -	drv_mgmt = dev_get_drvdata(instance->state->dev->parent);
> +	drv_mgmt = dev_get_drvdata(instance->state->dev);
> 
>  	if (buf)
>  		offset = (uintptr_t)buf & (PAGE_SIZE - 1);
> @@ -436,7 +436,7 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel
> 
>  	dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, actual);
> 
> -	drv_mgmt = dev_get_drvdata(instance->state->dev->parent);
> +	drv_mgmt = dev_get_drvdata(instance->state->dev);
> 
>  	/*
>  	 * NOTE: dma_unmap_sg must be called before the

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] staging: vc04_services: vchiq_arm: Fix NULL ptr dereferences
  2024-04-20  9:12 [PATCH V2] staging: vc04_services: vchiq_arm: Fix NULL ptr dereferences Stefan Wahren
  2024-04-20 10:54 ` Laurent Pinchart
@ 2024-04-21  8:49 ` Umang Jain
  1 sibling, 0 replies; 3+ messages in thread
From: Umang Jain @ 2024-04-21  8:49 UTC (permalink / raw)
  To: Stefan Wahren, Greg Kroah-Hartman, Florian Fainelli
  Cc: Laurent Pinchart, linux-staging, linux-arm-kernel

Hi Stefan,

Thank you for the fix

On 20/04/24 2:42 pm, Stefan Wahren wrote:
> The commit 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop
> g_cache_line_size") introduced NULL pointer dereferences by
> using the wrong device.
>
> Fixes: 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop g_cache_line_size")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>
> Changes in V2:
> - drop cosmetic changes as noticed by Laurent
>
>   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 502ddc0f6e46..c06232fcb0fb 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -257,7 +257,7 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf,
>   	if (count >= INT_MAX - PAGE_SIZE)
>   		return NULL;
>
> -	drv_mgmt = dev_get_drvdata(instance->state->dev->parent);
> +	drv_mgmt = dev_get_drvdata(instance->state->dev);
>
>   	if (buf)
>   		offset = (uintptr_t)buf & (PAGE_SIZE - 1);
> @@ -436,7 +436,7 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagel
>
>   	dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, actual);
>
> -	drv_mgmt = dev_get_drvdata(instance->state->dev->parent);
> +	drv_mgmt = dev_get_drvdata(instance->state->dev);
>
>   	/*
>   	 * NOTE: dma_unmap_sg must be called before the
> --
> 2.34.1
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-21  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-20  9:12 [PATCH V2] staging: vc04_services: vchiq_arm: Fix NULL ptr dereferences Stefan Wahren
2024-04-20 10:54 ` Laurent Pinchart
2024-04-21  8:49 ` Umang Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).