diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-09-20 15:42:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-09-20 15:42:47 -0400 |
commit | f685ddaf0fc9b9f53eb9346c858664776becf5d9 (patch) | |
tree | b28883e47171c16e69178e2b9ccaad9985778a9e /drivers | |
parent | 460edb3cd06865ffb231eb694b567daec3113210 (diff) | |
parent | cd46171c7297739dc7e46d885862e98023eab9c7 (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
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bnx2.c | 7 | ||||
-rw-r--r-- | drivers/net/pppoe.c | 3 | ||||
-rw-r--r-- | drivers/net/pppol2tp.c | 118 |
3 files changed, 58 insertions, 70 deletions
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 | ||
700 | discard: | 703 | discard: |
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 | ||
1081 | discard: | ||
1082 | /* Free the new skb. Caller will free original skb. */ | ||
1083 | if (skb2 != skb) | ||
1084 | kfree_skb(skb2); | ||
1085 | abort: | 1070 | abort: |
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; |