From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org,
Thomas Zimmermann <tzimmermann@suse.de>,
Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Subject: Re: [PATCH RESEND] drm: fix crash in drm_minor_alloc_release
Date: Mon, 7 Nov 2022 16:40:41 +0100 [thread overview]
Message-ID: <20221107154041.GA3600973@linux.intel.com> (raw)
In-Reply-To: <Y2kf+HLy/Kz5BclF@intel.com>
On Mon, Nov 07, 2022 at 05:10:48PM +0200, Ville Syrjälä wrote:
> On Mon, Nov 07, 2022 at 03:45:00PM +0100, Stanislaw Gruszka wrote:
> > index 8214a0b1ab7f..e3a1243dd2ae 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -102,7 +102,8 @@ static void drm_minor_alloc_release(struct drm_device *dev, void *data)
> >
> > WARN_ON(dev != minor->dev);
> >
> > - put_device(minor->kdev);
> > + if (!IS_ERR(minor->kdev))
> > + put_device(minor->kdev);
>
> Assigning error pointers into things is a terrible idea.
> IMO the correct fix would be to not return some
> half-constructed garbage from drm_minor_alloc().
> So basically should at least partically revert
> commit f96306f9892b ("drm: manage drm_minor cleanup with drmm_")
I would prefer to not change any ordering or remove drmm_* stuff, since
as pointed to above commit message, things are tricky there.
I think assigning NULL to minor->kdev should be fine:
if (IS_ERR(minor->kdev)) {
r = PTR_ERR(minor->kdev);
minor->kdev = NULL;
return r;
}
put_device() in drm_minor_alloc_release() will cope nicely with it.
Regards
Stanislaw
next prev parent reply other threads:[~2022-11-07 15:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 14:45 [PATCH RESEND] drm: fix crash in drm_minor_alloc_release Stanislaw Gruszka
2022-11-07 15:10 ` Ville Syrjälä
2022-11-07 15:40 ` Stanislaw Gruszka [this message]
2022-11-07 15:56 ` Ville Syrjälä
2022-11-08 16:24 ` Stanislaw Gruszka
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=20221107154041.GA3600973@linux.intel.com \
--to=stanislaw.gruszka@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacek.lawrynowicz@linux.intel.com \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).