platform/kernel/kernel-mfld-blackbay.git
12 years agoPM: wakelocks: Display wakelocks preventing suspend by default
Todd Poynor [Mon, 8 Aug 2011 23:06:54 +0000 (16:06 -0700)]
PM: wakelocks: Display wakelocks preventing suspend by default

Use DEBUG_WAKEUP flag to show wakelocks that abort suspend, in
addition to showing wakelocks held during system resume.
DEBUG_WAKEUP is enabled by default.

Change-Id: If6fa68e8afbc482a5300ffab2964694b02b34f41
Signed-off-by: Todd Poynor <toddpoynor@google.com>
12 years agousb: otg: add proxy_wait handler to otg_id
Erik Gilling [Tue, 9 Aug 2011 21:18:21 +0000 (14:18 -0700)]
usb: otg: add proxy_wait handler to otg_id

Some otg_id handlers can detect what's connected but can't detect a change.
This allows that handler to pass off the waiting for ID change to a proxy.

Change-Id: Ib38b750c3da4bffc35e37b620ecee37c5d64d31f
Signed-off-by: Erik Gilling <konkers@android.com>
12 years agonetfilter: xt_qtaguid: recognize IPV6 interfaces. root is procfs privileged.
JP Abgrall [Tue, 9 Aug 2011 18:53:11 +0000 (11:53 -0700)]
netfilter: xt_qtaguid: recognize IPV6 interfaces. root is procfs privileged.

* Allow tracking interfaces that only have an ipv6 address.
  Deal with ipv6 notifier chains that do NETDEV_UP without the rtnl_lock()
* Allow root all access to procfs ctrl/stats.
  To disable all checks:
    echo 0 > /sys/module/xt_qtaguid/parameters/ctrl_write_gid
    echo 0 > /sys/module/xt_qtaguid/parameters/stats_readall_gid
* Add CDEBUG define to enable pr_debug output specific to
    procfs ctrl/stats access.

Change-Id: I9a469511d92fe42734daff6ea2326701312a161b
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonetfilter: xt_qtaguid: add counter sets and matching control
JP Abgrall [Tue, 9 Aug 2011 18:49:50 +0000 (11:49 -0700)]
netfilter: xt_qtaguid: add counter sets and matching control

* Added support for sets of counters.
By default set 0 is active.
Userspace can control which set is active for a given UID by
writing to .../ctrl
   s <set_num> <uid>
Changing the active set is only permitted for processes in the
 AID_NET_BW_ACCT group.

The active set tracking is reset when the uid tag is deleted with
the .../ctrl command
  d 0 <uid>

* New output format for the proc .../stats
 - Now has cnt_set in the list.
  """
  idx iface acct_tag_hex uid_tag_int cnt_set rx_bytes rx_packets tx_bytes tx_packets rx_tcp_packets rx_tcp_bytes rx_udp_packets rx_udp_bytes rx_other_packets rx_other_bytes tx_tcp_packets tx_tcp_bytes tx_udp_packets tx_udp_bytes tx_other_packets tx_other_bytes
  ...
  2 rmnet0 0x0 1000 0 27729 29 1477 27 27501 26 228 3 0 0 1249 24 228 3 0 0
  2 rmnet0 0x0 1000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  3 rmnet0 0x0 10005 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  3 rmnet0 0x0 10005 1 46407 57 8008 64 46407 57 0 0 0 0 8008 64 0 0 0 0
  ...
  6 rmnet0 0x7fff000100000000 10005 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  6 rmnet0 0x7fff000100000000 10005 1 27493 24 1564 22 27493 24 0 0 0 0 1564 22 0 0 0 0
  """

* Refactored for proc stats output code.
* Silenced some of the per packet debug output.
* Reworded some of the debug messages.
* Replaced all the spin_lock_irqsave/irqrestore with *_bh():
   netfilter handling is done in softirq.

Change-Id: Ibe89f9d754579fd97335617186c614b43333cfd3
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonet: wireless: bcmdhd: Fixing memory leak problem in wl_get_ies
Greg Goldman [Tue, 9 Aug 2011 18:43:28 +0000 (11:43 -0700)]
net: wireless: bcmdhd: Fixing memory leak problem in wl_get_ies

Change-Id: I26462c22ba4c3aebc1e157fbf74833c65815647c
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoion: minor clean up
Iliyan Malchev [Tue, 9 Aug 2011 21:42:08 +0000 (14:42 -0700)]
ion: minor clean up

-- init rb nodes in ion_handle_create
-- in ion_handle_destroy, check that a node belongs to a tree before removing
   it (safety check, does not happen right now)
-- mark as static functions used only inside ion.c
-- update comments to ion_share() with a relevant blurb from the implementation
-- other minor updates/typo fixes to comments

Signed-off-by: Iliyan Malchev <malchev@google.com>
12 years agoBluetooth: Fixed wrong L2CAP Sock timer value
Chen Ganir [Thu, 28 Jul 2011 12:42:09 +0000 (15:42 +0300)]
Bluetooth: Fixed wrong L2CAP Sock timer value

L2CAP connection timeout needs to be assigned as miliseconds
and not as jiffies.

Signed-off-by: Chen Ganir <chen.ganir@ti.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoPM: wakelocks: Don't report wake up wakelock if suspend aborted
Todd Poynor [Tue, 9 Aug 2011 00:26:49 +0000 (17:26 -0700)]
PM: wakelocks: Don't report wake up wakelock if suspend aborted

If the wakelock driver aborts suspend due to an already-held
wakelock, don't report the next wakelock held as the "wake up
wakelock".

Change-Id: I582ffbb87a3c361739a77d839a0c62921cff11a6
Signed-off-by: Todd Poynor <toddpoynor@google.com>
12 years agonet: wireless: bcmdhd: Fix CFG80211 memory corruption
Lin Ma [Fri, 5 Aug 2011 19:53:04 +0000 (12:53 -0700)]
net: wireless: bcmdhd: Fix CFG80211 memory corruption

 * Sends event/data packets to kernel while net_device interface
   has not been created or registered yet
 * Timer gets freed twice
 * The primary net_device interface never gets freed
 * Memory corruption in scan buffer
 * Memory corruption in cfg80211 wiphy structure fix for kthred_stop crash

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoipv6: updates to privacy addresses per RFC 4941
JP Abgrall [Wed, 3 Aug 2011 01:53:48 +0000 (18:53 -0700)]
ipv6: updates to privacy addresses per RFC 4941

Update the code to handle some of the differences between
RFC 3041 and RFC 4941, which obsoletes it. Also a couple
of janitorial fixes.

- Allow router advertisements to increase the lifetime of
  temporary addresses. This was not allowed by RFC 3041,
  but is specified by RFC 4941. It is useful when RA
  lifetimes are lower than TEMP_{VALID,PREFERRED}_LIFETIME:
  in this case, the previous code would delete or deprecate
  addresses prematurely.

