]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
netfilter: xt_IDLETIMER: fix sysfs callback function type
authorSami Tolvanen <samitolvanen@google.com>
Wed, 27 Feb 2019 18:19:10 +0000 (10:19 -0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 1 Mar 2019 13:36:57 +0000 (14:36 +0100)
Use struct device_attribute instead of struct idletimer_tg_attr, and
the correct callback function type to avoid indirect call mismatches
with Control Flow Integrity checking.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_IDLETIMER.c

index eb4cbd244c3d311e2630a4c4cae868f0343c30f0..5f9b37e128014c76a048e4e516cff0a8d6e08152 100644 (file)
 #include <linux/workqueue.h>
 #include <linux/sysfs.h>
 
-struct idletimer_tg_attr {
-       struct attribute attr;
-       ssize_t (*show)(struct kobject *kobj,
-                       struct attribute *attr, char *buf);
-};
-
 struct idletimer_tg {
        struct list_head entry;
        struct timer_list timer;
        struct work_struct work;
 
        struct kobject *kobj;
-       struct idletimer_tg_attr attr;
+       struct device_attribute attr;
 
        unsigned int refcnt;
 };
@@ -76,15 +70,15 @@ struct idletimer_tg *__idletimer_tg_find_by_label(const char *label)
        return NULL;
 }
 
-static ssize_t idletimer_tg_show(struct kobject *kobj, struct attribute *attr,
-                                char *buf)
+static ssize_t idletimer_tg_show(struct device *dev,
+                                struct device_attribute *attr, char *buf)
 {
        struct idletimer_tg *timer;
        unsigned long expires = 0;
 
        mutex_lock(&list_mutex);
 
-       timer = __idletimer_tg_find_by_label(attr->name);
+       timer = __idletimer_tg_find_by_label(attr->attr.name);
        if (timer)
                expires = timer->timer.expires;