public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH v2 1/6] debugfs: fix automount d_fsdata usage
Date: Sat, 25 Nov 2023 19:31:47 +0100	[thread overview]
Message-ID: <d89598efbb289d211c19880cd33db77f9dae4431.camel@sipsolutions.net> (raw)
In-Reply-To: <2023112519-reprocess-backtrack-0732@gregkh>

On Sat, 2023-11-25 at 14:48 +0000, Greg Kroah-Hartman wrote:
> On Fri, Nov 24, 2023 at 05:25:24PM +0100, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> > 
> > debugfs_create_automount() stores a function pointer in d_fsdata,
> > but since commit 7c8d469877b1 ("debugfs: add support for more
> > elaborate ->d_fsdata") debugfs_release_dentry() will free it, now
> > conditionally on DEBUGFS_FSDATA_IS_REAL_FOPS_BIT, but that's not
> > set for the function pointer in automount. As a result, removing
> > an automount dentry would attempt to free the function pointer.
> > Luckily, the only user of this (tracing) never removes it.
> > 
> > Nevertheless, it's safer if we just handle the fsdata in one way,
> > namely either DEBUGFS_FSDATA_IS_REAL_FOPS_BIT or allocated. Thus,
> > change the automount to allocate it, and use the real_fops in the
> > data to indicate whether or not automount is filled, rather than
> > adding a type tag. At least for now this isn't actually needed,
> > but the next changes will require it.
> > 
> > Also check in debugfs_file_get() that it gets only called
> > on regular files, just to make things clearer.
> > 
> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> > ---
> > v2: add missing kfree() pointed out by smatch
> 
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

I have to fix the Kconfig issue in one of the later (wireless) patches,
but does that mean you'd actually prefer the debugfs changes go through
the wireless tree, together with the code using it?

Thanks,
johannes

  reply	other threads:[~2023-11-25 18:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 16:25 [PATCH v2 0/6] fixes for debugfs/wireless locking issue Johannes Berg
2023-11-24 16:25 ` [PATCH v2 1/6] debugfs: fix automount d_fsdata usage Johannes Berg
2023-11-25 14:48   ` Greg Kroah-Hartman
2023-11-25 18:31     ` Johannes Berg [this message]
2023-11-25 19:29       ` Greg Kroah-Hartman
2023-11-24 16:25 ` [PATCH v2 2/6] debugfs: annotate debugfs handlers vs. removal with lockdep Johannes Berg
2023-11-25 14:48   ` Greg Kroah-Hartman
2023-11-24 16:25 ` [PATCH v2 3/6] debugfs: add API to allow debugfs operations cancellation Johannes Berg
2023-11-25 14:48   ` Greg Kroah-Hartman
2023-11-24 16:25 ` [PATCH v2 4/6] wifi: cfg80211: add locked debugfs wrappers Johannes Berg
2023-11-24 16:25 ` [PATCH v2 5/6] wifi: mac80211: use wiphy locked debugfs helpers for agg_status Johannes Berg
2023-11-24 16:25 ` [PATCH v2 6/6] wifi: mac80211: use wiphy locked debugfs for sdata/link Johannes Berg
2023-11-28 15:48 ` [PATCH v2 0/6] fixes for debugfs/wireless locking issue Ben Greear

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=d89598efbb289d211c19880cd33db77f9dae4431.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rafael@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