Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-15 10:23:48 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-15 10:24:00 +0100
commitf56945ec9570d6d0beb8c18928a5e9a0c431a18e (patch)
tree467d31d67170a111b4574dd35d4285b2da33e597
parentc4c6bacf09a823e3bcc3ee472148030a9a481dfb (diff)
debugfs: fix debugfs_rename parameter checking (bnc#1012628).
-rw-r--r--patches.kernel.org/4.20.9-017-debugfs-fix-debugfs_rename-parameter-checking.patch44
-rw-r--r--series.conf1
2 files changed, 45 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.9-017-debugfs-fix-debugfs_rename-parameter-checking.patch b/patches.kernel.org/4.20.9-017-debugfs-fix-debugfs_rename-parameter-checking.patch
new file mode 100644
index 0000000000..6a6e696deb
--- /dev/null
+++ b/patches.kernel.org/4.20.9-017-debugfs-fix-debugfs_rename-parameter-checking.patch
@@ -0,0 +1,44 @@
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Wed, 23 Jan 2019 11:27:02 +0100
+Subject: [PATCH] debugfs: fix debugfs_rename parameter checking
+References: bnc#1012628
+Patch-mainline: 4.20.9
+Git-commit: d88c93f090f708c18195553b352b9f205e65418f
+
+commit d88c93f090f708c18195553b352b9f205e65418f upstream.
+
+debugfs_rename() needs to check that the dentries passed into it really
+are valid, as sometimes they are not (i.e. if the return value of
+another debugfs call is passed into this one.) So fix this up by
+properly checking if the two parent directories are errors (they are
+allowed to be NULL), and if the dentry to rename is not NULL or an
+error.
+
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/debugfs/inode.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
+index 13b01351dd1c..41ef452c1fcf 100644
+--- a/fs/debugfs/inode.c
++++ b/fs/debugfs/inode.c
+@@ -787,6 +787,13 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
+ struct dentry *dentry = NULL, *trap;
+ struct name_snapshot old_name;
+
++ if (IS_ERR(old_dir))
++ return old_dir;
++ if (IS_ERR(new_dir))
++ return new_dir;
++ if (IS_ERR_OR_NULL(old_dentry))
++ return old_dentry;
++
+ trap = lock_rename(new_dir, old_dir);
+ /* Source or destination directories don't exist? */
+ if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir))
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 71ec95bd08..8fff8259a9 100644
--- a/series.conf
+++ b/series.conf
@@ -1099,6 +1099,7 @@
patches.kernel.org/4.20.9-014-cfg80211-call-disconnect_wk-when-AP-stops.patch
patches.kernel.org/4.20.9-015-mei-me-add-ice-lake-point-device-id.patch
patches.kernel.org/4.20.9-016-samples-mei-use-dev-mei0-instead-of-dev-mei.patch
+ patches.kernel.org/4.20.9-017-debugfs-fix-debugfs_rename-parameter-checking.patch
########################################################
# Build fixes that apply to the vanilla kernel too.