USB: gadget: f_audio_source: Fix error handling and increase packet size

Fixes watchdog reset on USB disconnect
Larger packet size fixes performance in fullspeed mode

Signed-off-by: Mike Lockwood <lockwood@google.com>
USB: gadget: f_audio_source: Fix use after free in audio_unbind

When USB was disconnected, we were freeing our audio_dev struct in audio_unbind
before the audio system had cleaned up, resulting in a hang in audio_pcm_close.
We now statically allocate the audio_dev struct to avoid this problem.

Change-Id: I58ad21eaa20dcf4aa74ee614ef3b6ed2c91d52a1
Signed-off-by: Mike Lockwood <lockwood@google.com>
net: ipv6: ip6_fib.c: Flush dead neighbour and L2 cache on GC

Neighbour entry and hh cache pointed from dst_entry in IPv6 FIB
is not flushed on NETDEV_CHANGE_ADDR while neighbour is marked
dead. This causes the next hop of IPv6 destination pointing
an obsolete neighbour/L2 cache, causing IP packget drops or
packets sent out with wrong L2 source address.

Signed-off-by: Kazuhiro Ondo <kazuhiro.ondo@motorola.com>
bridge: notifier called with the wrong device

If a new device is added to a bridge, the ethernet address of the
bridge network device may change. When the address changes, the
appropriate callback is called, but with the wrong device argument.
The address of the bridge device (ie br0) changes not the address
of the device being passed to add_if (ie eth0).

Change-Id: Idf106c889f34e06e2d47462dd883f30caad26eb8
Original-author: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
bridge: Always send NETDEV_CHANGEADDR up on br MAC change.

This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.

This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.

This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.

This builds on Stephen Hemminger's patch, also handling the br_del_if
case, port MAC change case, and bridge MAC manual assignment case.

Change-Id: I6039ba021006f854e0e7e83dd1c4261c500aeab7
Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
net: wireless: bcmdhd: Report proper mcs rate mask

Setting proper mcs rate mask allows to connect in 802.11n-only mode

Change-Id: Iffd47a60c92a74d29e42d81d79fa64463f5895c5
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Merge remote-tracking branch 'gs-tegra/android-tegra-moto-2.6.39-jb-mr0' into new-moto

* gs-tegra/android-tegra-moto-2.6.39-jb-mr0:
  net: wireless: bcmdhd: Report proper mcs rate mask
  bridge: Always send NETDEV_CHANGEADDR up on br MAC change.
  bridge: notifier called with the wrong device
  net: ipv6: ip6_fib.c: Flush dead neighbour and L2 cache on GC
  USB: gadget: f_audio_source: Fix use after free in audio_unbind
  USB: gadget: f_audio_source: Fix error handling and increase packet size

Conflicts:
	drivers/net/wireless/bcmdhd/wl_cfg80211.c

Change-Id: Ib6ecb72a034e91299254167ccc51b0b150d47896
staging: android: lowmemkiller: RESET file to commit f862b627
("Substantially reduce overhead during reclaim")

This is the common path between the Moto Official LMK version and
the improved one in the 3.4+ kernels. From here I can then cleanly
merge up to that kernel's commits.

Change-Id: I353cb227d30c1b41692e8d8598994cbfedcd33e6
staging: android: lowmemorykiller: Remove bitrotted codepath

Now that we're murder-synchronous, this code path will never be
called (and if it does, it doesn't tell us anything useful other
than we killed a task that was already being killed by somebody
else but hadn't gotten its' signal yet)

Signed-off-by: San Mehat <san@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
(cherry picked from commit eb943f6be011b33455b767880e13c34a2bb96a5e)

Change-Id: I1ae785d261e4ce206da543bc9d8ff32d5124d2b7
staging: android: lowmemorykiller: Update arguments of shrinker for 2.6.35

