1. 25 2月, 2012 8 次提交
    • A
      tipc: Hide internal details of node table implementation · a635b46b
      Allan Stephens 提交于
      Relocates information about the size of TIPC's node table index and
      its associated hash function, since only node subsystem routines need
      to have access to this information.
      
      Note that these changes are essentially cosmetic in nature, and have
      no impact on the actual operation of TIPC.
      Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      a635b46b
    • A
      tipc: Eliminate a test for negative unsigned quantities · 9efde4a0
      Allan Stephens 提交于
      Simplifies a comparison operation to eliminate a useless test that
      checks if an unsigned value is less than zero.
      Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      9efde4a0
    • P
      tipc: nuke the delimit static inline function. · 732efba4
      Paul Gortmaker 提交于
      This "shortform" is actually longer than typing out what it is really
      trying to do, and just makes reading the code more difficult, so
      lets simply shoot it in the head.
      
      In the case of log.c - the comparison is on a u32, so we can drop the
      check for < 0 at the same time.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      732efba4
    • A
      tipc: Add check to prevent insertion of duplicate name table entries · f80c24d9
      Allan Stephens 提交于
      Adds a new check to TIPC's name table logic to reject any attempt to
      create a new name publication that is identical to an existing one.
      (Such an attempt will never happen under normal circumstances, but
      could arise if another network node malfunctions and issues a duplicate
      name publication message.)
      Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      f80c24d9
    • A
      tipc: Simplify enforcement of reserved name type prohibition · c422f1bd
      Allan Stephens 提交于
      Streamlines the logic that prevents an application from binding a
      reserved TIPC name type to a port by moving the check to the code
      that handles a socket bind() operation. This allows internal TIPC
      subsystems to bind a reserved name without having to set an atomic
      flag to gain permission to use such a name. (This simplification is
      now possible due to the elimination of support for TIPC's native API.)
      Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      c422f1bd
    • A
      tipc: Remove duplicate check of message destination node · c74a4611
      Allan Stephens 提交于
      Eliminates a check in the processing of TIPC messages arriving from
      off node that ensures the message is destined for this node, since this
      check duplicates an earlier check. (The check would be necessary if TIPC
      needed to be able to route incoming messages to another node, but the
      elimination of multi-cluster support means that this never happens and
      all incoming messages are consumed by the receiving node.)
      
      Note: This change involves the elimination of a single "if" statement
      with a large "then" clause; consequently, a significant number of lines
      end up getting re-indented. In addition, a simple message header access
      routine that is no longer referenced is eliminated. However, the only
      functional change is the elimination of the single check described above.
      Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      c74a4611
    • A
      tipc: Detect duplicate nodes using different network interfaces · 97878a40
      Allan Stephens 提交于
      Utilizes the new "node signature" field in neighbor discovery messages
      to ensure that all links TIPC associates with a given <Z.C.N> network
      address belong to the same neighboring node. (Previously, TIPC could not
      tell if link setup requests arriving on different interfaces were from
      the same node or from two different nodes that has mistakenly been assigned
      the same network address.)
      
      The revised algorithm for detecting a duplicate node considers both the
      node signature and the network interface adddress specified in a request
      message when deciding how to respond to a link setup request. This prevents
      false alarms that might otherwise arise during normal network operation
      under the following scenarios:
      
      a) A neighboring node reboots. (The node's signature changes, but the
      network interface address remains unchanged.)
      
      b) A neighboring node's network interface is replaced. (The node's signature
      remains unchanged, but the network interface address changes.)
      
      c) A neighboring node is completely replaced. (The node's signature and
      network interface address both change.)
      
      The algorithm also handles cases in which a node reboots and re-establishes
      its links to TIPC (or begins re-establishing those links) before TIPC
      detects that it is using a new node signature. In such cases of "delayed
      rediscovery" TIPC simply accepts the new signature without disrupting
      communication that is already underway over the links.
      
      Thanks to Laser [gotolaser@gmail.com] for his contributions to the
      development of this enhancement.
      Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      97878a40
    • A
      tipc: Introduce node signature field in neighbor discovery message · fc0eea69
      Allan Stephens 提交于
      Adds support for the new "node signature" in neighbor discovery messages,
      which is a 16 bit identifier chosen randomly when TIPC is initialized.
      This field makes it possible for nodes receiving a neighbor discovery
      message to detect if multiple neighboring nodes are using the same network
      address (i.e. <Z.C.N>), even when the messages are arriving on different
      interfaces.
      
      This first phase of node signature support creates the signature,
      incorporates it into outgoing neighbor discovery messages, and tracks
      the signature used by valid neighbors. An upcoming patch builds on this
      foundation to implement the improved duplicate neighbor detection checking.
      Signed-off-by: NAllan Stephens <allan.stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      fc0eea69
  2. 24 2月, 2012 1 次提交
  3. 23 2月, 2012 2 次提交
  4. 22 2月, 2012 5 次提交
  5. 18 2月, 2012 1 次提交
  6. 17 2月, 2012 10 次提交
  7. 16 2月, 2012 5 次提交
  8. 15 2月, 2012 8 次提交
    • U
      Bluetooth: Fix possible use after free in delete path · 24d2b8c0
      Ulisses Furquim 提交于
      We need to use the _sync() version for cancelling the info and security
      timer in the L2CAP connection delete path. Otherwise the delayed work
      handler might run after the connection object is freed.
      Signed-off-by: NUlisses Furquim <ulisses@profusion.mobi>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      24d2b8c0
    • U
      Bluetooth: Remove usage of __cancel_delayed_work() · 6de32750
      Ulisses Furquim 提交于
      __cancel_delayed_work() is being used in some paths where we cannot
      sleep waiting for the delayed work to finish. However, that function
      might return while the timer is running and the work will be queued
      again. Replace the calls with safer cancel_delayed_work() version
      which spins until the timer handler finishes on other CPUs and
      cancels the delayed work.
      Signed-off-by: NUlisses Furquim <ulisses@profusion.mobi>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      6de32750
    • J
      Bluetooth: Add missing QUIRK_NO_RESET test to hci_dev_do_close · ca0d6c7e
      Johan Hedberg 提交于
      We should only perform a reset in hci_dev_do_close if the
      HCI_QUIRK_NO_RESET flag is set (since in such a case a reset will not be
      performed when initializing the device).
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      ca0d6c7e
    • O
      Bluetooth: Fix RFCOMM session reference counting issue · cf33e77b
      Octavian Purdila 提交于
      There is an imbalance in the rfcomm_session_hold / rfcomm_session_put
      operations which causes the following crash:
      
      [  685.010159] BUG: unable to handle kernel paging request at 6b6b6b6b
      [  685.010169] IP: [<c149d76d>] rfcomm_process_dlcs+0x1b/0x15e
      [  685.010181] *pdpt = 000000002d665001 *pde = 0000000000000000
      [  685.010191] Oops: 0000 [#1] PREEMPT SMP
      [  685.010247]
      [  685.010255] Pid: 947, comm: krfcommd Tainted: G         C  3.0.16-mid8-dirty #44
      [  685.010266] EIP: 0060:[<c149d76d>] EFLAGS: 00010246 CPU: 1
      [  685.010274] EIP is at rfcomm_process_dlcs+0x1b/0x15e
      [  685.010281] EAX: e79f551c EBX: 6b6b6b6b ECX: 00000007 EDX: e79f40b4
      [  685.010288] ESI: e79f4060 EDI: ed4e1f70 EBP: ed4e1f68 ESP: ed4e1f50
      [  685.010295]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      [  685.010303] Process krfcommd (pid: 947, ti=ed4e0000 task=ed43e5e0 task.ti=ed4e0000)
      [  685.010308] Stack:
      [  685.010312]  ed4e1f68 c149eb53 e5925150 e79f4060 ed500000 ed4e1f70 ed4e1f80 c149ec10
      [  685.010331]  00000000 ed43e5e0 00000000 ed4e1f90 ed4e1f9c c149ec87 0000bf54 00000000
      [  685.010348]  00000000 ee03bf54 c149ec37 ed4e1fe4 c104fe01 00000000 00000000 00000000
      [  685.010367] Call Trace:
      [  685.010376]  [<c149eb53>] ? rfcomm_process_rx+0x6e/0x74
      [  685.010387]  [<c149ec10>] rfcomm_process_sessions+0xb7/0xde
      [  685.010398]  [<c149ec87>] rfcomm_run+0x50/0x6d
      [  685.010409]  [<c149ec37>] ? rfcomm_process_sessions+0xde/0xde
      [  685.010419]  [<c104fe01>] kthread+0x63/0x68
      [  685.010431]  [<c104fd9e>] ? __init_kthread_worker+0x42/0x42
      [  685.010442]  [<c14dae82>] kernel_thread_helper+0x6/0xd
      
      This issue has been brought up earlier here:
      
      https://lkml.org/lkml/2011/5/21/127
      
      The issue appears to be the rfcomm_session_put in rfcomm_recv_ua. This
      operation doesn't seem be to required as for the non-initiator case we
      have the rfcomm_process_rx doing an explicit put and in the initiator
      case the last dlc_unlink will drive the reference counter to 0.
      
      There have been several attempts to fix these issue:
      
      6c2718da Bluetooth: Do not call rfcomm_session_put() for RFCOMM UA on closed socket
      683d949a Bluetooth: Never deallocate a session when some DLC points to it
      
      but AFAICS they do not fix the issue just make it harder to reproduce.
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Signed-off-by: NGopala Krishna Murala <gopala.krishna.murala@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      cf33e77b
    • O
      Bluetooth: silence lockdep warning · b5a30dda
      Octavian Purdila 提交于
      Since bluetooth uses multiple protocols types, to avoid lockdep
      warnings, we need to use different lockdep classes (one for each
      protocol type).
      
      This is already done in bt_sock_create but it misses a couple of cases
      when new connections are created. This patch corrects that to fix the
      following warning:
      
      <4>[ 1864.732366] =======================================================
      <4>[ 1864.733030] [ INFO: possible circular locking dependency detected ]
      <4>[ 1864.733544] 3.0.16-mid3-00007-gc9a0f62 #3
      <4>[ 1864.733883] -------------------------------------------------------
      <4>[ 1864.734408] t.android.btclc/4204 is trying to acquire lock:
      <4>[ 1864.734869]  (rfcomm_mutex){+.+.+.}, at: [<c14970ea>] rfcomm_dlc_close+0x15/0x30
      <4>[ 1864.735541]
      <4>[ 1864.735549] but task is already holding lock:
      <4>[ 1864.736045]  (sk_lock-AF_BLUETOOTH){+.+.+.}, at: [<c1498bf7>] lock_sock+0xa/0xc
      <4>[ 1864.736732]
      <4>[ 1864.736740] which lock already depends on the new lock.
      <4>[ 1864.736750]
      <4>[ 1864.737428]
      <4>[ 1864.737437] the existing dependency chain (in reverse order) is:
      <4>[ 1864.738016]
      <4>[ 1864.738023] -> #1 (sk_lock-AF_BLUETOOTH){+.+.+.}:
      <4>[ 1864.738549]        [<c1062273>] lock_acquire+0x104/0x140
      <4>[ 1864.738977]        [<c13d35c1>] lock_sock_nested+0x58/0x68
      <4>[ 1864.739411]        [<c1493c33>] l2cap_sock_sendmsg+0x3e/0x76
      <4>[ 1864.739858]        [<c13d06c3>] __sock_sendmsg+0x50/0x59
      <4>[ 1864.740279]        [<c13d0ea2>] sock_sendmsg+0x94/0xa8
      <4>[ 1864.740687]        [<c13d0ede>] kernel_sendmsg+0x28/0x37
      <4>[ 1864.741106]        [<c14969ca>] rfcomm_send_frame+0x30/0x38
      <4>[ 1864.741542]        [<c1496a2a>] rfcomm_send_ua+0x58/0x5a
      <4>[ 1864.741959]        [<c1498447>] rfcomm_run+0x441/0xb52
      <4>[ 1864.742365]        [<c104f095>] kthread+0x63/0x68
      <4>[ 1864.742742]        [<c14d5182>] kernel_thread_helper+0x6/0xd
      <4>[ 1864.743187]
      <4>[ 1864.743193] -> #0 (rfcomm_mutex){+.+.+.}:
      <4>[ 1864.743667]        [<c1061ada>] __lock_acquire+0x988/0xc00
      <4>[ 1864.744100]        [<c1062273>] lock_acquire+0x104/0x140
      <4>[ 1864.744519]        [<c14d2c70>] __mutex_lock_common+0x3b/0x33f
      <4>[ 1864.744975]        [<c14d303e>] mutex_lock_nested+0x2d/0x36
      <4>[ 1864.745412]        [<c14970ea>] rfcomm_dlc_close+0x15/0x30
      <4>[ 1864.745842]        [<c14990d9>] __rfcomm_sock_close+0x5f/0x6b
      <4>[ 1864.746288]        [<c1499114>] rfcomm_sock_shutdown+0x2f/0x62
      <4>[ 1864.746737]        [<c13d275d>] sys_socketcall+0x1db/0x422
      <4>[ 1864.747165]        [<c14d42f0>] syscall_call+0x7/0xb
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      b5a30dda
    • A
      Bluetooth: l2cap_set_timer needs jiffies as timeout value · 6e1da683
      Andrzej Kaczmarek 提交于
      After moving L2CAP timers to workqueues l2cap_set_timer expects timeout
      value to be specified in jiffies but constants defined in miliseconds
      are used. This makes timeouts unreliable when CONFIG_HZ is not set to
      1000.
      
      __set_chan_timer macro still uses jiffies as input to avoid multiple
      conversions from/to jiffies for sk_sndtimeo value which is already
      specified in jiffies.
      Signed-off-by: NAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
      Ackec-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      6e1da683
    • A
      Bluetooth: Fix sk_sndtimeo initialization for L2CAP socket · a6375255
      Andrzej Kaczmarek 提交于
      sk_sndtime value should be specified in jiffies thus initial value
      needs to be converted from miliseconds. Otherwise this timeout is
      unreliable when CONFIG_HZ is not set to 1000.
      Signed-off-by: NAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      a6375255
    • J
      Bluetooth: Remove bogus inline declaration from l2cap_chan_connect · 4aa832c2
      Johan Hedberg 提交于
      As reported by Dan Carpenter this function causes a Sparse warning and
      shouldn't be declared inline:
      
      include/net/bluetooth/l2cap.h:837:30 error: marked inline, but without a
      definition"
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      4aa832c2