]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop queue-4.14/debugfs-add-debugfs_lookup_and_remove.patch
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Sep 2022 13:20:33 +0000 (15:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Sep 2022 13:20:33 +0000 (15:20 +0200)
Not needed there yet.

queue-4.14/debugfs-add-debugfs_lookup_and_remove.patch [deleted file]
queue-4.14/series

diff --git a/queue-4.14/debugfs-add-debugfs_lookup_and_remove.patch b/queue-4.14/debugfs-add-debugfs_lookup_and_remove.patch
deleted file mode 100644 (file)
index 367fd94..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-From 044233e644fd5568664b71907ba2ee48b4665e36 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 2 Sep 2022 16:59:15 +0200
-Subject: debugfs: add debugfs_lookup_and_remove()
-
-From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
-[ Upstream commit dec9b2f1e0455a151a7293c367da22ab973f713e ]
-
-There is a very common pattern of using
-debugfs_remove(debufs_lookup(..)) which results in a dentry leak of the
-dentry that was looked up.  Instead of having to open-code the correct
-pattern of calling dput() on the dentry, create
-debugfs_lookup_and_remove() to handle this pattern automatically and
-properly without any memory leaks.
-
-Cc: stable <stable@kernel.org>
-Reported-by: Kuyo Chang <kuyo.chang@mediatek.com>
-Tested-by: Kuyo Chang <kuyo.chang@mediatek.com>
-Link: https://lore.kernel.org/r/YxIaQ8cSinDR881k@kroah.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/debugfs/inode.c      | 22 ++++++++++++++++++++++
- include/linux/debugfs.h |  6 ++++++
- 2 files changed, 28 insertions(+)
-
-diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
-index f4df6feec271..58175679eedd 100644
---- a/fs/debugfs/inode.c
-+++ b/fs/debugfs/inode.c
-@@ -745,6 +745,28 @@ void debugfs_remove_recursive(struct dentry *dentry)
- }
- EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
-+/**
-+ * debugfs_lookup_and_remove - lookup a directory or file and recursively remove it
-+ * @name: a pointer to a string containing the name of the item to look up.
-+ * @parent: a pointer to the parent dentry of the item.
-+ *
-+ * This is the equlivant of doing something like
-+ * debugfs_remove(debugfs_lookup(..)) but with the proper reference counting
-+ * handled for the directory being looked up.
-+ */
-+void debugfs_lookup_and_remove(const char *name, struct dentry *parent)
-+{
-+      struct dentry *dentry;
-+
-+      dentry = debugfs_lookup(name, parent);
-+      if (!dentry)
-+              return;
-+
-+      debugfs_remove(dentry);
-+      dput(dentry);
-+}
-+EXPORT_SYMBOL_GPL(debugfs_lookup_and_remove);
-+
- /**
-  * debugfs_rename - rename a file/directory in the debugfs filesystem
-  * @old_dir: a pointer to the parent dentry for the renamed object. This
-diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
-index 755033acd2b0..497aac2c20d6 100644
---- a/include/linux/debugfs.h
-+++ b/include/linux/debugfs.h
-@@ -111,6 +111,8 @@ void debugfs_remove_recursive(struct dentry *dentry);
- int debugfs_use_file_start(const struct dentry *dentry, int *srcu_idx)
-       __acquires(&debugfs_srcu);
-+void debugfs_lookup_and_remove(const char *name, struct dentry *parent);
-+
- void debugfs_use_file_finish(int srcu_idx) __releases(&debugfs_srcu);
- ssize_t debugfs_attr_read(struct file *file, char __user *buf,
-@@ -240,6 +242,10 @@ static inline void debugfs_remove(struct dentry *dentry)
- static inline void debugfs_remove_recursive(struct dentry *dentry)
- { }
-+static inline void debugfs_lookup_and_remove(const char *name,
-+                                           struct dentry *parent)
-+{ }
-+
- static inline int debugfs_use_file_start(const struct dentry *dentry,
-                                       int *srcu_idx)
-       __acquires(&debugfs_srcu)
--- 
-2.35.1
-
index 867a6eae03ced1e1791f28a287ff86dd6cffcf6c..a8275a5dc9d345338507ed31d633cf9cebefe4fd 100644 (file)
@@ -4,4 +4,3 @@ drm-meson-correct-osd1-global-alpha-value.patch
 parisc-ccio-dma-add-missing-iounmap-in-error-path-in.patch
 efi-libstub-disable-shadow-call-stack.patch
 efi-libstub-disable-struct-randomization.patch
-debugfs-add-debugfs_lookup_and_remove.patch