aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-04 16:16:49 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-04 16:16:49 -0500
commit6d04e3b04b6ab569cabeb5ca28ad1be11777e895 (patch)
treeaaee636d71492f36fdef9977488c85a64063f8c4
parent42270035c6550101f7dc742a630c2590dd2d3ae0 (diff)
parent5c15bdec5c38f4ccf73ef2585fc80a6164de9554 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [VLAN]: Avoid a 4-order allocation. [HDLC] Fix dev->header_cache_update having a random value. [NetLabel]: Verify sensitivity level has a valid CIPSO mapping [PPPOE]: Key connections properly on local device. [AF_UNIX]: Test against sk_max_ack_backlog properly. [NET]: Fix bugs in "Whether sock accept queue is full" checking
-rw-r--r--drivers/net/8139cp.c3
-rw-r--r--drivers/net/acenic.c5
-rw-r--r--drivers/net/amd8111e.c3
-rw-r--r--drivers/net/atl1/atl1_main.c5
-rw-r--r--drivers/net/bnx2.c4
-rw-r--r--drivers/net/bonding/bond_main.c14
-rw-r--r--drivers/net/chelsio/cxgb2.c3
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c6
-rw-r--r--drivers/net/e1000/e1000_main.c13
-rw-r--r--drivers/net/ehea/ehea_main.c3
-rw-r--r--drivers/net/gianfar.c3
-rw-r--r--drivers/net/ixgb/ixgb_main.c5
-rw-r--r--drivers/net/ns83820.c3
-rw-r--r--drivers/net/pppoe.c52
-rw-r--r--drivers/net/r8169.c3
-rw-r--r--drivers/net/s2io.c3
-rw-r--r--drivers/net/sky2.c3
-rw-r--r--drivers/net/starfire.c5
-rw-r--r--drivers/net/tg3.c3
-rw-r--r--drivers/net/typhoon.c3
-rw-r--r--drivers/net/wan/hdlc.c33
-rw-r--r--drivers/net/wan/hdlc_cisco.c3
-rw-r--r--drivers/net/wan/hdlc_fr.c3
-rw-r--r--drivers/net/wan/hdlc_ppp.c2
-rw-r--r--drivers/net/wan/hdlc_raw.c3
-rw-r--r--drivers/net/wan/hdlc_x25.c2
-rw-r--r--drivers/s390/net/qeth_main.c25
-rw-r--r--include/linux/if_vlan.h25
-rw-r--r--include/net/sock.h2
-rw-r--r--net/8021q/vlan.c42
-rw-r--r--net/ipv4/cipso_ipv4.c7
-rw-r--r--net/unix/af_unix.c6
32 files changed, 165 insertions, 130 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 6f93a765e564..12c8453f44bc 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -448,8 +448,7 @@ static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
448 spin_lock_irqsave(&cp->lock, flags); 448 spin_lock_irqsave(&cp->lock, flags);
449 cp->cpcmd &= ~RxVlanOn; 449 cp->cpcmd &= ~RxVlanOn;
450 cpw16(CpCmd, cp->cpcmd); 450 cpw16(CpCmd, cp->cpcmd);
451 if (cp->vlgrp) 451 vlan_group_set_device(cp->vlgrp, vid, NULL);
452 cp->vlgrp->vlan_devices[vid] = NULL;
453 spin_unlock_irqrestore(&cp->lock, flags); 452 spin_unlock_irqrestore(&cp->lock, flags);
454} 453}
455#endif /* CP_VLAN_TAG_USED */ 454#endif /* CP_VLAN_TAG_USED */
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 33c6645455ae..7138e0e025bc 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2293,10 +2293,7 @@ static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2293 2293
2294 local_irq_save(flags); 2294 local_irq_save(flags);
2295 ace_mask_irq(dev); 2295 ace_mask_irq(dev);
2296 2296 vlan_group_set_device(ap->vlgrp, vid, NULL);
2297 if (ap->vlgrp)
2298 ap->vlgrp->vlan_devices[vid] = NULL;
2299
2300 ace_unmask_irq(dev); 2297 ace_unmask_irq(dev);
2301 local_irq_restore(flags); 2298 local_irq_restore(flags);
2302} 2299}
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 9c399aaefbdd..962c954c2d56 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1737,8 +1737,7 @@ static void amd8111e_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid
1737{ 1737{
1738 struct amd8111e_priv *lp = netdev_priv(dev); 1738 struct amd8111e_priv *lp = netdev_priv(dev);
1739 spin_lock_irq(&lp->lock); 1739 spin_lock_irq(&lp->lock);
1740 if (lp->vlgrp) 1740 vlan_group_set_device(lp->vlgrp, vid, NULL);
1741 lp->vlgrp->vlan_devices[vid] = NULL;
1742 spin_unlock_irq(&lp->lock); 1741 spin_unlock_irq(&lp->lock);
1743} 1742}
1744#endif 1743#endif
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 65673485bb6b..88d4f70035bb 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1252,8 +1252,7 @@ static void atl1_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1252 1252
1253 spin_lock_irqsave(&adapter->lock, flags); 1253 spin_lock_irqsave(&adapter->lock, flags);
1254 /* atl1_irq_disable(adapter); */ 1254 /* atl1_irq_disable(adapter); */
1255 if (adapter->vlgrp) 1255 vlan_group_set_device(adapter->vlgrp, vid, NULL);
1256 adapter->vlgrp->vlan_devices[vid] = NULL;
1257 /* atl1_irq_enable(adapter); */ 1256 /* atl1_irq_enable(adapter); */
1258 spin_unlock_irqrestore(&adapter->lock, flags); 1257 spin_unlock_irqrestore(&adapter->lock, flags);
1259 /* We don't do Vlan filtering */ 1258 /* We don't do Vlan filtering */
@@ -1266,7 +1265,7 @@ static void atl1_restore_vlan(struct atl1_adapter *adapter)
1266 if (adapter->vlgrp) { 1265 if (adapter->vlgrp) {
1267 u16 vid; 1266 u16 vid;
1268 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { 1267 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
1269 if (!adapter->vlgrp->vlan_devices[vid]) 1268 if (!vlan_group_get_device(adapter->vlgrp, vid))
1270 continue; 1269 continue;
1271 atl1_vlan_rx_add_vid(adapter->netdev, vid); 1270 atl1_vlan_rx_add_vid(adapter->netdev, vid);
1272 } 1271 }
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 5a96d7611af1..c12e5ea61819 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4467,9 +4467,7 @@ bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
4467 struct bnx2 *bp = netdev_priv(dev); 4467 struct bnx2 *bp = netdev_priv(dev);
4468 4468
4469 bnx2_netif_stop(bp); 4469 bnx2_netif_stop(bp);
4470 4470 vlan_group_set_device(bp->vlgrp, vid, NULL);
4471 if (bp->vlgrp)
4472 bp->vlgrp->vlan_devices[vid] = NULL;
4473 bnx2_set_rx_mode(dev); 4471 bnx2_set_rx_mode(dev);
4474 4472
4475 bnx2_netif_start(bp); 4473 bnx2_netif_start(bp);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index a7c8f98a890c..ea73ebff4387 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -488,9 +488,9 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid)
488 /* Save and then restore vlan_dev in the grp array, 488 /* Save and then restore vlan_dev in the grp array,
489 * since the slave's driver might clear it. 489 * since the slave's driver might clear it.
490 */ 490 */
491 vlan_dev = bond->vlgrp->vlan_devices[vid]; 491 vlan_dev = vlan_group_get_device(bond->vlgrp, vid);
492 slave_dev->vlan_rx_kill_vid(slave_dev, vid); 492 slave_dev->vlan_rx_kill_vid(slave_dev, vid);
493 bond->vlgrp->vlan_devices[vid] = vlan_dev; 493 vlan_group_set_device(bond->vlgrp, vid, vlan_dev);
494 } 494 }
495 } 495 }
496 496
@@ -550,9 +550,9 @@ static void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *s
550 /* Save and then restore vlan_dev in the grp array, 550 /* Save and then restore vlan_dev in the grp array,
551 * since the slave's driver might clear it. 551 * since the slave's driver might clear it.
552 */ 552 */
553 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 553 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
554 slave_dev->vlan_rx_kill_vid(slave_dev, vlan->vlan_id); 554 slave_dev->vlan_rx_kill_vid(slave_dev, vlan->vlan_id);
555 bond->vlgrp->vlan_devices[vlan->vlan_id] = vlan_dev; 555 vlan_group_set_device(bond->vlgrp, vlan->vlan_id, vlan_dev);
556 } 556 }
557 557
558unreg: 558unreg:
@@ -2397,7 +2397,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2397 vlan_id = 0; 2397 vlan_id = 0;
2398 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list, 2398 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
2399 vlan_list) { 2399 vlan_list) {
2400 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 2400 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
2401 if (vlan_dev == rt->u.dst.dev) { 2401 if (vlan_dev == rt->u.dst.dev) {
2402 vlan_id = vlan->vlan_id; 2402 vlan_id = vlan->vlan_id;
2403 dprintk("basa: vlan match on %s %d\n", 2403 dprintk("basa: vlan match on %s %d\n",
@@ -2444,7 +2444,7 @@ static void bond_send_gratuitous_arp(struct bonding *bond)
2444 } 2444 }
2445 2445
2446 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 2446 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
2447 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 2447 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
2448 if (vlan->vlan_ip) { 2448 if (vlan->vlan_ip) {
2449 bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip, 2449 bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
2450 vlan->vlan_ip, vlan->vlan_id); 2450 vlan->vlan_ip, vlan->vlan_id);
@@ -3371,7 +3371,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
3371 3371
3372 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list, 3372 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
3373 vlan_list) { 3373 vlan_list) {
3374 vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id]; 3374 vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
3375 if (vlan_dev == event_dev) { 3375 if (vlan_dev == event_dev) {
3376 switch (event) { 3376 switch (event) {
3377 case NETDEV_UP: 3377 case NETDEV_UP:
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 7d0f24f69777..125c9b105869 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -889,8 +889,7 @@ static void vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
889 struct adapter *adapter = dev->priv; 889 struct adapter *adapter = dev->priv;
890 890
891 spin_lock_irq(&adapter->async_lock); 891 spin_lock_irq(&adapter->async_lock);
892 if (adapter->vlan_grp) 892 vlan_group_set_device(adapter->vlan_grp, vid, NULL);
893 adapter->vlan_grp->vlan_devices[vid] = NULL;
894 spin_unlock_irq(&adapter->async_lock); 893 spin_unlock_irq(&adapter->async_lock);
895} 894}
896#endif 895#endif
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index b2cf5f6feb4a..f6ed033efb56 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -160,14 +160,16 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter,
160 int i; 160 int i;
161 161
162 for_each_port(adapter, i) { 162 for_each_port(adapter, i) {
163 const struct vlan_group *grp; 163 struct vlan_group *grp;
164 struct net_device *dev = adapter->port[i]; 164 struct net_device *dev = adapter->port[i];
165 const struct port_info *p = netdev_priv(dev); 165 const struct port_info *p = netdev_priv(dev);
166 166
167 if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) { 167 if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) {
168 if (vlan && vlan != VLAN_VID_MASK) { 168 if (vlan && vlan != VLAN_VID_MASK) {
169 grp = p->vlan_grp; 169 grp = p->vlan_grp;
170 dev = grp ? grp->vlan_devices[vlan] : NULL; 170 dev = NULL;
171 if (grp)
172 dev = vlan_group_get_device(grp, vlan);
171 } else 173 } else
172 while (dev->master) 174 while (dev->master)
173 dev = dev->master; 175 dev = dev->master;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 98215fdd7d10..1d08e937af82 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -376,7 +376,7 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter)
376 uint16_t vid = adapter->hw.mng_cookie.vlan_id; 376 uint16_t vid = adapter->hw.mng_cookie.vlan_id;
377 uint16_t old_vid = adapter->mng_vlan_id; 377 uint16_t old_vid = adapter->mng_vlan_id;
378 if (adapter->vlgrp) { 378 if (adapter->vlgrp) {
379 if (!adapter->vlgrp->vlan_devices[vid]) { 379 if (!vlan_group_get_device(adapter->vlgrp, vid)) {
380 if (adapter->hw.mng_cookie.status & 380 if (adapter->hw.mng_cookie.status &
381 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) { 381 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
382 e1000_vlan_rx_add_vid(netdev, vid); 382 e1000_vlan_rx_add_vid(netdev, vid);
@@ -386,7 +386,7 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter)
386 386
387 if ((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) && 387 if ((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) &&
388 (vid != old_vid) && 388 (vid != old_vid) &&
389 !adapter->vlgrp->vlan_devices[old_vid]) 389 !vlan_group_get_device(adapter->vlgrp, old_vid))
390 e1000_vlan_rx_kill_vid(netdev, old_vid); 390 e1000_vlan_rx_kill_vid(netdev, old_vid);
391 } else 391 } else
392 adapter->mng_vlan_id = vid; 392 adapter->mng_vlan_id = vid;
@@ -1482,7 +1482,7 @@ e1000_close(struct net_device *netdev)
1482 if ((adapter->hw.mng_cookie.status & 1482 if ((adapter->hw.mng_cookie.status &
1483 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && 1483 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
1484 !(adapter->vlgrp && 1484 !(adapter->vlgrp &&
1485 adapter->vlgrp->vlan_devices[adapter->mng_vlan_id])) { 1485 vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) {
1486 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 1486 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
1487 } 1487 }
1488 1488
@@ -4998,10 +4998,7 @@ e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
4998 uint32_t vfta, index; 4998 uint32_t vfta, index;
4999 4999
5000 e1000_irq_disable(adapter); 5000 e1000_irq_disable(adapter);
5001 5001 vlan_group_set_device(adapter->vlgrp, vid, NULL);
5002 if (adapter->vlgrp)
5003 adapter->vlgrp->vlan_devices[vid] = NULL;
5004
5005 e1000_irq_enable(adapter); 5002 e1000_irq_enable(adapter);
5006 5003
5007 if ((adapter->hw.mng_cookie.status & 5004 if ((adapter->hw.mng_cookie.status &
@@ -5027,7 +5024,7 @@ e1000_restore_vlan(struct e1000_adapter *adapter)
5027 if (adapter->vlgrp) { 5024 if (adapter->vlgrp) {
5028 uint16_t vid; 5025 uint16_t vid;
5029 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { 5026 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
5030 if (!adapter->vlgrp->vlan_devices[vid]) 5027 if (!vlan_group_get_device(adapter->vlgrp, vid))
5031 continue; 5028 continue;
5032 e1000_vlan_rx_add_vid(adapter->netdev, vid); 5029 e1000_vlan_rx_add_vid(adapter->netdev, vid);
5033 } 5030 }
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 88ad1c8bcee4..0e4042bc0a48 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -1939,8 +1939,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1939 int index; 1939 int index;
1940 u64 hret; 1940 u64 hret;
1941 1941
1942 if (port->vgrp) 1942 vlan_group_set_device(port->vgrp, vid, NULL);
1943 port->vgrp->vlan_devices[vid] = NULL;
1944 1943
1945 cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); 1944 cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
1946 if (!cb1) { 1945 if (!cb1) {
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 1f83988a6a64..02b61b85b62c 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1132,8 +1132,7 @@ static void gfar_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
1132 1132
1133 spin_lock_irqsave(&priv->rxlock, flags); 1133 spin_lock_irqsave(&priv->rxlock, flags);
1134 1134
1135 if (priv->vlgrp) 1135 vlan_group_set_device(priv->vgrp, vid, NULL);
1136 priv->vlgrp->vlan_devices[vid] = NULL;
1137 1136
1138 spin_unlock_irqrestore(&priv->rxlock, flags); 1137 spin_unlock_irqrestore(&priv->rxlock, flags);
1139} 1138}
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 0c3682889344..afc2ec72529e 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -2213,8 +2213,7 @@ ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
2213 2213
2214 ixgb_irq_disable(adapter); 2214 ixgb_irq_disable(adapter);
2215 2215
2216 if(adapter->vlgrp) 2216 vlan_group_set_device(adapter->vlgrp, vid, NULL);
2217 adapter->vlgrp->vlan_devices[vid] = NULL;
2218 2217
2219 ixgb_irq_enable(adapter); 2218 ixgb_irq_enable(adapter);
2220 2219
@@ -2234,7 +2233,7 @@ ixgb_restore_vlan(struct ixgb_adapter *adapter)
2234 if(adapter->vlgrp) { 2233 if(adapter->vlgrp) {
2235 uint16_t vid; 2234 uint16_t vid;
2236 for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { 2235 for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
2237 if(!adapter->vlgrp->vlan_devices[vid]) 2236 if(!vlan_group_get_device(adapter->vlgrp, vid))
2238 continue; 2237 continue;
2239 ixgb_vlan_rx_add_vid(adapter->netdev, vid); 2238 ixgb_vlan_rx_add_vid(adapter->netdev, vid);
2240 } 2239 }
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 568daeb3e9d8..9ec6e9e54f47 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -514,8 +514,7 @@ static void ns83820_vlan_rx_kill_vid(struct net_device *ndev, unsigned short vid
514 514
515 spin_lock_irq(&dev->misc_lock); 515 spin_lock_irq(&dev->misc_lock);
516 spin_lock(&dev->tx_lock); 516 spin_lock(&dev->tx_lock);
517 if (dev->vlgrp) 517 vlan_group_set_device(dev->vlgrp, vid, NULL);
518 dev->vlgrp->vlan_devices[vid] = NULL;
519 spin_unlock(&dev->tx_lock); 518 spin_unlock(&dev->tx_lock);
520 spin_unlock_irq(&dev->misc_lock); 519 spin_unlock_irq(&dev->misc_lock);
521} 520}
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 860bb0f60f68..86e56f1f2f0b 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -7,6 +7,12 @@
7 * 7 *
8 * Version: 0.7.0 8 * Version: 0.7.0
9 * 9 *
10 * 070228 : Fix to allow multiple sessions with same remote MAC and same
11 * session id by including the local device ifindex in the
12 * tuple identifying a session. This also ensures packets can't
13 * be injected into a session from interfaces other than the one
14 * specified by userspace. Florian Zumbiehl <florz@florz.de>
15 * (Oh, BTW, this one is YYMMDD, in case you were wondering ...)
10 * 220102 : Fix module use count on failure in pppoe_create, pppox_sk -acme 16 * 220102 : Fix module use count on failure in pppoe_create, pppox_sk -acme
11 * 030700 : Fixed connect logic to allow for disconnect. 17 * 030700 : Fixed connect logic to allow for disconnect.
12 * 270700 : Fixed potential SMP problems; we must protect against 18 * 270700 : Fixed potential SMP problems; we must protect against
@@ -127,14 +133,14 @@ static struct pppox_sock *item_hash_table[PPPOE_HASH_SIZE];
127 * Set/get/delete/rehash items (internal versions) 133 * Set/get/delete/rehash items (internal versions)
128 * 134 *
129 **********************************************************************/ 135 **********************************************************************/
130static struct pppox_sock *__get_item(unsigned long sid, unsigned char *addr) 136static struct pppox_sock *__get_item(unsigned long sid, unsigned char *addr, int ifindex)
131{ 137{
132 int hash = hash_item(sid, addr); 138 int hash = hash_item(sid, addr);
133 struct pppox_sock *ret; 139 struct pppox_sock *ret;
134 140
135 ret = item_hash_table[hash]; 141 ret = item_hash_table[hash];
136 142
137 while (ret && !cmp_addr(&ret->pppoe_pa, sid, addr)) 143 while (ret && !(cmp_addr(&ret->pppoe_pa, sid, addr) && ret->pppoe_dev->ifindex == ifindex))
138 ret = ret->next; 144 ret = ret->next;
139 145
140 return ret; 146 return ret;
@@ -147,21 +153,19 @@ static int __set_item(struct pppox_sock *po)
147 153
148 ret = item_hash_table[hash]; 154 ret = item_hash_table[hash];
149 while (ret) { 155 while (ret) {
150 if (cmp_2_addr(&ret->pppoe_pa, &po->pppoe_pa)) 156 if (cmp_2_addr(&ret->pppoe_pa, &po->pppoe_pa) && ret->pppoe_dev->ifindex == po->pppoe_dev->ifindex)
151 return -EALREADY; 157 return -EALREADY;
152 158
153 ret = ret->next; 159 ret = ret->next;
154 } 160 }
155 161
156 if (!ret) { 162 po->next = item_hash_table[hash];
157 po->next = item_hash_table[hash]; 163 item_hash_table[hash] = po;
158 item_hash_table[hash] = po;
159 }
160 164
161 return 0; 165 return 0;
162} 166}
163 167
164static struct pppox_sock *__delete_item(unsigned long sid, char *addr) 168static struct pppox_sock *__delete_item(unsigned long sid, char *addr, int ifindex)
165{ 169{
166 int hash = hash_item(sid, addr); 170 int hash = hash_item(sid, addr);
167 struct pppox_sock *ret, **src; 171 struct pppox_sock *ret, **src;
@@ -170,7 +174,7 @@ static struct pppox_sock *__delete_item(unsigned long sid, char *addr)
170 src = &item_hash_table[hash]; 174 src = &item_hash_table[hash];
171 175
172 while (ret) { 176 while (ret) {
173 if (cmp_addr(&ret->pppoe_pa, sid, addr)) { 177 if (cmp_addr(&ret->pppoe_pa, sid, addr) && ret->pppoe_dev->ifindex == ifindex) {
174 *src = ret->next; 178 *src = ret->next;
175 break; 179 break;
176 } 180 }
@@ -188,12 +192,12 @@ static struct pppox_sock *__delete_item(unsigned long sid, char *addr)
188 * 192 *
189 **********************************************************************/ 193 **********************************************************************/
190static inline struct pppox_sock *get_item(unsigned long sid, 194static inline struct pppox_sock *get_item(unsigned long sid,
191 unsigned char *addr) 195 unsigned char *addr, int ifindex)
192{ 196{
193 struct pppox_sock *po; 197 struct pppox_sock *po;
194 198
195 read_lock_bh(&pppoe_hash_lock); 199 read_lock_bh(&pppoe_hash_lock);
196 po = __get_item(sid, addr); 200 po = __get_item(sid, addr, ifindex);
197 if (po) 201 if (po)
198 sock_hold(sk_pppox(po)); 202 sock_hold(sk_pppox(po));
199 read_unlock_bh(&pppoe_hash_lock); 203 read_unlock_bh(&pppoe_hash_lock);
@@ -203,7 +207,15 @@ static inline struct pppox_sock *get_item(unsigned long sid,
203 207
204static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp) 208static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp)
205{ 209{
206 return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote); 210 struct net_device *dev = NULL;
211 int ifindex;
212
213 dev = dev_get_by_name(sp->sa_addr.pppoe.dev);
214 if(!dev)
215 return NULL;
216 ifindex = dev->ifindex;
217 dev_put(dev);
218 return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex);
207} 219}
208 220
209static inline int set_item(struct pppox_sock *po) 221static inline int set_item(struct pppox_sock *po)
@@ -220,12 +232,12 @@ static inline int set_item(struct pppox_sock *po)
220 return i; 232 return i;
221} 233}
222 234
223static inline struct pppox_sock *delete_item(unsigned long sid, char *addr) 235static inline struct pppox_sock *delete_item(unsigned long sid, char *addr, int ifindex)
224{ 236{
225 struct pppox_sock *ret; 237 struct pppox_sock *ret;
226 238
227 write_lock_bh(&pppoe_hash_lock); 239 write_lock_bh(&pppoe_hash_lock);
228 ret = __delete_item(sid, addr); 240 ret = __delete_item(sid, addr, ifindex);
229 write_unlock_bh(&pppoe_hash_lock); 241 write_unlock_bh(&pppoe_hash_lock);
230 242
231 return ret; 243 return ret;
@@ -391,7 +403,7 @@ static int pppoe_rcv(struct sk_buff *skb,
391 403
392 ph = (struct pppoe_hdr *) skb->nh.raw; 404 ph = (struct pppoe_hdr *) skb->nh.raw;
393 405
394 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source); 406 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
395 if (po != NULL) 407 if (po != NULL)
396 return sk_receive_skb(sk_pppox(po), skb, 0); 408 return sk_receive_skb(sk_pppox(po), skb, 0);
397drop: 409drop:
@@ -425,7 +437,7 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
425 if (ph->code != PADT_CODE) 437 if (ph->code != PADT_CODE)
426 goto abort; 438 goto abort;
427 439
428 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source); 440 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
429 if (po) { 441 if (po) {
430 struct sock *sk = sk_pppox(po); 442 struct sock *sk = sk_pppox(po);
431 443
@@ -517,7 +529,7 @@ static int pppoe_release(struct socket *sock)
517 529
518 po = pppox_sk(sk); 530 po = pppox_sk(sk);
519 if (po->pppoe_pa.sid) { 531 if (po->pppoe_pa.sid) {
520 delete_item(po->pppoe_pa.sid, po->pppoe_pa.remote); 532 delete_item(po->pppoe_pa.sid, po->pppoe_pa.remote, po->pppoe_dev->ifindex);
521 } 533 }
522 534
523 if (po->pppoe_dev) 535 if (po->pppoe_dev)
@@ -539,7 +551,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
539 int sockaddr_len, int flags) 551 int sockaddr_len, int flags)
540{ 552{
541 struct sock *sk = sock->sk; 553 struct sock *sk = sock->sk;
542 struct net_device *dev = NULL; 554 struct net_device *dev;
543 struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr; 555 struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr;
544 struct pppox_sock *po = pppox_sk(sk); 556 struct pppox_sock *po = pppox_sk(sk);
545 int error; 557 int error;
@@ -565,7 +577,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
565 pppox_unbind_sock(sk); 577 pppox_unbind_sock(sk);
566 578
567 /* Delete the old binding */ 579 /* Delete the old binding */
568 delete_item(po->pppoe_pa.sid,po->pppoe_pa.remote); 580 delete_item(po->pppoe_pa.sid,po->pppoe_pa.remote,po->pppoe_dev->ifindex);
569 581
570 if(po->pppoe_dev) 582 if(po->pppoe_dev)
571 dev_put(po->pppoe_dev); 583 dev_put(po->pppoe_dev);
@@ -705,7 +717,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
705 break; 717 break;
706 718
707 /* PPPoE address from the user specifies an outbound 719 /* PPPoE address from the user specifies an outbound
708 PPPoE address to which frames are forwarded to */ 720 PPPoE address which frames are forwarded to */
709 err = -EFAULT; 721 err = -EFAULT;
710 if (copy_from_user(&po->pppoe_relay, 722 if (copy_from_user(&po->pppoe_relay,
711 (void __user *)arg, 723 (void __user *)arg,
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 13cf06ee97f7..15d954e50cae 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -890,8 +890,7 @@ static void rtl8169_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
890 unsigned long flags; 890 unsigned long flags;
891 891
892 spin_lock_irqsave(&tp->lock, flags); 892 spin_lock_irqsave(&tp->lock, flags);
893 if (tp->vlgrp) 893 vlan_group_set_device(tp->vlgrp, vid, NULL);
894 tp->vlgrp->vlan_devices[vid] = NULL;
895 spin_unlock_irqrestore(&tp->lock, flags); 894 spin_unlock_irqrestore(&tp->lock, flags);
896} 895}
897 896
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 44bb2395af84..46ebf141ee5a 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -325,8 +325,7 @@ static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
325 unsigned long flags; 325 unsigned long flags;
326 326
327 spin_lock_irqsave(&nic->tx_lock, flags); 327 spin_lock_irqsave(&nic->tx_lock, flags);
328 if (nic->vlgrp) 328 vlan_group_set_device(nic->vlgrp, vid, NULL);
329 nic->vlgrp->vlan_devices[vid] = NULL;
330 spin_unlock_irqrestore(&nic->tx_lock, flags); 329 spin_unlock_irqrestore(&nic->tx_lock, flags);
331} 330}
332 331
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 52edbd7ac17e..53839979cfb8 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1053,8 +1053,7 @@ static void sky2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1053 1053
1054 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF); 1054 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF);
1055 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF); 1055 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
1056 if (sky2->vlgrp) 1056 vlan_group_set_device(sky2->vlgrp, vid, NULL);
1057 sky2->vlgrp->vlan_devices[vid] = NULL;
1058 1057
1059 netif_tx_unlock_bh(dev); 1058 netif_tx_unlock_bh(dev);
1060} 1059}
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index bf873ea25797..8bba2e3da7e1 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -677,8 +677,7 @@ static void netdev_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
677 spin_lock(&np->lock); 677 spin_lock(&np->lock);
678 if (debug > 1) 678 if (debug > 1)
679 printk("%s: removing vlanid %d from vlan filter\n", dev->name, vid); 679 printk("%s: removing vlanid %d from vlan filter\n", dev->name, vid);
680 if (np->vlgrp) 680 vlan_group_set_device(np->vlgrp, vid, NULL);
681 np->vlgrp->vlan_devices[vid] = NULL;
682 set_rx_mode(dev); 681 set_rx_mode(dev);
683 spin_unlock(&np->lock); 682 spin_unlock(&np->lock);
684} 683}
@@ -1738,7 +1737,7 @@ static void set_rx_mode(struct net_device *dev)
1738 int vlan_count = 0; 1737 int vlan_count = 0;
1739 void __iomem *filter_addr = ioaddr + HashTable + 8; 1738 void __iomem *filter_addr = ioaddr + HashTable + 8;
1740 for (i = 0; i < VLAN_VID_MASK; i++) { 1739 for (i = 0; i < VLAN_VID_MASK; i++) {
1741 if (np->vlgrp->vlan_devices[i]) { 1740 if (vlan_group_get_device(np->vlgrp, i)) {
1742 if (vlan_count >= 32) 1741 if (vlan_count >= 32)
1743 break; 1742 break;
1744 writew(cpu_to_be16(i), filter_addr); 1743 writew(cpu_to_be16(i), filter_addr);
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 26c6ac48288c..8c8f9f4d47a5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9114,8 +9114,7 @@ static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
9114 tg3_netif_stop(tp); 9114 tg3_netif_stop(tp);
9115 9115
9116 tg3_full_lock(tp, 0); 9116 tg3_full_lock(tp, 0);
9117 if (tp->vlgrp) 9117 vlan_group_set_device(tp->vlgrp, vid, NULL);
9118 tp->vlgrp->vlan_devices[vid] = NULL;
9119 tg3_full_unlock(tp); 9118 tg3_full_unlock(tp);
9120 9119
9121 if (netif_running(dev)) 9120 if (netif_running(dev))
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 9781b16bb8b6..0d91d094edd9 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -746,8 +746,7 @@ typhoon_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
746{ 746{
747 struct typhoon *tp = netdev_priv(dev); 747 struct typhoon *tp = netdev_priv(dev);
748 spin_lock_bh(&tp->state_lock); 748 spin_lock_bh(&tp->state_lock);
749 if(tp->vlgrp) 749 vlan_group_set_device(tp->vlgrp, vid, NULL);
750 tp->vlgrp->vlan_devices[vid] = NULL;
751 spin_unlock_bh(&tp->state_lock); 750 spin_unlock_bh(&tp->state_lock);
752} 751}
753 752
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 9040d7cf651e..65ad2e24caf0 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -38,7 +38,7 @@
38#include <linux/hdlc.h> 38#include <linux/hdlc.h>
39 39
40 40
41static const char* version = "HDLC support module revision 1.20"; 41static const char* version = "HDLC support module revision 1.21";
42 42
43#undef DEBUG_LINK 43#undef DEBUG_LINK
44 44
@@ -222,19 +222,31 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
222 return -EINVAL; 222 return -EINVAL;
223} 223}
224 224
225static void hdlc_setup_dev(struct net_device *dev)
226{
227 /* Re-init all variables changed by HDLC protocol drivers,
228 * including ether_setup() called from hdlc_raw_eth.c.
229 */
230 dev->get_stats = hdlc_get_stats;
231 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
232 dev->mtu = HDLC_MAX_MTU;
233 dev->type = ARPHRD_RAWHDLC;
234 dev->hard_header_len = 16;
235 dev->addr_len = 0;
236 dev->hard_header = NULL;
237 dev->rebuild_header = NULL;
238 dev->set_mac_address = NULL;
239 dev->hard_header_cache = NULL;
240 dev->header_cache_update = NULL;
241 dev->change_mtu = hdlc_change_mtu;
242 dev->hard_header_parse = NULL;
243}
244
225static void hdlc_setup(struct net_device *dev) 245static void hdlc_setup(struct net_device *dev)
226{ 246{
227 hdlc_device *hdlc = dev_to_hdlc(dev); 247 hdlc_device *hdlc = dev_to_hdlc(dev);
228 248
229 dev->get_stats = hdlc_get_stats; 249 hdlc_setup_dev(dev);
230 dev->change_mtu = hdlc_change_mtu;
231 dev->mtu = HDLC_MAX_MTU;
232
233 dev->type = ARPHRD_RAWHDLC;
234 dev->hard_header_len = 16;
235
236 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
237
238 hdlc->carrier = 1; 250 hdlc->carrier = 1;
239 hdlc->open = 0; 251 hdlc->open = 0;
240 spin_lock_init(&hdlc->state_lock); 252 spin_lock_init(&hdlc->state_lock);
@@ -294,6 +306,7 @@ void detach_hdlc_protocol(struct net_device *dev)
294 } 306 }
295 kfree(hdlc->state); 307 kfree(hdlc->state);
296 hdlc->state = NULL; 308 hdlc->state = NULL;
309 hdlc_setup_dev(dev);
297} 310}
298 311
299 312
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index b0bc5ddcf1b1..c9664fd8a917 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -365,10 +365,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
365 memcpy(&state(hdlc)->settings, &new_settings, size); 365 memcpy(&state(hdlc)->settings, &new_settings, size);
366 dev->hard_start_xmit = hdlc->xmit; 366 dev->hard_start_xmit = hdlc->xmit;
367 dev->hard_header = cisco_hard_header; 367 dev->hard_header = cisco_hard_header;
368 dev->hard_header_cache = NULL;
369 dev->type = ARPHRD_CISCO; 368 dev->type = ARPHRD_CISCO;
370 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
371 dev->addr_len = 0;
372 netif_dormant_on(dev); 369 netif_dormant_on(dev);
373 return 0; 370 return 0;
374 } 371 }
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index b45ab680d2d6..c6c3c757d6f1 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -1289,10 +1289,7 @@ static int fr_ioctl(struct net_device *dev, struct ifreq *ifr)
1289 memcpy(&state(hdlc)->settings, &new_settings, size); 1289 memcpy(&state(hdlc)->settings, &new_settings, size);
1290 1290
1291 dev->hard_start_xmit = hdlc->xmit; 1291 dev->hard_start_xmit = hdlc->xmit;
1292 dev->hard_header = NULL;
1293 dev->type = ARPHRD_FRAD; 1292 dev->type = ARPHRD_FRAD;
1294 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
1295 dev->addr_len = 0;
1296 return 0; 1293 return 0;
1297 1294
1298 case IF_PROTO_FR_ADD_PVC: 1295 case IF_PROTO_FR_ADD_PVC:
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index e9f717070fde..4591437dd2f3 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -127,9 +127,7 @@ static int ppp_ioctl(struct net_device *dev, struct ifreq *ifr)
127 if (result) 127 if (result)
128 return result; 128 return result;
129 dev->hard_start_xmit = hdlc->xmit; 129 dev->hard_start_xmit = hdlc->xmit;
130 dev->hard_header = NULL;
131 dev->type = ARPHRD_PPP; 130 dev->type = ARPHRD_PPP;
132 dev->addr_len = 0;
133 netif_dormant_off(dev); 131 netif_dormant_off(dev);
134 return 0; 132 return 0;
135 } 133 }
diff --git a/drivers/net/wan/hdlc_raw.c b/drivers/net/wan/hdlc_raw.c
index fe3cae5c6b9d..e23bc6656267 100644
--- a/drivers/net/wan/hdlc_raw.c
+++ b/drivers/net/wan/hdlc_raw.c
@@ -88,10 +88,7 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr)
88 return result; 88 return result;
89 memcpy(hdlc->state, &new_settings, size); 89 memcpy(hdlc->state, &new_settings, size);
90 dev->hard_start_xmit = hdlc->xmit; 90 dev->hard_start_xmit = hdlc->xmit;
91 dev->hard_header = NULL;
92 dev->type = ARPHRD_RAWHDLC; 91 dev->type = ARPHRD_RAWHDLC;
93 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
94 dev->addr_len = 0;
95 netif_dormant_off(dev); 92 netif_dormant_off(dev);
96 return 0; 93 return 0;
97 } 94 }
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c
index e4bb9f8ad433..cd7b22f50edc 100644
--- a/drivers/net/wan/hdlc_x25.c
+++ b/drivers/net/wan/hdlc_x25.c
@@ -215,9 +215,7 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr)
215 x25_rx, 0)) != 0) 215 x25_rx, 0)) != 0)
216 return result; 216 return result;
217 dev->hard_start_xmit = x25_xmit; 217 dev->hard_start_xmit = x25_xmit;
218 dev->hard_header = NULL;
219 dev->type = ARPHRD_X25; 218 dev->type = ARPHRD_X25;
220 dev->addr_len = 0;
221 netif_dormant_off(dev); 219 netif_dormant_off(dev);
222 return 0; 220 return 0;
223 } 221 }
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 2257e45594b3..d8a86f5af379 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -3654,7 +3654,7 @@ qeth_verify_vlan_dev(struct net_device *dev, struct qeth_card *card)
3654 return rc; 3654 return rc;
3655 3655
3656 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++){ 3656 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++){
3657 if (vg->vlan_devices[i] == dev){ 3657 if (vlan_group_get_device(vg, i) == dev){
3658 rc = QETH_VLAN_CARD; 3658 rc = QETH_VLAN_CARD;
3659 break; 3659 break;
3660 } 3660 }
@@ -5261,7 +5261,7 @@ qeth_free_vlan_addresses4(struct qeth_card *card, unsigned short vid)
5261 QETH_DBF_TEXT(trace, 4, "frvaddr4"); 5261 QETH_DBF_TEXT(trace, 4, "frvaddr4");
5262 5262
5263 rcu_read_lock(); 5263 rcu_read_lock();
5264 in_dev = __in_dev_get_rcu(card->vlangrp->vlan_devices[vid]); 5264 in_dev = __in_dev_get_rcu(vlan_group_get_device(card->vlangrp, vid));
5265 if (!in_dev) 5265 if (!in_dev)
5266 goto out; 5266 goto out;
5267 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { 5267 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
@@ -5288,7 +5288,7 @@ qeth_free_vlan_addresses6(struct qeth_card *card, unsigned short vid)
5288 5288
5289 QETH_DBF_TEXT(trace, 4, "frvaddr6"); 5289 QETH_DBF_TEXT(trace, 4, "frvaddr6");
5290 5290
5291 in6_dev = in6_dev_get(card->vlangrp->vlan_devices[vid]); 5291 in6_dev = in6_dev_get(vlan_group_get_device(card->vlangrp, vid));
5292 if (!in6_dev) 5292 if (!in6_dev)
5293 return; 5293 return;
5294 for (ifa = in6_dev->addr_list; ifa; ifa = ifa->lst_next){ 5294 for (ifa = in6_dev->addr_list; ifa; ifa = ifa->lst_next){
@@ -5360,7 +5360,7 @@ qeth_layer2_process_vlans(struct qeth_card *card, int clear)
5360 if (!card->vlangrp) 5360 if (!card->vlangrp)
5361 return; 5361 return;
5362 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 5362 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
5363 if (card->vlangrp->vlan_devices[i] == NULL) 5363 if (vlan_group_get_device(card->vlangrp, i) == NULL)
5364 continue; 5364 continue;
5365 if (clear) 5365 if (clear)
5366 qeth_layer2_send_setdelvlan(card, i, IPA_CMD_DELVLAN); 5366 qeth_layer2_send_setdelvlan(card, i, IPA_CMD_DELVLAN);
@@ -5398,8 +5398,7 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
5398 spin_lock_irqsave(&card->vlanlock, flags); 5398 spin_lock_irqsave(&card->vlanlock, flags);
5399 /* unregister IP addresses of vlan device */ 5399 /* unregister IP addresses of vlan device */
5400 qeth_free_vlan_addresses(card, vid); 5400 qeth_free_vlan_addresses(card, vid);
5401 if (card->vlangrp) 5401 vlan_group_set_device(card->vlangrp, vid, NULL);
5402 card->vlangrp->vlan_devices[vid] = NULL;
5403 spin_unlock_irqrestore(&card->vlanlock, flags); 5402 spin_unlock_irqrestore(&card->vlanlock, flags);
5404 if (card->options.layer2) 5403 if (card->options.layer2)
5405 qeth_layer2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); 5404 qeth_layer2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN);
@@ -5662,10 +5661,11 @@ qeth_add_vlan_mc(struct qeth_card *card)
5662 5661
5663 vg = card->vlangrp; 5662 vg = card->vlangrp;
5664 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 5663 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
5665 if (vg->vlan_devices[i] == NULL || 5664 struct net_device *netdev = vlan_group_get_device(vg, i);
5666 !(vg->vlan_devices[i]->flags & IFF_UP)) 5665 if (netdev == NULL ||
5666 !(netdev->flags & IFF_UP))
5667 continue; 5667 continue;
5668 in_dev = in_dev_get(vg->vlan_devices[i]); 5668 in_dev = in_dev_get(netdev);
5669 if (!in_dev) 5669 if (!in_dev)
5670 continue; 5670 continue;
5671 read_lock(&in_dev->mc_list_lock); 5671 read_lock(&in_dev->mc_list_lock);
@@ -5749,10 +5749,11 @@ qeth_add_vlan_mc6(struct qeth_card *card)
5749 5749
5750 vg = card->vlangrp; 5750 vg = card->vlangrp;
5751 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 5751 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
5752 if (vg->vlan_devices[i] == NULL || 5752 struct net_device *netdev = vlan_group_get_device(vg, i);
5753 !(vg->vlan_devices[i]->flags & IFF_UP)) 5753 if (netdev == NULL ||
5754 !(netdev->flags & IFF_UP))
5754 continue; 5755 continue;
5755 in_dev = in6_dev_get(vg->vlan_devices[i]); 5756 in_dev = in6_dev_get(netdev);
5756 if (!in_dev) 5757 if (!in_dev)
5757 continue; 5758 continue;
5758 read_lock(&in_dev->lock); 5759 read_lock(&in_dev->lock);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 35cb38573583..d103580c72d2 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -70,15 +70,34 @@ extern void vlan_ioctl_set(int (*hook)(void __user *));
70 * depends on completely exhausting the VLAN identifier space. Thus 70 * depends on completely exhausting the VLAN identifier space. Thus
71 * it gives constant time look-up, but in many cases it wastes memory. 71 * it gives constant time look-up, but in many cases it wastes memory.
72 */ 72 */
73#define VLAN_GROUP_ARRAY_LEN 4096 73#define VLAN_GROUP_ARRAY_LEN 4096
74#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
75#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS)
74 76
75struct vlan_group { 77struct vlan_group {
76 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 78 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */
77 struct hlist_node hlist; /* linked list */ 79 struct hlist_node hlist; /* linked list */
78 struct net_device *vlan_devices[VLAN_GROUP_ARRAY_LEN]; 80 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
79 struct rcu_head rcu; 81 struct rcu_head rcu;
80}; 82};
81 83
84static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id)
85{
86 struct net_device **array;
87 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
88 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN];
89}
90
91static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id,
92 struct net_device *dev)
93{
94 struct net_device **array;
95 if (!vg)
96 return;
97 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
98 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
99}
100
82struct vlan_priority_tci_mapping { 101struct vlan_priority_tci_mapping {
83 unsigned long priority; 102 unsigned long priority;
84 unsigned short vlan_qos; /* This should be shifted when first set, so we only do it 103 unsigned short vlan_qos; /* This should be shifted when first set, so we only do it
@@ -160,7 +179,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
160 return NET_RX_DROP; 179 return NET_RX_DROP;
161 } 180 }
162 181
163 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; 182 skb->dev = vlan_group_get_device(grp, vlan_tag & VLAN_VID_MASK);
164 if (skb->dev == NULL) { 183 if (skb->dev == NULL) {
165 dev_kfree_skb_any(skb); 184 dev_kfree_skb_any(skb);
166 185
diff --git a/include/net/sock.h b/include/net/sock.h
index 2c7d60ca3548..849c7df23181 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -426,7 +426,7 @@ static inline void sk_acceptq_added(struct sock *sk)
426 426
427static inline int sk_acceptq_is_full(struct sock *sk) 427static inline int sk_acceptq_is_full(struct sock *sk)
428{ 428{
429 return sk->sk_ack_backlog > sk->sk_max_ack_backlog; 429 return sk->sk_ack_backlog >= sk->sk_max_ack_backlog;
430} 430}
431 431
432/* 432/*
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index c1c205fad4fb..eb1c71ed7dfe 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -184,14 +184,23 @@ struct net_device *__find_vlan_dev(struct net_device *real_dev,
184 struct vlan_group *grp = __vlan_find_group(real_dev->ifindex); 184 struct vlan_group *grp = __vlan_find_group(real_dev->ifindex);
185 185
186 if (grp) 186 if (grp)
187 return grp->vlan_devices[VID]; 187 return vlan_group_get_device(grp, VID);
188 188
189 return NULL; 189 return NULL;
190} 190}
191 191
192static void vlan_group_free(struct vlan_group *grp)
193{
194 int i;
195
196 for (i=0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++)
197 kfree(grp->vlan_devices_arrays[i]);
198 kfree(grp);
199}
200
192static void vlan_rcu_free(struct rcu_head *rcu) 201static void vlan_rcu_free(struct rcu_head *rcu)
193{ 202{
194 kfree(container_of(rcu, struct vlan_group, rcu)); 203 vlan_group_free(container_of(rcu, struct vlan_group, rcu));
195} 204}
196 205
197 206
@@ -223,7 +232,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
223 ret = 0; 232 ret = 0;
224 233
225 if (grp) { 234 if (grp) {
226 dev = grp->vlan_devices[vlan_id]; 235 dev = vlan_group_get_device(grp, vlan_id);
227 if (dev) { 236 if (dev) {
228 /* Remove proc entry */ 237 /* Remove proc entry */
229 vlan_proc_rem_dev(dev); 238 vlan_proc_rem_dev(dev);
@@ -237,7 +246,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
237 real_dev->vlan_rx_kill_vid(real_dev, vlan_id); 246 real_dev->vlan_rx_kill_vid(real_dev, vlan_id);
238 } 247 }
239 248
240 grp->vlan_devices[vlan_id] = NULL; 249 vlan_group_set_device(grp, vlan_id, NULL);
241 synchronize_net(); 250 synchronize_net();
242 251
243 252
@@ -251,7 +260,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
251 * group. 260 * group.
252 */ 261 */
253 for (i = 0; i < VLAN_VID_MASK; i++) 262 for (i = 0; i < VLAN_VID_MASK; i++)
254 if (grp->vlan_devices[i]) 263 if (vlan_group_get_device(grp, i))
255 break; 264 break;
256 265
257 if (i == VLAN_VID_MASK) { 266 if (i == VLAN_VID_MASK) {
@@ -379,6 +388,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
379 struct net_device *new_dev; 388 struct net_device *new_dev;
380 struct net_device *real_dev; /* the ethernet device */ 389 struct net_device *real_dev; /* the ethernet device */
381 char name[IFNAMSIZ]; 390 char name[IFNAMSIZ];
391 int i;
382 392
383#ifdef VLAN_DEBUG 393#ifdef VLAN_DEBUG
384 printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n", 394 printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n",
@@ -544,6 +554,15 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
544 if (!grp) 554 if (!grp)
545 goto out_free_unregister; 555 goto out_free_unregister;
546 556
557 for (i=0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++) {
558 grp->vlan_devices_arrays[i] = kzalloc(
559 sizeof(struct net_device *)*VLAN_GROUP_ARRAY_PART_LEN,
560 GFP_KERNEL);
561
562 if (!grp->vlan_devices_arrays[i])
563 goto out_free_arrays;
564 }
565
547 /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */ 566 /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */
548 grp->real_dev_ifindex = real_dev->ifindex; 567 grp->real_dev_ifindex = real_dev->ifindex;
549 568
@@ -554,7 +573,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
554 real_dev->vlan_rx_register(real_dev, grp); 573 real_dev->vlan_rx_register(real_dev, grp);
555 } 574 }
556 575
557 grp->vlan_devices[VLAN_ID] = new_dev; 576 vlan_group_set_device(grp, VLAN_ID, new_dev);
558 577
559 if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */ 578 if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */
560 printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n", 579 printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
@@ -571,6 +590,9 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
571#endif 590#endif
572 return new_dev; 591 return new_dev;
573 592
593out_free_arrays:
594 vlan_group_free(grp);
595
574out_free_unregister: 596out_free_unregister:
575 unregister_netdev(new_dev); 597 unregister_netdev(new_dev);
576 goto out_unlock; 598 goto out_unlock;
@@ -606,7 +628,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
606 case NETDEV_CHANGE: 628 case NETDEV_CHANGE:
607 /* Propagate real device state to vlan devices */ 629 /* Propagate real device state to vlan devices */
608 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 630 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
609 vlandev = grp->vlan_devices[i]; 631 vlandev = vlan_group_get_device(grp, i);
610 if (!vlandev) 632 if (!vlandev)
611 continue; 633 continue;
612 634
@@ -617,7 +639,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
617 case NETDEV_DOWN: 639 case NETDEV_DOWN:
618 /* Put all VLANs for this dev in the down state too. */ 640 /* Put all VLANs for this dev in the down state too. */
619 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 641 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
620 vlandev = grp->vlan_devices[i]; 642 vlandev = vlan_group_get_device(grp, i);
621 if (!vlandev) 643 if (!vlandev)
622 continue; 644 continue;
623 645
@@ -632,7 +654,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
632 case NETDEV_UP: 654 case NETDEV_UP:
633 /* Put all VLANs for this dev in the up state too. */ 655 /* Put all VLANs for this dev in the up state too. */
634 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 656 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
635 vlandev = grp->vlan_devices[i]; 657 vlandev = vlan_group_get_device(grp, i);
636 if (!vlandev) 658 if (!vlandev)
637 continue; 659 continue;
638 660
@@ -649,7 +671,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
649 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { 671 for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
650 int ret; 672 int ret;
651 673
652 vlandev = grp->vlan_devices[i]; 674 vlandev = vlan_group_get_device(grp, i);
653 if (!vlandev) 675 if (!vlandev)
654 continue; 676 continue;
655 677
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 60aafb4a8adf..c976dd7e9758 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -732,11 +732,12 @@ static int cipso_v4_map_lvl_hton(const struct cipso_v4_doi *doi_def,
732 *net_lvl = host_lvl; 732 *net_lvl = host_lvl;
733 return 0; 733 return 0;
734 case CIPSO_V4_MAP_STD: 734 case CIPSO_V4_MAP_STD:
735 if (host_lvl < doi_def->map.std->lvl.local_size) { 735 if (host_lvl < doi_def->map.std->lvl.local_size &&
736 doi_def->map.std->lvl.local[host_lvl] < CIPSO_V4_INV_LVL) {
736 *net_lvl = doi_def->map.std->lvl.local[host_lvl]; 737 *net_lvl = doi_def->map.std->lvl.local[host_lvl];
737 return 0; 738 return 0;
738 } 739 }
739 break; 740 return -EPERM;
740 } 741 }
741 742
742 return -EINVAL; 743 return -EINVAL;
@@ -771,7 +772,7 @@ static int cipso_v4_map_lvl_ntoh(const struct cipso_v4_doi *doi_def,
771 *host_lvl = doi_def->map.std->lvl.cipso[net_lvl]; 772 *host_lvl = doi_def->map.std->lvl.cipso[net_lvl];
772 return 0; 773 return 0;
773 } 774 }
774 break; 775 return -EPERM;
775 } 776 }
776 777
777 return -EINVAL; 778 return -EINVAL;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 606971645b33..51ca4383c388 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -934,7 +934,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
934 934
935 sched = !sock_flag(other, SOCK_DEAD) && 935 sched = !sock_flag(other, SOCK_DEAD) &&
936 !(other->sk_shutdown & RCV_SHUTDOWN) && 936 !(other->sk_shutdown & RCV_SHUTDOWN) &&
937 (skb_queue_len(&other->sk_receive_queue) > 937 (skb_queue_len(&other->sk_receive_queue) >=
938 other->sk_max_ack_backlog); 938 other->sk_max_ack_backlog);
939 939
940 unix_state_runlock(other); 940 unix_state_runlock(other);
@@ -1008,7 +1008,7 @@ restart:
1008 if (other->sk_state != TCP_LISTEN) 1008 if (other->sk_state != TCP_LISTEN)
1009 goto out_unlock; 1009 goto out_unlock;
1010 1010
1011 if (skb_queue_len(&other->sk_receive_queue) > 1011 if (skb_queue_len(&other->sk_receive_queue) >=
1012 other->sk_max_ack_backlog) { 1012 other->sk_max_ack_backlog) {
1013 err = -EAGAIN; 1013 err = -EAGAIN;
1014 if (!timeo) 1014 if (!timeo)
@@ -1381,7 +1381,7 @@ restart:
1381 } 1381 }
1382 1382
1383 if (unix_peer(other) != sk && 1383 if (unix_peer(other) != sk &&
1384 (skb_queue_len(&other->sk_receive_queue) > 1384 (skb_queue_len(&other->sk_receive_queue) >=
1385 other->sk_max_ack_backlog)) { 1385 other->sk_max_ack_backlog)) {
1386 if (!timeo) { 1386 if (!timeo) {
1387 err = -EAGAIN; 1387 err = -EAGAIN;