]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: renesas: vsp1: Fix NULL pointer deref on module unload
authorTomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Thu, 15 Jan 2026 09:22:35 +0000 (11:22 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 24 Mar 2026 10:58:02 +0000 (11:58 +0100)
When unloading the module on gen 4, we hit a NULL pointer dereference.
This is caused by the cleanup code calling vsp1_drm_cleanup() where it
should be calling vsp1_vspx_cleanup().

Fix this by checking the IP version and calling the drm or vspx function
accordingly, the same way as the init code does.

Fixes: d06c1a9f348d ("media: vsp1: Add VSPX support")
Cc: stable@vger.kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/renesas/vsp1/vsp1_drv.c

index 2de515c497eb8557602ec946de527823f07ab11f..627b5046fa80063d0f3c94b93bada00cfb4b2c00 100644 (file)
@@ -240,8 +240,12 @@ static void vsp1_destroy_entities(struct vsp1_device *vsp1)
                media_device_unregister(&vsp1->media_dev);
        media_device_cleanup(&vsp1->media_dev);
 
-       if (!vsp1->info->uapi)
-               vsp1_drm_cleanup(vsp1);
+       if (!vsp1->info->uapi) {
+               if (vsp1->info->version == VI6_IP_VERSION_MODEL_VSPX_GEN4)
+                       vsp1_vspx_cleanup(vsp1);
+               else
+                       vsp1_drm_cleanup(vsp1);
+       }
 }
 
 static int vsp1_create_entities(struct vsp1_device *vsp1)