- Change the default of MAX_RETRY to 3 per RFC 4941.

- Add a comment to clarify that the preferred and valid
  lifetimes in inet6_ifaddr are relative to the timestamp.

- Shorten lines to 80 characters in a couple of places.

Change-Id: I4da097664d4b1de7c1cebf410895319601c7f1cc
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonet: wireless: bcmdhd: Ensure struct semaphore to be defined
Chih-Wei Huang [Thu, 4 Aug 2011 17:09:43 +0000 (10:09 -0700)]
net: wireless: bcmdhd: Ensure struct semaphore to be defined

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Keep debug symbols for built-in driver
Dmitry Shmidt [Thu, 4 Aug 2011 17:07:19 +0000 (10:07 -0700)]
net: wireless: bcmdhd: Keep debug symbols for built-in driver

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Clean up formatting.
Howard M. Harte [Thu, 4 Aug 2011 00:47:51 +0000 (17:47 -0700)]
net: wireless: bcmdhd: Clean up formatting.

Change-Id: Idf0771201837ad00304107af3592c35a6236eb33
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Improve arp_hostip_table processing
Dmitry Shmidt [Wed, 3 Aug 2011 21:11:58 +0000 (14:11 -0700)]
net: wireless: bcmdhd: Improve arp_hostip_table processing

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Eliminate nested IOCTL call
Lin Ma [Wed, 3 Aug 2011 20:43:03 +0000 (13:43 -0700)]
net: wireless: bcmdhd: Eliminate nested IOCTL call

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Remove noisy debug prints
Dmitry Shmidt [Tue, 2 Aug 2011 18:02:04 +0000 (11:02 -0700)]
net: wireless: bcmdhd: Remove noisy debug prints

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcm4329: Remove obsolete file
Dmitry Shmidt [Tue, 2 Aug 2011 17:27:24 +0000 (10:27 -0700)]
net: wireless: bcm4329: Remove obsolete file

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: add support for mkeepalive.
Howard M. Harte [Tue, 2 Aug 2011 02:38:54 +0000 (19:38 -0700)]
net: wireless: bcmdhd: add support for mkeepalive.
Fix p2p group add issue.
Change-Id: Ieb8fba54e04912b4002837243c00ba90fd150e5d
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Check wldev_ioctl() for NULL parameter
Dmitry Shmidt [Mon, 1 Aug 2011 22:40:01 +0000 (15:40 -0700)]
net: wireless: bcmdhd: Check wldev_ioctl() for NULL parameter

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoBluetooth: l2cap: Fix lost wakeup waiting for ERTM acks
Peter Hurley [Mon, 25 Jul 2011 22:36:26 +0000 (18:36 -0400)]
Bluetooth: l2cap: Fix lost wakeup waiting for ERTM acks

Fix race condition which can result in missing wakeup during
l2cap socket shutdown.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: bnep: Fix lost wakeup of session thread
Peter Hurley [Sun, 24 Jul 2011 04:11:07 +0000 (00:11 -0400)]
Bluetooth: bnep: Fix lost wakeup of session thread

Fix race condition which can result in missing the wakeup intended
to stop the session thread.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: sco: Fix lost wakeups waiting to accept socket
Peter Hurley [Sun, 24 Jul 2011 04:11:01 +0000 (00:11 -0400)]
Bluetooth: sco: Fix lost wakeups waiting to accept socket

Fix race conditions which can cause lost wakeups (or missed signals)
while waiting to accept a sco socket connection.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: l2cap: Fix lost wakeups waiting to accept socket
Peter Hurley [Sun, 24 Jul 2011 04:10:52 +0000 (00:10 -0400)]
Bluetooth: l2cap: Fix lost wakeups waiting to accept socket

Fix race conditions which can cause lost wakeups (or misssed signals)
while waiting to accept an l2cap socket connection.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Fix lost wakeups waiting for sock state change
Peter Hurley [Sun, 24 Jul 2011 04:10:46 +0000 (00:10 -0400)]
Bluetooth: Fix lost wakeups waiting for sock state change

Fix race conditions which can cause lost wakeups while waiting
for sock state to change.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: rfcomm: Fix lost wakeups waiting to accept socket
Peter Hurley [Sun, 24 Jul 2011 04:10:41 +0000 (00:10 -0400)]
Bluetooth: rfcomm: Fix lost wakeups waiting to accept socket

Fix race conditions which can cause lost wakeups (or missed
signals) while waiting to accept an rfcomm socket connection.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: rfcomm: Remove unnecessary krfcommd event
Peter Hurley [Sun, 24 Jul 2011 04:10:35 +0000 (00:10 -0400)]
Bluetooth: rfcomm: Remove unnecessary krfcommd event

Removed superfluous event handling which was used to signal
that the rfcomm kthread had been woken. This appears to have been
used to prevent lost wakeups. Correctly ordering when the task
state is set to TASK_INTERRUPTIBLE is sufficient to prevent lost wakeups.

To prevent wakeups which occurred prior to initially setting
TASK_INTERRUPTIBLE from being lost, the main work of the thread loop -
rfcomm_process_sessions() - is performed prior to sleeping.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agonet: wireless: bcmdhd: Fix memory corruption in wl_android_get_rssi()
Dmitry Shmidt [Fri, 29 Jul 2011 20:45:06 +0000 (13:45 -0700)]
net: wireless: bcmdhd: Fix memory corruption in wl_android_get_rssi()

In case of FW problem wldev_get_ssid() doesn't return error and ssid
structure has garbage.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: change logic for removing monitor interace for P2P.
Howard M. Harte [Wed, 27 Jul 2011 19:16:11 +0000 (12:16 -0700)]
net: wireless: bcmdhd: change logic for removing monitor interace for P2P.

Change-Id: Ie757ec25c86d0402d0463a9b7f2fff14b840f446
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoAdditional patch for scan and connection problem.
Howard M. Harte [Wed, 27 Jul 2011 01:27:14 +0000 (18:27 -0700)]
Additional patch for scan and connection problem.

Change-Id: I79a25bd3f36f5d3accae83116084b8baf63a1033
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Put p2p_dev_addr under DHD_P2P_DEV_ADDR_FROM_SYSFS
Dmitry Shmidt [Tue, 26 Jul 2011 22:05:47 +0000 (15:05 -0700)]
net: wireless: bcmdhd: Put p2p_dev_addr under DHD_P2P_DEV_ADDR_FROM_SYSFS

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Fix rfkill cleaning on failure
Dmitry Shmidt [Tue, 26 Jul 2011 22:00:34 +0000 (15:00 -0700)]
net: wireless: bcmdhd: Fix rfkill cleaning on failure

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoFix scan and connection problem.
Howard M. Harte [Tue, 26 Jul 2011 02:46:20 +0000 (19:46 -0700)]
Fix scan and connection problem.

