lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  1 Feb 2021 02:50:41 -0500
From:   Abel Wu <abel.w@...oud.com>
To:     rjw@...ysocki.net, pavel@....cz
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        hewenliang4@...wei.com, wuyun.wu@...wei.com,
        Abel Wu <abel.w@...oud.com>
Subject: [PATCH] PM: hibernate: add sanity check on power_kobj

The @power_kobj is initialized in pm_init() which is the same
initcall level as pm_disk_init(). Although this dependency is
guaranteed based on the current initcall serial execution model,
it would still be better do a cost-less sanity check to avoid
oops once the dependency is broken.

Signed-off-by: Abel Wu <abel.w@...oud.com>
---
 kernel/power/hibernate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index da0b41914177..060089cc261d 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -1262,6 +1262,9 @@ static const struct attribute_group attr_group = {
 
 static int __init pm_disk_init(void)
 {
+	if (!power_kobj)
+		return -EINVAL;
+
 	return sysfs_create_group(power_kobj, &attr_group);
 }
 
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