]> git.baikalelectronics.ru Git - kernel.git/commit
dlm: Fix kobject memleak
authorWang Hai <wanghai38@huawei.com>
Mon, 15 Jun 2020 03:25:33 +0000 (11:25 +0800)
committerDavid Teigland <teigland@redhat.com>
Thu, 6 Aug 2020 15:30:49 +0000 (10:30 -0500)
commit4bc03402d79c714bcb17a11bb827392c4f1206ed
tree5d38247952bdb7f8b7ee9a380f663f6a4f0b40d4
parente86d80f3f3da4d1072ca810bbe97a8ef4bd674b0
dlm: Fix kobject memleak

Currently the error return path from kobject_init_and_add() is not
followed by a call to kobject_put() - which means we are leaking
the kobject.

Set do_unreg = 1 before kobject_init_and_add() to ensure that
kobject_put() can be called in its error patch.

Fixes: 78b68ef95bb4 ("Kobject: change GFS2 to use kobject_init_and_add")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lockspace.c