Commit 7fc33a36 authored by Anel Orazgaliyeva's avatar Anel Orazgaliyeva Committed by Xia Fukun
Browse files

cpuidle: Fix kobject memory leaks in error paths

stable inclusion
from stable-v4.19.294
commit 22d44652b6d6404b96a40bb051d1046e6c005ae5
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I81G0T


CVE: NA

--------------------------------

[ Upstream commit e5f5a66c ]

Commit c343bf1b ("cpuidle: Fix three reference count leaks")
fixes the cleanup of kobjects; however, it removes kfree() calls
altogether, leading to memory leaks.

Fix those and also defer the initialization of dev->kobj_dev until
after the error check, so that we do not end up with a dangling
pointer.

Fixes: c343bf1b ("cpuidle: Fix three reference count leaks")
Signed-off-by: default avatarAnel Orazgaliyeva <anelkz@amazon.de>
Suggested-by: default avatarAman Priyadarshi <apeureka@amazon.de>
[ rjw: Subject edits ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarXia Fukun <xiafukun@huawei.com>
parent e898cffa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment