From: Daniel Vetter <daniel@ffwll.ch>
To: Qiujun Huang <hqjagain@gmail.com>
Cc: daniel@ffwll.ch, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, airlied@linux.ie,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
anenbupt@gmail.com
Subject: Re: [PATCH v2] drm/lease: fix WARNING in idr_destroy
Date: Wed, 18 Mar 2020 14:38:52 +0100 [thread overview]
Message-ID: <20200318133852.GU2363188@phenom.ffwll.local> (raw)
In-Reply-To: <1584518030-4173-1-git-send-email-hqjagain@gmail.com>
On Wed, Mar 18, 2020 at 03:53:50PM +0800, Qiujun Huang wrote:
> 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>
Thanks for the respin, and I've also seen the syzbot confirmation, so all
great.
Merged to -fixes with a cc: stable.
-Daniel
> ---
> drivers/gpu/drm/drm_lease.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> index b481caf..825abe3 100644
> --- a/drivers/gpu/drm/drm_lease.c
> +++ b/drivers/gpu/drm/drm_lease.c
> @@ -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;
> }
>
> @@ -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;
> --
> 1.8.3.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2020-03-18 13:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 7:53 Qiujun Huang
2020-03-18 13:38 ` Daniel Vetter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200318133852.GU2363188@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=anenbupt@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hqjagain@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®