aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-15 11:06:47 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-15 11:06:47 -0500
commit612166c76d6bd1ccd2624a15586a92444d2c4c0e (patch)
treecbe3bbc73fe5321d109c01259e64ea98e2646a9c
parentf885b51967fb5f611c462841e5119853df00cc97 (diff)
parent1b310fca30ac9851f79337ca72b1cf6a0f58064a (diff)
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: [TOKENRING]: rif_timer not initialized properly [NETFILTER]: bridge: fix double POST_ROUTING invocation [NETFILTER]: xt_helper: Do not bypass RCU [NETFILTER]: ip6t_eui64: Fixes calculation of Universal/Local bit [MACVLAN]: Prevent nesting macvlan devices [VLAN]: nested VLAN: fix lockdep's recursive locking warning [DECNET] ROUTE: fix rcu_dereference() uses in /proc/net/decnet_cache [BLUETOOTH]: Always send explicit hci_ll wake-up acks. [BLUETOOTH]: rfcomm tty BUG_ON() code fix [AX25] af_ax25: Possible circular locking. [AX25]: Kill user triggable printks. [IPV4] ROUTE: fix rcu_dereference() uses in /proc/net/rt_cache [NEIGH]: Fix race between neigh_parms_release and neightbl_fill_parms [NIU]: Support for Marvell PHY
-rw-r--r--drivers/bluetooth/hci_ll.c23
-rw-r--r--drivers/net/macvlan.c7
-rw-r--r--drivers/net/niu.c218
-rw-r--r--drivers/net/niu.h33
-rw-r--r--net/802/tr.c2
-rw-r--r--net/8021q/vlan.c7
-rw-r--r--net/ax25/af_ax25.c51
-rw-r--r--net/bluetooth/rfcomm/tty.c22
-rw-r--r--net/bridge/br_netfilter.c18
-rw-r--r--net/core/neighbour.c4
-rw-r--r--net/decnet/dn_route.c6
-rw-r--r--net/ipv4/route.c6
-rw-r--r--net/ipv6/netfilter/ip6t_eui64.c2
-rw-r--r--net/netfilter/xt_helper.c4
14 files changed, 325 insertions, 78 deletions
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 8c3e62a17b4a..b91d45a41b2f 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -204,6 +204,19 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
204 spin_lock_irqsave(&ll->hcill_lock, flags); 204 spin_lock_irqsave(&ll->hcill_lock, flags);
205 205
206 switch (ll->hcill_state) { 206 switch (ll->hcill_state) {
207 case HCILL_ASLEEP_TO_AWAKE:
208 /*
209 * This state means that both the host and the BRF chip
210 * have simultaneously sent a wake-up-indication packet.
211 * Traditionaly, in this case, receiving a wake-up-indication
212 * was enough and an additional wake-up-ack wasn't needed.
213 * This has changed with the BRF6350, which does require an
214 * explicit wake-up-ack. Other BRF versions, which do not
215 * require an explicit ack here, do accept it, thus it is
216 * perfectly safe to always send one.
217 */
218 BT_DBG("dual wake-up-indication");
219 /* deliberate fall-through - do not add break */
207 case HCILL_ASLEEP: 220 case HCILL_ASLEEP:
208 /* acknowledge device wake up */ 221 /* acknowledge device wake up */
209 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) { 222 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {
@@ -211,16 +224,8 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
211 goto out; 224 goto out;
212 } 225 }
213 break; 226 break;
214 case HCILL_ASLEEP_TO_AWAKE:
215 /*
216 * this state means that a wake-up-indication
217 * is already on its way to the device,
218 * and will serve as the required wake-up-ack
219 */
220 BT_DBG("dual wake-up-indication");
221 break;
222 default: 227 default:
223 /* any other state are illegal */ 228 /* any other state is illegal */
224 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state); 229 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state);
225 break; 230 break;
226 } 231 }
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2e4bcd5654c4..e8dc2f44fec9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev,
384 if (lowerdev == NULL) 384 if (lowerdev == NULL)
385 return -ENODEV; 385 return -ENODEV;
386 386
387 /* Don't allow macvlans on top of other macvlans - its not really
388 * wrong, but lockdep can't handle it and its not useful for anything
389 * you couldn't do directly on top of the real device.
390 */
391 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
392 return -ENODEV;
393
387 if (!tb[IFLA_MTU]) 394 if (!tb[IFLA_MTU])
388 dev->mtu = lowerdev->mtu; 395 dev->mtu = lowerdev->mtu;
389 else if (dev->mtu > lowerdev->mtu) 396 else if (dev->mtu > lowerdev->mtu)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 9a0c6d3adfe9..3bbcea11329f 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -801,22 +801,90 @@ static int bcm8704_init_user_dev3(struct niu *np)
801 return 0; 801 return 0;
802} 802}
803 803
804static int xcvr_init_10g(struct niu *np) 804static int mrvl88x2011_act_led(struct niu *np, int val)
805{
806 int err;
807
808 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
809 MRVL88X2011_LED_8_TO_11_CTL);
810 if (err < 0)
811 return err;
812
813 err &= ~MRVL88X2011_LED(MRVL88X2011_LED_ACT,MRVL88X2011_LED_CTL_MASK);
814 err |= MRVL88X2011_LED(MRVL88X2011_LED_ACT,val);
815
816 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
817 MRVL88X2011_LED_8_TO_11_CTL, err);
818}
819
820static int mrvl88x2011_led_blink_rate(struct niu *np, int rate)
821{
822 int err;
823
824 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
825 MRVL88X2011_LED_BLINK_CTL);
826 if (err >= 0) {
827 err &= ~MRVL88X2011_LED_BLKRATE_MASK;
828 err |= (rate << 4);
829
830 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
831 MRVL88X2011_LED_BLINK_CTL, err);
832 }
833
834 return err;
835}
836
837static int xcvr_init_10g_mrvl88x2011(struct niu *np)
838{
839 int err;
840
841 /* Set LED functions */
842 err = mrvl88x2011_led_blink_rate(np, MRVL88X2011_LED_BLKRATE_134MS);
843 if (err)
844 return err;
845
846 /* led activity */
847 err = mrvl88x2011_act_led(np, MRVL88X2011_LED_CTL_OFF);
848 if (err)
849 return err;
850
851 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
852 MRVL88X2011_GENERAL_CTL);
853 if (err < 0)
854 return err;
855
856 err |= MRVL88X2011_ENA_XFPREFCLK;
857
858 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
859 MRVL88X2011_GENERAL_CTL, err);
860 if (err < 0)
861 return err;
862
863 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
864 MRVL88X2011_PMA_PMD_CTL_1);
865 if (err < 0)
866 return err;
867
868 if (np->link_config.loopback_mode == LOOPBACK_MAC)
869 err |= MRVL88X2011_LOOPBACK;
870 else
871 err &= ~MRVL88X2011_LOOPBACK;
872
873 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
874 MRVL88X2011_PMA_PMD_CTL_1, err);
875 if (err < 0)
876 return err;
877
878 /* Enable PMD */
879 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
880 MRVL88X2011_10G_PMD_TX_DIS, MRVL88X2011_ENA_PMDTX);
881}
882
883static int xcvr_init_10g_bcm8704(struct niu *np)
805{ 884{
806 struct niu_link_config *lp = &np->link_config; 885 struct niu_link_config *lp = &np->link_config;
807 u16 analog_stat0, tx_alarm_status; 886 u16 analog_stat0, tx_alarm_status;
808 int err; 887 int err;
809 u64 val;
810
811 val = nr64_mac(XMAC_CONFIG);
812 val &= ~XMAC_CONFIG_LED_POLARITY;
813 val |= XMAC_CONFIG_FORCE_LED_ON;
814 nw64_mac(XMAC_CONFIG, val);
815
816 /* XXX shared resource, lock parent XXX */
817 val = nr64(MIF_CONFIG);
818 val |= MIF_CONFIG_INDIRECT_MODE;
819 nw64(MIF_CONFIG, val);
820 888
821 err = bcm8704_reset(np); 889 err = bcm8704_reset(np);
822 if (err) 890 if (err)
@@ -896,6 +964,38 @@ static int xcvr_init_10g(struct niu *np)
896 return 0; 964 return 0;
897} 965}
898 966
967static int xcvr_init_10g(struct niu *np)
968{
969 int phy_id, err;
970 u64 val;
971
972 val = nr64_mac(XMAC_CONFIG);
973 val &= ~XMAC_CONFIG_LED_POLARITY;
974 val |= XMAC_CONFIG_FORCE_LED_ON;
975 nw64_mac(XMAC_CONFIG, val);
976
977 /* XXX shared resource, lock parent XXX */
978 val = nr64(MIF_CONFIG);
979 val |= MIF_CONFIG_INDIRECT_MODE;
980 nw64(MIF_CONFIG, val);
981
982 phy_id = phy_decode(np->parent->port_phy, np->port);
983 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
984
985 /* handle different phy types */
986 switch (phy_id & NIU_PHY_ID_MASK) {
987 case NIU_PHY_ID_MRVL88X2011:
988 err = xcvr_init_10g_mrvl88x2011(np);
989 break;
990
991 default: /* bcom 8704 */
992 err = xcvr_init_10g_bcm8704(np);
993 break;
994 }
995
996 return 0;
997}
998
899static int mii_reset(struct niu *np) 999static int mii_reset(struct niu *np)
900{ 1000{
901 int limit, err; 1001 int limit, err;
@@ -1082,19 +1182,68 @@ static int niu_link_status_common(struct niu *np, int link_up)
1082 return 0; 1182 return 0;
1083} 1183}
1084 1184
1085static int link_status_10g(struct niu *np, int *link_up_p) 1185static int link_status_10g_mrvl(struct niu *np, int *link_up_p)
1086{ 1186{
1087 unsigned long flags; 1187 int err, link_up, pma_status, pcs_status;
1088 int err, link_up;
1089 1188
1090 link_up = 0; 1189 link_up = 0;
1091 1190
1092 spin_lock_irqsave(&np->lock, flags); 1191 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1192 MRVL88X2011_10G_PMD_STATUS_2);
1193 if (err < 0)
1194 goto out;
1093 1195
1094 err = -EINVAL; 1196 /* Check PMA/PMD Register: 1.0001.2 == 1 */
1095 if (np->link_config.loopback_mode != LOOPBACK_DISABLED) 1197 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1198 MRVL88X2011_PMA_PMD_STATUS_1);
1199 if (err < 0)
1200 goto out;
1201
1202 pma_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1203
1204 /* Check PMC Register : 3.0001.2 == 1: read twice */
1205 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1206 MRVL88X2011_PMA_PMD_STATUS_1);
1207 if (err < 0)
1208 goto out;
1209
1210 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1211 MRVL88X2011_PMA_PMD_STATUS_1);
1212 if (err < 0)
1213 goto out;
1214
1215 pcs_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1216
1217 /* Check XGXS Register : 4.0018.[0-3,12] */
1218 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV4_ADDR,
1219 MRVL88X2011_10G_XGXS_LANE_STAT);
1220 if (err < 0)
1096 goto out; 1221 goto out;
1097 1222
1223 if (err == (PHYXS_XGXS_LANE_STAT_ALINGED | PHYXS_XGXS_LANE_STAT_LANE3 |
1224 PHYXS_XGXS_LANE_STAT_LANE2 | PHYXS_XGXS_LANE_STAT_LANE1 |
1225 PHYXS_XGXS_LANE_STAT_LANE0 | PHYXS_XGXS_LANE_STAT_MAGIC |
1226 0x800))
1227 link_up = (pma_status && pcs_status) ? 1 : 0;
1228
1229 np->link_config.active_speed = SPEED_10000;
1230 np->link_config.active_duplex = DUPLEX_FULL;
1231 err = 0;
1232out:
1233 mrvl88x2011_act_led(np, (link_up ?
1234 MRVL88X2011_LED_CTL_PCS_ACT :
1235 MRVL88X2011_LED_CTL_OFF));
1236
1237 *link_up_p = link_up;
1238 return err;
1239}
1240
1241static int link_status_10g_bcom(struct niu *np, int *link_up_p)
1242{
1243 int err, link_up;
1244
1245 link_up = 0;
1246
1098 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, 1247 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR,
1099 BCM8704_PMD_RCV_SIGDET); 1248 BCM8704_PMD_RCV_SIGDET);
1100 if (err < 0) 1249 if (err < 0)
@@ -1134,9 +1283,37 @@ static int link_status_10g(struct niu *np, int *link_up_p)
1134 err = 0; 1283 err = 0;
1135 1284
1136out: 1285out:
1286 *link_up_p = link_up;
1287 return err;
1288}
1289
1290static int link_status_10g(struct niu *np, int *link_up_p)
1291{
1292 unsigned long flags;
1293 int err = -EINVAL;
1294
1295 spin_lock_irqsave(&np->lock, flags);
1296
1297 if (np->link_config.loopback_mode == LOOPBACK_DISABLED) {
1298 int phy_id;
1299
1300 phy_id = phy_decode(np->parent->port_phy, np->port);
1301 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
1302
1303 /* handle different phy types */
1304 switch (phy_id & NIU_PHY_ID_MASK) {
1305 case NIU_PHY_ID_MRVL88X2011:
1306 err = link_status_10g_mrvl(np, link_up_p);
1307 break;
1308
1309 default: /* bcom 8704 */
1310 err = link_status_10g_bcom(np, link_up_p);
1311 break;
1312 }
1313 }
1314
1137 spin_unlock_irqrestore(&np->lock, flags); 1315 spin_unlock_irqrestore(&np->lock, flags);
1138 1316
1139 *link_up_p = link_up;
1140 return err; 1317 return err;
1141} 1318}
1142 1319
@@ -6297,7 +6474,8 @@ static int __devinit phy_record(struct niu_parent *parent,
6297 if (dev_id_1 < 0 || dev_id_2 < 0) 6474 if (dev_id_1 < 0 || dev_id_2 < 0)
6298 return 0; 6475 return 0;
6299 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) { 6476 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) {
6300 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) 6477 if (((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) &&
6478 ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011))
6301 return 0; 6479 return 0;
6302 } else { 6480 } else {
6303 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R) 6481 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R)
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index 10e3f111b6d5..0e8626adc573 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -2538,6 +2538,39 @@ struct fcram_hash_ipv6 {
2538#define NIU_PHY_ID_MASK 0xfffff0f0 2538#define NIU_PHY_ID_MASK 0xfffff0f0
2539#define NIU_PHY_ID_BCM8704 0x00206030 2539#define NIU_PHY_ID_BCM8704 0x00206030
2540#define NIU_PHY_ID_BCM5464R 0x002060b0 2540#define NIU_PHY_ID_BCM5464R 0x002060b0
2541#define NIU_PHY_ID_MRVL88X2011 0x01410020
2542
2543/* MRVL88X2011 register addresses */
2544#define MRVL88X2011_USER_DEV1_ADDR 1
2545#define MRVL88X2011_USER_DEV2_ADDR 2
2546#define MRVL88X2011_USER_DEV3_ADDR 3
2547#define MRVL88X2011_USER_DEV4_ADDR 4
2548#define MRVL88X2011_PMA_PMD_CTL_1 0x0000
2549#define MRVL88X2011_PMA_PMD_STATUS_1 0x0001
2550#define MRVL88X2011_10G_PMD_STATUS_2 0x0008
2551#define MRVL88X2011_10G_PMD_TX_DIS 0x0009
2552#define MRVL88X2011_10G_XGXS_LANE_STAT 0x0018
2553#define MRVL88X2011_GENERAL_CTL 0x8300
2554#define MRVL88X2011_LED_BLINK_CTL 0x8303
2555#define MRVL88X2011_LED_8_TO_11_CTL 0x8306
2556
2557/* MRVL88X2011 register control */
2558#define MRVL88X2011_ENA_XFPREFCLK 0x0001
2559#define MRVL88X2011_ENA_PMDTX 0x0000
2560#define MRVL88X2011_LOOPBACK 0x1
2561#define MRVL88X2011_LED_ACT 0x1
2562#define MRVL88X2011_LNK_STATUS_OK 0x4
2563#define MRVL88X2011_LED_BLKRATE_MASK 0x70
2564#define MRVL88X2011_LED_BLKRATE_034MS 0x0
2565#define MRVL88X2011_LED_BLKRATE_067MS 0x1
2566#define MRVL88X2011_LED_BLKRATE_134MS 0x2
2567#define MRVL88X2011_LED_BLKRATE_269MS 0x3
2568#define MRVL88X2011_LED_BLKRATE_538MS 0x4
2569#define MRVL88X2011_LED_CTL_OFF 0x0
2570#define MRVL88X2011_LED_CTL_PCS_ACT 0x5
2571#define MRVL88X2011_LED_CTL_MASK 0x7
2572#define MRVL88X2011_LED(n,v) ((v)<<((n)*4))
2573#define MRVL88X2011_LED_STAT(n,v) ((v)>>((n)*4))
2541 2574
2542#define BCM8704_PMA_PMD_DEV_ADDR 1 2575#define BCM8704_PMA_PMD_DEV_ADDR 1
2543#define BCM8704_PCS_DEV_ADDR 2 2576#define BCM8704_PCS_DEV_ADDR 2
diff --git a/net/802/tr.c b/net/802/tr.c
index a2bd0f2e3af8..1e115e5beab6 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -642,7 +642,7 @@ struct net_device *alloc_trdev(int sizeof_priv)
642static int __init rif_init(void) 642static int __init rif_init(void)
643{ 643{
644 init_timer(&rif_timer); 644 init_timer(&rif_timer);
645 rif_timer.expires = sysctl_tr_rif_timeout; 645 rif_timer.expires = jiffies + sysctl_tr_rif_timeout;
646 rif_timer.data = 0L; 646 rif_timer.data = 0L;
647 rif_timer.function = rif_check_expire; 647 rif_timer.function = rif_check_expire;
648 add_timer(&rif_timer); 648 add_timer(&rif_timer);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4add9bd4bc8d..032bf44eca5e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -323,6 +323,7 @@ static const struct header_ops vlan_header_ops = {
323static int vlan_dev_init(struct net_device *dev) 323static int vlan_dev_init(struct net_device *dev)
324{ 324{
325 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; 325 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
326 int subclass = 0;
326 327
327 /* IFF_BROADCAST|IFF_MULTICAST; ??? */ 328 /* IFF_BROADCAST|IFF_MULTICAST; ??? */
328 dev->flags = real_dev->flags & ~IFF_UP; 329 dev->flags = real_dev->flags & ~IFF_UP;
@@ -349,7 +350,11 @@ static int vlan_dev_init(struct net_device *dev)
349 dev->hard_start_xmit = vlan_dev_hard_start_xmit; 350 dev->hard_start_xmit = vlan_dev_hard_start_xmit;
350 } 351 }
351 352
352 lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); 353 if (real_dev->priv_flags & IFF_802_1Q_VLAN)
354 subclass = 1;
355
356 lockdep_set_class_and_subclass(&dev->_xmit_lock,
357 &vlan_netdev_xmit_lock_key, subclass);
353 return 0; 358 return 0;
354} 359}
355 360
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8378afd54b30..b4725ff317c0 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -87,10 +87,22 @@ static void ax25_kill_by_device(struct net_device *dev)
87 return; 87 return;
88 88
89 spin_lock_bh(&ax25_list_lock); 89 spin_lock_bh(&ax25_list_lock);
90again:
90 ax25_for_each(s, node, &ax25_list) { 91 ax25_for_each(s, node, &ax25_list) {
91 if (s->ax25_dev == ax25_dev) { 92 if (s->ax25_dev == ax25_dev) {
92 s->ax25_dev = NULL; 93 s->ax25_dev = NULL;
94 spin_unlock_bh(&ax25_list_lock);
93 ax25_disconnect(s, ENETUNREACH); 95 ax25_disconnect(s, ENETUNREACH);
96 spin_lock_bh(&ax25_list_lock);
97
98 /* The entry could have been deleted from the
99 * list meanwhile and thus the next pointer is
100 * no longer valid. Play it safe and restart
101 * the scan. Forward progress is ensured
102 * because we set s->ax25_dev to NULL and we
103 * are never passed a NULL 'dev' argument.
104 */
105 goto again;
94 } 106 }
95 } 107 }
96 spin_unlock_bh(&ax25_list_lock); 108 spin_unlock_bh(&ax25_list_lock);
@@ -1109,21 +1121,19 @@ static int __must_check ax25_connect(struct socket *sock,
1109 * some sanity checks. code further down depends on this 1121 * some sanity checks. code further down depends on this
1110 */ 1122 */
1111 1123
1112 if (addr_len == sizeof(struct sockaddr_ax25)) { 1124 if (addr_len == sizeof(struct sockaddr_ax25))
1113 /* support for this will go away in early 2.5.x */ 1125 /* support for this will go away in early 2.5.x
1114 printk(KERN_WARNING "ax25_connect(): %s uses obsolete socket structure\n", 1126 * ax25_connect(): uses obsolete socket structure
1115 current->comm); 1127 */
1116 } 1128 ;
1117 else if (addr_len != sizeof(struct full_sockaddr_ax25)) { 1129 else if (addr_len != sizeof(struct full_sockaddr_ax25))
1118 /* support for old structure may go away some time */ 1130 /* support for old structure may go away some time
1131 * ax25_connect(): uses old (6 digipeater) socket structure.
1132 */
1119 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || 1133 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
1120 (addr_len > sizeof(struct full_sockaddr_ax25))) { 1134 (addr_len > sizeof(struct full_sockaddr_ax25)))
1121 return -EINVAL; 1135 return -EINVAL;
1122 }
1123 1136
1124 printk(KERN_WARNING "ax25_connect(): %s uses old (6 digipeater) socket structure.\n",
1125 current->comm);
1126 }
1127 1137
1128 if (fsa->fsa_ax25.sax25_family != AF_AX25) 1138 if (fsa->fsa_ax25.sax25_family != AF_AX25)
1129 return -EINVAL; 1139 return -EINVAL;
@@ -1467,21 +1477,20 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1467 goto out; 1477 goto out;
1468 } 1478 }
1469 1479
1470 if (addr_len == sizeof(struct sockaddr_ax25)) { 1480 if (addr_len == sizeof(struct sockaddr_ax25))
1471 printk(KERN_WARNING "ax25_sendmsg(): %s uses obsolete socket structure\n", 1481 /* ax25_sendmsg(): uses obsolete socket structure */
1472 current->comm); 1482 ;
1473 } 1483 else if (addr_len != sizeof(struct full_sockaddr_ax25))
1474 else if (addr_len != sizeof(struct full_sockaddr_ax25)) { 1484 /* support for old structure may go away some time
1475 /* support for old structure may go away some time */ 1485 * ax25_sendmsg(): uses old (6 digipeater)
1486 * socket structure.
1487 */
1476 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || 1488 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
1477 (addr_len > sizeof(struct full_sockaddr_ax25))) { 1489 (addr_len > sizeof(struct full_sockaddr_ax25))) {
1478 err = -EINVAL; 1490 err = -EINVAL;
1479 goto out; 1491 goto out;
1480 } 1492 }
1481 1493
1482 printk(KERN_WARNING "ax25_sendmsg(): %s uses old (6 digipeater) socket structure.\n",
1483 current->comm);
1484 }
1485 1494
1486 if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) { 1495 if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) {
1487 int ct = 0; 1496 int ct = 0;
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index e447651a2dbe..a6a758dd1f7d 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -95,9 +95,10 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
95 95
96 BT_DBG("dev %p dlc %p", dev, dlc); 96 BT_DBG("dev %p dlc %p", dev, dlc);
97 97
98 write_lock_bh(&rfcomm_dev_lock); 98 /* Refcount should only hit zero when called from rfcomm_dev_del()
99 list_del_init(&dev->list); 99 which will have taken us off the list. Everything else are
100 write_unlock_bh(&rfcomm_dev_lock); 100 refcounting bugs. */
101 BUG_ON(!list_empty(&dev->list));
101 102
102 rfcomm_dlc_lock(dlc); 103 rfcomm_dlc_lock(dlc);
103 /* Detach DLC if it's owned by this dev */ 104 /* Detach DLC if it's owned by this dev */
@@ -109,11 +110,6 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
109 110
110 tty_unregister_device(rfcomm_tty_driver, dev->id); 111 tty_unregister_device(rfcomm_tty_driver, dev->id);
111 112
112 /* Refcount should only hit zero when called from rfcomm_dev_del()
113 which will have taken us off the list. Everything else are
114 refcounting bugs. */
115 BUG_ON(!list_empty(&dev->list));
116
117 kfree(dev); 113 kfree(dev);
118 114
119 /* It's safe to call module_put() here because socket still 115 /* It's safe to call module_put() here because socket still
@@ -313,7 +309,15 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev)
313{ 309{
314 BT_DBG("dev %p", dev); 310 BT_DBG("dev %p", dev);
315 311
316 set_bit(RFCOMM_TTY_RELEASED, &dev->flags); 312 if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
313 BUG_ON(1);
314 else
315 set_bit(RFCOMM_TTY_RELEASED, &dev->flags);
316
317 write_lock_bh(&rfcomm_dev_lock);
318 list_del_init(&dev->list);
319 write_unlock_bh(&rfcomm_dev_lock);
320
317 rfcomm_dev_put(dev); 321 rfcomm_dev_put(dev);
318} 322}
319 323
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index c1757c79dfbb..5d8b939eded1 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -247,8 +247,9 @@ static void __br_dnat_complain(void)
247 * Let us first consider the case that ip_route_input() succeeds: 247 * Let us first consider the case that ip_route_input() succeeds:
248 * 248 *
249 * If skb->dst->dev equals the logical bridge device the packet 249 * If skb->dst->dev equals the logical bridge device the packet
250 * came in on, we can consider this bridging. We then call 250 * came in on, we can consider this bridging. The packet is passed
251 * skb->dst->output() which will make the packet enter br_nf_local_out() 251 * through the neighbour output function to build a new destination
252 * MAC address, which will make the packet enter br_nf_local_out()
252 * not much later. In that function it is assured that the iptables 253 * not much later. In that function it is assured that the iptables
253 * FORWARD chain is traversed for the packet. 254 * FORWARD chain is traversed for the packet.
254 * 255 *
@@ -285,12 +286,17 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
285 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 286 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
286 287
287 skb->dev = bridge_parent(skb->dev); 288 skb->dev = bridge_parent(skb->dev);
288 if (!skb->dev) 289 if (skb->dev) {
289 kfree_skb(skb); 290 struct dst_entry *dst = skb->dst;
290 else { 291
291 nf_bridge_pull_encap_header(skb); 292 nf_bridge_pull_encap_header(skb);
292 skb->dst->output(skb); 293
294 if (dst->hh)
295 return neigh_hh_output(dst->hh, skb);
296 else if (dst->neighbour)
297 return dst->neighbour->output(skb);
293 } 298 }
299 kfree_skb(skb);
294 return 0; 300 return 0;
295} 301}
296 302
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 29b8ee4e35d6..cc8a2f190acf 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1316,8 +1316,6 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
1316 *p = parms->next; 1316 *p = parms->next;
1317 parms->dead = 1; 1317 parms->dead = 1;
1318 write_unlock_bh(&tbl->lock); 1318 write_unlock_bh(&tbl->lock);
1319 if (parms->dev)
1320 dev_put(parms->dev);
1321 call_rcu(&parms->rcu_head, neigh_rcu_free_parms); 1319 call_rcu(&parms->rcu_head, neigh_rcu_free_parms);
1322 return; 1320 return;
1323 } 1321 }
@@ -1328,6 +1326,8 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
1328 1326
1329void neigh_parms_destroy(struct neigh_parms *parms) 1327void neigh_parms_destroy(struct neigh_parms *parms)
1330{ 1328{
1329 if (parms->dev)
1330 dev_put(parms->dev);
1331 kfree(parms); 1331 kfree(parms);
1332} 1332}
1333 1333
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 66663e5d7acd..0e10ff21e292 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1665,12 +1665,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq)
1665 break; 1665 break;
1666 rcu_read_unlock_bh(); 1666 rcu_read_unlock_bh();
1667 } 1667 }
1668 return rt; 1668 return rcu_dereference(rt);
1669} 1669}
1670 1670
1671static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) 1671static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt)
1672{ 1672{
1673 struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); 1673 struct dn_rt_cache_iter_state *s = seq->private;
1674 1674
1675 rt = rt->u.dst.dn_next; 1675 rt = rt->u.dst.dn_next;
1676 while(!rt) { 1676 while(!rt) {
@@ -1680,7 +1680,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
1680 rcu_read_lock_bh(); 1680 rcu_read_lock_bh();
1681 rt = dn_rt_hash_table[s->bucket].chain; 1681 rt = dn_rt_hash_table[s->bucket].chain;
1682 } 1682 }
1683 return rt; 1683 return rcu_dereference(rt);
1684} 1684}
1685 1685
1686static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) 1686static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d3377069ce05..28484f396b04 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -283,12 +283,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
283 break; 283 break;
284 rcu_read_unlock_bh(); 284 rcu_read_unlock_bh();
285 } 285 }
286 return r; 286 return rcu_dereference(r);
287} 287}
288 288
289static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) 289static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
290{ 290{
291 struct rt_cache_iter_state *st = rcu_dereference(seq->private); 291 struct rt_cache_iter_state *st = seq->private;
292 292
293 r = r->u.dst.rt_next; 293 r = r->u.dst.rt_next;
294 while (!r) { 294 while (!r) {
@@ -298,7 +298,7 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
298 rcu_read_lock_bh(); 298 rcu_read_lock_bh();
299 r = rt_hash_table[st->bucket].chain; 299 r = rt_hash_table[st->bucket].chain;
300 } 300 }
301 return r; 301 return rcu_dereference(r);
302} 302}
303 303
304static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) 304static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos)
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c
index 34ba150bfe5d..41df9a578c7a 100644
--- a/net/ipv6/netfilter/ip6t_eui64.c
+++ b/net/ipv6/netfilter/ip6t_eui64.c
@@ -47,7 +47,7 @@ match(const struct sk_buff *skb,
47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); 47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
48 eui64[3] = 0xff; 48 eui64[3] = 0xff;
49 eui64[4] = 0xfe; 49 eui64[4] = 0xfe;
50 eui64[0] |= 0x02; 50 eui64[0] ^= 0x02;
51 51
52 i = 0; 52 i = 0;
53 while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i] 53 while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i]
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c
index 0a1f4c6bcdef..d842c4a6d63f 100644
--- a/net/netfilter/xt_helper.c
+++ b/net/netfilter/xt_helper.c
@@ -56,8 +56,8 @@ match(const struct sk_buff *skb,
56 if (info->name[0] == '\0') 56 if (info->name[0] == '\0')
57 ret = !ret; 57 ret = !ret;
58 else 58 else
59 ret ^= !strncmp(master_help->helper->name, info->name, 59 ret ^= !strncmp(helper->name, info->name,
60 strlen(master_help->helper->name)); 60 strlen(helper->name));
61 return ret; 61 return ret;
62} 62}
63 63