1. 04 2月, 2019 1 次提交
  2. 08 1月, 2019 1 次提交
    • C
      smc: move unhash as early as possible in smc_release() · 26d92e95
      Cong Wang 提交于
      In smc_release() we release smc->clcsock before unhash the smc
      sock, but a parallel smc_diag_dump() may be still reading
      smc->clcsock, therefore this could cause a use-after-free as
      reported by syzbot.
      
      Reported-and-tested-by: syzbot+fbd1e5476e4c94c7b34e@syzkaller.appspotmail.com
      Fixes: 51f1de79 ("net/smc: replace sock_put worker by socket refcounting")
      Cc: Ursula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Reported-by: syzbot+0bf2e01269f1274b4b03@syzkaller.appspotmail.com
      Reported-by: syzbot+e3132895630f957306bc@syzkaller.appspotmail.com
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      26d92e95
  3. 19 12月, 2018 1 次提交
    • M
      net/smc: fix TCP fallback socket release · 78abe3d0
      Myungho Jung 提交于
      clcsock can be released while kernel_accept() references it in TCP
      listen worker. Also, clcsock needs to wake up before released if TCP
      fallback is used and the clcsock is blocked by accept. Add a lock to
      safely release clcsock and call kernel_sock_shutdown() to wake up
      clcsock from accept in smc_release().
      
      Reported-by: syzbot+0bf2e01269f1274b4b03@syzkaller.appspotmail.com
      Reported-by: syzbot+e3132895630f957306bc@syzkaller.appspotmail.com
      Signed-off-by: NMyungho Jung <mhjungk@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      78abe3d0
  4. 24 11月, 2018 5 次提交
  5. 22 11月, 2018 2 次提交
  6. 24 10月, 2018 1 次提交
    • K
      Revert "net: simplify sock_poll_wait" · 89ab066d
      Karsten Graul 提交于
      This reverts commit dd979b4d.
      
      This broke tcp_poll for SMC fallback: An AF_SMC socket establishes an
      internal TCP socket for the initial handshake with the remote peer.
      Whenever the SMC connection can not be established this TCP socket is
      used as a fallback. All socket operations on the SMC socket are then
      forwarded to the TCP socket. In case of poll, the file->private_data
      pointer references the SMC socket because the TCP socket has no file
      assigned. This causes tcp_poll to wait on the wrong socket.
      Signed-off-by: NKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      89ab066d
  7. 19 9月, 2018 3 次提交
    • K
      net/smc: no urgent data check for listen sockets · 71d117f5
      Karsten Graul 提交于
      Don't check a listen socket for pending urgent data in smc_poll().
      Signed-off-by: NKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      71d117f5
    • U
      net/smc: remove duplicate mutex_unlock · 1ca52fcf
      Ursula Braun 提交于
      For a failing smc_listen_rdma_finish() smc_listen_decline() is
      called. If fallback is possible, the new socket is already enqueued
      to be accepted in smc_listen_decline(). Avoid enqueuing a second time
      afterwards in this case, otherwise the smc_create_lgr_pending lock
      is released twice:
      [  373.463976] WARNING: bad unlock balance detected!
      [  373.463978] 4.18.0-rc7+ #123 Tainted: G           O
      [  373.463979] -------------------------------------
      [  373.463980] kworker/1:1/30 is trying to release lock (smc_create_lgr_pending) at:
      [  373.463990] [<000003ff801205fc>] smc_listen_work+0x22c/0x5d0 [smc]
      [  373.463991] but there are no more locks to release!
      [  373.463991]
      other info that might help us debug this:
      [  373.463993] 2 locks held by kworker/1:1/30:
      [  373.463994]  #0: 00000000772cbaed ((wq_completion)"events"){+.+.}, at: process_one_work+0x1ec/0x6b0
      [  373.464000]  #1: 000000003ad0894a ((work_completion)(&new_smc->smc_listen_work)){+.+.}, at: process_one_work+0x1ec/0x6b0
      [  373.464003]
      stack backtrace:
      [  373.464005] CPU: 1 PID: 30 Comm: kworker/1:1 Kdump: loaded Tainted: G           O      4.18.0-rc7uschi+ #123
      [  373.464007] Hardware name: IBM 2827 H43 738 (LPAR)
      [  373.464010] Workqueue: events smc_listen_work [smc]
      [  373.464011] Call Trace:
      [  373.464015] ([<0000000000114100>] show_stack+0x60/0xd8)
      [  373.464019]  [<0000000000a8c9bc>] dump_stack+0x9c/0xd8
      [  373.464021]  [<00000000001dcaf8>] print_unlock_imbalance_bug+0xf8/0x108
      [  373.464022]  [<00000000001e045c>] lock_release+0x114/0x4f8
      [  373.464025]  [<0000000000aa87fa>] __mutex_unlock_slowpath+0x4a/0x300
      [  373.464027]  [<000003ff801205fc>] smc_listen_work+0x22c/0x5d0 [smc]
      [  373.464029]  [<0000000000197a68>] process_one_work+0x2a8/0x6b0
      [  373.464030]  [<0000000000197ec2>] worker_thread+0x52/0x410
      [  373.464033]  [<000000000019fd0e>] kthread+0x15e/0x178
      [  373.464035]  [<0000000000aaf58a>] kernel_thread_starter+0x6/0xc
      [  373.464052]  [<0000000000aaf584>] kernel_thread_starter+0x0/0xc
      [  373.464054] INFO: lockdep is turned off.
      Signed-off-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1ca52fcf
    • U
      net/smc: fix non-blocking connect problem · 648a5a7a
      Ursula Braun 提交于
      In state SMC_INIT smc_poll() delegates polling to the internal
      CLC socket. This means, once the connect worker has finished
      its kernel_connect() step, the poll wake-up may occur. This is not
      intended. The wake-up should occur from the wake up call in
      smc_connect_work() after __smc_connect() has finished.
      Thus in state SMC_INIT this patch now calls sock_poll_wait() on the
      main SMC socket.
      Signed-off-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      648a5a7a
  8. 09 8月, 2018 3 次提交
  9. 31 7月, 2018 1 次提交
  10. 26 7月, 2018 3 次提交
  11. 24 7月, 2018 1 次提交
  12. 19 7月, 2018 1 次提交
  13. 17 7月, 2018 1 次提交
  14. 07 7月, 2018 1 次提交
    • U
      net/smc: reduce sock_put() for fallback sockets · e1bbdd57
      Ursula Braun 提交于
      smc_release() calls a sock_put() for smc fallback sockets to cover
      the passive closing sock_hold() in __smc_connect() and
      smc_tcp_listen_work(). This does not make sense for sockets in state
      SMC_LISTEN and SMC_INIT.
      An SMC socket stays in state SMC_INIT if connect fails. The sock_put
      in smc_connect_abort() does not cover all failures. Move it into
      smc_connect_decline_fallback().
      
      Fixes: ee9dfbef ("net/smc: handle sockopts forcing fallback")
      Reported-by: syzbot+3a0748c8f2f210c0ef9b@syzkaller.appspotmail.com
      Reported-by: syzbot+9e60d2428a42049a592a@syzkaller.appspotmail.com
      Signed-off-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e1bbdd57
  15. 04 7月, 2018 1 次提交
    • L
      net/smc: fix up merge error with poll changes · 410da1e1
      Linus Torvalds 提交于
      My networking merge (commit 4e33d7d4: "Pull networking fixes from
      David Miller") got the poll() handling conflict wrong for af_smc.
      
      The conflict between my a11e1d43 ("Revert changes to convert to
      ->poll_mask() and aio IOCB_CMD_POLL") and Ursula Braun's 24ac3a08
      ("net/smc: rebuild nonblocking connect") should have left the call to
      sock_poll_wait() in place, just without the socket lock release/retake.
      
      And I really should have realized that.  But happily, I at least asked
      Ursula to double-check the merge, and she set me right.
      
      This also fixes an incidental whitespace issue nearby that annoyed me
      while looking at this.
      Pointed-out-by: NUrsula Braun <ubraun@linux.ibm.com>
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      410da1e1
  16. 30 6月, 2018 3 次提交
  17. 29 6月, 2018 1 次提交
    • L
      Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL · a11e1d43
      Linus Torvalds 提交于
      The poll() changes were not well thought out, and completely
      unexplained.  They also caused a huge performance regression, because
      "->poll()" was no longer a trivial file operation that just called down
      to the underlying file operations, but instead did at least two indirect
      calls.
      
      Indirect calls are sadly slow now with the Spectre mitigation, but the
      performance problem could at least be largely mitigated by changing the
      "->get_poll_head()" operation to just have a per-file-descriptor pointer
      to the poll head instead.  That gets rid of one of the new indirections.
      
      But that doesn't fix the new complexity that is completely unwarranted
      for the regular case.  The (undocumented) reason for the poll() changes
      was some alleged AIO poll race fixing, but we don't make the common case
      slower and more complex for some uncommon special case, so this all
      really needs way more explanations and most likely a fundamental
      redesign.
      
      [ This revert is a revert of about 30 different commits, not reverted
        individually because that would just be unnecessarily messy  - Linus ]
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a11e1d43
  18. 28 6月, 2018 1 次提交
    • U
      net/smc: rebuild nonblocking connect · 24ac3a08
      Ursula Braun 提交于
      The recent poll change may lead to stalls for non-blocking connecting
      SMC sockets, since sock_poll_wait is no longer performed on the
      internal CLC socket, but on the outer SMC socket.  kernel_connect() on
      the internal CLC socket returns with -EINPROGRESS, but the wake up
      logic does not work in all cases. If the internal CLC socket is still
      in state TCP_SYN_SENT when polled, sock_poll_wait() from sock_poll()
      does not sleep. It is supposed to sleep till the state of the internal
      CLC socket switches to TCP_ESTABLISHED.
      
      This problem triggered a redesign of the SMC nonblocking connect logic.
      This patch introduces a connect worker covering all connect steps
      followed by a wake up of socket waiters. It allows to get rid of all
      delays and locks in smc_poll().
      
      Fixes: c0129a06 ("smc: convert to ->poll_mask")
      Signed-off-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      24ac3a08
  19. 13 6月, 2018 1 次提交
  20. 03 6月, 2018 1 次提交
  21. 24 5月, 2018 2 次提交
  22. 19 5月, 2018 5 次提交