aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-11-03 13:41:45 -0500
committerDavid S. Miller <davem@davemloft.net>2015-11-03 13:41:45 -0500
commit73186df8d7fa574345f0ad626ebe89649f8308a5 (patch)
tree9e6ed2c499cb5cbbcc79415602f9114503bb6931
parent0c63d80c3fac4e6eb0f01dff756e47bc7cd50092 (diff)
parentebac62fe3d24c0ce22dd83afa7b07d1a2aaef44d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Minor overlapping changes in net/ipv4/ipmr.c, in 'net' we were fixing the "BH-ness" of the counter bumps whilst in 'net-next' the functions were modified to take an explicit 'net' parameter. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c12
-rw-r--r--drivers/net/can/dev.c2
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c4
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.h1
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmmii.c18
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c2
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c10
-rw-r--r--drivers/net/ethernet/sfc/ef10.c4
-rw-r--r--drivers/net/ethernet/sfc/farch.c4
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h2
-rw-r--r--drivers/net/ethernet/sfc/tx.c30
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c7
-rw-r--r--drivers/net/phy/phy_device.c74
-rw-r--r--drivers/net/ppp/ppp_generic.c6
-rw-r--r--drivers/net/slip/slhc.c12
-rw-r--r--drivers/net/slip/slip.c2
-rw-r--r--drivers/net/usb/qmi_wwan.c5
-rw-r--r--include/net/inet_common.h3
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--net/ipv4/fib_frontend.c13
-rw-r--r--net/ipv4/fib_semantics.c18
-rw-r--r--net/ipv4/ipmr.c6
-rw-r--r--net/ipv6/route.c3
-rw-r--r--net/ipv6/sit.c26
-rw-r--r--net/ipv6/tunnel6.c12
-rw-r--r--net/tipc/udp_media.c5
27 files changed, 192 insertions, 92 deletions
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index c4198fa490bf..9c1e8adaf4fc 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file)
301 is->compflags = 0; 301 is->compflags = 0;
302 302
303 is->reset = isdn_ppp_ccp_reset_alloc(is); 303 is->reset = isdn_ppp_ccp_reset_alloc(is);
304 if (!is->reset)
305 return -ENOMEM;
304 306
305 is->lp = NULL; 307 is->lp = NULL;
306 is->mp_seqno = 0; /* MP sequence number */ 308 is->mp_seqno = 0; /* MP sequence number */
@@ -320,6 +322,10 @@ isdn_ppp_open(int min, struct file *file)
320 * VJ header compression init 322 * VJ header compression init
321 */ 323 */
322 is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */ 324 is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */
325 if (IS_ERR(is->slcomp)) {
326 isdn_ppp_ccp_reset_free(is);
327 return PTR_ERR(is->slcomp);
328 }
323#endif 329#endif
324#ifdef CONFIG_IPPP_FILTER 330#ifdef CONFIG_IPPP_FILTER
325 is->pass_filter = NULL; 331 is->pass_filter = NULL;
@@ -567,10 +573,8 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
567 is->maxcid = val; 573 is->maxcid = val;
568#ifdef CONFIG_ISDN_PPP_VJ 574#ifdef CONFIG_ISDN_PPP_VJ
569 sltmp = slhc_init(16, val); 575 sltmp = slhc_init(16, val);
570 if (!sltmp) { 576 if (IS_ERR(sltmp))
571 printk(KERN_ERR "ippp, can't realloc slhc struct\n"); 577 return PTR_ERR(sltmp);
572 return -ENOMEM;
573 }
574 if (is->slcomp) 578 if (is->slcomp)
575 slhc_free(is->slcomp); 579 slhc_free(is->slcomp);
576 is->slcomp = sltmp; 580 is->slcomp = sltmp;
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index aede704605c6..141c2a42d7ed 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -915,7 +915,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
915 nla_put(skb, IFLA_CAN_BITTIMING_CONST, 915 nla_put(skb, IFLA_CAN_BITTIMING_CONST,
916 sizeof(*priv->bittiming_const), priv->bittiming_const)) || 916 sizeof(*priv->bittiming_const), priv->bittiming_const)) ||
917 917
918 nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) || 918 nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) ||
919 nla_put_u32(skb, IFLA_CAN_STATE, state) || 919 nla_put_u32(skb, IFLA_CAN_STATE, state) ||
920 nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || 920 nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) ||
921 nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || 921 nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) ||
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 50f63b7f3c3e..17f017ab4dac 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1055,8 +1055,10 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
1055 } 1055 }
1056 1056
1057 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); 1057 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
1058 if (mode == GENET_POWER_PASSIVE) 1058 if (mode == GENET_POWER_PASSIVE) {
1059 bcmgenet_phy_power_set(priv->dev, true); 1059 bcmgenet_phy_power_set(priv->dev, true);
1060 bcmgenet_mii_reset(priv->dev);
1061 }
1060} 1062}
1061 1063
1062/* ioctl handle special commands that are not present in ethtool. */ 1064/* ioctl handle special commands that are not present in ethtool. */
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index 29dc2f1bbb19..967367557309 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -673,6 +673,7 @@ int bcmgenet_mii_init(struct net_device *dev);
673int bcmgenet_mii_config(struct net_device *dev); 673int bcmgenet_mii_config(struct net_device *dev);
674int bcmgenet_mii_probe(struct net_device *dev); 674int bcmgenet_mii_probe(struct net_device *dev);
675void bcmgenet_mii_exit(struct net_device *dev); 675void bcmgenet_mii_exit(struct net_device *dev);
676void bcmgenet_mii_reset(struct net_device *dev);
676void bcmgenet_phy_power_set(struct net_device *dev, bool enable); 677void bcmgenet_phy_power_set(struct net_device *dev, bool enable);
677void bcmgenet_mii_setup(struct net_device *dev); 678void bcmgenet_mii_setup(struct net_device *dev);
678 679
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index c8affad76f36..8bdfe53754ba 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -163,6 +163,7 @@ void bcmgenet_mii_setup(struct net_device *dev)
163 phy_print_status(phydev); 163 phy_print_status(phydev);
164} 164}
165 165
166
166static int bcmgenet_fixed_phy_link_update(struct net_device *dev, 167static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
167 struct fixed_phy_status *status) 168 struct fixed_phy_status *status)
168{ 169{
@@ -172,6 +173,22 @@ static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
172 return 0; 173 return 0;
173} 174}
174 175
176/* Perform a voluntary PHY software reset, since the EPHY is very finicky about
177 * not doing it and will start corrupting packets
178 */
179void bcmgenet_mii_reset(struct net_device *dev)
180{
181 struct bcmgenet_priv *priv = netdev_priv(dev);
182
183 if (GENET_IS_V4(priv))
184 return;
185
186 if (priv->phydev) {
187 phy_init_hw(priv->phydev);
188 phy_start_aneg(priv->phydev);
189 }
190}
191
175void bcmgenet_phy_power_set(struct net_device *dev, bool enable) 192void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
176{ 193{
177 struct bcmgenet_priv *priv = netdev_priv(dev); 194 struct bcmgenet_priv *priv = netdev_priv(dev);
@@ -214,6 +231,7 @@ static void bcmgenet_internal_phy_setup(struct net_device *dev)
214 reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); 231 reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
215 reg |= EXT_PWR_DN_EN_LD; 232 reg |= EXT_PWR_DN_EN_LD;
216 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); 233 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
234 bcmgenet_mii_reset(dev);
217} 235}
218 236
219static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) 237static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 501e1438d153..b2a32209ffbf 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3261,7 +3261,7 @@ static void fec_reset_phy(struct platform_device *pdev)
3261 return; 3261 return;
3262 } 3262 }
3263 msleep(msec); 3263 msleep(msec);
3264 gpio_set_value(phy_reset, 1); 3264 gpio_set_value_cansleep(phy_reset, 1);
3265} 3265}
3266#else /* CONFIG_OF */ 3266#else /* CONFIG_OF */
3267static void fec_reset_phy(struct platform_device *pdev) 3267static void fec_reset_phy(struct platform_device *pdev)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index e06bef5dd6a9..dc5d34e1d01e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1212,15 +1212,15 @@ static int sh_eth_ring_init(struct net_device *ndev)
1212 mdp->rx_buf_sz += NET_IP_ALIGN; 1212 mdp->rx_buf_sz += NET_IP_ALIGN;
1213 1213
1214 /* Allocate RX and TX skb rings */ 1214 /* Allocate RX and TX skb rings */
1215 mdp->rx_skbuff = kmalloc_array(mdp->num_rx_ring, 1215 mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff),
1216 sizeof(*mdp->rx_skbuff), GFP_KERNEL); 1216 GFP_KERNEL);
1217 if (!mdp->rx_skbuff) { 1217 if (!mdp->rx_skbuff) {
1218 ret = -ENOMEM; 1218 ret = -ENOMEM;
1219 return ret; 1219 return ret;
1220 } 1220 }
1221 1221
1222 mdp->tx_skbuff = kmalloc_array(mdp->num_tx_ring, 1222 mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff),
1223 sizeof(*mdp->tx_skbuff), GFP_KERNEL); 1223 GFP_KERNEL);
1224 if (!mdp->tx_skbuff) { 1224 if (!mdp->tx_skbuff) {
1225 ret = -ENOMEM; 1225 ret = -ENOMEM;
1226 goto skb_ring_free; 1226 goto skb_ring_free;
@@ -1232,7 +1232,7 @@ static int sh_eth_ring_init(struct net_device *ndev)
1232 GFP_KERNEL); 1232 GFP_KERNEL);
1233 if (!mdp->rx_ring) { 1233 if (!mdp->rx_ring) {
1234 ret = -ENOMEM; 1234 ret = -ENOMEM;
1235 goto desc_ring_free; 1235 goto skb_ring_free;
1236 } 1236 }
1237 1237
1238 mdp->dirty_rx = 0; 1238 mdp->dirty_rx = 0;
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 78b7b7bcae37..bc6d21b471be 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1855,7 +1855,9 @@ static void efx_ef10_tx_write(struct efx_tx_queue *tx_queue)
1855 unsigned int write_ptr; 1855 unsigned int write_ptr;
1856 efx_qword_t *txd; 1856 efx_qword_t *txd;
1857 1857
1858 BUG_ON(tx_queue->write_count == tx_queue->insert_count); 1858 tx_queue->xmit_more_available = false;
1859 if (unlikely(tx_queue->write_count == tx_queue->insert_count))
1860 return;
1859 1861
1860 do { 1862 do {
1861 write_ptr = tx_queue->write_count & tx_queue->ptr_mask; 1863 write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index f08266f0eca2..5a1c5a8f278a 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -321,7 +321,9 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue)
321 unsigned write_ptr; 321 unsigned write_ptr;
322 unsigned old_write_count = tx_queue->write_count; 322 unsigned old_write_count = tx_queue->write_count;
323 323
324 BUG_ON(tx_queue->write_count == tx_queue->insert_count); 324 tx_queue->xmit_more_available = false;
325 if (unlikely(tx_queue->write_count == tx_queue->insert_count))
326 return;
325 327
326 do { 328 do {
327 write_ptr = tx_queue->write_count & tx_queue->ptr_mask; 329 write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 229e68c89634..a8ddd122f685 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -219,6 +219,7 @@ struct efx_tx_buffer {
219 * @tso_packets: Number of packets via the TSO xmit path 219 * @tso_packets: Number of packets via the TSO xmit path
220 * @pushes: Number of times the TX push feature has been used 220 * @pushes: Number of times the TX push feature has been used
221 * @pio_packets: Number of times the TX PIO feature has been used 221 * @pio_packets: Number of times the TX PIO feature has been used
222 * @xmit_more_available: Are any packets waiting to be pushed to the NIC
222 * @empty_read_count: If the completion path has seen the queue as empty 223 * @empty_read_count: If the completion path has seen the queue as empty
223 * and the transmission path has not yet checked this, the value of 224 * and the transmission path has not yet checked this, the value of
224 * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0. 225 * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0.
@@ -253,6 +254,7 @@ struct efx_tx_queue {
253 unsigned int tso_packets; 254 unsigned int tso_packets;
254 unsigned int pushes; 255 unsigned int pushes;
255 unsigned int pio_packets; 256 unsigned int pio_packets;
257 bool xmit_more_available;
256 /* Statistics to supplement MAC stats */ 258 /* Statistics to supplement MAC stats */
257 unsigned long tx_packets; 259 unsigned long tx_packets;
258 260
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 1833a0146571..67f6afaa022f 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -431,8 +431,20 @@ finish_packet:
431 efx_tx_maybe_stop_queue(tx_queue); 431 efx_tx_maybe_stop_queue(tx_queue);
432 432
433 /* Pass off to hardware */ 433 /* Pass off to hardware */
434 if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) 434 if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) {
435 struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue);
436
437 /* There could be packets left on the partner queue if those
438 * SKBs had skb->xmit_more set. If we do not push those they
439 * could be left for a long time and cause a netdev watchdog.
440 */
441 if (txq2->xmit_more_available)
442 efx_nic_push_buffers(txq2);
443
435 efx_nic_push_buffers(tx_queue); 444 efx_nic_push_buffers(tx_queue);
445 } else {
446 tx_queue->xmit_more_available = skb->xmit_more;
447 }
436 448
437 tx_queue->tx_packets++; 449 tx_queue->tx_packets++;
438 450
@@ -722,6 +734,7 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue)
722 tx_queue->read_count = 0; 734 tx_queue->read_count = 0;
723 tx_queue->old_read_count = 0; 735 tx_queue->old_read_count = 0;
724 tx_queue->empty_read_count = 0 | EFX_EMPTY_COUNT_VALID; 736 tx_queue->empty_read_count = 0 | EFX_EMPTY_COUNT_VALID;
737 tx_queue->xmit_more_available = false;
725 738
726 /* Set up TX descriptor ring */ 739 /* Set up TX descriptor ring */
727 efx_nic_init_tx(tx_queue); 740 efx_nic_init_tx(tx_queue);
@@ -747,6 +760,7 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue)
747 760
748 ++tx_queue->read_count; 761 ++tx_queue->read_count;
749 } 762 }
763 tx_queue->xmit_more_available = false;
750 netdev_tx_reset_queue(tx_queue->core_txq); 764 netdev_tx_reset_queue(tx_queue->core_txq);
751} 765}
752 766
@@ -1302,8 +1316,20 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,
1302 efx_tx_maybe_stop_queue(tx_queue); 1316 efx_tx_maybe_stop_queue(tx_queue);
1303 1317
1304 /* Pass off to hardware */ 1318 /* Pass off to hardware */
1305 if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) 1319 if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) {
1320 struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue);
1321
1322 /* There could be packets left on the partner queue if those
1323 * SKBs had skb->xmit_more set. If we do not push those they
1324 * could be left for a long time and cause a netdev watchdog.
1325 */
1326 if (txq2->xmit_more_available)
1327 efx_nic_push_buffers(txq2);
1328
1306 efx_nic_push_buffers(tx_queue); 1329 efx_nic_push_buffers(tx_queue);
1330 } else {
1331 tx_queue->xmit_more_available = skb->xmit_more;
1332 }
1307 1333
1308 tx_queue->tso_bursts++; 1334 tx_queue->tso_bursts++;
1309 return NETDEV_TX_OK; 1335 return NETDEV_TX_OK;
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 3b4cd8a263de..c860c9007e49 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1052,6 +1052,7 @@ static int smsc911x_mii_probe(struct net_device *dev)
1052#ifdef USE_PHY_WORK_AROUND 1052#ifdef USE_PHY_WORK_AROUND
1053 if (smsc911x_phy_loopbacktest(dev) < 0) { 1053 if (smsc911x_phy_loopbacktest(dev) < 0) {
1054 SMSC_WARN(pdata, hw, "Failed Loop Back Test"); 1054 SMSC_WARN(pdata, hw, "Failed Loop Back Test");
1055 phy_disconnect(phydev);
1055 return -ENODEV; 1056 return -ENODEV;
1056 } 1057 }
1057 SMSC_TRACE(pdata, hw, "Passed Loop Back Test"); 1058 SMSC_TRACE(pdata, hw, "Passed Loop Back Test");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 771cda2a48b2..2e51b816a7e8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -721,10 +721,13 @@ static int stmmac_get_ts_info(struct net_device *dev,
721{ 721{
722 struct stmmac_priv *priv = netdev_priv(dev); 722 struct stmmac_priv *priv = netdev_priv(dev);
723 723
724 if ((priv->hwts_tx_en) && (priv->hwts_rx_en)) { 724 if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) {
725 725
726 info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | 726 info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
727 SOF_TIMESTAMPING_TX_HARDWARE |
728 SOF_TIMESTAMPING_RX_SOFTWARE |
727 SOF_TIMESTAMPING_RX_HARDWARE | 729 SOF_TIMESTAMPING_RX_HARDWARE |
730 SOF_TIMESTAMPING_SOFTWARE |
728 SOF_TIMESTAMPING_RAW_HARDWARE; 731 SOF_TIMESTAMPING_RAW_HARDWARE;
729 732
730 if (priv->ptp_clock) 733 if (priv->ptp_clock)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 383389146099..0bfbabad4431 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -205,6 +205,37 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
205} 205}
206EXPORT_SYMBOL(phy_device_create); 206EXPORT_SYMBOL(phy_device_create);
207 207
208/* get_phy_c45_devs_in_pkg - reads a MMD's devices in package registers.
209 * @bus: the target MII bus
210 * @addr: PHY address on the MII bus
211 * @dev_addr: MMD address in the PHY.
212 * @devices_in_package: where to store the devices in package information.
213 *
214 * Description: reads devices in package registers of a MMD at @dev_addr
215 * from PHY at @addr on @bus.
216 *
217 * Returns: 0 on success, -EIO on failure.
218 */
219static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr,
220 u32 *devices_in_package)
221{
222 int phy_reg, reg_addr;
223
224 reg_addr = MII_ADDR_C45 | dev_addr << 16 | MDIO_DEVS2;
225 phy_reg = mdiobus_read(bus, addr, reg_addr);
226 if (phy_reg < 0)
227 return -EIO;
228 *devices_in_package = (phy_reg & 0xffff) << 16;
229
230 reg_addr = MII_ADDR_C45 | dev_addr << 16 | MDIO_DEVS1;
231 phy_reg = mdiobus_read(bus, addr, reg_addr);
232 if (phy_reg < 0)
233 return -EIO;
234 *devices_in_package |= (phy_reg & 0xffff);
235
236 return 0;
237}
238
208/** 239/**
209 * get_phy_c45_ids - reads the specified addr for its 802.3-c45 IDs. 240 * get_phy_c45_ids - reads the specified addr for its 802.3-c45 IDs.
210 * @bus: the target MII bus 241 * @bus: the target MII bus
@@ -223,38 +254,31 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
223 int phy_reg; 254 int phy_reg;
224 int i, reg_addr; 255 int i, reg_addr;
225 const int num_ids = ARRAY_SIZE(c45_ids->device_ids); 256 const int num_ids = ARRAY_SIZE(c45_ids->device_ids);
257 u32 *devs = &c45_ids->devices_in_package;
226 258
227 /* Find first non-zero Devices In package. Device 259 /* Find first non-zero Devices In package. Device zero is reserved
228 * zero is reserved, so don't probe it. 260 * for 802.3 c45 complied PHYs, so don't probe it at first.
229 */ 261 */
230 for (i = 1; 262 for (i = 1; i < num_ids && *devs == 0; i++) {
231 i < num_ids && c45_ids->devices_in_package == 0; 263 phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, devs);
232 i++) {
233retry: reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2;
234 phy_reg = mdiobus_read(bus, addr, reg_addr);
235 if (phy_reg < 0) 264 if (phy_reg < 0)
236 return -EIO; 265 return -EIO;
237 c45_ids->devices_in_package = (phy_reg & 0xffff) << 16;
238 266
239 reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS1; 267 if ((*devs & 0x1fffffff) == 0x1fffffff) {
240 phy_reg = mdiobus_read(bus, addr, reg_addr); 268 /* If mostly Fs, there is no device there,
241 if (phy_reg < 0) 269 * then let's continue to probe more, as some
242 return -EIO; 270 * 10G PHYs have zero Devices In package,
243 c45_ids->devices_in_package |= (phy_reg & 0xffff); 271 * e.g. Cortina CS4315/CS4340 PHY.
244 272 */
245 if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) { 273 phy_reg = get_phy_c45_devs_in_pkg(bus, addr, 0, devs);
246 if (i) { 274 if (phy_reg < 0)
247 /* If mostly Fs, there is no device there, 275 return -EIO;
248 * then let's continue to probe more, as some 276 /* no device there, let's get out of here */
249 * 10G PHYs have zero Devices In package, 277 if ((*devs & 0x1fffffff) == 0x1fffffff) {
250 * e.g. Cortina CS4315/CS4340 PHY.
251 */
252 i = 0;
253 goto retry;
254 } else {
255 /* no device there, let's get out of here */
256 *phy_id = 0xffffffff; 278 *phy_id = 0xffffffff;
257 return 0; 279 return 0;
280 } else {
281 break;
258 } 282 }
259 } 283 }
260 } 284 }
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index ed00446759b2..9a863c6a6a33 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -721,10 +721,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
721 val &= 0xffff; 721 val &= 0xffff;
722 } 722 }
723 vj = slhc_init(val2+1, val+1); 723 vj = slhc_init(val2+1, val+1);
724 if (!vj) { 724 if (IS_ERR(vj)) {
725 netdev_err(ppp->dev, 725 err = PTR_ERR(vj);
726 "PPP: no memory (VJ compressor)\n");
727 err = -ENOMEM;
728 break; 726 break;
729 } 727 }
730 ppp_lock(ppp); 728 ppp_lock(ppp);
diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
index 079f7adfcde5..27ed25252aac 100644
--- a/drivers/net/slip/slhc.c
+++ b/drivers/net/slip/slhc.c
@@ -84,8 +84,9 @@ static long decode(unsigned char **cpp);
84static unsigned char * put16(unsigned char *cp, unsigned short x); 84static unsigned char * put16(unsigned char *cp, unsigned short x);
85static unsigned short pull16(unsigned char **cpp); 85static unsigned short pull16(unsigned char **cpp);
86 86
87/* Initialize compression data structure 87/* Allocate compression data structure
88 * slots must be in range 0 to 255 (zero meaning no compression) 88 * slots must be in range 0 to 255 (zero meaning no compression)
89 * Returns pointer to structure or ERR_PTR() on error.
89 */ 90 */
90struct slcompress * 91struct slcompress *
91slhc_init(int rslots, int tslots) 92slhc_init(int rslots, int tslots)
@@ -94,11 +95,14 @@ slhc_init(int rslots, int tslots)
94 register struct cstate *ts; 95 register struct cstate *ts;
95 struct slcompress *comp; 96 struct slcompress *comp;
96 97
98 if (rslots < 0 || rslots > 255 || tslots < 0 || tslots > 255)
99 return ERR_PTR(-EINVAL);
100
97 comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL); 101 comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL);
98 if (! comp) 102 if (! comp)
99 goto out_fail; 103 goto out_fail;
100 104
101 if ( rslots > 0 && rslots < 256 ) { 105 if (rslots > 0) {
102 size_t rsize = rslots * sizeof(struct cstate); 106 size_t rsize = rslots * sizeof(struct cstate);
103 comp->rstate = kzalloc(rsize, GFP_KERNEL); 107 comp->rstate = kzalloc(rsize, GFP_KERNEL);
104 if (! comp->rstate) 108 if (! comp->rstate)
@@ -106,7 +110,7 @@ slhc_init(int rslots, int tslots)
106 comp->rslot_limit = rslots - 1; 110 comp->rslot_limit = rslots - 1;
107 } 111 }
108 112
109 if ( tslots > 0 && tslots < 256 ) { 113 if (tslots > 0) {
110 size_t tsize = tslots * sizeof(struct cstate); 114 size_t tsize = tslots * sizeof(struct cstate);
111 comp->tstate = kzalloc(tsize, GFP_KERNEL); 115 comp->tstate = kzalloc(tsize, GFP_KERNEL);
112 if (! comp->tstate) 116 if (! comp->tstate)
@@ -141,7 +145,7 @@ out_free2:
141out_free: 145out_free:
142 kfree(comp); 146 kfree(comp);
143out_fail: 147out_fail:
144 return NULL; 148 return ERR_PTR(-ENOMEM);
145} 149}
146 150
147 151
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index 05387b1e2e95..a17d86a57734 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -164,7 +164,7 @@ static int sl_alloc_bufs(struct slip *sl, int mtu)
164 if (cbuff == NULL) 164 if (cbuff == NULL)
165 goto err_exit; 165 goto err_exit;
166 slcomp = slhc_init(16, 16); 166 slcomp = slhc_init(16, 16);
167 if (slcomp == NULL) 167 if (IS_ERR(slcomp))
168 goto err_exit; 168 goto err_exit;
169#endif 169#endif
170 spin_lock_bh(&sl->lock); 170 spin_lock_bh(&sl->lock);
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 75ae756e93cf..c54719984c4b 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -485,6 +485,10 @@ static const struct usb_device_id products[] = {
485 USB_CDC_PROTO_NONE), 485 USB_CDC_PROTO_NONE),
486 .driver_info = (unsigned long)&qmi_wwan_info, 486 .driver_info = (unsigned long)&qmi_wwan_info,
487 }, 487 },
488 { /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
489 USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7),
490 .driver_info = (unsigned long)&qmi_wwan_info,
491 },
488 492
489 /* 3. Combined interface devices matching on interface number */ 493 /* 3. Combined interface devices matching on interface number */
490 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ 494 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
@@ -737,7 +741,6 @@ static const struct usb_device_id products[] = {
737 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ 741 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
738 {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ 742 {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
739 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ 743 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
740 {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
741 744
742 /* 4. Gobi 1000 devices */ 745 /* 4. Gobi 1000 devices */
743 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 746 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 279f83591971..109e3ee9108c 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -41,7 +41,8 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,
41 41
42static inline void inet_ctl_sock_destroy(struct sock *sk) 42static inline void inet_ctl_sock_destroy(struct sock *sk)
43{ 43{
44 sock_release(sk->sk_socket); 44 if (sk)
45 sock_release(sk->sk_socket);
45} 46}
46 47
47#endif 48#endif
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index ac5c6e80586a..9f4df68105ab 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -317,7 +317,7 @@ void fib_flush_external(struct net *net);
317 317
318/* Exported by fib_semantics.c */ 318/* Exported by fib_semantics.c */
319int ip_fib_check_default(__be32 gw, struct net_device *dev); 319int ip_fib_check_default(__be32 gw, struct net_device *dev);
320int fib_sync_down_dev(struct net_device *dev, unsigned long event); 320int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force);
321int fib_sync_down_addr(struct net *net, __be32 local); 321int fib_sync_down_addr(struct net *net, __be32 local);
322int fib_sync_up(struct net_device *dev, unsigned int nh_flags); 322int fib_sync_up(struct net_device *dev, unsigned int nh_flags);
323 323
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index e786873c89f2..cc8f3e506cde 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1112,9 +1112,10 @@ static void nl_fib_lookup_exit(struct net *net)
1112 net->ipv4.fibnl = NULL; 1112 net->ipv4.fibnl = NULL;
1113} 1113}
1114 1114
1115static void fib_disable_ip(struct net_device *dev, unsigned long event) 1115static void fib_disable_ip(struct net_device *dev, unsigned long event,
1116 bool force)
1116{ 1117{
1117 if (fib_sync_down_dev(dev, event)) 1118 if (fib_sync_down_dev(dev, event, force))
1118 fib_flush(dev_net(dev)); 1119 fib_flush(dev_net(dev));
1119 rt_cache_flush(dev_net(dev)); 1120 rt_cache_flush(dev_net(dev));
1120 arp_ifdown(dev); 1121 arp_ifdown(dev);
@@ -1142,7 +1143,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
1142 /* Last address was deleted from this interface. 1143 /* Last address was deleted from this interface.
1143 * Disable IP. 1144 * Disable IP.
1144 */ 1145 */
1145 fib_disable_ip(dev, event); 1146 fib_disable_ip(dev, event, true);
1146 } else { 1147 } else {
1147 rt_cache_flush(dev_net(dev)); 1148 rt_cache_flush(dev_net(dev));
1148 } 1149 }
@@ -1159,7 +1160,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
1159 unsigned int flags; 1160 unsigned int flags;
1160 1161
1161 if (event == NETDEV_UNREGISTER) { 1162 if (event == NETDEV_UNREGISTER) {
1162 fib_disable_ip(dev, event); 1163 fib_disable_ip(dev, event, true);
1163 rt_flush_dev(dev); 1164 rt_flush_dev(dev);
1164 return NOTIFY_DONE; 1165 return NOTIFY_DONE;
1165 } 1166 }
@@ -1180,14 +1181,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
1180 rt_cache_flush(net); 1181 rt_cache_flush(net);
1181 break; 1182 break;
1182 case NETDEV_DOWN: 1183 case NETDEV_DOWN:
1183 fib_disable_ip(dev, event); 1184 fib_disable_ip(dev, event, false);
1184 break; 1185 break;
1185 case NETDEV_CHANGE: 1186 case NETDEV_CHANGE:
1186 flags = dev_get_flags(dev); 1187 flags = dev_get_flags(dev);
1187 if (flags & (IFF_RUNNING | IFF_LOWER_UP)) 1188 if (flags & (IFF_RUNNING | IFF_LOWER_UP))
1188 fib_sync_up(dev, RTNH_F_LINKDOWN); 1189 fib_sync_up(dev, RTNH_F_LINKDOWN);
1189 else 1190 else
1190 fib_sync_down_dev(dev, event); 1191 fib_sync_down_dev(dev, event, false);
1191 /* fall through */ 1192 /* fall through */
1192 case NETDEV_CHANGEMTU: 1193 case NETDEV_CHANGEMTU:
1193 rt_cache_flush(net); 1194 rt_cache_flush(net);
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f30df0ee4f4d..3e87447e65c7 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1343,7 +1343,13 @@ int fib_sync_down_addr(struct net *net, __be32 local)
1343 return ret; 1343 return ret;
1344} 1344}
1345 1345
1346int fib_sync_down_dev(struct net_device *dev, unsigned long event) 1346/* Event force Flags Description
1347 * NETDEV_CHANGE 0 LINKDOWN Carrier OFF, not for scope host
1348 * NETDEV_DOWN 0 LINKDOWN|DEAD Link down, not for scope host
1349 * NETDEV_DOWN 1 LINKDOWN|DEAD Last address removed
1350 * NETDEV_UNREGISTER 1 LINKDOWN|DEAD Device removed
1351 */
1352int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force)
1347{ 1353{
1348 int ret = 0; 1354 int ret = 0;
1349 int scope = RT_SCOPE_NOWHERE; 1355 int scope = RT_SCOPE_NOWHERE;
@@ -1352,8 +1358,7 @@ int fib_sync_down_dev(struct net_device *dev, unsigned long event)
1352 struct hlist_head *head = &fib_info_devhash[hash]; 1358 struct hlist_head *head = &fib_info_devhash[hash];
1353 struct fib_nh *nh; 1359 struct fib_nh *nh;
1354 1360
1355 if (event == NETDEV_UNREGISTER || 1361 if (force)
1356 event == NETDEV_DOWN)
1357 scope = -1; 1362 scope = -1;
1358 1363
1359 hlist_for_each_entry(nh, head, nh_hash) { 1364 hlist_for_each_entry(nh, head, nh_hash) {
@@ -1498,6 +1503,13 @@ int fib_sync_up(struct net_device *dev, unsigned int nh_flags)
1498 if (!(dev->flags & IFF_UP)) 1503 if (!(dev->flags & IFF_UP))
1499 return 0; 1504 return 0;
1500 1505
1506 if (nh_flags & RTNH_F_DEAD) {
1507 unsigned int flags = dev_get_flags(dev);
1508
1509 if (flags & (IFF_RUNNING | IFF_LOWER_UP))
1510 nh_flags |= RTNH_F_LINKDOWN;
1511 }
1512
1501 prev_fi = NULL; 1513 prev_fi = NULL;
1502 hash = fib_devindex_hashfn(dev->ifindex); 1514 hash = fib_devindex_hashfn(dev->ifindex);
1503 head = &fib_info_devhash[hash]; 1515 head = &fib_info_devhash[hash];
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index fc42525d8694..92dd4b74d513 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1683,8 +1683,8 @@ static inline int ipmr_forward_finish(struct net *net, struct sock *sk,
1683{ 1683{
1684 struct ip_options *opt = &(IPCB(skb)->opt); 1684 struct ip_options *opt = &(IPCB(skb)->opt);
1685 1685
1686 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTFORWDATAGRAMS); 1686 IP_INC_STATS(net, IPSTATS_MIB_OUTFORWDATAGRAMS);
1687 IP_ADD_STATS_BH(net, IPSTATS_MIB_OUTOCTETS, skb->len); 1687 IP_ADD_STATS(net, IPSTATS_MIB_OUTOCTETS, skb->len);
1688 1688
1689 if (unlikely(opt->optlen)) 1689 if (unlikely(opt->optlen))
1690 ip_forward_options(skb); 1690 ip_forward_options(skb);
@@ -1746,7 +1746,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt,
1746 * to blackhole. 1746 * to blackhole.
1747 */ 1747 */
1748 1748
1749 IP_INC_STATS_BH(net, IPSTATS_MIB_FRAGFAILS); 1749 IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS);
1750 ip_rt_put(rt); 1750 ip_rt_put(rt);
1751 goto out_free; 1751 goto out_free;
1752 } 1752 }
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2701cb3d88e9..c8bc9b4ac328 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2080,7 +2080,6 @@ static int ip6_route_del(struct fib6_config *cfg)
2080 2080
2081static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb) 2081static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb)
2082{ 2082{
2083 struct net *net = dev_net(skb->dev);
2084 struct netevent_redirect netevent; 2083 struct netevent_redirect netevent;
2085 struct rt6_info *rt, *nrt = NULL; 2084 struct rt6_info *rt, *nrt = NULL;
2086 struct ndisc_options ndopts; 2085 struct ndisc_options ndopts;
@@ -2141,7 +2140,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
2141 } 2140 }
2142 2141
2143 rt = (struct rt6_info *) dst; 2142 rt = (struct rt6_info *) dst;
2144 if (rt == net->ipv6.ip6_null_entry) { 2143 if (rt->rt6i_flags & RTF_REJECT) {
2145 net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop for redirect target\n"); 2144 net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop for redirect target\n");
2146 return; 2145 return;
2147 } 2146 }
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 94428fd85b2f..dcccae86190f 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1394,34 +1394,20 @@ static int ipip6_tunnel_init(struct net_device *dev)
1394 return 0; 1394 return 0;
1395} 1395}
1396 1396
1397static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) 1397static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1398{ 1398{
1399 struct ip_tunnel *tunnel = netdev_priv(dev); 1399 struct ip_tunnel *tunnel = netdev_priv(dev);
1400 struct iphdr *iph = &tunnel->parms.iph; 1400 struct iphdr *iph = &tunnel->parms.iph;
1401 struct net *net = dev_net(dev); 1401 struct net *net = dev_net(dev);
1402 struct sit_net *sitn = net_generic(net, sit_net_id); 1402 struct sit_net *sitn = net_generic(net, sit_net_id);
1403 1403
1404 tunnel->dev = dev;
1405 tunnel->net = dev_net(dev);
1406
1407 iph->version = 4; 1404 iph->version = 4;
1408 iph->protocol = IPPROTO_IPV6; 1405 iph->protocol = IPPROTO_IPV6;
1409 iph->ihl = 5; 1406 iph->ihl = 5;
1410 iph->ttl = 64; 1407 iph->ttl = 64;
1411 1408
1412 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
1413 if (!dev->tstats)
1414 return -ENOMEM;
1415
1416 tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst);
1417 if (!tunnel->dst_cache) {
1418 free_percpu(dev->tstats);
1419 return -ENOMEM;
1420 }
1421
1422 dev_hold(dev); 1409 dev_hold(dev);
1423 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); 1410 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
1424 return 0;
1425} 1411}
1426 1412
1427static int ipip6_validate(struct nlattr *tb[], struct nlattr *data[]) 1413static int ipip6_validate(struct nlattr *tb[], struct nlattr *data[])
@@ -1831,23 +1817,19 @@ static int __net_init sit_init_net(struct net *net)
1831 */ 1817 */
1832 sitn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; 1818 sitn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
1833 1819
1834 err = ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
1835 if (err)
1836 goto err_dev_free;
1837
1838 ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
1839 err = register_netdev(sitn->fb_tunnel_dev); 1820 err = register_netdev(sitn->fb_tunnel_dev);
1840 if (err) 1821 if (err)
1841 goto err_reg_dev; 1822 goto err_reg_dev;
1842 1823
1824 ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
1825 ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
1826
1843 t = netdev_priv(sitn->fb_tunnel_dev); 1827 t = netdev_priv(sitn->fb_tunnel_dev);
1844 1828
1845 strcpy(t->parms.name, sitn->fb_tunnel_dev->name); 1829 strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
1846 return 0; 1830 return 0;
1847 1831
1848err_reg_dev: 1832err_reg_dev:
1849 dev_put(sitn->fb_tunnel_dev);
1850err_dev_free:
1851 ipip6_dev_free(sitn->fb_tunnel_dev); 1833 ipip6_dev_free(sitn->fb_tunnel_dev);
1852err_alloc_dev: 1834err_alloc_dev:
1853 return err; 1835 return err;
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c
index 3c758007b327..dae25cad05cd 100644
--- a/net/ipv6/tunnel6.c
+++ b/net/ipv6/tunnel6.c
@@ -144,6 +144,16 @@ static void tunnel6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
144 break; 144 break;
145} 145}
146 146
147static void tunnel46_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
148 u8 type, u8 code, int offset, __be32 info)
149{
150 struct xfrm6_tunnel *handler;
151
152 for_each_tunnel_rcu(tunnel46_handlers, handler)
153 if (!handler->err_handler(skb, opt, type, code, offset, info))
154 break;
155}
156
147static const struct inet6_protocol tunnel6_protocol = { 157static const struct inet6_protocol tunnel6_protocol = {
148 .handler = tunnel6_rcv, 158 .handler = tunnel6_rcv,
149 .err_handler = tunnel6_err, 159 .err_handler = tunnel6_err,
@@ -152,7 +162,7 @@ static const struct inet6_protocol tunnel6_protocol = {
152 162
153static const struct inet6_protocol tunnel46_protocol = { 163static const struct inet6_protocol tunnel46_protocol = {
154 .handler = tunnel46_rcv, 164 .handler = tunnel46_rcv,
155 .err_handler = tunnel6_err, 165 .err_handler = tunnel46_err,
156 .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, 166 .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
157}; 167};
158 168
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 816914ef228d..ad2719ad4c1b 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -48,6 +48,7 @@
48#include <linux/tipc_netlink.h> 48#include <linux/tipc_netlink.h>
49#include "core.h" 49#include "core.h"
50#include "bearer.h" 50#include "bearer.h"
51#include "msg.h"
51 52
52/* IANA assigned UDP port */ 53/* IANA assigned UDP port */
53#define UDP_PORT_DEFAULT 6118 54#define UDP_PORT_DEFAULT 6118
@@ -220,6 +221,10 @@ static int tipc_udp_recv(struct sock *sk, struct sk_buff *skb)
220{ 221{
221 struct udp_bearer *ub; 222 struct udp_bearer *ub;
222 struct tipc_bearer *b; 223 struct tipc_bearer *b;
224 int usr = msg_user(buf_msg(skb));
225
226 if ((usr == LINK_PROTOCOL) || (usr == NAME_DISTRIBUTOR))
227 skb_linearize(skb);
223 228
224 ub = rcu_dereference_sk_user_data(sk); 229 ub = rcu_dereference_sk_user_data(sk);
225 if (!ub) { 230 if (!ub) {