aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c9
-rw-r--r--net/core/skbuff.c15
-rw-r--r--net/ipv4/icmp.c3
-rw-r--r--net/ipv4/inet_diag.c243
-rw-r--r--net/ipv4/inetpeer.c6
-rw-r--r--net/ipv4/ip_gre.c33
-rw-r--r--net/ipv4/ip_output.c1
-rw-r--r--net/ipv4/ipip.c18
-rw-r--r--net/ipv4/ipmr.c22
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv6/ip6_output.c4
-rw-r--r--net/ipv6/ip6_tunnel.c24
-rw-r--r--net/ipv6/sit.c20
-rw-r--r--net/key/af_key.c3
-rw-r--r--net/sched/Makefile14
-rw-r--r--net/sched/act_api.c4
-rw-r--r--net/sched/act_gact.c (renamed from net/sched/gact.c)3
-rw-r--r--net/sched/act_ipt.c (renamed from net/sched/ipt.c)6
-rw-r--r--net/sched/act_mirred.c (renamed from net/sched/mirred.c)3
-rw-r--r--net/sched/act_pedit.c (renamed from net/sched/pedit.c)5
-rw-r--r--net/sched/act_police.c (renamed from net/sched/police.c)17
-rw-r--r--net/sched/act_simple.c (renamed from net/sched/simple.c)3
-rw-r--r--net/sched/sch_cbq.c4
-rw-r--r--net/sched/sch_hfsc.c12
-rw-r--r--net/sched/sch_htb.c4
-rw-r--r--net/sched/sch_prio.c7
-rw-r--r--net/sched/sch_teql.c12
-rw-r--r--net/sctp/sm_sideeffect.c3
-rw-r--r--net/sunrpc/cache.c5
-rw-r--r--net/sunrpc/svc.c3
-rw-r--r--net/xfrm/xfrm_algo.c6
-rw-r--r--net/xfrm/xfrm_policy.c6
32 files changed, 286 insertions, 234 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 5081287923d5..bf66b114d3c2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1092,15 +1092,12 @@ int skb_checksum_help(struct sk_buff *skb, int inward)
1092 goto out; 1092 goto out;
1093 } 1093 }
1094 1094
1095 if (offset > (int)skb->len) 1095 BUG_ON(offset > (int)skb->len);
1096 BUG();
1097 csum = skb_checksum(skb, offset, skb->len-offset, 0); 1096 csum = skb_checksum(skb, offset, skb->len-offset, 0);
1098 1097
1099 offset = skb->tail - skb->h.raw; 1098 offset = skb->tail - skb->h.raw;
1100 if (offset <= 0) 1099 BUG_ON(offset <= 0);
1101 BUG(); 1100 BUG_ON(skb->csum + 2 > offset);
1102 if (skb->csum + 2 > offset)
1103 BUG();
1104 1101
1105 *(u16*)(skb->h.raw + skb->csum) = csum_fold(csum); 1102 *(u16*)(skb->h.raw + skb->csum) = csum_fold(csum);
1106 skb->ip_summed = CHECKSUM_NONE; 1103 skb->ip_summed = CHECKSUM_NONE;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 070f91cfde59..d0732e9c8560 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -791,8 +791,7 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc)
791 int end = offset + skb_shinfo(skb)->frags[i].size; 791 int end = offset + skb_shinfo(skb)->frags[i].size;
792 if (end > len) { 792 if (end > len) {
793 if (skb_cloned(skb)) { 793 if (skb_cloned(skb)) {
794 if (!realloc) 794 BUG_ON(!realloc);
795 BUG();
796 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 795 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
797 return -ENOMEM; 796 return -ENOMEM;
798 } 797 }
@@ -894,8 +893,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
894 struct sk_buff *insp = NULL; 893 struct sk_buff *insp = NULL;
895 894
896 do { 895 do {
897 if (!list) 896 BUG_ON(!list);
898 BUG();
899 897
900 if (list->len <= eat) { 898 if (list->len <= eat) {
901 /* Eaten as whole. */ 899 /* Eaten as whole. */
@@ -1199,8 +1197,7 @@ unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1199 start = end; 1197 start = end;
1200 } 1198 }
1201 } 1199 }
1202 if (len) 1200 BUG_ON(len);
1203 BUG();
1204 1201
1205 return csum; 1202 return csum;
1206} 1203}
@@ -1282,8 +1279,7 @@ unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
1282 start = end; 1279 start = end;
1283 } 1280 }
1284 } 1281 }
1285 if (len) 1282 BUG_ON(len);
1286 BUG();
1287 return csum; 1283 return csum;
1288} 1284}
1289 1285
@@ -1297,8 +1293,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
1297 else 1293 else
1298 csstart = skb_headlen(skb); 1294 csstart = skb_headlen(skb);
1299 1295
1300 if (csstart > skb_headlen(skb)) 1296 BUG_ON(csstart > skb_headlen(skb));
1301 BUG();
1302 1297
1303 memcpy(to, skb->data, csstart); 1298 memcpy(to, skb->data, csstart);
1304 1299
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index be5a519cd2f8..105039eb7629 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -899,8 +899,7 @@ static void icmp_address_reply(struct sk_buff *skb)
899 u32 _mask, *mp; 899 u32 _mask, *mp;
900 900
901 mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); 901 mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask);
902 if (mp == NULL) 902 BUG_ON(mp == NULL);
903 BUG();
904 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { 903 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
905 if (*mp == ifa->ifa_mask && 904 if (*mp == ifa->ifa_mask &&
906 inet_ifa_match(rt->rt_src, ifa)) 905 inet_ifa_match(rt->rt_src, ifa))
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index c49908192047..457db99c76df 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -50,9 +50,10 @@ static struct sock *idiagnl;
50#define INET_DIAG_PUT(skb, attrtype, attrlen) \ 50#define INET_DIAG_PUT(skb, attrtype, attrlen) \
51 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen)) 51 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
52 52
53static int inet_diag_fill(struct sk_buff *skb, struct sock *sk, 53static int inet_csk_diag_fill(struct sock *sk,
54 int ext, u32 pid, u32 seq, u16 nlmsg_flags, 54 struct sk_buff *skb,
55 const struct nlmsghdr *unlh) 55 int ext, u32 pid, u32 seq, u16 nlmsg_flags,
56 const struct nlmsghdr *unlh)
56{ 57{
57 const struct inet_sock *inet = inet_sk(sk); 58 const struct inet_sock *inet = inet_sk(sk);
58 const struct inet_connection_sock *icsk = inet_csk(sk); 59 const struct inet_connection_sock *icsk = inet_csk(sk);
@@ -70,20 +71,22 @@ static int inet_diag_fill(struct sk_buff *skb, struct sock *sk,
70 nlh->nlmsg_flags = nlmsg_flags; 71 nlh->nlmsg_flags = nlmsg_flags;
71 72
72 r = NLMSG_DATA(nlh); 73 r = NLMSG_DATA(nlh);
73 if (sk->sk_state != TCP_TIME_WAIT) { 74 BUG_ON(sk->sk_state == TCP_TIME_WAIT);
74 if (ext & (1 << (INET_DIAG_MEMINFO - 1))) 75
75 minfo = INET_DIAG_PUT(skb, INET_DIAG_MEMINFO, 76 if (ext & (1 << (INET_DIAG_MEMINFO - 1)))
76 sizeof(*minfo)); 77 minfo = INET_DIAG_PUT(skb, INET_DIAG_MEMINFO, sizeof(*minfo));
77 if (ext & (1 << (INET_DIAG_INFO - 1))) 78
78 info = INET_DIAG_PUT(skb, INET_DIAG_INFO, 79 if (ext & (1 << (INET_DIAG_INFO - 1)))
79 handler->idiag_info_size); 80 info = INET_DIAG_PUT(skb, INET_DIAG_INFO,
80 81 handler->idiag_info_size);
81 if ((ext & (1 << (INET_DIAG_CONG - 1))) && icsk->icsk_ca_ops) { 82
82 size_t len = strlen(icsk->icsk_ca_ops->name); 83 if ((ext & (1 << (INET_DIAG_CONG - 1))) && icsk->icsk_ca_ops) {
83 strcpy(INET_DIAG_PUT(skb, INET_DIAG_CONG, len + 1), 84 const size_t len = strlen(icsk->icsk_ca_ops->name);
84 icsk->icsk_ca_ops->name); 85
85 } 86 strcpy(INET_DIAG_PUT(skb, INET_DIAG_CONG, len + 1),
87 icsk->icsk_ca_ops->name);
86 } 88 }
89
87 r->idiag_family = sk->sk_family; 90 r->idiag_family = sk->sk_family;
88 r->idiag_state = sk->sk_state; 91 r->idiag_state = sk->sk_state;
89 r->idiag_timer = 0; 92 r->idiag_timer = 0;
@@ -93,37 +96,6 @@ static int inet_diag_fill(struct sk_buff *skb, struct sock *sk,
93 r->id.idiag_cookie[0] = (u32)(unsigned long)sk; 96 r->id.idiag_cookie[0] = (u32)(unsigned long)sk;
94 r->id.idiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1); 97 r->id.idiag_cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1);
95 98
96 if (r->idiag_state == TCP_TIME_WAIT) {
97 const struct inet_timewait_sock *tw = inet_twsk(sk);
98 long tmo = tw->tw_ttd - jiffies;
99 if (tmo < 0)
100 tmo = 0;
101
102 r->id.idiag_sport = tw->tw_sport;
103 r->id.idiag_dport = tw->tw_dport;
104 r->id.idiag_src[0] = tw->tw_rcv_saddr;
105 r->id.idiag_dst[0] = tw->tw_daddr;
106 r->idiag_state = tw->tw_substate;
107 r->idiag_timer = 3;
108 r->idiag_expires = (tmo * 1000 + HZ - 1) / HZ;
109 r->idiag_rqueue = 0;
110 r->idiag_wqueue = 0;
111 r->idiag_uid = 0;
112 r->idiag_inode = 0;
113#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
114 if (r->idiag_family == AF_INET6) {
115 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
116
117 ipv6_addr_copy((struct in6_addr *)r->id.idiag_src,
118 &tw6->tw_v6_rcv_saddr);
119 ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst,
120 &tw6->tw_v6_daddr);
121 }
122#endif
123 nlh->nlmsg_len = skb->tail - b;
124 return skb->len;
125 }
126
127 r->id.idiag_sport = inet->sport; 99 r->id.idiag_sport = inet->sport;
128 r->id.idiag_dport = inet->dport; 100 r->id.idiag_dport = inet->dport;
129 r->id.idiag_src[0] = inet->rcv_saddr; 101 r->id.idiag_src[0] = inet->rcv_saddr;
@@ -185,7 +157,75 @@ nlmsg_failure:
185 return -1; 157 return -1;
186} 158}
187 159
188static int inet_diag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh) 160static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
161 struct sk_buff *skb, int ext, u32 pid,
162 u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh)
164{
165 long tmo;
166 struct inet_diag_msg *r;
167 const unsigned char *previous_tail = skb->tail;
168 struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq,
169 unlh->nlmsg_type, sizeof(*r));
170
171 r = NLMSG_DATA(nlh);
172 BUG_ON(tw->tw_state != TCP_TIME_WAIT);
173
174 nlh->nlmsg_flags = nlmsg_flags;
175
176 tmo = tw->tw_ttd - jiffies;
177 if (tmo < 0)
178 tmo = 0;
179
180 r->idiag_family = tw->tw_family;
181 r->idiag_state = tw->tw_state;
182 r->idiag_timer = 0;
183 r->idiag_retrans = 0;
184 r->id.idiag_if = tw->tw_bound_dev_if;
185 r->id.idiag_cookie[0] = (u32)(unsigned long)tw;
186 r->id.idiag_cookie[1] = (u32)(((unsigned long)tw >> 31) >> 1);
187 r->id.idiag_sport = tw->tw_sport;
188 r->id.idiag_dport = tw->tw_dport;
189 r->id.idiag_src[0] = tw->tw_rcv_saddr;
190 r->id.idiag_dst[0] = tw->tw_daddr;
191 r->idiag_state = tw->tw_substate;
192 r->idiag_timer = 3;
193 r->idiag_expires = (tmo * 1000 + HZ - 1) / HZ;
194 r->idiag_rqueue = 0;
195 r->idiag_wqueue = 0;
196 r->idiag_uid = 0;
197 r->idiag_inode = 0;
198#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
199 if (tw->tw_family == AF_INET6) {
200 const struct inet6_timewait_sock *tw6 =
201 inet6_twsk((struct sock *)tw);
202
203 ipv6_addr_copy((struct in6_addr *)r->id.idiag_src,
204 &tw6->tw_v6_rcv_saddr);
205 ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst,
206 &tw6->tw_v6_daddr);
207 }
208#endif
209 nlh->nlmsg_len = skb->tail - previous_tail;
210 return skb->len;
211nlmsg_failure:
212 skb_trim(skb, previous_tail - skb->data);
213 return -1;
214}
215
216static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
217 int ext, u32 pid, u32 seq, u16 nlmsg_flags,
218 const struct nlmsghdr *unlh)
219{
220 if (sk->sk_state == TCP_TIME_WAIT)
221 return inet_twsk_diag_fill((struct inet_timewait_sock *)sk,
222 skb, ext, pid, seq, nlmsg_flags,
223 unlh);
224 return inet_csk_diag_fill(sk, skb, ext, pid, seq, nlmsg_flags, unlh);
225}
226
227static int inet_diag_get_exact(struct sk_buff *in_skb,
228 const struct nlmsghdr *nlh)
189{ 229{
190 int err; 230 int err;
191 struct sock *sk; 231 struct sock *sk;
@@ -235,7 +275,7 @@ static int inet_diag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nl
235 if (!rep) 275 if (!rep)
236 goto out; 276 goto out;
237 277
238 if (inet_diag_fill(rep, sk, req->idiag_ext, 278 if (sk_diag_fill(sk, rep, req->idiag_ext,
239 NETLINK_CB(in_skb).pid, 279 NETLINK_CB(in_skb).pid,
240 nlh->nlmsg_seq, 0, nlh) <= 0) 280 nlh->nlmsg_seq, 0, nlh) <= 0)
241 BUG(); 281 BUG();
@@ -283,7 +323,7 @@ static int bitstring_match(const u32 *a1, const u32 *a2, int bits)
283 323
284 324
285static int inet_diag_bc_run(const void *bc, int len, 325static int inet_diag_bc_run(const void *bc, int len,
286 const struct inet_diag_entry *entry) 326 const struct inet_diag_entry *entry)
287{ 327{
288 while (len > 0) { 328 while (len > 0) {
289 int yes = 1; 329 int yes = 1;
@@ -322,7 +362,7 @@ static int inet_diag_bc_run(const void *bc, int len,
322 yes = 0; 362 yes = 0;
323 break; 363 break;
324 } 364 }
325 365
326 if (cond->prefix_len == 0) 366 if (cond->prefix_len == 0)
327 break; 367 break;
328 368
@@ -331,7 +371,8 @@ static int inet_diag_bc_run(const void *bc, int len,
331 else 371 else
332 addr = entry->daddr; 372 addr = entry->daddr;
333 373
334 if (bitstring_match(addr, cond->addr, cond->prefix_len)) 374 if (bitstring_match(addr, cond->addr,
375 cond->prefix_len))
335 break; 376 break;
336 if (entry->family == AF_INET6 && 377 if (entry->family == AF_INET6 &&
337 cond->family == AF_INET) { 378 cond->family == AF_INET) {
@@ -346,7 +387,7 @@ static int inet_diag_bc_run(const void *bc, int len,
346 } 387 }
347 } 388 }
348 389
349 if (yes) { 390 if (yes) {
350 len -= op->yes; 391 len -= op->yes;
351 bc += op->yes; 392 bc += op->yes;
352 } else { 393 } else {
@@ -407,14 +448,15 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
407 default: 448 default:
408 return -EINVAL; 449 return -EINVAL;
409 } 450 }
410 bc += op->yes; 451 bc += op->yes;
411 len -= op->yes; 452 len -= op->yes;
412 } 453 }
413 return len == 0 ? 0 : -EINVAL; 454 return len == 0 ? 0 : -EINVAL;
414} 455}
415 456
416static int inet_diag_dump_sock(struct sk_buff *skb, struct sock *sk, 457static int inet_csk_diag_dump(struct sock *sk,
417 struct netlink_callback *cb) 458 struct sk_buff *skb,
459 struct netlink_callback *cb)
418{ 460{
419 struct inet_diag_req *r = NLMSG_DATA(cb->nlh); 461 struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
420 462
@@ -444,14 +486,50 @@ static int inet_diag_dump_sock(struct sk_buff *skb, struct sock *sk,
444 return 0; 486 return 0;
445 } 487 }
446 488
447 return inet_diag_fill(skb, sk, r->idiag_ext, NETLINK_CB(cb->skb).pid, 489 return inet_csk_diag_fill(sk, skb, r->idiag_ext,
448 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh); 490 NETLINK_CB(cb->skb).pid,
491 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
492}
493
494static int inet_twsk_diag_dump(struct inet_timewait_sock *tw,
495 struct sk_buff *skb,
496 struct netlink_callback *cb)
497{
498 struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
499
500 if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) {
501 struct inet_diag_entry entry;
502 struct rtattr *bc = (struct rtattr *)(r + 1);
503
504 entry.family = tw->tw_family;
505#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
506 if (tw->tw_family == AF_INET6) {
507 struct inet6_timewait_sock *tw6 =
508 inet6_twsk((struct sock *)tw);
509 entry.saddr = tw6->tw_v6_rcv_saddr.s6_addr32;
510 entry.daddr = tw6->tw_v6_daddr.s6_addr32;
511 } else
512#endif
513 {
514 entry.saddr = &tw->tw_rcv_saddr;
515 entry.daddr = &tw->tw_daddr;
516 }
517 entry.sport = tw->tw_num;
518 entry.dport = ntohs(tw->tw_dport);
519 entry.userlocks = 0;
520
521 if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry))
522 return 0;
523 }
524
525 return inet_twsk_diag_fill(tw, skb, r->idiag_ext,
526 NETLINK_CB(cb->skb).pid,
527 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
449} 528}
450 529
451static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, 530static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
452 struct request_sock *req, 531 struct request_sock *req, u32 pid, u32 seq,
453 u32 pid, u32 seq, 532 const struct nlmsghdr *unlh)
454 const struct nlmsghdr *unlh)
455{ 533{
456 const struct inet_request_sock *ireq = inet_rsk(req); 534 const struct inet_request_sock *ireq = inet_rsk(req);
457 struct inet_sock *inet = inet_sk(sk); 535 struct inet_sock *inet = inet_sk(sk);
@@ -504,7 +582,7 @@ nlmsg_failure:
504} 582}
505 583
506static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, 584static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
507 struct netlink_callback *cb) 585 struct netlink_callback *cb)
508{ 586{
509 struct inet_diag_entry entry; 587 struct inet_diag_entry entry;
510 struct inet_diag_req *r = NLMSG_DATA(cb->nlh); 588 struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
@@ -556,7 +634,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
556 inet6_rsk(req)->loc_addr.s6_addr32 : 634 inet6_rsk(req)->loc_addr.s6_addr32 :
557#endif 635#endif
558 &ireq->loc_addr; 636 &ireq->loc_addr;
559 entry.daddr = 637 entry.daddr =
560#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 638#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
561 (entry.family == AF_INET6) ? 639 (entry.family == AF_INET6) ?
562 inet6_rsk(req)->rmt_addr.s6_addr32 : 640 inet6_rsk(req)->rmt_addr.s6_addr32 :
@@ -599,7 +677,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
599 handler = inet_diag_table[cb->nlh->nlmsg_type]; 677 handler = inet_diag_table[cb->nlh->nlmsg_type];
600 BUG_ON(handler == NULL); 678 BUG_ON(handler == NULL);
601 hashinfo = handler->idiag_hashinfo; 679 hashinfo = handler->idiag_hashinfo;
602 680
603 s_i = cb->args[1]; 681 s_i = cb->args[1];
604 s_num = num = cb->args[2]; 682 s_num = num = cb->args[2];
605 683
@@ -630,7 +708,7 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
630 cb->args[3] > 0) 708 cb->args[3] > 0)
631 goto syn_recv; 709 goto syn_recv;
632 710
633 if (inet_diag_dump_sock(skb, sk, cb) < 0) { 711 if (inet_csk_diag_dump(sk, skb, cb) < 0) {
634 inet_listen_unlock(hashinfo); 712 inet_listen_unlock(hashinfo);
635 goto done; 713 goto done;
636 } 714 }
@@ -672,7 +750,6 @@ skip_listen_ht:
672 s_num = 0; 750 s_num = 0;
673 751
674 read_lock_bh(&head->lock); 752 read_lock_bh(&head->lock);
675
676 num = 0; 753 num = 0;
677 sk_for_each(sk, node, &head->chain) { 754 sk_for_each(sk, node, &head->chain) {
678 struct inet_sock *inet = inet_sk(sk); 755 struct inet_sock *inet = inet_sk(sk);
@@ -684,9 +761,10 @@ skip_listen_ht:
684 if (r->id.idiag_sport != inet->sport && 761 if (r->id.idiag_sport != inet->sport &&
685 r->id.idiag_sport) 762 r->id.idiag_sport)
686 goto next_normal; 763 goto next_normal;
687 if (r->id.idiag_dport != inet->dport && r->id.idiag_dport) 764 if (r->id.idiag_dport != inet->dport &&
765 r->id.idiag_dport)
688 goto next_normal; 766 goto next_normal;
689 if (inet_diag_dump_sock(skb, sk, cb) < 0) { 767 if (inet_csk_diag_dump(sk, skb, cb) < 0) {
690 read_unlock_bh(&head->lock); 768 read_unlock_bh(&head->lock);
691 goto done; 769 goto done;
692 } 770 }
@@ -695,19 +773,20 @@ next_normal:
695 } 773 }
696 774
697 if (r->idiag_states & TCPF_TIME_WAIT) { 775 if (r->idiag_states & TCPF_TIME_WAIT) {
698 sk_for_each(sk, node, 776 struct inet_timewait_sock *tw;
777
778 inet_twsk_for_each(tw, node,
699 &hashinfo->ehash[i + hashinfo->ehash_size].chain) { 779 &hashinfo->ehash[i + hashinfo->ehash_size].chain) {
700 struct inet_sock *inet = inet_sk(sk);
701 780
702 if (num < s_num) 781 if (num < s_num)
703 goto next_dying; 782 goto next_dying;
704 if (r->id.idiag_sport != inet->sport && 783 if (r->id.idiag_sport != tw->tw_sport &&
705 r->id.idiag_sport) 784 r->id.idiag_sport)
706 goto next_dying; 785 goto next_dying;
707 if (r->id.idiag_dport != inet->dport && 786 if (r->id.idiag_dport != tw->tw_dport &&
708 r->id.idiag_dport) 787 r->id.idiag_dport)
709 goto next_dying; 788 goto next_dying;
710 if (inet_diag_dump_sock(skb, sk, cb) < 0) { 789 if (inet_twsk_diag_dump(tw, skb, cb) < 0) {
711 read_unlock_bh(&head->lock); 790 read_unlock_bh(&head->lock);
712 goto done; 791 goto done;
713 } 792 }
@@ -724,8 +803,7 @@ done:
724 return skb->len; 803 return skb->len;
725} 804}
726 805
727static __inline__ int 806static inline int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
728inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
729{ 807{
730 if (!(nlh->nlmsg_flags&NLM_F_REQUEST)) 808 if (!(nlh->nlmsg_flags&NLM_F_REQUEST))
731 return 0; 809 return 0;
@@ -755,9 +833,8 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
755 } 833 }
756 return netlink_dump_start(idiagnl, skb, nlh, 834 return netlink_dump_start(idiagnl, skb, nlh,
757 inet_diag_dump, NULL); 835 inet_diag_dump, NULL);
758 } else { 836 } else
759 return inet_diag_get_exact(skb, nlh); 837 return inet_diag_get_exact(skb, nlh);
760 }
761 838
762err_inval: 839err_inval:
763 return -EINVAL; 840 return -EINVAL;
@@ -766,15 +843,15 @@ err_inval:
766 843
767static inline void inet_diag_rcv_skb(struct sk_buff *skb) 844static inline void inet_diag_rcv_skb(struct sk_buff *skb)
768{ 845{
769 int err;
770 struct nlmsghdr * nlh;
771
772 if (skb->len >= NLMSG_SPACE(0)) { 846 if (skb->len >= NLMSG_SPACE(0)) {
773 nlh = (struct nlmsghdr *)skb->data; 847 int err;
774 if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) 848 struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
849
850 if (nlh->nlmsg_len < sizeof(*nlh) ||
851 skb->len < nlh->nlmsg_len)
775 return; 852 return;
776 err = inet_diag_rcv_msg(skb, nlh); 853 err = inet_diag_rcv_msg(skb, nlh);
777 if (err || nlh->nlmsg_flags & NLM_F_ACK) 854 if (err || nlh->nlmsg_flags & NLM_F_ACK)
778 netlink_ack(skb, nlh, err); 855 netlink_ack(skb, nlh, err);
779 } 856 }
780} 857}
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index ce5fe3f74a3d..2160874ce7aa 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -304,8 +304,7 @@ static void unlink_from_pool(struct inet_peer *p)
304 /* look for a node to insert instead of p */ 304 /* look for a node to insert instead of p */
305 struct inet_peer *t; 305 struct inet_peer *t;
306 t = lookup_rightempty(p); 306 t = lookup_rightempty(p);
307 if (*stackptr[-1] != t) 307 BUG_ON(*stackptr[-1] != t);
308 BUG();
309 **--stackptr = t->avl_left; 308 **--stackptr = t->avl_left;
310 /* t is removed, t->v4daddr > x->v4daddr for any 309 /* t is removed, t->v4daddr > x->v4daddr for any
311 * x in p->avl_left subtree. 310 * x in p->avl_left subtree.
@@ -314,8 +313,7 @@ static void unlink_from_pool(struct inet_peer *p)
314 t->avl_left = p->avl_left; 313 t->avl_left = p->avl_left;
315 t->avl_right = p->avl_right; 314 t->avl_right = p->avl_right;
316 t->avl_height = p->avl_height; 315 t->avl_height = p->avl_height;
317 if (delp[1] != &p->avl_left) 316 BUG_ON(delp[1] != &p->avl_left);
318 BUG();
319 delp[1] = &t->avl_left; /* was &p->avl_left */ 317 delp[1] = &t->avl_left; /* was &p->avl_left */
320 } 318 }
321 peer_avl_rebalance(stack, stackptr); 319 peer_avl_rebalance(stack, stackptr);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index de16e944777f..1e93eafa7af1 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -188,7 +188,7 @@ static struct ip_tunnel * ipgre_tunnel_lookup(u32 remote, u32 local, u32 key)
188 } 188 }
189 189
190 if (ipgre_fb_tunnel_dev->flags&IFF_UP) 190 if (ipgre_fb_tunnel_dev->flags&IFF_UP)
191 return ipgre_fb_tunnel_dev->priv; 191 return netdev_priv(ipgre_fb_tunnel_dev);
192 return NULL; 192 return NULL;
193} 193}
194 194
@@ -278,7 +278,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
278 return NULL; 278 return NULL;
279 279
280 dev->init = ipgre_tunnel_init; 280 dev->init = ipgre_tunnel_init;
281 nt = dev->priv; 281 nt = netdev_priv(dev);
282 nt->parms = *parms; 282 nt->parms = *parms;
283 283
284 if (register_netdevice(dev) < 0) { 284 if (register_netdevice(dev) < 0) {
@@ -286,9 +286,6 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
286 goto failed; 286 goto failed;
287 } 287 }
288 288
289 nt = dev->priv;
290 nt->parms = *parms;
291
292 dev_hold(dev); 289 dev_hold(dev);
293 ipgre_tunnel_link(nt); 290 ipgre_tunnel_link(nt);
294 return nt; 291 return nt;
@@ -299,7 +296,7 @@ failed:
299 296
300static void ipgre_tunnel_uninit(struct net_device *dev) 297static void ipgre_tunnel_uninit(struct net_device *dev)
301{ 298{
302 ipgre_tunnel_unlink((struct ip_tunnel*)dev->priv); 299 ipgre_tunnel_unlink(netdev_priv(dev));
303 dev_put(dev); 300 dev_put(dev);
304} 301}
305 302
@@ -518,7 +515,7 @@ out:
518 skb2->dst->ops->update_pmtu(skb2->dst, rel_info); 515 skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
519 rel_info = htonl(rel_info); 516 rel_info = htonl(rel_info);
520 } else if (type == ICMP_TIME_EXCEEDED) { 517 } else if (type == ICMP_TIME_EXCEEDED) {
521 struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; 518 struct ip_tunnel *t = netdev_priv(skb2->dev);
522 if (t->parms.iph.ttl) { 519 if (t->parms.iph.ttl) {
523 rel_type = ICMP_DEST_UNREACH; 520 rel_type = ICMP_DEST_UNREACH;
524 rel_code = ICMP_HOST_UNREACH; 521 rel_code = ICMP_HOST_UNREACH;
@@ -669,7 +666,7 @@ drop_nolock:
669 666
670static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 667static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
671{ 668{
672 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 669 struct ip_tunnel *tunnel = netdev_priv(dev);
673 struct net_device_stats *stats = &tunnel->stat; 670 struct net_device_stats *stats = &tunnel->stat;
674 struct iphdr *old_iph = skb->nh.iph; 671 struct iphdr *old_iph = skb->nh.iph;
675 struct iphdr *tiph; 672 struct iphdr *tiph;
@@ -915,7 +912,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
915 t = ipgre_tunnel_locate(&p, 0); 912 t = ipgre_tunnel_locate(&p, 0);
916 } 913 }
917 if (t == NULL) 914 if (t == NULL)
918 t = (struct ip_tunnel*)dev->priv; 915 t = netdev_priv(dev);
919 memcpy(&p, &t->parms, sizeof(p)); 916 memcpy(&p, &t->parms, sizeof(p));
920 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 917 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
921 err = -EFAULT; 918 err = -EFAULT;
@@ -955,7 +952,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
955 } else { 952 } else {
956 unsigned nflags=0; 953 unsigned nflags=0;
957 954
958 t = (struct ip_tunnel*)dev->priv; 955 t = netdev_priv(dev);
959 956
960 if (MULTICAST(p.iph.daddr)) 957 if (MULTICAST(p.iph.daddr))
961 nflags = IFF_BROADCAST; 958 nflags = IFF_BROADCAST;
@@ -1004,7 +1001,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
1004 if ((t = ipgre_tunnel_locate(&p, 0)) == NULL) 1001 if ((t = ipgre_tunnel_locate(&p, 0)) == NULL)
1005 goto done; 1002 goto done;
1006 err = -EPERM; 1003 err = -EPERM;
1007 if (t == ipgre_fb_tunnel_dev->priv) 1004 if (t == netdev_priv(ipgre_fb_tunnel_dev))
1008 goto done; 1005 goto done;
1009 dev = t->dev; 1006 dev = t->dev;
1010 } 1007 }
@@ -1021,12 +1018,12 @@ done:
1021 1018
1022static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev) 1019static struct net_device_stats *ipgre_tunnel_get_stats(struct net_device *dev)
1023{ 1020{
1024 return &(((struct ip_tunnel*)dev->priv)->stat); 1021 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
1025} 1022}
1026 1023
1027static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) 1024static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1028{ 1025{
1029 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 1026 struct ip_tunnel *tunnel = netdev_priv(dev);
1030 if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen) 1027 if (new_mtu < 68 || new_mtu > 0xFFF8 - tunnel->hlen)
1031 return -EINVAL; 1028 return -EINVAL;
1032 dev->mtu = new_mtu; 1029 dev->mtu = new_mtu;
@@ -1066,7 +1063,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1066static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 1063static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
1067 void *daddr, void *saddr, unsigned len) 1064 void *daddr, void *saddr, unsigned len)
1068{ 1065{
1069 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1066 struct ip_tunnel *t = netdev_priv(dev);
1070 struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); 1067 struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen);
1071 u16 *p = (u16*)(iph+1); 1068 u16 *p = (u16*)(iph+1);
1072 1069
@@ -1093,7 +1090,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
1093 1090
1094static int ipgre_open(struct net_device *dev) 1091static int ipgre_open(struct net_device *dev)
1095{ 1092{
1096 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1093 struct ip_tunnel *t = netdev_priv(dev);
1097 1094
1098 if (MULTICAST(t->parms.iph.daddr)) { 1095 if (MULTICAST(t->parms.iph.daddr)) {
1099 struct flowi fl = { .oif = t->parms.link, 1096 struct flowi fl = { .oif = t->parms.link,
@@ -1117,7 +1114,7 @@ static int ipgre_open(struct net_device *dev)
1117 1114
1118static int ipgre_close(struct net_device *dev) 1115static int ipgre_close(struct net_device *dev)
1119{ 1116{
1120 struct ip_tunnel *t = (struct ip_tunnel*)dev->priv; 1117 struct ip_tunnel *t = netdev_priv(dev);
1121 if (MULTICAST(t->parms.iph.daddr) && t->mlink) { 1118 if (MULTICAST(t->parms.iph.daddr) && t->mlink) {
1122 struct in_device *in_dev = inetdev_by_index(t->mlink); 1119 struct in_device *in_dev = inetdev_by_index(t->mlink);
1123 if (in_dev) { 1120 if (in_dev) {
@@ -1157,7 +1154,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1157 int mtu = ETH_DATA_LEN; 1154 int mtu = ETH_DATA_LEN;
1158 int addend = sizeof(struct iphdr) + 4; 1155 int addend = sizeof(struct iphdr) + 4;
1159 1156
1160 tunnel = (struct ip_tunnel*)dev->priv; 1157 tunnel = netdev_priv(dev);
1161 iph = &tunnel->parms.iph; 1158 iph = &tunnel->parms.iph;
1162 1159
1163 tunnel->dev = dev; 1160 tunnel->dev = dev;
@@ -1221,7 +1218,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1221 1218
1222static int __init ipgre_fb_tunnel_init(struct net_device *dev) 1219static int __init ipgre_fb_tunnel_init(struct net_device *dev)
1223{ 1220{
1224 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 1221 struct ip_tunnel *tunnel = netdev_priv(dev);
1225 struct iphdr *iph = &tunnel->parms.iph; 1222 struct iphdr *iph = &tunnel->parms.iph;
1226 1223
1227 tunnel->dev = dev; 1224 tunnel->dev = dev;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index c2169b47ddfd..3324fbfe528a 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -69,6 +69,7 @@
69#include <net/ip.h> 69#include <net/ip.h>
70#include <net/protocol.h> 70#include <net/protocol.h>
71#include <net/route.h> 71#include <net/route.h>
72#include <net/xfrm.h>
72#include <linux/skbuff.h> 73#include <linux/skbuff.h>
73#include <net/sock.h> 74#include <net/sock.h>
74#include <net/arp.h> 75#include <net/arp.h>
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index bbd85f5ec985..bc5ca23b2646 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -244,7 +244,7 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
244 if (dev == NULL) 244 if (dev == NULL)
245 return NULL; 245 return NULL;
246 246
247 nt = dev->priv; 247 nt = netdev_priv(dev);
248 SET_MODULE_OWNER(dev); 248 SET_MODULE_OWNER(dev);
249 dev->init = ipip_tunnel_init; 249 dev->init = ipip_tunnel_init;
250 nt->parms = *parms; 250 nt->parms = *parms;
@@ -269,7 +269,7 @@ static void ipip_tunnel_uninit(struct net_device *dev)
269 tunnels_wc[0] = NULL; 269 tunnels_wc[0] = NULL;
270 write_unlock_bh(&ipip_lock); 270 write_unlock_bh(&ipip_lock);
271 } else 271 } else
272 ipip_tunnel_unlink((struct ip_tunnel*)dev->priv); 272 ipip_tunnel_unlink(netdev_priv(dev));
273 dev_put(dev); 273 dev_put(dev);
274} 274}
275 275
@@ -443,7 +443,7 @@ out:
443 skb2->dst->ops->update_pmtu(skb2->dst, rel_info); 443 skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
444 rel_info = htonl(rel_info); 444 rel_info = htonl(rel_info);
445 } else if (type == ICMP_TIME_EXCEEDED) { 445 } else if (type == ICMP_TIME_EXCEEDED) {
446 struct ip_tunnel *t = (struct ip_tunnel*)skb2->dev->priv; 446 struct ip_tunnel *t = netdev_priv(skb2->dev);
447 if (t->parms.iph.ttl) { 447 if (t->parms.iph.ttl) {
448 rel_type = ICMP_DEST_UNREACH; 448 rel_type = ICMP_DEST_UNREACH;
449 rel_code = ICMP_HOST_UNREACH; 449 rel_code = ICMP_HOST_UNREACH;
@@ -514,7 +514,7 @@ out:
514 514
515static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 515static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
516{ 516{
517 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 517 struct ip_tunnel *tunnel = netdev_priv(dev);
518 struct net_device_stats *stats = &tunnel->stat; 518 struct net_device_stats *stats = &tunnel->stat;
519 struct iphdr *tiph = &tunnel->parms.iph; 519 struct iphdr *tiph = &tunnel->parms.iph;
520 u8 tos = tunnel->parms.iph.tos; 520 u8 tos = tunnel->parms.iph.tos;
@@ -674,7 +674,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
674 t = ipip_tunnel_locate(&p, 0); 674 t = ipip_tunnel_locate(&p, 0);
675 } 675 }
676 if (t == NULL) 676 if (t == NULL)
677 t = (struct ip_tunnel*)dev->priv; 677 t = netdev_priv(dev);
678 memcpy(&p, &t->parms, sizeof(p)); 678 memcpy(&p, &t->parms, sizeof(p));
679 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 679 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
680 err = -EFAULT; 680 err = -EFAULT;
@@ -711,7 +711,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
711 err = -EINVAL; 711 err = -EINVAL;
712 break; 712 break;
713 } 713 }
714 t = (struct ip_tunnel*)dev->priv; 714 t = netdev_priv(dev);
715 ipip_tunnel_unlink(t); 715 ipip_tunnel_unlink(t);
716 t->parms.iph.saddr = p.iph.saddr; 716 t->parms.iph.saddr = p.iph.saddr;
717 t->parms.iph.daddr = p.iph.daddr; 717 t->parms.iph.daddr = p.iph.daddr;
@@ -765,7 +765,7 @@ done:
765 765
766static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev) 766static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev)
767{ 767{
768 return &(((struct ip_tunnel*)dev->priv)->stat); 768 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
769} 769}
770 770
771static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) 771static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu)
@@ -800,7 +800,7 @@ static int ipip_tunnel_init(struct net_device *dev)
800 struct ip_tunnel *tunnel; 800 struct ip_tunnel *tunnel;
801 struct iphdr *iph; 801 struct iphdr *iph;
802 802
803 tunnel = (struct ip_tunnel*)dev->priv; 803 tunnel = netdev_priv(dev);
804 iph = &tunnel->parms.iph; 804 iph = &tunnel->parms.iph;
805 805
806 tunnel->dev = dev; 806 tunnel->dev = dev;
@@ -838,7 +838,7 @@ static int ipip_tunnel_init(struct net_device *dev)
838 838
839static int __init ipip_fb_tunnel_init(struct net_device *dev) 839static int __init ipip_fb_tunnel_init(struct net_device *dev)
840{ 840{
841 struct ip_tunnel *tunnel = dev->priv; 841 struct ip_tunnel *tunnel = netdev_priv(dev);
842 struct iphdr *iph = &tunnel->parms.iph; 842 struct iphdr *iph = &tunnel->parms.iph;
843 843
844 tunnel->dev = dev; 844 tunnel->dev = dev;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9a5c0ce7ff35..f58ac9854c3f 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -178,8 +178,8 @@ static int reg_vif_num = -1;
178static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) 178static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
179{ 179{
180 read_lock(&mrt_lock); 180 read_lock(&mrt_lock);
181 ((struct net_device_stats*)dev->priv)->tx_bytes += skb->len; 181 ((struct net_device_stats*)netdev_priv(dev))->tx_bytes += skb->len;
182 ((struct net_device_stats*)dev->priv)->tx_packets++; 182 ((struct net_device_stats*)netdev_priv(dev))->tx_packets++;
183 ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT); 183 ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT);
184 read_unlock(&mrt_lock); 184 read_unlock(&mrt_lock);
185 kfree_skb(skb); 185 kfree_skb(skb);
@@ -188,7 +188,7 @@ static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
188 188
189static struct net_device_stats *reg_vif_get_stats(struct net_device *dev) 189static struct net_device_stats *reg_vif_get_stats(struct net_device *dev)
190{ 190{
191 return (struct net_device_stats*)dev->priv; 191 return (struct net_device_stats*)netdev_priv(dev);
192} 192}
193 193
194static void reg_vif_setup(struct net_device *dev) 194static void reg_vif_setup(struct net_device *dev)
@@ -1149,8 +1149,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1149 if (vif->flags & VIFF_REGISTER) { 1149 if (vif->flags & VIFF_REGISTER) {
1150 vif->pkt_out++; 1150 vif->pkt_out++;
1151 vif->bytes_out+=skb->len; 1151 vif->bytes_out+=skb->len;
1152 ((struct net_device_stats*)vif->dev->priv)->tx_bytes += skb->len; 1152 ((struct net_device_stats*)netdev_priv(vif->dev))->tx_bytes += skb->len;
1153 ((struct net_device_stats*)vif->dev->priv)->tx_packets++; 1153 ((struct net_device_stats*)netdev_priv(vif->dev))->tx_packets++;
1154 ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT); 1154 ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT);
1155 kfree_skb(skb); 1155 kfree_skb(skb);
1156 return; 1156 return;
@@ -1210,8 +1210,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1210 if (vif->flags & VIFF_TUNNEL) { 1210 if (vif->flags & VIFF_TUNNEL) {
1211 ip_encap(skb, vif->local, vif->remote); 1211 ip_encap(skb, vif->local, vif->remote);
1212 /* FIXME: extra output firewall step used to be here. --RR */ 1212 /* FIXME: extra output firewall step used to be here. --RR */
1213 ((struct ip_tunnel *)vif->dev->priv)->stat.tx_packets++; 1213 ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_packets++;
1214 ((struct ip_tunnel *)vif->dev->priv)->stat.tx_bytes+=skb->len; 1214 ((struct ip_tunnel *)netdev_priv(vif->dev))->stat.tx_bytes+=skb->len;
1215 } 1215 }
1216 1216
1217 IPCB(skb)->flags |= IPSKB_FORWARDED; 1217 IPCB(skb)->flags |= IPSKB_FORWARDED;
@@ -1467,8 +1467,8 @@ int pim_rcv_v1(struct sk_buff * skb)
1467 skb->pkt_type = PACKET_HOST; 1467 skb->pkt_type = PACKET_HOST;
1468 dst_release(skb->dst); 1468 dst_release(skb->dst);
1469 skb->dst = NULL; 1469 skb->dst = NULL;
1470 ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; 1470 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
1471 ((struct net_device_stats*)reg_dev->priv)->rx_packets++; 1471 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
1472 nf_reset(skb); 1472 nf_reset(skb);
1473 netif_rx(skb); 1473 netif_rx(skb);
1474 dev_put(reg_dev); 1474 dev_put(reg_dev);
@@ -1522,8 +1522,8 @@ static int pim_rcv(struct sk_buff * skb)
1522 skb->ip_summed = 0; 1522 skb->ip_summed = 0;
1523 skb->pkt_type = PACKET_HOST; 1523 skb->pkt_type = PACKET_HOST;
1524 dst_release(skb->dst); 1524 dst_release(skb->dst);
1525 ((struct net_device_stats*)reg_dev->priv)->rx_bytes += skb->len; 1525 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_bytes += skb->len;
1526 ((struct net_device_stats*)reg_dev->priv)->rx_packets++; 1526 ((struct net_device_stats*)netdev_priv(reg_dev))->rx_packets++;
1527 skb->dst = NULL; 1527 skb->dst = NULL;
1528 nf_reset(skb); 1528 nf_reset(skb);
1529 netif_rx(skb); 1529 netif_rx(skb);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0a461232329f..a97ed5416c28 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3347,7 +3347,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list,
3347 int offset = start - TCP_SKB_CB(skb)->seq; 3347 int offset = start - TCP_SKB_CB(skb)->seq;
3348 int size = TCP_SKB_CB(skb)->end_seq - start; 3348 int size = TCP_SKB_CB(skb)->end_seq - start;
3349 3349
3350 if (offset < 0) BUG(); 3350 BUG_ON(offset < 0);
3351 if (size > 0) { 3351 if (size > 0) {
3352 size = min(copy, size); 3352 size = min(copy, size);
3353 if (skb_copy_bits(skb, offset, skb_put(nskb, size), size)) 3353 if (skb_copy_bits(skb, offset, skb_put(nskb, size), size))
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index b4c4beba0ede..efa3e72cfcfa 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -226,6 +226,8 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
226 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 226 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
227 ipv6_addr_copy(&hdr->daddr, first_hop); 227 ipv6_addr_copy(&hdr->daddr, first_hop);
228 228
229 skb->priority = sk->sk_priority;
230
229 mtu = dst_mtu(dst); 231 mtu = dst_mtu(dst);
230 if ((skb->len <= mtu) || ipfragok) { 232 if ((skb->len <= mtu) || ipfragok) {
231 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 233 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
@@ -1182,6 +1184,8 @@ int ip6_push_pending_frames(struct sock *sk)
1182 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 1184 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
1183 ipv6_addr_copy(&hdr->daddr, final_dst); 1185 ipv6_addr_copy(&hdr->daddr, final_dst);
1184 1186
1187 skb->priority = sk->sk_priority;
1188
1185 skb->dst = dst_clone(&rt->u.dst); 1189 skb->dst = dst_clone(&rt->u.dst);
1186 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 1190 IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
1187 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output); 1191 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index f079621c8b67..c3c2bf699a67 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -243,7 +243,7 @@ ip6_tnl_create(struct ip6_tnl_parm *p, struct ip6_tnl **pt)
243 if (dev == NULL) 243 if (dev == NULL)
244 return -ENOMEM; 244 return -ENOMEM;
245 245
246 t = dev->priv; 246 t = netdev_priv(dev);
247 dev->init = ip6ip6_tnl_dev_init; 247 dev->init = ip6ip6_tnl_dev_init;
248 t->parms = *p; 248 t->parms = *p;
249 249
@@ -308,7 +308,7 @@ ip6ip6_tnl_locate(struct ip6_tnl_parm *p, struct ip6_tnl **pt, int create)
308static void 308static void
309ip6ip6_tnl_dev_uninit(struct net_device *dev) 309ip6ip6_tnl_dev_uninit(struct net_device *dev)
310{ 310{
311 struct ip6_tnl *t = dev->priv; 311 struct ip6_tnl *t = netdev_priv(dev);
312 312
313 if (dev == ip6ip6_fb_tnl_dev) { 313 if (dev == ip6ip6_fb_tnl_dev) {
314 write_lock_bh(&ip6ip6_lock); 314 write_lock_bh(&ip6ip6_lock);
@@ -623,7 +623,7 @@ ip6ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr)
623static int 623static int
624ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) 624ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
625{ 625{
626 struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; 626 struct ip6_tnl *t = netdev_priv(dev);
627 struct net_device_stats *stats = &t->stat; 627 struct net_device_stats *stats = &t->stat;
628 struct ipv6hdr *ipv6h = skb->nh.ipv6h; 628 struct ipv6hdr *ipv6h = skb->nh.ipv6h;
629 struct ipv6_txoptions *opt = NULL; 629 struct ipv6_txoptions *opt = NULL;
@@ -933,11 +933,11 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
933 break; 933 break;
934 } 934 }
935 if ((err = ip6ip6_tnl_locate(&p, &t, 0)) == -ENODEV) 935 if ((err = ip6ip6_tnl_locate(&p, &t, 0)) == -ENODEV)
936 t = (struct ip6_tnl *) dev->priv; 936 t = netdev_priv(dev);
937 else if (err) 937 else if (err)
938 break; 938 break;
939 } else 939 } else
940 t = (struct ip6_tnl *) dev->priv; 940 t = netdev_priv(dev);
941 941
942 memcpy(&p, &t->parms, sizeof (p)); 942 memcpy(&p, &t->parms, sizeof (p));
943 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { 943 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) {
@@ -955,7 +955,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
955 break; 955 break;
956 } 956 }
957 if (!create && dev != ip6ip6_fb_tnl_dev) { 957 if (!create && dev != ip6ip6_fb_tnl_dev) {
958 t = (struct ip6_tnl *) dev->priv; 958 t = netdev_priv(dev);
959 } 959 }
960 if (!t && (err = ip6ip6_tnl_locate(&p, &t, create))) { 960 if (!t && (err = ip6ip6_tnl_locate(&p, &t, create))) {
961 break; 961 break;
@@ -991,12 +991,12 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
991 err = ip6ip6_tnl_locate(&p, &t, 0); 991 err = ip6ip6_tnl_locate(&p, &t, 0);
992 if (err) 992 if (err)
993 break; 993 break;
994 if (t == ip6ip6_fb_tnl_dev->priv) { 994 if (t == netdev_priv(ip6ip6_fb_tnl_dev)) {
995 err = -EPERM; 995 err = -EPERM;
996 break; 996 break;
997 } 997 }
998 } else { 998 } else {
999 t = (struct ip6_tnl *) dev->priv; 999 t = netdev_priv(dev);
1000 } 1000 }
1001 err = unregister_netdevice(t->dev); 1001 err = unregister_netdevice(t->dev);
1002 break; 1002 break;
@@ -1016,7 +1016,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1016static struct net_device_stats * 1016static struct net_device_stats *
1017ip6ip6_tnl_get_stats(struct net_device *dev) 1017ip6ip6_tnl_get_stats(struct net_device *dev)
1018{ 1018{
1019 return &(((struct ip6_tnl *) dev->priv)->stat); 1019 return &(((struct ip6_tnl *)netdev_priv(dev))->stat);
1020} 1020}
1021 1021
1022/** 1022/**
@@ -1073,7 +1073,7 @@ static void ip6ip6_tnl_dev_setup(struct net_device *dev)
1073static inline void 1073static inline void
1074ip6ip6_tnl_dev_init_gen(struct net_device *dev) 1074ip6ip6_tnl_dev_init_gen(struct net_device *dev)
1075{ 1075{
1076 struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; 1076 struct ip6_tnl *t = netdev_priv(dev);
1077 t->fl.proto = IPPROTO_IPV6; 1077 t->fl.proto = IPPROTO_IPV6;
1078 t->dev = dev; 1078 t->dev = dev;
1079 strcpy(t->parms.name, dev->name); 1079 strcpy(t->parms.name, dev->name);
@@ -1087,7 +1087,7 @@ ip6ip6_tnl_dev_init_gen(struct net_device *dev)
1087static int 1087static int
1088ip6ip6_tnl_dev_init(struct net_device *dev) 1088ip6ip6_tnl_dev_init(struct net_device *dev)
1089{ 1089{
1090 struct ip6_tnl *t = (struct ip6_tnl *) dev->priv; 1090 struct ip6_tnl *t = netdev_priv(dev);
1091 ip6ip6_tnl_dev_init_gen(dev); 1091 ip6ip6_tnl_dev_init_gen(dev);
1092 ip6ip6_tnl_link_config(t); 1092 ip6ip6_tnl_link_config(t);
1093 return 0; 1093 return 0;
@@ -1103,7 +1103,7 @@ ip6ip6_tnl_dev_init(struct net_device *dev)
1103static int 1103static int
1104ip6ip6_fb_tnl_dev_init(struct net_device *dev) 1104ip6ip6_fb_tnl_dev_init(struct net_device *dev)
1105{ 1105{
1106 struct ip6_tnl *t = dev->priv; 1106 struct ip6_tnl *t = netdev_priv(dev);
1107 ip6ip6_tnl_dev_init_gen(dev); 1107 ip6ip6_tnl_dev_init_gen(dev);
1108 dev_hold(dev); 1108 dev_hold(dev);
1109 tnls_wc[0] = t; 1109 tnls_wc[0] = t;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 02872ae8a439..0dae48aa1cec 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -184,7 +184,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
184 if (dev == NULL) 184 if (dev == NULL)
185 return NULL; 185 return NULL;
186 186
187 nt = dev->priv; 187 nt = netdev_priv(dev);
188 dev->init = ipip6_tunnel_init; 188 dev->init = ipip6_tunnel_init;
189 nt->parms = *parms; 189 nt->parms = *parms;
190 190
@@ -210,7 +210,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev)
210 write_unlock_bh(&ipip6_lock); 210 write_unlock_bh(&ipip6_lock);
211 dev_put(dev); 211 dev_put(dev);
212 } else { 212 } else {
213 ipip6_tunnel_unlink((struct ip_tunnel*)dev->priv); 213 ipip6_tunnel_unlink(netdev_priv(dev));
214 dev_put(dev); 214 dev_put(dev);
215 } 215 }
216} 216}
@@ -346,7 +346,7 @@ out:
346 rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0); 346 rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0);
347 347
348 if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) { 348 if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) {
349 struct ip_tunnel * t = (struct ip_tunnel*)rt6i->rt6i_dev->priv; 349 struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev);
350 if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) { 350 if (rel_type == ICMPV6_TIME_EXCEED && t->parms.iph.ttl) {
351 rel_type = ICMPV6_DEST_UNREACH; 351 rel_type = ICMPV6_DEST_UNREACH;
352 rel_code = ICMPV6_ADDR_UNREACH; 352 rel_code = ICMPV6_ADDR_UNREACH;
@@ -424,7 +424,7 @@ static inline u32 try_6to4(struct in6_addr *v6dst)
424 424
425static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 425static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
426{ 426{
427 struct ip_tunnel *tunnel = (struct ip_tunnel*)dev->priv; 427 struct ip_tunnel *tunnel = netdev_priv(dev);
428 struct net_device_stats *stats = &tunnel->stat; 428 struct net_device_stats *stats = &tunnel->stat;
429 struct iphdr *tiph = &tunnel->parms.iph; 429 struct iphdr *tiph = &tunnel->parms.iph;
430 struct ipv6hdr *iph6 = skb->nh.ipv6h; 430 struct ipv6hdr *iph6 = skb->nh.ipv6h;
@@ -610,7 +610,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
610 t = ipip6_tunnel_locate(&p, 0); 610 t = ipip6_tunnel_locate(&p, 0);
611 } 611 }
612 if (t == NULL) 612 if (t == NULL)
613 t = (struct ip_tunnel*)dev->priv; 613 t = netdev_priv(dev);
614 memcpy(&p, &t->parms, sizeof(p)); 614 memcpy(&p, &t->parms, sizeof(p));
615 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) 615 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
616 err = -EFAULT; 616 err = -EFAULT;
@@ -647,7 +647,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
647 err = -EINVAL; 647 err = -EINVAL;
648 break; 648 break;
649 } 649 }
650 t = (struct ip_tunnel*)dev->priv; 650 t = netdev_priv(dev);
651 ipip6_tunnel_unlink(t); 651 ipip6_tunnel_unlink(t);
652 t->parms.iph.saddr = p.iph.saddr; 652 t->parms.iph.saddr = p.iph.saddr;
653 t->parms.iph.daddr = p.iph.daddr; 653 t->parms.iph.daddr = p.iph.daddr;
@@ -683,7 +683,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
683 if ((t = ipip6_tunnel_locate(&p, 0)) == NULL) 683 if ((t = ipip6_tunnel_locate(&p, 0)) == NULL)
684 goto done; 684 goto done;
685 err = -EPERM; 685 err = -EPERM;
686 if (t == ipip6_fb_tunnel_dev->priv) 686 if (t == netdev_priv(ipip6_fb_tunnel_dev))
687 goto done; 687 goto done;
688 dev = t->dev; 688 dev = t->dev;
689 } 689 }
@@ -700,7 +700,7 @@ done:
700 700
701static struct net_device_stats *ipip6_tunnel_get_stats(struct net_device *dev) 701static struct net_device_stats *ipip6_tunnel_get_stats(struct net_device *dev)
702{ 702{
703 return &(((struct ip_tunnel*)dev->priv)->stat); 703 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
704} 704}
705 705
706static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu) 706static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu)
@@ -735,7 +735,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
735 struct ip_tunnel *tunnel; 735 struct ip_tunnel *tunnel;
736 struct iphdr *iph; 736 struct iphdr *iph;
737 737
738 tunnel = (struct ip_tunnel*)dev->priv; 738 tunnel = netdev_priv(dev);
739 iph = &tunnel->parms.iph; 739 iph = &tunnel->parms.iph;
740 740
741 tunnel->dev = dev; 741 tunnel->dev = dev;
@@ -775,7 +775,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
775 775
776static int __init ipip6_fb_tunnel_init(struct net_device *dev) 776static int __init ipip6_fb_tunnel_init(struct net_device *dev)
777{ 777{
778 struct ip_tunnel *tunnel = dev->priv; 778 struct ip_tunnel *tunnel = netdev_priv(dev);
779 struct iphdr *iph = &tunnel->parms.iph; 779 struct iphdr *iph = &tunnel->parms.iph;
780 780
781 tunnel->dev = dev; 781 tunnel->dev = dev;
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 52efd04cbedb..4c2f6d694f88 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -297,8 +297,7 @@ static int pfkey_error(struct sadb_msg *orig, int err, struct sock *sk)
297 err = EINTR; 297 err = EINTR;
298 if (err >= 512) 298 if (err >= 512)
299 err = EINVAL; 299 err = EINVAL;
300 if (err <= 0 || err >= 256) 300 BUG_ON(err <= 0 || err >= 256);
301 BUG();
302 301
303 hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); 302 hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg));
304 pfkey_hdr_dup(hdr, orig); 303 pfkey_hdr_dup(hdr, orig);
diff --git a/net/sched/Makefile b/net/sched/Makefile
index e48d0d456b3e..0f06aec66094 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -7,13 +7,13 @@ obj-y := sch_generic.o
7obj-$(CONFIG_NET_SCHED) += sch_api.o sch_fifo.o sch_blackhole.o 7obj-$(CONFIG_NET_SCHED) += sch_api.o sch_fifo.o sch_blackhole.o
8obj-$(CONFIG_NET_CLS) += cls_api.o 8obj-$(CONFIG_NET_CLS) += cls_api.o
9obj-$(CONFIG_NET_CLS_ACT) += act_api.o 9obj-$(CONFIG_NET_CLS_ACT) += act_api.o
10obj-$(CONFIG_NET_ACT_POLICE) += police.o 10obj-$(CONFIG_NET_ACT_POLICE) += act_police.o
11obj-$(CONFIG_NET_CLS_POLICE) += police.o 11obj-$(CONFIG_NET_CLS_POLICE) += act_police.o
12obj-$(CONFIG_NET_ACT_GACT) += gact.o 12obj-$(CONFIG_NET_ACT_GACT) += act_gact.o
13obj-$(CONFIG_NET_ACT_MIRRED) += mirred.o 13obj-$(CONFIG_NET_ACT_MIRRED) += act_mirred.o
14obj-$(CONFIG_NET_ACT_IPT) += ipt.o 14obj-$(CONFIG_NET_ACT_IPT) += act_ipt.o
15obj-$(CONFIG_NET_ACT_PEDIT) += pedit.o 15obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit.o
16obj-$(CONFIG_NET_ACT_SIMP) += simple.o 16obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o
17obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o 17obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o
18obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o 18obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
19obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o 19obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 2ce1cb2aa2ed..792ce59940ec 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -165,7 +165,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action *act,
165 while ((a = act) != NULL) { 165 while ((a = act) != NULL) {
166repeat: 166repeat:
167 if (a->ops && a->ops->act) { 167 if (a->ops && a->ops->act) {
168 ret = a->ops->act(&skb, a, res); 168 ret = a->ops->act(skb, a, res);
169 if (TC_MUNGED & skb->tc_verd) { 169 if (TC_MUNGED & skb->tc_verd) {
170 /* copied already, allow trampling */ 170 /* copied already, allow trampling */
171 skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd); 171 skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd);
@@ -290,7 +290,7 @@ struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
290 if (a_o == NULL) { 290 if (a_o == NULL) {
291#ifdef CONFIG_KMOD 291#ifdef CONFIG_KMOD
292 rtnl_unlock(); 292 rtnl_unlock();
293 request_module(act_name); 293 request_module("act_%s", act_name);
294 rtnl_lock(); 294 rtnl_lock();
295 295
296 a_o = tc_lookup_action_n(act_name); 296 a_o = tc_lookup_action_n(act_name);
diff --git a/net/sched/gact.c b/net/sched/act_gact.c
index d1c6d542912a..a1e68f78dcc2 100644
--- a/net/sched/gact.c
+++ b/net/sched/act_gact.c
@@ -135,10 +135,9 @@ tcf_gact_cleanup(struct tc_action *a, int bind)
135} 135}
136 136
137static int 137static int
138tcf_gact(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res) 138tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
139{ 139{
140 struct tcf_gact *p = PRIV(a, gact); 140 struct tcf_gact *p = PRIV(a, gact);
141 struct sk_buff *skb = *pskb;
142 int action = TC_ACT_SHOT; 141 int action = TC_ACT_SHOT;
143 142
144 spin_lock(&p->lock); 143 spin_lock(&p->lock);
diff --git a/net/sched/ipt.c b/net/sched/act_ipt.c
index f50136eed211..b5001939b74b 100644
--- a/net/sched/ipt.c
+++ b/net/sched/act_ipt.c
@@ -201,11 +201,10 @@ tcf_ipt_cleanup(struct tc_action *a, int bind)
201} 201}
202 202
203static int 203static int
204tcf_ipt(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res) 204tcf_ipt(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
205{ 205{
206 int ret = 0, result = 0; 206 int ret = 0, result = 0;
207 struct tcf_ipt *p = PRIV(a, ipt); 207 struct tcf_ipt *p = PRIV(a, ipt);
208 struct sk_buff *skb = *pskb;
209 208
210 if (skb_cloned(skb)) { 209 if (skb_cloned(skb)) {
211 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 210 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
@@ -222,6 +221,9 @@ tcf_ipt(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)
222 worry later - danger - this API seems to have changed 221 worry later - danger - this API seems to have changed
223 from earlier kernels */ 222 from earlier kernels */
224 223
224 /* iptables targets take a double skb pointer in case the skb
225 * needs to be replaced. We don't own the skb, so this must not
226 * happen. The pskb_expand_head above should make sure of this */
225 ret = p->t->u.kernel.target->target(&skb, skb->dev, NULL, 227 ret = p->t->u.kernel.target->target(&skb, skb->dev, NULL,
226 p->hook, p->t->data, NULL); 228 p->hook, p->t->data, NULL);
227 switch (ret) { 229 switch (ret) {
diff --git a/net/sched/mirred.c b/net/sched/act_mirred.c
index 20d06916dc0b..4fcccbd50885 100644
--- a/net/sched/mirred.c
+++ b/net/sched/act_mirred.c
@@ -158,12 +158,11 @@ tcf_mirred_cleanup(struct tc_action *a, int bind)
158} 158}
159 159
160static int 160static int
161tcf_mirred(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res) 161tcf_mirred(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
162{ 162{
163 struct tcf_mirred *p = PRIV(a, mirred); 163 struct tcf_mirred *p = PRIV(a, mirred);
164 struct net_device *dev; 164 struct net_device *dev;
165 struct sk_buff *skb2 = NULL; 165 struct sk_buff *skb2 = NULL;
166 struct sk_buff *skb = *pskb;
167 u32 at = G_TC_AT(skb->tc_verd); 166 u32 at = G_TC_AT(skb->tc_verd);
168 167
169 spin_lock(&p->lock); 168 spin_lock(&p->lock);
diff --git a/net/sched/pedit.c b/net/sched/act_pedit.c
index 767d24f4610e..1742a68e0122 100644
--- a/net/sched/pedit.c
+++ b/net/sched/act_pedit.c
@@ -130,10 +130,9 @@ tcf_pedit_cleanup(struct tc_action *a, int bind)
130} 130}
131 131
132static int 132static int
133tcf_pedit(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res) 133tcf_pedit(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
134{ 134{
135 struct tcf_pedit *p = PRIV(a, pedit); 135 struct tcf_pedit *p = PRIV(a, pedit);
136 struct sk_buff *skb = *pskb;
137 int i, munged = 0; 136 int i, munged = 0;
138 u8 *pptr; 137 u8 *pptr;
139 138
@@ -246,10 +245,12 @@ tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,int bind, int ref)
246 t.lastuse = jiffies_to_clock_t(jiffies - p->tm.lastuse); 245 t.lastuse = jiffies_to_clock_t(jiffies - p->tm.lastuse);
247 t.expires = jiffies_to_clock_t(p->tm.expires); 246 t.expires = jiffies_to_clock_t(p->tm.expires);
248 RTA_PUT(skb, TCA_PEDIT_TM, sizeof(t), &t); 247 RTA_PUT(skb, TCA_PEDIT_TM, sizeof(t), &t);
248 kfree(opt);
249 return skb->len; 249 return skb->len;
250 250
251rtattr_failure: 251rtattr_failure:
252 skb_trim(skb, b - skb->data); 252 skb_trim(skb, b - skb->data);
253 kfree(opt);
253 return -1; 254 return -1;
254} 255}
255 256
diff --git a/net/sched/police.c b/net/sched/act_police.c
index eb39fb2f39b6..fa877f8f652c 100644
--- a/net/sched/police.c
+++ b/net/sched/act_police.c
@@ -284,11 +284,10 @@ static int tcf_act_police_cleanup(struct tc_action *a, int bind)
284 return 0; 284 return 0;
285} 285}
286 286
287static int tcf_act_police(struct sk_buff **pskb, struct tc_action *a, 287static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
288 struct tcf_result *res) 288 struct tcf_result *res)
289{ 289{
290 psched_time_t now; 290 psched_time_t now;
291 struct sk_buff *skb = *pskb;
292 struct tcf_police *p = PRIV(a); 291 struct tcf_police *p = PRIV(a);
293 long toks; 292 long toks;
294 long ptoks = 0; 293 long ptoks = 0;
@@ -408,7 +407,7 @@ police_cleanup_module(void)
408module_init(police_init_module); 407module_init(police_init_module);
409module_exit(police_cleanup_module); 408module_exit(police_cleanup_module);
410 409
411#endif 410#else /* CONFIG_NET_CLS_ACT */
412 411
413struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est) 412struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est)
414{ 413{
@@ -545,6 +544,7 @@ int tcf_police(struct sk_buff *skb, struct tcf_police *p)
545 spin_unlock(&p->lock); 544 spin_unlock(&p->lock);
546 return p->action; 545 return p->action;
547} 546}
547EXPORT_SYMBOL(tcf_police);
548 548
549int tcf_police_dump(struct sk_buff *skb, struct tcf_police *p) 549int tcf_police_dump(struct sk_buff *skb, struct tcf_police *p)
550{ 550{
@@ -601,13 +601,4 @@ errout:
601 return -1; 601 return -1;
602} 602}
603 603
604 604#endif /* CONFIG_NET_CLS_ACT */
605EXPORT_SYMBOL(tcf_police);
606EXPORT_SYMBOL(tcf_police_destroy);
607EXPORT_SYMBOL(tcf_police_dump);
608EXPORT_SYMBOL(tcf_police_dump_stats);
609EXPORT_SYMBOL(tcf_police_hash);
610EXPORT_SYMBOL(tcf_police_ht);
611EXPORT_SYMBOL(tcf_police_locate);
612EXPORT_SYMBOL(tcf_police_lookup);
613EXPORT_SYMBOL(tcf_police_new_index);
diff --git a/net/sched/simple.c b/net/sched/act_simple.c
index 8a6ae4f491e8..e5f2e1f431e2 100644
--- a/net/sched/simple.c
+++ b/net/sched/act_simple.c
@@ -44,9 +44,8 @@ static DEFINE_RWLOCK(simp_lock);
44#include <net/pkt_act.h> 44#include <net/pkt_act.h>
45#include <net/act_generic.h> 45#include <net/act_generic.h>
46 46
47static int tcf_simp(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res) 47static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)
48{ 48{
49 struct sk_buff *skb = *pskb;
50 struct tcf_defact *p = PRIV(a, defact); 49 struct tcf_defact *p = PRIV(a, defact);
51 50
52 spin_lock(&p->lock); 51 spin_lock(&p->lock);
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 09453f997d8c..6cd81708bf71 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -257,7 +257,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
257 (cl = cbq_class_lookup(q, prio)) != NULL) 257 (cl = cbq_class_lookup(q, prio)) != NULL)
258 return cl; 258 return cl;
259 259
260 *qerr = NET_XMIT_DROP; 260 *qerr = NET_XMIT_BYPASS;
261 for (;;) { 261 for (;;) {
262 int result = 0; 262 int result = 0;
263 defmap = head->defaults; 263 defmap = head->defaults;
@@ -413,7 +413,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
413 q->rx_class = cl; 413 q->rx_class = cl;
414#endif 414#endif
415 if (cl == NULL) { 415 if (cl == NULL) {
416 if (ret == NET_XMIT_DROP) 416 if (ret == NET_XMIT_BYPASS)
417 sch->qstats.drops++; 417 sch->qstats.drops++;
418 kfree_skb(skb); 418 kfree_skb(skb);
419 return ret; 419 return ret;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index c26764bc4103..91132f6871d7 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -208,7 +208,7 @@ struct hfsc_sched
208do { \ 208do { \
209 struct timeval tv; \ 209 struct timeval tv; \
210 do_gettimeofday(&tv); \ 210 do_gettimeofday(&tv); \
211 (stamp) = 1000000ULL * tv.tv_sec + tv.tv_usec; \ 211 (stamp) = 1ULL * USEC_PER_SEC * tv.tv_sec + tv.tv_usec; \
212} while (0) 212} while (0)
213#endif 213#endif
214 214
@@ -502,8 +502,8 @@ d2dx(u32 d)
502 u64 dx; 502 u64 dx;
503 503
504 dx = ((u64)d * PSCHED_JIFFIE2US(HZ)); 504 dx = ((u64)d * PSCHED_JIFFIE2US(HZ));
505 dx += 1000000 - 1; 505 dx += USEC_PER_SEC - 1;
506 do_div(dx, 1000000); 506 do_div(dx, USEC_PER_SEC);
507 return dx; 507 return dx;
508} 508}
509 509
@@ -523,7 +523,7 @@ dx2d(u64 dx)
523{ 523{
524 u64 d; 524 u64 d;
525 525
526 d = dx * 1000000; 526 d = dx * USEC_PER_SEC;
527 do_div(d, PSCHED_JIFFIE2US(HZ)); 527 do_div(d, PSCHED_JIFFIE2US(HZ));
528 return (u32)d; 528 return (u32)d;
529} 529}
@@ -1227,7 +1227,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
1227 if (cl->level == 0) 1227 if (cl->level == 0)
1228 return cl; 1228 return cl;
1229 1229
1230 *qerr = NET_XMIT_DROP; 1230 *qerr = NET_XMIT_BYPASS;
1231 tcf = q->root.filter_list; 1231 tcf = q->root.filter_list;
1232 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { 1232 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
1233#ifdef CONFIG_NET_CLS_ACT 1233#ifdef CONFIG_NET_CLS_ACT
@@ -1643,7 +1643,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1643 1643
1644 cl = hfsc_classify(skb, sch, &err); 1644 cl = hfsc_classify(skb, sch, &err);
1645 if (cl == NULL) { 1645 if (cl == NULL) {
1646 if (err == NET_XMIT_DROP) 1646 if (err == NET_XMIT_BYPASS)
1647 sch->qstats.drops++; 1647 sch->qstats.drops++;
1648 kfree_skb(skb); 1648 kfree_skb(skb);
1649 return err; 1649 return err;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 558cc087e602..3ec95df4a85e 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -321,7 +321,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, in
321 if ((cl = htb_find(skb->priority,sch)) != NULL && cl->level == 0) 321 if ((cl = htb_find(skb->priority,sch)) != NULL && cl->level == 0)
322 return cl; 322 return cl;
323 323
324 *qerr = NET_XMIT_DROP; 324 *qerr = NET_XMIT_BYPASS;
325 tcf = q->filter_list; 325 tcf = q->filter_list;
326 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { 326 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
327#ifdef CONFIG_NET_CLS_ACT 327#ifdef CONFIG_NET_CLS_ACT
@@ -724,7 +724,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
724 } 724 }
725#ifdef CONFIG_NET_CLS_ACT 725#ifdef CONFIG_NET_CLS_ACT
726 } else if (!cl) { 726 } else if (!cl) {
727 if (ret == NET_XMIT_DROP) 727 if (ret == NET_XMIT_BYPASS)
728 sch->qstats.drops++; 728 sch->qstats.drops++;
729 kfree_skb (skb); 729 kfree_skb (skb);
730 return ret; 730 return ret;
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 3ac0f495bad0..5b3a3e48ed92 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -54,7 +54,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
54 u32 band = skb->priority; 54 u32 band = skb->priority;
55 struct tcf_result res; 55 struct tcf_result res;
56 56
57 *qerr = NET_XMIT_DROP; 57 *qerr = NET_XMIT_BYPASS;
58 if (TC_H_MAJ(skb->priority) != sch->handle) { 58 if (TC_H_MAJ(skb->priority) != sch->handle) {
59#ifdef CONFIG_NET_CLS_ACT 59#ifdef CONFIG_NET_CLS_ACT
60 switch (tc_classify(skb, q->filter_list, &res)) { 60 switch (tc_classify(skb, q->filter_list, &res)) {
@@ -91,7 +91,8 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
91 qdisc = prio_classify(skb, sch, &ret); 91 qdisc = prio_classify(skb, sch, &ret);
92#ifdef CONFIG_NET_CLS_ACT 92#ifdef CONFIG_NET_CLS_ACT
93 if (qdisc == NULL) { 93 if (qdisc == NULL) {
94 if (ret == NET_XMIT_DROP) 94
95 if (ret == NET_XMIT_BYPASS)
95 sch->qstats.drops++; 96 sch->qstats.drops++;
96 kfree_skb(skb); 97 kfree_skb(skb);
97 return ret; 98 return ret;
@@ -118,7 +119,7 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch)
118 qdisc = prio_classify(skb, sch, &ret); 119 qdisc = prio_classify(skb, sch, &ret);
119#ifdef CONFIG_NET_CLS_ACT 120#ifdef CONFIG_NET_CLS_ACT
120 if (qdisc == NULL) { 121 if (qdisc == NULL) {
121 if (ret == NET_XMIT_DROP) 122 if (ret == NET_XMIT_BYPASS)
122 sch->qstats.drops++; 123 sch->qstats.drops++;
123 kfree_skb(skb); 124 kfree_skb(skb);
124 return ret; 125 return ret;
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index c4a2a8c4c339..79b8ef34c6e4 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -274,7 +274,7 @@ teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *de
274 274
275static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) 275static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
276{ 276{
277 struct teql_master *master = (void*)dev->priv; 277 struct teql_master *master = netdev_priv(dev);
278 struct Qdisc *start, *q; 278 struct Qdisc *start, *q;
279 int busy; 279 int busy;
280 int nores; 280 int nores;
@@ -350,7 +350,7 @@ drop:
350static int teql_master_open(struct net_device *dev) 350static int teql_master_open(struct net_device *dev)
351{ 351{
352 struct Qdisc * q; 352 struct Qdisc * q;
353 struct teql_master *m = (void*)dev->priv; 353 struct teql_master *m = netdev_priv(dev);
354 int mtu = 0xFFFE; 354 int mtu = 0xFFFE;
355 unsigned flags = IFF_NOARP|IFF_MULTICAST; 355 unsigned flags = IFF_NOARP|IFF_MULTICAST;
356 356
@@ -397,13 +397,13 @@ static int teql_master_close(struct net_device *dev)
397 397
398static struct net_device_stats *teql_master_stats(struct net_device *dev) 398static struct net_device_stats *teql_master_stats(struct net_device *dev)
399{ 399{
400 struct teql_master *m = (void*)dev->priv; 400 struct teql_master *m = netdev_priv(dev);
401 return &m->stats; 401 return &m->stats;
402} 402}
403 403
404static int teql_master_mtu(struct net_device *dev, int new_mtu) 404static int teql_master_mtu(struct net_device *dev, int new_mtu)
405{ 405{
406 struct teql_master *m = (void*)dev->priv; 406 struct teql_master *m = netdev_priv(dev);
407 struct Qdisc *q; 407 struct Qdisc *q;
408 408
409 if (new_mtu < 68) 409 if (new_mtu < 68)
@@ -423,7 +423,7 @@ static int teql_master_mtu(struct net_device *dev, int new_mtu)
423 423
424static __init void teql_master_setup(struct net_device *dev) 424static __init void teql_master_setup(struct net_device *dev)
425{ 425{
426 struct teql_master *master = dev->priv; 426 struct teql_master *master = netdev_priv(dev);
427 struct Qdisc_ops *ops = &master->qops; 427 struct Qdisc_ops *ops = &master->qops;
428 428
429 master->dev = dev; 429 master->dev = dev;
@@ -476,7 +476,7 @@ static int __init teql_init(void)
476 break; 476 break;
477 } 477 }
478 478
479 master = dev->priv; 479 master = netdev_priv(dev);
480 480
481 strlcpy(master->qops.id, dev->name, IFNAMSIZ); 481 strlcpy(master->qops.id, dev->name, IFNAMSIZ);
482 err = register_qdisc(&master->qops); 482 err = register_qdisc(&master->qops);
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 2d7d8a5db2ac..b8b38aba92b3 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1250,8 +1250,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1250 case SCTP_CMD_TIMER_START: 1250 case SCTP_CMD_TIMER_START:
1251 timer = &asoc->timers[cmd->obj.to]; 1251 timer = &asoc->timers[cmd->obj.to];
1252 timeout = asoc->timeouts[cmd->obj.to]; 1252 timeout = asoc->timeouts[cmd->obj.to];
1253 if (!timeout) 1253 BUG_ON(!timeout);
1254 BUG();
1255 1254
1256 timer->expires = jiffies + timeout; 1255 timer->expires = jiffies + timeout;
1257 sctp_association_hold(asoc); 1256 sctp_association_hold(asoc);
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index f509e9992767..dcaa0c4453ff 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -575,12 +575,11 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
575 if (rp->q.list.next == &cd->queue) { 575 if (rp->q.list.next == &cd->queue) {
576 spin_unlock(&queue_lock); 576 spin_unlock(&queue_lock);
577 up(&queue_io_sem); 577 up(&queue_io_sem);
578 if (rp->offset) 578 BUG_ON(rp->offset);
579 BUG();
580 return 0; 579 return 0;
581 } 580 }
582 rq = container_of(rp->q.list.next, struct cache_request, q.list); 581 rq = container_of(rp->q.list.next, struct cache_request, q.list);
583 if (rq->q.reader) BUG(); 582 BUG_ON(rq->q.reader);
584 if (rp->offset == 0) 583 if (rp->offset == 0)
585 rq->readers++; 584 rq->readers++;
586 spin_unlock(&queue_lock); 585 spin_unlock(&queue_lock);
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index e4296c8b861e..b19cc26fa9c2 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -122,8 +122,7 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size)
122 rqstp->rq_argused = 0; 122 rqstp->rq_argused = 0;
123 rqstp->rq_resused = 0; 123 rqstp->rq_resused = 0;
124 arghi = 0; 124 arghi = 0;
125 if (pages > RPCSVC_MAXPAGES) 125 BUG_ON(pages > RPCSVC_MAXPAGES);
126 BUG();
127 while (pages) { 126 while (pages) {
128 struct page *p = alloc_page(GFP_KERNEL); 127 struct page *p = alloc_page(GFP_KERNEL);
129 if (!p) 128 if (!p)
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 2f4531fcaca2..6ed3302312fb 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -540,8 +540,7 @@ void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm,
540 start = end; 540 start = end;
541 } 541 }
542 } 542 }
543 if (len) 543 BUG_ON(len);
544 BUG();
545} 544}
546EXPORT_SYMBOL_GPL(skb_icv_walk); 545EXPORT_SYMBOL_GPL(skb_icv_walk);
547 546
@@ -610,8 +609,7 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
610 start = end; 609 start = end;
611 } 610 }
612 } 611 }
613 if (len) 612 BUG_ON(len);
614 BUG();
615 return elt; 613 return elt;
616} 614}
617EXPORT_SYMBOL_GPL(skb_to_sgvec); 615EXPORT_SYMBOL_GPL(skb_to_sgvec);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 59614a994b4e..077bbf9fb9b7 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -248,11 +248,9 @@ EXPORT_SYMBOL(xfrm_policy_alloc);
248 248
249void __xfrm_policy_destroy(struct xfrm_policy *policy) 249void __xfrm_policy_destroy(struct xfrm_policy *policy)
250{ 250{
251 if (!policy->dead) 251 BUG_ON(!policy->dead);
252 BUG();
253 252
254 if (policy->bundles) 253 BUG_ON(policy->bundles);
255 BUG();
256 254
257 if (del_timer(&policy->timer)) 255 if (del_timer(&policy->timer))
258 BUG(); 256 BUG();