Commit 20fdaf6e authored by Sami Tolvanen's avatar Sami Tolvanen Committed by Pablo Neira Ayuso
Browse files

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: default avatarSami Tolvanen <samitolvanen@google.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 2e7b162c
Loading
Loading
Loading
Loading
+4 −10
Original line number Original line Diff line number Diff line
@@ -41,19 +41,13 @@
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/sysfs.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 idletimer_tg {
	struct list_head entry;
	struct list_head entry;
	struct timer_list timer;
	struct timer_list timer;
	struct work_struct work;
	struct work_struct work;


	struct kobject *kobj;
	struct kobject *kobj;
	struct idletimer_tg_attr attr;
	struct device_attribute attr;


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


static ssize_t idletimer_tg_show(struct kobject *kobj, struct attribute *attr,
static ssize_t idletimer_tg_show(struct device *dev,
				 char *buf)
				 struct device_attribute *attr, char *buf)
{
{
	struct idletimer_tg *timer;
	struct idletimer_tg *timer;
	unsigned long expires = 0;
	unsigned long expires = 0;


	mutex_lock(&list_mutex);
	mutex_lock(&list_mutex);


	timer =	__idletimer_tg_find_by_label(attr->name);
	timer =	__idletimer_tg_find_by_label(attr->attr.name);
	if (timer)
	if (timer)
		expires = timer->timer.expires;
		expires = timer->timer.expires;