1. 16 9月, 2019 1 次提交
  2. 31 7月, 2019 1 次提交
  3. 26 7月, 2019 1 次提交
    • D
      ipoib: correcly show a VF hardware address · 3252b29e
      Denis Kirjanov 提交于
      [ Upstream commit 64d701c608fea362881e823b666327f5d28d7ffd ]
      
      in the case of IPoIB with SRIOV enabled hardware
      ip link show command incorrecly prints
      0 instead of a VF hardware address.
      
      Before:
      11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
      state UP mode DEFAULT group default qlen 256
          link/infiniband
      80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
      00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
          vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable,
      trust off, query_rss off
      ...
      After:
      11: ib1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2044 qdisc pfifo_fast
      state UP mode DEFAULT group default qlen 256
          link/infiniband
      80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
      00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
          vf 0     link/infiniband
      80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd
      00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof
      checking off, link-state disable, trust off, query_rss off
      
      v1->v2: just copy an address without modifing ifla_vf_mac
      v2->v3: update the changelog
      Signed-off-by: NDenis Kirjanov <kda@linux-powerpc.org>
      Acked-by: NDoug Ledford <dledford@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      3252b29e
  4. 08 5月, 2019 1 次提交
  5. 14 3月, 2019 1 次提交
    • F
      IB/ipoib: Fix for use-after-free in ipoib_cm_tx_start · 1ee82160
      Feras Daoud 提交于
      [ Upstream commit 6ab4aba00f811a5265acc4d3eb1863bb3ca60562 ]
      
      The following BUG was reported by kasan:
      
       BUG: KASAN: use-after-free in ipoib_cm_tx_start+0x430/0x1390 [ib_ipoib]
       Read of size 80 at addr ffff88034c30bcd0 by task kworker/u16:1/24020
      
       Workqueue: ipoib_wq ipoib_cm_tx_start [ib_ipoib]
       Call Trace:
        dump_stack+0x9a/0xeb
        print_address_description+0xe3/0x2e0
        kasan_report+0x18a/0x2e0
        ? ipoib_cm_tx_start+0x430/0x1390 [ib_ipoib]
        memcpy+0x1f/0x50
        ipoib_cm_tx_start+0x430/0x1390 [ib_ipoib]
        ? kvm_clock_read+0x1f/0x30
        ? ipoib_cm_skb_reap+0x610/0x610 [ib_ipoib]
        ? __lock_is_held+0xc2/0x170
        ? process_one_work+0x880/0x1960
        ? process_one_work+0x912/0x1960
        process_one_work+0x912/0x1960
        ? wq_pool_ids_show+0x310/0x310
        ? lock_acquire+0x145/0x440
        worker_thread+0x87/0xbb0
        ? process_one_work+0x1960/0x1960
        kthread+0x314/0x3d0
        ? kthread_create_worker_on_cpu+0xc0/0xc0
        ret_from_fork+0x3a/0x50
      
       Allocated by task 0:
        kasan_kmalloc+0xa0/0xd0
        kmem_cache_alloc_trace+0x168/0x3e0
        path_rec_create+0xa2/0x1f0 [ib_ipoib]
        ipoib_start_xmit+0xa98/0x19e0 [ib_ipoib]
        dev_hard_start_xmit+0x159/0x8d0
        sch_direct_xmit+0x226/0xb40
        __dev_queue_xmit+0x1d63/0x2950
        neigh_update+0x889/0x1770
        arp_process+0xc47/0x21f0
        arp_rcv+0x462/0x760
        __netif_receive_skb_core+0x1546/0x2da0
        netif_receive_skb_internal+0xf2/0x590
        napi_gro_receive+0x28e/0x390
        ipoib_ib_handle_rx_wc_rss+0x873/0x1b60 [ib_ipoib]
        ipoib_rx_poll_rss+0x17d/0x320 [ib_ipoib]
        net_rx_action+0x427/0xe30
        __do_softirq+0x28e/0xc42
      
       Freed by task 26680:
        __kasan_slab_free+0x11d/0x160
        kfree+0xf5/0x360
        ipoib_flush_paths+0x532/0x9d0 [ib_ipoib]
        ipoib_set_mode_rss+0x1ad/0x560 [ib_ipoib]
        set_mode+0xc8/0x150 [ib_ipoib]
        kernfs_fop_write+0x279/0x440
        __vfs_write+0xd8/0x5c0
        vfs_write+0x15e/0x470
        ksys_write+0xb8/0x180
        do_syscall_64+0x9b/0x420
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
       The buggy address belongs to the object at ffff88034c30bcc8
                      which belongs to the cache kmalloc-512 of size 512
       The buggy address is located 8 bytes inside of
                      512-byte region [ffff88034c30bcc8, ffff88034c30bec8)
       The buggy address belongs to the page:
      
      The following race between change mode and xmit flow is the reason for
      this use-after-free:
      
      Change mode     Send packet 1 to GID XX      Send packet 2 to GID XX
           |                    |                             |
         start                  |                             |
           |                    |                             |
           |                    |                             |
           |         Create new path for GID XX               |
           |           and update neigh path                  |
           |                    |                             |
           |                    |                             |
           |                    |                             |
       flush_paths              |                             |
                                |                             |
                     queue_work(cm.start_task)                |
                                |                 Path for GID XX not found
                                |                      create new path
                                |
                                |
                     start_task runs with old
                          released path
      
      There is no locking to protect the lifetime of the path through the
      ipoib_cm_tx struct, so delete it entirely and always use the newly looked
      up path under the priv->lock.
      
      Fixes: 546481c2 ("IB/ipoib: Fix memory corruption in ipoib cm mode connect flow")
      Signed-off-by: NFeras Daoud <ferasda@mellanox.com>
      Reviewed-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1ee82160
  6. 27 2月, 2019 1 次提交
    • B
      RDMA/srp: Rework SCSI device reset handling · 293f2dcd
      Bart Van Assche 提交于
      commit 48396e80fb6526ea5ed267bd84f028bae56d2f9e upstream.
      
      Since .scsi_done() must only be called after scsi_queue_rq() has
      finished, make sure that the SRP initiator driver does not call
      .scsi_done() while scsi_queue_rq() is in progress. Although
      invoking sg_reset -d while I/O is in progress works fine with kernel
      v4.20 and before, that is not the case with kernel v5.0-rc1. This
      patch avoids that the following crash is triggered with kernel
      v5.0-rc1:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000138
      CPU: 0 PID: 360 Comm: kworker/0:1H Tainted: G    B             5.0.0-rc1-dbg+ #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
      Workqueue: kblockd blk_mq_run_work_fn
      RIP: 0010:blk_mq_dispatch_rq_list+0x116/0xb10
      Call Trace:
       blk_mq_sched_dispatch_requests+0x2f7/0x300
       __blk_mq_run_hw_queue+0xd6/0x180
       blk_mq_run_work_fn+0x27/0x30
       process_one_work+0x4f1/0xa20
       worker_thread+0x67/0x5b0
       kthread+0x1cf/0x1f0
       ret_from_fork+0x24/0x30
      
      Cc: <stable@vger.kernel.org>
      Fixes: 94a9174c ("IB/srp: reduce lock coverage of command completion")
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      293f2dcd
  7. 13 1月, 2019 1 次提交
    • B
      RDMA/srpt: Fix a use-after-free in the channel release code · f408aac3
      Bart Van Assche 提交于
      commit ed041919f0d23c109d52cde8da6ddc211c52d67e upstream.
      
      This patch avoids that KASAN sporadically reports the following:
      
      BUG: KASAN: use-after-free in rxe_run_task+0x1e/0x60 [rdma_rxe]
      Read of size 1 at addr ffff88801c50d8f4 by task check/24830
      
      CPU: 4 PID: 24830 Comm: check Not tainted 4.20.0-rc6-dbg+ #3
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
      Call Trace:
       dump_stack+0x86/0xca
       print_address_description+0x71/0x239
       kasan_report.cold.5+0x242/0x301
       __asan_load1+0x47/0x50
       rxe_run_task+0x1e/0x60 [rdma_rxe]
       rxe_post_send+0x4bd/0x8d0 [rdma_rxe]
       srpt_zerolength_write+0xe1/0x160 [ib_srpt]
       srpt_close_ch+0x8b/0xe0 [ib_srpt]
       srpt_set_enabled+0xe7/0x150 [ib_srpt]
       srpt_tpg_enable_store+0xc0/0x100 [ib_srpt]
       configfs_write_file+0x157/0x1d0
       __vfs_write+0xd7/0x3d0
       vfs_write+0x102/0x290
       ksys_write+0xab/0x130
       __x64_sys_write+0x43/0x50
       do_syscall_64+0x71/0x210
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Allocated by task 13856:
       save_stack+0x43/0xd0
       kasan_kmalloc+0xc7/0xe0
       kasan_slab_alloc+0x11/0x20
       kmem_cache_alloc+0x105/0x320
       rxe_alloc+0xff/0x1f0 [rdma_rxe]
       rxe_create_qp+0x9f/0x160 [rdma_rxe]
       ib_create_qp+0xf5/0x690 [ib_core]
       rdma_create_qp+0x6a/0x140 [rdma_cm]
       srpt_cm_req_recv.cold.59+0x1588/0x237b [ib_srpt]
       srpt_rdma_cm_req_recv.isra.35+0x1d5/0x220 [ib_srpt]
       srpt_rdma_cm_handler+0x6f/0x100 [ib_srpt]
       cma_listen_handler+0x59/0x60 [rdma_cm]
       cma_ib_req_handler+0xd5b/0x2570 [rdma_cm]
       cm_process_work+0x2e/0x110 [ib_cm]
       cm_work_handler+0x2aae/0x502b [ib_cm]
       process_one_work+0x481/0x9e0
       worker_thread+0x67/0x5b0
       kthread+0x1cf/0x1f0
       ret_from_fork+0x24/0x30
      
      Freed by task 3440:
       save_stack+0x43/0xd0
       __kasan_slab_free+0x139/0x190
       kasan_slab_free+0xe/0x10
       kmem_cache_free+0xbc/0x330
       rxe_elem_release+0x66/0xe0 [rdma_rxe]
       rxe_destroy_qp+0x3f/0x50 [rdma_rxe]
       ib_destroy_qp+0x140/0x360 [ib_core]
       srpt_release_channel_work+0xdc/0x310 [ib_srpt]
       process_one_work+0x481/0x9e0
       worker_thread+0x67/0x5b0
       kthread+0x1cf/0x1f0
       ret_from_fork+0x24/0x30
      
      Cc: Sergey Gorenko <sergeygo@mellanox.com>
      Cc: Max Gurtovoy <maxg@mellanox.com>
      Cc: Laurence Oberman <loberman@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f408aac3
  8. 08 12月, 2018 1 次提交
  9. 14 11月, 2018 2 次提交
    • A
      IB/ipoib: Use dev_port to expose network interface port numbers · 24d4d9a4
      Arseny Maslennikov 提交于
      [ Upstream commit 9b8b2a323008aedd39a8debb861b825707f01420 ]
      
      Some InfiniBand network devices have multiple ports on the same PCI
      function. This initializes the `dev_port' sysfs field of those
      network interfaces with their port number.
      
      Prior to this the kernel erroneously used the `dev_id' sysfs
      field of those network interfaces to convey the port number to userspace.
      
      The use of `dev_id' was considered correct until Linux 3.15,
      when another field, `dev_port', was defined for this particular
      purpose and `dev_id' was reserved for distinguishing stacked ifaces
      (e.g: VLANs) with the same hardware address as their parent device.
      
      Similar fixes to net/mlx4_en and many other drivers, which started
      exporting this information through `dev_id' before 3.15, were accepted
      into the kernel 4 years ago.
      See 76a066f2 (`net/mlx4_en: Expose port number through sysfs').
      Signed-off-by: NArseny Maslennikov <ar@cs.msu.ru>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24d4d9a4
    • D
      IB/ipoib: Clear IPCB before icmp_send · ebd7595d
      Denis Drozdov 提交于
      [ Upstream commit 4d6e4d12da2c308f8f976d3955c45ee62539ac98 ]
      
      IPCB should be cleared before icmp_send, since it may contain data from
      previous layers and the data could be misinterpreted as ip header options,
      which later caused the ihl to be set to an invalid value and resulted in
      the following stack corruption:
      
      [ 1083.031512] ib0: packet len 57824 (> 2048) too long to send, dropping
      [ 1083.031843] ib0: packet len 37904 (> 2048) too long to send, dropping
      [ 1083.032004] ib0: packet len 4040 (> 2048) too long to send, dropping
      [ 1083.032253] ib0: packet len 63800 (> 2048) too long to send, dropping
      [ 1083.032481] ib0: packet len 23960 (> 2048) too long to send, dropping
      [ 1083.033149] ib0: packet len 63800 (> 2048) too long to send, dropping
      [ 1083.033439] ib0: packet len 63800 (> 2048) too long to send, dropping
      [ 1083.033700] ib0: packet len 63800 (> 2048) too long to send, dropping
      [ 1083.034124] ib0: packet len 63800 (> 2048) too long to send, dropping
      [ 1083.034387] ==================================================================
      [ 1083.034602] BUG: KASAN: stack-out-of-bounds in __ip_options_echo+0xf08/0x1310
      [ 1083.034798] Write of size 4 at addr ffff880353457c5f by task kworker/u16:0/7
      [ 1083.034990]
      [ 1083.035104] CPU: 7 PID: 7 Comm: kworker/u16:0 Tainted: G           O      4.19.0-rc5+ #1
      [ 1083.035316] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu2 04/01/2014
      [ 1083.035573] Workqueue: ipoib_wq ipoib_cm_skb_reap [ib_ipoib]
      [ 1083.035750] Call Trace:
      [ 1083.035888]  dump_stack+0x9a/0xeb
      [ 1083.036031]  print_address_description+0xe3/0x2e0
      [ 1083.036213]  kasan_report+0x18a/0x2e0
      [ 1083.036356]  ? __ip_options_echo+0xf08/0x1310
      [ 1083.036522]  __ip_options_echo+0xf08/0x1310
      [ 1083.036688]  icmp_send+0x7b9/0x1cd0
      [ 1083.036843]  ? icmp_route_lookup.constprop.9+0x1070/0x1070
      [ 1083.037018]  ? netif_schedule_queue+0x5/0x200
      [ 1083.037180]  ? debug_show_all_locks+0x310/0x310
      [ 1083.037341]  ? rcu_dynticks_curr_cpu_in_eqs+0x85/0x120
      [ 1083.037519]  ? debug_locks_off+0x11/0x80
      [ 1083.037673]  ? debug_check_no_obj_freed+0x207/0x4c6
      [ 1083.037841]  ? check_flags.part.27+0x450/0x450
      [ 1083.037995]  ? debug_check_no_obj_freed+0xc3/0x4c6
      [ 1083.038169]  ? debug_locks_off+0x11/0x80
      [ 1083.038318]  ? skb_dequeue+0x10e/0x1a0
      [ 1083.038476]  ? ipoib_cm_skb_reap+0x2b5/0x650 [ib_ipoib]
      [ 1083.038642]  ? netif_schedule_queue+0xa8/0x200
      [ 1083.038820]  ? ipoib_cm_skb_reap+0x544/0x650 [ib_ipoib]
      [ 1083.038996]  ipoib_cm_skb_reap+0x544/0x650 [ib_ipoib]
      [ 1083.039174]  process_one_work+0x912/0x1830
      [ 1083.039336]  ? wq_pool_ids_show+0x310/0x310
      [ 1083.039491]  ? lock_acquire+0x145/0x3a0
      [ 1083.042312]  worker_thread+0x87/0xbb0
      [ 1083.045099]  ? process_one_work+0x1830/0x1830
      [ 1083.047865]  kthread+0x322/0x3e0
      [ 1083.050624]  ? kthread_create_worker_on_cpu+0xc0/0xc0
      [ 1083.053354]  ret_from_fork+0x3a/0x50
      
      For instance __ip_options_echo is failing to proceed with invalid srr and
      optlen passed from another layer via IPCB
      
      [  762.139568] IPv4: __ip_options_echo rr=0 ts=0 srr=43 cipso=0
      [  762.139720] IPv4: ip_options_build: IPCB 00000000f3cd969e opt 000000002ccb3533
      [  762.139838] IPv4: __ip_options_echo in srr: optlen 197 soffset 84
      [  762.139852] IPv4: ip_options_build srr=0 is_frag=0 rr_needaddr=0 ts_needaddr=0 ts_needtime=0 rr=0 ts=0
      [  762.140269] ==================================================================
      [  762.140713] IPv4: __ip_options_echo rr=0 ts=0 srr=0 cipso=0
      [  762.141078] BUG: KASAN: stack-out-of-bounds in __ip_options_echo+0x12ec/0x1680
      [  762.141087] Write of size 4 at addr ffff880353457c7f by task kworker/u16:0/7
      Signed-off-by: NDenis Drozdov <denisd@mellanox.com>
      Reviewed-by: NErez Shitrit <erezsh@mellanox.com>
      Reviewed-by: NFeras Daoud <ferasda@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ebd7595d
  10. 20 9月, 2018 1 次提交
  11. 06 9月, 2018 1 次提交
    • A
      IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler · 816e846c
      Aaron Knister 提交于
      Inside of start_xmit() the call to check if the connection is up and the
      queueing of the packets for later transmission is not atomic which leaves
      a window where cm_rep_handler can run, set the connection up, dequeue
      pending packets and leave the subsequently queued packets by start_xmit()
      sitting on neigh->queue until they're dropped when the connection is torn
      down. This only applies to connected mode. These dropped packets can
      really upset TCP, for example, and cause multi-minute delays in
      transmission for open connections.
      
      Here's the code in start_xmit where we check to see if the connection is
      up:
      
             if (ipoib_cm_get(neigh)) {
                     if (ipoib_cm_up(neigh)) {
                             ipoib_cm_send(dev, skb, ipoib_cm_get(neigh));
                             goto unref;
                     }
             }
      
      The race occurs if cm_rep_handler execution occurs after the above
      connection check (specifically if it gets to the point where it acquires
      priv->lock to dequeue pending skb's) but before the below code snippet in
      start_xmit where packets are queued.
      
             if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
                     push_pseudo_header(skb, phdr->hwaddr);
                     spin_lock_irqsave(&priv->lock, flags);
                     __skb_queue_tail(&neigh->queue, skb);
                     spin_unlock_irqrestore(&priv->lock, flags);
             } else {
                     ++dev->stats.tx_dropped;
                     dev_kfree_skb_any(skb);
             }
      
      The patch acquires the netif tx lock in cm_rep_handler for the section
      where it sets the connection up and dequeues and retransmits deferred
      skb's.
      
      Fixes: 839fcaba ("IPoIB: Connected mode experimental support")
      Cc: stable@vger.kernel.org
      Signed-off-by: NAaron Knister <aaron.s.knister@nasa.gov>
      Tested-by: NIra Weiny <ira.weiny@intel.com>
      Reviewed-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      816e846c
  12. 03 8月, 2018 11 次提交
    • J
      IB/ipoib: Consolidate checking of the proposed child interface · 76010976
      Jason Gunthorpe 提交于
      Move all the checking for pkey and other validity to the __ipoib_vlan_add
      function. This removes the last difference from the control flow
      of the __ipoib_vlan_add to make the overall design simpler to
      understand.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      76010976
    • J
      IB/ipoib: Maintain the child_intfs list from ndo_init/uninit · 13476d35
      Jason Gunthorpe 提交于
      This fixes a bug in the netlink path where the vlan_rwsem was not
      held around __ipoib_vlan_add causing the child_intfs to be manipulated
      unsafely.
      
      In the process this greatly simplifies the vlan_rwsem write side locking
      to only cover a single non-sleeping statement.
      
      This also further increases the safety of the removal ordering by holding
      the netdev of the parent while the child is active to ensure most bugs
      become either an oops on a NULL priv or a deadlock on the netdev refcount.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      13476d35
    • J
      IB/ipoib: Do not remove child devices from within the ndo_uninit · 25405d98
      Jason Gunthorpe 提交于
      Switching to priv_destructor and needs_free_netdev created a subtle
      ordering problem in ipoib_remove_one.
      
      Now that unregister_netdev frees the netdev and priv we must ensure that
      the children are unregistered before trying to unregister the parent,
      or child unregister will use after free.
      
      The solution is to unregister the children, then parent, in the same batch
      all while holding the rtnl_lock. This closes all the races where a new
      child could have been added and ensures proper ordering.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      25405d98
    • J
      IB/ipoib: Get rid of the sysfs_mutex · ee190ab7
      Jason Gunthorpe 提交于
      This mutex was introduced to deal with the deadlock formed by calling
      unregister_netdev from within the sysfs callback of a netdev.
      
      Now that we have priv_destructor and needs_free_netdev we can switch
      to the more targeted solution of running the unregister from a
      work queue. This avoids the deadlock and gets rid of the mutex.
      
      The next patch in the series needs this mutex eliminated to create
      atomicity of unregisteration.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      ee190ab7
    • J
      RDMA/netdev: Use priv_destructor for netdev cleanup · 9f49a5b5
      Jason Gunthorpe 提交于
      Now that the unregister_netdev flow for IPoIB no longer relies on external
      code we can now introduce the use of priv_destructor and
      needs_free_netdev.
      
      The rdma_netdev flow is switched to use the netdev common priv_destructor
      instead of the special free_rdma_netdev and the IPOIB ULP adjusted:
       - priv_destructor needs to switch to point to the ULP's destructor
         which will then call the rdma_ndev's in the right order
       - We need to be careful around the error unwind of register_netdev
         as it sometimes calls priv_destructor on failure
       - ULPs need to use ndo_init/uninit to ensure proper ordering
         of failures around register_netdev
      
      Switching to priv_destructor is a necessary pre-requisite to using
      the rtnl new_link mechanism.
      
      The VNIC user for rdma_netdev should also be revised, but that is left for
      another patch.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NDenis Drozdov <denisd@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      9f49a5b5
    • J
      IB/ipoib: Move init code to ndo_init · eaeb3984
      Jason Gunthorpe 提交于
      Now that we have a proper ndo_uninit, move code that naturally pairs
      with the ndo_uninit into ndo_init. This allows the netdev core to natually
      handle ordering.
      
      This fixes the situation where register_netdev can fail before calling
      ndo_init, in which case it wouldn't call ndo_uninit either.
      
      Also move a bunch of duplicated init code that is shared between child
      and parent for clarity. Now the child and parent register functions look
      very similar.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      eaeb3984
    • J
      IB/ipoib: Move all uninit code into ndo_uninit · 7cbee87c
      Jason Gunthorpe 提交于
      Currently uninit is sometimes done twice in error flows, and is sprinkled
      a bit all over the place.
      
      Improve the clarity of the design by moving all uninit only into
      ndo_uinit.
      
      Some duplication is removed:
       - Sometimes IPOIB_STOP_NEIGH_GC was done before unregister, but
         this duplicates the process in ipoib_neigh_hash_init
       - Flushing priv->wq was sometimes done before unregister,
         but that duplicates what has been done in ndo_uninit
      
      Uniniting the IB event queue must remain before unregister_netdev as it
      requires the RTNL lock to be dropped, this is moved to a helper to make
      that flow really clear and remove some duplication in error flows.
      
      If register_netdev fails (and ndo_init is NULL) then it almost always
      calls ndo_uninit, which lets us remove all the extra code from the error
      unwinds. The next patch in the series will close the 'almost always' hole
      by pairing a proper ndo_init with ndo_uninit.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      7cbee87c
    • E
      IB/ipoib: Use cancel_delayed_work_sync for neigh-clean task · cda8daf1
      Erez Shitrit 提交于
      The neigh_reap_task is self restarting, but so long as we call
      cancel_delayed_work_sync() it will be guaranteed to not be running and
      never start again. Thus we don't need to have the racy
      IPOIB_STOP_NEIGH_GC bit, or the confusing mismatch of places sometimes
      calling flush_workqueue after the cancel.
      
      This fixes a situation where the GC work could have been left running
      in some rare situations.
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      cda8daf1
    • J
      IB/ipoib: Get rid of IPOIB_FLAG_GOING_DOWN · 577e07ff
      Jason Gunthorpe 提交于
      This essentially duplicates the netdev's reg_state, so just use that
      directly. The reg_state is updated under the rntl_lock, and all places
      using GOING_DOWN already acquire the rtnl_lock so checking is safe.
      
      Since the only place we use GOING_DOWN is for the parent device this
      does not fix any bugs, but it is a step to tidy up the unregister flow
      so that after later patches the flow is uniform and sane.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      577e07ff
    • M
      scsi: target: srp, vscsi, sbp, qla: use target_remove_session · b287e351
      Mike Christie 提交于
      This converts the drivers that called transport_deregister_session_configfs
      and then immediately called transport_deregister_session to use
      target_remove_session.
      Signed-off-by: NMike Christie <mchristi@redhat.com>
      Reviewed-by: NBart Van Assche <bart.vanassche@wdc.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Chris Boot <bootc@bootc.net>
      Cc: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
      Cc: Michael Cyr <mikecyr@linux.vnet.ibm.com>
      Cc: <qla2xxx-upstream@qlogic.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b287e351
    • M
      scsi: target: rename target_alloc_session · fa834287
      Mike Christie 提交于
      Rename target_alloc_session to target_setup_session to avoid confusion with
      the other transport session allocation function that only allocates the
      session and because the target_alloc_session does so much more. It
      allocates the session, sets up the nacl and registers the session.
      
      The next patch will then add a remove function to match the setup in this
      one, so it should make sense for all drivers, except iscsi, to just call
      those 2 functions to setup and remove a session.
      
      iscsi will continue to be the odd driver.
      Signed-off-by: NMike Christie <mchristi@redhat.com>
      Reviewed-by: NBart Van Assche <bart.vanassche@wdc.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Chris Boot <bootc@bootc.net>
      Cc: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
      Cc: Michael Cyr <mikecyr@linux.vnet.ibm.com>
      Cc: <qla2xxx-upstream@qlogic.com>
      Cc: Johannes Thumshirn <jth@kernel.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      fa834287
  13. 02 8月, 2018 1 次提交
  14. 01 8月, 2018 1 次提交
  15. 31 7月, 2018 3 次提交
  16. 30 7月, 2018 1 次提交
  17. 25 7月, 2018 6 次提交
  18. 24 7月, 2018 1 次提交
  19. 14 7月, 2018 2 次提交
  20. 11 7月, 2018 1 次提交
  21. 10 7月, 2018 1 次提交