From: Greg Kroah-Hartman Date: Tue, 7 Feb 2023 09:35:23 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v5.15.93~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e40c438b49efeae7a4ebe286a30459819faceba3;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: nvmem-core-fix-cell-removal-on-error.patch --- 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 index 00000000000..8316b76ac58 --- /dev/null +++ b/queue-5.4/nvmem-core-fix-cell-removal-on-error.patch @@ -0,0 +1,42 @@ +From db3546d58b5a0fa581d9c9f2bdc2856fa6c5e43e Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Fri, 27 Jan 2023 10:40:13 +0000 +Subject: nvmem: core: fix cell removal on error + +From: Michael Walle + +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 +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230127104015.23839-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + 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: diff --git a/queue-5.4/series b/queue-5.4/series index 4e62cbc0c53..a9e8a8e3275 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -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