Skip to content

Commit 20fdaf6

Browse files
samitolvanenummakynes
authored andcommitted
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. Signed-off-by: Sami Tolvanen <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 2e7b162 commit 20fdaf6

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

net/netfilter/xt_IDLETIMER.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,13 @@
4141
#include <linux/workqueue.h>
4242
#include <linux/sysfs.h>
4343

44-
struct idletimer_tg_attr {
45-
struct attribute attr;
46-
ssize_t (*show)(struct kobject *kobj,
47-
struct attribute *attr, char *buf);
48-
};
49-
5044
struct idletimer_tg {
5145
struct list_head entry;
5246
struct timer_list timer;
5347
struct work_struct work;
5448

5549
struct kobject *kobj;
56-
struct idletimer_tg_attr attr;
50+
struct device_attribute attr;
5751

5852
unsigned int refcnt;
5953
};
@@ -76,15 +70,15 @@ struct idletimer_tg *__idletimer_tg_find_by_label(const char *label)
7670
return NULL;
7771
}
7872

79-
static ssize_t idletimer_tg_show(struct kobject *kobj, struct attribute *attr,
80-
char *buf)
73+
static ssize_t idletimer_tg_show(struct device *dev,
74+
struct device_attribute *attr, char *buf)
8175
{
8276
struct idletimer_tg *timer;
8377
unsigned long expires = 0;
8478

8579
mutex_lock(&list_mutex);
8680

87-
timer = __idletimer_tg_find_by_label(attr->name);
81+
timer = __idletimer_tg_find_by_label(attr->attr.name);
8882
if (timer)
8983
expires = timer->timer.expires;
9084

0 commit comments

Comments
 (0)