Skip to content

Commit b549c25

Browse files
TinaZhangZWzhenyw
authored andcommitted
drm/i915/gvt: Fix orphan vgpu dmabuf_objs' lifetime
Deleting dmabuf item's list head after releasing its container can lead to KASAN-reported issue: BUG: KASAN: use-after-free in __list_del_entry_valid+0x15/0xf0 Read of size 8 at addr ffff88818a4598a8 by task kworker/u8:3/13119 So fix this issue by puting deleting dmabuf_objs ahead of releasing its container. Fixes: dfb6ae4 ("drm/i915/gvt: Handle orphan dmabuf_objs") Signed-off-by: Tina Zhang <[email protected]> Reviewed-by: Zhenyu Wang <[email protected]> Signed-off-by: Zhenyu Wang <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3eb55e6 commit b549c25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/i915/gvt/dmabuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ static void dmabuf_gem_object_free(struct kref *kref)
151151
dmabuf_obj = container_of(pos,
152152
struct intel_vgpu_dmabuf_obj, list);
153153
if (dmabuf_obj == obj) {
154+
list_del(pos);
154155
intel_gvt_hypervisor_put_vfio_device(vgpu);
155156
idr_remove(&vgpu->object_idr,
156157
dmabuf_obj->dmabuf_id);
157158
kfree(dmabuf_obj->info);
158159
kfree(dmabuf_obj);
159-
list_del(pos);
160160
break;
161161
}
162162
}

0 commit comments

Comments
 (0)