![John Audia](/assets/img/avatar_default.png)
Manually rebased: backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch Removed upstreamed: backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch[1] patches-5.10/070-net-bgmac-fix-BCM5358-support-by-setting-correct-fla.patch[2] Add fix: target/linux/generic/backport-5.10/804-0001-net-Remove-WARN_ON_ONCE-sk-sk_forward_alloc-from-sk_.patch[3] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.169&id=a19a0f67dbb89ad2bfc466f2003841acba645884 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.169&id=a5c51e0c3202820192db3f3809e072f3ca2b1177 3. https://lore.kernel.org/stable/20230227211548.13923-1-kuniyu@amazon.com Signed-off-by: John Audia <therealgraysky@proton.me>
37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
From de0534df93474f268486c486ea7e01b44a478026 Mon Sep 17 00:00:00 2001
|
|
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
|
Date: Fri, 6 Aug 2021 09:59:47 +0100
|
|
Subject: [PATCH] nvmem: core: fix error handling while validating keepout
|
|
regions
|
|
|
|
Current error path on failure of validating keepout regions is calling
|
|
put_device, eventhough the device is not even registered at that point.
|
|
|
|
Fix this by adding proper error handling of freeing ida and nvmem.
|
|
|
|
Fixes: fd3bb8f54a88 ("nvmem: core: Add support for keepout regions")
|
|
Cc: <stable@vger.kernel.org>
|
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
|
Link: https://lore.kernel.org/r/20210806085947.22682-5-srinivas.kandagatla@linaro.org
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
---
|
|
drivers/nvmem/core.c | 7 +++++--
|
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/nvmem/core.c
|
|
+++ b/drivers/nvmem/core.c
|
|
@@ -850,8 +850,11 @@ struct nvmem_device *nvmem_register(cons
|
|
|
|
if (nvmem->nkeepout) {
|
|
rval = nvmem_validate_keepouts(nvmem);
|
|
- if (rval)
|
|
- goto err_put_device;
|
|
+ if (rval) {
|
|
+ ida_free(&nvmem_ida, nvmem->id);
|
|
+ kfree(nvmem);
|
|
+ return ERR_PTR(rval);
|
|
+ }
|
|
}
|
|
|
|
dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|