Signed-off-by: Colin Cross <ccross@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
(cherry picked from commit 06a1074e1c789a777732f8c432d913b0fedb8ff5)

Conflicts:

	drivers/staging/android/lowmemorykiller.c

Change-Id: I3533cdc0c5bba774d445fc3a0442c3cd57e32d37
staging: android: lowmemorykiller: Ignore shmem pages in page-cache

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
(cherry picked from commit 71b2c82bdf67ab24716c536e10de436169d3574c)

Change-Id: I7bac09e40c7bc95c95bce0029bbbbbdd486f9f0a
android: lowmemorykiller: Fix arguments to lowmem_shrink

The arguments to shrink functions have changed, update
lowmem_shrink to match.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
(cherry picked from commit cae9bf11ef0d92875b222f994a2cfd723991435a)

Conflicts:

	drivers/staging/android/lowmemorykiller.c

Change-Id: I44341bdb37346ebb0c411e29a24308179cb287d3
Staging: android: fixed 80 characters warnings in lowmemorykiller.c

This patch fixes some 80 chatacters limit warnings in the lowmemorykiller.c file

Signed-off-by: Marco Navarra <fromenglish@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
(cherry picked from commit 3bf5d65f4324510231cf33e5d75654f4fb1d1892)
staging: android: lowmemorykiller: Don't wait more than one second for a process to die

If a process forked and the child process was killed by the
lowmemorykiller, the lowmemory killer would be disabled until
the parent process reaped the child or it died itself.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e5d7965f88a3755b2d0c54768a17032ab3a72819)

Change-Id: Icfd56fbffaf0c14a32fa9c6542127ca8b2fbb5ef
staging: android/lowmemorykiller: Don't grab tasklist_lock

Grabbing tasklist_lock has its disadvantages, i.e. it blocks
process creation and destruction. If there are lots of processes,
blocking doesn't sound as a great idea.

For LMK, it is sufficient to surround tasks list traverse with
rcu_read_{,un}lock().

>From now on using force_sig() is not safe, as it can race with an
already exiting task, so we use send_sig() now. As a downside, it
won't kill PID namespace init processes, but that's not what we
want anyway.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 294b27119f2e20643e71a0c1a1b511320a11e4c3)
staging: android/lowmemorykiller: Better mm handling

LMK should not directly check for task->mm. The reason is that the
process' threads may exit or detach its mm via use_mm(), but other
threads may still have a valid mm. To catch this we use
find_lock_task_mm(), which walks up all threads and returns an
appropriate task (with lock held).

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 95670001188911f9d466875cd68e3681f39df38a)
staging: android/lowmemorykiller: No need for task->signal check

task->signal == NULL is not possible, so no need for these checks.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 353416099128914a684e8bb81e7475d8c2961cc3)
staging: android/lowmemorykiller: Do not kill kernel threads

LMK should not try killing kernel threads.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9823ec9ded836ee7ca4fe5ab7964b9cdc8af010c)
staging: android, lowmemorykiller: convert to use oom_score_adj

/proc/pid/oom_adj is deprecated and will be removed in August 2012
according to Documentation/feature-removal-schedule.txt.  Convert its
usage in the lowmemorykiller to use the new interface, oom_score_adj,
instead.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 940f77b07f85a4211fb149d6316a3cbd84d7227d)
staging: android/lowmemorykiller: Don't unregister notifier from atomic context

The lowmemorykiller registers an atomic notifier for notfication of when
the task is freed.  From this atomic notifier callback, it removes the
atomic notifier via task_free_unregister().  This is incorrect because
atomic_notifier_chain_unregister() calls syncronize_rcu(), which can
sleep, which shouldn't be done from an atomic notifier.

Fix this by registering the notifier during init, and only unregister it
if the lowmemorykiller is unloaded.

Rebased to -next by Paul E. McKenney.
Rebased to -next again by Anton Vorontsov.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1eda5166c7640092f512138be6899d050c3d62ed)