Change-Id: Idd77caf358fc77c4b81929c644020d09009e4f36
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoUpdate to 5.90.125.52:
Howard M. Harte [Tue, 26 Jul 2011 02:15:11 +0000 (19:15 -0700)]
Update to 5.90.125.52:
Fix unremoved monitor interface problem after killing hostapd.
Add WPS support for hostapd.

Change-Id: I4e476fafb203592fcdf5c15a526b67d4aa78df3e
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoFix a potential crash/memory leak if NVRAM fails to load.
Howard M. Harte [Tue, 26 Jul 2011 00:19:49 +0000 (17:19 -0700)]
Fix a potential crash/memory leak if NVRAM fails to load.

Change-Id: I27f41dd5833835b74f38524e9691d68ac807c991
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Ignore WL_BSS_INFO_VERSION value
Dmitry Shmidt [Mon, 25 Jul 2011 16:53:20 +0000 (09:53 -0700)]
net: wireless: bcmdhd: Ignore WL_BSS_INFO_VERSION value

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoFix ag band issue and escan crashes
Lin Ma [Fri, 22 Jul 2011 22:51:01 +0000 (15:51 -0700)]
Fix ag band issue and escan crashes

Change-Id: Ie1bdb52a362755b7c922be9b721e9cf0e4042d95
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoPM: Fix printing IRQ names for pending wakeup IRQs
Todd Poynor [Mon, 25 Jul 2011 21:54:03 +0000 (14:54 -0700)]
PM: Fix printing IRQ names for pending wakeup IRQs

