Patch "mtd: core: don't remove debugfs directory if device is in use" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mtd: core: don't remove debugfs directory if device is in use

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mtd-core-don-t-remove-debugfs-directory-if-device-is.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 922bafc83cf942b46969de5fb2097538daaa546d
Author: Zev Weiss <zev@xxxxxxxxxxxxxxxxx>
Date:   Thu Oct 14 13:39:52 2021 -0700

    mtd: core: don't remove debugfs directory if device is in use
    
    [ Upstream commit c13de2386c78e890d4ae6f01a85eefd0b293fb08 ]
    
    Previously, if del_mtd_device() failed with -EBUSY due to a non-zero
    usecount, a subsequent call to attempt the deletion again would try to
    remove a debugfs directory that had already been removed and panic.
    With this change the second call can instead proceed safely.
    
    Fixes: e8e3edb95ce6 ("mtd: create per-device and module-scope debugfs entries")
    Signed-off-by: Zev Weiss <zev@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
    Link: https://lore.kernel.org/linux-mtd/20211014203953.5424-1-zev@xxxxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 1c8c407286783..a5197a4819025 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -721,8 +721,6 @@ int del_mtd_device(struct mtd_info *mtd)
 
 	mutex_lock(&mtd_table_mutex);
 
-	debugfs_remove_recursive(mtd->dbg.dfs_dir);
-
 	if (idr_find(&mtd_idr, mtd->index) != mtd) {
 		ret = -ENODEV;
 		goto out_error;
@@ -738,6 +736,8 @@ int del_mtd_device(struct mtd_info *mtd)
 		       mtd->index, mtd->name, mtd->usecount);
 		ret = -EBUSY;
 	} else {
+		debugfs_remove_recursive(mtd->dbg.dfs_dir);
+
 		/* Try to remove the NVMEM provider */
 		if (mtd->nvmem)
 			nvmem_unregister(mtd->nvmem);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux