accel/qaic: Free user handle on interrupted mutex
authorCarl Vanderlip <quic_carlv@quicinc.com>
Fri, 2 Jun 2023 21:04:39 +0000 (15:04 -0600)
committerJeffrey Hugo <quic_jhugo@quicinc.com>
Fri, 9 Jun 2023 17:06:33 +0000 (11:06 -0600)
After user handle is allocated, if mutex is interrupted, we do not free
the user handle and return an error. Kref had been initialized, but not
added to users list, so device teardown would also not call free_usr.

Fixes: c501ca23a6a3 ("accel/qaic: Add uapi and core driver file")
Signed-off-by: Carl Vanderlip <quic_carlv@quicinc.com>
Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230602210440.8411-2-quic_jhugo@quicinc.com
drivers/accel/qaic/qaic_drv.c

index 2d0828db28d8e9d87da49b62583e48ae069831e0..961cd341b4141f7fe5135f07a313267df206e81b 100644 (file)
@@ -97,6 +97,7 @@ static int qaic_open(struct drm_device *dev, struct drm_file *file)
 
 cleanup_usr:
        cleanup_srcu_struct(&usr->qddev_lock);
+       ida_free(&qaic_usrs, usr->handle);
 free_usr:
        kfree(usr);
 dev_unlock: