1. 12 10月, 2010 3 次提交
    • A
      Bluetooth: check L2CAP length in first ACL fragment · 89794813
      Andrei Emeltchenko 提交于
      Current Bluetooth code assembles fragments of big L2CAP packets
      in l2cap_recv_acldata and then checks allowed L2CAP size in
      assemled L2CAP packet (pi->imtu < skb->len).
      
      The patch moves allowed L2CAP size check to the early stage when
      we receive the first fragment of L2CAP packet. We do not need to
      reserve and keep L2CAP fragments for bad packets.
      
      Updated version after comments from Mat Martineau <mathewm@codeaurora.org>
      and Gustavo Padovan <padovan@profusion.mobi>.
      
      Trace below is received when using stress tools sending big
      fragmented L2CAP packets.
      ...
      [ 1712.798492] swapper: page allocation failure. order:4, mode:0x4020
      [ 1712.804809] [<c0031870>] (unwind_backtrace+0x0/0xdc) from [<c00a1f70>]
      (__alloc_pages_nodemask+0x4)
      [ 1712.814666] [<c00a1f70>] (__alloc_pages_nodemask+0x47c/0x4d4) from
      [<c00a1fd8>] (__get_free_pages+)
      [ 1712.824645] [<c00a1fd8>] (__get_free_pages+0x10/0x3c) from [<c026eb5c>]
      (__alloc_skb+0x4c/0xfc)
      [ 1712.833465] [<c026eb5c>] (__alloc_skb+0x4c/0xfc) from [<bf28c738>]
      (l2cap_recv_acldata+0xf0/0x1f8 )
      [ 1712.843322] [<bf28c738>] (l2cap_recv_acldata+0xf0/0x1f8 [l2cap]) from
      [<bf0094ac>] (hci_rx_task+0x)
      ...
      Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@nokia.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      89794813
    • M
      Bluetooth: Use a stream-oriented recvmsg with SOCK_STREAM L2CAP sockets. · 6fdf482b
      Mat Martineau 提交于
      L2CAP ERTM sockets can be opened with the SOCK_STREAM socket type,
      which is a mandatory request for ERTM mode.
      
      However, these sockets still have SOCK_SEQPACKET read semantics when
      bt_sock_recvmsg() is used to pull data from the receive queue.  If the
      application is only reading part of a frame, then the unread portion
      of the frame is discarded.  If the application requests more bytes
      than are in the current frame, only the current frame's data is
      returned.
      
      This patch utilizes common code derived from RFCOMM's recvmsg()
      function to make L2CAP SOCK_STREAM reads behave like RFCOMM reads (and
      other SOCK_STREAM sockets in general).  The application may read one
      byte at a time from the input stream and not lose any data, and may
      also read across L2CAP frame boundaries.
      Signed-off-by: NMat Martineau <mathewm@codeaurora.org>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      6fdf482b
    • M
      Bluetooth: Validate PSM values in calls to connect() and bind() · 0fba2558
      Mat Martineau 提交于
      Valid L2CAP PSMs are odd numbers, and the least significant bit of the
      most significant byte must be 0.
      Signed-off-by: NMat Martineau <mathewm@codeaurora.org>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
      0fba2558
  2. 05 10月, 2010 1 次提交
  3. 30 9月, 2010 4 次提交
  4. 10 8月, 2010 2 次提交
    • M
      Bluetooth: Fix incorrect setting of remote_tx_win for L2CAP ERTM · cff70fae
      Mat Martineau 提交于
      remote_tx_win is intended to be set on receipt of an L2CAP
      configuration request.  The value is used to determine the size of the
      transmit window on the remote side of an ERTM connection, so L2CAP
      can stop sending frames when that remote window is full.
      
      An incorrect remote_tx_win value will cause the stack to not fully
      utilize the tx window (performance impact), or to overfill the remote
      tx window (causing dropped frames or a disconnect).
      
      This patch removes an extra setting of remote_tx_win when a
      configuration response is received.  The transmit window has a
      different meaning in a response - it is an informational value
      less than or equal to the local tx_win.
      Signed-off-by: NMat Martineau <mathewm@codeaurora.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      cff70fae
    • M
      Bluetooth: Fix endianness issue with L2CAP MPS configuration · 86b1b263
      Mat Martineau 提交于
      Incoming configuration values must be converted to native CPU order
      before use.  This fixes a bug where a little-endian MPS value is
      compared to a native CPU value.  On big-endian processors, this
      can cause ERTM and streaming mode segmentation to produce PDUs
      that are larger than the remote stack is expecting, or that would
      produce fragmented skbs that the current FCS code cannot handle.
      Signed-off-by: NMat Martineau <mathewm@codeaurora.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      86b1b263
  5. 04 8月, 2010 2 次提交
  6. 22 7月, 2010 28 次提交