diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-04-18 16:24:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-04-18 16:24:42 -0400 |
commit | 40d9018eb738f724dc9c27eec88c78cc488e0af0 (patch) | |
tree | 8afd5db71fd8cb36290cfa488ce75e50a533ba24 | |
parent | fb5e2154b764812705dce84881319471d27606fb (diff) | |
parent | acf167f3f2495f0b6565f6e8ac9bd87158a0e98d (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller:
1) BPF tail call handling bug fixes from Daniel Borkmann.
2) Fix allowance of too many rx queues in sfc driver, from Bert
Kenward.
3) Non-loopback ipv6 packets claiming src of ::1 should be dropped,
from Florian Westphal.
4) Statistics requests on KSZ9031 can crash, fix from Grygorii
Strashko.
5) TX ring handling fixes in mediatek driver, from Sean Wang.
6) ip_ra_control can deadlock, fix lock acquisition ordering to fix,
from Cong WANG.
7) Fix use after free in ip_recv_error(), from Willem de Buijn.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
bpf: fix checking xdp_adjust_head on tail calls
bpf: fix cb access in socket filter programs on tail calls
ipv6: drop non loopback packets claiming to originate from ::1
net: ethernet: mediatek: fix inconsistency of port number carried in TXD
net: ethernet: mediatek: fix inconsistency between TXD and the used buffer
net: phy: micrel: fix crash when statistic requested for KSZ9031 phy
net: vrf: Fix setting NLM_F_EXCL flag when adding l3mdev rule
net: thunderx: Fix set_max_bgx_per_node for 81xx rgx
net-timestamp: avoid use-after-free in ip_recv_error
ipv4: fix a deadlock in ip_ra_control
sfc: limit the number of receive queues
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/mediatek/mtk_eth_soc.c | 31 | ||||
-rw-r--r-- | drivers/net/ethernet/mediatek/mtk_eth_soc.h | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/falcon/efx.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/micrel.c | 17 | ||||
-rw-r--r-- | drivers/net/vrf.c | 2 | ||||
-rw-r--r-- | kernel/bpf/syscall.c | 8 | ||||
-rw-r--r-- | net/core/skbuff.c | 1 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 10 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 11 | ||||
-rw-r--r-- | net/ipv4/raw.c | 2 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 10 | ||||
-rw-r--r-- | net/ipv6/ip6_input.c | 7 |
15 files changed, 69 insertions, 58 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 64a1095e4d14..a0ca68ce3fbb 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c | |||
@@ -134,6 +134,7 @@ static void set_max_bgx_per_node(struct pci_dev *pdev) | |||
134 | pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &sdevid); | 134 | pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &sdevid); |
135 | switch (sdevid) { | 135 | switch (sdevid) { |
136 | case PCI_SUBSYS_DEVID_81XX_BGX: | 136 | case PCI_SUBSYS_DEVID_81XX_BGX: |
137 | case PCI_SUBSYS_DEVID_81XX_RGX: | ||
137 | max_bgx_per_node = MAX_BGX_PER_CN81XX; | 138 | max_bgx_per_node = MAX_BGX_PER_CN81XX; |
138 | break; | 139 | break; |
139 | case PCI_SUBSYS_DEVID_83XX_BGX: | 140 | case PCI_SUBSYS_DEVID_83XX_BGX: |
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h index c5080f2cead5..6b7fe6fdd13b 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h | |||
@@ -16,6 +16,7 @@ | |||
16 | /* Subsystem device IDs */ | 16 | /* Subsystem device IDs */ |
17 | #define PCI_SUBSYS_DEVID_88XX_BGX 0xA126 | 17 | #define PCI_SUBSYS_DEVID_88XX_BGX 0xA126 |
18 | #define PCI_SUBSYS_DEVID_81XX_BGX 0xA226 | 18 | #define PCI_SUBSYS_DEVID_81XX_BGX 0xA226 |
19 | #define PCI_SUBSYS_DEVID_81XX_RGX 0xA254 | ||
19 | #define PCI_SUBSYS_DEVID_83XX_BGX 0xA326 | 20 | #define PCI_SUBSYS_DEVID_83XX_BGX 0xA326 |
20 | 21 | ||
21 | #define MAX_BGX_THUNDER 8 /* Max 2 nodes, 4 per node */ | 22 | #define MAX_BGX_THUNDER 8 /* Max 2 nodes, 4 per node */ |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 9e757684816d..93949139e62c 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | |||
@@ -613,7 +613,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
613 | struct mtk_mac *mac = netdev_priv(dev); | 613 | struct mtk_mac *mac = netdev_priv(dev); |
614 | struct mtk_eth *eth = mac->hw; | 614 | struct mtk_eth *eth = mac->hw; |
615 | struct mtk_tx_dma *itxd, *txd; | 615 | struct mtk_tx_dma *itxd, *txd; |
616 | struct mtk_tx_buf *tx_buf; | 616 | struct mtk_tx_buf *itx_buf, *tx_buf; |
617 | dma_addr_t mapped_addr; | 617 | dma_addr_t mapped_addr; |
618 | unsigned int nr_frags; | 618 | unsigned int nr_frags; |
619 | int i, n_desc = 1; | 619 | int i, n_desc = 1; |
@@ -627,8 +627,8 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
627 | fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT; | 627 | fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT; |
628 | txd4 |= fport; | 628 | txd4 |= fport; |
629 | 629 | ||
630 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); | 630 | itx_buf = mtk_desc_to_tx_buf(ring, itxd); |
631 | memset(tx_buf, 0, sizeof(*tx_buf)); | 631 | memset(itx_buf, 0, sizeof(*itx_buf)); |
632 | 632 | ||
633 | if (gso) | 633 | if (gso) |
634 | txd4 |= TX_DMA_TSO; | 634 | txd4 |= TX_DMA_TSO; |
@@ -647,9 +647,11 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
647 | return -ENOMEM; | 647 | return -ENOMEM; |
648 | 648 | ||
649 | WRITE_ONCE(itxd->txd1, mapped_addr); | 649 | WRITE_ONCE(itxd->txd1, mapped_addr); |
650 | tx_buf->flags |= MTK_TX_FLAGS_SINGLE0; | 650 | itx_buf->flags |= MTK_TX_FLAGS_SINGLE0; |
651 | dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr); | 651 | itx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 : |
652 | dma_unmap_len_set(tx_buf, dma_len0, skb_headlen(skb)); | 652 | MTK_TX_FLAGS_FPORT1; |
653 | dma_unmap_addr_set(itx_buf, dma_addr0, mapped_addr); | ||
654 | dma_unmap_len_set(itx_buf, dma_len0, skb_headlen(skb)); | ||
653 | 655 | ||
654 | /* TX SG offload */ | 656 | /* TX SG offload */ |
655 | txd = itxd; | 657 | txd = itxd; |
@@ -685,11 +687,13 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
685 | last_frag * TX_DMA_LS0)); | 687 | last_frag * TX_DMA_LS0)); |
686 | WRITE_ONCE(txd->txd4, fport); | 688 | WRITE_ONCE(txd->txd4, fport); |
687 | 689 | ||
688 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; | ||
689 | tx_buf = mtk_desc_to_tx_buf(ring, txd); | 690 | tx_buf = mtk_desc_to_tx_buf(ring, txd); |
690 | memset(tx_buf, 0, sizeof(*tx_buf)); | 691 | memset(tx_buf, 0, sizeof(*tx_buf)); |
691 | 692 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; | |
692 | tx_buf->flags |= MTK_TX_FLAGS_PAGE0; | 693 | tx_buf->flags |= MTK_TX_FLAGS_PAGE0; |
694 | tx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 : | ||
695 | MTK_TX_FLAGS_FPORT1; | ||
696 | |||
693 | dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr); | 697 | dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr); |
694 | dma_unmap_len_set(tx_buf, dma_len0, frag_map_size); | 698 | dma_unmap_len_set(tx_buf, dma_len0, frag_map_size); |
695 | frag_size -= frag_map_size; | 699 | frag_size -= frag_map_size; |
@@ -698,7 +702,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
698 | } | 702 | } |
699 | 703 | ||
700 | /* store skb to cleanup */ | 704 | /* store skb to cleanup */ |
701 | tx_buf->skb = skb; | 705 | itx_buf->skb = skb; |
702 | 706 | ||
703 | WRITE_ONCE(itxd->txd4, txd4); | 707 | WRITE_ONCE(itxd->txd4, txd4); |
704 | WRITE_ONCE(itxd->txd3, (TX_DMA_SWC | TX_DMA_PLEN0(skb_headlen(skb)) | | 708 | WRITE_ONCE(itxd->txd3, (TX_DMA_SWC | TX_DMA_PLEN0(skb_headlen(skb)) | |
@@ -1012,17 +1016,16 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget) | |||
1012 | 1016 | ||
1013 | while ((cpu != dma) && budget) { | 1017 | while ((cpu != dma) && budget) { |
1014 | u32 next_cpu = desc->txd2; | 1018 | u32 next_cpu = desc->txd2; |
1015 | int mac; | 1019 | int mac = 0; |
1016 | 1020 | ||
1017 | desc = mtk_qdma_phys_to_virt(ring, desc->txd2); | 1021 | desc = mtk_qdma_phys_to_virt(ring, desc->txd2); |
1018 | if ((desc->txd3 & TX_DMA_OWNER_CPU) == 0) | 1022 | if ((desc->txd3 & TX_DMA_OWNER_CPU) == 0) |
1019 | break; | 1023 | break; |
1020 | 1024 | ||
1021 | mac = (desc->txd4 >> TX_DMA_FPORT_SHIFT) & | ||
1022 | TX_DMA_FPORT_MASK; | ||
1023 | mac--; | ||
1024 | |||
1025 | tx_buf = mtk_desc_to_tx_buf(ring, desc); | 1025 | tx_buf = mtk_desc_to_tx_buf(ring, desc); |
1026 | if (tx_buf->flags & MTK_TX_FLAGS_FPORT1) | ||
1027 | mac = 1; | ||
1028 | |||
1026 | skb = tx_buf->skb; | 1029 | skb = tx_buf->skb; |
1027 | if (!skb) { | 1030 | if (!skb) { |
1028 | condition = 1; | 1031 | condition = 1; |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index 99b1c8e9f16f..08285a96ff70 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h | |||
@@ -406,12 +406,18 @@ struct mtk_hw_stats { | |||
406 | struct u64_stats_sync syncp; | 406 | struct u64_stats_sync syncp; |
407 | }; | 407 | }; |
408 | 408 | ||
409 | /* PDMA descriptor can point at 1-2 segments. This enum allows us to track how | ||
410 | * memory was allocated so that it can be freed properly | ||
411 | */ | ||
412 | enum mtk_tx_flags { | 409 | enum mtk_tx_flags { |
410 | /* PDMA descriptor can point at 1-2 segments. This enum allows us to | ||
411 | * track how memory was allocated so that it can be freed properly. | ||
412 | */ | ||
413 | MTK_TX_FLAGS_SINGLE0 = 0x01, | 413 | MTK_TX_FLAGS_SINGLE0 = 0x01, |
414 | MTK_TX_FLAGS_PAGE0 = 0x02, | 414 | MTK_TX_FLAGS_PAGE0 = 0x02, |
415 | |||
416 | /* MTK_TX_FLAGS_FPORTx allows tracking which port the transmitted | ||
417 | * SKB out instead of looking up through hardware TX descriptor. | ||
418 | */ | ||
419 | MTK_TX_FLAGS_FPORT0 = 0x04, | ||
420 | MTK_TX_FLAGS_FPORT1 = 0x08, | ||
415 | }; | 421 | }; |
416 | 422 | ||
417 | /* This enum allows us to identify how the clock is defined on the array of the | 423 | /* This enum allows us to identify how the clock is defined on the array of the |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 50d28261b6b9..b9cb697b2818 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -1371,6 +1371,13 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx) | |||
1371 | free_cpumask_var(thread_mask); | 1371 | free_cpumask_var(thread_mask); |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | if (count > EFX_MAX_RX_QUEUES) { | ||
1375 | netif_cond_dbg(efx, probe, efx->net_dev, !rss_cpus, warn, | ||
1376 | "Reducing number of rx queues from %u to %u.\n", | ||
1377 | count, EFX_MAX_RX_QUEUES); | ||
1378 | count = EFX_MAX_RX_QUEUES; | ||
1379 | } | ||
1380 | |||
1374 | /* If RSS is requested for the PF *and* VFs then we can't write RSS | 1381 | /* If RSS is requested for the PF *and* VFs then we can't write RSS |
1375 | * table entries that are inaccessible to VFs | 1382 | * table entries that are inaccessible to VFs |
1376 | */ | 1383 | */ |
diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index f5e5cd1659a1..29614da91cbf 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c | |||
@@ -1354,6 +1354,13 @@ static unsigned int ef4_wanted_parallelism(struct ef4_nic *efx) | |||
1354 | free_cpumask_var(thread_mask); | 1354 | free_cpumask_var(thread_mask); |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | if (count > EF4_MAX_RX_QUEUES) { | ||
1358 | netif_cond_dbg(efx, probe, efx->net_dev, !rss_cpus, warn, | ||
1359 | "Reducing number of rx queues from %u to %u.\n", | ||
1360 | count, EF4_MAX_RX_QUEUES); | ||
1361 | count = EF4_MAX_RX_QUEUES; | ||
1362 | } | ||
1363 | |||
1357 | return count; | 1364 | return count; |
1358 | } | 1365 | } |
1359 | 1366 | ||
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 6742070ca676..1326d99771c1 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -798,9 +798,6 @@ static struct phy_driver ksphy_driver[] = { | |||
798 | .read_status = genphy_read_status, | 798 | .read_status = genphy_read_status, |
799 | .ack_interrupt = kszphy_ack_interrupt, | 799 | .ack_interrupt = kszphy_ack_interrupt, |
800 | .config_intr = kszphy_config_intr, | 800 | .config_intr = kszphy_config_intr, |
801 | .get_sset_count = kszphy_get_sset_count, | ||
802 | .get_strings = kszphy_get_strings, | ||
803 | .get_stats = kszphy_get_stats, | ||
804 | .suspend = genphy_suspend, | 801 | .suspend = genphy_suspend, |
805 | .resume = genphy_resume, | 802 | .resume = genphy_resume, |
806 | }, { | 803 | }, { |
@@ -940,9 +937,6 @@ static struct phy_driver ksphy_driver[] = { | |||
940 | .read_status = genphy_read_status, | 937 | .read_status = genphy_read_status, |
941 | .ack_interrupt = kszphy_ack_interrupt, | 938 | .ack_interrupt = kszphy_ack_interrupt, |
942 | .config_intr = kszphy_config_intr, | 939 | .config_intr = kszphy_config_intr, |
943 | .get_sset_count = kszphy_get_sset_count, | ||
944 | .get_strings = kszphy_get_strings, | ||
945 | .get_stats = kszphy_get_stats, | ||
946 | .suspend = genphy_suspend, | 940 | .suspend = genphy_suspend, |
947 | .resume = genphy_resume, | 941 | .resume = genphy_resume, |
948 | }, { | 942 | }, { |
@@ -952,6 +946,7 @@ static struct phy_driver ksphy_driver[] = { | |||
952 | .features = PHY_GBIT_FEATURES, | 946 | .features = PHY_GBIT_FEATURES, |
953 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 947 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
954 | .driver_data = &ksz9021_type, | 948 | .driver_data = &ksz9021_type, |
949 | .probe = kszphy_probe, | ||
955 | .config_init = ksz9021_config_init, | 950 | .config_init = ksz9021_config_init, |
956 | .config_aneg = genphy_config_aneg, | 951 | .config_aneg = genphy_config_aneg, |
957 | .read_status = genphy_read_status, | 952 | .read_status = genphy_read_status, |
@@ -971,6 +966,7 @@ static struct phy_driver ksphy_driver[] = { | |||
971 | .features = PHY_GBIT_FEATURES, | 966 | .features = PHY_GBIT_FEATURES, |
972 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 967 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
973 | .driver_data = &ksz9021_type, | 968 | .driver_data = &ksz9021_type, |
969 | .probe = kszphy_probe, | ||
974 | .config_init = ksz9031_config_init, | 970 | .config_init = ksz9031_config_init, |
975 | .config_aneg = genphy_config_aneg, | 971 | .config_aneg = genphy_config_aneg, |
976 | .read_status = ksz9031_read_status, | 972 | .read_status = ksz9031_read_status, |
@@ -989,9 +985,6 @@ static struct phy_driver ksphy_driver[] = { | |||
989 | .config_init = kszphy_config_init, | 985 | .config_init = kszphy_config_init, |
990 | .config_aneg = ksz8873mll_config_aneg, | 986 | .config_aneg = ksz8873mll_config_aneg, |
991 | .read_status = ksz8873mll_read_status, | 987 | .read_status = ksz8873mll_read_status, |
992 | .get_sset_count = kszphy_get_sset_count, | ||
993 | .get_strings = kszphy_get_strings, | ||
994 | .get_stats = kszphy_get_stats, | ||
995 | .suspend = genphy_suspend, | 988 | .suspend = genphy_suspend, |
996 | .resume = genphy_resume, | 989 | .resume = genphy_resume, |
997 | }, { | 990 | }, { |
@@ -1003,9 +996,6 @@ static struct phy_driver ksphy_driver[] = { | |||
1003 | .config_init = kszphy_config_init, | 996 | .config_init = kszphy_config_init, |
1004 | .config_aneg = genphy_config_aneg, | 997 | .config_aneg = genphy_config_aneg, |
1005 | .read_status = genphy_read_status, | 998 | .read_status = genphy_read_status, |
1006 | .get_sset_count = kszphy_get_sset_count, | ||
1007 | .get_strings = kszphy_get_strings, | ||
1008 | .get_stats = kszphy_get_stats, | ||
1009 | .suspend = genphy_suspend, | 999 | .suspend = genphy_suspend, |
1010 | .resume = genphy_resume, | 1000 | .resume = genphy_resume, |
1011 | }, { | 1001 | }, { |
@@ -1017,9 +1007,6 @@ static struct phy_driver ksphy_driver[] = { | |||
1017 | .config_init = kszphy_config_init, | 1007 | .config_init = kszphy_config_init, |
1018 | .config_aneg = ksz8873mll_config_aneg, | 1008 | .config_aneg = ksz8873mll_config_aneg, |
1019 | .read_status = ksz8873mll_read_status, | 1009 | .read_status = ksz8873mll_read_status, |
1020 | .get_sset_count = kszphy_get_sset_count, | ||
1021 | .get_strings = kszphy_get_strings, | ||
1022 | .get_stats = kszphy_get_stats, | ||
1023 | .suspend = genphy_suspend, | 1010 | .suspend = genphy_suspend, |
1024 | .resume = genphy_resume, | 1011 | .resume = genphy_resume, |
1025 | } }; | 1012 | } }; |
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index d6988db1930d..7d909c8183e9 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c | |||
@@ -1128,7 +1128,7 @@ static int vrf_fib_rule(const struct net_device *dev, __u8 family, bool add_it) | |||
1128 | goto nla_put_failure; | 1128 | goto nla_put_failure; |
1129 | 1129 | ||
1130 | /* rule only needs to appear once */ | 1130 | /* rule only needs to appear once */ |
1131 | nlh->nlmsg_flags &= NLM_F_EXCL; | 1131 | nlh->nlmsg_flags |= NLM_F_EXCL; |
1132 | 1132 | ||
1133 | frh = nlmsg_data(nlh); | 1133 | frh = nlmsg_data(nlh); |
1134 | memset(frh, 0, sizeof(*frh)); | 1134 | memset(frh, 0, sizeof(*frh)); |
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 7af0dcc5d755..821f9e807de5 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -617,6 +617,14 @@ static void fixup_bpf_calls(struct bpf_prog *prog) | |||
617 | if (insn->imm == BPF_FUNC_xdp_adjust_head) | 617 | if (insn->imm == BPF_FUNC_xdp_adjust_head) |
618 | prog->xdp_adjust_head = 1; | 618 | prog->xdp_adjust_head = 1; |
619 | if (insn->imm == BPF_FUNC_tail_call) { | 619 | if (insn->imm == BPF_FUNC_tail_call) { |
620 | /* If we tail call into other programs, we | ||
621 | * cannot make any assumptions since they | ||
622 | * can be replaced dynamically during runtime | ||
623 | * in the program array. | ||
624 | */ | ||
625 | prog->cb_access = 1; | ||
626 | prog->xdp_adjust_head = 1; | ||
627 | |||
620 | /* mark bpf_tail_call as different opcode | 628 | /* mark bpf_tail_call as different opcode |
621 | * to avoid conditional branch in | 629 | * to avoid conditional branch in |
622 | * interpeter for every normal call | 630 | * interpeter for every normal call |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 9f781092fda9..35c1e2460206 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3807,6 +3807,7 @@ static void __skb_complete_tx_timestamp(struct sk_buff *skb, | |||
3807 | serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING; | 3807 | serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING; |
3808 | serr->ee.ee_info = tstype; | 3808 | serr->ee.ee_info = tstype; |
3809 | serr->opt_stats = opt_stats; | 3809 | serr->opt_stats = opt_stats; |
3810 | serr->header.h4.iif = skb->dev ? skb->dev->ifindex : 0; | ||
3810 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { | 3811 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { |
3811 | serr->ee.ee_data = skb_shinfo(skb)->tskey; | 3812 | serr->ee.ee_data = skb_shinfo(skb)->tskey; |
3812 | if (sk->sk_protocol == IPPROTO_TCP && | 3813 | if (sk->sk_protocol == IPPROTO_TCP && |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index ebd953bc5607..1d46d05efb0f 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -488,16 +488,15 @@ static bool ipv4_datagram_support_cmsg(const struct sock *sk, | |||
488 | return false; | 488 | return false; |
489 | 489 | ||
490 | /* Support IP_PKTINFO on tstamp packets if requested, to correlate | 490 | /* Support IP_PKTINFO on tstamp packets if requested, to correlate |
491 | * timestamp with egress dev. Not possible for packets without dev | 491 | * timestamp with egress dev. Not possible for packets without iif |
492 | * or without payload (SOF_TIMESTAMPING_OPT_TSONLY). | 492 | * or without payload (SOF_TIMESTAMPING_OPT_TSONLY). |
493 | */ | 493 | */ |
494 | if ((!(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_CMSG)) || | 494 | info = PKTINFO_SKB_CB(skb); |
495 | (!skb->dev)) | 495 | if (!(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_CMSG) || |
496 | !info->ipi_ifindex) | ||
496 | return false; | 497 | return false; |
497 | 498 | ||
498 | info = PKTINFO_SKB_CB(skb); | ||
499 | info->ipi_spec_dst.s_addr = ip_hdr(skb)->saddr; | 499 | info->ipi_spec_dst.s_addr = ip_hdr(skb)->saddr; |
500 | info->ipi_ifindex = skb->dev->ifindex; | ||
501 | return true; | 500 | return true; |
502 | } | 501 | } |
503 | 502 | ||
@@ -591,6 +590,7 @@ static bool setsockopt_needs_rtnl(int optname) | |||
591 | case MCAST_LEAVE_GROUP: | 590 | case MCAST_LEAVE_GROUP: |
592 | case MCAST_LEAVE_SOURCE_GROUP: | 591 | case MCAST_LEAVE_SOURCE_GROUP: |
593 | case MCAST_UNBLOCK_SOURCE: | 592 | case MCAST_UNBLOCK_SOURCE: |
593 | case IP_ROUTER_ALERT: | ||
594 | return true; | 594 | return true; |
595 | } | 595 | } |
596 | return false; | 596 | return false; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index c0317c940bcd..b036e85e093b 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1278,7 +1278,7 @@ static void mrtsock_destruct(struct sock *sk) | |||
1278 | struct net *net = sock_net(sk); | 1278 | struct net *net = sock_net(sk); |
1279 | struct mr_table *mrt; | 1279 | struct mr_table *mrt; |
1280 | 1280 | ||
1281 | rtnl_lock(); | 1281 | ASSERT_RTNL(); |
1282 | ipmr_for_each_table(mrt, net) { | 1282 | ipmr_for_each_table(mrt, net) { |
1283 | if (sk == rtnl_dereference(mrt->mroute_sk)) { | 1283 | if (sk == rtnl_dereference(mrt->mroute_sk)) { |
1284 | IPV4_DEVCONF_ALL(net, MC_FORWARDING)--; | 1284 | IPV4_DEVCONF_ALL(net, MC_FORWARDING)--; |
@@ -1289,7 +1289,6 @@ static void mrtsock_destruct(struct sock *sk) | |||
1289 | mroute_clean_tables(mrt, false); | 1289 | mroute_clean_tables(mrt, false); |
1290 | } | 1290 | } |
1291 | } | 1291 | } |
1292 | rtnl_unlock(); | ||
1293 | } | 1292 | } |
1294 | 1293 | ||
1295 | /* Socket options and virtual interface manipulation. The whole | 1294 | /* Socket options and virtual interface manipulation. The whole |
@@ -1353,13 +1352,8 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, | |||
1353 | if (sk != rcu_access_pointer(mrt->mroute_sk)) { | 1352 | if (sk != rcu_access_pointer(mrt->mroute_sk)) { |
1354 | ret = -EACCES; | 1353 | ret = -EACCES; |
1355 | } else { | 1354 | } else { |
1356 | /* We need to unlock here because mrtsock_destruct takes | ||
1357 | * care of rtnl itself and we can't change that due to | ||
1358 | * the IP_ROUTER_ALERT setsockopt which runs without it. | ||
1359 | */ | ||
1360 | rtnl_unlock(); | ||
1361 | ret = ip_ra_control(sk, 0, NULL); | 1355 | ret = ip_ra_control(sk, 0, NULL); |
1362 | goto out; | 1356 | goto out_unlock; |
1363 | } | 1357 | } |
1364 | break; | 1358 | break; |
1365 | case MRT_ADD_VIF: | 1359 | case MRT_ADD_VIF: |
@@ -1470,7 +1464,6 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, | |||
1470 | } | 1464 | } |
1471 | out_unlock: | 1465 | out_unlock: |
1472 | rtnl_unlock(); | 1466 | rtnl_unlock(); |
1473 | out: | ||
1474 | return ret; | 1467 | return ret; |
1475 | } | 1468 | } |
1476 | 1469 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 8119e1f66e03..9d943974de2b 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -682,7 +682,9 @@ static void raw_close(struct sock *sk, long timeout) | |||
682 | /* | 682 | /* |
683 | * Raw sockets may have direct kernel references. Kill them. | 683 | * Raw sockets may have direct kernel references. Kill them. |
684 | */ | 684 | */ |
685 | rtnl_lock(); | ||
685 | ip_ra_control(sk, 0, NULL); | 686 | ip_ra_control(sk, 0, NULL); |
687 | rtnl_unlock(); | ||
686 | 688 | ||
687 | sk_common_release(sk); | 689 | sk_common_release(sk); |
688 | } | 690 | } |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index eec27f87efac..e011122ebd43 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -405,9 +405,6 @@ static inline bool ipv6_datagram_support_addr(struct sock_exterr_skb *serr) | |||
405 | * At one point, excluding local errors was a quick test to identify icmp/icmp6 | 405 | * At one point, excluding local errors was a quick test to identify icmp/icmp6 |
406 | * errors. This is no longer true, but the test remained, so the v6 stack, | 406 | * errors. This is no longer true, but the test remained, so the v6 stack, |
407 | * unlike v4, also honors cmsg requests on all wifi and timestamp errors. | 407 | * unlike v4, also honors cmsg requests on all wifi and timestamp errors. |
408 | * | ||
409 | * Timestamp code paths do not initialize the fields expected by cmsg: | ||
410 | * the PKTINFO fields in skb->cb[]. Fill those in here. | ||
411 | */ | 408 | */ |
412 | static bool ip6_datagram_support_cmsg(struct sk_buff *skb, | 409 | static bool ip6_datagram_support_cmsg(struct sk_buff *skb, |
413 | struct sock_exterr_skb *serr) | 410 | struct sock_exterr_skb *serr) |
@@ -419,14 +416,9 @@ static bool ip6_datagram_support_cmsg(struct sk_buff *skb, | |||
419 | if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) | 416 | if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) |
420 | return false; | 417 | return false; |
421 | 418 | ||
422 | if (!skb->dev) | 419 | if (!IP6CB(skb)->iif) |
423 | return false; | 420 | return false; |
424 | 421 | ||
425 | if (skb->protocol == htons(ETH_P_IPV6)) | ||
426 | IP6CB(skb)->iif = skb->dev->ifindex; | ||
427 | else | ||
428 | PKTINFO_SKB_CB(skb)->ipi_ifindex = skb->dev->ifindex; | ||
429 | |||
430 | return true; | 422 | return true; |
431 | } | 423 | } |
432 | 424 | ||
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index aacfb4bce153..c45b12b4431c 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -122,11 +122,14 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
122 | max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs)); | 122 | max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs)); |
123 | /* | 123 | /* |
124 | * RFC4291 2.5.3 | 124 | * RFC4291 2.5.3 |
125 | * The loopback address must not be used as the source address in IPv6 | ||
126 | * packets that are sent outside of a single node. [..] | ||
125 | * A packet received on an interface with a destination address | 127 | * A packet received on an interface with a destination address |
126 | * of loopback must be dropped. | 128 | * of loopback must be dropped. |
127 | */ | 129 | */ |
128 | if (!(dev->flags & IFF_LOOPBACK) && | 130 | if ((ipv6_addr_loopback(&hdr->saddr) || |
129 | ipv6_addr_loopback(&hdr->daddr)) | 131 | ipv6_addr_loopback(&hdr->daddr)) && |
132 | !(dev->flags & IFF_LOOPBACK)) | ||
130 | goto err; | 133 | goto err; |
131 | 134 | ||
132 | /* RFC4291 Errata ID: 3480 | 135 | /* RFC4291 Errata ID: 3480 |