ext4: fix memory leak in xattr - From AK-xGenesis Kernel

ext4: fix memory leak in xattr
If we take the 2nd retry path in ext4_expand_extra_isize_ea, we
potentionally return from the function without having freed these
allocations.  If we don't do the return, we over-write the previous
allocation pointers, so we leak either way.

Spotted with Coverity.

[ Fixed by tytso to set is and bs to NULL after freeing these
pointers, in case in the retry loop we later end up triggering an
error causing a jump to cleanup, at which point we could have a double
free bug. -- Ted ]

Change-Id: I49b8ca41a6c6d44b563eb23306870258a3affd3b
Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Cc: stable@vger.kernel.org
Git-commit: 6e4ea8e
Git-repo:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
ext4: speed up truncate/unlink by not using bforget() unless needed - From AK-xGenesis

Do not iterate over data blocks scanning for bh's to forget as they're
never exist. This improves time taken by unlink / truncate syscall.
Tested by continuously truncating file that is being written by dd.
Another test is rm -rf of linux tree while tar unpacks it. With
ordered data mode condition unlikely(!tbh) was always met in
ext4_free_blocks. With journal data mode tbh was found only few times,
so optimisation is also possible.

Unlinking fallocated 60G file after doing sync && echo 3 >
/proc/sys/vm/drop_caches && time rm --help

X86 before (linux 3.6-rc4):
# time rm -f test1
real    0m2.710s
user    0m0.000s
sys     0m1.530s

X86 after:
# time rm -f test1
real    0m0.644s
user    0m0.003s
sys     0m0.060s

MIPS before (linux 2.6.37):
# time rm -f test1
real    0m 4.93s
user    0m 0.00s
sys     0m 4.61s

MIPS after:
# time rm -f test1
real    0m 0.16s
user    0m 0.00s
sys     0m 0.06s

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrey Sidorov <qrxd43@motorola.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ALSA: usb-audio: Fix the mixer control range limiting issue - From AK-xGenesis Kernel

ALSA: usb-audio: Fix the mixer control range limiting issue
- mixer_ctl_set() function is limiting the volume level
to particular range. This results in incorrect initial
volume setting for that device.
- In USB mixer while calculating the dBmin/dBmax values
resolution factor is hardcoded to 256 which results in
populating the wrong values for dBmin/dBmax.
- Fix is to use appropriate resolution factor while
calculating the dBmin/dBmax values.

CRs-Fixed: 515012
Prev-Change-Id: I502355af66f850bb65380c27333c3341fa43a947
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>

Change-Id: I79c14014ad6828a802f6978b796d8a4a91c87e46
board-j1-gpu: Fix 544MHz's bus_freq to 5 from 6

In acpuclock-8064.c

[5] = BW_MBPS(4264), /* At least 533 MHz on bus. */
[6] = BW_MBPS(4660), /* At least 583 MHz on bus. */

So I changed to 5 from 6
e975_defconfig: Enable kexec hardboot by default
sound: Faux Sound: Update to 3.2 - From MikeEx kernel_msm
Latest Bundi iPhone 5 preset - From MikeEx kernel_msm
input: touchscreen: d2w: Increase recognizing time
input: touchscreen: s2w: Fix power key duratioin time
fs: Add dynamic_fsync by faux123 - From MikeEx kernel_msm
fs/sync: Make sync() satisfy many requests with one invocation - From MikeEx kernel_msm

