History

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

David S. Miller committed 7 years ago

Commit 9eb35912 parents cf29576 07f12b251 files · +408 −106Browse files

Unified · Split

51 files
  1. arch/mips/net/ebpf_jit.c +1 −1
  2. drivers/net/dsa/lantiq_gswip.c +6 −0
  3. drivers/net/dsa/mv88e6xxx/chip.c +12 −2
  4. drivers/net/dsa/mv88e6xxx/port.c +6 −2
  5. drivers/net/dsa/mv88e6xxx/port.h +1 −0
  6. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +3 −0
  7. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c +9 −0
  8. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h +4 −0
  9. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h +13 −0
  10. drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 −0
  11. drivers/net/ethernet/microchip/enc28j60.c +1 −1
  12. drivers/net/ethernet/microchip/lan743x_main.c +12 −4
  13. drivers/net/geneve.c +8 −3
  14. drivers/net/hyperv/netvsc_drv.c +19 −3
  15. drivers/net/phy/dp83867.c +3 −0
  16. drivers/net/phy/micrel.c +12 −1
  17. drivers/net/phy/phylink.c +4 −0
  18. drivers/net/tun.c +2 −2
  19. drivers/net/xen-netback/hash.c +2 −0
  20. drivers/net/xen-netback/interface.c +7 −0
  21. drivers/net/xen-netback/netback.c +5 −5
  22. include/linux/netdevice.h +1 −1
  23. include/net/icmp.h +8 −1
  24. include/net/ip.h +3 −1
  25. kernel/bpf/syscall.c +3 −3
  26. kernel/bpf/verifier.c +2 −1
  27. net/dsa/dsa2.c +10 −6
  28. net/dsa/port.c +1 −0
  29. net/ipv4/cipso_ipv4.c +17 −3
  30. net/ipv4/fib_frontend.c +4 −0
  31. net/ipv4/icmp.c +4 −3
  32. net/ipv4/ip_input.c +5 −4
  33. net/ipv4/ip_options.c +17 −5
  34. net/ipv4/netlink.c +13 −4
  35. net/ipv4/route.c +1 −1
  36. net/ipv6/route.c +6 −1
  37. net/ipv6/sit.c +1 −0
  38. net/mpls/af_mpls.c +3 −0
  39. net/netlabel/netlabel_kapi.c +2 −1
  40. net/nfc/llcp_commands.c +20 −0
  41. net/nfc/llcp_core.c +20 −4
  42. net/sched/act_ipt.c +1 −2
  43. net/sched/act_skbedit.c +1 −2
  44. net/sched/act_tunnel_key.c +2 −1
  45. net/sched/sch_netem.c +7 −3
  46. net/sctp/chunk.c +1 −1
  47. net/socket.c +1 −0
  48. net/tipc/socket.c +5 −1
  49. tools/testing/selftests/net/pmtu.sh +80 −16
  50. tools/testing/selftests/net/udpgro.sh +4 −4
  51. tools/testing/selftests/net/udpgso_bench_rx.c +29 −13
