usb: gadget: Add support for enabling DIAG in more than one configuration

This change adds a support for multiple DIAG USB instances.
This is required to support USB compositions which have
several USB configurations, such that the DIAG can be included in
more than one configuration.

Change-Id: I0939e95ed3c4315c36c73899557c560594c32498
CRs-Fixed: 437963
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Merge "usb: gadget: Add support for enabling DIAG in more than one configuration"
net: more accurate skb truesize

skb truesize currently accounts for sk_buff struct and part of skb head.
kmalloc() roundings are also ignored.

Considering that skb_shared_info is larger than sk_buff, its time to
take it into account for better memory accounting.

This patch introduces SKB_TRUESIZE(X) macro to centralize various
assumptions into a single place.

At skb alloc phase, we put skb_shared_info struct at the exact end of
skb head, to allow a better use of memory (lowering number of
reallocations), since kmalloc() gives us power-of-two memory blocks.

Unless SLUB/SLUB debug is active, both skb->head and skb_shared_info are
aligned to cache lines, as before.

Note: This patch might trigger performance regressions because of
misconfigured protocol stacks, hitting per socket or global memory
limits that were previously not reached. But its a necessary step for a
more accurate memory accounting.

CRs-Fixed: 441477
Change-Id: I3e566ada529403d6612ce1a7ae7da280e053265e
Acked by: Manish Poddar <mpoddar@qti.qualcomm.com>
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Andi Kleen <ak@linux.intel.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net: Add back alignment for size for __alloc_skb

Commit 87fb4b7b533073eeeaed0b6bf7c2328995f6c075 (net: more
accurate skb truesize) changed the alignment of size. This
can cause problems at least on some machines with NFS root:

