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:   Wed, 18 Dec 2019 15:12:07 +0100
From:   Arnaud Pouliquen <arnaud.pouliquen@...com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, <arnaud.pouliquen@...com>
Subject: [PATCH] component: fix debugfs.

In component_devices_show function, the data field
of the component_match_array structure can not match with the
device structure type. As mentioned in component_match_add_release
description, data field type is undefined. This can result to an
unexpected print or can generate an overflow.
Seems no generic way to get the component name, so this patch
prints the component device name only if registered.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@...com>
---
 drivers/base/component.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index 532a3a5d8f63..3ce4f75a6610 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -102,11 +102,13 @@ static int component_devices_show(struct seq_file *s, void *data)
 	seq_printf(s, "%-40s %20s\n", "device name", "status");
 	seq_puts(s, "-------------------------------------------------------------\n");
 	for (i = 0; i < match->num; i++) {
-		struct device *d = (struct device *)match->compare[i].data;
+		struct component *comp = match->compare[i].component;
 
-		seq_printf(s, "%-40s %20s\n", dev_name(d),
-			   match->compare[i].component ?
-			   "registered" : "not registered");
+		if (comp)
+			seq_printf(s, "%-40s %20s\n", dev_name(comp->dev),
+				   "registered");
+		else
+			seq_printf(s, "%61s\n", "not registered");
 	}
 	mutex_unlock(&component_mutex);
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