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
58
59
60
61
62
63
64
65
66
67
68
69
|
Patch by Jeremy Drake, https://bugs.gentoo.org/show_bug.cgi?id=466430
Adds support for building with PaX hardened kernel
Adapted to version 2.0 by Sergey Popov <pinkbyte@gentoo.org>
--- a/ipt_NETFLOW.c
+++ b/ipt_NETFLOW.c
@@ -845,13 +845,13 @@
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 < LOCK_COUNT)
return -EPERM;
return set_hashsize(hsize)?:ret;
@@ -864,6 +864,7 @@
{
int ret;
struct ipt_netflow_sock *usock;
+ ctl_table_no_const lctl = *ctl;
mutex_lock(&sock_lock);
if (list_empty(&usock_list)) {
@@ -875,8 +876,8 @@
sndbuf = usock->sock->sk->sk_sndbuf;
mutex_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)
@@ -943,9 +944,10 @@
{
int ret;
int val = 0;
+ ctl_table_no_const lctl = *ctl;
- 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;
@@ -966,8 +968,9 @@
int ret;
int ver = protocol;
- ctl->data = &ver;
- ret = proc_dointvec(ctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
+ ctl_table_no_const lctl = *ctl;
+ lctl.data = &ver;
+ ret = proc_dointvec(&lctl, write, BEFORE2632(filp,) buffer, lenp, fpos);
if (!write)
return ret;
|