]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Feb 2023 09:35:23 +0000 (10:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Feb 2023 09:35:23 +0000 (10:35 +0100)
added patches:
nvmem-core-fix-cell-removal-on-error.patch

queue-5.4/nvmem-core-fix-cell-removal-on-error.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/nvmem-core-fix-cell-removal-on-error.patch b/queue-5.4/nvmem-core-fix-cell-removal-on-error.patch
new file mode 100644 (file)
index 0000000..8316b76
--- /dev/null
@@ -0,0 +1,42 @@
+From db3546d58b5a0fa581d9c9f2bdc2856fa6c5e43e Mon Sep 17 00:00:00 2001
+From: Michael Walle <michael@walle.cc>
+Date: Fri, 27 Jan 2023 10:40:13 +0000
+Subject: nvmem: core: fix cell removal on error
+
+From: Michael Walle <michael@walle.cc>
+
+commit db3546d58b5a0fa581d9c9f2bdc2856fa6c5e43e upstream.
+
+nvmem_add_cells() could return an error after some cells are already
+added to the provider. In this case, the added cells are not removed.
+Remove any registered cells if nvmem_add_cells() fails.
+
+Fixes: fa72d847d68d7 ("nvmem: check the return value of nvmem_add_cells()")
+Cc: stable@vger.kernel.org
+Signed-off-by: Michael Walle <michael@walle.cc>
+Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+Link: https://lore.kernel.org/r/20230127104015.23839-9-srinivas.kandagatla@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/nvmem/core.c |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/nvmem/core.c
++++ b/drivers/nvmem/core.c
+@@ -439,7 +439,7 @@ struct nvmem_device *nvmem_register(cons
+       if (config->cells) {
+               rval = nvmem_add_cells(nvmem, config->cells, config->ncells);
+               if (rval)
+-                      goto err_teardown_compat;
++                      goto err_remove_cells;
+       }
+       rval = nvmem_add_cells_from_table(nvmem);
+@@ -456,7 +456,6 @@ struct nvmem_device *nvmem_register(cons
+ err_remove_cells:
+       nvmem_device_remove_all_cells(nvmem);
+-err_teardown_compat:
+       if (config->compat)
+               nvmem_sysfs_remove_compat(nvmem, config);
+ err_device_del:
index 4e62cbc0c53cb4bc0de66e176f59f7816c899d13..a9e8a8e3275e20f5e8456ac60ddac138a49f0e36 100644 (file)
@@ -47,3 +47,4 @@ mm-hugetlb-proc-check-for-hugetlb-shared-pmd-in-proc-pid-smaps.patch
 fpga-stratix10-soc-fix-return-value-check-in-s10_ops_write_init.patch
 mm-swapfile-add-cond_resched-in-get_swap_pages.patch
 squashfs-fix-handling-and-sanity-checking-of-xattr_ids-count.patch
+nvmem-core-fix-cell-removal-on-error.patch