Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (28 commits)
ipheth: remove incorrect devtype to WWAN
MAINTAINERS: Add CAIF
sctp: fix test for end of loop
KS8851: Correct RX packet allocation
udp: add rehash on connect()
net: blackhole route should always be recalculated
ipv4: Suppress lockdep-RCU false positive in FIB trie (3)
niu: Fix kernel buffer overflow for ETHTOOL_GRXCLSRLALL
ipvs: fix active FTP
gro: Re-fix different skb headrooms
via-velocity: Turn scatter-gather support back off.
ipv4: Fix reverse path filtering with multipath routing.
UNIX: Do not loop forever at unix_autobind().
PATCH: b44 Handle RX FIFO overflow better (simplified)
irda: off by one
3c59x: Fix deadlock in vortex_error()
netfilter: discard overlapping IPv6 fragment
ipv6: discard overlapping fragment
net: fix tx queue selection for bridged devices implementing select_queue
bonding: Fix jiffies overflow problems (again)
...

Fix up trivial conflicts due to the same cgroup API thinko fix going
through both Andrew and the networking tree. However, there were small
differences between the two, with Andrew's version generally being the
nicer one, and the one I merged first. So pick that one.

Conflicts in: include/linux/cgroup.h and kernel/cgroup.c

+384 -304
+10
MAINTAINERS
··· 1445 1445 F: Documentation/video4linux/cafe_ccic 1446 1446 F: drivers/media/video/cafe_ccic* 1447 1447 1448 + CAIF NETWORK LAYER 1449 + M: Sjur Braendeland <sjur.brandeland@stericsson.com> 1450 + L: netdev@vger.kernel.org 1451 + S: Supported 1452 + F: Documentation/networking/caif/ 1453 + F: drivers/net/caif/ 1454 + F: include/linux/caif/ 1455 + F: include/net/caif/ 1456 + F: net/caif/ 1457 + 1448 1458 CALGARY x86-64 IOMMU 1449 1459 M: Muli Ben-Yehuda <muli@il.ibm.com> 1450 1460 M: "Jon D. Mason" <jdmason@kudzu.us>
+7 -3
drivers/net/3c59x.c
··· 1994 1994 } 1995 1995 } 1996 1996 1997 - if (status & RxEarly) { /* Rx early is unused. */ 1998 - vortex_rx(dev); 1997 + if (status & RxEarly) /* Rx early is unused. */ 1999 1998 iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD); 2000 - } 1999 + 2001 2000 if (status & StatsFull) { /* Empty statistics. */ 2002 2001 static int DoneDidThat; 2003 2002 if (vortex_debug > 4) ··· 2297 2298 if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) { 2298 2299 if (status == 0xffff) 2299 2300 break; 2301 + if (status & RxEarly) 2302 + vortex_rx(dev); 2303 + spin_unlock(&vp->window_lock); 2300 2304 vortex_error(dev, status); 2305 + spin_lock(&vp->window_lock); 2306 + window_set(vp, 7); 2301 2307 } 2302 2308 2303 2309 if (--work_done < 0) {
+9
drivers/net/b44.c
··· 848 848 b44_tx(bp); 849 849 /* spin_unlock(&bp->tx_lock); */ 850 850 } 851 + if (bp->istat & ISTAT_RFO) { /* fast recovery, in ~20msec */ 852 + bp->istat &= ~ISTAT_RFO; 853 + b44_disable_ints(bp); 854 + ssb_device_enable(bp->sdev, 0); /* resets ISTAT_RFO */ 855 + b44_init_rings(bp); 856 + b44_init_hw(bp, B44_FULL_RESET_SKIP_PHY); 857 + netif_wake_queue(bp->dev); 858 + } 859 + 851 860 spin_unlock_irqrestore(&bp->lock, flags); 852 861 853 862 work_done = 0;
+1
drivers/net/benet/be.h
··· 181 181 u64 be_rx_bytes_prev; 182 182 u64 be_rx_pkts; 183 183 u32 be_rx_rate; 184 + u32 be_rx_mcast_pkt; 184 185 /* number of non ether type II frames dropped where 185 186 * frame len > length field of Mac Hdr */ 186 187 u32 be_802_3_dropped_frames;
+3 -5
drivers/net/benet/be_cmds.c
··· 140 140 while ((compl = be_mcc_compl_get(adapter))) { 141 141 if (compl->flags & CQE_FLAGS_ASYNC_MASK) { 142 142 /* Interpret flags as an async trailer */ 143 - BUG_ON(!is_link_state_evt(compl->flags)); 144 - 145 - /* Interpret compl as a async link evt */ 146 - be_async_link_state_process(adapter, 143 + if (is_link_state_evt(compl->flags)) 144 + be_async_link_state_process(adapter, 147 145 (struct be_async_event_link_state *) compl); 148 146 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { 149 147 *status = be_mcc_compl_process(adapter, compl); ··· 205 207 206 208 if (msecs > 4000) { 207 209 dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 208 - be_dump_ue(adapter); 210 + be_detect_dump_ue(adapter); 209 211 return -1; 210 212 } 211 213
+1 -1
drivers/net/benet/be_cmds.h
··· 992 992 extern int be_cmd_get_phy_info(struct be_adapter *adapter, 993 993 struct be_dma_mem *cmd); 994 994 extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); 995 - extern void be_dump_ue(struct be_adapter *adapter); 995 + extern void be_detect_dump_ue(struct be_adapter *adapter); 996 996
+1
drivers/net/benet/be_ethtool.c
··· 60 60 {DRVSTAT_INFO(be_rx_events)}, 61 61 {DRVSTAT_INFO(be_tx_compl)}, 62 62 {DRVSTAT_INFO(be_rx_compl)}, 63 + {DRVSTAT_INFO(be_rx_mcast_pkt)}, 63 64 {DRVSTAT_INFO(be_ethrx_post_fail)}, 64 65 {DRVSTAT_INFO(be_802_3_dropped_frames)}, 65 66 {DRVSTAT_INFO(be_802_3_malformed_frames)},
+5 -2
drivers/net/benet/be_hw.h
··· 167 167 #define FLASH_FCoE_BIOS_START_g3 (13631488) 168 168 #define FLASH_REDBOOT_START_g3 (262144) 169 169 170 - 171 - 170 + /************* Rx Packet Type Encoding **************/ 171 + #define BE_UNICAST_PACKET 0 172 + #define BE_MULTICAST_PACKET 1 173 + #define BE_BROADCAST_PACKET 2 174 + #define BE_RSVD_PACKET 3 172 175 173 176 /* 174 177 * BE descriptors: host memory data structures whose formats
+19 -28
drivers/net/benet/be_main.c
··· 247 247 dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts; 248 248 dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes; 249 249 dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes; 250 + dev_stats->multicast = drvr_stats(adapter)->be_rx_mcast_pkt; 250 251 251 252 /* bad pkts received */ 252 253 dev_stats->rx_errors = port_stats->rx_crc_errors + ··· 295 294 /* no space available in linux */ 296 295 dev_stats->tx_dropped = 0; 297 296 298 - dev_stats->multicast = port_stats->rx_multicast_frames; 299 297 dev_stats->collisions = 0; 300 298 301 299 /* detailed tx_errors */ ··· 848 848 } 849 849 850 850 static void be_rx_stats_update(struct be_adapter *adapter, 851 - u32 pktsize, u16 numfrags) 851 + u32 pktsize, u16 numfrags, u8 pkt_type) 852 852 { 853 853 struct be_drvr_stats *stats = drvr_stats(adapter); 854 854 ··· 856 856 stats->be_rx_frags += numfrags; 857 857 stats->be_rx_bytes += pktsize; 858 858 stats->be_rx_pkts++; 859 + 860 + if (pkt_type == BE_MULTICAST_PACKET) 861 + stats->be_rx_mcast_pkt++; 859 862 } 860 863 861 864 static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) ··· 928 925 u16 rxq_idx, i, j; 929 926 u32 pktsize, hdr_len, curr_frag_len, size; 930 927 u8 *start; 928 + u8 pkt_type; 931 929 932 930 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); 933 931 pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); 932 + pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp); 934 933 935 934 page_info = get_rx_page_info(adapter, rxq_idx); 936 935 ··· 998 993 BUG_ON(j > MAX_SKB_FRAGS); 999 994 1000 995 done: 1001 - be_rx_stats_update(adapter, pktsize, num_rcvd); 996 + be_rx_stats_update(adapter, pktsize, num_rcvd, pkt_type); 1002 997 } 1003 998 1004 999 /* Process the RX completion indicated by rxcp when GRO is disabled */ ··· 1065 1060 u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; 1066 1061 u16 i, rxq_idx = 0, vid, j; 1067 1062 u8 vtm; 1063 + u8 pkt_type; 1068 1064 1069 1065 num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); 1070 1066 /* Is it a flush compl that has no data */ ··· 1076 1070 vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); 1077 1071 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); 1078 1072 vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); 1073 + pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp); 1079 1074 1080 1075 /* vlanf could be wrongly set in some cards. 1081 1076 * ignore if vtm is not set */ ··· 1132 1125 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid); 1133 1126 } 1134 1127 1135 - be_rx_stats_update(adapter, pkt_size, num_rcvd); 1128 + be_rx_stats_update(adapter, pkt_size, num_rcvd, pkt_type); 1136 1129 } 1137 1130 1138 1131 static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter) ··· 1750 1743 return 1; 1751 1744 } 1752 1745 1753 - static inline bool be_detect_ue(struct be_adapter *adapter) 1754 - { 1755 - u32 online0 = 0, online1 = 0; 1756 - 1757 - pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0); 1758 - 1759 - pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1); 1760 - 1761 - if (!online0 || !online1) { 1762 - adapter->ue_detected = true; 1763 - dev_err(&adapter->pdev->dev, 1764 - "UE Detected!! online0=%d online1=%d\n", 1765 - online0, online1); 1766 - return true; 1767 - } 1768 - 1769 - return false; 1770 - } 1771 - 1772 - void be_dump_ue(struct be_adapter *adapter) 1746 + void be_detect_dump_ue(struct be_adapter *adapter) 1773 1747 { 1774 1748 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; 1775 1749 u32 i; ··· 1766 1778 1767 1779 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); 1768 1780 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); 1781 + 1782 + if (ue_status_lo || ue_status_hi) { 1783 + adapter->ue_detected = true; 1784 + dev_err(&adapter->pdev->dev, "UE Detected!!\n"); 1785 + } 1769 1786 1770 1787 if (ue_status_lo) { 1771 1788 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { ··· 1807 1814 adapter->rx_post_starved = false; 1808 1815 be_post_rx_frags(adapter); 1809 1816 } 1810 - if (!adapter->ue_detected) { 1811 - if (be_detect_ue(adapter)) 1812 - be_dump_ue(adapter); 1813 - } 1817 + if (!adapter->ue_detected) 1818 + be_detect_dump_ue(adapter); 1814 1819 1815 1820 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); 1816 1821 }
+39 -17
drivers/net/bonding/bond_main.c
··· 2797 2797 * so it can wait 2798 2798 */ 2799 2799 bond_for_each_slave(bond, slave, i) { 2800 + unsigned long trans_start = dev_trans_start(slave->dev); 2801 + 2800 2802 if (slave->link != BOND_LINK_UP) { 2801 - if (time_before_eq(jiffies, dev_trans_start(slave->dev) + delta_in_ticks) && 2802 - time_before_eq(jiffies, slave->dev->last_rx + delta_in_ticks)) { 2803 + if (time_in_range(jiffies, 2804 + trans_start - delta_in_ticks, 2805 + trans_start + delta_in_ticks) && 2806 + time_in_range(jiffies, 2807 + slave->dev->last_rx - delta_in_ticks, 2808 + slave->dev->last_rx + delta_in_ticks)) { 2803 2809 2804 2810 slave->link = BOND_LINK_UP; 2805 2811 slave->state = BOND_STATE_ACTIVE; ··· 2833 2827 * when the source ip is 0, so don't take the link down 2834 2828 * if we don't know our ip yet 2835 2829 */ 2836 - if (time_after_eq(jiffies, dev_trans_start(slave->dev) + 2*delta_in_ticks) || 2837 - (time_after_eq(jiffies, slave->dev->last_rx + 2*delta_in_ticks))) { 2830 + if (!time_in_range(jiffies, 2831 + trans_start - delta_in_ticks, 2832 + trans_start + 2 * delta_in_ticks) || 2833 + !time_in_range(jiffies, 2834 + slave->dev->last_rx - delta_in_ticks, 2835 + slave->dev->last_rx + 2 * delta_in_ticks)) { 2838 2836 2839 2837 slave->link = BOND_LINK_DOWN; 2840 2838 slave->state = BOND_STATE_BACKUP; ··· 2893 2883 { 2894 2884 struct slave *slave; 2895 2885 int i, commit = 0; 2886 + unsigned long trans_start; 2896 2887 2897 2888 bond_for_each_slave(bond, slave, i) { 2898 2889 slave->new_link = BOND_LINK_NOCHANGE; 2899 2890 2900 2891 if (slave->link != BOND_LINK_UP) { 2901 - if (time_before_eq(jiffies, slave_last_rx(bond, slave) + 2902 - delta_in_ticks)) { 2892 + if (time_in_range(jiffies, 2893 + slave_last_rx(bond, slave) - delta_in_ticks, 2894 + slave_last_rx(bond, slave) + delta_in_ticks)) { 2895 + 2903 2896 slave->new_link = BOND_LINK_UP; 2904 2897 commit++; 2905 2898 } ··· 2915 2902 * active. This avoids bouncing, as the last receive 2916 2903 * times need a full ARP monitor cycle to be updated. 2917 2904 */ 2918 - if (!time_after_eq(jiffies, slave->jiffies + 2919 - 2 * delta_in_ticks)) 2905 + if (time_in_range(jiffies, 2906 + slave->jiffies - delta_in_ticks, 2907 + slave->jiffies + 2 * delta_in_ticks)) 2920 2908 continue; 2921 2909 2922 2910 /* ··· 2935 2921 */ 2936 2922 if (slave->state == BOND_STATE_BACKUP && 2937 2923 !bond->current_arp_slave && 2938 - time_after(jiffies, slave_last_rx(bond, slave) + 2939 - 3 * delta_in_ticks)) { 2924 + !time_in_range(jiffies, 2925 + slave_last_rx(bond, slave) - delta_in_ticks, 2926 + slave_last_rx(bond, slave) + 3 * delta_in_ticks)) { 2927 + 2940 2928 slave->new_link = BOND_LINK_DOWN; 2941 2929 commit++; 2942 2930 } ··· 2949 2933 * - (more than 2*delta since receive AND 2950 2934 * the bond has an IP address) 2951 2935 */ 2936 + trans_start = dev_trans_start(slave->dev); 2952 2937 if ((slave->state == BOND_STATE_ACTIVE) && 2953 - (time_after_eq(jiffies, dev_trans_start(slave->dev) + 2954 - 2 * delta_in_ticks) || 2955 - (time_after_eq(jiffies, slave_last_rx(bond, slave) 2956 - + 2 * delta_in_ticks)))) { 2938 + (!time_in_range(jiffies, 2939 + trans_start - delta_in_ticks, 2940 + trans_start + 2 * delta_in_ticks) || 2941 + !time_in_range(jiffies, 2942 + slave_last_rx(bond, slave) - delta_in_ticks, 2943 + slave_last_rx(bond, slave) + 2 * delta_in_ticks))) { 2944 + 2957 2945 slave->new_link = BOND_LINK_DOWN; 2958 2946 commit++; 2959 2947 } ··· 2976 2956 { 2977 2957 struct slave *slave; 2978 2958 int i; 2959 + unsigned long trans_start; 2979 2960 2980 2961 bond_for_each_slave(bond, slave, i) { 2981 2962 switch (slave->new_link) { ··· 2984 2963 continue; 2985 2964 2986 2965 case BOND_LINK_UP: 2966 + trans_start = dev_trans_start(slave->dev); 2987 2967 if ((!bond->curr_active_slave && 2988 - time_before_eq(jiffies, 2989 - dev_trans_start(slave->dev) + 2990 - delta_in_ticks)) || 2968 + time_in_range(jiffies, 2969 + trans_start - delta_in_ticks, 2970 + trans_start + delta_in_ticks)) || 2991 2971 bond->curr_active_slave != slave) { 2992 2972 slave->link = BOND_LINK_UP; 2993 2973 bond->current_arp_slave = NULL;
+26 -23
drivers/net/ks8851.c
··· 503 503 ks8851_wrreg16(ks, KS_RXQCR, 504 504 ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE); 505 505 506 - if (rxlen > 0) { 507 - skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8); 508 - if (!skb) { 509 - /* todo - dump frame and move on */ 506 + if (rxlen > 4) { 507 + unsigned int rxalign; 508 + 509 + rxlen -= 4; 510 + rxalign = ALIGN(rxlen, 4); 511 + skb = netdev_alloc_skb_ip_align(ks->netdev, rxalign); 512 + if (skb) { 513 + 514 + /* 4 bytes of status header + 4 bytes of 515 + * garbage: we put them before ethernet 516 + * header, so that they are copied, 517 + * but ignored. 518 + */ 519 + 520 + rxpkt = skb_put(skb, rxlen) - 8; 521 + 522 + ks8851_rdfifo(ks, rxpkt, rxalign + 8); 523 + 524 + if (netif_msg_pktdata(ks)) 525 + ks8851_dbg_dumpkkt(ks, rxpkt); 526 + 527 + skb->protocol = eth_type_trans(skb, ks->netdev); 528 + netif_rx(skb); 529 + 530 + ks->netdev->stats.rx_packets++; 531 + ks->netdev->stats.rx_bytes += rxlen; 510 532 } 511 - 512 - /* two bytes to ensure ip is aligned, and four bytes 513 - * for the status header and 4 bytes of garbage */ 514 - skb_reserve(skb, 2 + 4 + 4); 515 - 516 - rxpkt = skb_put(skb, rxlen - 4) - 8; 517 - 518 - /* align the packet length to 4 bytes, and add 4 bytes 519 - * as we're getting the rx status header as well */ 520 - ks8851_rdfifo(ks, rxpkt, ALIGN(rxlen, 4) + 8); 521 - 522 - if (netif_msg_pktdata(ks)) 523 - ks8851_dbg_dumpkkt(ks, rxpkt); 524 - 525 - skb->protocol = eth_type_trans(skb, ks->netdev); 526 - netif_rx(skb); 527 - 528 - ks->netdev->stats.rx_packets++; 529 - ks->netdev->stats.rx_bytes += rxlen - 4; 530 533 } 531 534 532 535 ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
+6 -10
drivers/net/niu.c
··· 7269 7269 struct niu_parent *parent = np->parent; 7270 7270 struct niu_tcam_entry *tp; 7271 7271 int i, idx, cnt; 7272 - u16 n_entries; 7273 7272 unsigned long flags; 7274 - 7273 + int ret = 0; 7275 7274 7276 7275 /* put the tcam size here */ 7277 7276 nfc->data = tcam_get_size(np); 7278 7277 7279 7278 niu_lock_parent(np, flags); 7280 - n_entries = nfc->rule_cnt; 7281 7279 for (cnt = 0, i = 0; i < nfc->data; i++) { 7282 7280 idx = tcam_get_index(np, i); 7283 7281 tp = &parent->tcam[idx]; 7284 7282 if (!tp->valid) 7285 7283 continue; 7284 + if (cnt == nfc->rule_cnt) { 7285 + ret = -EMSGSIZE; 7286 + break; 7287 + } 7286 7288 rule_locs[cnt] = i; 7287 7289 cnt++; 7288 7290 } 7289 7291 niu_unlock_parent(np, flags); 7290 7292 7291 - if (n_entries != cnt) { 7292 - /* print warning, this should not happen */ 7293 - netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n", 7294 - np->parent->index, __func__, n_entries, cnt); 7295 - } 7296 - 7297 - return 0; 7293 + return ret; 7298 7294 } 7299 7295 7300 7296 static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
+4 -5
drivers/net/stmmac/stmmac_main.c
··· 1865 1865 if (!netif_running(dev)) 1866 1866 return 0; 1867 1867 1868 - spin_lock(&priv->lock); 1869 - 1870 1868 if (priv->shutdown) { 1871 1869 /* Re-open the interface and re-init the MAC/DMA 1872 - and the rings. */ 1870 + and the rings (i.e. on hibernation stage) */ 1873 1871 stmmac_open(dev); 1874 - goto out_resume; 1872 + return 0; 1875 1873 } 1874 + 1875 + spin_lock(&priv->lock); 1876 1876 1877 1877 /* Power Down bit, into the PM register, is cleared 1878 1878 * automatically as soon as a magic packet or a Wake-up frame ··· 1901 1901 1902 1902 netif_start_queue(dev); 1903 1903 1904 - out_resume: 1905 1904 spin_unlock(&priv->lock); 1906 1905 return 0; 1907 1906 }
+1 -6
drivers/net/usb/ipheth.c
··· 429 429 .ndo_get_stats = &ipheth_stats, 430 430 }; 431 431 432 - static struct device_type ipheth_type = { 433 - .name = "wwan", 434 - }; 435 - 436 432 static int ipheth_probe(struct usb_interface *intf, 437 433 const struct usb_device_id *id) 438 434 { ··· 446 450 447 451 netdev->netdev_ops = &ipheth_netdev_ops; 448 452 netdev->watchdog_timeo = IPHETH_TX_TIMEOUT; 449 - strcpy(netdev->name, "wwan%d"); 453 + strcpy(netdev->name, "eth%d"); 450 454 451 455 dev = netdev_priv(netdev); 452 456 dev->udev = udev; ··· 496 500 497 501 SET_NETDEV_DEV(netdev, &intf->dev); 498 502 SET_ETHTOOL_OPS(netdev, &ops); 499 - SET_NETDEV_DEVTYPE(netdev, &ipheth_type); 500 503 501 504 retval = register_netdev(netdev); 502 505 if (retval) {
+1 -1
drivers/net/via-velocity.c
··· 2824 2824 netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT); 2825 2825 2826 2826 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | 2827 - NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM | NETIF_F_SG; 2827 + NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM; 2828 2828 2829 2829 ret = register_netdev(dev); 2830 2830 if (ret < 0)
+61 -25
drivers/vhost/vhost.c
··· 60 60 return 0; 61 61 } 62 62 63 - /* Init poll structure */ 64 - void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, 65 - unsigned long mask, struct vhost_dev *dev) 63 + static void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn) 66 64 { 67 - struct vhost_work *work = &poll->work; 68 - 69 - init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup); 70 - init_poll_funcptr(&poll->table, vhost_poll_func); 71 - poll->mask = mask; 72 - poll->dev = dev; 73 - 74 65 INIT_LIST_HEAD(&work->node); 75 66 work->fn = fn; 76 67 init_waitqueue_head(&work->done); 77 68 work->flushing = 0; 78 69 work->queue_seq = work->done_seq = 0; 70 + } 71 + 72 + /* Init poll structure */ 73 + void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, 74 + unsigned long mask, struct vhost_dev *dev) 75 + { 76 + init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup); 77 + init_poll_funcptr(&poll->table, vhost_poll_func); 78 + poll->mask = mask; 79 + poll->dev = dev; 80 + 81 + vhost_work_init(&poll->work, fn); 79 82 } 80 83 81 84 /* Start polling a file. We add ourselves to file's wait queue. The caller must ··· 98 95 remove_wait_queue(poll->wqh, &poll->wait); 99 96 } 100 97 101 - /* Flush any work that has been scheduled. When calling this, don't hold any 102 - * locks that are also used by the callback. */ 103 - void vhost_poll_flush(struct vhost_poll *poll) 98 + static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) 104 99 { 105 - struct vhost_work *work = &poll->work; 106 100 unsigned seq; 107 101 int left; 108 102 int flushing; 109 103 110 - spin_lock_irq(&poll->dev->work_lock); 104 + spin_lock_irq(&dev->work_lock); 111 105 seq = work->queue_seq; 112 106 work->flushing++; 113 - spin_unlock_irq(&poll->dev->work_lock); 107 + spin_unlock_irq(&dev->work_lock); 114 108 wait_event(work->done, ({ 115 - spin_lock_irq(&poll->dev->work_lock); 109 + spin_lock_irq(&dev->work_lock); 116 110 left = seq - work->done_seq <= 0; 117 - spin_unlock_irq(&poll->dev->work_lock); 111 + spin_unlock_irq(&dev->work_lock); 118 112 left; 119 113 })); 120 - spin_lock_irq(&poll->dev->work_lock); 114 + spin_lock_irq(&dev->work_lock); 121 115 flushing = --work->flushing; 122 - spin_unlock_irq(&poll->dev->work_lock); 116 + spin_unlock_irq(&dev->work_lock); 123 117 BUG_ON(flushing < 0); 124 118 } 125 119 126 - void vhost_poll_queue(struct vhost_poll *poll) 120 + /* Flush any work that has been scheduled. When calling this, don't hold any 121 + * locks that are also used by the callback. */ 122 + void vhost_poll_flush(struct vhost_poll *poll) 127 123 { 128 - struct vhost_dev *dev = poll->dev; 129 - struct vhost_work *work = &poll->work; 124 + vhost_work_flush(poll->dev, &poll->work); 125 + } 126 + 127 + static inline void vhost_work_queue(struct vhost_dev *dev, 128 + struct vhost_work *work) 129 + { 130 130 unsigned long flags; 131 131 132 132 spin_lock_irqsave(&dev->work_lock, flags); ··· 139 133 wake_up_process(dev->worker); 140 134 } 141 135 spin_unlock_irqrestore(&dev->work_lock, flags); 136 + } 137 + 138 + void vhost_poll_queue(struct vhost_poll *poll) 139 + { 140 + vhost_work_queue(poll->dev, &poll->work); 142 141 } 143 142 144 143 static void vhost_vq_reset(struct vhost_dev *dev, ··· 247 236 return dev->mm == current->mm ? 0 : -EPERM; 248 237 } 249 238 239 + struct vhost_attach_cgroups_struct { 240 + struct vhost_work work; 241 + struct task_struct *owner; 242 + int ret; 243 + }; 244 + 245 + static void vhost_attach_cgroups_work(struct vhost_work *work) 246 + { 247 + struct vhost_attach_cgroups_struct *s; 248 + s = container_of(work, struct vhost_attach_cgroups_struct, work); 249 + s->ret = cgroup_attach_task_all(s->owner, current); 250 + } 251 + 252 + static int vhost_attach_cgroups(struct vhost_dev *dev) 253 + { 254 + struct vhost_attach_cgroups_struct attach; 255 + attach.owner = current; 256 + vhost_work_init(&attach.work, vhost_attach_cgroups_work); 257 + vhost_work_queue(dev, &attach.work); 258 + vhost_work_flush(dev, &attach.work); 259 + return attach.ret; 260 + } 261 + 250 262 /* Caller should have device mutex */ 251 263 static long vhost_dev_set_owner(struct vhost_dev *dev) 252 264 { ··· 289 255 } 290 256 291 257 dev->worker = worker; 292 - err = cgroup_attach_task_current_cg(worker); 258 + wake_up_process(worker); /* avoid contributing to loadavg */ 259 + 260 + err = vhost_attach_cgroups(dev); 293 261 if (err) 294 262 goto err_cgroup; 295 - wake_up_process(worker); /* avoid contributing to loadavg */ 296 263 297 264 return 0; 298 265 err_cgroup: 299 266 kthread_stop(worker); 267 + dev->worker = NULL; 300 268 err_worker: 301 269 if (dev->mm) 302 270 mmput(dev->mm);
+8 -2
include/net/cls_cgroup.h
··· 27 27 #ifdef CONFIG_NET_CLS_CGROUP 28 28 static inline u32 task_cls_classid(struct task_struct *p) 29 29 { 30 + int classid; 31 + 30 32 if (in_interrupt()) 31 33 return 0; 32 34 33 - return container_of(task_subsys_state(p, net_cls_subsys_id), 34 - struct cgroup_cls_state, css)->classid; 35 + rcu_read_lock(); 36 + classid = container_of(task_subsys_state(p, net_cls_subsys_id), 37 + struct cgroup_cls_state, css)->classid; 38 + rcu_read_unlock(); 39 + 40 + return classid; 35 41 } 36 42 #else 37 43 extern int net_cls_subsys_id;
+3
include/net/ip_vs.h
··· 955 955 return csum_partial(diff, sizeof(diff), oldsum); 956 956 } 957 957 958 + extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 959 + int outin); 960 + 958 961 #endif /* __KERNEL__ */ 959 962 960 963 #endif /* _NET_IP_VS_H */
+1
include/net/sock.h
··· 752 752 /* Keeping track of sk's, looking them up, and port selection methods. */ 753 753 void (*hash)(struct sock *sk); 754 754 void (*unhash)(struct sock *sk); 755 + void (*rehash)(struct sock *sk); 755 756 int (*get_port)(struct sock *sk, unsigned short snum); 756 757 757 758 /* Keeping track of sockets in use */
+1
include/net/udp.h
··· 151 151 } 152 152 153 153 extern void udp_lib_unhash(struct sock *sk); 154 + extern void udp_lib_rehash(struct sock *sk, u16 new_hash); 154 155 155 156 static inline void udp_lib_close(struct sock *sk, long timeout) 156 157 {
+8 -8
net/core/dev.c
··· 2058 2058 struct sk_buff *skb) 2059 2059 { 2060 2060 int queue_index; 2061 - struct sock *sk = skb->sk; 2061 + const struct net_device_ops *ops = dev->netdev_ops; 2062 2062 2063 - queue_index = sk_tx_queue_get(sk); 2064 - if (queue_index < 0) { 2065 - const struct net_device_ops *ops = dev->netdev_ops; 2063 + if (ops->ndo_select_queue) { 2064 + queue_index = ops->ndo_select_queue(dev, skb); 2065 + queue_index = dev_cap_txqueue(dev, queue_index); 2066 + } else { 2067 + struct sock *sk = skb->sk; 2068 + queue_index = sk_tx_queue_get(sk); 2069 + if (queue_index < 0) { 2066 2070 2067 - if (ops->ndo_select_queue) { 2068 - queue_index = ops->ndo_select_queue(dev, skb); 2069 - queue_index = dev_cap_txqueue(dev, queue_index); 2070 - } else { 2071 2071 queue_index = 0; 2072 2072 if (dev->real_num_tx_queues > 1) 2073 2073 queue_index = skb_tx_hash(dev, skb);
+1 -1
net/core/skbuff.c
··· 2706 2706 } else if (skb_gro_len(p) != pinfo->gso_size) 2707 2707 return -E2BIG; 2708 2708 2709 - headroom = NET_SKB_PAD + NET_IP_ALIGN; 2709 + headroom = skb_headroom(p); 2710 2710 nskb = alloc_skb(headroom + skb_gro_offset(p), GFP_ATOMIC); 2711 2711 if (unlikely(!nskb)) 2712 2712 return -ENOMEM;
+4 -1
net/ipv4/datagram.c
··· 62 62 } 63 63 if (!inet->inet_saddr) 64 64 inet->inet_saddr = rt->rt_src; /* Update source address */ 65 - if (!inet->inet_rcv_saddr) 65 + if (!inet->inet_rcv_saddr) { 66 66 inet->inet_rcv_saddr = rt->rt_src; 67 + if (sk->sk_prot->rehash) 68 + sk->sk_prot->rehash(sk); 69 + } 67 70 inet->inet_daddr = rt->rt_dst; 68 71 inet->inet_dport = usin->sin_port; 69 72 sk->sk_state = TCP_ESTABLISHED;
+13 -2
net/ipv4/fib_frontend.c
··· 246 246 247 247 struct fib_result res; 248 248 int no_addr, rpf, accept_local; 249 + bool dev_match; 249 250 int ret; 250 251 struct net *net; 251 252 ··· 274 273 } 275 274 *spec_dst = FIB_RES_PREFSRC(res); 276 275 fib_combine_itag(itag, &res); 276 + dev_match = false; 277 + 277 278 #ifdef CONFIG_IP_ROUTE_MULTIPATH 278 - if (FIB_RES_DEV(res) == dev || res.fi->fib_nhs > 1) 279 + for (ret = 0; ret < res.fi->fib_nhs; ret++) { 280 + struct fib_nh *nh = &res.fi->fib_nh[ret]; 281 + 282 + if (nh->nh_dev == dev) { 283 + dev_match = true; 284 + break; 285 + } 286 + } 279 287 #else 280 288 if (FIB_RES_DEV(res) == dev) 289 + dev_match = true; 281 290 #endif 282 - { 291 + if (dev_match) { 283 292 ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; 284 293 fib_res_put(&res); 285 294 return ret;
+6 -2
net/ipv4/fib_trie.c
··· 186 186 { 187 187 struct tnode *ret = node_parent(node); 188 188 189 - return rcu_dereference(ret); 189 + return rcu_dereference_check(ret, 190 + rcu_read_lock_held() || 191 + lockdep_rtnl_is_held()); 190 192 } 191 193 192 194 /* Same as rcu_assign_pointer ··· 1755 1753 1756 1754 static struct leaf *trie_firstleaf(struct trie *t) 1757 1755 { 1758 - struct tnode *n = (struct tnode *) rcu_dereference(t->trie); 1756 + struct tnode *n = (struct tnode *) rcu_dereference_check(t->trie, 1757 + rcu_read_lock_held() || 1758 + lockdep_rtnl_is_held()); 1759 1759 1760 1760 if (!n) 1761 1761 return NULL;
+6 -1
net/ipv4/route.c
··· 2738 2738 } 2739 2739 EXPORT_SYMBOL_GPL(__ip_route_output_key); 2740 2740 2741 + static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 cookie) 2742 + { 2743 + return NULL; 2744 + } 2745 + 2741 2746 static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 2742 2747 { 2743 2748 } ··· 2751 2746 .family = AF_INET, 2752 2747 .protocol = cpu_to_be16(ETH_P_IP), 2753 2748 .destroy = ipv4_dst_destroy, 2754 - .check = ipv4_dst_check, 2749 + .check = ipv4_blackhole_dst_check, 2755 2750 .update_pmtu = ipv4_rt_blackhole_update_pmtu, 2756 2751 .entries = ATOMIC_INIT(0), 2757 2752 };
+44
net/ipv4/udp.c
··· 1260 1260 } 1261 1261 EXPORT_SYMBOL(udp_lib_unhash); 1262 1262 1263 + /* 1264 + * inet_rcv_saddr was changed, we must rehash secondary hash 1265 + */ 1266 + void udp_lib_rehash(struct sock *sk, u16 newhash) 1267 + { 1268 + if (sk_hashed(sk)) { 1269 + struct udp_table *udptable = sk->sk_prot->h.udp_table; 1270 + struct udp_hslot *hslot, *hslot2, *nhslot2; 1271 + 1272 + hslot2 = udp_hashslot2(udptable, udp_sk(sk)->udp_portaddr_hash); 1273 + nhslot2 = udp_hashslot2(udptable, newhash); 1274 + udp_sk(sk)->udp_portaddr_hash = newhash; 1275 + if (hslot2 != nhslot2) { 1276 + hslot = udp_hashslot(udptable, sock_net(sk), 1277 + udp_sk(sk)->udp_port_hash); 1278 + /* we must lock primary chain too */ 1279 + spin_lock_bh(&hslot->lock); 1280 + 1281 + spin_lock(&hslot2->lock); 1282 + hlist_nulls_del_init_rcu(&udp_sk(sk)->udp_portaddr_node); 1283 + hslot2->count--; 1284 + spin_unlock(&hslot2->lock); 1285 + 1286 + spin_lock(&nhslot2->lock); 1287 + hlist_nulls_add_head_rcu(&udp_sk(sk)->udp_portaddr_node, 1288 + &nhslot2->head); 1289 + nhslot2->count++; 1290 + spin_unlock(&nhslot2->lock); 1291 + 1292 + spin_unlock_bh(&hslot->lock); 1293 + } 1294 + } 1295 + } 1296 + EXPORT_SYMBOL(udp_lib_rehash); 1297 + 1298 + static void udp_v4_rehash(struct sock *sk) 1299 + { 1300 + u16 new_hash = udp4_portaddr_hash(sock_net(sk), 1301 + inet_sk(sk)->inet_rcv_saddr, 1302 + inet_sk(sk)->inet_num); 1303 + udp_lib_rehash(sk, new_hash); 1304 + } 1305 + 1263 1306 static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) 1264 1307 { 1265 1308 int rc; ··· 1886 1843 .backlog_rcv = __udp_queue_rcv_skb, 1887 1844 .hash = udp_lib_hash, 1888 1845 .unhash = udp_lib_unhash, 1846 + .rehash = udp_v4_rehash, 1889 1847 .get_port = udp_v4_get_port, 1890 1848 .memory_allocated = &udp_memory_allocated, 1891 1849 .sysctl_mem = sysctl_udp_mem,
+6 -1
net/ipv6/datagram.c
··· 105 105 if (ipv6_addr_any(&np->saddr)) 106 106 ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); 107 107 108 - if (ipv6_addr_any(&np->rcv_saddr)) 108 + if (ipv6_addr_any(&np->rcv_saddr)) { 109 109 ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, 110 110 &np->rcv_saddr); 111 + if (sk->sk_prot->rehash) 112 + sk->sk_prot->rehash(sk); 113 + } 111 114 112 115 goto out; 113 116 } ··· 184 181 if (ipv6_addr_any(&np->rcv_saddr)) { 185 182 ipv6_addr_copy(&np->rcv_saddr, &fl.fl6_src); 186 183 inet->inet_rcv_saddr = LOOPBACK4_IPV6; 184 + if (sk->sk_prot->rehash) 185 + sk->sk_prot->rehash(sk); 187 186 } 188 187 189 188 ip6_dst_store(sk, dst,
+15 -65
net/ipv6/netfilter/nf_conntrack_reasm.c
··· 113 113 kfree_skb(NFCT_FRAG6_CB(skb)->orig); 114 114 } 115 115 116 - /* Memory Tracking Functions. */ 117 - static void frag_kfree_skb(struct sk_buff *skb) 118 - { 119 - atomic_sub(skb->truesize, &nf_init_frags.mem); 120 - nf_skb_free(skb); 121 - kfree_skb(skb); 122 - } 123 - 124 116 /* Destruction primitives. */ 125 117 126 118 static __inline__ void fq_put(struct nf_ct_frag6_queue *fq) ··· 274 282 } 275 283 276 284 found: 277 - /* We found where to put this one. Check for overlap with 278 - * preceding fragment, and, if needed, align things so that 279 - * any overlaps are eliminated. 285 + /* RFC5722, Section 4: 286 + * When reassembling an IPv6 datagram, if 287 + * one or more its constituent fragments is determined to be an 288 + * overlapping fragment, the entire datagram (and any constituent 289 + * fragments, including those not yet received) MUST be silently 290 + * discarded. 280 291 */ 281 - if (prev) { 282 - int i = (NFCT_FRAG6_CB(prev)->offset + prev->len) - offset; 283 292 284 - if (i > 0) { 285 - offset += i; 286 - if (end <= offset) { 287 - pr_debug("overlap\n"); 288 - goto err; 289 - } 290 - if (!pskb_pull(skb, i)) { 291 - pr_debug("Can't pull\n"); 292 - goto err; 293 - } 294 - if (skb->ip_summed != CHECKSUM_UNNECESSARY) 295 - skb->ip_summed = CHECKSUM_NONE; 296 - } 297 - } 293 + /* Check for overlap with preceding fragment. */ 294 + if (prev && 295 + (NFCT_FRAG6_CB(prev)->offset + prev->len) - offset > 0) 296 + goto discard_fq; 298 297 299 - /* Look for overlap with succeeding segments. 300 - * If we can merge fragments, do it. 301 - */ 302 - while (next && NFCT_FRAG6_CB(next)->offset < end) { 303 - /* overlap is 'i' bytes */ 304 - int i = end - NFCT_FRAG6_CB(next)->offset; 305 - 306 - if (i < next->len) { 307 - /* Eat head of the next overlapped fragment 308 - * and leave the loop. The next ones cannot overlap. 309 - */ 310 - pr_debug("Eat head of the overlapped parts.: %d", i); 311 - if (!pskb_pull(next, i)) 312 - goto err; 313 - 314 - /* next fragment */ 315 - NFCT_FRAG6_CB(next)->offset += i; 316 - fq->q.meat -= i; 317 - if (next->ip_summed != CHECKSUM_UNNECESSARY) 318 - next->ip_summed = CHECKSUM_NONE; 319 - break; 320 - } else { 321 - struct sk_buff *free_it = next; 322 - 323 - /* Old fragmnet is completely overridden with 324 - * new one drop it. 325 - */ 326 - next = next->next; 327 - 328 - if (prev) 329 - prev->next = next; 330 - else 331 - fq->q.fragments = next; 332 - 333 - fq->q.meat -= free_it->len; 334 - frag_kfree_skb(free_it); 335 - } 336 - } 298 + /* Look for overlap with succeeding segment. */ 299 + if (next && NFCT_FRAG6_CB(next)->offset < end) 300 + goto discard_fq; 337 301 338 302 NFCT_FRAG6_CB(skb)->offset = offset; 339 303 ··· 319 371 write_unlock(&nf_frags.lock); 320 372 return 0; 321 373 374 + discard_fq: 375 + fq_kill(fq); 322 376 err: 323 377 return -1; 324 378 }
+15 -56
net/ipv6/reassembly.c
··· 149 149 } 150 150 EXPORT_SYMBOL(ip6_frag_match); 151 151 152 - /* Memory Tracking Functions. */ 153 - static void frag_kfree_skb(struct netns_frags *nf, struct sk_buff *skb) 154 - { 155 - atomic_sub(skb->truesize, &nf->mem); 156 - kfree_skb(skb); 157 - } 158 - 159 152 void ip6_frag_init(struct inet_frag_queue *q, void *a) 160 153 { 161 154 struct frag_queue *fq = container_of(q, struct frag_queue, q); ··· 339 346 } 340 347 341 348 found: 342 - /* We found where to put this one. Check for overlap with 343 - * preceding fragment, and, if needed, align things so that 344 - * any overlaps are eliminated. 349 + /* RFC5722, Section 4: 350 + * When reassembling an IPv6 datagram, if 351 + * one or more its constituent fragments is determined to be an 352 + * overlapping fragment, the entire datagram (and any constituent 353 + * fragments, including those not yet received) MUST be silently 354 + * discarded. 345 355 */ 346 - if (prev) { 347 - int i = (FRAG6_CB(prev)->offset + prev->len) - offset; 348 356 349 - if (i > 0) { 350 - offset += i; 351 - if (end <= offset) 352 - goto err; 353 - if (!pskb_pull(skb, i)) 354 - goto err; 355 - if (skb->ip_summed != CHECKSUM_UNNECESSARY) 356 - skb->ip_summed = CHECKSUM_NONE; 357 - } 358 - } 357 + /* Check for overlap with preceding fragment. */ 358 + if (prev && 359 + (FRAG6_CB(prev)->offset + prev->len) - offset > 0) 360 + goto discard_fq; 359 361 360 - /* Look for overlap with succeeding segments. 361 - * If we can merge fragments, do it. 362 - */ 363 - while (next && FRAG6_CB(next)->offset < end) { 364 - int i = end - FRAG6_CB(next)->offset; /* overlap is 'i' bytes */ 365 - 366 - if (i < next->len) { 367 - /* Eat head of the next overlapped fragment 368 - * and leave the loop. The next ones cannot overlap. 369 - */ 370 - if (!pskb_pull(next, i)) 371 - goto err; 372 - FRAG6_CB(next)->offset += i; /* next fragment */ 373 - fq->q.meat -= i; 374 - if (next->ip_summed != CHECKSUM_UNNECESSARY) 375 - next->ip_summed = CHECKSUM_NONE; 376 - break; 377 - } else { 378 - struct sk_buff *free_it = next; 379 - 380 - /* Old fragment is completely overridden with 381 - * new one drop it. 382 - */ 383 - next = next->next; 384 - 385 - if (prev) 386 - prev->next = next; 387 - else 388 - fq->q.fragments = next; 389 - 390 - fq->q.meat -= free_it->len; 391 - frag_kfree_skb(fq->q.net, free_it); 392 - } 393 - } 362 + /* Look for overlap with succeeding segment. */ 363 + if (next && FRAG6_CB(next)->offset < end) 364 + goto discard_fq; 394 365 395 366 FRAG6_CB(skb)->offset = offset; 396 367 ··· 393 436 write_unlock(&ip6_frags.lock); 394 437 return -1; 395 438 439 + discard_fq: 440 + fq_kill(fq); 396 441 err: 397 442 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), 398 443 IPSTATS_MIB_REASMFAILS);
+10
net/ipv6/udp.c
··· 111 111 return udp_lib_get_port(sk, snum, ipv6_rcv_saddr_equal, hash2_nulladdr); 112 112 } 113 113 114 + static void udp_v6_rehash(struct sock *sk) 115 + { 116 + u16 new_hash = udp6_portaddr_hash(sock_net(sk), 117 + &inet6_sk(sk)->rcv_saddr, 118 + inet_sk(sk)->inet_num); 119 + 120 + udp_lib_rehash(sk, new_hash); 121 + } 122 + 114 123 static inline int compute_score(struct sock *sk, struct net *net, 115 124 unsigned short hnum, 116 125 struct in6_addr *saddr, __be16 sport, ··· 1456 1447 .backlog_rcv = udpv6_queue_rcv_skb, 1457 1448 .hash = udp_lib_hash, 1458 1449 .unhash = udp_lib_unhash, 1450 + .rehash = udp_v6_rehash, 1459 1451 .get_port = udp_v6_get_port, 1460 1452 .memory_allocated = &udp_memory_allocated, 1461 1453 .sysctl_mem = sysctl_udp_mem,
+1 -1
net/irda/irlan/irlan_common.c
··· 1102 1102 memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */ 1103 1103 le16_to_cpus(&val_len); n+=2; 1104 1104 1105 - if (val_len > 1016) { 1105 + if (val_len >= 1016) { 1106 1106 IRDA_DEBUG(2, "%s(), parameter length to long\n", __func__ ); 1107 1107 return -RSP_INVALID_COMMAND_FORMAT; 1108 1108 }
+1
net/netfilter/ipvs/ip_vs_core.c
··· 924 924 925 925 ip_vs_out_stats(cp, skb); 926 926 ip_vs_set_state(cp, IP_VS_DIR_OUTPUT, skb, pp); 927 + ip_vs_update_conntrack(skb, cp, 0); 927 928 ip_vs_conn_put(cp); 928 929 929 930 skb->ipvs_property = 1;
-6
net/netfilter/ipvs/ip_vs_ftp.c
··· 410 410 union nf_inet_addr to; 411 411 __be16 port; 412 412 struct ip_vs_conn *n_cp; 413 - struct nf_conn *ct; 414 413 415 414 #ifdef CONFIG_IP_VS_IPV6 416 415 /* This application helper doesn't work with IPv6 yet, ··· 495 496 /* add its controller */ 496 497 ip_vs_control_add(n_cp, cp); 497 498 } 498 - 499 - ct = (struct nf_conn *)skb->nfct; 500 - if (ct && ct != &nf_conntrack_untracked) 501 - ip_vs_expect_related(skb, ct, n_cp, 502 - IPPROTO_TCP, &n_cp->dport, 1); 503 499 504 500 /* 505 501 * Move tunnel to listen state
+12 -6
net/netfilter/ipvs/ip_vs_xmit.c
··· 349 349 } 350 350 #endif 351 351 352 - static void 353 - ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp) 352 + void 353 + ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, int outin) 354 354 { 355 355 struct nf_conn *ct = (struct nf_conn *)skb->nfct; 356 356 struct nf_conntrack_tuple new_tuple; ··· 365 365 * real-server we will see RIP->DIP. 366 366 */ 367 367 new_tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; 368 - new_tuple.src.u3 = cp->daddr; 368 + if (outin) 369 + new_tuple.src.u3 = cp->daddr; 370 + else 371 + new_tuple.dst.u3 = cp->vaddr; 369 372 /* 370 373 * This will also take care of UDP and other protocols. 371 374 */ 372 - new_tuple.src.u.tcp.port = cp->dport; 375 + if (outin) 376 + new_tuple.src.u.tcp.port = cp->dport; 377 + else 378 + new_tuple.dst.u.tcp.port = cp->vport; 373 379 nf_conntrack_alter_reply(ct, &new_tuple); 374 380 } 375 381 ··· 434 428 435 429 IP_VS_DBG_PKT(10, pp, skb, 0, "After DNAT"); 436 430 437 - ip_vs_update_conntrack(skb, cp); 431 + ip_vs_update_conntrack(skb, cp, 1); 438 432 439 433 /* FIXME: when application helper enlarges the packet and the length 440 434 is larger than the MTU of outgoing device, there will be still ··· 512 506 513 507 IP_VS_DBG_PKT(10, pp, skb, 0, "After DNAT"); 514 508 515 - ip_vs_update_conntrack(skb, cp); 509 + ip_vs_update_conntrack(skb, cp, 1); 516 510 517 511 /* FIXME: when application helper enlarges the packet and the length 518 512 is larger than the MTU of outgoing device, there will be still
+23 -23
net/sctp/sm_statefuns.c
··· 1232 1232 return 0; 1233 1233 } 1234 1234 1235 + static bool list_has_sctp_addr(const struct list_head *list, 1236 + union sctp_addr *ipaddr) 1237 + { 1238 + struct sctp_transport *addr; 1239 + 1240 + list_for_each_entry(addr, list, transports) { 1241 + if (sctp_cmp_addr_exact(ipaddr, &addr->ipaddr)) 1242 + return true; 1243 + } 1244 + 1245 + return false; 1246 + } 1235 1247 /* A restart is occurring, check to make sure no new addresses 1236 1248 * are being added as we may be under a takeover attack. 1237 1249 */ ··· 1252 1240 struct sctp_chunk *init, 1253 1241 sctp_cmd_seq_t *commands) 1254 1242 { 1255 - struct sctp_transport *new_addr, *addr; 1256 - int found; 1243 + struct sctp_transport *new_addr; 1244 + int ret = 1; 1257 1245 1258 - /* Implementor's Guide - Sectin 5.2.2 1246 + /* Implementor's Guide - Section 5.2.2 1259 1247 * ... 1260 1248 * Before responding the endpoint MUST check to see if the 1261 1249 * unexpected INIT adds new addresses to the association. If new ··· 1266 1254 /* Search through all current addresses and make sure 1267 1255 * we aren't adding any new ones. 1268 1256 */ 1269 - new_addr = NULL; 1270 - found = 0; 1271 - 1272 1257 list_for_each_entry(new_addr, &new_asoc->peer.transport_addr_list, 1273 - transports) { 1274 - found = 0; 1275 - list_for_each_entry(addr, &asoc->peer.transport_addr_list, 1276 - transports) { 1277 - if (sctp_cmp_addr_exact(&new_addr->ipaddr, 1278 - &addr->ipaddr)) { 1279 - found = 1; 1280 - break; 1281 - } 1282 - } 1283 - if (!found) 1258 + transports) { 1259 + if (!list_has_sctp_addr(&asoc->peer.transport_addr_list, 1260 + &new_addr->ipaddr)) { 1261 + sctp_sf_send_restart_abort(&new_addr->ipaddr, init, 1262 + commands); 1263 + ret = 0; 1284 1264 break; 1285 - } 1286 - 1287 - /* If a new address was added, ABORT the sender. */ 1288 - if (!found && new_addr) { 1289 - sctp_sf_send_restart_abort(&new_addr->ipaddr, init, commands); 1265 + } 1290 1266 } 1291 1267 1292 1268 /* Return success if all addresses were found. */ 1293 - return found; 1269 + return ret; 1294 1270 } 1295 1271 1296 1272 /* Populate the verification/tie tags based on overlapping INIT
+12 -3
net/unix/af_unix.c
··· 692 692 static u32 ordernum = 1; 693 693 struct unix_address *addr; 694 694 int err; 695 + unsigned int retries = 0; 695 696 696 697 mutex_lock(&u->readlock); 697 698 ··· 718 717 if (__unix_find_socket_byname(net, addr->name, addr->len, sock->type, 719 718 addr->hash)) { 720 719 spin_unlock(&unix_table_lock); 721 - /* Sanity yield. It is unusual case, but yet... */ 722 - if (!(ordernum&0xFF)) 723 - yield(); 720 + /* 721 + * __unix_find_socket_byname() may take long time if many names 722 + * are already in use. 723 + */ 724 + cond_resched(); 725 + /* Give up if all names seems to be in use. */ 726 + if (retries++ == 0xFFFFF) { 727 + err = -ENOSPC; 728 + kfree(addr); 729 + goto out; 730 + } 724 731 goto retry; 725 732 } 726 733 addr->hash ^= sk->sk_type;