arch/mips/net/ebpf_jit.c+1−1
@@ -1819,7 +1819,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) · 1818 unmodified lines
18191819
18201820 /* Update the icache */
18211821 flush_icache_range((unsigned long)ctx.target,
1822− (unsigned long)(ctx.target + ctx.idx * sizeof(u32)));
1822+ (unsigned long)&ctx.target[ctx.idx]);
18231823
18241824 if (bpf_jit_enable > 1)
18251825 /* Dump JIT code */
drivers/net/dsa/lantiq_gswip.c+6−0
@@ -1163,6 +1163,12 @@ static struct platform_driver gswip_driver = { · 1162 unmodified lines
11631163
11641164 module_platform_driver(gswip_driver);
11651165
1166+MODULE_FIRMWARE("lantiq/xrx300_phy11g_a21.bin");
1167+MODULE_FIRMWARE("lantiq/xrx300_phy22f_a21.bin");
1168+MODULE_FIRMWARE("lantiq/xrx200_phy11g_a14.bin");
1169+MODULE_FIRMWARE("lantiq/xrx200_phy11g_a22.bin");
1170+MODULE_FIRMWARE("lantiq/xrx200_phy22f_a14.bin");
1171+MODULE_FIRMWARE("lantiq/xrx200_phy22f_a22.bin");
11661172 MODULE_AUTHOR("Hauke Mehrtens <hauke@hauke-m.de>");
11671173 MODULE_DESCRIPTION("Lantiq / Intel GSWIP driver");
11681174 MODULE_LICENSE("GPL v2");
drivers/net/dsa/mv88e6xxx/chip.c+12−2
@@ -922,7 +922,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, · 921 unmodified lines
922922 default:
923923 return U64_MAX;
924924 }
925− value = (((u64)high) << 16) | low;
925+ value = (((u64)high) << 32) | low;
926926 return value;
927927 }
928928
@@ -3118,7 +3118,7 @@ static const struct mv88e6xxx_ops mv88e6161_ops = { · 2189 unmodified lines
31183118 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
31193119 .port_link_state = mv88e6352_port_link_state,
31203120 .port_get_cmode = mv88e6185_port_get_cmode,
3121− .stats_snapshot = mv88e6320_g1_stats_snapshot,
3121+ .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
31223122 .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
31233123 .stats_get_sset_count = mv88e6095_stats_get_sset_count,
31243124 .stats_get_strings = mv88e6095_stats_get_strings,
@@ -4620,6 +4620,14 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip, · 1495 unmodified lines
46204620 return 0;
46214621 }
46224622
4623+static void mv88e6xxx_ports_cmode_init(struct mv88e6xxx_chip *chip)
4624+{
4625+ int i;
4626+
4627+ for (i = 0; i < mv88e6xxx_num_ports(chip); i++)
4628+ chip->ports[i].cmode = MV88E6XXX_PORT_STS_CMODE_INVALID;
4629+}
4630+
46234631 static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
46244632 int port)
46254633 {
@@ -4656,6 +4664,8 @@ static const char *mv88e6xxx_drv_probe(struct device *dsa_dev, · 30 unmodified lines
46564664 if (err)
46574665 goto free;
46584666
4667+ mv88e6xxx_ports_cmode_init(chip);
4668+
46594669 mutex_lock(&chip->reg_lock);
46604670 err = mv88e6xxx_switch_reset(chip);
46614671 mutex_unlock(&chip->reg_lock);
drivers/net/dsa/mv88e6xxx/port.c+6−2
@@ -398,6 +398,10 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 397 unmodified lines
398398 cmode = 0;
399399 }
400400
401+ /* cmode doesn't change, nothing to do for us */
402+ if (cmode == chip->ports[port].cmode)
403+ return 0;
404+
401405 lane = mv88e6390x_serdes_get_lane(chip, port);
402406 if (lane < 0)
403407 return lane;
@@ -408,7 +412,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 4 unmodified lines
408412 return err;
409413 }
410414
411− err = mv88e6390_serdes_power(chip, port, false);
415+ err = mv88e6390x_serdes_power(chip, port, false);
412416 if (err)
413417 return err;
414418
@@ -424,7 +428,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 9 unmodified lines
424428 if (err)
425429 return err;
426430
427− err = mv88e6390_serdes_power(chip, port, true);
431+ err = mv88e6390x_serdes_power(chip, port, true);
428432 if (err)
429433 return err;
430434
drivers/net/dsa/mv88e6xxx/port.h+1−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #define MV88E6185_PORT_STS_CMODE_1000BASE_X 0x0005
5353 #define MV88E6185_PORT_STS_CMODE_PHY 0x0006
5454 #define MV88E6185_PORT_STS_CMODE_DISABLED 0x0007
55+#define MV88E6XXX_PORT_STS_CMODE_INVALID 0xff
5556
5657 /* Offset 0x01: MAC (or PCS or Physical) Control Register */
5758 #define MV88E6XXX_PORT_MAC_CTL 0x01
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c+3−0
@@ -279,6 +279,9 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, · 278 unmodified lines
279279
280280 static int hw_atl_b0_hw_init_tx_path(struct aq_hw_s *self)
281281 {
282+ /* Tx TC/Queue number config */
283+ hw_atl_rpb_tps_tx_tc_mode_set(self, 1U);
284+
282285 hw_atl_thm_lso_tcp_flag_of_first_pkt_set(self, 0x0FF6U);
283286 hw_atl_thm_lso_tcp_flag_of_middle_pkt_set(self, 0x0FF6U);
284287 hw_atl_thm_lso_tcp_flag_of_last_pkt_set(self, 0x0F7FU);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c+9−0
@@ -1274,6 +1274,15 @@ void hw_atl_tpb_tx_buff_en_set(struct aq_hw_s *aq_hw, u32 tx_buff_en) · 1273 unmodified lines
12741274 HW_ATL_TPB_TX_BUF_EN_SHIFT, tx_buff_en);
12751275 }
12761276
1277+void hw_atl_rpb_tps_tx_tc_mode_set(struct aq_hw_s *aq_hw,
1278+ u32 tx_traf_class_mode)
1279+{
1280+ aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TX_TC_MODE_ADDR,
1281+ HW_ATL_TPB_TX_TC_MODE_MSK,
1282+ HW_ATL_TPB_TX_TC_MODE_SHIFT,
1283+ tx_traf_class_mode);
1284+}
1285+
12771286 void hw_atl_tpb_tx_buff_hi_threshold_per_tc_set(struct aq_hw_s *aq_hw,
12781287 u32 tx_buff_hi_threshold_per_tc,
12791288 u32 buffer)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h+4−0
@@ -605,6 +605,10 @@ void hw_atl_thm_lso_tcp_flag_of_middle_pkt_set(struct aq_hw_s *aq_hw, · 604 unmodified lines
605605
606606 /* tpb */
607607
608+/* set TX Traffic Class Mode */
609+void hw_atl_rpb_tps_tx_tc_mode_set(struct aq_hw_s *aq_hw,
610+ u32 tx_traf_class_mode);
611+
608612 /* set tx buffer enable */
609613 void hw_atl_tpb_tx_buff_en_set(struct aq_hw_s *aq_hw, u32 tx_buff_en);
610614
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h+13−0
@@ -1948,6 +1948,19 @@ · 1947 unmodified lines
19481948 /* default value of bitfield tx_buf_en */
19491949 #define HW_ATL_TPB_TX_BUF_EN_DEFAULT 0x0
19501950
1951+/* register address for bitfield tx_tc_mode */
1952+#define HW_ATL_TPB_TX_TC_MODE_ADDR 0x00007900
1953+/* bitmask for bitfield tx_tc_mode */
1954+#define HW_ATL_TPB_TX_TC_MODE_MSK 0x00000100
1955+/* inverted bitmask for bitfield tx_tc_mode */
1956+#define HW_ATL_TPB_TX_TC_MODE_MSKN 0xFFFFFEFF
1957+/* lower bit position of bitfield tx_tc_mode */
1958+#define HW_ATL_TPB_TX_TC_MODE_SHIFT 8
1959+/* width of bitfield tx_tc_mode */
1960+#define HW_ATL_TPB_TX_TC_MODE_WIDTH 1
1961+/* default value of bitfield tx_tc_mode */
1962+#define HW_ATL_TPB_TX_TC_MODE_DEFAULT 0x0
1963+
19511964 /* tx tx{b}_hi_thresh[c:0] bitfield definitions
19521965 * preprocessor definitions for the bitfield "tx{b}_hi_thresh[c:0]".
19531966 * parameter: buffer {b} | stride size 0x10 | range [0, 7]
drivers/net/ethernet/broadcom/bnxt/bnxt.c+6−0
@@ -504,6 +504,12 @@ normal_tx: · 503 unmodified lines
504504 }
505505
506506 length >>= 9;
507+ if (unlikely(length >= ARRAY_SIZE(bnxt_lhint_arr))) {
508+ dev_warn_ratelimited(&pdev->dev, "Dropped oversize %d bytes TX packet.\n",
509+ skb->len);
510+ i = 0;
511+ goto tx_dma_error;
512+ }
507513 flags |= bnxt_lhint_arr[length];
508514 txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
509515
drivers/net/ethernet/microchip/enc28j60.c+1−1
@@ -1681,5 +1681,5 @@ MODULE_DESCRIPTION(DRV_NAME " ethernet driver"); · 1680 unmodified lines
16811681 MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");
16821682 MODULE_LICENSE("GPL");
16831683 module_param_named(debug, debug.msg_enable, int, 0);
1684−MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., ffff=all)");
1684+MODULE_PARM_DESC(debug, "Debug verbosity level in amount of bits set (0=none, ..., 31=all)");
16851685 MODULE_ALIAS("spi:" DRV_NAME);
drivers/net/ethernet/microchip/lan743x_main.c+12−4
@@ -1400,7 +1400,8 @@ static int lan743x_tx_frame_start(struct lan743x_tx *tx, · 1399 unmodified lines
14001400 }
14011401
14021402 static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
1403− unsigned int frame_length)
1403+ unsigned int frame_length,
1404+ int nr_frags)
14041405 {
14051406 /* called only from within lan743x_tx_xmit_frame.
14061407 * assuming tx->ring_lock has already been acquired.
@@ -1410,6 +1411,10 @@ static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx, · 3 unmodified lines
14101411
14111412 /* wrap up previous descriptor */
14121413 tx->frame_data0 |= TX_DESC_DATA0_EXT_;
1414+ if (nr_frags <= 0) {
1415+ tx->frame_data0 |= TX_DESC_DATA0_LS_;
1416+ tx->frame_data0 |= TX_DESC_DATA0_IOC_;
1417+ }
14131418 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
14141419 tx_descriptor->data0 = tx->frame_data0;
14151420
@@ -1514,8 +1519,11 @@ static void lan743x_tx_frame_end(struct lan743x_tx *tx, · 98 unmodified lines
15141519 u32 tx_tail_flags = 0;
15151520
15161521 /* wrap up previous descriptor */
1517− tx->frame_data0 |= TX_DESC_DATA0_LS_;
1518− tx->frame_data0 |= TX_DESC_DATA0_IOC_;
1522+ if ((tx->frame_data0 & TX_DESC_DATA0_DTYPE_MASK_) ==
1523+ TX_DESC_DATA0_DTYPE_DATA_) {
1524+ tx->frame_data0 |= TX_DESC_DATA0_LS_;
1525+ tx->frame_data0 |= TX_DESC_DATA0_IOC_;
1526+ }
15191527
15201528 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
15211529 buffer_info = &tx->buffer_info[tx->frame_tail];
@@ -1600,7 +1608,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx, · 78 unmodified lines
16001608 }
16011609
16021610 if (gso)
1603− lan743x_tx_frame_add_lso(tx, frame_length);
1611+ lan743x_tx_frame_add_lso(tx, frame_length, nr_frags);
16041612
16051613 if (nr_frags <= 0)
16061614 goto finish;
drivers/net/geneve.c+8−3
@@ -692,15 +692,20 @@ out: · 691 unmodified lines
692692 static int geneve_open(struct net_device *dev)
693693 {
694694 struct geneve_dev *geneve = netdev_priv(dev);
695− bool ipv6 = !!(geneve->info.mode & IP_TUNNEL_INFO_IPV6);
696695 bool metadata = geneve->collect_md;
696+ bool ipv4, ipv6;
697697 int ret = 0;
698698
699+ ipv6 = geneve->info.mode & IP_TUNNEL_INFO_IPV6 || metadata;
700+ ipv4 = !ipv6 || metadata;
699701 #if IS_ENABLED(CONFIG_IPV6)
700− if (ipv6 || metadata)
702+ if (ipv6) {
701703 ret = geneve_sock_add(geneve, true);
704+ if (ret < 0 && ret != -EAFNOSUPPORT)
705+ ipv4 = false;
706+ }
702707 #endif
703− if (!ret && (!ipv6 || metadata))
708+ if (ipv4)
704709 ret = geneve_sock_add(geneve, false);
705710 if (ret < 0)
706711 geneve_sock_release(geneve);
drivers/net/hyperv/netvsc_drv.c+19−3
@@ -744,6 +744,14 @@ void netvsc_linkstatus_callback(struct net_device *net, · 743 unmodified lines
744744 schedule_delayed_work(&ndev_ctx->dwork, 0);
745745 }
746746
747+static void netvsc_comp_ipcsum(struct sk_buff *skb)
748+{
749+ struct iphdr *iph = (struct iphdr *)skb->data;
750+
751+ iph->check = 0;
752+ iph->check = ip_fast_csum(iph, iph->ihl);
753+}
754+
747755 static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
748756 struct netvsc_channel *nvchan)
749757 {
@@ -770,9 +778,17 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, · 20 unmodified lines
770778 /* skb is already created with CHECKSUM_NONE */
771779 skb_checksum_none_assert(skb);
772780
773− /*
774− * In Linux, the IP checksum is always checked.
775− * Do L4 checksum offload if enabled and present.
781+ /* Incoming packets may have IP header checksum verified by the host.
782+ * They may not have IP header checksum computed after coalescing.
783+ * We compute it here if the flags are set, because on Linux, the IP
784+ * checksum is always checked.
785+ */
786+ if (csum_info && csum_info->receive.ip_checksum_value_invalid &&
787+ csum_info->receive.ip_checksum_succeeded &&
788+ skb->protocol == htons(ETH_P_IP))
789+ netvsc_comp_ipcsum(skb);
790+
791+ /* Do L4 checksum offload if enabled and present.
776792 */
777793 if (csum_info && (net->features & NETIF_F_RXCSUM)) {
778794 if (csum_info->receive.tcp_checksum_succeeded ||
drivers/net/phy/dp83867.c+3−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/module.h>
1212 #include <linux/of.h>
1313 #include <linux/phy.h>
14+#include <linux/delay.h>
1415
1516 #include <dt-bindings/net/ti-dp83867.h>
1617
@@ -304,6 +305,8 @@ static int dp83867_phy_reset(struct phy_device *phydev) · 287 unmodified lines
304305 if (err < 0)
305306 return err;
306307
308+ usleep_range(10, 20);
309+
307310 return dp83867_config_init(phydev);
308311 }
309312
drivers/net/phy/micrel.c+12−1
@@ -340,6 +340,17 @@ static int ksz8041_config_aneg(struct phy_device *phydev) · 339 unmodified lines
340340 return genphy_config_aneg(phydev);
341341 }
342342
343+static int ksz8061_config_init(struct phy_device *phydev)
344+{
345+ int ret;
346+
347+ ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A);
348+ if (ret)
349+ return ret;
350+
351+ return kszphy_config_init(phydev);
352+}
353+
343354 static int ksz9021_load_values_from_of(struct phy_device *phydev,
344355 const struct device_node *of_node,
345356 u16 reg,
@@ -1015,7 +1026,7 @@ static struct phy_driver ksphy_driver[] = { · 669 unmodified lines
10151026 .name = "Micrel KSZ8061",
10161027 .phy_id_mask = MICREL_PHY_ID_MASK,
10171028 .features = PHY_BASIC_FEATURES,
1018− .config_init = kszphy_config_init,
1029+ .config_init = ksz8061_config_init,
10191030 .ack_interrupt = kszphy_ack_interrupt,
10201031 .config_intr = kszphy_config_intr,
10211032 .suspend = genphy_suspend,
drivers/net/phy/phylink.c+4−0
@@ -324,6 +324,10 @@ static int phylink_get_mac_state(struct phylink *pl, struct phylink_link_state * · 323 unmodified lines
324324 linkmode_zero(state->lp_advertising);
325325 state->interface = pl->link_config.interface;
326326 state->an_enabled = pl->link_config.an_enabled;
327+ state->speed = SPEED_UNKNOWN;
328+ state->duplex = DUPLEX_UNKNOWN;
329+ state->pause = MLO_PAUSE_NONE;
330+ state->an_complete = 0;
327331 state->link = 1;
328332
329333 return pl->ops->mac_link_state(ndev, state);
drivers/net/tun.c+2−2
@@ -2167,9 +2167,9 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err) · 2166 unmodified lines
21672167 }
21682168
21692169 add_wait_queue(&tfile->wq.wait, &wait);
2170− current->state = TASK_INTERRUPTIBLE;
21712170
21722171 while (1) {
2172+ set_current_state(TASK_INTERRUPTIBLE);
21732173 ptr = ptr_ring_consume(&tfile->tx_ring);
21742174 if (ptr)
21752175 break;
@@ -2185,7 +2185,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err) · 9 unmodified lines
21852185 schedule();
21862186 }
21872187
2188− current->state = TASK_RUNNING;
2188+ __set_current_state(TASK_RUNNING);
21892189 remove_wait_queue(&tfile->wq.wait, &wait);
21902190
21912191 out:
drivers/net/xen-netback/hash.c+2−0
@@ -454,6 +454,8 @@ void xenvif_init_hash(struct xenvif *vif) · 453 unmodified lines
454454 if (xenvif_hash_cache_size == 0)
455455 return;
456456
457+ BUG_ON(vif->hash.cache.count);
458+
457459 spin_lock_init(&vif->hash.cache.lock);
458460 INIT_LIST_HEAD(&vif->hash.cache.list);
459461 }
drivers/net/xen-netback/interface.c+7−0
@@ -153,6 +153,13 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, · 152 unmodified lines
153153 {
154154 struct xenvif *vif = netdev_priv(dev);
155155 unsigned int size = vif->hash.size;
156+ unsigned int num_queues;
157+
158+ /* If queues are not set up internally - always return 0
159+ * as the packet going to be dropped anyway */
160+ num_queues = READ_ONCE(vif->num_queues);
161+ if (num_queues < 1)
162+ return 0;
156163
157164 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
158165 return fallback(dev, skb, NULL) % dev->real_num_tx_queues;
drivers/net/xen-netback/netback.c+5−5
@@ -1072,11 +1072,6 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s · 1071 unmodified lines
10721072 skb_frag_size_set(&frags[i], len);
10731073 }
10741074
1075− /* Copied all the bits from the frag list -- free it. */
1076− skb_frag_list_init(skb);
1077− xenvif_skb_zerocopy_prepare(queue, nskb);
1078− kfree_skb(nskb);
1079−
10801075 /* Release all the original (foreign) frags. */
10811076 for (f = 0; f < skb_shinfo(skb)->nr_frags; f++)
10821077 skb_frag_unref(skb, f);
@@ -1145,6 +1140,8 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) · 62 unmodified lines
11451140 xenvif_fill_frags(queue, skb);
11461141
11471142 if (unlikely(skb_has_frag_list(skb))) {
1143+ struct sk_buff *nskb = skb_shinfo(skb)->frag_list;
1144+ xenvif_skb_zerocopy_prepare(queue, nskb);
11481145 if (xenvif_handle_frag_list(queue, skb)) {
11491146 if (net_ratelimit())
11501147 netdev_err(queue->vif->dev,
@@ -1153,6 +1150,9 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) · 2 unmodified lines
11531150 kfree_skb(skb);
11541151 continue;
11551152 }
1153+ /* Copied all the bits from the frag list -- free it. */
1154+ skb_frag_list_init(skb);
1155+ kfree_skb(nskb);
11561156 }
11571157
11581158 skb->dev = queue->vif->dev;
include/linux/netdevice.h+1−1
@@ -3887,7 +3887,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) · 3886 unmodified lines
38873887 if (debug_value == 0) /* no output */
38883888 return 0;
38893889 /* set low N bits */
3890− return (1 << debug_value) - 1;
3890+ return (1U << debug_value) - 1;
38913891 }
38923892
38933893 static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
include/net/icmp.h+8−1
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222
2323 #include <net/inet_sock.h>
2424 #include <net/snmp.h>
25+#include <net/ip.h>
2526
2627 struct icmp_err {
2728 int errno;
@@ -39,7 +40,13 @@ struct net_proto_family; · 11 unmodified lines
3940 struct sk_buff;
4041 struct net;
4142
42−void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43+void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
44+ const struct ip_options *opt);
45+static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
46+{
47+ __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
48+}
49+
4350 int icmp_rcv(struct sk_buff *skb);
4451 int icmp_err(struct sk_buff *skb, u32 info);
4552 int icmp_init(void);
include/net/ip.h+3−1
@@ -667,6 +667,8 @@ static inline int ip_options_echo(struct net *net, struct ip_options *dopt, · 666 unmodified lines
667667 }
668668
669669 void ip_options_fragment(struct sk_buff *skb);
670+int __ip_options_compile(struct net *net, struct ip_options *opt,
671+ struct sk_buff *skb, __be32 *info);
670672 int ip_options_compile(struct net *net, struct ip_options *opt,
671673 struct sk_buff *skb);
672674 int ip_options_get(struct net *net, struct ip_options_rcu **optp,
@@ -716,7 +718,7 @@ extern int sysctl_icmp_msgs_burst; · 43 unmodified lines
716718 int ip_misc_proc_init(void);
717719 #endif
718720
719−int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
721+int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
720722 struct netlink_ext_ack *extack);
721723
722724 #endif /* _IP_H */
kernel/bpf/syscall.c+3−3
@@ -577,12 +577,12 @@ static int map_create(union bpf_attr *attr) · 576 unmodified lines
577577 err = bpf_map_new_fd(map, f_flags);
578578 if (err < 0) {
579579 /* failed to allocate fd.
580− * bpf_map_put() is needed because the above
580+ * bpf_map_put_with_uref() is needed because the above
581581 * bpf_map_alloc_id() has published the map
582582 * to the userspace and the userspace may
583583 * have refcnt-ed it through BPF_MAP_GET_FD_BY_ID.
584584 */
585− bpf_map_put(map);
585+ bpf_map_put_with_uref(map);
586586 return err;
587587 }
588588
@@ -2025,7 +2025,7 @@ static int bpf_map_get_fd_by_id(const union bpf_attr *attr) · 1436 unmodified lines
20252025
20262026 fd = bpf_map_new_fd(map, f_flags);
20272027 if (fd < 0)
2028− bpf_map_put(map);
2028+ bpf_map_put_with_uref(map);
20292029
20302030 return fd;
20312031 }
kernel/bpf/verifier.c+2−1
@@ -7559,7 +7559,8 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env) · 7558 unmodified lines
75597559 u32 off_reg;
75607560
75617561 aux = &env->insn_aux_data[i + delta];
7562− if (!aux->alu_state)
7562+ if (!aux->alu_state ||
7563+ aux->alu_state == BPF_ALU_NON_POINTER)
75637564 continue;
75647565
75657566 isneg = aux->alu_state & BPF_ALU_NEG_VALUE;
net/dsa/dsa2.c+10−6
@@ -612,8 +612,8 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds, · 611 unmodified lines
612612 {
613613 struct device_node *ports, *port;
614614 struct dsa_port *dp;
615+ int err = 0;
615616 u32 reg;
616− int err;
617617
618618 ports = of_get_child_by_name(dn, "ports");
619619 if (!ports) {
@@ -624,19 +624,23 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds, · 4 unmodified lines
624624 for_each_available_child_of_node(ports, port) {
625625 err = of_property_read_u32(port, "reg", &reg);
626626 if (err)
627− return err;
627+ goto out_put_node;
628628
629− if (reg >= ds->num_ports)
630− return -EINVAL;
629+ if (reg >= ds->num_ports) {
630+ err = -EINVAL;
631+ goto out_put_node;
632+ }
631633
632634 dp = &ds->ports[reg];
633635
634636 err = dsa_port_parse_of(dp, port);
635637 if (err)
636− return err;
638+ goto out_put_node;
637639 }
638640
639− return 0;
641+out_put_node:
642+ of_node_put(ports);
643+ return err;
640644 }
641645
642646 static int dsa_switch_parse_member_of(struct dsa_switch *ds,
net/dsa/port.c+1−0
@@ -337,6 +337,7 @@ static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp) · 336 unmodified lines
337337 return ERR_PTR(-EPROBE_DEFER);
338338 }
339339
340+ of_node_put(phy_dn);
340341 return phydev;
341342 }
342343
net/ipv4/cipso_ipv4.c+17−3
@@ -667,7 +667,8 @@ static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level) · 666 unmodified lines
667667 case CIPSO_V4_MAP_PASS:
668668 return 0;
669669 case CIPSO_V4_MAP_TRANS:
670− if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)
670+ if ((level < doi_def->map.std->lvl.cipso_size) &&
671+ (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL))
671672 return 0;
672673 break;
673674 }
@@ -1735,13 +1736,26 @@ validate_return: · 1061 unmodified lines
17351736 */
17361737 void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)
17371738 {
1739+ unsigned char optbuf[sizeof(struct ip_options) + 40];
1740+ struct ip_options *opt = (struct ip_options *)optbuf;
1741+
17381742 if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES)
17391743 return;
17401744
1745+ /*
1746+ * We might be called above the IP layer,
1747+ * so we can not use icmp_send and IPCB here.
1748+ */
1749+
1750+ memset(opt, 0, sizeof(struct ip_options));
1751+ opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);
1752+ if (__ip_options_compile(dev_net(skb->dev), opt, skb, NULL))
1753+ return;
1754+
17411755 if (gateway)
1742− icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0);
1756+ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0, opt);
17431757 else
1744− icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0);
1758+ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0, opt);
17451759 }
17461760
17471761 /**
net/ipv4/fib_frontend.c+4−0
@@ -710,6 +710,10 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, · 709 unmodified lines
710710 case RTA_GATEWAY:
711711 cfg->fc_gw = nla_get_be32(attr);
712712 break;
713+ case RTA_VIA:
714+ NL_SET_ERR_MSG(extack, "IPv4 does not support RTA_VIA attribute");
715+ err = -EINVAL;
716+ goto errout;
713717 case RTA_PRIORITY:
714718 cfg->fc_priority = nla_get_u32(attr);
715719 break;
net/ipv4/icmp.c+4−3
@@ -570,7 +570,8 @@ relookup_failed: · 569 unmodified lines
570570 * MUST reply to only the first fragment.
571571 */
572572
573−void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
573+void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
574+ const struct ip_options *opt)
574575 {
575576 struct iphdr *iph;
576577 int room;
@@ -691,7 +692,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) · 114 unmodified lines
691692 iph->tos;
692693 mark = IP4_REPLY_MARK(net, skb_in->mark);
693694
694− if (ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in))
695+ if (__ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in, opt))
695696 goto out_unlock;
696697
697698
@@ -742,7 +743,7 @@ out_bh_enable: · 44 unmodified lines
742743 local_bh_enable();
743744 out:;
744745 }
745−EXPORT_SYMBOL(icmp_send);
746+EXPORT_SYMBOL(__icmp_send);
746747
747748
748749 static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
net/ipv4/ip_input.c+5−4
@@ -307,11 +307,10 @@ drop: · 306 unmodified lines
307307 }
308308
309309 static int ip_rcv_finish_core(struct net *net, struct sock *sk,
310− struct sk_buff *skb)
310+ struct sk_buff *skb, struct net_device *dev)
311311 {
312312 const struct iphdr *iph = ip_hdr(skb);
313313 int (*edemux)(struct sk_buff *skb);
314− struct net_device *dev = skb->dev;
315314 struct rtable *rt;
316315 int err;
317316
@@ -400,6 +399,7 @@ drop_error: · 82 unmodified lines
400399
401400 static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
402401 {
402+ struct net_device *dev = skb->dev;
403403 int ret;
404404
405405 /* if ingress device is enslaved to an L3 master device pass the
@@ -409,7 +409,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) · 3 unmodified lines
409409 if (!skb)
410410 return NET_RX_SUCCESS;
411411
412− ret = ip_rcv_finish_core(net, sk, skb);
412+ ret = ip_rcv_finish_core(net, sk, skb, dev);
413413 if (ret != NET_RX_DROP)
414414 ret = dst_input(skb);
415415 return ret;
@@ -545,6 +545,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk, · 129 unmodified lines
545545
546546 INIT_LIST_HEAD(&sublist);
547547 list_for_each_entry_safe(skb, next, head, list) {
548+ struct net_device *dev = skb->dev;
548549 struct dst_entry *dst;
549550
550551 skb_list_del_init(skb);
@@ -554,7 +555,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk, · 3 unmodified lines
554555 skb = l3mdev_ip_rcv(skb);
555556 if (!skb)
556557 continue;
557− if (ip_rcv_finish_core(net, sk, skb) == NET_RX_DROP)
558+ if (ip_rcv_finish_core(net, sk, skb, dev) == NET_RX_DROP)
558559 continue;
559560
560561 dst = skb_dst(skb);
net/ipv4/ip_options.c+17−5
@@ -251,8 +251,9 @@ static void spec_dst_fill(__be32 *spec_dst, struct sk_buff *skb) · 250 unmodified lines
251251 * If opt == NULL, then skb->data should point to IP header.
252252 */
253253
254−int ip_options_compile(struct net *net,
255− struct ip_options *opt, struct sk_buff *skb)
254+int __ip_options_compile(struct net *net,
255+ struct ip_options *opt, struct sk_buff *skb,
256+ __be32 *info)
256257 {
257258 __be32 spec_dst = htonl(INADDR_ANY);
258259 unsigned char *pp_ptr = NULL;
@@ -468,11 +469,22 @@ eol: · 209 unmodified lines
468469 return 0;
469470
470471 error:
471− if (skb) {
472− icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24));
473− }
472+ if (info)
473+ *info = htonl((pp_ptr-iph)<<24);
474474 return -EINVAL;
475475 }
476+
477+int ip_options_compile(struct net *net,
478+ struct ip_options *opt, struct sk_buff *skb)
479+{
480+ int ret;
481+ __be32 info;
482+
483+ ret = __ip_options_compile(net, opt, skb, &info);
484+ if (ret != 0 && skb)
485+ icmp_send(skb, ICMP_PARAMETERPROB, 0, info);
486+ return ret;
487+}
476488 EXPORT_SYMBOL(ip_options_compile);
477489
478490 /*
net/ipv4/netlink.c+13−4
@@ -3,9 +3,10 @@ · 2 unmodified lines
33 #include <linux/types.h>
44 #include <net/net_namespace.h>
55 #include <net/netlink.h>
6+#include <linux/in6.h>
67 #include <net/ip.h>
78
8−int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
9+int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
910 struct netlink_ext_ack *extack)
1011 {
1112 *ip_proto = nla_get_u8(attr);
@@ -13,11 +14,19 @@ int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, · 1 unmodified line
1314 switch (*ip_proto) {
1415 case IPPROTO_TCP:
1516 case IPPROTO_UDP:
17+ return 0;
1618 case IPPROTO_ICMP:
19+ if (family != AF_INET)
20+ break;
21+ return 0;
22+#if IS_ENABLED(CONFIG_IPV6)
23+ case IPPROTO_ICMPV6:
24+ if (family != AF_INET6)
25+ break;
1726 return 0;
18− default:
19− NL_SET_ERR_MSG(extack, "Unsupported ip proto");
20− return -EOPNOTSUPP;
27+#endif
2128 }
29+ NL_SET_ERR_MSG(extack, "Unsupported ip proto");
30+ return -EOPNOTSUPP;
2231 }
2332 EXPORT_SYMBOL_GPL(rtm_getroute_parse_ip_proto);
net/ipv4/route.c+1−1
@@ -2876,7 +2876,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, · 2875 unmodified lines
28762876
28772877 if (tb[RTA_IP_PROTO]) {
28782878 err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO],
2879− &ip_proto, extack);
2879+ &ip_proto, AF_INET, extack);
28802880 if (err)
28812881 return err;
28822882 }
net/ipv6/route.c+6−1
@@ -4176,6 +4176,10 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, · 4175 unmodified lines
41764176 cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]);
41774177 cfg->fc_flags |= RTF_GATEWAY;
41784178 }
4179+ if (tb[RTA_VIA]) {
4180+ NL_SET_ERR_MSG(extack, "IPv6 does not support RTA_VIA attribute");
4181+ goto errout;
4182+ }
41794183
41804184 if (tb[RTA_DST]) {
41814185 int plen = (rtm->rtm_dst_len + 7) >> 3;
@@ -4949,7 +4953,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, · 767 unmodified lines
49494953
49504954 if (tb[RTA_IP_PROTO]) {
49514955 err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO],
4952− &fl6.flowi6_proto, extack);
4956+ &fl6.flowi6_proto, AF_INET6,
4957+ extack);
49534958 if (err)
49544959 goto errout;
49554960 }
net/ipv6/sit.c+1−0
@@ -1873,6 +1873,7 @@ static int __net_init sit_init_net(struct net *net) · 1872 unmodified lines
18731873
18741874 err_reg_dev:
18751875 ipip6_dev_free(sitn->fb_tunnel_dev);
1876+ free_netdev(sitn->fb_tunnel_dev);
18761877 err_alloc_dev:
18771878 return err;
18781879 }
net/mpls/af_mpls.c+3−0
@@ -1874,6 +1874,9 @@ static int rtm_to_route_config(struct sk_buff *skb, · 1873 unmodified lines
18741874 goto errout;
18751875 break;
18761876 }
1877+ case RTA_GATEWAY:
1878+ NL_SET_ERR_MSG(extack, "MPLS does not support RTA_GATEWAY attribute");
1879+ goto errout;
18771880 case RTA_VIA:
18781881 {
18791882 if (nla_get_via(nla, &cfg->rc_via_alen,
net/netlabel/netlabel_kapi.c+2−1
@@ -903,7 +903,8 @@ int netlbl_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len, · 902 unmodified lines
903903 (state == 0 && (byte & bitmask) == 0))
904904 return bit_spot;
905905
906− bit_spot++;
906+ if (++bit_spot >= bitmap_len)
907+ return -1;
907908 bitmask >>= 1;
908909 if (bitmask == 0) {
909910 byte = bitmap[++byte_offset];
net/nfc/llcp_commands.c+20−0
@@ -419,6 +419,10 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) · 418 unmodified lines
419419 sock->service_name,
420420 sock->service_name_len,
421421 &service_name_tlv_length);
422+ if (!service_name_tlv) {
423+ err = -ENOMEM;
424+ goto error_tlv;
425+ }
422426 size += service_name_tlv_length;
423427 }
424428
@@ -429,9 +433,17 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) · 4 unmodified lines
429433
430434 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
431435 &miux_tlv_length);
436+ if (!miux_tlv) {
437+ err = -ENOMEM;
438+ goto error_tlv;
439+ }
432440 size += miux_tlv_length;
433441
434442 rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
443+ if (!rw_tlv) {
444+ err = -ENOMEM;
445+ goto error_tlv;
446+ }
435447 size += rw_tlv_length;
436448
437449 pr_debug("SKB size %d SN length %zu\n", size, sock->service_name_len);
@@ -484,9 +496,17 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock) · 46 unmodified lines
484496
485497 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
486498 &miux_tlv_length);
499+ if (!miux_tlv) {
500+ err = -ENOMEM;
501+ goto error_tlv;
502+ }
487503 size += miux_tlv_length;
488504
489505 rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
506+ if (!rw_tlv) {
507+ err = -ENOMEM;
508+ goto error_tlv;
509+ }
490510 size += rw_tlv_length;
491511
492512 skb = llcp_allocate_pdu(sock, LLCP_PDU_CC, size);
net/nfc/llcp_core.c+20−4
@@ -532,10 +532,10 @@ static u8 nfc_llcp_reserve_sdp_ssap(struct nfc_llcp_local *local) · 531 unmodified lines
532532
533533 static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
534534 {
535− u8 *gb_cur, *version_tlv, version, version_length;
536− u8 *lto_tlv, lto_length;
537− u8 *wks_tlv, wks_length;
538− u8 *miux_tlv, miux_length;
535+ u8 *gb_cur, version, version_length;
536+ u8 lto_length, wks_length, miux_length;
537+ u8 *version_tlv = NULL, *lto_tlv = NULL,
538+ *wks_tlv = NULL, *miux_tlv = NULL;
539539 __be16 wks = cpu_to_be16(local->local_wks);
540540 u8 gb_len = 0;
541541 int ret = 0;
@@ -543,17 +543,33 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local) · 1 unmodified line
543543 version = LLCP_VERSION_11;
544544 version_tlv = nfc_llcp_build_tlv(LLCP_TLV_VERSION, &version,
545545 1, &version_length);
546+ if (!version_tlv) {
547+ ret = -ENOMEM;
548+ goto out;
549+ }
546550 gb_len += version_length;
547551
548552 lto_tlv = nfc_llcp_build_tlv(LLCP_TLV_LTO, &local->lto, 1, &lto_length);
553+ if (!lto_tlv) {
554+ ret = -ENOMEM;
555+ goto out;
556+ }
549557 gb_len += lto_length;
550558
551559 pr_debug("Local wks 0x%lx\n", local->local_wks);
552560 wks_tlv = nfc_llcp_build_tlv(LLCP_TLV_WKS, (u8 *)&wks, 2, &wks_length);
561+ if (!wks_tlv) {
562+ ret = -ENOMEM;
563+ goto out;
564+ }
553565 gb_len += wks_length;
554566
555567 miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&local->miux, 0,
556568 &miux_length);
569+ if (!miux_tlv) {
570+ ret = -ENOMEM;
571+ goto out;
572+ }
557573 gb_len += miux_length;
558574
559575 gb_len += ARRAY_SIZE(llcp_magic);
net/sched/act_ipt.c+1−2
@@ -199,8 +199,7 @@ err3: · 198 unmodified lines
199199 err2:
200200 kfree(tname);
201201 err1:
202− if (ret == ACT_P_CREATED)
203− tcf_idr_release(*a, bind);
202+ tcf_idr_release(*a, bind);
204203 return err;
205204 }
206205
net/sched/act_skbedit.c+1−2
@@ -189,8 +189,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla, · 188 unmodified lines
189189
190190 params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
191191 if (unlikely(!params_new)) {
192− if (ret == ACT_P_CREATED)
193− tcf_idr_release(*a, bind);
192+ tcf_idr_release(*a, bind);
194193 return -ENOMEM;
195194 }
196195
net/sched/act_tunnel_key.c+2−1
@@ -394,7 +394,8 @@ release_dst_cache: · 393 unmodified lines
394394 dst_cache_destroy(&metadata->u.tun_info.dst_cache);
395395 #endif
396396 release_tun_meta:
397− dst_release(&metadata->dst);
397+ if (metadata)
398+ dst_release(&metadata->dst);
398399
399400 err_out:
400401 if (exists)
net/sched/sch_netem.c+7−3
@@ -447,6 +447,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 446 unmodified lines
447447 int nb = 0;
448448 int count = 1;
449449 int rc = NET_XMIT_SUCCESS;
450+ int rc_drop = NET_XMIT_DROP;
450451
451452 /* Do not fool qdisc_drop_all() */
452453 skb->prev = NULL;
@@ -486,6 +487,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 33 unmodified lines
486487 q->duplicate = 0;
487488 rootq->enqueue(skb2, rootq, to_free);
488489 q->duplicate = dupsave;
490+ rc_drop = NET_XMIT_SUCCESS;
489491 }
490492
491493 /*
@@ -498,7 +500,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 6 unmodified lines
498500 if (skb_is_gso(skb)) {
499501 segs = netem_segment(skb, sch, to_free);
500502 if (!segs)
501− return NET_XMIT_DROP;
503+ return rc_drop;
502504 } else {
503505 segs = skb;
504506 }
@@ -521,8 +523,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 16 unmodified lines
521523 1<<(prandom_u32() % 8);
522524 }
523525
524− if (unlikely(sch->q.qlen >= sch->limit))
525− return qdisc_drop_all(skb, sch, to_free);
526+ if (unlikely(sch->q.qlen >= sch->limit)) {
527+ qdisc_drop_all(skb, sch, to_free);
528+ return rc_drop;
529+ }
526530
527531 qdisc_qstats_backlog_inc(sch, skb);
528532
net/sctp/chunk.c+1−1
@@ -192,7 +192,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, · 191 unmodified lines
192192 if (unlikely(!max_data)) {
193193 max_data = sctp_min_frag_point(sctp_sk(asoc->base.sk),
194194 sctp_datachk_len(&asoc->stream));
195− pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%Zu)",
195+ pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%zu)",
196196 __func__, asoc, max_data);
197197 }
198198
net/socket.c+1−0
@@ -577,6 +577,7 @@ static void __sock_release(struct socket *sock, struct inode *inode) · 576 unmodified lines
577577 if (inode)
578578 inode_lock(inode);
579579 sock->ops->release(sock);
580+ sock->sk = NULL;
580581 if (inode)
581582 inode_unlock(inode);
582583 sock->ops = NULL;
net/tipc/socket.c+5−1
@@ -379,11 +379,13 @@ static int tipc_sk_sock_err(struct socket *sock, long *timeout) · 378 unmodified lines
379379
380380 #define tipc_wait_for_cond(sock_, timeo_, condition_) \
381381 ({ \
382+ DEFINE_WAIT_FUNC(wait_, woken_wake_function); \
382383 struct sock *sk_; \
383384 int rc_; \
384385 \
385386 while ((rc_ = !(condition_))) { \
386− DEFINE_WAIT_FUNC(wait_, woken_wake_function); \
387+ /* coupled with smp_wmb() in tipc_sk_proto_rcv() */ \
388+ smp_rmb(); \
387389 sk_ = (sock_)->sk; \
388390 rc_ = tipc_sk_sock_err((sock_), timeo_); \
389391 if (rc_) \
@@ -1983,6 +1985,8 @@ static void tipc_sk_proto_rcv(struct sock *sk, · 1593 unmodified lines
19831985 return;
19841986 case SOCK_WAKEUP:
19851987 tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0);
1988+ /* coupled with smp_rmb() in tipc_wait_for_cond() */
1989+ smp_wmb();
19861990 tsk->cong_link_cnt--;
19871991 wakeup = true;
19881992 break;
tools/testing/selftests/net/pmtu.sh+80−16
@@ -103,6 +103,15 @@ · 102 unmodified lines
103103 # and check that configured MTU is used on link creation and changes, and
104104 # that MTU is properly calculated instead when MTU is not configured from
105105 # userspace
106+#
107+# - cleanup_ipv4_exception
108+# Similar to pmtu_ipv4_vxlan4_exception, but explicitly generate PMTU
109+# exceptions on multiple CPUs and check that the veth device tear-down
110+# happens in a timely manner
111+#
112+# - cleanup_ipv6_exception
113+# Same as above, but use IPv6 transport from A to B
114+
106115
107116 # Kselftest framework requirement - SKIP code is 4.
108117 ksft_skip=4
@@ -135,7 +144,9 @@ tests=" · 26 unmodified lines
135144 pmtu_vti6_default_mtu vti6: default MTU assignment
136145 pmtu_vti4_link_add_mtu vti4: MTU setting on link creation
137146 pmtu_vti6_link_add_mtu vti6: MTU setting on link creation
138− pmtu_vti6_link_change_mtu vti6: MTU changes on link changes"
147+ pmtu_vti6_link_change_mtu vti6: MTU changes on link changes
148+ cleanup_ipv4_exception ipv4: cleanup of cached exceptions
149+ cleanup_ipv6_exception ipv6: cleanup of cached exceptions"
139150
140151 NS_A="ns-$(mktemp -u XXXXXX)"
141152 NS_B="ns-$(mktemp -u XXXXXX)"
@@ -263,8 +274,6 @@ setup_fou_or_gue() { · 121 unmodified lines
263274
264275 ${ns_a} ip link set ${encap}_a up
265276 ${ns_b} ip link set ${encap}_b up
266−
267− sleep 1
268277 }
269278
270279 setup_fou44() {
@@ -302,6 +311,10 @@ setup_gue66() { · 31 unmodified lines
302311 setup_namespaces() {
303312 for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2}; do
304313 ip netns add ${n} || return 1
314+
315+ # Disable DAD, so that we don't have to wait to use the
316+ # configured IPv6 addresses
317+ ip netns exec ${n} sysctl -q net/ipv6/conf/default/accept_dad=0
305318 done
306319 }
307320
@@ -337,8 +350,6 @@ setup_vti() { · 29 unmodified lines
337350
338351 ${ns_a} ip link set vti${proto}_a up
339352 ${ns_b} ip link set vti${proto}_b up
340−
341− sleep 1
342353 }
343354
344355 setup_vti4() {
@@ -375,8 +386,6 @@ setup_vxlan_or_geneve() { · 30 unmodified lines
375386
376387 ${ns_a} ip link set ${type}_a up
377388 ${ns_b} ip link set ${type}_b up
378−
379− sleep 1
380389 }
381390
382391 setup_geneve4() {
@@ -588,8 +597,8 @@ test_pmtu_ipvX() { · 205 unmodified lines
588597 mtu "${ns_b}" veth_B-R2 1500
589598
590599 # Create route exceptions
591− ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1800 ${dst1} > /dev/null
592− ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1800 ${dst2} > /dev/null
600+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst1} > /dev/null
601+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst2} > /dev/null
593602
594603 # Check that exceptions have been created with the correct PMTU
595604 pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})"
@@ -621,7 +630,7 @@ test_pmtu_ipvX() { · 25 unmodified lines
621630 # Decrease remote MTU on path via R2, get new exception
622631 mtu "${ns_r2}" veth_R2-B 400
623632 mtu "${ns_b}" veth_B-R2 400
624− ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1400 ${dst2} > /dev/null
633+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1400 ${dst2} > /dev/null
625634 pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"
626635 check_pmtu_value "lock 552" "${pmtu_2}" "exceeding MTU, with MTU < min_pmtu" || return 1
627636
@@ -638,7 +647,7 @@ test_pmtu_ipvX() { · 10 unmodified lines
638647 check_pmtu_value "1500" "${pmtu_2}" "increasing local MTU" || return 1
639648
640649 # Get new exception
641− ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1400 ${dst2} > /dev/null
650+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1400 ${dst2} > /dev/null
642651 pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"
643652 check_pmtu_value "lock 552" "${pmtu_2}" "exceeding MTU, with MTU < min_pmtu" || return 1
644653 }
@@ -687,7 +696,7 @@ test_pmtu_ipvX_over_vxlanY_or_geneveY_exception() { · 42 unmodified lines
687696
688697 mtu "${ns_a}" ${type}_a $((${ll_mtu} + 1000))
689698 mtu "${ns_b}" ${type}_b $((${ll_mtu} + 1000))
690− ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
699+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
691700
692701 # Check that exception was created
693702 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
@@ -767,7 +776,7 @@ test_pmtu_ipvX_over_fouY_or_gueY() { · 73 unmodified lines
767776
768777 mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000))
769778 mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000))
770− ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
779+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
771780
772781 # Check that exception was created
773782 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
@@ -825,13 +834,13 @@ test_pmtu_vti4_exception() { · 51 unmodified lines
825834
826835 # Send DF packet without exceeding link layer MTU, check that no
827836 # exception is created
828− ${ns_a} ping -q -M want -i 0.1 -w 2 -s ${ping_payload} ${tunnel4_b_addr} > /dev/null
837+ ${ns_a} ping -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel4_b_addr} > /dev/null
829838 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
830839 check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1
831840
832841 # Now exceed link layer MTU by one byte, check that exception is created
833842 # with the right PMTU value
834− ${ns_a} ping -q -M want -i 0.1 -w 2 -s $((ping_payload + 1)) ${tunnel4_b_addr} > /dev/null
843+ ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((ping_payload + 1)) ${tunnel4_b_addr} > /dev/null
835844 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
836845 check_pmtu_value "${esp_payload_rfc4106}" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106 + 1)))"
837846 }
@@ -847,7 +856,7 @@ test_pmtu_vti6_exception() { · 9 unmodified lines
847856 mtu "${ns_b}" veth_b 4000
848857 mtu "${ns_a}" vti6_a 5000
849858 mtu "${ns_b}" vti6_b 5000
850− ${ns_a} ${ping6} -q -i 0.1 -w 2 -s 60000 ${tunnel6_b_addr} > /dev/null
859+ ${ns_a} ${ping6} -q -i 0.1 -w 1 -s 60000 ${tunnel6_b_addr} > /dev/null
851860
852861 # Check that exception was created
853862 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"
@@ -1008,6 +1017,61 @@ test_pmtu_vti6_link_change_mtu() { · 154 unmodified lines
10081017 return ${fail}
10091018 }
10101019
1020+check_command() {
1021+ cmd=${1}
1022+
1023+ if ! which ${cmd} > /dev/null 2>&1; then
1024+ err " missing required command: '${cmd}'"
1025+ return 1
1026+ fi
1027+ return 0
1028+}
1029+
1030+test_cleanup_vxlanX_exception() {
1031+ outer="${1}"
1032+ encap="vxlan"
1033+ ll_mtu=4000
1034+
1035+ check_command taskset || return 2
1036+ cpu_list=$(grep -m 2 processor /proc/cpuinfo | cut -d ' ' -f 2)
1037+
1038+ setup namespaces routing ${encap}${outer} || return 2
1039+ trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \
1040+ "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \
1041+ "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B
1042+
1043+ # Create route exception by exceeding link layer MTU
1044+ mtu "${ns_a}" veth_A-R1 $((${ll_mtu} + 1000))
1045+ mtu "${ns_r1}" veth_R1-A $((${ll_mtu} + 1000))
1046+ mtu "${ns_b}" veth_B-R1 ${ll_mtu}
1047+ mtu "${ns_r1}" veth_R1-B ${ll_mtu}
1048+
1049+ mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000))
1050+ mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000))
1051+
1052+ # Fill exception cache for multiple CPUs (2)
1053+ # we can always use inner IPv4 for that
1054+ for cpu in ${cpu_list}; do
1055+ taskset --cpu-list ${cpu} ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${tunnel4_b_addr} > /dev/null
1056+ done
1057+
1058+ ${ns_a} ip link del dev veth_A-R1 &
1059+ iplink_pid=$!
1060+ sleep 1
1061+ if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then
1062+ err " can't delete veth device in a timely manner, PMTU dst likely leaked"
1063+ return 1
1064+ fi
1065+}
1066+
1067+test_cleanup_ipv6_exception() {
1068+ test_cleanup_vxlanX_exception 6
1069+}
1070+
1071+test_cleanup_ipv4_exception() {
1072+ test_cleanup_vxlanX_exception 4
1073+}
1074+
10111075 usage() {
10121076 echo
10131077 echo "$0 [OPTIONS] [TEST]..."
tools/testing/selftests/net/udpgro.sh+4−4
@@ -37,7 +37,7 @@ run_one() { · 36 unmodified lines
3737
3838 cfg_veth
3939
40− ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} && \
40+ ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} && \
4141 echo "ok" || \
4242 echo "failed" &
4343
@@ -81,7 +81,7 @@ run_one_nat() { · 37 unmodified lines
8181 # will land on the 'plain' one
8282 ip netns exec "${PEER_NS}" ./udpgso_bench_rx -G ${family} -b ${addr1} -n 0 &
8383 pid=$!
84− ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${family} -b ${addr2%/*} ${rx_args} && \
84+ ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} && \
8585 echo "ok" || \
8686 echo "failed"&
8787
@@ -99,8 +99,8 @@ run_one_2sock() { · 11 unmodified lines
9999
100100 cfg_veth
101101
102− ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -p 12345 &
103− ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} && \
102+ ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} -p 12345 &
103+ ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} && \
104104 echo "ok" || \
105105 echo "failed" &
106106
tools/testing/selftests/net/udpgso_bench_rx.c+29−13
@@ -45,6 +45,8 @@ static int cfg_alen = sizeof(struct sockaddr_in6); · 44 unmodified lines
4545 static int cfg_expected_pkt_nr;
4646 static int cfg_expected_pkt_len;
4747 static int cfg_expected_gso_size;
48+static int cfg_connect_timeout_ms;
49+static int cfg_rcv_timeout_ms;
4850 static struct sockaddr_storage cfg_bind_addr;
4951
5052 static bool interrupted;
@@ -87,7 +89,7 @@ static unsigned long gettimeofday_ms(void) · 36 unmodified lines
8789 return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
8890 }
8991
90−static void do_poll(int fd)
92+static void do_poll(int fd, int timeout_ms)
9193 {
9294 struct pollfd pfd;
9395 int ret;
@@ -102,8 +104,16 @@ static void do_poll(int fd) · 8 unmodified lines
102104 break;
103105 if (ret == -1)
104106 error(1, errno, "poll");
105− if (ret == 0)
106− continue;
107+ if (ret == 0) {
108+ if (!timeout_ms)
109+ continue;
110+
111+ timeout_ms -= 10;
112+ if (timeout_ms <= 0) {
113+ interrupted = true;
114+ break;
115+ }
116+ }
107117 if (pfd.revents != POLLIN)
108118 error(1, errno, "poll: 0x%x expected 0x%x\n",
109119 pfd.revents, POLLIN);
@@ -134,7 +144,7 @@ static int do_socket(bool do_tcp) · 24 unmodified lines
134144 if (listen(accept_fd, 1))
135145 error(1, errno, "listen");
136146
137− do_poll(accept_fd);
147+ do_poll(accept_fd, cfg_connect_timeout_ms);
138148 if (interrupted)
139149 exit(0);
140150
@@ -273,7 +283,9 @@ static void do_flush_udp(int fd) · 132 unmodified lines
273283
274284 static void usage(const char *filepath)
275285 {
276− error(1, 0, "Usage: %s [-Grtv] [-b addr] [-p port] [-l pktlen] [-n packetnr] [-S gsosize]", filepath);
286+ error(1, 0, "Usage: %s [-C connect_timeout] [-Grtv] [-b addr] [-p port]"
287+ " [-l pktlen] [-n packetnr] [-R rcv_timeout] [-S gsosize]",
288+ filepath);
277289 }
278290
279291 static void parse_opts(int argc, char **argv)
@@ -282,7 +294,7 @@ static void parse_opts(int argc, char **argv) · 2 unmodified lines
282294
283295 /* bind to any by default */
284296 setup_sockaddr(PF_INET6, "::", &cfg_bind_addr);
285− while ((c = getopt(argc, argv, "4b:Gl:n:p:rS:tv")) != -1) {
297+ while ((c = getopt(argc, argv, "4b:C:Gl:n:p:rR:S:tv")) != -1) {
286298 switch (c) {
287299 case '4':
288300 cfg_family = PF_INET;
@@ -292,6 +304,9 @@ static void parse_opts(int argc, char **argv) · 3 unmodified lines
292304 case 'b':
293305 setup_sockaddr(cfg_family, optarg, &cfg_bind_addr);
294306 break;
307+ case 'C':
308+ cfg_connect_timeout_ms = strtoul(optarg, NULL, 0);
309+ break;
295310 case 'G':
296311 cfg_gro_segment = true;
297312 break;
@@ -307,6 +322,9 @@ static void parse_opts(int argc, char **argv) · 9 unmodified lines
307322 case 'r':
308323 cfg_read_all = true;
309324 break;
325+ case 'R':
326+ cfg_rcv_timeout_ms = strtoul(optarg, NULL, 0);
327+ break;
310328 case 'S':
311329 cfg_expected_gso_size = strtol(optarg, NULL, 0);
312330 break;
@@ -329,8 +347,9 @@ static void parse_opts(int argc, char **argv) · 16 unmodified lines
329347
330348 static void do_recv(void)
331349 {
350+ int timeout_ms = cfg_tcp ? cfg_rcv_timeout_ms : cfg_connect_timeout_ms;
332351 unsigned long tnow, treport;
333− int fd, loop = 0;
352+ int fd;
334353
335354 fd = do_socket(cfg_tcp);
336355
@@ -342,12 +361,7 @@ static void do_recv(void) · 5 unmodified lines
342361
343362 treport = gettimeofday_ms() + 1000;
344363 do {
345− /* force termination after the second poll(); this cope both
346− * with sender slower than receiver and missing packet errors
347− */
348− if (cfg_expected_pkt_nr && loop++)
349− interrupted = true;
350− do_poll(fd);
364+ do_poll(fd, timeout_ms);
351365
352366 if (cfg_tcp)
353367 do_flush_tcp(fd);
@@ -365,6 +379,8 @@ static void do_recv(void) · 11 unmodified lines
365379 treport = tnow + 1000;
366380 }
367381
382+ timeout_ms = cfg_rcv_timeout_ms;
383+
368384 } while (!interrupted);
369385
370386 if (cfg_expected_pkt_nr && (packets != cfg_expected_pkt_nr))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t