1. 18 5月, 2020 9 次提交
    • Ł
      Bluetooth: Fix for GAP/SEC/SEM/BI-10-C · 49c06c9e
      Łukasz Rymanowski 提交于
      Security Mode 1 level 4, force us to use have key size 16 octects long.
      This patch adds check for that.
      
      This is required for the qualification test GAP/SEC/SEM/BI-10-C
      
      Logs from test when ATT is configured with sec level BT_SECURITY_FIPS
      
      < ACL Data TX: Handle 3585 flags 0x00 dlen 11                                                                       #28 [hci0] 3.785965
            SMP: Pairing Request (0x01) len 6
              IO capability: DisplayYesNo (0x01)
              OOB data: Authentication data not present (0x00)
              Authentication requirement: Bonding, MITM, SC, No Keypresses (0x0d)
              Max encryption key size: 16
              Initiator key distribution: EncKey Sign (0x05)
              Responder key distribution: EncKey IdKey Sign (0x07)
      > ACL Data RX: Handle 3585 flags 0x02 dlen 11                                                                       #35 [hci0] 3.883020
            SMP: Pairing Response (0x02) len 6
              IO capability: DisplayYesNo (0x01)
              OOB data: Authentication data not present (0x00)
              Authentication requirement: Bonding, MITM, SC, No Keypresses (0x0d)
              Max encryption key size: 7
              Initiator key distribution: EncKey Sign (0x05)
              Responder key distribution: EncKey IdKey Sign (0x07)
      < ACL Data TX: Handle 3585 flags 0x00 dlen 6                                                                        #36 [hci0] 3.883136
            SMP: Pairing Failed (0x05) len 1
              Reason: Encryption key size (0x06)
      Signed-off-by: NŁukasz Rymanowski <lukasz.rymanowski@codecoup.pl>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      49c06c9e
    • J
      rds: convert get_user_pages() --> pin_user_pages() · dbfe7d74
      John Hubbard 提交于
      This code was using get_user_pages_fast(), in a "Case 2" scenario
      (DMA/RDMA), using the categorization from [1]. That means that it's
      time to convert the get_user_pages_fast() + put_page() calls to
      pin_user_pages_fast() + unpin_user_pages() calls.
      
      There is some helpful background in [2]: basically, this is a small
      part of fixing a long-standing disconnect between pinning pages, and
      file systems' use of those pages.
      
      [1] Documentation/core-api/pin_user_pages.rst
      
      [2] "Explicit pinning of user-space pages":
          https://lwn.net/Articles/807108/
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: netdev@vger.kernel.org
      Cc: linux-rdma@vger.kernel.org
      Cc: rds-devel@oss.oracle.com
      Signed-off-by: NJohn Hubbard <jhubbard@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dbfe7d74
    • F
      net: allow __skb_ext_alloc to sleep · 4930f483
      Florian Westphal 提交于
      mptcp calls this from the transmit side, from process context.
      Allow a sleeping allocation instead of unconditional GFP_ATOMIC.
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4930f483
    • F
      mptcp: remove inner wait loop from mptcp_sendmsg_frag · 5c826443
      Florian Westphal 提交于
      previous patches made sure we only call into this function
      when these prerequisites are met, so no need to wait on the
      subflow socket anymore.
      
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/7Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5c826443
    • F
      mptcp: fill skb page frag cache outside of mptcp_sendmsg_frag · 17091708
      Florian Westphal 提交于
      The mptcp_sendmsg_frag helper contains a loop that will wait on the
      subflow sk.
      
      It seems preferrable to only wait in mptcp_sendmsg() when blocking io is
      requested.  mptcp_sendmsg already has such a wait loop that is used when
      no subflow socket is available for transmission.
      
      This is another preparation patch that makes sure we call
      mptcp_sendmsg_frag only if the page frag cache has been refilled.
      
      Followup patch will remove the wait loop from mptcp_sendmsg_frag().
      
      The retransmit worker doesn't need to do this refill as it won't
      transmit new mptcp-level data.
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      17091708
    • F
      mptcp: fill skb extension cache outside of mptcp_sendmsg_frag · 149f7c71
      Florian Westphal 提交于
      The mptcp_sendmsg_frag helper contains a loop that will wait on the
      subflow sk.
      
      It seems preferrable to only wait in mptcp_sendmsg() when blocking io is
      requested.  mptcp_sendmsg already has such a wait loop that is used when
      no subflow socket is available for transmission.
      
      This is a preparation patch that makes sure we call
      mptcp_sendmsg_frag only if a skb extension has been allocated.
      
      Moreover, such allocation currently uses GFP_ATOMIC while it
      could use sleeping allocation instead.
      
      Followup patches will remove the wait loop from mptcp_sendmsg_frag()
      and will allow to do a sleeping allocation for the extension.
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      149f7c71
    • F
      mptcp: avoid blocking in tcp_sendpages · 72511aab
      Florian Westphal 提交于
      The transmit loop continues to xmit new data until an error is returned
      or all data was transmitted.
      
      For the blocking i/o case, this means that tcp_sendpages() may block on
      the subflow until more space becomes available, i.e. we end up sleeping
      with the mptcp socket lock held.
      
      Instead we should check if a different subflow is ready to be used.
      
      This restarts the subflow sk lookup when the tx operation succeeded
      and the tcp subflow can't accept more data or if tcp_sendpages
      indicates -EAGAIN on a blocking mptcp socket.
      
      In that case we also need to set the NOSPACE bit to make sure we get
      notified once memory becomes available.
      
      In case all subflows are busy, the existing logic will wait until a
      subflow is ready, releasing the mptcp socket lock while doing so.
      
      The mptcp worker already sets DONTWAIT, so no need to make changes there.
      
      v2:
       * set NOSPACE bit
       * add a comment to clarify that mptcp-sk sndbuf limits need to
         be checked as well.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      72511aab
    • F
      mptcp: break and restart in case mptcp sndbuf is full · fb529e62
      Florian Westphal 提交于
      Its not enough to check for available tcp send space.
      
      We also hold on to transmitted data for mptcp-level retransmits.
      Right now we will send more and more data if the peer can ack data
      at the tcp level fast enough, since that frees up tcp send buffer space.
      
      But we also need to check that data was acked and reclaimed at the mptcp
      level.
      
      Therefore add needed check in mptcp_sendmsg, flush tcp data and
      wait until more mptcp snd space becomes available if we are over the
      limit.  Before we wait for more data, also make sure we start the
      retransmit timer if we ran out of sndbuf space.
      
      Otherwise there is a very small chance that we wait forever:
      
       * receiver is waiting for data
       * sender is blocked because mptcp socket buffer is full
       * at tcp level, all data was acked
       * mptcp-level snd_una was not updated, because last ack
         that acknowledged the last data packet carried an older
         MPTCP-ack.
      
      Restarting the retransmit timer avoids this problem: if TCP
      subflow is idle, data is retransmitted from the RTX queue.
      
      New data will make the peer send a new, updated MPTCP-Ack.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fb529e62
    • F
      mptcp: move common nospace-pattern to a helper · a0e17064
      Florian Westphal 提交于
      Paolo noticed that ssk_check_wmem() has same pattern, so add/use
      common helper for both places.
      Suggested-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a0e17064
  2. 17 5月, 2020 4 次提交
  3. 16 5月, 2020 7 次提交
  4. 15 5月, 2020 14 次提交
  5. 14 5月, 2020 6 次提交
    • C
      ipv6: set msg_control_is_user in do_ipv6_getsockopt · 1b2f08df
      Christoph Hellwig 提交于
      While do_ipv6_getsockopt does not call the high-level recvmsg helper,
      the msghdr eventually ends up being passed to put_cmsg anyway, and thus
      needs msg_control_is_user set to the proper value.
      
      Fixes: 1f466e1f ("net: cleanly handle kernel vs user buffers for ->msg_control")
      Reported-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1b2f08df
    • T
      tipc: fix failed service subscription deletion · 88690b10
      Tuong Lien 提交于
      When a service subscription is expired or canceled by user, it needs to
      be deleted from the subscription list, so that new subscriptions can be
      registered (max = 65535 per net). However, there are two issues in code
      that can cause such an unused subscription to persist:
      
      1) The 'tipc_conn_delete_sub()' has a loop on the subscription list but
      it makes a break shortly when the 1st subscription differs from the one
      specified, so the subscription will not be deleted.
      
      2) In case a subscription is canceled, the code to remove the
      'TIPC_SUB_CANCEL' flag from the subscription filter does not work if it
      is a local subscription (i.e. the little endian isn't involved). So, it
      will be no matches when looking for the subscription to delete later.
      
      The subscription(s) will be removed eventually when the user terminates
      its topology connection but that could be a long time later. Meanwhile,
      the number of available subscriptions may be exhausted.
      
      This commit fixes the two issues above, so as needed a subscription can
      be deleted correctly.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jmaloy@redhat.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      88690b10
    • T
      tipc: fix memory leak in service subscripting · 0771d7df
      Tuong Lien 提交于
      Upon receipt of a service subscription request from user via a topology
      connection, one 'sub' object will be allocated in kernel, so it will be
      able to send an event of the service if any to the user correspondingly
      then. Also, in case of any failure, the connection will be shutdown and
      all the pertaining 'sub' objects will be freed.
      
      However, there is a race condition as follows resulting in memory leak:
      
             receive-work       connection        send-work
                    |                |                |
              sub-1 |<------//-------|                |
              sub-2 |<------//-------|                |
                    |                |<---------------| evt for sub-x
              sub-3 |<------//-------|                |
                    :                :                :
                    :                :                :
                    |       /--------|                |
                    |       |        * peer closed    |
                    |       |        |                |
                    |       |        |<-------X-------| evt for sub-y
                    |       |        |<===============|
              sub-n |<------/        X    shutdown    |
          -> orphan |                                 |
      
      That is, the 'receive-work' may get the last subscription request while
      the 'send-work' is shutting down the connection due to peer close.
      
      We had a 'lock' on the connection, so the two actions cannot be carried
      out simultaneously. If the last subscription is allocated e.g. 'sub-n',
      before the 'send-work' closes the connection, there will be no issue at
      all, the 'sub' objects will be freed. In contrast the last subscription
      will become orphan since the connection was closed, and we released all
      references.
      
      This commit fixes the issue by simply adding one test if the connection
      remains in 'connected' state right after we obtain the connection lock,
      then a subscription object can be created as usual, otherwise we ignore
      it.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jmaloy@redhat.com>
      Reported-by: NThang Ngo <thang.h.ngo@dektech.com.au>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0771d7df
    • T
      tipc: fix large latency in smart Nagle streaming · c7268589
      Tuong Lien 提交于
      Currently when a connection is in Nagle mode, we set the 'ack_required'
      bit in the last sending buffer and wait for the corresponding ACK prior
      to pushing more data. However, on the receiving side, the ACK is issued
      only when application really  reads the whole data. Even if part of the
      last buffer is received, we will not do the ACK as required. This might
      cause an unnecessary delay since the receiver does not always fetch the
      message as fast as the sender, resulting in a large latency in the user
      message sending, which is: [one RTT + the receiver processing time].
      
      The commit makes Nagle ACK as soon as possible i.e. when a message with
      the 'ack_required' arrives in the receiving side's stack even before it
      is processed or put in the socket receive queue...
      This way, we can limit the streaming latency to one RTT as committed in
      Nagle mode.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Acked-by: NJon Maloy <jmaloy@redhat.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c7268589
    • C
      net: ignore sock_from_file errors in __scm_install_fd · 6e8a4f9d
      Christoph Hellwig 提交于
      The code had historically been ignoring these errors, and my recent
      refactoring changed that, which broke ssh in some setups.
      
      Fixes: 2618d530 ("net/scm: cleanup scm_detach_fds")
      Reported-by: NIdo Schimmel <idosch@idosch.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Tested-by: NIdo Schimmel <idosch@mellanox.com>
      Tested-by: NIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6e8a4f9d
    • Y
      bpf: Enable bpf_iter targets registering ctx argument types · 3c32cc1b
      Yonghong Song 提交于
      Commit b121b341 ("bpf: Add PTR_TO_BTF_ID_OR_NULL
      support") adds a field btf_id_or_null_non0_off to
      bpf_prog->aux structure to indicate that the
      first ctx argument is PTR_TO_BTF_ID reg_type and
      all others are PTR_TO_BTF_ID_OR_NULL.
      This approach does not really scale if we have
      other different reg types in the future, e.g.,
      a pointer to a buffer.
      
      This patch enables bpf_iter targets registering ctx argument
      reg types which may be different from the default one.
      For example, for pointers to structures, the default reg_type
      is PTR_TO_BTF_ID for tracing program. The target can register
      a particular pointer type as PTR_TO_BTF_ID_OR_NULL which can
      be used by the verifier to enforce accesses.
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200513180221.2949882-1-yhs@fb.com
      3c32cc1b