aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 15:49:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 15:49:40 -0500
commit0191b625ca5a46206d2fb862bb08f36f2fcb3b31 (patch)
tree454d1842b1833d976da62abcbd5c47521ebe9bd7 /net/ax25
parent54a696bd07c14d3b1192d03ce7269bc59b45209a (diff)
parenteb56092fc168bf5af199d47af50c0d84a96db898 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1429 commits) net: Allow dependancies of FDDI & Tokenring to be modular. igb: Fix build warning when DCA is disabled. net: Fix warning fallout from recent NAPI interface changes. gro: Fix potential use after free sfc: If AN is enabled, always read speed/duplex from the AN advertising bits sfc: When disabling the NIC, close the device rather than unregistering it sfc: SFT9001: Add cable diagnostics sfc: Add support for multiple PHY self-tests sfc: Merge top-level functions for self-tests sfc: Clean up PHY mode management in loopback self-test sfc: Fix unreliable link detection in some loopback modes sfc: Generate unique names for per-NIC workqueues 802.3ad: use standard ethhdr instead of ad_header 802.3ad: generalize out mac address initializer 802.3ad: initialize ports LACPDU from const initializer 802.3ad: remove typedef around ad_system 802.3ad: turn ports is_individual into a bool 802.3ad: turn ports is_enabled into a bool 802.3ad: make ntt bool ixgbe: Fix set_ringparam in ixgbe to use the same memory pools. ... Fixed trivial IPv4/6 address printing conflicts in fs/cifs/connect.c due to the conversion to %pI (in this networking merge) and the addition of doing IPv6 addresses (from the earlier merge of CIFS).
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/ax25_in.c41
-rw-r--r--net/ax25/sysctl_net_ax25.c58
2 files changed, 45 insertions, 54 deletions
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 4a5ba978a804..5f1d2107a1dd 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -200,19 +200,15 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
200 200
201 skb_reset_transport_header(skb); 201 skb_reset_transport_header(skb);
202 202
203 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { 203 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
204 kfree_skb(skb); 204 goto free;
205 return 0;
206 }
207 205
208 /* 206 /*
209 * Parse the address header. 207 * Parse the address header.
210 */ 208 */
211 209
212 if (ax25_addr_parse(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL) { 210 if (ax25_addr_parse(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL)
213 kfree_skb(skb); 211 goto free;
214 return 0;
215 }
216 212
217 /* 213 /*
218 * Ours perhaps ? 214 * Ours perhaps ?
@@ -239,10 +235,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
239 235
240 ax25_send_to_raw(&dest, skb, skb->data[1]); 236 ax25_send_to_raw(&dest, skb, skb->data[1]);
241 237
242 if (!mine && ax25cmp(&dest, (ax25_address *)dev->broadcast) != 0) { 238 if (!mine && ax25cmp(&dest, (ax25_address *)dev->broadcast) != 0)
243 kfree_skb(skb); 239 goto free;
244 return 0;
245 }
246 240
247 /* Now we are pointing at the pid byte */ 241 /* Now we are pointing at the pid byte */
248 switch (skb->data[1]) { 242 switch (skb->data[1]) {
@@ -301,10 +295,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
301 * If not, should we DM the incoming frame (except DMs) or 295 * If not, should we DM the incoming frame (except DMs) or
302 * silently ignore them. For now we stay quiet. 296 * silently ignore them. For now we stay quiet.
303 */ 297 */
304 if (ax25_dev->values[AX25_VALUES_CONMODE] == 0) { 298 if (ax25_dev->values[AX25_VALUES_CONMODE] == 0)
305 kfree_skb(skb); 299 goto free;
306 return 0;
307 }
308 300
309 /* LAPB */ 301 /* LAPB */
310 302
@@ -339,8 +331,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
339 if ((*skb->data & ~AX25_PF) != AX25_DM && mine) 331 if ((*skb->data & ~AX25_PF) != AX25_DM && mine)
340 ax25_return_dm(dev, &src, &dest, &dp); 332 ax25_return_dm(dev, &src, &dest, &dp);
341 333
342 kfree_skb(skb); 334 goto free;
343 return 0;
344 } 335 }
345 336
346 /* b) received SABM(E) */ 337 /* b) received SABM(E) */
@@ -372,15 +363,12 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
372 sk->sk_ack_backlog++; 363 sk->sk_ack_backlog++;
373 bh_unlock_sock(sk); 364 bh_unlock_sock(sk);
374 } else { 365 } else {
375 if (!mine) { 366 if (!mine)
376 kfree_skb(skb); 367 goto free;
377 return 0;
378 }
379 368
380 if ((ax25 = ax25_create_cb()) == NULL) { 369 if ((ax25 = ax25_create_cb()) == NULL) {
381 ax25_return_dm(dev, &src, &dest, &dp); 370 ax25_return_dm(dev, &src, &dest, &dp);
382 kfree_skb(skb); 371 goto free;
383 return 0;
384 } 372 }
385 373
386 ax25_fillin_cb(ax25, ax25_dev); 374 ax25_fillin_cb(ax25, ax25_dev);
@@ -436,9 +424,10 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
436 if (!sock_flag(sk, SOCK_DEAD)) 424 if (!sock_flag(sk, SOCK_DEAD))
437 sk->sk_data_ready(sk, skb->len); 425 sk->sk_data_ready(sk, skb->len);
438 sock_put(sk); 426 sock_put(sk);
439 } else 427 } else {
428free:
440 kfree_skb(skb); 429 kfree_skb(skb);
441 430 }
442 return 0; 431 return 0;
443} 432}
444 433
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index f288fc4aef9b..62ee3fb34732 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -24,7 +24,9 @@ static int min_idle[1], max_idle[] = {65535000};
24static int min_n2[] = {1}, max_n2[] = {31}; 24static int min_n2[] = {1}, max_n2[] = {31};
25static int min_paclen[] = {1}, max_paclen[] = {512}; 25static int min_paclen[] = {1}, max_paclen[] = {512};
26static int min_proto[1], max_proto[] = { AX25_PROTO_MAX }; 26static int min_proto[1], max_proto[] = { AX25_PROTO_MAX };
27#ifdef CONFIG_AX25_DAMA_SLAVE
27static int min_ds_timeout[1], max_ds_timeout[] = {65535000}; 28static int min_ds_timeout[1], max_ds_timeout[] = {65535000};
29#endif
28 30
29static struct ctl_table_header *ax25_table_header; 31static struct ctl_table_header *ax25_table_header;
30 32
@@ -43,8 +45,8 @@ static const ctl_table ax25_param_table[] = {
43 .procname = "ip_default_mode", 45 .procname = "ip_default_mode",
44 .maxlen = sizeof(int), 46 .maxlen = sizeof(int),
45 .mode = 0644, 47 .mode = 0644,
46 .proc_handler = &proc_dointvec_minmax, 48 .proc_handler = proc_dointvec_minmax,
47 .strategy = &sysctl_intvec, 49 .strategy = sysctl_intvec,
48 .extra1 = &min_ipdefmode, 50 .extra1 = &min_ipdefmode,
49 .extra2 = &max_ipdefmode 51 .extra2 = &max_ipdefmode
50 }, 52 },
@@ -53,8 +55,8 @@ static const ctl_table ax25_param_table[] = {
53 .procname = "ax25_default_mode", 55 .procname = "ax25_default_mode",
54 .maxlen = sizeof(int), 56 .maxlen = sizeof(int),
55 .mode = 0644, 57 .mode = 0644,
56 .proc_handler = &proc_dointvec_minmax, 58 .proc_handler = proc_dointvec_minmax,
57 .strategy = &sysctl_intvec, 59 .strategy = sysctl_intvec,
58 .extra1 = &min_axdefmode, 60 .extra1 = &min_axdefmode,
59 .extra2 = &max_axdefmode 61 .extra2 = &max_axdefmode
60 }, 62 },
@@ -63,8 +65,8 @@ static const ctl_table ax25_param_table[] = {
63 .procname = "backoff_type", 65 .procname = "backoff_type",
64 .maxlen = sizeof(int), 66 .maxlen = sizeof(int),
65 .mode = 0644, 67 .mode = 0644,
66 .proc_handler = &proc_dointvec_minmax, 68 .proc_handler = proc_dointvec_minmax,
67 .strategy = &sysctl_intvec, 69 .strategy = sysctl_intvec,
68 .extra1 = &min_backoff, 70 .extra1 = &min_backoff,
69 .extra2 = &max_backoff 71 .extra2 = &max_backoff
70 }, 72 },
@@ -73,8 +75,8 @@ static const ctl_table ax25_param_table[] = {
73 .procname = "connect_mode", 75 .procname = "connect_mode",
74 .maxlen = sizeof(int), 76 .maxlen = sizeof(int),
75 .mode = 0644, 77 .mode = 0644,
76 .proc_handler = &proc_dointvec_minmax, 78 .proc_handler = proc_dointvec_minmax,
77 .strategy = &sysctl_intvec, 79 .strategy = sysctl_intvec,
78 .extra1 = &min_conmode, 80 .extra1 = &min_conmode,
79 .extra2 = &max_conmode 81 .extra2 = &max_conmode
80 }, 82 },
@@ -83,8 +85,8 @@ static const ctl_table ax25_param_table[] = {
83 .procname = "standard_window_size", 85 .procname = "standard_window_size",
84 .maxlen = sizeof(int), 86 .maxlen = sizeof(int),
85 .mode = 0644, 87 .mode = 0644,
86 .proc_handler = &proc_dointvec_minmax, 88 .proc_handler = proc_dointvec_minmax,
87 .strategy = &sysctl_intvec, 89 .strategy = sysctl_intvec,
88 .extra1 = &min_window, 90 .extra1 = &min_window,
89 .extra2 = &max_window 91 .extra2 = &max_window
90 }, 92 },
@@ -93,8 +95,8 @@ static const ctl_table ax25_param_table[] = {
93 .procname = "extended_window_size", 95 .procname = "extended_window_size",
94 .maxlen = sizeof(int), 96 .maxlen = sizeof(int),
95 .mode = 0644, 97 .mode = 0644,
96 .proc_handler = &proc_dointvec_minmax, 98 .proc_handler = proc_dointvec_minmax,
97 .strategy = &sysctl_intvec, 99 .strategy = sysctl_intvec,
98 .extra1 = &min_ewindow, 100 .extra1 = &min_ewindow,
99 .extra2 = &max_ewindow 101 .extra2 = &max_ewindow
100 }, 102 },
@@ -103,8 +105,8 @@ static const ctl_table ax25_param_table[] = {
103 .procname = "t1_timeout", 105 .procname = "t1_timeout",
104 .maxlen = sizeof(int), 106 .maxlen = sizeof(int),
105 .mode = 0644, 107 .mode = 0644,
106 .proc_handler = &proc_dointvec_minmax, 108 .proc_handler = proc_dointvec_minmax,
107 .strategy = &sysctl_intvec, 109 .strategy = sysctl_intvec,
108 .extra1 = &min_t1, 110 .extra1 = &min_t1,
109 .extra2 = &max_t1 111 .extra2 = &max_t1
110 }, 112 },
@@ -113,8 +115,8 @@ static const ctl_table ax25_param_table[] = {
113 .procname = "t2_timeout", 115 .procname = "t2_timeout",
114 .maxlen = sizeof(int), 116 .maxlen = sizeof(int),
115 .mode = 0644, 117 .mode = 0644,
116 .proc_handler = &proc_dointvec_minmax, 118 .proc_handler = proc_dointvec_minmax,
117 .strategy = &sysctl_intvec, 119 .strategy = sysctl_intvec,
118 .extra1 = &min_t2, 120 .extra1 = &min_t2,
119 .extra2 = &max_t2 121 .extra2 = &max_t2
120 }, 122 },
@@ -123,8 +125,8 @@ static const ctl_table ax25_param_table[] = {
123 .procname = "t3_timeout", 125 .procname = "t3_timeout",
124 .maxlen = sizeof(int), 126 .maxlen = sizeof(int),
125 .mode = 0644, 127 .mode = 0644,
126 .proc_handler = &proc_dointvec_minmax, 128 .proc_handler = proc_dointvec_minmax,
127 .strategy = &sysctl_intvec, 129 .strategy = sysctl_intvec,
128 .extra1 = &min_t3, 130 .extra1 = &min_t3,
129 .extra2 = &max_t3 131 .extra2 = &max_t3
130 }, 132 },
@@ -133,8 +135,8 @@ static const ctl_table ax25_param_table[] = {
133 .procname = "idle_timeout", 135 .procname = "idle_timeout",
134 .maxlen = sizeof(int), 136 .maxlen = sizeof(int),
135 .mode = 0644, 137 .mode = 0644,
136 .proc_handler = &proc_dointvec_minmax, 138 .proc_handler = proc_dointvec_minmax,
137 .strategy = &sysctl_intvec, 139 .strategy = sysctl_intvec,
138 .extra1 = &min_idle, 140 .extra1 = &min_idle,
139 .extra2 = &max_idle 141 .extra2 = &max_idle
140 }, 142 },
@@ -143,8 +145,8 @@ static const ctl_table ax25_param_table[] = {
143 .procname = "maximum_retry_count", 145 .procname = "maximum_retry_count",
144 .maxlen = sizeof(int), 146 .maxlen = sizeof(int),
145 .mode = 0644, 147 .mode = 0644,
146 .proc_handler = &proc_dointvec_minmax, 148 .proc_handler = proc_dointvec_minmax,
147 .strategy = &sysctl_intvec, 149 .strategy = sysctl_intvec,
148 .extra1 = &min_n2, 150 .extra1 = &min_n2,
149 .extra2 = &max_n2 151 .extra2 = &max_n2
150 }, 152 },
@@ -153,8 +155,8 @@ static const ctl_table ax25_param_table[] = {
153 .procname = "maximum_packet_length", 155 .procname = "maximum_packet_length",
154 .maxlen = sizeof(int), 156 .maxlen = sizeof(int),
155 .mode = 0644, 157 .mode = 0644,
156 .proc_handler = &proc_dointvec_minmax, 158 .proc_handler = proc_dointvec_minmax,
157 .strategy = &sysctl_intvec, 159 .strategy = sysctl_intvec,
158 .extra1 = &min_paclen, 160 .extra1 = &min_paclen,
159 .extra2 = &max_paclen 161 .extra2 = &max_paclen
160 }, 162 },
@@ -163,8 +165,8 @@ static const ctl_table ax25_param_table[] = {
163 .procname = "protocol", 165 .procname = "protocol",
164 .maxlen = sizeof(int), 166 .maxlen = sizeof(int),
165 .mode = 0644, 167 .mode = 0644,
166 .proc_handler = &proc_dointvec_minmax, 168 .proc_handler = proc_dointvec_minmax,
167 .strategy = &sysctl_intvec, 169 .strategy = sysctl_intvec,
168 .extra1 = &min_proto, 170 .extra1 = &min_proto,
169 .extra2 = &max_proto 171 .extra2 = &max_proto
170 }, 172 },
@@ -174,8 +176,8 @@ static const ctl_table ax25_param_table[] = {
174 .procname = "dama_slave_timeout", 176 .procname = "dama_slave_timeout",
175 .maxlen = sizeof(int), 177 .maxlen = sizeof(int),
176 .mode = 0644, 178 .mode = 0644,
177 .proc_handler = &proc_dointvec_minmax, 179 .proc_handler = proc_dointvec_minmax,
178 .strategy = &sysctl_intvec, 180 .strategy = sysctl_intvec,
179 .extra1 = &min_ds_timeout, 181 .extra1 = &min_ds_timeout,
180 .extra2 = &max_ds_timeout 182 .extra2 = &max_ds_timeout
181 }, 183 },