[PATCH] sysfs: (rest) if show/store is missing return -EIO
sysfs: fix the rest of the kernel so if an attribute doesn't implement show or store method read/write will return -EIO instead of 0 or -EINVAL or -EPERM. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
6c1852a08e
commit
70f2817a43
@@ -155,7 +155,7 @@ seclvl_attr_store(struct kobject *kobj,
|
||||
struct seclvl_obj *obj = container_of(kobj, struct seclvl_obj, kobj);
|
||||
struct seclvl_attribute *attribute =
|
||||
container_of(attr, struct seclvl_attribute, attr);
|
||||
return (attribute->store ? attribute->store(obj, buf, len) : 0);
|
||||
return attribute->store ? attribute->store(obj, buf, len) : -EIO;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
@@ -164,7 +164,7 @@ seclvl_attr_show(struct kobject *kobj, struct attribute *attr, char *buf)
|
||||
struct seclvl_obj *obj = container_of(kobj, struct seclvl_obj, kobj);
|
||||
struct seclvl_attribute *attribute =
|
||||
container_of(attr, struct seclvl_attribute, attr);
|
||||
return (attribute->show ? attribute->show(obj, buf) : 0);
|
||||
return attribute->show ? attribute->show(obj, buf) : -EIO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user