Skip to contentSkip to conversation

EDD - set sysfs attr owner field

DISCUSSION Matt Domsch 1 participant 1 message Apr 21, 2004

lore
Share & tools
lore
#0 lore raw

Andrew, the patch below from Michael E. Brown properly sets the owner field of a sysfs attribute. Without this patch, it is possible to crash the kernel with a simultaneous insmod/rmmod while reading files exported by the module.

Thanks,
Matt

Signature · 28 lines
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com


# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/04/21 00:13:44-05:00 [email protected] 
#   fix edd module unload race vs sysfs access
# 
# drivers/firmware/edd.c
#   2004/04/21 00:13:35-05:00 [email protected] +1 -1
#   fix edd module unload race vs sysfs access
# 
diff -Nru a/drivers/firmware/edd.c b/drivers/firmware/edd.c
--- a/drivers/firmware/edd.c	Wed Apr 21 00:41:03 2004
+++ b/drivers/firmware/edd.c	Wed Apr 21 00:41:03 2004
@@ -86,7 +86,7 @@
 
 #define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \
 struct edd_attribute edd_attr_##_name = { 	\
-	.attr = {.name = __stringify(_name), .mode = _mode },	\
+	.attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE },	\
 	.show	= _show,				\
 	.test	= _test,				\
 };