]> git.baikalelectronics.ru Git - kernel.git/commit
bonding: Fix reference count leak in bond_sysfs_slave_add.
authorQiushi Wu <wu000273@umn.edu>
Thu, 28 May 2020 03:10:29 +0000 (22:10 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 May 2020 18:08:16 +0000 (11:08 -0700)
commit68004d7179ee5bebf70fea1df0a9e92839ad482d
treeec255ba76de111c5398513fa3cfb2cd5c1c4dcad
parent1ea896ddbed12f554ea477c63c9e95cf1bc804d7
bonding: Fix reference count leak in bond_sysfs_slave_add.

kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object. Previous
commit "f20a305eb122" fixed a similar problem.

Fixes: 66554649a1ca ("bonding: add sysfs /slave dir for bond slave devices.")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_sysfs_slave.c