[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y+PFreHoRVB+5J+1@kroah.com>
Date: Wed, 8 Feb 2023 16:54:21 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Michael Walle <michael@...le.cc>
Cc: linux-kernel@...r.kernel.org,
Tudor Ambarus <tudor.ambarus@...rochip.com>,
Pratyush Yadav <pratyush@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
linux-mtd@...ts.infradead.org
Subject: Re: [PATCH v3] mtd: spi-nor: fix memory leak when using
debugfs_lookup()
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
Powered by blists - more mailing lists