]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
host1x: bus: Fix missing ops null check in error teardown
authorshayderrr <darknessshayder@gmail.com>
Sun, 17 May 2026 17:04:56 +0000 (12:04 -0500)
committerThierry Reding <treding@nvidia.com>
Thu, 28 May 2026 15:19:28 +0000 (17:19 +0200)
In host1x_device_init(), the error teardown paths do not check
client->ops before dereferencing it, unlike the forward init paths
which correctly guard with 'client->ops &&'. This can result in a
NULL pointer dereference if client->ops is NULL.

Fix by adding the missing client->ops check in both the teardown
and teardown_late labels.

Signed-off-by: shayderrr <darknessshayder@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20260517170456.84927-1-darknessshayder@gmail.com
drivers/gpu/host1x/bus.c

index 772e05a7b45b3acfaa26feadb746545081a7f6fb..70310d1e3162483e176ad22bdb6f4cd0c838d944 100644 (file)
@@ -221,7 +221,7 @@ int host1x_device_init(struct host1x_device *device)
 
 teardown:
        list_for_each_entry_continue_reverse(client, &device->clients, list)
-               if (client->ops->exit)
+               if (client->ops && client->ops->exit)
                        client->ops->exit(client);
 
        /* reset client to end of list for late teardown */
@@ -229,7 +229,7 @@ teardown:
 
 teardown_late:
        list_for_each_entry_continue_reverse(client, &device->clients, list)
-               if (client->ops->late_exit)
+               if (client->ops && client->ops->late_exit)
                        client->ops->late_exit(client);
 
        mutex_unlock(&device->clients_lock);