summaryrefslogtreecommitdiff
blob: 792b68279d0f6629a4612fb59a44edad7ec77894 (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
50
51
52
53
54
55
56
57
Patch by Jeremy Drake, https://bugs.gentoo.org/show_bug.cgi?id=466430

Adds support for building with PaX hardened kernel

--- ipt_NETFLOW.c.orig	2013-06-26 23:02:17.000000000 +0400
+++ ipt_NETFLOW.c	2013-06-26 23:04:52.000000000 +0400
@@ -371,14 +371,13 @@
 static int hsize_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp,)
 			 void __user *buffer, size_t *lenp, loff_t *fpos)
 {
-	void *orig = ctl->data;
+	ctl_table_no_const lctl = *ctl;
 	int ret, hsize;
 
 	if (write)
-		ctl->data = &hsize;
-	ret = proc_dointvec(ctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
+		lctl.data = &hsize;
+	ret = proc_dointvec(&lctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
 	if (write) {
-		ctl->data = orig;
 		if (hsize < 1)
 			return -EPERM;
 		return set_hashsize(hsize)?:ret;
@@ -391,6 +390,7 @@
 {
 	int ret;
 	struct ipt_netflow_sock *usock;
+	ctl_table_no_const lctl = *ctl;
        
 	read_lock(&sock_lock);
 	if (list_empty(&usock_list)) {
@@ -401,8 +401,8 @@
 	sndbuf = usock->sock->sk->sk_sndbuf;
 	read_unlock(&sock_lock);
 
-	ctl->data = &sndbuf;
-	ret = proc_dointvec(ctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
+	lctl.data = &sndbuf;
+	ret = proc_dointvec(&lctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
 	if (!write)
 		return ret;
 	if (sndbuf < SOCK_MIN_SNDBUF)
@@ -451,10 +451,11 @@
 {
 	int ret;
 	int val;
+	ctl_table_no_const lctl = *ctl;
 
 	val = 0;
-	ctl->data = &val;
-	ret = proc_dointvec(ctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
+	lctl.data = &val;
+	ret = proc_dointvec(&lctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
 
 	if (!write)
 		return ret;