Skip to content

Commit

Permalink
drm/lease: fix WARNING in idr_destroy
Browse files Browse the repository at this point in the history
drm_lease_create takes ownership of leases. And leases will be released
by drm_master_put.

drm_master_put
    ->drm_master_destroy
            ->idr_destroy

So we needn't call idr_destroy again.

Reported-and-tested-by: syzbot+05835159fe322770fe3d@syzkaller.appspotmail.com
Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1584518030-4173-1-git-send-email-hqjagain@gmail.com
  • Loading branch information
Qiujun Huang authored and Daniel Vetter committed Mar 18, 2020
1 parent 8c34cd1 commit b216a8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/drm_lease.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,12 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
}

DRM_DEBUG_LEASE("Creating lease\n");
/* lessee will take the ownership of leases */
lessee = drm_lease_create(lessor, &leases);

if (IS_ERR(lessee)) {
ret = PTR_ERR(lessee);
idr_destroy(&leases);
goto out_leases;
}

Expand Down Expand Up @@ -580,7 +582,6 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,

out_leases:
put_unused_fd(fd);
idr_destroy(&leases);

DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret);
return ret;
Expand Down

0 comments on commit b216a8e

Please sign in to comment.