Patch "nvmem: core: Fix a resource leak on error in nvmem_add_cells_from_of()" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nvmem: core: Fix a resource leak on error in nvmem_add_cells_from_of()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nvmem-core-fix-a-resource-leak-on-error-in-nvmem_add.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a27b97bb1036af92f46545b0037d1ec91ba87df2
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Fri Jan 29 17:14:26 2021 +0000

    nvmem: core: Fix a resource leak on error in nvmem_add_cells_from_of()
    
    [ Upstream commit 72e008ce307fa2f35f6783997378b32e83122839 ]
    
    This doesn't call of_node_put() on the error path so it leads to a
    memory leak.
    
    Fixes: 0749aa25af82 ("nvmem: core: fix regression in of_nvmem_cell_get()")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210129171430.11328-2-srinivas.kandagatla@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index a09ff8409f600..1a3460a8e73ab 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -576,6 +576,7 @@ static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
 				cell->name, nvmem->stride);
 			/* Cells already added will be freed later. */
 			kfree_const(cell->name);
+			of_node_put(cell->np);
 			kfree(cell);
 			return -EINVAL;
 		}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux