summaryrefslogtreecommitdiffstats
path: root/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch
blob: d608835a4d80f6e2f722cb5e5c61dd69bed141e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- a/src/linux/xt_coova.c
+++ b/src/linux/xt_coova.c
@@ -292,6 +292,8 @@ static int coova_mt_check(const struct x
 	struct coova_table *t;
 #ifdef CONFIG_PROC_FS
 	struct proc_dir_entry *pde;
+	kuid_t uid;
+	kgid_t gid;
 #endif
 	unsigned i;
 	int ret = 0;
@@ -330,8 +332,9 @@ static int coova_mt_check(const struct x
 		ret = -ENOMEM;
 		goto out;
 	}
-	pde->uid = ip_list_uid;
-	pde->gid = ip_list_gid;
+	uid = make_kuid(&init_user_ns, ip_list_uid);
+	gid = make_kgid(&init_user_ns, ip_list_gid);
+	proc_set_user(pde, uid, gid);
 #endif
 	spin_lock_bh(&coova_lock);
 	list_add_tail(&t->list, &tables);
@@ -445,14 +448,13 @@ static const struct seq_operations coova
 
 static int coova_seq_open(struct inode *inode, struct file *file)
 {
-	struct proc_dir_entry *pde = PDE(inode);
 	struct coova_iter_state *st;
 
 	st = __seq_open_private(file, &coova_seq_ops, sizeof(*st));
 	if (st == NULL)
 		return -ENOMEM;
 
-	st->table = pde->data;
+	st->table = PDE_DATA(inode);
 	return 0;
 }
 
@@ -460,8 +462,7 @@ static ssize_t
 coova_mt_proc_write(struct file *file, const char __user *input,
 		    size_t size, loff_t *loff)
 {
-	const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
-	struct coova_table *t = pde->data;
+	struct coova_table *t = PDE_DATA(file->f_path.dentry->d_inode);
 	struct coova_entry *e;
 	char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")];
 	const char *c = buf;