All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Michael Walle <michael@walle.cc>
Cc: linux-kernel@vger.kernel.org,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH v3] mtd: spi-nor: fix memory leak when using debugfs_lookup()
Date: Wed, 8 Feb 2023 16:54:21 +0100	[thread overview]
Message-ID: <Y+PFreHoRVB+5J+1@kroah.com> (raw)
In-Reply-To: <68d10a9b27a0a3894a290b28c1a22085@walle.cc>

On Wed, Feb 08, 2023 at 04:28:45PM +0100, Michael Walle wrote:
> > +static void __exit spi_nor_module_exit(void)
> > +{
> > +	spi_nor_debugfs_shutdown();
> > +	spi_mem_driver_unregister(&spi_nor_driver);
> 
> Hm, does the order matter here? I didn't test it, but this will
> lead to:
> 
> rootdir = debugfs_create_dir("spi-nor", NULL);
> nor->debugfs_root = debugfs_create_dir("spi0", rootdir);
> debugfs_remove(rootdir);
> debugfs_remove(nor->debugfs_root);
> 
> If that's ok, then this looks good.

It's ok as the last call to debugfs_remove() will just fail as that
dentry is long gone.  Not the nicest, so I'll reverse them and send out
a v4 now.

thanks,

greg k-h

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Michael Walle <michael@walle.cc>
Cc: linux-kernel@vger.kernel.org,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH v3] mtd: spi-nor: fix memory leak when using debugfs_lookup()
Date: Wed, 8 Feb 2023 16:54:21 +0100	[thread overview]
Message-ID: <Y+PFreHoRVB+5J+1@kroah.com> (raw)
In-Reply-To: <68d10a9b27a0a3894a290b28c1a22085@walle.cc>

On Wed, Feb 08, 2023 at 04:28:45PM +0100, Michael Walle wrote:
> > +static void __exit spi_nor_module_exit(void)
> > +{
> > +	spi_nor_debugfs_shutdown();
> > +	spi_mem_driver_unregister(&spi_nor_driver);
> 
> Hm, does the order matter here? I didn't test it, but this will
> lead to:
> 
> rootdir = debugfs_create_dir("spi-nor", NULL);
> nor->debugfs_root = debugfs_create_dir("spi0", rootdir);
> debugfs_remove(rootdir);
> debugfs_remove(nor->debugfs_root);
> 
> If that's ok, then this looks good.

It's ok as the last call to debugfs_remove() will just fail as that
dentry is long gone.  Not the nicest, so I'll reverse them and send out
a v4 now.

thanks,

greg k-h

  reply	other threads:[~2023-02-08 15:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 14:53 [PATCH v3] mtd: spi-nor: fix memory leak when using debugfs_lookup() Greg Kroah-Hartman
2023-02-08 14:53 ` Greg Kroah-Hartman
2023-02-08 15:28 ` Michael Walle
2023-02-08 15:28   ` Michael Walle
2023-02-08 15:54   ` Greg Kroah-Hartman [this message]
2023-02-08 15:54     ` Greg Kroah-Hartman

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=Y+PFreHoRVB+5J+1@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.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.