From: Marius-cristian Vlad <marius-cristian.vlad@nxp.com>
To: "daniel@ffwll.ch" <daniel@ffwll.ch>
Cc: "daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
"keithp@keithp.com" <keithp@keithp.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/drm_lease: Do not call drm_master_put() twice in case drm_lease_create() fails
Date: Tue, 12 Dec 2017 15:44:07 +0000 [thread overview]
Message-ID: <1513093446.3780.13.camel@nxp.com> (raw)
In-Reply-To: <20171212153020.GD526@phenom.ffwll.local>
drm_mode_create_lease_ioctl() -> drm_lease_create()
drm_lease_create() -> fails and drm_master_put() is called
twice: once in drm_lease_create() and once in
drm_mode_create_lease_ioctl().
From drm_mode_create_lease_ioctl():
lessee = drm_lease_create(lessor, &leases);
if (IS_ERR(lessee)) {
ret = PTR_ERR(lessee);
goto out_leases;
}
....
out_lessee:
drm_master_put(&lessee); <- but we already done this in
drm_lease_create().
On Tue, 2017-12-12 at 16:30 +0100, Daniel Vetter wrote:
> On Tue, Dec 12, 2017 at 02:04:14PM +0200, Marius Vlad wrote:
> > This case can been seen when creating the lease with same objects
> > passed.
> >
> > Signed-off-by: Marius Vlad <marius-cristian.vlad@nxp.com>
> > ---
> > drivers/gpu/drm/drm_lease.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_lease.c
> > b/drivers/gpu/drm/drm_lease.c
> > index d1eb56a..ae57f33 100644
> > --- a/drivers/gpu/drm/drm_lease.c
> > +++ b/drivers/gpu/drm/drm_lease.c
> > @@ -254,8 +254,6 @@ static struct drm_master
> > *drm_lease_create(struct drm_master *lessor, struct idr
> > return lessee;
> >
> > out_lessee:
> > - drm_master_put(&lessee);
>
> I'm not really following here ... the lessee reference we're dropping
> here
> is created in drm_master_create. We're only calling drm_master_put if
> that
> succeeded. Removing this line here looks like now we're leaking.
>
> Where is the double-free? I don't see the 2nd drm_master_put()
> anywhere
> ... drm_mode_create_lease_ioctl also seems to be doing the right
> thing
> from just staring at it.
> -Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-12-13 2:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 12:04 [PATCH] drm/drm_lease: Do not call drm_master_put() twice in case drm_lease_create() fails Marius Vlad
2017-12-12 15:30 ` Daniel Vetter
2017-12-12 15:44 ` Marius-cristian Vlad [this message]
2017-12-13 8:23 ` Daniel Vetter
2017-12-13 9:18 ` Marius-cristian Vlad
2017-12-13 10:44 ` Daniel Vetter
2017-12-13 18:10 ` [PATCH v2] drm/drm_lease: Prevent deadlock " Marius Vlad
2017-12-14 7:25 ` Daniel Vetter
2017-12-14 7:29 ` Daniel Vetter
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=1513093446.3780.13.camel@nxp.com \
--to=marius-cristian.vlad@nxp.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=keithp@keithp.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.