summaryrefslogtreecommitdiffstats
path: root/recipes-enea/linx/linx-mod-2.6.5/support-for-3.11-kernel-versions.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-enea/linx/linx-mod-2.6.5/support-for-3.11-kernel-versions.patch')
-rw-r--r--recipes-enea/linx/linx-mod-2.6.5/support-for-3.11-kernel-versions.patch206
1 files changed, 206 insertions, 0 deletions
diff --git a/recipes-enea/linx/linx-mod-2.6.5/support-for-3.11-kernel-versions.patch b/recipes-enea/linx/linx-mod-2.6.5/support-for-3.11-kernel-versions.patch
new file mode 100644
index 0000000..d6f9106
--- /dev/null
+++ b/recipes-enea/linx/linx-mod-2.6.5/support-for-3.11-kernel-versions.patch
@@ -0,0 +1,206 @@
1From 20294330f08283d28b6092b568156e29b1792328 Mon Sep 17 00:00:00 2001
2From: Adrian Dudau <adrian.dudau@enea.com>
3Date: Thu, 12 Dec 2013 11:23:24 +0100
4Subject: [PATCH] support for 3.11 kernel versions
5
6Fixed NULL pointer dereference in ecm_conn.c
7
8Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
9---
10 cfg/db_proc.c | 23 ++++++++++++++++++-----
11 ecm/ecm_conn.c | 11 ++++++++---
12 ipc/hunt.c | 24 ++++++++++++++++++++++++
13 3 files changed, 50 insertions(+), 8 deletions(-)
14
15diff --git a/cfg/db_proc.c b/cfg/db_proc.c
16index c062a3d..bad0353 100644
17--- a/cfg/db_proc.c
18+++ b/cfg/db_proc.c
19@@ -41,6 +41,12 @@
20 #include "db_format.h"
21 #include <asm/uaccess.h>
22
23+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0))
24+#define PDE_INODE_NAME(inode) PDE_DATA(inode)
25+#else
26+#define PDE_INODE_NAME(inode) PDE(inode)->name
27+#endif
28+
29 struct db_seq {
30 const struct db_template *template;
31 struct list_head *list;
32@@ -148,11 +154,11 @@ static int db_proc_open(struct inode *inode, struct file *file)
33 if (status != 0)
34 goto out_20;
35
36- status = db_template_get(PDE(inode)->name, &p->template);
37+ status = db_template_get(PDE_INODE_NAME(inode), &p->template);
38 if (status != 0)
39 goto out_20;
40
41- status = db_list_get(PDE(inode)->name, &p->list);
42+ status = db_list_get(PDE_INODE_NAME(inode), &p->list);
43 if (status != 0)
44 goto out_10;
45
46@@ -161,7 +167,7 @@ static int db_proc_open(struct inode *inode, struct file *file)
47 return 0;
48
49 out_10:
50- db_template_put(PDE(inode)->name, &p->template);
51+ db_template_put(PDE_INODE_NAME(inode), &p->template);
52 out_20:
53 kfree(p);
54 return status;
55@@ -217,11 +223,11 @@ static int db_proc_release(struct inode *inode, struct file *file)
56 s = file->private_data;
57 p = s->private;
58
59- status = db_list_put(PDE(inode)->name, &p->list);
60+ status = db_list_put(PDE_INODE_NAME(inode), &p->list);
61 if (status != 0)
62 return status;
63
64- status = db_template_put(PDE(inode)->name, &p->template);
65+ status = db_template_put(PDE_INODE_NAME(inode), &p->template);
66 if (status != 0)
67 return status;
68
69@@ -258,14 +264,21 @@ int db_proc_add(const char *name)
70 {
71 struct proc_dir_entry *pde;
72
73+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
74+ pde = proc_create_data(name, 0777, db_proc_root,
75+ &db_proc_file_ops, (void *)name);
76+#else
77 pde = create_proc_entry(name, 0777, db_proc_root);
78+#endif
79 if (pde == NULL)
80 return -EINVAL;
81
82 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
83 pde->owner = THIS_MODULE;
84 #endif
85+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
86 pde->proc_fops = &db_proc_file_ops;
87+#endif
88 return 0;
89 }
90 EXPORT_SYMBOL(db_proc_add);
91diff --git a/ecm/ecm_conn.c b/ecm/ecm_conn.c
92index aaf5161..b81abd1 100644
93--- a/ecm/ecm_conn.c
94+++ b/ecm/ecm_conn.c
95@@ -905,8 +905,9 @@ static void free_ecm_connection(struct RlnhLinkObj *co)
96 {
97 /* Undo alloc_ecm_connection(). */
98 if (co != NULL) {
99- if (list_empty(&co->ecm_dev->conn_list))
100- dev_remove_pack(&co->ecm_dev->pt);
101+ if (co->ecm_dev != NULL)
102+ if (list_empty(&co->ecm_dev->conn_list))
103+ dev_remove_pack(&co->ecm_dev->pt);
104 if (co->con_name != NULL)
105 kfree(co->con_name);
106 if (co->dev_name != NULL)
107@@ -1315,7 +1316,11 @@ static int net_event(struct notifier_block *nb, unsigned long event, void *data)
108 struct ecm_work_net_event *p;
109
110 (void)nb;
111- dev = data;
112+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
113+ dev = netdev_notifier_info_to_dev(data);
114+#else
115+ dev = data;
116+#endif
117
118 w = alloc_ecm_work(sizeof(*p), ECM_WORK_NET_EVENT, GFP_KERNEL);
119 if (w == NULL)
120diff --git a/ipc/hunt.c b/ipc/hunt.c
121index 843a893..f4564eb 100644
122--- a/ipc/hunt.c
123+++ b/ipc/hunt.c
124@@ -743,7 +743,9 @@ static inline struct sock *__locate_name(const char *name,
125 unsigned hash, uint32_t hunter_spid)
126 {
127 struct sock *s, *s_found = NULL;
128+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
129 struct hlist_node *node;
130+#endif
131
132 linx_trace_enter(LINX_TRACEGROUP_IPC,
133 "%s, %d, 0x%x, 0x%x", name, len, hash, hunter_spid);
134@@ -753,7 +755,11 @@ static inline struct sock *__locate_name(const char *name,
135
136 /* Traverse the list of sockets in the specified hash slot to find a
137 match. */
138+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
139+ sk_for_each(s, &linx_sockets_bound[hash]) {
140+#else
141 sk_for_each(s, node, &linx_sockets_bound[hash]) {
142+#endif
143 linx_check_sock(s);
144
145 /* If the length of the aname are the same, potential match was found. */
146@@ -1122,7 +1128,9 @@ int linx_info_sockets(struct linx_info_sockets *isockets,
147 LINX_SPID __user * spids)
148 {
149 struct sock *sk;
150+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
151 const struct hlist_node *node;
152+#endif
153 int i, tot_sockets = 0, tot_sockets_tmp = 0, max_sockets;
154
155 LINX_ASSERT(isockets != NULL);
156@@ -1131,7 +1139,11 @@ int linx_info_sockets(struct linx_info_sockets *isockets,
157
158 read_lock_bh(&linx_socket_bound_unbound_lock);
159 /* Count the number of sockets the needs to be returned. */
160+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
161+ sk_for_each(sk, &linx_sockets_unbound) {
162+#else
163 sk_for_each(sk, node, &linx_sockets_unbound) {
164+#endif
165 if (linx_sk(sk)->type == LINX_TYPE_REMOTE && isockets->remote) {
166 tot_sockets_tmp++;
167 } else if (linx_sk(sk)->type == LINX_TYPE_LOCAL &&
168@@ -1156,7 +1168,11 @@ int linx_info_sockets(struct linx_info_sockets *isockets,
169
170 tot_sockets_tmp = 0;
171
172+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
173+ sk_for_each(sk, &linx_sockets_unbound) {
174+#else
175 sk_for_each(sk, node, &linx_sockets_unbound) {
176+#endif
177 LINX_SPID spid = linx_sock_to_spid(sk);
178 if (linx_sk(sk)->type == LINX_TYPE_REMOTE &&
179 isockets->remote) {
180@@ -1197,7 +1213,11 @@ int linx_info_sockets(struct linx_info_sockets *isockets,
181 for (i = 0; i < LINX_HASH_SIZE; i++) {
182 tot_sockets_tmp = 0;
183 read_lock_bh(&linx_socket_bound_unbound_lock);
184+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
185+ sk_for_each(sk, &linx_sockets_bound[i]) {
186+#else
187 sk_for_each(sk, node, &linx_sockets_bound[i]) {
188+#endif
189 if (linx_sk(sk)->type == LINX_TYPE_REMOTE &&
190 isockets->remote) {
191 tot_sockets_tmp++;
192@@ -1222,7 +1242,11 @@ int linx_info_sockets(struct linx_info_sockets *isockets,
193 }
194
195 tot_sockets_tmp = 0;
196+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
197+ sk_for_each(sk, &linx_sockets_bound[i]) {
198+#else
199 sk_for_each(sk, node, &linx_sockets_bound[i]) {
200+#endif
201 LINX_SPID spid = linx_sock_to_spid(sk);
202 if (linx_sk(sk)->type == LINX_TYPE_REMOTE &&
203 isockets->remote) {
204--
2051.8.3.2
206