1. 07 5月, 2019 1 次提交
  2. 03 5月, 2019 10 次提交
  3. 02 5月, 2019 1 次提交
  4. 25 4月, 2019 3 次提交
  5. 24 4月, 2019 2 次提交
  6. 23 4月, 2019 3 次提交
    • P
      RDMA/core: Add a netlink command to change net namespace of rdma device · 2e5b8a01
      Parav Pandit 提交于
      Provide an option to change the net namespace of a rdma device through a
      netlink command. When multiple rdma devices exists in a system, and when
      containers are used, this will limit rdma device visibility to a specified
      net namespace.
      
      An example command to change net namespace of mlx5_1 device to the
      previously created net namespace 'foo' is:
      
      $ ip netns add foo
      $ rdma dev set mlx5_1 netns foo
      Signed-off-by: NParav Pandit <parav@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      2e5b8a01
    • P
      RDMA/core: Introduce a helper function to change net namespace of rdma device · decbc7a6
      Parav Pandit 提交于
      Introduce a helper function that changes rdma device's net namespace which
      performs mini disable/enable sequence to have device visible only in
      assigned net namespace.
      
      Device unregistration, device rename and device change net namespace
      may be invoked concurrently.
      
      (a) device unregistration needs to wait if a device change (rename or net
          namespace change) operation is in progress.
      (b) device net namespace change should not proceed if the unregistration
          has started.
      (c) while one cpu is changing device net namespace, other cpu should not
          be able to rename or change net namespace.
      
      To address above concurrency,
      (a) Use unreg_mutex to synchronize between ib_unregister_device() and net
          namespace change operation
      (b) In cases where unregister_device() has started unregistration before
          change_netns got chance to acquire unreg_mutex, validate the refcount
          - if it dropped to zero, abort the net namespace change operation.
      
      Finally use the helper function to change net namespace of ib device to
      move the device back to init_net when such net is deleted.
      Signed-off-by: NParav Pandit <parav@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      decbc7a6
    • P
      RDMA/core: Avoid freeing netdevs in disable_device() · 3042492b
      Parav Pandit 提交于
      So we can use the disable_device() helper while changing the net namespace
      of the rdma device in a subsequent patch, move free_netdevs() out of it.
      Signed-off-by: NParav Pandit <parav@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      3042492b
  7. 09 4月, 2019 7 次提交
  8. 04 4月, 2019 2 次提交
    • L
      RDMA/cm: Remove useless zeroing of static global variable · c7252a65
      Leon Romanovsky 提交于
      Static global variables are initialized to zero by C standard,
      there is no need to zero them again.
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      c7252a65
    • L
      RDMA/cma: Set proper port number as index · 061ccb52
      Leon Romanovsky 提交于
      Conversion from IDR to XArray missed the fact that idr_alloc() returned
      index as a return value, this index was saved in port variable and used as
      query index later on. This caused to the following error.
      
       BUG: KASAN: use-after-free in cma_check_port+0x86a/0xa20 [rdma_cm]
       Read of size 8 at addr ffff888069fde998 by task ucmatose/387
       CPU: 3 PID: 387 Comm: ucmatose Not tainted 5.1.0-rc2+ #253
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014
       Call Trace:
        dump_stack+0x7c/0xc0
        print_address_description+0x6c/0x23c
        ? cma_check_port+0x86a/0xa20 [rdma_cm]
        kasan_report.cold.3+0x1c/0x35
        ? cma_check_port+0x86a/0xa20 [rdma_cm]
        ? cma_check_port+0x86a/0xa20 [rdma_cm]
        cma_check_port+0x86a/0xa20 [rdma_cm]
        rdma_bind_addr+0x11bc/0x1b00 [rdma_cm]
        ? find_held_lock+0x33/0x1c0
        ? cma_ndev_work_handler+0x180/0x180 [rdma_cm]
        ? wait_for_completion+0x3d0/0x3d0
        ucma_bind+0x120/0x160 [rdma_ucm]
        ? ucma_resolve_addr+0x1a0/0x1a0 [rdma_ucm]
        ucma_write+0x1f8/0x2b0 [rdma_ucm]
        ? ucma_open+0x260/0x260 [rdma_ucm]
        vfs_write+0x157/0x460
        ksys_write+0xb8/0x170
        ? __ia32_sys_read+0xb0/0xb0
        ? trace_hardirqs_off_caller+0x5b/0x160
        ? do_syscall_64+0x18/0x3c0
        do_syscall_64+0x95/0x3c0
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        Allocated by task 381:
         __kasan_kmalloc.constprop.5+0xc1/0xd0
         cma_alloc_port+0x4d/0x160 [rdma_cm]
         rdma_bind_addr+0x14e7/0x1b00 [rdma_cm]
         ucma_bind+0x120/0x160 [rdma_ucm]
         ucma_write+0x1f8/0x2b0 [rdma_ucm]
         vfs_write+0x157/0x460
         ksys_write+0xb8/0x170
         do_syscall_64+0x95/0x3c0
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        Freed by task 381:
         __kasan_slab_free+0x12e/0x180
         kfree+0xed/0x290
         rdma_destroy_id+0x6b6/0x9e0 [rdma_cm]
         ucma_close+0x110/0x300 [rdma_ucm]
         __fput+0x25a/0x740
         task_work_run+0x10e/0x190
         do_exit+0x85e/0x29e0
         do_group_exit+0xf0/0x2e0
         get_signal+0x2e0/0x17e0
         do_signal+0x94/0x1570
         exit_to_usermode_loop+0xfa/0x130
         do_syscall_64+0x327/0x3c0
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Reported-by: <syzbot+2e3e485d5697ea610460@syzkaller.appspotmail.com>
      Reported-by: NRan Rozenstein <ranro@mellanox.com>
      Fixes: 63826753 ("cma: Convert portspace IDRs to XArray")
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: NBart Van Assche <bvanassche@acm.org>
      Tested-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      061ccb52
  9. 02 4月, 2019 5 次提交
  10. 29 3月, 2019 6 次提交