]> git.baikalelectronics.ru Git - kernel.git/commit
of: Fix a refcounting bug in __of_attach_node_sysfs()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 20 May 2020 12:04:14 +0000 (15:04 +0300)
committerRob Herring <robh@kernel.org>
Thu, 28 May 2020 01:30:25 +0000 (19:30 -0600)
commite09755207d632741bf20baacf20a204c0c2306b1
tree43b15e49cc02ece48eb1f19eb864e8faba9d4a56
parent46c2104147545e65c9c3b0ab15dcf4dd56ee1877
of: Fix a refcounting bug in __of_attach_node_sysfs()

The problem in this code is that if kobject_add() fails, then it should
call of_node_put(np) to drop the reference count.  I've actually moved
the of_node_get(np) later in the function to avoid needing to do clean
up.

Fixes: afe3dcfadb96 ("of: overlay: add missing of_node_get() in __of_attach_node_sysfs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/kobj.c