This Linux kernel change "sched/cpufreq: Fix kobject memleak" is included in the Linux 5.1 release. This change is authored by Tobin C. Harding <tobin [at] kernel.org> on Tue Apr 30 10:11:44 2019 +1000. The commit for this change in Linux stable tree is 9a4f26c (patch).
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 <email@example.com> Cc: Greg Kroah-Hartman <firstname.lastname@example.org> Cc: Linus Torvalds <email@example.com> Cc: Peter Zijlstra <firstname.lastname@example.org> Cc: Rafael J. Wysocki <email@example.com> Cc: Thomas Gleixner <firstname.lastname@example.org> Cc: Tobin C. Harding <email@example.com> Cc: Vincent Guittot <firstname.lastname@example.org> Cc: Viresh Kumar <email@example.com> Link: http://firstname.lastname@example.org Signed-off-by: Ingo Molnar <email@example.com>
There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
kernel/sched/cpufreq_schedutil.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 5c41ea3..3638d23 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -771,6 +771,7 @@ static int sugov_init(struct cpufreq_policy *policy) return 0; fail: + kobject_put(&tunables->attr_set.kobj); policy->governor_data = NULL; sugov_tunables_free(tunables);