The IRQ name has moved to the struct irqaction list (so print
first action's name).

Change-Id: I65a627457f9abaf7c1dcc32d8814243ba2ff4717
Signed-off-by: Todd Poynor <toddpoynor@google.com>
12 years agonetfilter: qtaguid: disable #define DEBUG
JP Abgrall [Fri, 22 Jul 2011 17:34:22 +0000 (10:34 -0700)]
netfilter: qtaguid: disable #define DEBUG

This would cause log spam to the point of slowing down the system.

Change-Id: I5655f0207935004b0198f43ad0d3c9ea25466e4e
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonetfilter: xt_qtaguid: add uid permission checks during ctrl/stats access
JP Abgrall [Sun, 17 Jul 2011 23:07:23 +0000 (16:07 -0700)]
netfilter: xt_qtaguid: add uid permission checks during ctrl/stats access

* uid handling
 - Limit UID impersonation to processes with a gid in AID_NET_BW_ACCT.
   This affects socket tagging, and data removal.
 - Limit stats lookup to own uid or the process gid is in AID_NET_BW_STATS.
   This affects stats lookup.

* allow pacifying the module
  Setting passive to Y/y will make the module return immediately on
  external stimulus.
  No more stats and silent success on ctrl writes.
  Mainly used when one suspects this module of misbehaving.

Change-Id: I83990862d52a9b0922aca103a0f61375cddeb7c4
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonetfilter: qtaguid: add tag delete command, expand stats output.
JP Abgrall [Sat, 16 Jul 2011 05:27:28 +0000 (22:27 -0700)]
netfilter: qtaguid: add tag delete command, expand stats output.

* Add a new ctrl command to delete stored data.
  d <acct_tag> [<uid>]
The uid will default to the running process's.
The accounting tag can be 0, in which case all counters and socket tags
associated with the uid will be cleared.

* Simplify the ctrl command handling at the expense of duplicate code.
This should make it easier to maintain.

* /proc/net/xt_qtaguid/stats now returns more stats
  idx iface acct_tag_hex uid_tag_int
  {rx,tx}_{bytes,packets}
  {rx,tx}_{tcp,udp,other}_{bytes,packets}
the {rx,tx}_{bytes,packets} are the totals.

* re-tagging will now allow changing the uid.

Change-Id: I9594621543cefeab557caa3d68a22a3eb320466d
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonetfilter: quota2: add support to log quota limit reached.
JP Abgrall [Wed, 13 Jul 2011 23:02:31 +0000 (16:02 -0700)]
netfilter: quota2: add support to log quota limit reached.

This uses the NETLINK NETLINK_NFLOG family to log a single message
when the quota limit is reached.
It uses the same packet type as ipt_ULOG, but
 - never copies skb data,
 - uses 112 as the event number (ULOG's +1)

It doesn't log if the module param "event_num" is 0.

Change-Id: I6f31736b568bb31a4ff0b9ac2ee58380e6b675ca
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonet: wireless: bcmdhd: Fix compilation for WEXT
Dmitry Shmidt [Wed, 20 Jul 2011 23:04:45 +0000 (16:04 -0700)]
net: wireless: bcmdhd: Fix compilation for WEXT

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Allow firmware_path parameter change
Dmitry Shmidt [Wed, 20 Jul 2011 17:31:30 +0000 (10:31 -0700)]
net: wireless: bcmdhd: Allow firmware_path parameter change

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoRelease 5.90.125.48 Add regulatory domain check in cfg80211 driver and fix PNO issues
Lin Ma [Wed, 20 Jul 2011 01:20:12 +0000 (18:20 -0700)]
Release 5.90.125.48 Add regulatory domain check in cfg80211 driver and fix PNO issues

Change-Id: I394f4eb017ca61861f16632e8998a8fb07e6fca7
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Allow empty scan results
Dmitry Shmidt [Tue, 19 Jul 2011 17:00:31 +0000 (10:00 -0700)]
net: wireless: bcmdhd: Allow empty scan results

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Fix compilation for kernel 3.0
Dmitry Shmidt [Tue, 19 Jul 2011 16:58:13 +0000 (09:58 -0700)]
net: wireless: bcmdhd: Fix compilation for kernel 3.0

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoUpdate to 5.90.125.40
Lin Ma [Mon, 18 Jul 2011 18:42:36 +0000 (11:42 -0700)]
Update to 5.90.125.40

Add monitor interface support and fix cfg80211 management frame isses
Add support for hostapd
Use private command to get p2p device address

Change-Id: Ie490e38f1af9f259ff4a96b2f7d367119c65c377
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcm4329: fix array subscript is below array bounds
Choi, Jong-Hwan [Fri, 15 Jul 2011 01:56:25 +0000 (10:56 +0900)]
net: wireless: bcm4329: fix array subscript is below array bounds

Change-Id: I5d521895070d255f7ac0c9eaf262ec9f4cdd2f8a
Signed-off-by: Choi, Jong-Hwan <jhbird.choi@samsung.com>
12 years agoUSB: gadget: f_accessory: Add ioctl to detect USB accessory attached at boot
Mike Lockwood [Thu, 21 Jul 2011 18:39:17 +0000 (11:39 -0700)]
USB: gadget: f_accessory: Add ioctl to detect USB accessory attached at boot

Signed-off-by: Mike Lockwood <lockwood@android.com>
12 years agoearlysuspend: add verbose debug flag
Erik Gilling [Thu, 21 Jul 2011 21:07:45 +0000 (14:07 -0700)]
earlysuspend: add verbose debug flag

when enabled, prints out the function of each handler as they are called

Change-Id: I5ed251867e0e3aa3cd05f030ff3579808cedd0c2
Signed-off-by: Erik Gilling <konkers@android.com>
12 years agoUSB: gadget: f_mtp: Move all setup handling to mtp_ctrlrequest
Mike Lockwood [Thu, 21 Jul 2011 00:08:28 +0000 (17:08 -0700)]
USB: gadget: f_mtp: Move all setup handling to mtp_ctrlrequest

The composite driver no longer sends setup requests to functions if the
destination is USB_RECIP_DEVICE, so we need to handle the requests
here instead of the function's setup callback.

Signed-off-by: Mike Lockwood <lockwood@android.com>
12 years agopower: Add option to log time spent in suspend
Colin Cross [Tue, 19 Jul 2011 19:33:45 +0000 (12:33 -0700)]
power: Add option to log time spent in suspend

Prints the time spent in suspend in the kernel log, and
keeps statistics on the time spent in suspend in
/sys/kernel/debug/suspend_time

Change-Id: Ia6b9ebe4baa0f7f5cd211c6a4f7e813aefd3fa1d
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
12 years agocpufreq: interactive: fix checkpatch warnings on long lines
Allen Martin [Tue, 19 Jul 2011 21:56:21 +0000 (14:56 -0700)]
cpufreq: interactive: fix checkpatch warnings on long lines

Fix up checkpatch warning introduced by long lines in timer_rate
patch.

Change-Id: I22b105dafb1b49390799bb7577464da03f0f8afb
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agoDocumentation: cpufreq: add description of timer_rate
Allen Martin [Fri, 1 Jul 2011 06:54:07 +0000 (23:54 -0700)]
Documentation: cpufreq: add description of timer_rate

Add description of timer_rate tunable and clean up some
typos.

Change-Id: I4b96a36aad51eed3bef0ee5f571dc6e0a94c8dd9
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agoBluetooth: Fix regression in L2CAP connection procedure
Gustavo F. Padovan [Fri, 15 Jul 2011 18:30:20 +0000 (18:30 +0000)]
Bluetooth: Fix regression in L2CAP connection procedure

Caused by the following commit, partially revert it.

commit 9fa7e4f76f3658ba1f44fbdb95c77e7df3f53f95
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Jun 30 16:11:30 2011 -0300

    Bluetooth: Fix regression with incoming L2CAP connections

    PTS test A2DP/SRC/SRC_SET/TC_SRC_SET_BV_02_I revealed that
    ( probably after the df3c3931e commit ) the l2cap connection
    could not be established in case when the "Auth Complete" HCI
    event does not arive before the initiator send "Configuration
    request", in which case l2cap replies with "Command rejected"
    since the channel is still in BT_CONNECT2 state.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoBluetooth: Fix regression with incoming L2CAP connections
Gustavo F. Padovan [Thu, 30 Jun 2011 19:11:30 +0000 (16:11 -0300)]
Bluetooth: Fix regression with incoming L2CAP connections

PTS test A2DP/SRC/SRC_SET/TC_SRC_SET_BV_02_I revealed that
( probably after the df3c3931e commit ) the l2cap connection
could not be established in case when the "Auth Complete" HCI
event does not arive before the initiator send "Configuration
request", in which case l2cap replies with "Command rejected"
since the channel is still in BT_CONNECT2 state.

Based on patch from: Ilia Kolomisnky <iliak@ti.com>

Change-Id: Ifcffe0124adbbc6d1931389ff7476dd0304d6f51
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agonet: Only NET_ADMIN is allowed to fully control TUN interfaces.
Chia-chi Yeh [Fri, 15 Jul 2011 22:32:57 +0000 (15:32 -0700)]
net: Only NET_ADMIN is allowed to fully control TUN interfaces.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
12 years agocpufreq: interactive: cleanup checkpatch warnings
Allen Martin [Fri, 1 Jul 2011 18:19:14 +0000 (11:19 -0700)]
cpufreq: interactive: cleanup checkpatch warnings

Cleanup some style warnings reported by checkpatch

Change-Id: Ie2e6903d52867fb3347e009d7efa3bc4ca755cea
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agocpufreq: Add more verbose description of interactive governor
Allen Martin [Fri, 1 Jul 2011 18:17:39 +0000 (11:17 -0700)]
cpufreq: Add more verbose description of interactive governor

Update the Kconfig help paragraph to give more detail about
interactive governor.

Change-Id: I607b817b370accac3a685001649a15e2f7894f59
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agoDocumentation: remove trailing whitespace in governors.txt
Allen Martin [Fri, 1 Jul 2011 18:16:06 +0000 (11:16 -0700)]
Documentation: remove trailing whitespace in governors.txt

Fixes a checkpatch warning

Change-Id: I2962b7c32f336188de0d2fe4f0f13f1199cb68e2
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agocpufreq: interactive: add sysfs control for timer rate
Allen Martin [Fri, 1 Jul 2011 06:54:07 +0000 (23:54 -0700)]
cpufreq: interactive: add sysfs control for timer rate

Add a new sysfs control that tunes the rate of the timer used to
increase cpu frequency

Change-Id: I1aa13ae54bb43aff5b3688984d2955f56aae1658
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agocpufreq: interactive: Add error checking on sysfs interfaces
Allen Martin [Thu, 30 Jun 2011 23:59:19 +0000 (16:59 -0700)]
cpufreq: interactive: Add error checking on sysfs interfaces

This adds better error checking on tunable parameters on sysfs
interfaces.  Also fixes return value from these functions, previously
on success they would return 0 which would cause a infinite loop.

Change-Id: Ic05038492166f8673d007202092471f98a2f0dfa
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agocpufreq: interactive: use idle notifier
Allen Martin [Tue, 28 Jun 2011 16:58:39 +0000 (09:58 -0700)]
cpufreq: interactive: use idle notifier

Convert interactive governor to use idle notifier instead of
hooking pm_idle directly.

Change-Id: I47e007f330468ac559240a0ae8a3cb06a89ccb67
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agocpufreq: interactive: remove debug trace code
Allen Martin [Tue, 28 Jun 2011 17:40:30 +0000 (10:40 -0700)]
cpufreq: interactive: remove debug trace code

Remove debug trace code in preparation of upstreaming

Change-Id: I0905885e75031f5e9d7cb06878fb68c1fd06d4fe
Signed-off-by: Allen Martin <amartin@nvidia.com>
12 years agoARM: Move leds idle start/stop calls to idle notifiers
Todd Poynor [Sat, 25 Jun 2011 02:33:01 +0000 (19:33 -0700)]
ARM: Move leds idle start/stop calls to idle notifiers

Change-Id: I5d8e4e85b17bbab7992ecb477f0bdb5e4138b166
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
12 years agoARM: Call idle notifiers
Todd Poynor [Thu, 16 Jun 2011 00:44:50 +0000 (17:44 -0700)]
ARM: Call idle notifiers

Change-Id: Id833e61c13baa1783705ac9e9046d1f0cc90c95e
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
12 years agoMove x86_64 idle notifiers to generic
Todd Poynor [Thu, 16 Jun 2011 00:21:57 +0000 (17:21 -0700)]
Move x86_64 idle notifiers to generic

Move the x86_64 idle notifiers originally by Andi Kleen and Venkatesh
Pallipadi to generic.

Change-Id: Idf29cda15be151f494ff245933c12462643388d5
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
12 years agoUSB: gadget: f_mtp: Add support for sending MTP header during file transfer
Mike Lockwood [Thu, 14 Jul 2011 23:42:42 +0000 (19:42 -0400)]
USB: gadget: f_mtp: Add support for sending MTP header during file transfer

MTP_SEND_FILE_WITH_HEADER ioctl allows sending a file with the 12 byte header
prepended at the beginning.
This is to allow MTP to use a single packet for the data phase instead of two.

Signed-off-by: Mike Lockwood <lockwood@android.com>
12 years agonet: wireless: bcmdhd: Add PNO support through CFG80211 private command
Dmitry Shmidt [Wed, 13 Jul 2011 22:09:00 +0000 (15:09 -0700)]
net: wireless: bcmdhd: Add PNO support through CFG80211 private command

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Fix build break with newer versions of gcc
Rom Lemarchand [Wed, 13 Jul 2011 19:15:34 +0000 (12:15 -0700)]
net: wireless: bcmdhd: Fix build break with newer versions of gcc

In case the WPA cipher can't be determined the pval and gval variables don't
get updated which generates a warning in newer versions of gcc (tested with
4.5.2). Since the bcmdhd driver gets compiled with warnings treated as errors
this change is needed to fix the build.

Change-Id: Ia483777fee54ac526bb0db7c666fa2bf5df17354
Signed-off-by: Rom Lemarchand <rlemarchand@sta.samsung.com>
12 years agonet: wireless: bcm4329: Fix roaming message processing
Dmitry Shmidt [Wed, 13 Jul 2011 17:43:20 +0000 (10:43 -0700)]
net: wireless: bcm4329: Fix roaming message processing

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcmdhd: Add country private command
Dmitry Shmidt [Tue, 12 Jul 2011 18:19:48 +0000 (11:19 -0700)]
net: wireless: bcmdhd: Add country private command

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agonet: wireless: bcm4329: Add packet filtering commands
Dmitry Shmidt [Tue, 12 Jul 2011 00:17:23 +0000 (17:17 -0700)]
net: wireless: bcm4329: Add packet filtering commands

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agocgroup: Add generic cgroup subsystem permission checks
Colin Cross [Wed, 13 Jul 2011 02:53:24 +0000 (19:53 -0700)]
cgroup: Add generic cgroup subsystem permission checks

Rather than using explicit euid == 0 checks when trying to move
tasks into a cgroup via CFS, move permission checks into each
specific cgroup subsystem. If a subsystem does not specify a
'allow_attach' handler, then we fall back to doing our checks
the old way.

Use the 'allow_attach' handler for the 'cpu' cgroup to allow
non-root processes to add arbitrary processes to a 'cpu' cgroup
if it has the CAP_SYS_NICE capability set.

This version of the patch adds a 'allow_attach' handler instead
of reusing the 'can_attach' handler.  If the 'can_attach' handler
is reused, a new cgroup that implements 'can_attach' but not
the permission checks could end up with no permission checks
at all.

Change-Id: Icfa950aa9321d1ceba362061d32dc7dfa2c64f0c
Original-Author: San Mehat <san@google.com>
Signed-off-by: Colin Cross <ccross@android.com>
12 years agoRevert "cgroup: Add generic cgroup subsystem permission checks."
Colin Cross [Wed, 13 Jul 2011 03:12:45 +0000 (20:12 -0700)]
Revert "cgroup: Add generic cgroup subsystem permission checks."

This reverts commit 1d38bc7d0523af2233b4280e2aeab34c6a076665.

Change-Id: I2c5066b696cbdd5ca117ed74718bcb7e70e878e7
Signed-off-by: Colin Cross <ccross@android.com>
12 years agonetfitler: fixup the quota2, and enable.
JP Abgrall [Tue, 12 Jul 2011 19:02:59 +0000 (12:02 -0700)]
netfitler: fixup the quota2, and enable.

The xt_quota2 came from
  http://sourceforge.net/projects/xtables-addons/develop

It needed tweaking for it to compile within the kernel tree.
Fixed kmalloc() and create_proc_entry() invocations within
 a non-interruptible context.
Removed useless copying of current quota back to the iptable's
struct matchinfo:
  - those are per CPU: they will change randomly based on which
    cpu gets to update the value.
  - they prevent matching a rule: e.g.
      -A chain -m quota2 --name q1 --quota 123
     can't be followed by
      -D chain -m quota2 --name q1 --quota 123
    as the 123 will be compared to the struct matchinfo's quota member.

Change-Id: I021d3b743db3b22158cc49acb5c94d905b501492
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agonetfilter: adding the original quota2 from xtables-addons
JP Abgrall [Tue, 21 Jun 2011 18:14:49 +0000 (11:14 -0700)]
netfilter: adding the original quota2 from xtables-addons

The original xt_quota in the kernel is plain broken:
  - counts quota at a per CPU level
    (was written back when ubiquitous SMP was just a dream)
  - provides no way to count across IPV4/IPV6.

This patch is the original unaltered code from:
  http://sourceforge.net/projects/xtables-addons

  at commit e84391ce665cef046967f796dd91026851d6bbf3

Change-Id: I19d49858840effee9ecf6cff03c23b45a97efdeb
Signed-off-by: JP Abgrall <jpa@google.com>
12 years agoUSB: otg: add otg id notifier utiltiies
Colin Cross [Fri, 24 Jun 2011 22:58:51 +0000 (15:58 -0700)]
USB: otg: add otg id notifier utiltiies

Add a otg_id notifier to allow multiple drivers to cooperate to
determine the type of cable connected to a USB connector without
requiring direct calls between the drivers.

Change-Id: Ic5675f1a89daf85b17336765de24e4bdb6df6348
Signed-off-by: Colin Cross <ccross@android.com>
12 years agopda_power: add support for using otg transceiver events
Dima Zavin [Fri, 8 Jul 2011 06:20:27 +0000 (23:20 -0700)]
pda_power: add support for using otg transceiver events

If the platform data sets the use_otg_notifier flag,
the driver will now register an otg notifier callback and listen
to transceiver events for AC/USB plug-in events instead. This would
normally be used by not specifying is_xx_online callbacks and
not specifying any irqs so the state machine is completely driven
from OTG xceiver events.

Change-Id: Ic4b3bc4010f299156e41fd2411696c7ff5a88e92
Signed-off-by: Dima Zavin <dima@android.com>
12 years agoBluetooth: Add support for returning the encryption key size
Vinicius Costa Gomes [Fri, 8 Jul 2011 21:31:46 +0000 (18:31 -0300)]
Bluetooth: Add support for returning the encryption key size

This will be useful when userspace wants to restrict some kinds of
operations based on the length of the key size used to encrypt the
link.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add support for storing the key size
Vinicius Costa Gomes [Fri, 8 Jul 2011 21:31:45 +0000 (18:31 -0300)]
Bluetooth: Add support for storing the key size

In some cases it will be useful having the key size used for
encrypting the link. For example, some profiles may restrict
some operations depending on the key length.

The key size is stored in the key that is passed to userspace
using the pin_length field in the key structure.

For now this field is only valid for LE controllers. 3.0+HS
controllers define the Read Encryption Key Size command, this
field is intended for storing the value returned by that
command.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add support for communicating keys with userspace
Vinicius Costa Gomes [Fri, 8 Jul 2011 21:31:44 +0000 (18:31 -0300)]
Bluetooth: Add support for communicating keys with userspace

As the key format has changed to something that has a dynamic size,
the way that keys are received and sent must be changed.

The structure fields order is changed to make the parsing of the
information received from the Management Interface easier.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Remove unused field in hci_conn
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:42 +0000 (18:59 -0300)]
Bluetooth: Remove unused field in hci_conn

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Use the stored LTK for restabilishing security
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:41 +0000 (18:59 -0300)]
Bluetooth: Use the stored LTK for restabilishing security

