diff mbox series

[1/2] iommu: apple: Mark device with DM_FLAG_VITAL

Message ID 20241031-iommu_apple_dart_ordering-v1-1-8a6877946d6b@jannau.net
State Needs Review / ACK
Delegated to: Tom Rini
Headers show
Series Fix device removal order for Apple dart iommu | expand

Commit Message

Janne Grunau Oct. 31, 2024, 10:48 p.m. UTC
Avoids NULL pointer dereferences in apple_dart_unmap when the iommu
device is removed before its user. U-boot's device model does not track
dependencies between devices.
Observed on a M1 Ultra Mac Studio with v2024.10.

Signed-off-by: Janne Grunau <j@jannau.net>
---
 drivers/iommu/apple_dart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt Nov. 1, 2024, 7:12 a.m. UTC | #1
On 10/31/24 23:48, Janne Grunau wrote:
> Avoids NULL pointer dereferences in apple_dart_unmap when the iommu
> device is removed before its user. U-boot's device model does not track
> dependencies between devices.
> Observed on a M1 Ultra Mac Studio with v2024.10.
>
> Signed-off-by: Janne Grunau <j@jannau.net>

Hello Simon,

could you, please, review this patch.

Best regards

Heinrich

> ---
>   drivers/iommu/apple_dart.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/apple_dart.c b/drivers/iommu/apple_dart.c
> index 611ac7cd6deb4fccd45ccfe8cbb9b3e36e2af753..9df174f32d721c39079e65736c91e3e27a72ace2 100644
> --- a/drivers/iommu/apple_dart.c
> +++ b/drivers/iommu/apple_dart.c
> @@ -312,5 +312,5 @@ U_BOOT_DRIVER(apple_dart) = {
>   	.ops = &apple_dart_ops,
>   	.probe = apple_dart_probe,
>   	.remove = apple_dart_remove,
> -	.flags	= DM_FLAG_OS_PREPARE
> +	.flags	= DM_FLAG_OS_PREPARE | DM_FLAG_VITAL
>   };
>
Heinrich Schuchardt Nov. 1, 2024, 7:12 a.m. UTC | #2
On 10/31/24 23:48, Janne Grunau wrote:
> Avoids NULL pointer dereferences in apple_dart_unmap when the iommu
> device is removed before its user. U-boot's device model does not track
> dependencies between devices.
> Observed on a M1 Ultra Mac Studio with v2024.10.
>
> Signed-off-by: Janne Grunau <j@jannau.net>

Hello Simon,

could you, please, review this patch.

Best regards

Heinrich


> ---
>   drivers/iommu/apple_dart.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/apple_dart.c b/drivers/iommu/apple_dart.c
> index 611ac7cd6deb4fccd45ccfe8cbb9b3e36e2af753..9df174f32d721c39079e65736c91e3e27a72ace2 100644
> --- a/drivers/iommu/apple_dart.c
> +++ b/drivers/iommu/apple_dart.c
> @@ -312,5 +312,5 @@ U_BOOT_DRIVER(apple_dart) = {
>   	.ops = &apple_dart_ops,
>   	.probe = apple_dart_probe,
>   	.remove = apple_dart_remove,
> -	.flags	= DM_FLAG_OS_PREPARE
> +	.flags	= DM_FLAG_OS_PREPARE | DM_FLAG_VITAL
>   };
>
Mark Kettenis Nov. 1, 2024, 8:28 p.m. UTC | #3
> From: Janne Grunau <j@jannau.net>
> Date: Thu, 31 Oct 2024 23:48:01 +0100
> 
> Avoids NULL pointer dereferences in apple_dart_unmap when the iommu
> device is removed before its user. U-boot's device model does not track
> dependencies between devices.
> Observed on a M1 Ultra Mac Studio with v2024.10.
> 
> Signed-off-by: Janne Grunau <j@jannau.net>

Acked-by: Mark Kettenis <kettenis@openbsd.org>

> ---
>  drivers/iommu/apple_dart.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/apple_dart.c b/drivers/iommu/apple_dart.c
> index 611ac7cd6deb4fccd45ccfe8cbb9b3e36e2af753..9df174f32d721c39079e65736c91e3e27a72ace2 100644
> --- a/drivers/iommu/apple_dart.c
> +++ b/drivers/iommu/apple_dart.c
> @@ -312,5 +312,5 @@ U_BOOT_DRIVER(apple_dart) = {
>  	.ops = &apple_dart_ops,
>  	.probe = apple_dart_probe,
>  	.remove = apple_dart_remove,
> -	.flags	= DM_FLAG_OS_PREPARE
> +	.flags	= DM_FLAG_OS_PREPARE | DM_FLAG_VITAL
>  };
> 
> -- 
> 2.47.0
> 
>
diff mbox series

Patch

diff --git a/drivers/iommu/apple_dart.c b/drivers/iommu/apple_dart.c
index 611ac7cd6deb4fccd45ccfe8cbb9b3e36e2af753..9df174f32d721c39079e65736c91e3e27a72ace2 100644
--- a/drivers/iommu/apple_dart.c
+++ b/drivers/iommu/apple_dart.c
@@ -312,5 +312,5 @@  U_BOOT_DRIVER(apple_dart) = {
 	.ops = &apple_dart_ops,
 	.probe = apple_dart_probe,
 	.remove = apple_dart_remove,
-	.flags	= DM_FLAG_OS_PREPARE
+	.flags	= DM_FLAG_OS_PREPARE | DM_FLAG_VITAL
 };