Driver core: warn when userspace writes to the uevent file in a non-supported way
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 5 Apr 2007 23:40:38 +0000 (01:40 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 17:57:31 +0000 (10:57 -0700)
In the future we will allow the uevent type to be written to the uevent
file to trigger the different types of uevents.  But for now, as we only
support the ADD event, warn if userspace tries to write anything else to
this file.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/core.c

index 72c6ee57471b7f5ee344eb3c5d2132576ca6e676..f69305c7269d1cf7fb294c2576a67c66118f7d64 100644 (file)
@@ -296,6 +296,9 @@ out:
 static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
                            const char *buf, size_t count)
 {
+       if (memcmp(buf, "add", 3) != 0)
+               dev_err(dev, "uevent: unsupported action-string; this will "
+                       "be ignored in a future kernel version");
        kobject_uevent(&dev->kobj, KOBJ_ADD);
        return count;
 }