]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Jan 2021 11:56:33 +0000 (12:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Jan 2021 11:56:33 +0000 (12:56 +0100)
added patches:
regmap-debugfs-fix-a-reversed-if-statement-in-regmap_debugfs_init.patch

queue-5.4/regmap-debugfs-fix-a-reversed-if-statement-in-regmap_debugfs_init.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/regmap-debugfs-fix-a-reversed-if-statement-in-regmap_debugfs_init.patch b/queue-5.4/regmap-debugfs-fix-a-reversed-if-statement-in-regmap_debugfs_init.patch
new file mode 100644 (file)
index 0000000..b27bb43
--- /dev/null
@@ -0,0 +1,37 @@
+From f6bcb4c7f366905b66ce8ffca7190118244bb642 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Tue, 5 Jan 2021 14:42:29 +0300
+Subject: regmap: debugfs: Fix a reversed if statement in regmap_debugfs_init()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit f6bcb4c7f366905b66ce8ffca7190118244bb642 upstream.
+
+This code will leak "map->debugfs_name" because the if statement is
+reversed so it only frees NULL pointers instead of non-NULL.  In
+fact the if statement is not required and should just be removed
+because kfree() accepts NULL pointers.
+
+Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/X/RQpfAwRdLg0GqQ@mwanda
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/regmap/regmap-debugfs.c |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/base/regmap/regmap-debugfs.c
++++ b/drivers/base/regmap/regmap-debugfs.c
+@@ -595,9 +595,7 @@ void regmap_debugfs_init(struct regmap *
+       }
+       if (!strcmp(name, "dummy")) {
+-              if (!map->debugfs_name)
+-                      kfree(map->debugfs_name);
+-
++              kfree(map->debugfs_name);
+               map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d",
+                                               dummy_index);
+               if (!map->debugfs_name)
index 3a98c803ae4c74844bbb6cb5585ff214991ff7d7..7f4e95e6b8f323f7fb9c938fc9e167d171d71f25 100644 (file)
@@ -59,3 +59,4 @@ net-mvpp2-disable-force-link-up-during-port-init-procedure.patch
 kvm-arm64-don-t-access-pmcr_el0-when-no-pmu-is-available.patch
 block-fix-use-after-free-in-disk_part_iter_next.patch
 net-drop-bogus-skb-with-checksum_partial-and-offset-beyond-end-of-trimmed-packet.patch
+regmap-debugfs-fix-a-reversed-if-statement-in-regmap_debugfs_init.patch