Skip to contentSkip to conversation

patch "staging: gasket: Fix incongruency in handling of sysfs entries" added to staging-linus

PATCH [email protected] 1 participant 1 message Apr 13, 2020

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

staging: gasket: Fix incongruency in handling of sysfs entries

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 9195d762042b0e5e4ded63606b4b30a93cba4400 Mon Sep 17 00:00:00 2001
From: Luis Mendes <[email protected]>
Date: Fri, 3 Apr 2020 16:15:34 +0100
Subject: staging: gasket: Fix incongruency in handling of sysfs entries
creation

Fix incongruency in handling of sysfs entries creation. This issue could cause invalid memory accesses, by not properly detecting the end of the sysfs attributes array.

Fixes 84c45d5f3bf1 ("staging: gasket: Replace macro __ATTR with __ATTR_NULL")
Cc stable <[email protected]>
---
 drivers/staging/gasket/gasket_sysfs.c | 3 +--
 drivers/staging/gasket/gasket_sysfs.h | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/staging/gasket/gasket_sysfs.c +1 -2
index a2d67c28f530..5f0e089573a2 100644
@@ -228,8 +228,7 @@ int gasket_sysfs_create_entries(struct device *device,
 	}
 
 	mutex_lock(&mapping->mutex);
-	for (i = 0; strcmp(attrs[i].attr.attr.name, GASKET_ARRAY_END_MARKER);
-		i++) {
+	for (i = 0; attrs[i].attr.attr.name != NULL; i++) {
 		if (mapping->attribute_count == GASKET_SYSFS_MAX_NODES) {
 			dev_err(device,
 				"Maximum number of sysfs nodes reached for device\n");
drivers/staging/gasket/gasket_sysfs.h +0 -4
index 1d0eed66a7f4..ab5aa351d555 100644
@@ -30,10 +30,6 @@
  */
 #define GASKET_SYSFS_MAX_NODES 196
 
-/* End markers for sysfs struct arrays. */
-#define GASKET_ARRAY_END_TOKEN GASKET_RESERVED_ARRAY_END
-#define GASKET_ARRAY_END_MARKER __stringify(GASKET_ARRAY_END_TOKEN)
-
 /*
  * Terminator struct for a gasket_sysfs_attr array. Must be at the end of
  * all gasket_sysfs_attribute arrays.
Signature · 1 line
2.26.0