From 50a212ec906f7524620675f0c57357691c26c81f Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Wed, 16 Oct 2024 01:20:19 +0000 Subject: [PATCH] 修改GPIO导出默认初始值 --- kernel/drivers/gpu/drm/virtio/virtgpu_ioctl.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/kernel/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/kernel/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 33b8eba..36efa27 100644 --- a/kernel/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/kernel/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -279,10 +279,18 @@ drm_gem_object_release(obj); return ret; } - drm_gem_object_put(obj); rc->res_handle = qobj->hw_res_handle; /* similiar to a VM address */ rc->bo_handle = handle; + + /* + * The handle owns the reference now. But we must drop our + * remaining reference *after* we no longer need to dereference + * the obj. Otherwise userspace could guess the handle and + * race closing it from another thread. + */ + drm_gem_object_put(obj); + return 0; } -- Gitblit v1.6.2