Dave Jones reported RCU stalls, overly long hrtimer interrupts, and
amazingly long NMI handlers from a trinity-induced workload involving
lots of concurrent sync() calls (https://lkml.org/lkml/2013/7/23/369).
There are any number of things that one might do to make sync() behave
better under high levels of contention, but it is also the case that
multiple concurrent sync() system calls can be satisfied by a single
sys_sync() invocation.

Given that this situation is reminiscent of rcu_barrier(), this commit
applies the rcu_barrier() approach to sys_sync().  This approach uses
a global mutex and a sequence counter.  The mutex is held across the
sync() operation, which eliminates contention between concurrent sync()
operations.  The counter is incremented at the beginning and end of
each sync() operation, so that it is odd while a sync() operation is in
progress and even otherwise, just like sequence locks.

The code that used to be in sys_sync() is now in do_sync(), and
sys_sync()
now handles the concurrency.  The sys_sync() function first takes a
snapshot of the counter, then acquires the mutex, and then takes another
snapshot of the counter.  If the values of the two snapshots indicate
that
a full do_sync() executed during the mutex acquisition, the sys_sync()
function releases the mutex and returns ("Our work is done!").
Otherwise,
sys_sync() increments the counter, invokes do_sync(), and increments
the counter again.

This approach allows a single call to do_sync() to satisfy an
arbitrarily
large number of sync() system calls, which should eliminate issues due
to large numbers of concurrent invocations of the sync() system call.

Changes since v1 (https://lkml.org/lkml/2013/7/24/683):

o Add a pair of memory barriers to keep the increments from
bleeding into the do_sync() code.  (The failure probability
is insanely low, but when you have several hundred million
devices running Linux, you can expect several hundred instances
of one-in-a-million failures.)

o Actually CC some people who have experience in this area.

Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Cc: Curt Wohlgemuth <curtw@google.com>
Cc: Jens Axboe <jaxboe@fusionio.com>
Cc: linux-fsdevel@vger.kernel.org

Signed-off-by: Paul Reioux <reioux@gmail.com>
Battery Life eXtender (BLX) - From MikeEx kernel_msm

This is a simple port of Ezekeel's BLX mod to the Nexus 4.

See this thread for more information:
http://forum.xda-developers.com/showthread.php?t=1257497

Let's keep the same sysfs implementation so that apps, such as Trickster
MOD, can support this.
touchscreen: tweak some initialization parameters for better UI response - From MikeEx kernel_msm

Signed-off-by: faux123 <reioux@gmail.com>

faux123 authored on 5 Dec 2012
mathkid95 committed on 30 Nov 2013
prima: release v3.2.3.2 - From MikeEx kernel_msm

This drop includes the gCfgEntry cherry-pick

git://codeaurora.org/external/wlan/prima.git

069ea26 prima: check for gCfgEntry being NULL
893da90 wlan : Revision 3.2.3.2
680abeb wlan: Enable TDLS for the drivers build as part of the kernel
dd16d53 wlan: update sched_scan_results after cfg80211 resumed
f6999ad wlan: Return success while stoping sched scan.
969abac wlan: wiphy->bands[] can be null.
e688ce3 wlan: GO should not follow STA channel if channel is passive.
ae2bb79 wlan:Block WiFi Direct GO mode on UNII-1 Band.
ab378f7 wlan: set appropriate flags for wiphy device based on current
regdomain
2692073 wlan: Revision 3.2.3.1
f464d79 wlan: Update value of WLAN_HAL_PNO_MAX_NETW_CHANNELS
fb72387 wlan: Update SME scan cache with PNO candidate information.
da3fd7c wlan: Update definition of tPrefNetwFoundParams.
571c5e9 Porting prima source from 2.6
4990d1c Wlan: Release 3.2.2.17B
d6b217f wlan: DTIM3 changed to DTIM1 after roaming
f83a6cd Wlan: Release 3.2.2.17A
2f45a43 Fix for "crash in pMac->cfg.gCfgEntry"
c8faf30 wlan: Change regulatory followed customer request
82e75bf wlan: Add msecs_to_jiffies() to wake lock argument
f1bb518 Revert "wlan: Release 3.2.2.18"
a65fc60 Revert "wlan: Set the country code in cfg before creating
channel list."
d235ff4 Revert "wlan: Release 3.2.2.19"
2742bc2 Revert "wlan: Decrease SAP timeout from 100 to 10 seconds"
768b6f5 Revert "wlan: Change RX wakelock to 50 milliseconds"
4edbdc7 Revert "wlan: Fix for spectrum management bit in AddBss for SM
disabled AP"
2b46b25 Revert "wlan: Release 3.2.2.20"
0647d89 wlan: Release 3.2.2.20
e1c76a3 wlan: Fix for spectrum management bit in AddBss for SM disabled
AP
b8493a3 wlan: Change RX wakelock to 50 milliseconds
476a501 wlan: Decrease SAP timeout from 100 to 10 seconds
c883f13 wlan: Release 3.2.2.19
4dbdab2 wlan: Set the country code in cfg before creating channel list.
7cabdd8 wlan: Release 3.2.2.18

Signed-off-by: Iliyan Malchev <malchev@google.com>