Commit c7fb6b75 authored by Tobin C. Harding's avatar Tobin C. Harding Committed by Greg Kroah-Hartman

ocfs2: fix error path kobject memory leak

[ Upstream commit b9fba67b3806e21b98bd5a98dc3921a8e9b42d61 ]

If a call to kobject_init_and_add() fails we should call kobject_put()
otherwise we leak memory.

Add call to kobject_put() in the error path of call to
kobject_init_and_add().  Please note, this has the side effect that the
release method is called if kobject_init_and_add() fails.

Link: 's avatarTobin C. Harding <>
Reviewed-by: 's avatarGreg Kroah-Hartman <>
Reviewed-by: 's avatarJoseph Qi <>
Cc: Mark Fasheh <>
Cc: Joel Becker <>
Cc: Junxiao Bi <>
Cc: Changwei Ge <>
Cc: Gang He <>
Cc: Jun Piao <>
Signed-off-by: 's avatarAndrew Morton <>
Signed-off-by: 's avatarLinus Torvalds <>
Signed-off-by: 's avatarSasha Levin <>
parent fedb1b9c
......@@ -193,6 +193,7 @@ int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb)
ret = kobject_init_and_add(&entry->fs_kobj, &ocfs2_ktype_filecheck,
NULL, "filecheck");
if (ret) {
return ret;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment