From: Greg KH <gregkh@linuxfoundation.org>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
"Christian König" <christian.koenig@amd.com>,
"Das, Nirmoy" <Nirmoy.Das@amd.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: Fw: [Intel-gfx] [PATCH 1/5] dri: cleanup debugfs error handling
Date: Mon, 11 Oct 2021 19:07:08 +0200 [thread overview]
Message-ID: <YWRvPB1h3Rch/Gjd@kroah.com> (raw)
In-Reply-To: <878ryz1pq9.fsf@intel.com>
On Mon, Oct 11, 2021 at 07:38:22PM +0300, Jani Nikula wrote:
> On Mon, 11 Oct 2021, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Mon, Oct 11, 2021 at 04:19:58PM +0200, Christian König wrote:
> >> > > > > And then throw it away, later, when you want to remove the directory,
> >> > > > > look it up with a call to debugfs_lookup() and pass that to
> >> > > > > debugfs_remove() (which does so recursively).
> >> > > > >
> >> > > > > There should never be a need to save, or check, the result of any
> >> > > > > debugfs call. If so, odds are it is being used incorrectly.
> >> > > Yeah, exactly that's the problem I see here.
> >> > >
> >> > > We save the return value because the DRM subsystem is creating a debugfs
> >> > > directory for the drivers to use.
> >> > That's fine for now, not a big deal. And even if there is an error,
> >> > again, you can always feed that error back into the debugfs subsystem on
> >> > another call and it will handle it correctly.
> >>
> >> Problem is it isn't, we have a crash because the member isn't a pointer but
> >> an ERR_PTR instead.
> >
> > Again, that is fine, you can feed that into debugfs and it will "just
> > work". Treat it as an opaque pointer, not a *dentry and you will be
> > fine.
>
> Hmm, some of the patches add things like:
>
> +
> + if (!root)
> + goto error;
> +
> minor->debugfs_root = debugfs_create_dir(name, root);
>
> Superficially this seems okay, as it looks like debugfs_create_dir()
> doesn't actually cope with NULL values.
Yes it does, it puts things at the root of debugfs.
But why are you checking for NULL here, as the return value of a debugfs
call can never be NULL?
> However, since ->debugfs_root
> comes from debugfs_create_dir() I presume it'll never be NULL on errors
> anyway but rather an error pointer!
That is correct.
> So I think we probably need to go through the drm subsystem and look for
> existing similar patterns in fix them.
Please do. I know I made one pass at it a while ago but I think someone
else went through and cleaned them up again.
thanks,
greg k-h
next prev parent reply other threads:[~2021-10-11 17:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 9:17 [PATCH 1/5] dri: cleanup debugfs error handling Nirmoy Das
2021-10-08 9:17 ` [PATCH 2/5] drm/i915: check dri root before debugfs init Nirmoy Das
2021-10-12 9:59 ` Wang, Zhi A
2021-10-12 10:19 ` Das, Nirmoy
2021-10-08 9:17 ` [PATCH 3/5] drm/radeon: " Nirmoy Das
2021-10-08 10:23 ` Christian König
2021-10-08 10:34 ` Das, Nirmoy
2021-10-08 9:17 ` [PATCH 4/5] drm/armada: check dri/crtc " Nirmoy Das
2021-10-12 19:40 ` kernel test robot
2021-10-08 9:17 ` [PATCH 5/5] drm/tegra: check root dentry " Nirmoy Das
2021-11-08 6:35 ` kernel test robot
2021-10-08 9:35 ` [PATCH 1/5] dri: cleanup debugfs error handling Thomas Zimmermann
2021-10-08 9:40 ` [Intel-gfx] " Jani Nikula
2021-10-08 11:07 ` Greg KH
2021-10-08 12:08 ` Das, Nirmoy
[not found] ` <02fc9da3-ebac-2df1-3a54-d764b273f91b@amd.com>
2021-10-08 12:56 ` Fw: " Das, Nirmoy
[not found] ` <c4f1464d-19b6-04a3-e2d8-a153bfbb050a@amd.com>
[not found] ` <YWBfvILqkBQ8VSYc@kroah.com>
2021-10-11 14:19 ` Christian König
2021-10-11 14:53 ` Greg KH
2021-10-11 16:38 ` Jani Nikula
2021-10-11 17:07 ` Greg KH [this message]
2021-10-11 18:43 ` Jani Nikula
2021-10-11 15:13 ` Das, Nirmoy
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=YWRvPB1h3Rch/Gjd@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Nirmoy.Das@amd.com \
--cc=christian.koenig@amd.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@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