[PATCH 0/2] nvmem: layouts: fix device_node reference leaks on error path

Leo Cheng posted 2 patches 1 month, 2 weeks ago
Only 0 patches received!
drivers/nvmem/layouts/onie-tlv.c | 1 +
drivers/nvmem/layouts/sl28vpd.c  | 1 +
2 files changed, 2 insertions(+)
[PATCH 0/2] nvmem: layouts: fix device_node reference leaks on error path
Posted by Leo Cheng 1 month, 2 weeks ago
Both in-tree nvmem layout drivers take a device_node reference with
of_get_child_by_name() and hand it to nvmem_add_one_cell(). That helper
does not take its own reference: on success the created cell entry adopts
the caller's reference and releases it later, and on failure it does not
consume it, so the caller still owns it. Both drivers only put the
container node on the nvmem_add_one_cell() error path and leak the child
node reference.

Fix both error paths to also put the child node.

Leo Cheng (2):
  nvmem: layouts: sl28vpd: fix device_node reference leak in error path
  nvmem: layouts: onie-tlv: fix device_node reference leak in error path

 drivers/nvmem/layouts/onie-tlv.c | 1 +
 drivers/nvmem/layouts/sl28vpd.c  | 1 +
 2 files changed, 2 insertions(+)

-- 
2.43.0