From c4759b6ea8dc4bf5a08775750c798f803a6fe263 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Tue, 26 Feb 2019 13:07:52 -0800 Subject: [PATCH] UPSTREAM: netfilter: xt_IDLETIMER: fix sysfs callback function type 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. Bug: 117299373 Change-Id: I5cc50171e01a5162ef504a726fe3ed4b51941b34 (cherry-picked from commit 20fdaf6e1e313b4efa48243d5250526eb43ea70d) Signed-off-by: Sami Tolvanen Signed-off-by: Pablo Neira Ayuso --- net/netfilter/xt_IDLETIMER.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c index 559acfaec0e9..f5e165e018d9 100644 --- a/net/netfilter/xt_IDLETIMER.c +++ b/net/netfilter/xt_IDLETIMER.c @@ -51,19 +51,13 @@ #include #include -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; struct timespec delayed_timer_trigger; struct timespec last_modified_timer; @@ -184,8 +178,8 @@ 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; @@ -193,7 +187,7 @@ static ssize_t idletimer_tg_show(struct kobject *kobj, struct attribute *attr, 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;