Unhandled fault: alignment exception (0x801) at 0xc183a43a
Internal error: : 801 [#1] PREEMPT
Modules linked in:
CPU: 0    Not tainted  (3.1.0-08784-g5eeee4a #733)
pc : [<c02fbba0>]    lr : [<c02fbb9c>]    psr: 60000013
sp : c180fef8  ip : 00000000  fp : c181f580
r10: 00000000  r9 : c044b28c  r8 : 00000001
r7 : c183a3a0  r6 : c1835be0  r5 : c183a412  r4 : 000001f2
r3 : 00000000  r2 : 00000000  r1 : ffffffe6  r0 : c183a43a
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 0005317f  Table: 10004000  DAC: 00000017
Process swapper (pid: 1, stack limit = 0xc180e270)
Stack: (0xc180fef8 to 0xc1810000)
fee0:                                                       00000024 00000000
ff00: 00000000 c183b9c0 c183b8e0 c044b28c c0507ccc c019dfc4 c180ff2c c0503cf8
ff20: c180ff4c c180ff4c 00000000 c1835420 c182c740 c18349c0 c05233c0 00000000
ff40: 00000000 c00e6bb8 c180e000 00000000 c04dd82c c0507e7c c050cc18 c183b9c0
ff60: c05233c0 00000000 00000000 c01f34f4 c0430d70 c019d364 c04dd898 c04dd898
ff80: c04dd82c c0507e7c c180e000 00000000 c04c584c c01f4918 c04dd898 c04dd82c
ffa0: c04ddd28 c180e000 00000000 c0008758 c181fa60 3231d82c 00000037 00000000
ffc0: 00000000 c04dd898 c04dd82c c04ddd28 00000013 00000000 00000000 00000000
ffe0: 00000000 c04b2224 00000000 c04b21a0 c001056c c001056c 00000000 00000000
Function entered at [<c02fbba0>] from [<c019dfc4>]
Function entered at [<c019dfc4>] from [<c01f34f4>]
Function entered at [<c01f34f4>] from [<c01f4918>]
Function entered at [<c01f4918>] from [<c0008758>]
Function entered at [<c0008758>] from [<c04b2224>]
Function entered at [<c04b2224>] from [<c001056c>]
Code: e1a00005 e3a01028 ebfa7cb0 e35a0000 (e5858028)

Here PC is at __alloc_skb and &shinfo->dataref is unaligned because
skb->end can be unaligned without this patch.

As explained by Eric Dumazet <eric.dumazet@gmail.com>, this happens
only with SLOB, and not with SLAB or SLUB:

* Eric Dumazet <eric.dumazet@gmail.com> [111102 15:56]:
>
> Your patch is absolutely needed, I completely forgot about SLOB :(
>
> since, kmalloc(386) on SLOB gives exactly ksize=386 bytes, not nearest
> power of two.
>
> [   60.305763] malloc(size=385)->ffff880112c11e38 ksize=386 -> nsize=2
> [   60.305921] malloc(size=385)->ffff88007c92ce28 ksize=386 -> nsize=2
> [   60.306898] malloc(size=656)->ffff88007c44ad28 ksize=656 -> nsize=272
> [   60.325385] malloc(size=656)->ffff88007c575868 ksize=656 -> nsize=272
> [   60.325531] malloc(size=656)->ffff88011c777230 ksize=656 -> nsize=272
> [   60.325701] malloc(size=656)->ffff880114011008 ksize=656 -> nsize=272
> [   60.346716] malloc(size=385)->ffff880114142008 ksize=386 -> nsize=2
> [   60.346900] malloc(size=385)->ffff88011c777690 ksize=386 -> nsize=2

CRs-Fixed: 441477
Change-Id: I3124f2e26920701d8c0a29a678b91f39bd74dc20
Acked by: Manish Poddar <mpoddar@qti.qualcomm.com>
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ASoC: msm: Add voice host pcm feature

Voice host pcm feature allows userspace to tap out and inject
PCM samples into the voice topology using shared memory.
Add Front end driver to read and write voice data from voice
module in DSP.

Change-Id: Ic90524c40749d264f655efb7d0c7a8d90ebfd898
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
msm: 9615: Add platform data for voice host pcm

Voice host pcm feature allows userspace to tap out and inject
PCM samples into the voice topology using shared memory.
Add platform data for voice host pcm.

Change-Id: If47c25b4eefc5d93218cf81092854e04951fa17d
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
ASoC: msm: Add voice host pcm dais to the machine driver

Voice host pcm feature allows userspace to tap out and inject
PCM samples into the voice topology using shared memory.
Add the voice host pcm playback and capture dais for both
TX and RX dai links in the machine driver.

Change-Id: I0d9666fa8ecf06f03ca023fffb1770602f7f011b
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
msm_fb: wfd: power off overlay 2 block on overlay2 done

Need to call mdp_pipe_ctrl with overlay 2 block off on overlay2
done otherwise the clocks will never go off on suspend.

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
(cherry picked from commit ccfc8d2e0c3839197fa28490d0c05d8c310f1b31)

Change-Id: I6ad402d3b48653f6a85fa9854a8047a9adc04d8b
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Merge "msm_fb: wfd: power off overlay 2 block on overlay2 done"
kernel/sys.c: fix stack memory content leak via UNAME26

Calling uname() with the UNAME26 personality set allows a leak of kernel
stack contents.  This fixes it by defensively calculating the length of
copy_to_user() call, making the len argument unsigned, and initializing
the stack buffer to zero (now technically unneeded, but hey, overkill).

CVE-2012-0957

Reported-by: PaX Team <pageexec@freemail.hu>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: PaX Team <pageexec@freemail.hu>
Cc: Brad Spengler <spender@grsecurity.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Change-Id: Ib0a6cb461986eae3eebc15156969762f670ffe9b
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Merge "net: more accurate skb truesize"
Merge "net: Add back alignment for size for __alloc_skb"
Merge "ASoC: msm: Add voice host pcm feature"
Merge "msm: 9615: Add platform data for voice host pcm"
Merge "ASoC: msm: Add voice host pcm dais to the machine driver"
Merge "kernel/sys.c: fix stack memory content leak via UNAME26"
ASoC: msm: Add mixer command to disable cvp postprocessing

Voice host pcm allows tapping RX and TX data from voice modules
in DSP which allows userspace to apply post processing on this data.
Add mixer command in voice driver to disable DSP's post processing.

Change-Id: Ib170fe3b4c65c28bed46f3b83f3bfc938b13fc12
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
Merge "ASoC: msm: Add mixer command to disable cvp postprocessing"
mfd: pm8xxx-spk: Fix settings for the class D audio amplifier

Test results based on noise gate recommended the following settings

0x254=0xC8 (Threshold=110, preamp bias=01)
0x255=0xC1 (Hold=110, max attn=0000, mute=1)
0x256=0xB0 (decay=101, attack=10, delay=0)

(cherry picked from commit 59442e223dcd616d7a244c85d8e0acccf4df9651)

Change-Id: If37ed46904ab1aa6a78fc410336f3bf780ee6249
CRs-Fixed: 385187
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
msm: board-8930-pmic: Disable pmic noise gate.

The noise gate is resulting in intermittent audio issue,
hence disable it.

(cherry picked from commit 53c87b04d0282af18fa57b1d99d2b6b13149b3e4)

Change-Id: I333f1045541fdb08bc1cfbf389012f3920d1889d
CRs-Fixed: 428933
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>