Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Mar 10, 2022
  2. Mar 09, 2022
    • Jakub Kicinski's avatar
      Merge branch 'selftests-pmtu-sh-fix-cleanup-of-processes-launched-in-subshell' · 5f147476
      Jakub Kicinski authored
      Guillaume Nault says:
      
      ====================
      selftests: pmtu.sh: Fix cleanup of processes launched in subshell.
      
      Depending on the options used, pmtu.sh may launch tcpdump and nettest
      processes in the background. However it fails to clean them up after
      the tests complete.
      
      Patch 1 allows the cleanup() function to read the list of PIDs launched
      by the tests.
      Patch 2 fixes the way the nettest PIDs are retrieved.
      ====================
      
      Link: https://lore.kernel.org/r/cover.1646776561.git.gnault@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5f147476
    • Guillaume Nault's avatar
      selftests: pmtu.sh: Kill nettest processes launched in subshell. · 94a4a4fe
      Guillaume Nault authored
      When using "run_cmd <command> &", then "$!" refers to the PID of the
      subshell used to run <command>, not the command itself. Therefore
      nettest_pids actually doesn't contain the list of the nettest commands
      running in the background. So cleanup() can't kill them and the nettest
      processes run until completion (fortunately they have a 5s timeout).
      
      Fix this by defining a new command for running processes in the
      background, for which "$!" really refers to the PID of the command run.
      
      Also, double quote variables on the modified lines, to avoid shellcheck
      warnings.
      
      Fixes: ece1278a
      
       ("selftests: net: add ESP-in-UDP PMTU test")
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      94a4a4fe
    • Guillaume Nault's avatar
      selftests: pmtu.sh: Kill tcpdump processes launched by subshell. · 18dfc667
      Guillaume Nault authored
      The cleanup() function takes care of killing processes launched by the
      test functions. It relies on variables like ${tcpdump_pids} to get the
      relevant PIDs. But tests are run in their own subshell, so updated
      *_pids values are invisible to other shells. Therefore cleanup() never
      sees any process to kill:
      
      $ ./tools/testing/selftests/net/pmtu.sh -t pmtu_ipv4_exception
      TEST: ipv4: PMTU exceptions                                         [ OK ]
      TEST: ipv4: PMTU exceptions - nexthop objects                       [ OK ]
      
      $ pgrep -af tcpdump
      6084 tcpdump -s 0 -i veth_A-R1 -w pmtu_ipv4_exception_veth_A-R1.pcap
      6085 tcpdump -s 0 -i veth_R1-A -w pmtu_ipv4_exception_veth_R1-A.pcap
      6086 tcpdump -s 0 -i veth_R1-B -w pmtu_ipv4_exception_veth_R1-B.pcap
      6087 tcpdump -s 0 -i veth_B-R1 -w pmtu_ipv4_exception_veth_B-R1.pcap
      6088 tcpdump -s 0 -i veth_A-R2 -w pmtu_ipv4_exception_veth_A-R2.pcap
      6089 tcpdump -s 0 -i veth_R2-A -w pmtu_ipv4_exception_veth_R2-A.pcap
      6090 tcpdump -s 0 -i veth_R2-B -w pmtu_ipv4_exception_veth_R2-B.pcap
      6091 tcpdump -s 0 -i veth_B-R2 -w pmtu_ipv4_exception_veth_B-R2.pcap
      6228 tcpdump -s 0 -i veth_A-R1 -w pmtu_ipv4_exception_veth_A-R1.pcap
      6229 tcpdump -s 0 -i veth_R1-A -w pmtu_ipv4_exception_veth_R1-A.pcap
      6230 tcpdump -s 0 -i veth_R1-B -w pmtu_ipv4_exception_veth_R1-B.pcap
      6231 tcpdump -s 0 -i veth_B-R1 -w pmtu_ipv4_exception_veth_B-R1.pcap
      6232 tcpdump -s 0 -i veth_A-R2 -w pmtu_ipv4_exception_veth_A-R2.pcap
      6233 tcpdump -s 0 -i veth_R2-A -w pmtu_ipv4_exception_veth_R2-A.pcap
      6234 tcpdump -s 0 -i veth_R2-B -w pmtu_ipv4_exception_veth_R2-B.pcap
      6235 tcpdump -s 0 -i veth_B-R2 -w pmtu_ipv4_exception_veth_B-R2.pcap
      
      Fix this by running cleanup() in the context of the test subshell.
      Now that each test cleans the environment after completion, there's no
      need for calling cleanup() again when the next test starts. So let's
      drop it from the setup() function. This is okay because cleanup() is
      also called when pmtu.sh starts, so even the first test starts in a
      clean environment.
      
      Also, use tcpdump's immediate mode. Otherwise it might not have time to
      process buffered packets, resulting in missing packets or even empty
      pcap files for short tests.
      
      Note: PAUSE_ON_FAIL is still evaluated before cleanup(), so one can
      still inspect the test environment upon failure when using -p.
      
      Fixes: a92a0a7b
      
       ("selftests: pmtu: Simplify cleanup and namespace names")
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      18dfc667
    • Pavel Skripkin's avatar
      NFC: port100: fix use-after-free in port100_send_complete · f80cfe2f
      Pavel Skripkin authored
      Syzbot reported UAF in port100_send_complete(). The root case is in
      missing usb_kill_urb() calls on error handling path of ->probe function.
      
      port100_send_complete() accesses devm allocated memory which will be
      freed on probe failure. We should kill this urbs before returning an
      error from probe function to prevent reported use-after-free
      
      Fail log:
      
      BUG: KASAN: use-after-free in port100_send_complete+0x16e/0x1a0 drivers/nfc/port100.c:935
      Read of size 1 at addr ffff88801bb59540 by task ksoftirqd/2/26
      ...
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       print_address_description.constprop.0.cold+0x8d/0x303 mm/kasan/report.c:255
       __kasan_report mm/kasan/report.c:442 [inline]
       kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
       port100_send_complete+0x16e/0x1a0 drivers/nfc/port100.c:935
       __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1670
      
      ...
      
      Allocated by task 1255:
       kasan_save...
      f80cfe2f
    • Ben Ben-Ishay's avatar
      net/mlx5e: SHAMPO, reduce TIR indication · 99a2b9be
      Ben Ben-Ishay authored
      SHAMPO is an RQ / WQ feature, an indication was added to the TIR in the
      first place to enforce suitability between connected TIR and RQ, this
      enforcement does not exist in current the Firmware implementation and was
      redundant in the first place.
      
      Fixes: 83439f3c
      
       ("net/mlx5e: Add HW-GRO offload")
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      99a2b9be
    • Roi Dayan's avatar
      net/mlx5e: Lag, Only handle events from highest priority multipath entry · ad11c4f1
      Roi Dayan authored
      There could be multiple multipath entries but changing the port affinity
      for each one doesn't make much sense and there should be a default one.
      So only track the entry with lowest priority value.
      The commit doesn't affect existing users with a single entry.
      
      Fixes: 544fe7c2
      
       ("net/mlx5e: Activate HW multipath and handle port affinity based on FIB events")
      Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      ad11c4f1
    • Dima Chumak's avatar
      net/mlx5: Fix offloading with ESWITCH_IPV4_TTL_MODIFY_ENABLE · 39bab83b
      Dima Chumak authored
      Only prio 1 is supported for nic mode when there is no ignore flow level
      support in firmware. But for switchdev mode, which supports fixed number
      of statically pre-allocated prios, this restriction is not relevant so
      it can be relaxed.
      
      Fixes: d671e109
      
       ("net/mlx5: Fix tc max supported prio for nic mode")
      Signed-off-by: default avatarDima Chumak <dchumak@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      39bab83b
    • Moshe Shemesh's avatar
      net/mlx5: Fix a race on command flush flow · 063bd355
      Moshe Shemesh authored
      Fix a refcount use after free warning due to a race on command entry.
      Such race occurs when one of the commands releases its last refcount and
      frees its index and entry while another process running command flush
      flow takes refcount to this command entry. The process which handles
      commands flush may see this command as needed to be flushed if the other
      process released its refcount but didn't release the index yet. Fix it
      by adding the needed spin lock.
      
      It fixes the following warning trace:
      
      refcount_t: addition on 0; use-after-free.
      WARNING: CPU: 11 PID: 540311 at lib/refcount.c:25 refcount_warn_saturate+0x80/0xe0
      ...
      RIP: 0010:refcount_warn_saturate+0x80/0xe0
      ...
      Call Trace:
       <TASK>
       mlx5_cmd_trigger_completions+0x293/0x340 [mlx5_core]
       mlx5_cmd_flush+0x3a/0xf0 [mlx5_core]
       enter_error_state+0x44/0x80 [mlx5_core]
       mlx5_fw_fatal_reporter_err_work+0x37/0xe0 [mlx5_core]
       process_one_work+0x1be/0x390
       worker_thread+0x4d/0x3d0
       ? rescuer_thread+0x350/0x350
       kthread+0x141/0x160
       ? set_kthread_struct+0x40/0x40
       ret_from_fork+0x1f/0x30
       </TASK>
      
      Fixes: 50b2412b
      
       ("net/mlx5: Avoid possible free of command entry while timeout comp handler")
      Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Reviewed-by: default avatarEran Ben Elisha <eranbe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      063bd355
    • Mohammad Kabat's avatar
      net/mlx5: Fix size field in bufferx_reg struct · ac77998b
      Mohammad Kabat authored
      According to HW spec the field "size" should be 16 bits
      in bufferx register.
      
      Fixes: e281682b
      
       ("net/mlx5_core: HW data structs/types definitions cleanup")
      Signed-off-by: default avatarMohammad Kabat <mohammadkab@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      ac77998b
    • David S. Miller's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · cc7e2f59
      David S. Miller authored
      
      Steffen Klassert says:
      
      ====================
      pull request (net): ipsec 2022-03-09
      
      1) Fix IPv6 PMTU discovery for xfrm interfaces.
         From Lina Wang.
      
      2) Revert failing for policies and states that are
         configured with XFRMA_IF_ID 0. It broke a
         user configuration. From Kai Lueke.
      
      3) Fix a possible buffer overflow in the ESP output path.
      
      4) Fix ESP GSO for tunnel and BEET mode on inter address
         family tunnels.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc7e2f59
    • Duoming Zhou's avatar
      ax25: Fix NULL pointer dereference in ax25_kill_by_device · 71171ac8
      Duoming Zhou authored
      When two ax25 devices attempted to establish connection, the requester use ax25_create(),
      ax25_bind() and ax25_connect() to initiate connection. The receiver use ax25_rcv() to
      accept connection and use ax25_create_cb() in ax25_rcv() to create ax25_cb, but the
      ax25_cb->sk is NULL. When the receiver is detaching, a NULL pointer dereference bug
      caused by sock_hold(sk) in ax25_kill_by_device() will happen. The corresponding
      fail log is shown below:
      
      ===============================================================
      BUG: KASAN: null-ptr-deref in ax25_device_event+0xfd/0x290
      Call Trace:
      ...
      ax25_device_event+0xfd/0x290
      raw_notifier_call_chain+0x5e/0x70
      dev_close_many+0x174/0x220
      unregister_netdevice_many+0x1f7/0xa60
      unregister_netdevice_queue+0x12f/0x170
      unregister_netdev+0x13/0x20
      mkiss_close+0xcd/0x140
      tty_ldisc_release+0xc0/0x220
      tty_release_struct+0x17/0xa0
      tty_release+0x62d/0x670
      ...
      
      This patch add condition check in ax25_kill_by_device(). If s->sk is
      NULL, it will goto if branch to kill device.
      
      Fixes: 4e0f718d
      
       ("ax25: improve the incomplete fix to avoid UAF and NPD bugs")
      Reported-by: default avatarThomas Osterried <thomas@osterried.de>
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71171ac8
    • Miaoqian Lin's avatar
      net: marvell: prestera: Add missing of_node_put() in prestera_switch_set_base_mac_addr · c9ffa3e2
      Miaoqian Lin authored
      This node pointer is returned by of_find_compatible_node() with
      refcount incremented. Calling of_node_put() to aovid the refcount leak.
      
      Fixes: 501ef306
      
       ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c9ffa3e2
    • Jiasheng Jiang's avatar
      net: ethernet: lpc_eth: Handle error for clk_enable · 2169b792
      Jiasheng Jiang authored
      As the potential failure of the clk_enable(),
      it should be better to check it and return error
      if fails.
      
      Fixes: b7370112
      
       ("lpc32xx: Added ethernet driver")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2169b792
    • Minghao Chi (CGEL ZTE)'s avatar
      net:mcf8390: Use platform_get_irq() to get the interrupt · 2a760554
      Minghao Chi (CGEL ZTE) authored
      
      It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ)
      for requesting IRQ's resources any more, as they can be not ready yet in
      case of DT-booting.
      
      platform_get_irq() instead is a recommended way for getting IRQ even if
      it was not retrieved earlier.
      
      It also makes code simpler because we're getting "int" value right away
      and no conversion from resource to int is required.
      
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarMinghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a760554
    • Jiasheng Jiang's avatar
      net: ethernet: ti: cpts: Handle error for clk_enable · 6babfc6e
      Jiasheng Jiang authored
      As the potential failure of the clk_enable(),
      it should be better to check it and return error
      if fails.
      
      Fixes: 8a2c9a5a
      
       ("net: ethernet: ti: cpts: rework initialization/deinitialization")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6babfc6e
    • David S. Miller's avatar
      Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 030141b0
      David S. Miller authored
      
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2022-03-08
      
      This series contains updates to iavf, i40e, and ice drivers.
      
      Michal ensures netdev features are properly updated to reflect VLAN
      changes received from PF and adds an additional flag for MSI-X
      reinitialization as further differentiation of reinitialization
      operations is needed for iavf.
      
      Jake stops disabling of VFs due to failed virtchannel responses for
      i40e and ice driver.
      
      Dave moves MTU event notification to the service task to prevent issues
      with RTNL lock for ice.
      
      Christophe Jaillet corrects an allocation to GFP_ATOMIC instead of
      GFP_KERNEL for ice.
      
      Jedrzej fixes the value for link speed comparison which was preventing
      the requested value from being set for ice.
      ---
      Note: This will conflict when merging with net-next. Resolution:
      
      diff --cc drivers/net/ethernet/intel/ice/ice.h
      index dc42ff92dbad,3121f9b04f59..000000000000
      --- a/drivers/net/ethernet/intel/ice/ice.h
      +++ b/drivers/net/ethernet/intel/ice/ice.h
      @@@ -484,10 -481,9 +484,11 @@@ enum ice_pf_flags
              ICE_FLAG_LEGACY_RX,
              ICE_FLAG_VF_TRUE_PROMISC_ENA,
              ICE_FLAG_MDD_AUTO_RESET_VF,
       +      ICE_FLAG_VF_VLAN_PRUNING,
              ICE_FLAG_LINK_LENIENT_MODE_ENA,
              ICE_FLAG_PLUG_AUX_DEV,
      +       ICE_FLAG_MTU_CHANGED,
       +      ICE_FLAG_GNSS,                  /* GNSS successfully initialized */
              ICE_PF_FLAGS_NBITS              /* must be last */
        };
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      030141b0
    • Tung Nguyen's avatar
      tipc: fix incorrect order of state message data sanity check · c79fcc27
      Tung Nguyen authored
      When receiving a state message, function tipc_link_validate_msg()
      is called to validate its header portion. Then, its data portion
      is validated before it can be accessed correctly. However, current
      data sanity  check is done after the message header is accessed to
      update some link variables.
      
      This commit fixes this issue by moving the data sanity check to
      the beginning of state message handling and right after the header
      sanity check.
      
      Fixes: 9aa422ad
      
       ("tipc: improve size validations for received domain records")
      Acked-by: default avatarJon Maloy <jmaloy@redhat.com>
      Signed-off-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
      Link: https://lore.kernel.org/r/20220308021200.9245-1-tung.q.nguyen@dektech.com.au
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c79fcc27
    • Miaoqian Lin's avatar
      ethernet: Fix error handling in xemaclite_of_probe · b19ab4b3
      Miaoqian Lin authored
      This node pointer is returned by of_parse_phandle() with refcount
      incremented in this function. Calling of_node_put() to avoid the
      refcount leak. As the remove function do.
      
      Fixes: 5cdaaa12
      
       ("net: emaclite: adding MDIO and phy lib support")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20220308024751.2320-1-linmq006@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b19ab4b3
  3. Mar 08, 2022
  4. Mar 07, 2022
  5. Mar 06, 2022