Skip to content

Commit 9195d76

Browse files
CoreRasuraegregkh
authored andcommitted
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: 84c45d5 ("staging: gasket: Replace macro __ATTR with __ATTR_NULL") Signed-off-by: Luis Mendes <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8f3d9f3 commit 9195d76

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

drivers/staging/gasket/gasket_sysfs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ int gasket_sysfs_create_entries(struct device *device,
228228
}
229229

230230
mutex_lock(&mapping->mutex);
231-
for (i = 0; strcmp(attrs[i].attr.attr.name, GASKET_ARRAY_END_MARKER);
232-
i++) {
231+
for (i = 0; attrs[i].attr.attr.name != NULL; i++) {
233232
if (mapping->attribute_count == GASKET_SYSFS_MAX_NODES) {
234233
dev_err(device,
235234
"Maximum number of sysfs nodes reached for device\n");

drivers/staging/gasket/gasket_sysfs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
*/
3131
#define GASKET_SYSFS_MAX_NODES 196
3232

33-
/* End markers for sysfs struct arrays. */
34-
#define GASKET_ARRAY_END_TOKEN GASKET_RESERVED_ARRAY_END
35-
#define GASKET_ARRAY_END_MARKER __stringify(GASKET_ARRAY_END_TOKEN)
36-
3733
/*
3834
* Terminator struct for a gasket_sysfs_attr array. Must be at the end of
3935
* all gasket_sysfs_attribute arrays.

0 commit comments

Comments
 (0)