Now that it's possible that the exchanged key is present in
the link key list, we may be able to estabilish security with
an already existing key, without need to perform any SMP
procedure.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Use the link key list to temporarily store the STK
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:40 +0000 (18:59 -0300)]
Bluetooth: Use the link key list to temporarily store the STK

With this we can use only one place to store all keys, without
need to use a field in the connection structure for this
purpose.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add support for storing the LTK
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:39 +0000 (18:59 -0300)]
Bluetooth: Add support for storing the LTK

Now when the LTK is received from the remote or generated it is stored,
so it can later be used.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Fix SM pairing parameters negotiation
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:38 +0000 (18:59 -0300)]
Bluetooth: Fix SM pairing parameters negotiation

Before implementing SM key distribution, the pairing features
exchange must be better negotiated, taking into account some
features of the host and connection requirements.

If we are in the "not pairable" state, it makes no sense to
exchange any key. This allows for simplification of the key
negociation method.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Reject an encryption request when the key isn't found
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:37 +0000 (18:59 -0300)]
Bluetooth: Reject an encryption request when the key isn't found

Now that we have methods to finding keys by its parameters we can
reject an encryption request if the key isn't found.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add functions to manipulate the link key list for SMP
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:36 +0000 (18:59 -0300)]
Bluetooth: Add functions to manipulate the link key list for SMP

