1. 06 Feb, 2023 9 commits
    • Zhang Changzhong's avatar
      ice: switch: fix potential memleak in ice_add_adv_recipe() · 4a606ce6
      Zhang Changzhong authored
      When ice_add_special_words() fails, the 'rm' is not released, which will
      lead to a memory leak. Fix this up by going to 'err_unroll' label.
      
      Compile tested only.
      
      Fixes: 8b032a55 ("ice: low level support for tunnels")
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      4a606ce6
    • Dan Carpenter's avatar
      ice: Fix off by one in ice_tc_forward_to_queue() · 3f4870df
      Dan Carpenter authored
      The > comparison should be >= to prevent reading one element beyond
      the end of the array.
      
      The "vsi->num_rxq" is not strictly speaking the number of elements in
      the vsi->rxq_map[] array.  The array has "vsi->alloc_rxq" elements and
      "vsi->num_rxq" is less than or equal to the number of elements in the
      array.  The array is allocated in ice_vsi_alloc_arrays().  It's still
      an off by one but it might not access outside the end of the array.
      
      Fixes: 143b86f3 ("ice: Enable RX queue selection using skbedit action")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarAmritha Nambiar <amritha.nambiar@intel.com>
      Tested-by: default avatarBharathi Sreenivas <bharathi.sreenivas@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      3f4870df
    • Brett Creeley's avatar
      ice: Fix disabling Rx VLAN filtering with port VLAN enabled · c793f8ea
      Brett Creeley authored
      If the user turns on the vf-true-promiscuous-support flag, then Rx VLAN
      filtering will be disabled if the VF requests to enable promiscuous
      mode. When the VF is in a port VLAN, this is the incorrect behavior
      because it will allow the VF to receive traffic outside of its port VLAN
      domain. Fortunately this only resulted in the VF(s) receiving broadcast
      traffic outside of the VLAN domain because all of the VLAN promiscuous
      rules are based on the port VLAN ID. Fix this by setting the
      .disable_rx_filtering VLAN op to a no-op when a port VLAN is enabled on
      the VF.
      
      Also, make sure to make this fix for both Single VLAN Mode and Double
      VLAN Mode enabled devices.
      
      Fixes: c31af68a ("ice: Add outer_vlan_ops and VSI specific VLAN ops implementations")
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarKaren Ostrowska <karen.ostrowska@intel.com>
      Tested-by: default avatarMarek Szlosek <marek.szlosek@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      c793f8ea
    • Michal Swiatkowski's avatar
      ice: fix out-of-bounds KASAN warning in virtchnl · b2dbde3a
      Michal Swiatkowski authored
      KASAN reported:
      [ 9793.708867] BUG: KASAN: global-out-of-bounds in ice_get_link_speed+0x16/0x30 [ice]
      [ 9793.709205] Read of size 4 at addr ffffffffc1271b1c by task kworker/6:1/402
      
      [ 9793.709222] CPU: 6 PID: 402 Comm: kworker/6:1 Kdump: loaded Tainted: G    B      OE      6.1.0+ #3
      [ 9793.709235] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.00.01.0014.070920180847 07/09/2018
      [ 9793.709245] Workqueue: ice ice_service_task [ice]
      [ 9793.709575] Call Trace:
      [ 9793.709582]  <TASK>
      [ 9793.709588]  dump_stack_lvl+0x44/0x5c
      [ 9793.709613]  print_report+0x17f/0x47b
      [ 9793.709632]  ? __cpuidle_text_end+0x5/0x5
      [ 9793.709653]  ? ice_get_link_speed+0x16/0x30 [ice]
      [ 9793.709986]  ? ice_get_link_speed+0x16/0x30 [ice]
      [ 9793.710317]  kasan_report+0xb7/0x140
      [ 9793.710335]  ? ice_get_link_speed+0x16/0x30 [ice]
      [ 9793.710673]  ice_get_link_speed+0x16/0x30 [ice]
      [ 9793.711006]  ice_vc_notify_vf_link_state+0x14c/0x160 [ice]
      [ 9793.711351]  ? ice_vc_repr_cfg_promiscuous_mode+0x120/0x120 [ice]
      [ 9793.711698]  ice_vc_process_vf_msg+0x7a7/0xc00 [ice]
      [ 9793.712074]  __ice_clean_ctrlq+0x98f/0xd20 [ice]
      [ 9793.712534]  ? ice_bridge_setlink+0x410/0x410 [ice]
      [ 9793.712979]  ? __request_module+0x320/0x520
      [ 9793.713014]  ? ice_process_vflr_event+0x27/0x130 [ice]
      [ 9793.713489]  ice_service_task+0x11cf/0x1950 [ice]
      [ 9793.713948]  ? io_schedule_timeout+0xb0/0xb0
      [ 9793.713972]  process_one_work+0x3d0/0x6a0
      [ 9793.714003]  worker_thread+0x8a/0x610
      [ 9793.714031]  ? process_one_work+0x6a0/0x6a0
      [ 9793.714049]  kthread+0x164/0x1a0
      [ 9793.714071]  ? kthread_complete_and_exit+0x20/0x20
      [ 9793.714100]  ret_from_fork+0x1f/0x30
      [ 9793.714137]  </TASK>
      
      [ 9793.714151] The buggy address belongs to the variable:
      [ 9793.714158]  ice_aq_to_link_speed+0x3c/0xffffffffffff3520 [ice]
      
      [ 9793.714632] Memory state around the buggy address:
      [ 9793.714642]  ffffffffc1271a00: f9 f9 f9 f9 00 00 05 f9 f9 f9 f9 f9 00 00 02 f9
      [ 9793.714656]  ffffffffc1271a80: f9 f9 f9 f9 00 00 04 f9 f9 f9 f9 f9 00 00 00 00
      [ 9793.714670] >ffffffffc1271b00: 00 00 00 04 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
      [ 9793.714680]                             ^
      [ 9793.714690]  ffffffffc1271b80: 00 00 00 00 00 04 f9 f9 f9 f9 f9 f9 00 00 00 00
      [ 9793.714704]  ffffffffc1271c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      
      The ICE_AQ_LINK_SPEED_UNKNOWN define is BIT(15). The value is bigger
      than both legacy and normal link speed tables. Add one element (0 -
      unknown) to both tables. There is no need to explicitly set table size,
      leave it empty.
      
      Fixes: 1d0e28a9 ("ice: Remove and replace ice speed defines with ethtool.h versions")
      Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
      Reviewed-by: default avatarAlexander Lobakin <alexandr.lobakin@intel.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      b2dbde3a
    • Anirudh Venkataramanan's avatar
      ice: Do not use WQ_MEM_RECLAIM flag for workqueue · 4d159f78
      Anirudh Venkataramanan authored
      When both ice and the irdma driver are loaded, a warning in
      check_flush_dependency is being triggered. This is due to ice driver
      workqueue being allocated with the WQ_MEM_RECLAIM flag and the irdma one
      is not.
      
      According to kernel documentation, this flag should be set if the
      workqueue will be involved in the kernel's memory reclamation flow.
      Since it is not, there is no need for the ice driver's WQ to have this
      flag set so remove it.
      
      Example trace:
      
      [  +0.000004] workqueue: WQ_MEM_RECLAIM ice:ice_service_task [ice] is flushing !WQ_MEM_RECLAIM infiniband:0x0
      [  +0.000139] WARNING: CPU: 0 PID: 728 at kernel/workqueue.c:2632 check_flush_dependency+0x178/0x1a0
      [  +0.000011] Modules linked in: bonding tls xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 nft_compat nft_cha
      in_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink bridge stp llc rfkill vfat fat intel_rapl_msr intel
      _rapl_common isst_if_common skx_edac nfit libnvdimm x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct1
      0dif_pclmul crc32_pclmul ghash_clmulni_intel rapl intel_cstate rpcrdma sunrpc rdma_ucm ib_srpt ib_isert iscsi_target_mod target_
      core_mod ib_iser libiscsi scsi_transport_iscsi rdma_cm ib_cm iw_cm iTCO_wdt iTCO_vendor_support ipmi_ssif irdma mei_me ib_uverbs
      ib_core intel_uncore joydev pcspkr i2c_i801 acpi_ipmi mei lpc_ich i2c_smbus intel_pch_thermal ioatdma ipmi_si acpi_power_meter
      acpi_pad xfs libcrc32c sd_mod t10_pi crc64_rocksoft crc64 sg ahci ixgbe libahci ice i40e igb crc32c_intel mdio i2c_algo_bit liba
      ta dca wmi dm_mirror dm_region_hash dm_log dm_mod ipmi_devintf ipmi_msghandler fuse
      [  +0.000161]  [last unloaded: bonding]
      [  +0.000006] CPU: 0 PID: 728 Comm: kworker/0:2 Tainted: G S                 6.2.0-rc2_next-queue-13jan-00458-gc20aabd57164 #1
      [  +0.000006] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0010.010620200716 01/06/2020
      [  +0.000003] Workqueue: ice ice_service_task [ice]
      [  +0.000127] RIP: 0010:check_flush_dependency+0x178/0x1a0
      [  +0.000005] Code: 89 8e 02 01 e8 49 3d 40 00 49 8b 55 18 48 8d 8d d0 00 00 00 48 8d b3 d0 00 00 00 4d 89 e0 48 c7 c7 e0 3b 08
      9f e8 bb d3 07 01 <0f> 0b e9 be fe ff ff 80 3d 24 89 8e 02 00 0f 85 6b ff ff ff e9 06
      [  +0.000004] RSP: 0018:ffff88810a39f990 EFLAGS: 00010282
      [  +0.000005] RAX: 0000000000000000 RBX: ffff888141bc2400 RCX: 0000000000000000
      [  +0.000004] RDX: 0000000000000001 RSI: dffffc0000000000 RDI: ffffffffa1213a80
      [  +0.000003] RBP: ffff888194bf3400 R08: ffffed117b306112 R09: ffffed117b306112
      [  +0.000003] R10: ffff888bd983088b R11: ffffed117b306111 R12: 0000000000000000
      [  +0.000003] R13: ffff888111f84d00 R14: ffff88810a3943ac R15: ffff888194bf3400
      [  +0.000004] FS:  0000000000000000(0000) GS:ffff888bd9800000(0000) knlGS:0000000000000000
      [  +0.000003] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  +0.000003] CR2: 000056035b208b60 CR3: 000000017795e005 CR4: 00000000007706f0
      [  +0.000003] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  +0.000003] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  +0.000002] PKRU: 55555554
      [  +0.000003] Call Trace:
      [  +0.000002]  <TASK>
      [  +0.000003]  __flush_workqueue+0x203/0x840
      [  +0.000006]  ? mutex_unlock+0x84/0xd0
      [  +0.000008]  ? __pfx_mutex_unlock+0x10/0x10
      [  +0.000004]  ? __pfx___flush_workqueue+0x10/0x10
      [  +0.000006]  ? mutex_lock+0xa3/0xf0
      [  +0.000005]  ib_cache_cleanup_one+0x39/0x190 [ib_core]
      [  +0.000174]  __ib_unregister_device+0x84/0xf0 [ib_core]
      [  +0.000094]  ib_unregister_device+0x25/0x30 [ib_core]
      [  +0.000093]  irdma_ib_unregister_device+0x97/0xc0 [irdma]
      [  +0.000064]  ? __pfx_irdma_ib_unregister_device+0x10/0x10 [irdma]
      [  +0.000059]  ? up_write+0x5c/0x90
      [  +0.000005]  irdma_remove+0x36/0x90 [irdma]
      [  +0.000062]  auxiliary_bus_remove+0x32/0x50
      [  +0.000007]  device_release_driver_internal+0xfa/0x1c0
      [  +0.000005]  bus_remove_device+0x18a/0x260
      [  +0.000007]  device_del+0x2e5/0x650
      [  +0.000005]  ? __pfx_device_del+0x10/0x10
      [  +0.000003]  ? mutex_unlock+0x84/0xd0
      [  +0.000004]  ? __pfx_mutex_unlock+0x10/0x10
      [  +0.000004]  ? _raw_spin_unlock+0x18/0x40
      [  +0.000005]  ice_unplug_aux_dev+0x52/0x70 [ice]
      [  +0.000160]  ice_service_task+0x1309/0x14f0 [ice]
      [  +0.000134]  ? __pfx___schedule+0x10/0x10
      [  +0.000006]  process_one_work+0x3b1/0x6c0
      [  +0.000008]  worker_thread+0x69/0x670
      [  +0.000005]  ? __kthread_parkme+0xec/0x110
      [  +0.000007]  ? __pfx_worker_thread+0x10/0x10
      [  +0.000005]  kthread+0x17f/0x1b0
      [  +0.000005]  ? __pfx_kthread+0x10/0x10
      [  +0.000004]  ret_from_fork+0x29/0x50
      [  +0.000009]  </TASK>
      
      Fixes: 940b61af ("ice: Initialize PF and setup miscellaneous interrupt")
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Signed-off-by: default avatarMarcin Szycik <marcin.szycik@linux.intel.com>
      Tested-by: default avatarJakub Andrysiak <jakub.andrysiak@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      4d159f78
    • Alan Stern's avatar
      net: USB: Fix wrong-direction WARNING in plusb.c · 811d5811
      Alan Stern authored
      The syzbot fuzzer detected a bug in the plusb network driver: A
      zero-length control-OUT transfer was treated as a read instead of a
      write.  In modern kernels this error provokes a WARNING:
      
      usb 1-1: BOGUS control dir, pipe 80000280 doesn't match bRequestType c0
      WARNING: CPU: 0 PID: 4645 at drivers/usb/core/urb.c:411
      usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
      Modules linked in:
      CPU: 1 PID: 4645 Comm: dhcpcd Not tainted
      6.2.0-rc6-syzkaller-00050-g9f266cca #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google
      01/12/2023
      RIP: 0010:usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
      ...
      Call Trace:
       <TASK>
       usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58
       usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
       usb_control_msg+0x320/0x4a0 drivers/usb/core/message.c:153
       __usbnet_read_cmd+0xb9/0x390 drivers/net/usb/usbnet.c:2010
       usbnet_read_cmd+0x96/0xf0 drivers/net/usb/usbnet.c:2068
       pl_vendor_req drivers/net/usb/plusb.c:60 [inline]
       pl_set_QuickLink_features drivers/net/usb/plusb.c:75 [inline]
       pl_reset+0x2f/0xf0 drivers/net/usb/plusb.c:85
       usbnet_open+0xcc/0x5d0 drivers/net/usb/usbnet.c:889
       __dev_open+0x297/0x4d0 net/core/dev.c:1417
       __dev_change_flags+0x587/0x750 net/core/dev.c:8530
       dev_change_flags+0x97/0x170 net/core/dev.c:8602
       devinet_ioctl+0x15a2/0x1d70 net/ipv4/devinet.c:1147
       inet_ioctl+0x33f/0x380 net/ipv4/af_inet.c:979
       sock_do_ioctl+0xcc/0x230 net/socket.c:1169
       sock_ioctl+0x1f8/0x680 net/socket.c:1286
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl fs/ioctl.c:856 [inline]
       __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The fix is to call usbnet_write_cmd() instead of usbnet_read_cmd() and
      remove the USB_DIR_IN flag.
      
      Reported-and-tested-by: syzbot+2a0e7abd24f1eb90ce25@syzkaller.appspotmail.com
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Fixes: 090ffa9d ("[PATCH] USB: usbnet (9/9) module for pl2301/2302 cables")
      CC: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/00000000000052099f05f3b3e298@google.com/Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      811d5811
    • Casper Andersson's avatar
      net: microchip: sparx5: fix PTP init/deinit not checking all ports · d7d94b26
      Casper Andersson authored
      Check all ports instead of just port_count ports. PTP init was only
      checking ports 0 to port_count. If the hardware ports are not mapped
      starting from 0 then they would be missed, e.g. if only ports 20-30 were
      mapped it would attempt to init ports 0-10, resulting in NULL pointers
      when attempting to timestamp. Now it will init all mapped ports.
      
      Fixes: 70dfe25c ("net: sparx5: Update extraction/injection for timestamping")
      Signed-off-by: default avatarCasper Andersson <casper.casan@gmail.com>
      Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d7d94b26
    • Herton R. Krzesinski's avatar
      uapi: add missing ip/ipv6 header dependencies for linux/stddef.h · 03702d4d
      Herton R. Krzesinski authored
      Since commit 58e0be1e ("net: use struct_group to copy ip/ipv6
      header addresses"), ip and ipv6 headers started to use the __struct_group
      definition, which is defined at include/uapi/linux/stddef.h. However,
      linux/stddef.h isn't explicitly included in include/uapi/linux/{ip,ipv6}.h,
      which breaks build of xskxceiver bpf selftest if you install the uapi
      headers in the system:
      
      $ make V=1 xskxceiver -C tools/testing/selftests/bpf
      ...
      make: Entering directory '(...)/tools/testing/selftests/bpf'
      gcc -g -O0 -rdynamic -Wall -Werror (...)
      In file included from xskxceiver.c:79:
      /usr/include/linux/ip.h:103:9: error: expected specifier-qualifier-list before ‘__struct_group’
        103 |         __struct_group(/* no tag */, addrs, /* no attrs */,
            |         ^~~~~~~~~~~~~~
      ...
      
      Include the missing <linux/stddef.h> dependency in ip.h and do the
      same for the ipv6.h header.
      
      Fixes: 58e0be1e ("net: use struct_group to copy ip/ipv6 header addresses")
      Signed-off-by: default avatarHerton R. Krzesinski <herton@redhat.com>
      Reviewed-by: default avatarCarlos O'Donell <carlos@redhat.com>
      Tested-by: default avatarCarlos O'Donell <carlos@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      03702d4d
    • Julian Anastasov's avatar
      neigh: make sure used and confirmed times are valid · c1d2ecdf
      Julian Anastasov authored
      Entries can linger in cache without timer for days, thanks to
      the gc_thresh1 limit. As result, without traffic, the confirmed
      time can be outdated and to appear to be in the future. Later,
      on traffic, NUD_STALE entries can switch to NUD_DELAY and start
      the timer which can see the invalid confirmed time and wrongly
      switch to NUD_REACHABLE state instead of NUD_PROBE. As result,
      timer is set many days in the future. This is more visible on
      32-bit platforms, with higher HZ value.
      
      Why this is a problem? While we expect unused entries to expire,
      such entries stay in REACHABLE state for too long, locked in
      cache. They are not expired normally, only when cache is full.
      
      Problem and the wrong state change reported by Zhang Changzhong:
      
      172.16.1.18 dev bond0 lladdr 0a:0e:0f:01:12:01 ref 1 used 350521/15994171/350520 probes 4 REACHABLE
      
      350520 seconds have elapsed since this entry was last updated, but it is
      still in the REACHABLE state (base_reachable_time_ms is 30000),
      preventing lladdr from being updated through probe.
      
      Fix it by ensuring timer is started with valid used/confirmed
      times. Considering the valid time range is LONG_MAX jiffies,
      we try not to go too much in the past while we are in
      DELAY/PROBE state. There are also places that need
      used/updated times to be validated while timer is not running.
      Reported-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Signed-off-by: default avatarJulian Anastasov <ja@ssi.bg>
      Tested-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c1d2ecdf
  2. 04 Feb, 2023 7 commits
  3. 03 Feb, 2023 1 commit
  4. 02 Feb, 2023 23 commits