aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-20 15:42:47 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-20 15:42:47 -0400
commitf685ddaf0fc9b9f53eb9346c858664776becf5d9 (patch)
treeb28883e47171c16e69178e2b9ccaad9985778a9e
parent460edb3cd06865ffb231eb694b567daec3113210 (diff)
parentcd46171c7297739dc7e46d885862e98023eab9c7 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [BNX2]: Add PHY workaround for 5709 A1. [PPP] L2TP: Fix skb handling in pppol2tp_xmit [PPP] L2TP: Fix skb handling in pppol2tp_recv_core [PPP] L2TP: Disallow non-UDP datagram sockets [PPP] pppoe: Fix double-free on skb after transmit failure [PKT_SCHED]: Fix 'SFQ qdisc crashes with limit of 2 packets' [NETFILTER]: MAINTAINERS update [NETFILTER]: nfnetlink_log: fix sending of multipart messages
-rw-r--r--MAINTAINERS6
-rw-r--r--drivers/net/bnx2.c7
-rw-r--r--drivers/net/pppoe.c3
-rw-r--r--drivers/net/pppol2tp.c118
-rw-r--r--net/netfilter/nfnetlink_log.c13
-rw-r--r--net/sched/sch_sfq.c10
6 files changed, 73 insertions, 84 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 9c54a5ef0ba7..9a91d9e3f1f2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2622,8 +2622,8 @@ P: Harald Welte
2622P: Jozsef Kadlecsik 2622P: Jozsef Kadlecsik
2623P: Patrick McHardy 2623P: Patrick McHardy
2624M: kaber@trash.net 2624M: kaber@trash.net
2625L: netfilter-devel@lists.netfilter.org 2625L: netfilter-devel@vger.kernel.org
2626L: netfilter@lists.netfilter.org (subscribers-only) 2626L: netfilter@vger.kernel.org
2627L: coreteam@netfilter.org 2627L: coreteam@netfilter.org
2628W: http://www.netfilter.org/ 2628W: http://www.netfilter.org/
2629W: http://www.iptables.org/ 2629W: http://www.iptables.org/
@@ -2676,7 +2676,7 @@ M: jmorris@namei.org
2676P: Hideaki YOSHIFUJI 2676P: Hideaki YOSHIFUJI
2677M: yoshfuji@linux-ipv6.org 2677M: yoshfuji@linux-ipv6.org
2678P: Patrick McHardy 2678P: Patrick McHardy
2679M: kaber@coreworks.de 2679M: kaber@trash.net
2680L: netdev@vger.kernel.org 2680L: netdev@vger.kernel.org
2681T: git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git 2681T: git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git
2682S: Maintained 2682S: Maintained
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 854d80c330ec..66eed22cbd21 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.6.4" 57#define DRV_MODULE_VERSION "1.6.5"
58#define DRV_MODULE_RELDATE "August 3, 2007" 58#define DRV_MODULE_RELDATE "September 20, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -6727,7 +6727,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6727 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || 6727 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
6728 CHIP_NUM(bp) == CHIP_NUM_5708) 6728 CHIP_NUM(bp) == CHIP_NUM_5708)
6729 bp->phy_flags |= PHY_CRC_FIX_FLAG; 6729 bp->phy_flags |= PHY_CRC_FIX_FLAG;
6730 else if (CHIP_ID(bp) == CHIP_ID_5709_A0) 6730 else if (CHIP_ID(bp) == CHIP_ID_5709_A0 ||
6731 CHIP_ID(bp) == CHIP_ID_5709_A1)
6731 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; 6732 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG;
6732 6733
6733 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || 6734 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 0d7f570b9a54..9b30cd600a64 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -879,8 +879,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
879 dev->hard_header(skb, dev, ETH_P_PPP_SES, 879 dev->hard_header(skb, dev, ETH_P_PPP_SES,
880 po->pppoe_pa.remote, NULL, data_len); 880 po->pppoe_pa.remote, NULL, data_len);
881 881
882 if (dev_queue_xmit(skb) < 0) 882 dev_queue_xmit(skb);
883 goto abort;
884 883
885 return 1; 884 return 1;
886 885
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 266e8b38fe10..abe91cb595f4 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -491,44 +491,46 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
491 u16 hdrflags; 491 u16 hdrflags;
492 u16 tunnel_id, session_id; 492 u16 tunnel_id, session_id;
493 int length; 493 int length;
494 struct udphdr *uh; 494 int offset;
495 495
496 tunnel = pppol2tp_sock_to_tunnel(sock); 496 tunnel = pppol2tp_sock_to_tunnel(sock);
497 if (tunnel == NULL) 497 if (tunnel == NULL)
498 goto error; 498 goto error;
499 499
500 /* UDP always verifies the packet length. */
501 __skb_pull(skb, sizeof(struct udphdr));
502
500 /* Short packet? */ 503 /* Short packet? */
501 if (skb->len < sizeof(struct udphdr)) { 504 if (!pskb_may_pull(skb, 12)) {
502 PRINTK(tunnel->debug, PPPOL2TP_MSG_DATA, KERN_INFO, 505 PRINTK(tunnel->debug, PPPOL2TP_MSG_DATA, KERN_INFO,
503 "%s: recv short packet (len=%d)\n", tunnel->name, skb->len); 506 "%s: recv short packet (len=%d)\n", tunnel->name, skb->len);
504 goto error; 507 goto error;
505 } 508 }
506 509
507 /* Point to L2TP header */ 510 /* Point to L2TP header */
508 ptr = skb->data + sizeof(struct udphdr); 511 ptr = skb->data;
509 512
510 /* Get L2TP header flags */ 513 /* Get L2TP header flags */
511 hdrflags = ntohs(*(__be16*)ptr); 514 hdrflags = ntohs(*(__be16*)ptr);
512 515
513 /* Trace packet contents, if enabled */ 516 /* Trace packet contents, if enabled */
514 if (tunnel->debug & PPPOL2TP_MSG_DATA) { 517 if (tunnel->debug & PPPOL2TP_MSG_DATA) {
518 length = min(16u, skb->len);
519 if (!pskb_may_pull(skb, length))
520 goto error;
521
515 printk(KERN_DEBUG "%s: recv: ", tunnel->name); 522 printk(KERN_DEBUG "%s: recv: ", tunnel->name);
516 523
517 for (length = 0; length < 16; length++) 524 offset = 0;
518 printk(" %02X", ptr[length]); 525 do {
526 printk(" %02X", ptr[offset]);
527 } while (++offset < length);
528
519 printk("\n"); 529 printk("\n");
520 } 530 }
521 531
522 /* Get length of L2TP packet */ 532 /* Get length of L2TP packet */
523 uh = (struct udphdr *) skb_transport_header(skb); 533 length = skb->len;
524 length = ntohs(uh->len) - sizeof(struct udphdr);
525
526 /* Too short? */
527 if (length < 12) {
528 PRINTK(tunnel->debug, PPPOL2TP_MSG_DATA, KERN_INFO,
529 "%s: recv short L2TP packet (len=%d)\n", tunnel->name, length);
530 goto error;
531 }
532 534
533 /* If type is control packet, it is handled by userspace. */ 535 /* If type is control packet, it is handled by userspace. */
534 if (hdrflags & L2TP_HDRFLAG_T) { 536 if (hdrflags & L2TP_HDRFLAG_T) {
@@ -606,7 +608,6 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
606 "%s: recv data has no seq numbers when required. " 608 "%s: recv data has no seq numbers when required. "
607 "Discarding\n", session->name); 609 "Discarding\n", session->name);
608 session->stats.rx_seq_discards++; 610 session->stats.rx_seq_discards++;
609 session->stats.rx_errors++;
610 goto discard; 611 goto discard;
611 } 612 }
612 613
@@ -625,7 +626,6 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
625 "%s: recv data has no seq numbers when required. " 626 "%s: recv data has no seq numbers when required. "
626 "Discarding\n", session->name); 627 "Discarding\n", session->name);
627 session->stats.rx_seq_discards++; 628 session->stats.rx_seq_discards++;
628 session->stats.rx_errors++;
629 goto discard; 629 goto discard;
630 } 630 }
631 631
@@ -634,10 +634,14 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
634 } 634 }
635 635
636 /* If offset bit set, skip it. */ 636 /* If offset bit set, skip it. */
637 if (hdrflags & L2TP_HDRFLAG_O) 637 if (hdrflags & L2TP_HDRFLAG_O) {
638 ptr += 2 + ntohs(*(__be16 *) ptr); 638 offset = ntohs(*(__be16 *)ptr);
639 skb->transport_header += 2 + offset;
640 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2))
641 goto discard;
642 }
639 643
640 skb_pull(skb, ptr - skb->data); 644 __skb_pull(skb, skb_transport_offset(skb));
641 645
642 /* Skip PPP header, if present. In testing, Microsoft L2TP clients 646 /* Skip PPP header, if present. In testing, Microsoft L2TP clients
643 * don't send the PPP header (PPP header compression enabled), but 647 * don't send the PPP header (PPP header compression enabled), but
@@ -673,7 +677,6 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
673 */ 677 */
674 if (PPPOL2TP_SKB_CB(skb)->ns != session->nr) { 678 if (PPPOL2TP_SKB_CB(skb)->ns != session->nr) {
675 session->stats.rx_seq_discards++; 679 session->stats.rx_seq_discards++;
676 session->stats.rx_errors++;
677 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, 680 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG,
678 "%s: oos pkt %hu len %d discarded, " 681 "%s: oos pkt %hu len %d discarded, "
679 "waiting for %hu, reorder_q_len=%d\n", 682 "waiting for %hu, reorder_q_len=%d\n",
@@ -698,6 +701,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
698 return 0; 701 return 0;
699 702
700discard: 703discard:
704 session->stats.rx_errors++;
701 kfree_skb(skb); 705 kfree_skb(skb);
702 sock_put(session->sock); 706 sock_put(session->sock);
703 707
@@ -958,7 +962,6 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
958 int data_len = skb->len; 962 int data_len = skb->len;
959 struct inet_sock *inet; 963 struct inet_sock *inet;
960 __wsum csum = 0; 964 __wsum csum = 0;
961 struct sk_buff *skb2 = NULL;
962 struct udphdr *uh; 965 struct udphdr *uh;
963 unsigned int len; 966 unsigned int len;
964 967
@@ -989,41 +992,30 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
989 */ 992 */
990 headroom = NET_SKB_PAD + sizeof(struct iphdr) + 993 headroom = NET_SKB_PAD + sizeof(struct iphdr) +
991 sizeof(struct udphdr) + hdr_len + sizeof(ppph); 994 sizeof(struct udphdr) + hdr_len + sizeof(ppph);
992 if (skb_headroom(skb) < headroom) { 995 if (skb_cow_head(skb, headroom))
993 skb2 = skb_realloc_headroom(skb, headroom); 996 goto abort;
994 if (skb2 == NULL)
995 goto abort;
996 } else
997 skb2 = skb;
998
999 /* Check that the socket has room */
1000 if (atomic_read(&sk_tun->sk_wmem_alloc) < sk_tun->sk_sndbuf)
1001 skb_set_owner_w(skb2, sk_tun);
1002 else
1003 goto discard;
1004 997
1005 /* Setup PPP header */ 998 /* Setup PPP header */
1006 skb_push(skb2, sizeof(ppph)); 999 __skb_push(skb, sizeof(ppph));
1007 skb2->data[0] = ppph[0]; 1000 skb->data[0] = ppph[0];
1008 skb2->data[1] = ppph[1]; 1001 skb->data[1] = ppph[1];
1009 1002
1010 /* Setup L2TP header */ 1003 /* Setup L2TP header */
1011 skb_push(skb2, hdr_len); 1004 pppol2tp_build_l2tp_header(session, __skb_push(skb, hdr_len));
1012 pppol2tp_build_l2tp_header(session, skb2->data);
1013 1005
1014 /* Setup UDP header */ 1006 /* Setup UDP header */
1015 inet = inet_sk(sk_tun); 1007 inet = inet_sk(sk_tun);
1016 skb_push(skb2, sizeof(struct udphdr)); 1008 __skb_push(skb, sizeof(*uh));
1017 skb_reset_transport_header(skb2); 1009 skb_reset_transport_header(skb);
1018 uh = (struct udphdr *) skb2->data; 1010 uh = udp_hdr(skb);
1019 uh->source = inet->sport; 1011 uh->source = inet->sport;
1020 uh->dest = inet->dport; 1012 uh->dest = inet->dport;
1021 uh->len = htons(sizeof(struct udphdr) + hdr_len + sizeof(ppph) + data_len); 1013 uh->len = htons(sizeof(struct udphdr) + hdr_len + sizeof(ppph) + data_len);
1022 uh->check = 0; 1014 uh->check = 0;
1023 1015
1024 /* Calculate UDP checksum if configured to do so */ 1016 /* *BROKEN* Calculate UDP checksum if configured to do so */
1025 if (sk_tun->sk_no_check != UDP_CSUM_NOXMIT) 1017 if (sk_tun->sk_no_check != UDP_CSUM_NOXMIT)
1026 csum = udp_csum_outgoing(sk_tun, skb2); 1018 csum = udp_csum_outgoing(sk_tun, skb);
1027 1019
1028 /* Debug */ 1020 /* Debug */
1029 if (session->send_seq) 1021 if (session->send_seq)
@@ -1036,7 +1028,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1036 1028
1037 if (session->debug & PPPOL2TP_MSG_DATA) { 1029 if (session->debug & PPPOL2TP_MSG_DATA) {
1038 int i; 1030 int i;
1039 unsigned char *datap = skb2->data; 1031 unsigned char *datap = skb->data;
1040 1032
1041 printk(KERN_DEBUG "%s: xmit:", session->name); 1033 printk(KERN_DEBUG "%s: xmit:", session->name);
1042 for (i = 0; i < data_len; i++) { 1034 for (i = 0; i < data_len; i++) {
@@ -1049,18 +1041,18 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1049 printk("\n"); 1041 printk("\n");
1050 } 1042 }
1051 1043
1052 memset(&(IPCB(skb2)->opt), 0, sizeof(IPCB(skb2)->opt)); 1044 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
1053 IPCB(skb2)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 1045 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
1054 IPSKB_REROUTED); 1046 IPSKB_REROUTED);
1055 nf_reset(skb2); 1047 nf_reset(skb);
1056 1048
1057 /* Get routing info from the tunnel socket */ 1049 /* Get routing info from the tunnel socket */
1058 dst_release(skb2->dst); 1050 dst_release(skb->dst);
1059 skb2->dst = sk_dst_get(sk_tun); 1051 skb->dst = sk_dst_get(sk_tun);
1060 1052
1061 /* Queue the packet to IP for output */ 1053 /* Queue the packet to IP for output */
1062 len = skb2->len; 1054 len = skb->len;
1063 rc = ip_queue_xmit(skb2, 1); 1055 rc = ip_queue_xmit(skb, 1);
1064 1056
1065 /* Update stats */ 1057 /* Update stats */
1066 if (rc >= 0) { 1058 if (rc >= 0) {
@@ -1073,17 +1065,12 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1073 session->stats.tx_errors++; 1065 session->stats.tx_errors++;
1074 } 1066 }
1075 1067
1076 /* Free the original skb */
1077 kfree_skb(skb);
1078
1079 return 1; 1068 return 1;
1080 1069
1081discard:
1082 /* Free the new skb. Caller will free original skb. */
1083 if (skb2 != skb)
1084 kfree_skb(skb2);
1085abort: 1070abort:
1086 return 0; 1071 /* Free the original skb */
1072 kfree_skb(skb);
1073 return 1;
1087} 1074}
1088 1075
1089/***************************************************************************** 1076/*****************************************************************************
@@ -1326,12 +1313,14 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
1326 goto err; 1313 goto err;
1327 } 1314 }
1328 1315
1316 sk = sock->sk;
1317
1329 /* Quick sanity checks */ 1318 /* Quick sanity checks */
1330 err = -ESOCKTNOSUPPORT; 1319 err = -EPROTONOSUPPORT;
1331 if (sock->type != SOCK_DGRAM) { 1320 if (sk->sk_protocol != IPPROTO_UDP) {
1332 PRINTK(-1, PPPOL2TP_MSG_CONTROL, KERN_ERR, 1321 PRINTK(-1, PPPOL2TP_MSG_CONTROL, KERN_ERR,
1333 "tunl %hu: fd %d wrong type, got %d, expected %d\n", 1322 "tunl %hu: fd %d wrong protocol, got %d, expected %d\n",
1334 tunnel_id, fd, sock->type, SOCK_DGRAM); 1323 tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP);
1335 goto err; 1324 goto err;
1336 } 1325 }
1337 err = -EAFNOSUPPORT; 1326 err = -EAFNOSUPPORT;
@@ -1343,7 +1332,6 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
1343 } 1332 }
1344 1333
1345 err = -ENOTCONN; 1334 err = -ENOTCONN;
1346 sk = sock->sk;
1347 1335
1348 /* Check if this socket has already been prepped */ 1336 /* Check if this socket has already been prepped */
1349 tunnel = (struct pppol2tp_tunnel *)sk->sk_user_data; 1337 tunnel = (struct pppol2tp_tunnel *)sk->sk_user_data;
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index e185a5b55913..2351533a8507 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -58,7 +58,6 @@ struct nfulnl_instance {
58 58
59 unsigned int qlen; /* number of nlmsgs in skb */ 59 unsigned int qlen; /* number of nlmsgs in skb */
60 struct sk_buff *skb; /* pre-allocatd skb */ 60 struct sk_buff *skb; /* pre-allocatd skb */
61 struct nlmsghdr *lastnlh; /* netlink header of last msg in skb */
62 struct timer_list timer; 61 struct timer_list timer;
63 int peer_pid; /* PID of the peer process */ 62 int peer_pid; /* PID of the peer process */
64 63
@@ -345,10 +344,12 @@ static struct sk_buff *nfulnl_alloc_skb(unsigned int inst_size,
345static int 344static int
346__nfulnl_send(struct nfulnl_instance *inst) 345__nfulnl_send(struct nfulnl_instance *inst)
347{ 346{
348 int status; 347 int status = -1;
349 348
350 if (inst->qlen > 1) 349 if (inst->qlen > 1)
351 inst->lastnlh->nlmsg_type = NLMSG_DONE; 350 NLMSG_PUT(inst->skb, 0, 0,
351 NLMSG_DONE,
352 sizeof(struct nfgenmsg));
352 353
353 status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT); 354 status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT);
354 if (status < 0) { 355 if (status < 0) {
@@ -358,8 +359,8 @@ __nfulnl_send(struct nfulnl_instance *inst)
358 359
359 inst->qlen = 0; 360 inst->qlen = 0;
360 inst->skb = NULL; 361 inst->skb = NULL;
361 inst->lastnlh = NULL;
362 362
363nlmsg_failure:
363 return status; 364 return status;
364} 365}
365 366
@@ -538,7 +539,6 @@ __build_packet_message(struct nfulnl_instance *inst,
538 } 539 }
539 540
540 nlh->nlmsg_len = inst->skb->tail - old_tail; 541 nlh->nlmsg_len = inst->skb->tail - old_tail;
541 inst->lastnlh = nlh;
542 return 0; 542 return 0;
543 543
544nlmsg_failure: 544nlmsg_failure:
@@ -644,7 +644,8 @@ nfulnl_log_packet(unsigned int pf,
644 } 644 }
645 645
646 if (inst->qlen >= qthreshold || 646 if (inst->qlen >= qthreshold ||
647 (inst->skb && size > skb_tailroom(inst->skb))) { 647 (inst->skb && size >
648 skb_tailroom(inst->skb) - sizeof(struct nfgenmsg))) {
648 /* either the queue len is too high or we don't have 649 /* either the queue len is too high or we don't have
649 * enough room in the skb left. flush to userspace. */ 650 * enough room in the skb left. flush to userspace. */
650 UDEBUG("flushing old skb\n"); 651 UDEBUG("flushing old skb\n");
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 957957309859..3a23e30bc79e 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -270,7 +270,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
270 q->tail = x; 270 q->tail = x;
271 } 271 }
272 } 272 }
273 if (++sch->q.qlen < q->limit-1) { 273 if (++sch->q.qlen <= q->limit) {
274 sch->bstats.bytes += skb->len; 274 sch->bstats.bytes += skb->len;
275 sch->bstats.packets++; 275 sch->bstats.packets++;
276 return 0; 276 return 0;
@@ -306,7 +306,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
306 q->tail = x; 306 q->tail = x;
307 } 307 }
308 } 308 }
309 if (++sch->q.qlen < q->limit - 1) { 309 if (++sch->q.qlen <= q->limit) {
310 sch->qstats.requeues++; 310 sch->qstats.requeues++;
311 return 0; 311 return 0;
312 } 312 }
@@ -391,10 +391,10 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
391 q->quantum = ctl->quantum ? : psched_mtu(sch->dev); 391 q->quantum = ctl->quantum ? : psched_mtu(sch->dev);
392 q->perturb_period = ctl->perturb_period*HZ; 392 q->perturb_period = ctl->perturb_period*HZ;
393 if (ctl->limit) 393 if (ctl->limit)
394 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH); 394 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH - 2);
395 395
396 qlen = sch->q.qlen; 396 qlen = sch->q.qlen;
397 while (sch->q.qlen >= q->limit-1) 397 while (sch->q.qlen > q->limit)
398 sfq_drop(sch); 398 sfq_drop(sch);
399 qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen); 399 qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen);
400 400
@@ -423,7 +423,7 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
423 q->dep[i+SFQ_DEPTH].next = i+SFQ_DEPTH; 423 q->dep[i+SFQ_DEPTH].next = i+SFQ_DEPTH;
424 q->dep[i+SFQ_DEPTH].prev = i+SFQ_DEPTH; 424 q->dep[i+SFQ_DEPTH].prev = i+SFQ_DEPTH;
425 } 425 }
426 q->limit = SFQ_DEPTH; 426 q->limit = SFQ_DEPTH - 2;
427 q->max_depth = 0; 427 q->max_depth = 0;
428 q->tail = SFQ_DEPTH; 428 q->tail = SFQ_DEPTH;
429 if (opt == NULL) { 429 if (opt == NULL) {