As the LTK (the new type of key being handled now) has more data
associated with it, we need to store this extra data and retrieve
the keys based on that data.

Methods for searching for a key and for adding a new LTK are
introduced here.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add new structures for supporting SM key distribution
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:35 +0000 (18:59 -0300)]
Bluetooth: Add new structures for supporting SM key distribution

We need these changes because SMP keys may have more information
associated with them, for example, in the LTK case, it has an
encrypted diversifier (ediv) and a random number (rand).

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add support for SMP phase 3 (key distribution)
Vinicius Costa Gomes [Thu, 7 Jul 2011 21:59:34 +0000 (18:59 -0300)]
Bluetooth: Add support for SMP phase 3 (key distribution)

This adds support for generating and distributing all the keys
specified in the third phase of SMP.

This will make possible to re-establish secure connections, resolve
private addresses and sign commands.

For now, the values generated are random.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Remove L2CAP busy queue
Mat Martineau [Thu, 7 Jul 2011 16:39:03 +0000 (09:39 -0700)]
Bluetooth: Remove L2CAP busy queue

The ERTM receive buffer is now handled in a way that does not require
the busy queue and the associated polling code.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Use event-driven approach for handling ERTM receive buffer
Mat Martineau [Thu, 7 Jul 2011 16:39:02 +0000 (09:39 -0700)]
Bluetooth: Use event-driven approach for handling ERTM receive buffer

This change moves most L2CAP ERTM receive buffer handling out of the
L2CAP core and in to the socket code.  It's up to the higher layer
(the socket code, in this case) to tell the core when its buffer is
full or has space available.  The recv op should always accept
incoming ERTM data or else the connection will go down.

Within the socket layer, an skb that does not fit in the socket
receive buffer will be temporarily stored.  When the socket is read
from, that skb will be placed in the receive buffer if possible.  Once
adequate buffer space becomes available, the L2CAP core is informed
and the ERTM local busy state is cleared.

Receive buffer management for non-ERTM modes is unchanged.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Move code for ERTM local busy state to separate functions
Mat Martineau [Thu, 7 Jul 2011 16:39:01 +0000 (09:39 -0700)]
Bluetooth: Move code for ERTM local busy state to separate functions

The local busy state is entered and exited based on buffer status in
the socket layer (or other upper layer).  This change is in
preparation for general buffer status reports from the socket layer,
which will then be used to change the local busy status.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Fix potential deadlock in mgmt
Andre Guedes [Thu, 7 Jul 2011 13:30:36 +0000 (10:30 -0300)]
Bluetooth: Fix potential deadlock in mgmt

All threads running in process context should disable local bottom
halve before locking hdev->lock.

This patch fix the following message generated when Bluetooh module
is loaded with enable_mgmt=y (CONFIG_PROVE_LOCKING enabled).

