sched/cpufreq: Fix kobject memleak
authorTobin C. Harding <tobin@kernel.org>
Tue, 30 Apr 2019 00:11:44 +0000 (10:11 +1000)
committerIngo Molnar <mingo@kernel.org>
Tue, 30 Apr 2019 05:57:23 +0000 (07:57 +0200)
commit9a4f26cc98d81b67ecc23b890c28e2df324e29f3
treed121e33139a3a521e51a595d86675f108f3cb945
parent37624b58542fb9f2d9a70e6ea006ef8a5f66c30b
sched/cpufreq: 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.

Fix it by adding a call to kobject_put() in the error path of
kobject_init_and_add().

Signed-off-by: Tobin C. Harding <tobin@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tobin C. Harding <tobin@kernel.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Link: http://lkml.kernel.org/r/20190430001144.24890-1-tobin@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/cpufreq_schedutil.c