1. 18 May, 2022 8 commits
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Properly block LRO when XDP is enabled · cf6e34c8
      Maxim Mikityanskiy authored
      LRO is incompatible and mutually exclusive with XDP. However, the needed
      checks are only made when enabling XDP. If LRO is enabled when XDP is
      already active, the command will succeed, and XDP will be skipped in the
      data path, although still enabled.
      
      This commit fixes the bug by checking the XDP status in
      mlx5e_fix_features and disabling LRO if XDP is enabled.
      
      Fixes: 86994156 ("net/mlx5e: XDP fast RX drop bpf programs support")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      cf6e34c8
    • Aya Levin's avatar
      net/mlx5e: Block rx-gro-hw feature in switchdev mode · 15a5078c
      Aya Levin authored
      When the driver is in switchdev mode and rx-gro-hw is set, the RQ needs
      special CQE handling. Till then, block setting of rx-gro-hw feature in
      switchdev mode, to avoid failure while setting the feature due to
      failure while opening the RQ.
      
      Fixes: f97d5c2a ("net/mlx5e: Add handle SHAMPO cqe support")
      Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      15a5078c
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Wrap mlx5e_trap_napi_poll into rcu_read_lock · 37916974
      Maxim Mikityanskiy authored
      The body of mlx5e_napi_poll is wrapped into rcu_read_lock to be able to
      read the XDP program pointer using rcu_dereference. However, the trap RQ
      NAPI doesn't use rcu_read_lock, because the trap RQ works only in the
      non-linear mode, and mlx5e_skb_from_cqe_nonlinear, until recently,
      didn't support XDP and didn't call rcu_dereference.
      
      Starting from the cited commit, mlx5e_skb_from_cqe_nonlinear supports
      XDP and calls rcu_dereference, but mlx5e_trap_napi_poll doesn't wrap it
      into rcu_read_lock. It leads to RCU-lockdep warnings like this:
      
          WARNING: suspicious RCU usage
      
      This commit fixes the issue by adding an rcu_read_lock to
      mlx5e_trap_napi_poll, similarly to mlx5e_napi_poll.
      
      Fixes: ea5d49bd ("net/mlx5e: Add XDP multi buffer support to the non-linear legacy RQ")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      37916974
    • Yevgeny Kliteynik's avatar
      net/mlx5: DR, Ignore modify TTL on RX if device doesn't support it · 785d7ed2
      Yevgeny Kliteynik authored
      When modifying TTL, packet's csum has to be recalculated.
      Due to HW issue in ConnectX-5, csum recalculation for modify
      TTL on RX is supported through a work-around that is specifically
      enabled by configuration.
      If the work-around isn't enabled, rather than adding an unsupported
      action the modify TTL action on RX should be ignored.
      Ignoring modify TTL action might result in zero actions, so in such
      cases we will not convert the match STE to modify STE, as it is done
      by FW in DMFS.
      
      This patch fixes an issue where modify TTL action was ignored both
      on RX and TX instead of only on RX.
      
      Fixes: 4ff725e1 ("net/mlx5: DR, Ignore modify TTL if device doesn't support it")
      Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Reviewed-by: default avatarAlex Vesker <valex@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      785d7ed2
    • Shay Drory's avatar
      net/mlx5: Initialize flow steering during driver probe · b3388697
      Shay Drory authored
      Currently, software objects of flow steering are created and destroyed
      during reload flow. In case a device is unloaded, the following error
      is printed during grace period:
      
       mlx5_core 0000:00:0b.0: mlx5_fw_fatal_reporter_err_work:690:(pid 95):
          Driver is in error state. Unloading
      
      As a solution to fix use-after-free bugs, where we try to access
      these objects, when reading the value of flow_steering_mode devlink
      param[1], let's split flow steering creation and destruction into two
      routines:
          * init and cleanup: memory, cache, and pools allocation/free.
          * create and destroy: namespaces initialization and cleanup.
      
      While at it, re-order the cleanup function to mirror the init function.
      
      [1]
      Kasan trace:
      
      [  385.119849 ] BUG: KASAN: use-after-free in mlx5_devlink_fs_mode_get+0x3b/0xa0
      [  385.119849 ] Read of size 4 at addr ffff888104b79308 by task bash/291
      [  385.119849 ]
      [  385.119849 ] CPU: 1 PID: 291 Comm: bash Not tainted 5.17.0-rc1+ #2
      [  385.119849 ] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
      [  385.119849 ] Call Trace:
      [  385.119849 ]  <TASK>
      [  385.119849 ]  dump_stack_lvl+0x6e/0x91
      [  385.119849 ]  print_address_description.constprop.0+0x1f/0x160
      [  385.119849 ]  ? mlx5_devlink_fs_mode_get+0x3b/0xa0
      [  385.119849 ]  ? mlx5_devlink_fs_mode_get+0x3b/0xa0
      [  385.119849 ]  kasan_report.cold+0x83/0xdf
      [  385.119849 ]  ? devlink_param_notify+0x20/0x190
      [  385.119849 ]  ? mlx5_devlink_fs_mode_get+0x3b/0xa0
      [  385.119849 ]  mlx5_devlink_fs_mode_get+0x3b/0xa0
      [  385.119849 ]  devlink_nl_param_fill+0x18a/0xa50
      [  385.119849 ]  ? _raw_spin_lock_irqsave+0x8d/0xe0
      [  385.119849 ]  ? devlink_flash_update_timeout_notify+0xf0/0xf0
      [  385.119849 ]  ? __wake_up_common+0x4b/0x1e0
      [  385.119849 ]  ? preempt_count_sub+0x14/0xc0
      [  385.119849 ]  ? _raw_spin_unlock_irqrestore+0x28/0x40
      [  385.119849 ]  ? __wake_up_common_lock+0xe3/0x140
      [  385.119849 ]  ? __wake_up_common+0x1e0/0x1e0
      [  385.119849 ]  ? __sanitizer_cov_trace_const_cmp8+0x27/0x80
      [  385.119849 ]  ? __rcu_read_unlock+0x48/0x70
      [  385.119849 ]  ? kasan_unpoison+0x23/0x50
      [  385.119849 ]  ? __kasan_slab_alloc+0x2c/0x80
      [  385.119849 ]  ? memset+0x20/0x40
      [  385.119849 ]  ? __sanitizer_cov_trace_const_cmp4+0x25/0x80
      [  385.119849 ]  devlink_param_notify+0xce/0x190
      [  385.119849 ]  devlink_unregister+0x92/0x2b0
      [  385.119849 ]  remove_one+0x41/0x140
      [  385.119849 ]  pci_device_remove+0x68/0x140
      [  385.119849 ]  ? pcibios_free_irq+0x10/0x10
      [  385.119849 ]  __device_release_driver+0x294/0x3f0
      [  385.119849 ]  device_driver_detach+0x82/0x130
      [  385.119849 ]  unbind_store+0x193/0x1b0
      [  385.119849 ]  ? subsys_interface_unregister+0x270/0x270
      [  385.119849 ]  drv_attr_store+0x4e/0x70
      [  385.119849 ]  ? drv_attr_show+0x60/0x60
      [  385.119849 ]  sysfs_kf_write+0xa7/0xc0
      [  385.119849 ]  kernfs_fop_write_iter+0x23a/0x2f0
      [  385.119849 ]  ? sysfs_kf_bin_read+0x160/0x160
      [  385.119849 ]  new_sync_write+0x311/0x430
      [  385.119849 ]  ? new_sync_read+0x480/0x480
      [  385.119849 ]  ? _raw_spin_lock+0x87/0xe0
      [  385.119849 ]  ? __sanitizer_cov_trace_cmp4+0x25/0x80
      [  385.119849 ]  ? security_file_permission+0x94/0xa0
      [  385.119849 ]  vfs_write+0x4c7/0x590
      [  385.119849 ]  ksys_write+0xf6/0x1e0
      [  385.119849 ]  ? __x64_sys_read+0x50/0x50
      [  385.119849 ]  ? fpregs_assert_state_consistent+0x99/0xa0
      [  385.119849 ]  do_syscall_64+0x3d/0x90
      [  385.119849 ]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [  385.119849 ] RIP: 0033:0x7fc36ef38504
      [  385.119849 ] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f
      80 00 00 00 00 48 8d 05 f9 61 0d 00 8b 00 85 c0 75 13 b8 01 00 00 00 0f
      05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 41 54 49 89 d4 55 48 89 f5 53
      [  385.119849 ] RSP: 002b:00007ffde0ff3d08 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      [  385.119849 ] RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fc36ef38504
      [  385.119849 ] RDX: 000000000000000c RSI: 00007fc370521040 RDI: 0000000000000001
      [  385.119849 ] RBP: 00007fc370521040 R08: 00007fc36f00b8c0 R09: 00007fc36ee4b740
      [  385.119849 ] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc36f00a760
      [  385.119849 ] R13: 000000000000000c R14: 00007fc36f005760 R15: 000000000000000c
      [  385.119849 ]  </TASK>
      [  385.119849 ]
      [  385.119849 ] Allocated by task 65:
      [  385.119849 ]  kasan_save_stack+0x1e/0x40
      [  385.119849 ]  __kasan_kmalloc+0x81/0xa0
      [  385.119849 ]  mlx5_init_fs+0x11b/0x1160
      [  385.119849 ]  mlx5_load+0x13c/0x220
      [  385.119849 ]  mlx5_load_one+0xda/0x160
      [  385.119849 ]  mlx5_recover_device+0xb8/0x100
      [  385.119849 ]  mlx5_health_try_recover+0x2f9/0x3a1
      [  385.119849 ]  devlink_health_reporter_recover+0x75/0x100
      [  385.119849 ]  devlink_health_report+0x26c/0x4b0
      [  385.275909 ]  mlx5_fw_fatal_reporter_err_work+0x11e/0x1b0
      [  385.275909 ]  process_one_work+0x520/0x970
      [  385.275909 ]  worker_thread+0x378/0x950
      [  385.275909 ]  kthread+0x1bb/0x200
      [  385.275909 ]  ret_from_fork+0x1f/0x30
      [  385.275909 ]
      [  385.275909 ] Freed by task 65:
      [  385.275909 ]  kasan_save_stack+0x1e/0x40
      [  385.275909 ]  kasan_set_track+0x21/0x30
      [  385.275909 ]  kasan_set_free_info+0x20/0x30
      [  385.275909 ]  __kasan_slab_free+0xfc/0x140
      [  385.275909 ]  kfree+0xa5/0x3b0
      [  385.275909 ]  mlx5_unload+0x2e/0xb0
      [  385.275909 ]  mlx5_unload_one+0x86/0xb0
      [  385.275909 ]  mlx5_fw_fatal_reporter_err_work.cold+0xca/0xcf
      [  385.275909 ]  process_one_work+0x520/0x970
      [  385.275909 ]  worker_thread+0x378/0x950
      [  385.275909 ]  kthread+0x1bb/0x200
      [  385.275909 ]  ret_from_fork+0x1f/0x30
      [  385.275909 ]
      [  385.275909 ] The buggy address belongs to the object at ffff888104b79300
      [  385.275909 ]  which belongs to the cache kmalloc-128 of size 128
      [  385.275909 ] The buggy address is located 8 bytes inside of
      [  385.275909 ]  128-byte region [ffff888104b79300, ffff888104b79380)
      [  385.275909 ] The buggy address belongs to the page:
      [  385.275909 ] page:00000000de44dd39 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104b78
      [  385.275909 ] head:00000000de44dd39 order:1 compound_mapcount:0
      [  385.275909 ] flags: 0x8000000000010200(slab|head|zone=2)
      [  385.275909 ] raw: 8000000000010200 0000000000000000 dead000000000122 ffff8881000428c0
      [  385.275909 ] raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
      [  385.275909 ] page dumped because: kasan: bad access detected
      [  385.275909 ]
      [  385.275909 ] Memory state around the buggy address:
      [  385.275909 ]  ffff888104b79200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
      [  385.275909 ]  ffff888104b79280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [  385.275909 ] >ffff888104b79300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  385.275909 ]                       ^
      [  385.275909 ]  ffff888104b79380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [  385.275909 ]  ffff888104b79400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  385.275909 ]]
      
      Fixes: e890acd5 ("net/mlx5: Add devlink flow_steering_mode parameter")
      Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
      Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      b3388697
    • Maor Dickman's avatar
      net/mlx5: DR, Fix missing flow_source when creating multi-destination FW table · 2c5fc6cd
      Maor Dickman authored
      In order to support multiple destination FTEs with SW steering
      FW table is created with single FTE with multiple actions and
      SW steering rule forward to it. When creating this table, flow
      source isn't set according to the original FTE.
      
      Fix this by passing the original FTE flow source to the created
      FW table.
      
      Fixes: 34583bee ("net/mlx5: DR, Create multi-destination table for SW-steering use")
      Signed-off-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      2c5fc6cd
    • Duoming Zhou's avatar
      NFC: nci: fix sleep in atomic context bugs caused by nci_skb_alloc · 23dd4581
      Duoming Zhou authored
      There are sleep in atomic context bugs when the request to secure
      element of st-nci is timeout. The root cause is that nci_skb_alloc
      with GFP_KERNEL parameter is called in st_nci_se_wt_timeout which is
      a timer handler. The call paths that could trigger bugs are shown below:
      
          (interrupt context 1)
      st_nci_se_wt_timeout
        nci_hci_send_event
          nci_hci_send_data
            nci_skb_alloc(..., GFP_KERNEL) //may sleep
      
         (interrupt context 2)
      st_nci_se_wt_timeout
        nci_hci_send_event
          nci_hci_send_data
            nci_send_data
              nci_queue_tx_data_frags
                nci_skb_alloc(..., GFP_KERNEL) //may sleep
      
      This patch changes allocation mode of nci_skb_alloc from GFP_KERNEL to
      GFP_ATOMIC in order to prevent atomic context sleeping. The GFP_ATOMIC
      flag makes memory allocation operation could be used in atomic context.
      
      Fixes: ed06aeef ("nfc: st-nci: Rename st21nfcb to st-nci")
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Link: https://lore.kernel.org/r/20220517012530.75714-1-duoming@zju.edu.cnSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      23dd4581
    • Christophe JAILLET's avatar
      net/qla3xxx: Fix a test in ql_reset_work() · 5361448e
      Christophe JAILLET authored
      test_bit() tests if one bit is set or not.
      Here the logic seems to check of bit QL_RESET_PER_SCSI (i.e. 4) OR bit
      QL_RESET_START (i.e. 3) is set.
      
      In fact, it checks if bit 7 (4 | 3 = 7) is set, that is to say
      QL_ADAPTER_UP.
      
      This looks harmless, because this bit is likely be set, and when the
      ql_reset_work() delayed work is scheduled in ql3xxx_isr() (the only place
      that schedule this work), QL_RESET_START or QL_RESET_PER_SCSI is set.
      
      This has been spotted by smatch.
      
      Fixes: 5a4faa87 ("[PATCH] qla3xxx NIC driver")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Link: https://lore.kernel.org/r/80e73e33f390001d9c0140ffa9baddf6466a41a2.1652637337.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5361448e
  2. 17 May, 2022 5 commits
    • Zixuan Fu's avatar
      net: vmxnet3: fix possible NULL pointer dereference in vmxnet3_rq_cleanup() · edf410cb
      Zixuan Fu authored
      In vmxnet3_rq_create(), when dma_alloc_coherent() fails,
      vmxnet3_rq_destroy() is called. It sets rq->rx_ring[i].base to NULL. Then
      vmxnet3_rq_create() returns an error to its callers mxnet3_rq_create_all()
      -> vmxnet3_change_mtu(). Then vmxnet3_change_mtu() calls
      vmxnet3_force_close() -> dev_close() in error handling code. And the driver
      calls vmxnet3_close() -> vmxnet3_quiesce_dev() -> vmxnet3_rq_cleanup_all()
      -> vmxnet3_rq_cleanup(). In vmxnet3_rq_cleanup(),
      rq->rx_ring[ring_idx].base is accessed, but this variable is NULL, causing
      a NULL pointer dereference.
      
      To fix this possible bug, an if statement is added to check whether
      rq->rx_ring[0].base is NULL in vmxnet3_rq_cleanup() and exit early if so.
      
      The error log in our fault-injection testing is shown as follows:
      
      [   65.220135] BUG: kernel NULL pointer dereference, address: 0000000000000008
      ...
      [   65.222633] RIP: 0010:vmxnet3_rq_cleanup_all+0x396/0x4e0 [vmxnet3]
      ...
      [   65.227977] Call Trace:
      ...
      [   65.228262]  vmxnet3_quiesce_dev+0x80f/0x8a0 [vmxnet3]
      [   65.228580]  vmxnet3_close+0x2c4/0x3f0 [vmxnet3]
      [   65.228866]  __dev_close_many+0x288/0x350
      [   65.229607]  dev_close_many+0xa4/0x480
      [   65.231124]  dev_close+0x138/0x230
      [   65.231933]  vmxnet3_force_close+0x1f0/0x240 [vmxnet3]
      [   65.232248]  vmxnet3_change_mtu+0x75d/0x920 [vmxnet3]
      ...
      
      Fixes: d1a890fa ("net: VMware virtual Ethernet NIC driver: vmxnet3")
      Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
      Signed-off-by: default avatarZixuan Fu <r33s3n6@gmail.com>
      Link: https://lore.kernel.org/r/20220514050711.2636709-1-r33s3n6@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      edf410cb
    • Zixuan Fu's avatar
      net: vmxnet3: fix possible use-after-free bugs in vmxnet3_rq_alloc_rx_buf() · 9e7fef95
      Zixuan Fu authored
      In vmxnet3_rq_alloc_rx_buf(), when dma_map_single() fails, rbi->skb is
      freed immediately. Similarly, in another branch, when dma_map_page() fails,
      rbi->page is also freed. In the two cases, vmxnet3_rq_alloc_rx_buf()
      returns an error to its callers vmxnet3_rq_init() -> vmxnet3_rq_init_all()
      -> vmxnet3_activate_dev(). Then vmxnet3_activate_dev() calls
      vmxnet3_rq_cleanup_all() in error handling code, and rbi->skb or rbi->page
      are freed again in vmxnet3_rq_cleanup_all(), causing use-after-free bugs.
      
      To fix these possible bugs, rbi->skb and rbi->page should be cleared after
      they are freed.
      
      The error log in our fault-injection testing is shown as follows:
      
      [   14.319016] BUG: KASAN: use-after-free in consume_skb+0x2f/0x150
      ...
      [   14.321586] Call Trace:
      ...
      [   14.325357]  consume_skb+0x2f/0x150
      [   14.325671]  vmxnet3_rq_cleanup_all+0x33a/0x4e0 [vmxnet3]
      [   14.326150]  vmxnet3_activate_dev+0xb9d/0x2ca0 [vmxnet3]
      [   14.326616]  vmxnet3_open+0x387/0x470 [vmxnet3]
      ...
      [   14.361675] Allocated by task 351:
      ...
      [   14.362688]  __netdev_alloc_skb+0x1b3/0x6f0
      [   14.362960]  vmxnet3_rq_alloc_rx_buf+0x1b0/0x8d0 [vmxnet3]
      [   14.363317]  vmxnet3_activate_dev+0x3e3/0x2ca0 [vmxnet3]
      [   14.363661]  vmxnet3_open+0x387/0x470 [vmxnet3]
      ...
      [   14.367309]
      [   14.367412] Freed by task 351:
      ...
      [   14.368932]  __dev_kfree_skb_any+0xd2/0xe0
      [   14.369193]  vmxnet3_rq_alloc_rx_buf+0x71e/0x8d0 [vmxnet3]
      [   14.369544]  vmxnet3_activate_dev+0x3e3/0x2ca0 [vmxnet3]
      [   14.369883]  vmxnet3_open+0x387/0x470 [vmxnet3]
      [   14.370174]  __dev_open+0x28a/0x420
      [   14.370399]  __dev_change_flags+0x192/0x590
      [   14.370667]  dev_change_flags+0x7a/0x180
      [   14.370919]  do_setlink+0xb28/0x3570
      [   14.371150]  rtnl_newlink+0x1160/0x1740
      [   14.371399]  rtnetlink_rcv_msg+0x5bf/0xa50
      [   14.371661]  netlink_rcv_skb+0x1cd/0x3e0
      [   14.371913]  netlink_unicast+0x5dc/0x840
      [   14.372169]  netlink_sendmsg+0x856/0xc40
      [   14.372420]  ____sys_sendmsg+0x8a7/0x8d0
      [   14.372673]  __sys_sendmsg+0x1c2/0x270
      [   14.372914]  do_syscall_64+0x41/0x90
      [   14.373145]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      ...
      
      Fixes: 5738a09d ("vmxnet3: fix checks for dma mapping errors")
      Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
      Signed-off-by: default avatarZixuan Fu <r33s3n6@gmail.com>
      Link: https://lore.kernel.org/r/20220514050656.2636588-1-r33s3n6@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      9e7fef95
    • Xin Long's avatar
      xfrm: set dst dev to blackhole_netdev instead of loopback_dev in ifdown · 4d33ab08
      Xin Long authored
      The global blackhole_netdev has replaced pernet loopback_dev to become the
      one given to the object that holds an netdev when ifdown in many places of
      ipv4 and ipv6 since commit 8d7017fd ("blackhole_netdev: use
      blackhole_netdev to invalidate dst entries").
      
      Especially after commit faab39f6 ("net: allow out-of-order netdev
      unregistration"), it's no longer safe to use loopback_dev that may be
      freed before other netdev.
      
      This patch is to set dst dev to blackhole_netdev instead of loopback_dev
      in ifdown.
      
      v1->v2:
        - add Fixes tag as Eric suggested.
      
      Fixes: faab39f6 ("net: allow out-of-order netdev unregistration")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/e8c87482998ca6fcdab214f5a9d582899ec0c648.1652665047.git.lucien.xin@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      4d33ab08
    • Christophe JAILLET's avatar
      net: systemport: Fix an error handling path in bcm_sysport_probe() · ef6b1cd1
      Christophe JAILLET authored
      if devm_clk_get_optional() fails, we still need to go through the error
      handling path.
      
      Add the missing goto.
      
      Fixes: 6328a126 ("net: systemport: Manage Wake-on-LAN clock")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/99d70634a81c229885ae9e4ee69b2035749f7edc.1652634040.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ef6b1cd1
    • Horatiu Vultur's avatar
      net: lan966x: Fix assignment of the MAC address · af8ca6ea
      Horatiu Vultur authored
      The following two scenarios were failing for lan966x.
      1. If the port had the address X and then trying to assign the same
         address, then the HW was just removing this address because first it
         tries to learn new address and then delete the old one. As they are
         the same the HW remove it.
      2. If the port eth0 was assigned the same address as one of the other
         ports eth1 then when assigning back the address to eth0 then the HW
         was deleting the address of eth1.
      
      The case 1. is fixed by checking if the port has already the same
      address while case 2. is fixed by checking if the address is used by any
      other port.
      
      Fixes: e18aba89 ("net: lan966x: add mactable support")
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Link: https://lore.kernel.org/r/20220513180030.3076793-1-horatiu.vultur@microchip.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      af8ca6ea
  3. 16 May, 2022 3 commits
    • Jonathan Lemon's avatar
      ptp: ocp: have adjtime handle negative delta_ns correctly · da2172a9
      Jonathan Lemon authored
      delta_ns is a s64, but it was being passed ptp_ocp_adjtime_coarse
      as an u64.  Also, it turns out that timespec64_add_ns() only handles
      positive values, so perform the math with set_normalized_timespec().
      
      Fixes: 90f8f4c0 ("ptp: ocp: Add ptp_ocp_adjtime_coarse for large adjustments")
      Suggested-by: default avatarVadim Fedorenko <vfedorenko@novek.ru>
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Acked-by: default avatarVadim Fedorenko <vfedorenko@novek.ru>
      Link: https://lore.kernel.org/r/20220513225231.1412-1-jonathan.lemon@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      da2172a9
    • Paolo Abeni's avatar
      net/sched: act_pedit: sanitize shift argument before usage · 4d42d54a
      Paolo Abeni authored
      syzbot was able to trigger an Out-of-Bound on the pedit action:
      
      UBSAN: shift-out-of-bounds in net/sched/act_pedit.c:238:43
      shift exponent 1400735974 is too large for 32-bit type 'unsigned int'
      CPU: 0 PID: 3606 Comm: syz-executor151 Not tainted 5.18.0-rc5-syzkaller-00165-g810c2f0a #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       ubsan_epilogue+0xb/0x50 lib/ubsan.c:151
       __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x187 lib/ubsan.c:322
       tcf_pedit_init.cold+0x1a/0x1f net/sched/act_pedit.c:238
       tcf_action_init_1+0x414/0x690 net/sched/act_api.c:1367
       tcf_action_init+0x530/0x8d0 net/sched/act_api.c:1432
       tcf_action_add+0xf9/0x480 net/sched/act_api.c:1956
       tc_ctl_action+0x346/0x470 net/sched/act_api.c:2015
       rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5993
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1921
       sock_sendmsg_nosec net/socket.c:705 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:725
       ____sys_sendmsg+0x6e2/0x800 net/socket.c:2413
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2467
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7fe36e9e1b59
      Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffef796fe88 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe36e9e1b59
      RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003
      RBP: 00007fe36e9a5d00 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe36e9a5d90
      R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
       </TASK>
      
      The 'shift' field is not validated, and any value above 31 will
      trigger out-of-bounds. The issue predates the git history, but
      syzbot was able to trigger it only after the commit mentioned in
      the fixes tag, and this change only applies on top of such commit.
      
      Address the issue bounding the 'shift' value to the maximum allowed
      by the relevant operator.
      
      Reported-and-tested-by: syzbot+8ed8fc4c57e9dcf23ca6@syzkaller.appspotmail.com
      Fixes: 8b796475 ("net/sched: act_pedit: really ensure the skb is writable")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4d42d54a
    • David S. Miller's avatar
      Merge tag 'linux-can-fixes-for-5.18-20220514' of... · dbd5f5d8
      David S. Miller authored
      Merge tag 'linux-can-fixes-for-5.18-20220514' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can 2022-05-14
      
      this is a pull request of 2 patches for net/master.
      
      Changes to linux-can-fixes-for-5.18-20220513:
      - adjusted Fixes: Tag on "Revert "can: m_can: pci: use custom bit timings for Elkhart Lake""
        (Thanks Jakub)
      
      Both patches are by Jarkko Nikula, target the m_can PCI driver
      bindings, and fix usage of wrong bit timing constants for the Elkhart
      Lake platform.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dbd5f5d8
  4. 14 May, 2022 6 commits
  5. 13 May, 2022 5 commits
  6. 12 May, 2022 13 commits
    • Linus Torvalds's avatar
      Merge tag 'net-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · f3f19f93
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from wireless, and bluetooth.
      
        No outstanding fires.
      
        Current release - regressions:
      
         - eth: atlantic: always deep reset on pm op, fix null-deref
      
        Current release - new code bugs:
      
         - rds: use maybe_get_net() when acquiring refcount on TCP sockets
           [refinement of a previous fix]
      
         - eth: ocelot: mark traps with a bool instead of guessing type based
           on list membership
      
        Previous releases - regressions:
      
         - net: fix skipping features in for_each_netdev_feature()
      
         - phy: micrel: fix null-derefs on suspend/resume and probe
      
         - bcmgenet: check for Wake-on-LAN interrupt probe deferral
      
        Previous releases - always broken:
      
         - ipv4: drop dst in multicast routing path, prevent leaks
      
         - ping: fix address binding wrt vrf
      
         - net: fix wrong network header length when BPF protocol translation
           is used on skbs with a fraglist
      
         - bluetooth: fix the creation of hdev->name
      
         - rfkill: uapi: fix RFKILL_IOCTL_MAX_SIZE ioctl request definition
      
         - wifi: iwlwifi: iwl-dbg: use del_timer_sync() before freeing
      
         - wifi: ath11k: reduce the wait time of 11d scan and hw scan while
           adding an interface
      
         - mac80211: fix rx reordering with non explicit / psmp ack policy
      
         - mac80211: reset MBSSID parameters upon connection
      
         - nl80211: fix races in nl80211_set_tx_bitrate_mask()
      
         - tls: fix context leak on tls_device_down
      
         - sched: act_pedit: really ensure the skb is writable
      
         - batman-adv: don't skb_split skbuffs with frag_list
      
         - eth: ocelot: fix various issues with TC actions (null-deref; bad
           stats; ineffective drops; ineffective filter removal)"
      
      * tag 'net-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (61 commits)
        tls: Fix context leak on tls_device_down
        net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
        net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending
        net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down()
        mlxsw: Avoid warning during ip6gre device removal
        net: bcmgenet: Check for Wake-on-LAN interrupt probe deferral
        net: ethernet: mediatek: ppe: fix wrong size passed to memset()
        Bluetooth: Fix the creation of hdev->name
        i40e: i40e_main: fix a missing check on list iterator
        net/sched: act_pedit: really ensure the skb is writable
        s390/lcs: fix variable dereferenced before check
        s390/ctcm: fix potential memory leak
        s390/ctcm: fix variable dereferenced before check
        net: atlantic: verify hw_head_ lies within TX buffer ring
        net: atlantic: add check for MAX_SKB_FRAGS
        net: atlantic: reduce scope of is_rsc_complete
        net: atlantic: fix "frag[0] not initialized"
        net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
        net: phy: micrel: Fix incorrect variable type in micrel
        decnet: Use container_of() for struct dn_neigh casts
        ...
      f3f19f93
    • Linus Torvalds's avatar
      Merge branch 'for-5.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · 0ac824f3
      Linus Torvalds authored
      Pull cgroup fix from Tejun Heo:
       "Waiman's fix for a cgroup2 cpuset bug where it could miss nodes which
        were hot-added"
      
      * 'for-5.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
        cgroup/cpuset: Remove cpus_allowed/mems_allowed setup in cpuset_init_smp()
      0ac824f3
    • Linus Torvalds's avatar
      Merge tag 'fixes_for_v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · c37dba6a
      Linus Torvalds authored
      Pull fs fixes from Jan Kara:
       "Three fixes that I'd still like to get to 5.18:
      
         - add a missing sanity check in the fanotify FAN_RENAME feature
           (added in 5.17, let's fix it before it gets wider usage in
           userspace)
      
         - udf fix for recently introduced filesystem corruption issue
      
         - writeback fix for a race in inode list handling that can lead to
           delayed writeback and possible dirty throttling stalls"
      
      * tag 'fixes_for_v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        udf: Avoid using stale lengthOfImpUse
        writeback: Avoid skipping inode writeback
        fanotify: do not allow setting dirent events in mask of non-dir
      c37dba6a
    • Maxim Mikityanskiy's avatar
      tls: Fix context leak on tls_device_down · 3740651b
      Maxim Mikityanskiy authored
      The commit cited below claims to fix a use-after-free condition after
      tls_device_down. Apparently, the description wasn't fully accurate. The
      context stayed alive, but ctx->netdev became NULL, and the offload was
      torn down without a proper fallback, so a bug was present, but a
      different kind of bug.
      
      Due to misunderstanding of the issue, the original patch dropped the
      refcount_dec_and_test line for the context to avoid the alleged
      premature deallocation. That line has to be restored, because it matches
      the refcount_inc_not_zero from the same function, otherwise the contexts
      that survived tls_device_down are leaked.
      
      This patch fixes the described issue by restoring refcount_dec_and_test.
      After this change, there is no leak anymore, and the fallback to
      software kTLS still works.
      
      Fixes: c55dcdd4 ("net/tls: Fix use-after-free after the TLS device goes down and up")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Link: https://lore.kernel.org/r/20220512091830.678684-1-maximmi@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3740651b
    • Taehee Yoo's avatar
      net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe() · 1fa89ffb
      Taehee Yoo authored
      In the NIC ->probe() callback, ->mtd_probe() callback is called.
      If NIC has 2 ports, ->probe() is called twice and ->mtd_probe() too.
      In the ->mtd_probe(), which is efx_ef10_mtd_probe() it allocates and
      initializes mtd partiion.
      But mtd partition for sfc is shared data.
      So that allocated mtd partition data from last called
      efx_ef10_mtd_probe() will not be used.
      Therefore it must be freed.
      But it doesn't free a not used mtd partition data in efx_ef10_mtd_probe().
      
      kmemleak reports:
      unreferenced object 0xffff88811ddb0000 (size 63168):
        comm "systemd-udevd", pid 265, jiffies 4294681048 (age 348.586s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffffa3767749>] kmalloc_order_trace+0x19/0x120
          [<ffffffffa3873f0e>] __kmalloc+0x20e/0x250
          [<ffffffffc041389f>] efx_ef10_mtd_probe+0x11f/0x270 [sfc]
          [<ffffffffc0484c8a>] efx_pci_probe.cold.17+0x3df/0x53d [sfc]
          [<ffffffffa414192c>] local_pci_probe+0xdc/0x170
          [<ffffffffa4145df5>] pci_device_probe+0x235/0x680
          [<ffffffffa443dd52>] really_probe+0x1c2/0x8f0
          [<ffffffffa443e72b>] __driver_probe_device+0x2ab/0x460
          [<ffffffffa443e92a>] driver_probe_device+0x4a/0x120
          [<ffffffffa443f2ae>] __driver_attach+0x16e/0x320
          [<ffffffffa4437a90>] bus_for_each_dev+0x110/0x190
          [<ffffffffa443b75e>] bus_add_driver+0x39e/0x560
          [<ffffffffa4440b1e>] driver_register+0x18e/0x310
          [<ffffffffc02e2055>] 0xffffffffc02e2055
          [<ffffffffa3001af3>] do_one_initcall+0xc3/0x450
          [<ffffffffa33ca574>] do_init_module+0x1b4/0x700
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Fixes: 8127d661 ("sfc: Add support for Solarflare SFC9100 family")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Link: https://lore.kernel.org/r/20220512054709.12513-1-ap420073@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1fa89ffb
    • Guangguan Wang's avatar
      net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending · f3c46e41
      Guangguan Wang authored
      Non blocking sendmsg will return -EAGAIN when any signal pending
      and no send space left, while non blocking recvmsg return -EINTR
      when signal pending and no data received. This may makes confused.
      As TCP returns -EAGAIN in the conditions described above. Align the
      behavior of smc with TCP.
      
      Fixes: 846e344e ("net/smc: add receive timeout check")
      Signed-off-by: default avatarGuangguan Wang <guangguan.wang@linux.alibaba.com>
      Reviewed-by: default avatarTony Lu <tonylu@linux.alibaba.com>
      Acked-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220512030820.73848-1-guangguan.wang@linux.alibaba.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f3c46e41
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down() · b7be130c
      Florian Fainelli authored
      After commit 2d1f90f9 ("net: dsa/bcm_sf2: fix incorrect usage of
      state->link") the interface suspend path would call our mac_link_down()
      call back which would forcibly set the link down, thus preventing
      Wake-on-LAN packets from reaching our management port.
      
      Fix this by looking at whether the port is enabled for Wake-on-LAN and
      not clearing the link status in that case to let packets go through.
      
      Fixes: 2d1f90f9 ("net: dsa/bcm_sf2: fix incorrect usage of state->link")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220512021731.2494261-1-f.fainelli@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b7be130c
    • Amit Cohen's avatar
      mlxsw: Avoid warning during ip6gre device removal · 810c2f0a
      Amit Cohen authored
      IPv6 addresses which are used for tunnels are stored in a hash table
      with reference counting. When a new GRE tunnel is configured, the driver
      is notified and configures it in hardware.
      
      Currently, any change in the tunnel is not applied in the driver. It
      means that if the remote address is changed, the driver is not aware of
      this change and the first address will be used.
      
      This behavior results in a warning [1] in scenarios such as the
      following:
      
       # ip link add name gre1 type ip6gre local 2000::3 remote 2000::fffe tos inherit ttl inherit
       # ip link set name gre1 type ip6gre local 2000::3 remote 2000::ffff ttl inherit
       # ip link delete gre1
      
      The change of the address is not applied in the driver. Currently, the
      driver uses the remote address which is stored in the 'parms' of the
      overlay device. When the tunnel is removed, the new IPv6 address is
      used, the driver tries to release it, but as it is not aware of the
      change, this address is not configured and it warns about releasing non
      existing IPv6 address.
      
      Fix it by using the IPv6 address which is cached in the IPIP entry, this
      address is the last one that the driver used, so even in cases such the
      above, the first address will be released, without any warning.
      
      [1]:
      
      WARNING: CPU: 1 PID: 2197 at drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2920 mlxsw_sp_ipv6_addr_put+0x146/0x220 [mlxsw_spectrum]
      ...
      CPU: 1 PID: 2197 Comm: ip Not tainted 5.17.0-rc8-custom-95062-gc1e5ded51a9a #84
      Hardware name: Mellanox Technologies Ltd. MSN4700/VMOD0010, BIOS 5.11 07/12/2021
      RIP: 0010:mlxsw_sp_ipv6_addr_put+0x146/0x220 [mlxsw_spectrum]
      ...
      Call Trace:
       <TASK>
       mlxsw_sp2_ipip_rem_addr_unset_gre6+0xf1/0x120 [mlxsw_spectrum]
       mlxsw_sp_netdevice_ipip_ol_event+0xdb/0x640 [mlxsw_spectrum]
       mlxsw_sp_netdevice_event+0xc4/0x850 [mlxsw_spectrum]
       raw_notifier_call_chain+0x3c/0x50
       call_netdevice_notifiers_info+0x2f/0x80
       unregister_netdevice_many+0x311/0x6d0
       rtnl_dellink+0x136/0x360
       rtnetlink_rcv_msg+0x12f/0x380
       netlink_rcv_skb+0x49/0xf0
       netlink_unicast+0x233/0x340
       netlink_sendmsg+0x202/0x440
       ____sys_sendmsg+0x1f3/0x220
       ___sys_sendmsg+0x70/0xb0
       __sys_sendmsg+0x54/0xa0
       do_syscall_64+0x35/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Fixes: e846efe2 ("mlxsw: spectrum: Add hash table for IPv6 address mapping")
      Reported-by: default avatarMaksym Yaremchuk <maksymy@nvidia.com>
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/20220511115747.238602-1-idosch@nvidia.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      810c2f0a
    • Florian Fainelli's avatar
      net: bcmgenet: Check for Wake-on-LAN interrupt probe deferral · 6b77c066
      Florian Fainelli authored
      The interrupt controller supplying the Wake-on-LAN interrupt line maybe
      modular on some platforms (irq-bcm7038-l1.c) and might be probed at a
      later time than the GENET driver. We need to specifically check for
      -EPROBE_DEFER and propagate that error to ensure that we eventually
      fetch the interrupt descriptor.
      
      Fixes: 9deb48b5 ("bcmgenet: add WOL IRQ check")
      Fixes: 5b1f0e62 ("net: bcmgenet: Avoid touching non-existent interrupt")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Link: https://lore.kernel.org/r/20220511031752.2245566-1-f.fainelli@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      6b77c066
    • Yang Yingliang's avatar
      net: ethernet: mediatek: ppe: fix wrong size passed to memset() · 00832b1d
      Yang Yingliang authored
      'foe_table' is a pointer, the real size of struct mtk_foe_entry
      should be pass to memset().
      
      Fixes: ba37b7ca ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Acked-by: default avatarFelix Fietkau <nbd@nbd.name>
      Link: https://lore.kernel.org/r/20220511030829.3308094-1-yangyingliang@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      00832b1d
    • Jakub Kicinski's avatar
      Merge tag 'for-net-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth · a48ab883
      Jakub Kicinski authored
      Luiz Augusto von Dentz says:
      
      ====================
      bluetooth pull request for net:
      
       - Fix the creation of hdev->name when index is greater than 9999
      
      * tag 'for-net-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth:
        Bluetooth: Fix the creation of hdev->name
      ====================
      
      Link: https://lore.kernel.org/r/20220512002901.823647-1-luiz.dentz@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a48ab883
    • Jakub Kicinski's avatar
      Merge tag 'wireless-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · 8bf6008c
      Jakub Kicinski authored
      Kalle Valo says:
      
      ====================
      wireless fixes for v5.18
      
      Second set of fixes for v5.18 and hopefully the last one. We have a
      new iwlwifi maintainer, a fix to rfkill ioctl interface and important
      fixes to both stack and two drivers.
      
      * tag 'wireless-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        rfkill: uapi: fix RFKILL_IOCTL_MAX_SIZE ioctl request definition
        nl80211: fix locking in nl80211_set_tx_bitrate_mask()
        mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection
        mac80211_hwsim: fix RCU protected chanctx access
        mailmap: update Kalle Valo's email
        mac80211: Reset MBSSID parameters upon connection
        cfg80211: retrieve S1G operating channel number
        nl80211: validate S1G channel width
        mac80211: fix rx reordering with non explicit / psmp ack policy
        ath11k: reduce the wait time of 11d scan and hw scan while add interface
        MAINTAINERS: update iwlwifi driver maintainer
        iwlwifi: iwl-dbg: Use del_timer_sync() before freeing
      ====================
      
      Link: https://lore.kernel.org/r/20220511154535.A1A12C340EE@smtp.kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8bf6008c
    • Itay Iellin's avatar
      Bluetooth: Fix the creation of hdev->name · 103a2f32
      Itay Iellin authored
      Set a size limit of 8 bytes of the written buffer to "hdev->name"
      including the terminating null byte, as the size of "hdev->name" is 8
      bytes. If an id value which is greater than 9999 is allocated,
      then the "snprintf(hdev->name, sizeof(hdev->name), "hci%d", id)"
      function call would lead to a truncation of the id value in decimal
      notation.
      
      Set an explicit maximum id parameter in the id allocation function call.
      The id allocation function defines the maximum allocated id value as the
      maximum id parameter value minus one. Therefore, HCI_MAX_ID is defined
      as 10000.
      Signed-off-by: default avatarItay Iellin <ieitayie@gmail.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      103a2f32