[  107.880781] =================================
[  107.881631] [ INFO: inconsistent lock state ]
[  107.881631] 2.6.39+ #1
[  107.881631] ---------------------------------
[  107.881631] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[  107.881631] rcuc0/7 [HC0[0]:SC1[3]:HE1:SE0] takes:
[  107.881631]  (&(&hdev->lock)->rlock){+.?...}, at: [<ffffffffa0012c8d>] mgmt_set_local_name_complete+0x84/0x10b [bluetooth]
[  107.881631] {SOFTIRQ-ON-W} state was registered at:
[  107.881631]   [<ffffffff8105188b>] __lock_acquire+0x347/0xd52
[  107.881631]   [<ffffffff810526ac>] lock_acquire+0x8a/0xa7
[  107.881631]   [<ffffffff812b3758>] _raw_spin_lock+0x2c/0x3b
[  107.881631]   [<ffffffffa0011cc2>] mgmt_control+0xd4d/0x175b [bluetooth]
[  107.881631]   [<ffffffffa0013275>] hci_sock_sendmsg+0x97/0x293 [bluetooth]
[  107.881631]   [<ffffffff8121940c>] sock_aio_write+0x126/0x13a
[  107.881631]   [<ffffffff810a35fa>] do_sync_write+0xba/0xfa
[  107.881631]   [<ffffffff810a3beb>] vfs_write+0xaa/0xca
[  107.881631]   [<ffffffff810a3d80>] sys_write+0x45/0x69
[  107.881631]   [<ffffffff812b4892>] system_call_fastpath+0x16/0x1b
[  107.881631] irq event stamp: 2100876
[  107.881631] hardirqs last  enabled at (2100876): [<ffffffff812b40d4>] restore_args+0x0/0x30
[  107.881631] hardirqs last disabled at (2100875): [<ffffffff812b3f6a>] save_args+0x6a/0x70
[  107.881631] softirqs last  enabled at (2100862): [<ffffffff8106a805>] rcu_cpu_kthread+0x2b5/0x2e2
[  107.881631] softirqs last disabled at (2100863): [<ffffffff812b56bc>] call_softirq+0x1c/0x26
[  107.881631]
[  107.881631] other info that might help us debug this:
[  107.881631]  Possible unsafe locking scenario:
[  107.881631]
[  107.881631]        CPU0
[  107.881631]        ----
[  107.881631]   lock(&(&hdev->lock)->rlock);
[  107.881631]   <Interrupt>
[  107.881631]     lock(&(&hdev->lock)->rlock);
[  107.881631]
[  107.881631]  *** DEADLOCK ***
[  107.881631]
[  107.881631] 1 lock held by rcuc0/7:
[  107.881631]  #0:  (hci_task_lock){++.-..}, at: [<ffffffffa0008353>] hci_rx_task+0x49/0x2f3 [bluetooth]
[  107.881631]
[  107.881631] stack backtrace:
[  107.881631] Pid: 7, comm: rcuc0 Not tainted 2.6.39+ #1
[  107.881631] Call Trace:
[  107.881631]  <IRQ>  [<ffffffff812ae901>] print_usage_bug+0x1e7/0x1f8
[  107.881631]  [<ffffffff8100a796>] ? save_stack_trace+0x27/0x44
[  107.881631]  [<ffffffff8104fc3f>] ? print_irq_inversion_bug.part.26+0x19a/0x19a
[  107.881631]  [<ffffffff810504bb>] mark_lock+0x106/0x258
[  107.881631]  [<ffffffff81051817>] __lock_acquire+0x2d3/0xd52
[  107.881631]  [<ffffffff8102be73>] ? vprintk+0x3ab/0x3d7
[  107.881631]  [<ffffffff810526ac>] lock_acquire+0x8a/0xa7
[  107.881631]  [<ffffffffa0012c8d>] ? mgmt_set_local_name_complete+0x84/0x10b [bluetooth]
[  107.881631]  [<ffffffff81052615>] ? lock_release+0x16c/0x179
[  107.881631]  [<ffffffff812b3952>] _raw_spin_lock_bh+0x31/0x40
[  107.881631]  [<ffffffffa0012c8d>] ? mgmt_set_local_name_complete+0x84/0x10b [bluetooth]
[  107.881631]  [<ffffffffa0012c8d>] mgmt_set_local_name_complete+0x84/0x10b [bluetooth]
[  107.881631]  [<ffffffffa000d3fe>] hci_event_packet+0x122b/0x3e12 [bluetooth]
[  107.881631]  [<ffffffff81050658>] ? mark_held_locks+0x4b/0x6d
[  107.881631]  [<ffffffff812b3cff>] ? _raw_spin_unlock_irqrestore+0x40/0x4d
[  107.881631]  [<ffffffff810507b9>] ? trace_hardirqs_on_caller+0x13f/0x172
[  107.881631]  [<ffffffff812b3d07>] ? _raw_spin_unlock_irqrestore+0x48/0x4d
[  107.881631]  [<ffffffffa00083d2>] hci_rx_task+0xc8/0x2f3 [bluetooth]
[  107.881631]  [<ffffffff8102f836>] ? __local_bh_enable+0x90/0xa4
[  107.881631]  [<ffffffff8102f5a9>] tasklet_action+0x87/0xe6
[  107.881631]  [<ffffffff8102fa11>] __do_softirq+0x9f/0x13f
[  107.881631]  [<ffffffff812b56bc>] call_softirq+0x1c/0x26
[  107.881631]  <EOI>  [<ffffffff810033b8>] ? do_softirq+0x46/0x9a
[  107.881631]  [<ffffffff8106a805>] ? rcu_cpu_kthread+0x2b5/0x2e2
[  107.881631]  [<ffffffff8102f906>] _local_bh_enable_ip+0xac/0xc9
[  107.881631]  [<ffffffff8102f93b>] local_bh_enable+0xd/0xf
[  107.881631]  [<ffffffff8106a805>] rcu_cpu_kthread+0x2b5/0x2e2
[  107.881631]  [<ffffffff81041586>] ? __init_waitqueue_head+0x46/0x46
[  107.881631]  [<ffffffff8106a550>] ? rcu_yield.constprop.42+0x98/0x98
[  107.881631]  [<ffffffff81040f0a>] kthread+0x7f/0x87
[  107.881631]  [<ffffffff812b55c4>] kernel_thread_helper+0x4/0x10
[  107.881631]  [<ffffffff812b40d4>] ? retint_restore_args+0x13/0x13
[  107.881631]  [<ffffffff81040e8b>] ? __init_kthread_worker+0x53/0x53
[  107.881631]  [<ffffffff812b55c0>] ? gs_change+0x13/0x13

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Fix potential deadlock in hci_core
Andre Guedes [Thu, 7 Jul 2011 13:30:35 +0000 (10:30 -0300)]
Bluetooth: Fix potential deadlock in hci_core

Since hdev->lock may be acquired by threads runnning in interrupt
context, all threads running in process context should disable
local bottom halve before locking hdev->lock. This can be done by
using hci_dev_lock_bh macro.

This way, we avoid potencial deadlocks like this one reported by
CONFIG_PROVE_LOCKING=y.

[  304.788780] =================================
[  304.789686] [ INFO: inconsistent lock state ]
[  304.789686] 2.6.39+ #1
[  304.789686] ---------------------------------
[  304.789686] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[  304.789686] ksoftirqd/0/3 [HC0[0]:SC1[1]:HE1:SE0] takes:
[  304.789686]  (&(&hdev->lock)->rlock){+.?...}, at: [<ffffffffa000bbfe>] hci_conn_check_pending+0x38/0x76 [bluetooth]
[  304.789686] {SOFTIRQ-ON-W} state was registered at:
[  304.789686]   [<ffffffff8105188b>] __lock_acquire+0x347/0xd52
[  304.789686]   [<ffffffff810526ac>] lock_acquire+0x8a/0xa7
[  304.789686]   [<ffffffff812b3758>] _raw_spin_lock+0x2c/0x3b
[  304.789686]   [<ffffffffa0009cf0>] hci_blacklist_del+0x1f/0x8a [bluetooth]
[  304.789686]   [<ffffffffa00139fd>] hci_sock_ioctl+0x2d9/0x314 [bluetooth]
[  304.789686]   [<ffffffff812197d8>] sock_ioctl+0x1f2/0x214
[  304.789686]   [<ffffffff810b0fd6>] do_vfs_ioctl+0x46c/0x4ad
[  304.789686]   [<ffffffff810b1059>] sys_ioctl+0x42/0x65
[  304.789686]   [<ffffffff812b4892>] system_call_fastpath+0x16/0x1b
[  304.789686] irq event stamp: 9768
[  304.789686] hardirqs last  enabled at (9768): [<ffffffff812b40d4>] restore_args+0x0/0x30
[  304.789686] hardirqs last disabled at (9767): [<ffffffff812b3f6a>] save_args+0x6a/0x70
[  304.789686] softirqs last  enabled at (9726): [<ffffffff8102fa9b>] __do_softirq+0x129/0x13f
[  304.789686] softirqs last disabled at (9739): [<ffffffff8102fb33>] run_ksoftirqd+0x82/0x133
[  304.789686]
[  304.789686] other info that might help us debug this:
[  304.789686]  Possible unsafe locking scenario:
[  304.789686]
[  304.789686]        CPU0
[  304.789686]        ----
[  304.789686]   lock(&(&hdev->lock)->rlock);
[  304.789686]   <Interrupt>
[  304.789686]     lock(&(&hdev->lock)->rlock);
[  304.789686]
[  304.789686]  *** DEADLOCK ***
[  304.789686]
[  304.789686] 1 lock held by ksoftirqd/0/3:
[  304.789686]  #0:  (hci_task_lock){++.-..}, at: [<ffffffffa0008353>] hci_rx_task+0x49/0x2f3 [bluetooth]
[  304.789686]
[  304.789686] stack backtrace:
[  304.789686] Pid: 3, comm: ksoftirqd/0 Not tainted 2.6.39+ #1
[  304.789686] Call Trace:
[  304.789686]  [<ffffffff812ae901>] print_usage_bug+0x1e7/0x1f8
[  304.789686]  [<ffffffff8100a796>] ? save_stack_trace+0x27/0x44
[  304.789686]  [<ffffffff8104fc3f>] ? print_irq_inversion_bug.part.26+0x19a/0x19a
[  304.789686]  [<ffffffff810504bb>] mark_lock+0x106/0x258
[  304.789686]  [<ffffffff812b40d4>] ? retint_restore_args+0x13/0x13
[  304.789686]  [<ffffffff81051817>] __lock_acquire+0x2d3/0xd52
[  304.789686]  [<ffffffff8102be73>] ? vprintk+0x3ab/0x3d7
[  304.789686]  [<ffffffff812ae126>] ? printk+0x3c/0x3e
[  304.789686]  [<ffffffff810526ac>] lock_acquire+0x8a/0xa7
[  304.789686]  [<ffffffffa000bbfe>] ? hci_conn_check_pending+0x38/0x76 [bluetooth]
[  304.789686]  [<ffffffff811601c6>] ? __dynamic_pr_debug+0x10c/0x11a
[  304.789686]  [<ffffffff812b3758>] _raw_spin_lock+0x2c/0x3b
[  304.789686]  [<ffffffffa000bbfe>] ? hci_conn_check_pending+0x38/0x76 [bluetooth]
[  304.789686]  [<ffffffffa000bbfe>] hci_conn_check_pending+0x38/0x76 [bluetooth]
[  304.789686]  [<ffffffffa000c561>] hci_event_packet+0x38e/0x3e12 [bluetooth]
[  304.789686]  [<ffffffff81052615>] ? lock_release+0x16c/0x179
[  304.789686]  [<ffffffff812b3b41>] ? _raw_read_unlock+0x23/0x27
[  304.789686]  [<ffffffffa0013e7f>] ? hci_send_to_sock+0x179/0x188 [bluetooth]
[  304.789686]  [<ffffffffa00083d2>] hci_rx_task+0xc8/0x2f3 [bluetooth]
[  304.789686]  [<ffffffff8102f5a9>] tasklet_action+0x87/0xe6
[  304.789686]  [<ffffffff8102fa11>] __do_softirq+0x9f/0x13f
[  304.789686]  [<ffffffff8102fb33>] run_ksoftirqd+0x82/0x133
[  304.789686]  [<ffffffff8102fab1>] ? __do_softirq+0x13f/0x13f
[  304.789686]  [<ffffffff81040f0a>] kthread+0x7f/0x87
[  304.789686]  [<ffffffff812b55c4>] kernel_thread_helper+0x4/0x10
[  304.789686]  [<ffffffff812b40d4>] ? retint_restore_args+0x13/0x13
[  304.789686]  [<ffffffff81040e8b>] ? __init_kthread_worker+0x53/0x53
[  304.789686]  [<ffffffff812b55c0>] ? gs_change+0x13/0x13

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Remove enable_smp parameter
Andre Guedes [Thu, 30 Jun 2011 22:20:56 +0000 (19:20 -0300)]
Bluetooth: Remove enable_smp parameter

The enable_smp parameter is no longer needed. It can be replaced by
checking lmp_host_le_capable.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add lmp_host_le_capable() macro
Andre Guedes [Thu, 30 Jun 2011 22:20:55 +0000 (19:20 -0300)]
Bluetooth: Add lmp_host_le_capable() macro

Since we have the extended LMP features properly implemented, we
should check the LMP_HOST_LE bit to know if the host supports LE.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Add enable_le module parameter
Andre Guedes [Thu, 30 Jun 2011 22:20:54 +0000 (19:20 -0300)]
Bluetooth: Add enable_le module parameter

This patch adds a new module parameter to enable/disable host LE
support. By default host LE support is disabled.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
12 years agoBluetooth: Write LE Host Supported command
Andre Guedes [Thu, 30 Jun 2011 22:20:53 +0000 (19:20 -0300)]
Bluetooth: Write LE Host Supported command

This patch adds a handler to Write LE Host Supported command complete
events. Once this commands has completed successfully, we should
read the extended LMP features and update the extfeatures field in
hci_dev.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>