2 years agoPepper: Spotfix for write silence
David DSH [Fri, 18 Nov 2016 18:28:49 +0000]
Pepper: Spotfix for write silence

Have the timer grab the lock to prevent task accessing the pcm_buffer to
get bad pointer.

Bug 1842498

Change-Id: I7f9691ceceeb8e7bb8dc00bd68617b91c4275c30
Signed-off-by: David DSH <ddastoussthi@nvidia.com>
Reviewed-on: http://git-master/r/1256442
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agohid: jarvis: remove the sound card limit
Siddardha Naraharisetti [Tue, 15 Nov 2016 07:43:20 +0000]
hid: jarvis: remove the sound card limit

Remove the limit of 5 sound cards in driver.

Bug 1821999

Change-Id: I47ee126b3bf179902cdab4fd6faa1baaafa0117e
Signed-off-by: Siddardha Naraharisetti <siddardhan@nvidia.com>
Reviewed-on: http://git-master/r/1253331
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoCompilation of 3.10 kernel with GCC-6.1
Sujeet Baranwal [Thu, 10 Nov 2016 19:14:45 +0000]
Compilation of 3.10 kernel with GCC-6.1

All necessary chnages made all across kernel to make the
build go thru with GCC 6.1

Bug 1838484

Change-Id: Ie9eb1aecd6847df689a99abd6ea8651309db4e57
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242348
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoAlignment correction
Sujeet Baranwal [Thu, 10 Nov 2016 18:30:20 +0000]
Alignment correction

GCC-6.1 fails to build these files because of alignement errors.
Files modified accordingly.

Bug 1838484

Change-Id: Ie493dfbea195f7f756227b8e4fa355b6a011fd82
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1251327
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoAdd sancov plugin
Emese Revfy [Wed, 9 Nov 2016 17:59:44 +0000]
Add sancov plugin

The sancov gcc plugin inserts a __sanitizer_cov_trace_pc() call
at the start of basic blocks.

This plugin is a helper plugin for the kcov feature. It supports
all gcc versions with plugin support (from gcc-4.5 on).
It is based on the gcc commit "Add fuzzing coverage support" by Dmitry Vyukov
(https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=revision&revision=231296).

Signed-off-by: Emese Revfy <re.emese@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michal Marek <mmarek@suse.com>

Conflicts:
Makefile
arch/Kconfig
scripts/Makefile.gcc-plugins
scripts/gcc-plugins/Makefile

Bug 1838484

Change-Id: I590c06bdc07146a36e8d68c92151da7e7a647652
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1250558
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoGCC plugin infrastructure
Emese Revfy [Thu, 20 Oct 2016 22:16:16 +0000]
GCC plugin infrastructure

This patch allows to build the whole kernel with GCC plugins. It was ported from
grsecurity/PaX. The infrastructure supports building out-of-tree modules and
building in a separate directory. Cross-compilation is supported too.
Currently the x86, arm, arm64 and uml architectures enable plugins.
The directory of the gcc plugins is scripts/gcc-plugins. You can use a file or a directory
there. The plugins compile with these options:
 * -fno-rtti: gcc is compiled with this option so the plugins must use it too
 * -fno-exceptions: this is inherited from gcc too
 * -fasynchronous-unwind-tables: this is inherited from gcc too
 * -ggdb: it is useful for debugging a plugin (better backtrace on internal
    errors)
 * -Wno-narrowing: to suppress warnings from gcc headers (ipa-utils.h)
 * -Wno-unused-variable: to suppress warnings from gcc headers (gcc_version
    variable, plugin-version.h)
The infrastructure introduces a new Makefile target called gcc-plugins. It
supports all gcc versions from 4.5 to 6.0. The scripts/gcc-plugin.sh script
chooses the proper host compiler (gcc-4.7 can be built by either gcc or g++).
This script also checks the availability of the included headers in
scripts/gcc-plugins/gcc-common.h.
The gcc-common.h header contains frequently included headers for GCC plugins
and it has a compatibility layer for the supported gcc versions.
The gcc-generate-*-pass.h headers automatically generate the registration
structures for GIMPLE, SIMPLE_IPA, IPA and RTL passes.
Note that 'make clean' keeps the *.so files (only the distclean or mrproper
targets clean all) because they are needed for out-of-tree modules.
Based on work created by the PaX Team.
Signed-off-by: Emese Revfy <re.emese@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michal Marek <mmarek@suse.com>
Conflicts:
Makefile

Bug 1838484

Change-Id: I576d5ff30576449d9947489d45aff4fd79d10129
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242346
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agokcov: add AFL-style tracing
Quentin Casasnovas [Thu, 20 Oct 2016 20:57:41 +0000]
kcov: add AFL-style tracing

AFL uses a fixed-size buffer (typically 64 KiB) where each byte is
a counter representing how many times an A -> B branch was taken.
Of course, since the buffer is fixed size, it's a little imprecise
in that e.g. two different branches could map to the same counter,
but in practice it works well.
See afl:docs/technical_details.txt for more information.
Here is a small test program that demonstrates the new capability:
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <errno.h>
#include <error.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/types.h>
#define KCOV_INIT_TRACE                 _IOR('c', 1, unsigned long)
#define KCOV_INIT_AFL                   _IOR('c', 2, unsigned long)
#define KCOV_ENABLE                     _IO('c', 100)
#define KCOV_DISABLE                    _IO('c', 101)
int main(int argc, char *argv[])
{
int fd = open("/sys/kernel/debug/kcov", O_RDWR);
if (fd == -1)
error(1, errno, "open()");
unsigned long size = 1 << 10;
if (ioctl(fd, KCOV_INIT_AFL, size) != 0)
error(1, errno, "ioctl(KCOV_INIT_AFL)");
void *mem = mmap(NULL, size * sizeof(long), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (mem == MAP_FAILED)
error(1, errno, "mmap()");
/* Start kernel instrumentation */
if (ioctl(fd, KCOV_ENABLE, 0) != 0)
error(1, errno, "ioctl(KCOV_ENABLE)");
printf("Hello world!\n");
/* End kernel instrumentation*/
if (ioctl(fd, KCOV_DISABLE, 0) != 0)
error(1, errno, "ioctl(KCOV_DISABLE)");
/* Hex dump of memory area */
unsigned char *mem2 = mem;
for (unsigned int i = 0; i < size; ++i) {
printf("%02x ", mem2[i]);
if (i % 32 == 31)
printf("\n");
}
close(fd);
return 0;
}
This patch is a collaboration between Quentin Casasnovas and Vegard Nossum.

Bug 1838484

Change-Id: I5c7f98386857eb5fca9689ee2e0d2126bd0456ea
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Michal Zalewski <lcamtuf@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242345
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agokcov: allow more fine-grained coverage instrumentation
Vegard Nossum [Thu, 20 Oct 2016 20:47:50 +0000]
kcov: allow more fine-grained coverage instrumentation

For more targeted fuzzing, it's better to disable kernel-wide
instrumentation and instead enable it on a per-subsystem basis. This
follows the pattern of UBSAN and allows you to compile in the kcov driver
without instrumenting the whole kernel.
To instrument a part of the kernel, you can use either
    # for a single file in the current directory
    KCOV_INSTRUMENT_filename.o := y
or
    # for all the files in the current directory (excluding subdirectories)
    KCOV_INSTRUMENT := y
or
    # (same as above)
    ccflags-y += $(CFLAGS_KCOV)
or
    # for all the files in the current directory (including subdirectories)
    subdir-ccflags-y += $(CFLAGS_KCOV)

Bug 1838484

Change-Id: I2ecd3cdcaaae7a9b2f285b1b048bc03ae4686d38
Link: http://lkml.kernel.org/r/1464008380-11405-1-git-send-email-vegard.nossum@oracle.com
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242344
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoarm64: allow building with kcov coverage on ARM64
Alexander Potapenko [Wed, 19 Oct 2016 23:03:26 +0000]
arm64: allow building with kcov coverage on ARM64

Add ARCH_HAS_KCOV to ARM64 config. To avoid potential crashes, disable
instrumentation of the files in arch/arm64/kvm/hyp/*.

Signed-off-by: Alexander Potapenko <glider@google.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Tested-by: James Morse <james.morse@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug 1838484

Change-Id: I83e7810cfdbe842b31e128b177b037fb5275fb4a
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242343
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User

2 years agokcov: don't profile branches in kcov
Andrey Ryabinin [Wed, 19 Oct 2016 23:02:03 +0000]
kcov: don't profile branches in kcov

Profiling 'if' statements in __sanitizer_cov_trace_pc() leads
to unbound recursion and crash:
__sanitizer_cov_trace_pc() ->
ftrace_likely_update ->
__sanitizer_cov_trace_pc() ...

Define DISABLE_BRANCH_PROFILING to disable this tracer.

Bug 1838484

Change-Id: I8384d520f2616871183cecd5f2ace463478f675f
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242342
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agokcov: don't trace the code coverage code
James Morse [Wed, 19 Oct 2016 23:00:46 +0000]
kcov: don't trace the code coverage code

Kcov causes the compiler to add a call to __sanitizer_cov_trace_pc() in
every basic block. Ftrace patches in a call to _mcount() to each function
it has annotated.

Letting these mechanisms annotate each other is a bad thing. Break the loop
by adding 'notrace' to __sanitizer_cov_trace_pc() so that ftrace won't try
to patch this code.

This patch lets arm64 with KCOV and STACK_TRACER boot.

Bug 1838484

Change-Id: Iddb322e4dcab7986413ab8af5be37c1fb1db04d2
Signed-off-by: James Morse <james.morse@arm.com>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242341
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agokernel: add kcov code coverage
Dmitry Vyukov [Wed, 19 Oct 2016 21:37:22 +0000]
kernel: add kcov code coverage

kcov provides code coverage collection for coverage-guided fuzzing
(randomized testing).  Coverage-guided fuzzing is a testing technique
that uses coverage feedback to determine new interesting inputs to a
system.  A notable user-space example is AFL
(http://lcamtuf.coredump.cx/afl/).  However, this technique is not
widely used for kernel testing due to missing compiler and kernel
support.
kcov does not aim to collect as much coverage as possible.  It aims to
collect more or less stable coverage that is function of syscall inputs.
To achieve this goal it does not collect coverage in soft/hard
interrupts and instrumentation of some inherently non-deterministic or
non-interesting parts of kernel is disbled (e.g.  scheduler, locking).
Currently there is a single coverage collection mode (tracing), but the
API anticipates additional collection modes.  Initially I also
implemented a second mode which exposes coverage in a fixed-size hash
table of counters (what Quentin used in his original patch).  I've
dropped the second mode for simplicity.
This patch adds the necessary support on kernel side.  The complimentary
compiler support was added in gcc revision 231296.
We've used this support to build syzkaller system call fuzzer, which has
found 90 kernel bugs in just 2 months:
  https://github.com/google/syzkaller/wiki/Found-Bugs
We've also found 30+ bugs in our internal systems with syzkaller.
Another (yet unexplored) direction where kcov coverage would greatly
help is more traditional "blob mutation".  For example, mounting a
random blob as a filesystem, or receiving a random blob over wire.
Why not gcov.  Typical fuzzing loop looks as follows: (1) reset
coverage, (2) execute a bit of code, (3) collect coverage, repeat.  A
typical coverage can be just a dozen of basic blocks (e.g.  an invalid
input).  In such context gcov becomes prohibitively expensive as
reset/collect coverage steps depend on total number of basic
blocks/edges in program (in case of kernel it is about 2M).  Cost of
kcov depends only on number of executed basic blocks/edges.  On top of
that, kernel requires per-thread coverage because there are always
background threads and unrelated processes that also produce coverage.
With inlined gcov instrumentation per-thread coverage is not possible.
kcov exposes kernel PCs and control flow to user-space which is
insecure.  But debugfs should not be mapped as user accessible.
Based on a patch by Quentin Casasnovas.
[akpm@linux-foundation.org: make task_struct.kcov_mode have type `enum kcov_mode']
[akpm@linux-foundation.org: unbreak allmodconfig]
[akpm@linux-foundation.org: follow x86 Makefile layout standards]
Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: syzkaller <syzkaller@googlegroups.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Tavis Ormandy <taviso@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Kees Cook <keescook@google.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: David Drysdale <drysdale@google.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Conflicts:
Makefile
lib/Kconfig.debug
mm/kasan/Makefile
scripts/Makefile.lib
kernel/Makefile

Bug 1838484

Change-Id: I3c2c66e5f431f5bfe1cb7cba4209614e60578613
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/1242340
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoPCI/ASPM: fix un-initialized variable access
Vidya Sagar [Tue, 30 Aug 2016 12:29:36 +0000]
PCI/ASPM: fix un-initialized variable access

fixes un-initialized structure variable access by
memsetting it to zero

Bug 200219196

Change-Id: I6b927e374038e3b3d349cf8330dc1215ceb7b9f0
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Reviewed-on: http://git-master/r/1215383
(cherry picked from commit b70ad37fb59b347eeb0289e44a8b109375014633)
Reviewed-on: http://git-master/r/1257028
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>

2 years agopcie: host: tegra: use GFP_DMA32 for MSI mem alloc
Vidya Sagar [Tue, 27 Sep 2016 13:03:03 +0000]
pcie: host: tegra: use GFP_DMA32 for MSI mem alloc

uses GFP_DMA32 instead of GFP_KERNEL while allocating
memory to be given to PCIe end points to issue write
transactions to generate MSI interrupts.
This fixes issues with PCIe end points that are capable
of generating writes to only 32-bit addresses for generating
MSI interrupts

Bug 200234273

Change-Id: I269cb5c55bcac20fd14deb2311067e8a1f58c49b
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Reviewed-on: http://git-master/r/1227735
(cherry picked from commit 11b39e38141e2b862ed79b9b414e0412e0e0e2f4)
Reviewed-on: http://git-master/r/1257027
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>

2 years agoarm64: dma-mapping: fix invalid page count check
Vidya Sagar [Mon, 2 May 2016 07:39:09 +0000]
arm64: dma-mapping: fix invalid page count check

Fix the false assertion caused by invalid page count check.

Bug 200178753
Bug 1823434

Change-Id: Ib100714ab54ff08ca0ee6bf63f45a5c00e46ce77
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Reviewed-on: http://git-master/r/1139581
(cherry picked from commit 27cc6b3e8262c3c91f27f242d62d1f904b3cebc4)
Reviewed-on: http://git-master/r/1235015
(cherry picked from commit 6d534cac2e328300d19c8d9be0d8fa8265e00841)
Reviewed-on: http://git-master/r/1243046
(cherry picked from commit f796a417a64212c388223f8fb1de858ba120f65d)
Reviewed-on: http://git-master/r/1257024
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>

2 years ago[media] uvcvideo: improve urb buffer allocation
Henry Lin [Wed, 21 Sep 2016 16:02:03 +0000]
[media] uvcvideo: improve urb buffer allocation

Some UVC device (e.g. StereoLabs ZED camera) may have strict timing
requirement for transferring video payload. This change improves URB
buffer allocation for UVC device with bulk VideoStreaming interface. The
criteria for buffer allocation are:
- Let an URB able to receive a complete UVC payload
- Prepare and submit URBs for a complete video frame

If system memory is large enough, URB buffers will consume memory size
up to a complete video frame.

Bug 1674178

Change-Id: If5f366582ee1c1cb559e890176d74484634dccef
Signed-off-by: Henry Lin <henryl@nvidia.com>
Reviewed-on: http://git-master/r/1225266
Reviewed-by: WK Tsai <wtsai@nvidia.com>
Reviewed-by: Hans Yang <hansy@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit
(cherry picked from commit 4797f84301fe6ff42313c688e72e4f7c0d52b2e6)
Reviewed-on: http://git-master/r/1239557
Reviewed-by: Peter Yu <pyu@nvidia.com>
Tested-by: Peter Yu <pyu@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoRT8168: Add power control sysfs knobs
David DSH [Wed, 16 Nov 2016 02:50:24 +0000]
RT8168: Add power control sysfs knobs

Add low power modes control knobs via sysfs

Bug 1828585

Change-Id: If9fbd678399c811177f4550f54ef7be88070b795
Signed-off-by: David DSH <ddastoussthi@nvidia.com>
Reviewed-on: http://git-master/r/1254366
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoT124 : platform : Enable CPUSETS
Somdutta Roy [Wed, 12 Oct 2016 18:16:41 +0000]
T124 : platform : Enable CPUSETS

- Enable CPUSETS in the T124 kernel
- Allow system UID (1000) to make changes in cgroups

boot.img size not changed

Bug 1792325

Change-Id: Ifcaf3d8ebfc97b257db5755d9dd54d0bcfd46ab5
Signed-off-by: Somdutta Roy <somduttar@nvidia.com>
Reviewed-on: http://git-master/r/1235435
Reviewed-by: Christopher Freeman <cfreeman@nvidia.com>
Reviewed-by: David Lock <dlock@nvidia.com>
Reviewed-by: Wen Yi <wyi@nvidia.com>
Reviewed-by: Mahesh Lagadapati <mlagadapati@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agovideo: tegra: host: check debuginfo for nvdec boot
Deepak Nibade [Mon, 3 Oct 2016 09:53:41 +0000]
video: tegra: host: check debuginfo for nvdec boot

After waiting for falcon idle, confirm successful nvdec boot
by reading nvdec_debuginfo_r()

If register reads 0, then booting is successful
Otherwise, its error

Bug 200237849
Jira HOSTX-118

Change-Id: Ibaf6a21baaa3b5c61b432c9ceac4ddf9af233ebc
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1230795
Reviewed-on: http://git-master/r/1242938
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agot210: tegra-fuse: add support to read UID
Shardar Shariff Md [Thu, 1 Sep 2016 09:12:20 +0000]
t210: tegra-fuse: add support to read UID

- Add support to read unique ID (UID), there is no one register
field to read UID, instead UID is constructed from various bits
of information burned into the fuses during the manufactoring
process.

UID is constructed to 64 bit as below from below UID register
<CID:4><VENDOR:4><FAB:6><LOT:26><WAFER:6><X:9><Y:9>

- rename tegra21x offset filename to tegra210

Bug 1803702

Change-Id: Ie14ab25e147d6668ab2a092305a0c62b7257279a
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com>
Reviewed-on: http://git-master/r/1218594
(cherry picked from commit d4b54be134a1c70ef00c4931bc48c2be29b7ed40)
Reviewed-on: http://git-master/r/1253246
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

2 years agobcmdhd_88: disable nv_logger logging by default
Bibhay Ranjan [Mon, 24 Oct 2016 08:36:13 +0000]
bcmdhd_88: disable nv_logger logging by default

Bug 200231321

Change-Id: Icb02bf96cf565fac493da0c68dee7967338e090f
Signed-off-by: Bibhay Ranjan <bibhayr@nvidia.com>
Reviewed-on: http://git-master/r/1235065
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Todd Poynter <tpoynter@nvidia.com>

2 years agoarm64: dts: HE: enable BL poweroff on red state
Yunfan Zhang [Mon, 14 Nov 2016 08:39:10 +0000]
arm64: dts: HE: enable BL poweroff on red state

- BL power off device when verified boot in RED state

Bug 200205420

Change-Id: I1a779e42b76352aa37275e8d8efa686cddd5b72c
Signed-off-by: Yunfan Zhang <yunfanz@nvidia.com>
Reviewed-on: http://git-master/r/1252601
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ian Chang <ianc@nvidia.com>
Tested-by: Ian Chang <ianc@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jay Bhukhanwala <jbhukhanwala@nvidia.com>
Reviewed-by: Robert Shih <rshih@nvidia.com>

2 years agommc: sd: change attribute speed_class to decimal
Harry Lin [Mon, 14 Nov 2016 05:53:40 +0000]
mmc: sd: change attribute speed_class to decimal

Change SD attribute /sys/block/mmcblk#/device/speed_class
from hexadecimal to decimal.

Bug 200245639

Change-Id: Iad3a7d709db405cbd0b73459ca8ed69856674543
Signed-off-by: Harry Lin <harlin@nvidia.com>
Reviewed-on: http://git-master/r/1252512
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>

2 years agoUPSTREAM: ASN.1: Fix non-match detection failure on data overrun
David Howells [Mon, 11 Jul 2016 21:18:11 +0000]
UPSTREAM: ASN.1: Fix non-match detection failure on data overrun

(cherry pick from commit 0d62e9dd6da45bbf0f33a8617afc5fe774c8f45f)

If the ASN.1 decoder is asked to parse a sequence of objects, non-optional
matches get skipped if there's no more data to be had rather than a
data-overrun error being reported.

This is due to the code segment that decides whether to skip optional
matches (ie. matches that could get ignored because an element is marked
OPTIONAL in the grammar) due to a lack of data also skips non-optional
elements if the data pointer has reached the end of the buffer.

This can be tested with the data decoder for the new RSA akcipher algorithm
that takes three non-optional integers.  Currently, it skips the last
integer if there is insufficient data.

Without the fix, #defining DEBUG in asn1_decoder.c will show something
like:

next_op: pc=0/13 dp=0/270 C=0 J=0
- match? 30 30 00
- TAG: 30 266 CONS
next_op: pc=2/13 dp=4/270 C=1 J=0
- match? 02 02 00
- TAG: 02 257
- LEAF: 257
next_op: pc=5/13 dp=265/270 C=1 J=0
- match? 02 02 00
- TAG: 02 3
- LEAF: 3
next_op: pc=8/13 dp=270/270 C=1 J=0
next_op: pc=11/13 dp=270/270 C=1 J=0
- end cons t=4 dp=270 l=270/270

The next_op line for pc=8/13 should be followed by a match line.

This is not exploitable for X.509 certificates by means of shortening the
message and fixing up the ASN.1 CONS tags because:

 (1) The relevant records being built up are cleared before use.

 (2) If the message is shortened sufficiently to remove the public key, the
     ASN.1 parse of the RSA key will fail quickly due to a lack of data.

 (3) Extracted signature data is either turned into MPIs (which cope with a
     0 length) or is simpler integers specifying algoritms and suchlike
     (which can validly be 0); and

 (4) The AKID and SKID extensions are optional and their removal is handled
     without risking passing a NULL to asymmetric_key_generate_id().

 (5) If the certificate is truncated sufficiently to remove the subject,
     issuer or serialNumber then the ASN.1 decoder will fail with a 'Cons
     stack underflow' return.

This is not exploitable for PKCS#7 messages by means of removal of
elements from such a message from the tail end of a sequence:

 (1) Any shortened X.509 certs embedded in the PKCS#7 message are survivable
     as detailed above.

 (2) The message digest content isn't used if it shows a NULL pointer,
     similarly, the authattrs aren't used if that shows a NULL pointer.

 (3) A missing signature results in a NULL MPI - which the MPI routines deal
     with.

 (4) If data is NULL, it is expected that the message has detached content and
     that is handled appropriately.

 (5) If the serialNumber is excised, the unconditional action associated
     with it will pick up the containing SEQUENCE instead, so no NULL
     pointer will be seen here.

     If both the issuer and the serialNumber are excised, the ASN.1 decode
     will fail with an 'Unexpected tag' return.

     In either case, there's no way to get to asymmetric_key_generate_id()
     with a NULL pointer.

 (6) Other fields are decoded to simple integers.  Shortening the message
     to omit an algorithm ID field will cause checks on this to fail early
     in the verification process.

This can also be tested by snipping objects off of the end of the ASN.1 stream
such that mandatory tags are removed - or even from the end of internal
SEQUENCEs.  If any mandatory tag is missing, the error EBADMSG *should* be
produced.  Without this patch ERANGE or ENOPKG might be produced or the parse
may apparently succeed, perhaps with ENOKEY or EKEYREJECTED being produced
later, depending on what gets snipped.

Just snipping off the final BIT_STRING or OCTET_STRING from either sample
should be a start since both are mandatory and neither will cause an EBADMSG
without the patches

Jira EASS-863

Bug 1797728

Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Marcel Holtmann <marcel@holtmann.org>
Reviewed-by: David Woodhouse <David.Woodhouse@intel.com>
Change-Id: I4f6003fade25d8c77baafdff3af084c739efa69c
Bug: 28751627
(cherry picked from commit 62882e757d95076bbd14371ebfaf1246f0191816)
Reviewed-on: http://git-master/r/1209644
(cherry picked from commit 4d84d5a01f0ff0eaa16cc94632a0e83208998bc0)
Signed-off-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-on: http://git-master/r/1213242
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
(cherry picked from commit 2a4e8a8787008b4730837f29c62726249705eea0)
Reviewed-on: http://git-master/r/1230817
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>
Tested-by: Dhiren Parmar <dparmar@nvidia.com>
(cherry picked from commit dae3090aff58be2ffb4df841102a806573fe4459)
Reviewed-on: http://git-master/r/1250875
Reviewed-by: Vaibhav Shinde <vashinde@nvidia.com>
Tested-by: Vaibhav Shinde <vashinde@nvidia.com>

2 years agoKEYS: potential uninitialized variable
Dan Carpenter [Thu, 16 Jun 2016 14:48:57 +0000]
KEYS: potential uninitialized variable

If __key_link_begin() failed then "edit" would be uninitialized.  I've
added a check to fix that.

This allows a random user to crash the kernel, though it's quite
difficult to achieve.  There are three ways it can be done as the user
would have to cause an error to occur in __key_link():

 (1) Cause the kernel to run out of memory.  In practice, this is difficult
     to achieve without ENOMEM cropping up elsewhere and aborting the
     attempt.

 (2) Revoke the destination keyring between the keyring ID being looked up
     and it being tested for revocation.  In practice, this is difficult to
     time correctly because the KEYCTL_REJECT function can only be used
     from the request-key upcall process.  Further, users can only make use
     of what's in /sbin/request-key.conf, though this does including a
     rejection debugging test - which means that the destination keyring
     has to be the caller's session keyring in practice.

 (3) Have just enough key quota available to create a key, a new session
     keyring for the upcall and a link in the session keyring, but not then
     sufficient quota to create a link in the nominated destination keyring
     so that it fails with EDQUOT.

The bug can be triggered using option (3) above using something like the
following:

echo 80 >/proc/sys/kernel/keys/root_maxbytes
keyctl request2 user debug:fred negate @t

The above sets the quota to something much lower (80) to make the bug
easier to trigger, but this is dependent on the system.  Note also that
the name of the keyring created contains a random number that may be
between 1 and 10 characters in size, so may throw the test off by
changing the amount of quota used.

Assuming the failure occurs, something like the following will be seen:

kfree_debugcheck: out of range ptr 6b6b6b6b6b6b6b68h
------------[ cut here ]------------
kernel BUG at ../mm/slab.c:2821!
...
RIP: 0010:[<ffffffff811600f9>] kfree_debugcheck+0x20/0x25
RSP: 0018:ffff8804014a7de8  EFLAGS: 00010092
RAX: 0000000000000034 RBX: 6b6b6b6b6b6b6b68 RCX: 0000000000000000
RDX: 0000000000040001 RSI: 00000000000000f6 RDI: 0000000000000300
RBP: ffff8804014a7df0 R08: 0000000000000001 R09: 0000000000000000
R10: ffff8804014a7e68 R11: 0000000000000054 R12: 0000000000000202
R13: ffffffff81318a66 R14: 0000000000000000 R15: 0000000000000001
...
Call Trace:
  kfree+0xde/0x1bc
  assoc_array_cancel_edit+0x1f/0x36
  __key_link_end+0x55/0x63
  key_reject_and_link+0x124/0x155
  keyctl_reject_key+0xb6/0xe0
  keyctl_negate_key+0x10/0x12
  SyS_keyctl+0x9f/0xe7
  do_syscall_64+0x63/0x13a
  entry_SYSCALL64_slow_path+0x25/0x25

(cherry picked from commit 38327424b40bcebe2de92d07312c89360ac9229a)
Jira EASS-863

Bug 1797728

Change-Id: Iaf1905f06f52e547654274cbb4827dd03866b71b
Fixes: f70e2e06196a ('KEYS: Do preallocation for __key_link()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-on: http://git-master/r/1209532
(cherry picked from commit d84542d36e9d5968c1cef665e9e0a5c70f8eabc4)
Signed-off-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-on: http://git-master/r/1213221
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
(cherry picked from commit 552d71467ba0fda2d8816408201b77599e624aca)
Reviewed-on: http://git-master/r/1230814
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>
Tested-by: Dhiren Parmar <dparmar@nvidia.com>
(cherry picked from commit 842aad2797759fcb19e49457882ab40b7859160f)
Reviewed-on: http://git-master/r/1250872
Reviewed-by: Vaibhav Shinde <vashinde@nvidia.com>
Tested-by: Vaibhav Shinde <vashinde@nvidia.com>

2 years agofs: ext4: disable support for FALLOC_FL_PUNCH_HOLE
Woojung Min [Thu, 10 Nov 2016 05:48:18 +0000]
fs: ext4: disable support for FALLOC_FL_PUNCH_HOLE

Disable support for the fallocate FALLOC_FL_PUNCH_HOLE to
prevent the race conditions.

CVE-2015-8839
ANDROID-28760453

Jira EASS-863

Bug 1797728

Change-Id: Iae76df73f811da4e8209d21dd0803b070c0db684
Reviewed-on: http://git-master/r/1209635
(cherry picked from commit 9704617c5412f4cde41270259331a9078b479915)
Reviewed-on: http://git-master/r/1213238
(cherry picked from commit 533c2cafdb20f630647b88ae443b580216ebfc34)
Reviewed-on: http://git-master/r/1230816
Signed-off-by: Vaibhav Shinde <vashinde@nvidia.com>
Reviewed-on: http://git-master/r/1250871
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>

2 years agousbnet: cleanup after bind() in probe()
Oliver Neukum [Mon, 7 Mar 2016 10:31:10 +0000]
usbnet: cleanup after bind() in probe()

In case bind() works, but a later error forces bailing
in probe() in error cases work and a timer may be scheduled.
They must be killed. This fixes an error case related to
the double free reported in
http://www.spinics.net/lists/netdev/msg367669.html
and needs to go on top of Linus' fix to cdc-ncm.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Bug 1797728

(cherry picked from commit 1666984c8625b3db19a9abc298931d35ab7bc64b)
Change-Id: Ibc50a06dee69894e18bb62f5969e1718138395cf
(cherry picked from commmit f10f1a249226dfac19ce97b606bb5cea814e63ca)
Signed-off-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-on: http://git-master/r/1214495
Reviewed-by: Jinyoung Park <jinyoungp@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

(cherry picked from commit fee44a55ae456313dcfb0e41ea70fc2227ebe44c)
Signed-off-by: Vaibhav Shinde <vashinde@nvidia.com>
Change-Id: Ia1dd62d6e0e8453c146a8161fc68f8e092c88c3a
Reviewed-on: http://git-master/r/1231203
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>
Tested-by: Dhiren Parmar <dparmar@nvidia.com>
(cherry picked from commit 795ce24a85f0b197431d4dba743e78ffd99a56fb)
Reviewed-on: http://git-master/r/1250870

2 years agovideo: tegra: host: Optimize the accuracy of actmon average load
Nicolin Chen [Thu, 3 Nov 2016 20:03:29 +0000]
video: tegra: host: Optimize the accuracy of actmon average load

According to Bug 1381833, we can enlarge the k value and sample period
to increase the accuracy of the average load value from the activity
monitor. (The range of k is [1, 6] while the sample period should not
exceed 22us.)

Based on the experiments mentioned in the Bug 1828143, we found that
setting k=5 and sample period=20us could be relatively benifit to the
accuracy of the average load.

So this patch just modifies these two values.

Bug 1828143

Change-Id: I6fbd4d6a832248e121f177cc5e30640d3702e84c
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: http://git-master/r/1248444
GVS: Gerrit_Virtual_Submit
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>

2 years agotegra: fuse: remove cmd sensing after fuse program
Shardar Shariff Md [Fri, 11 Nov 2016 14:23:25 +0000]
tegra: fuse: remove cmd sensing after fuse program

- Remove cmd sense after fuse programming as recommended by ASIC.
- Correct the fuse programing width time

Bug 1832850

Change-Id: I6fb4ac0fa55bb3830cb1ea937c9939ecfba308bf
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com>
Reviewed-on: http://git-master/r/1251999
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

2 years agonet: wireless: bcmdhd / bcmdhd_88: Disable tcpdump feature by default
Michael Hsu [Thu, 6 Oct 2016 23:43:03 +0000]
net: wireless: bcmdhd / bcmdhd_88: Disable tcpdump feature by default

Disable saving tcpdump records until it is enabled (by writing 'enable'
command to the sysfs node).

Only tcpdump records is disabled by default - other record types, such
as power or wifi stats records, are still enabled by default.

Bug 200240507

Change-Id: I033b5e3057b25c4e828a2ea179e0898e13002a31
Signed-off-by: Michael Hsu <mhsu@nvidia.com>
Reviewed-on: http://git-master/r/1232801
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>

2 years agoRevert "ext4: use old interface for ext4_readdir()"
Ian Chang [Mon, 7 Nov 2016 08:14:16 +0000]
Revert "ext4: use old interface for ext4_readdir()"

This reverts commit b6b8b43596251f7f1e8379665ac2bcc4aa1c831c.

The change we revert will cause file system iterate call back
function broken. So reverting that.

bug 200205692

Change-Id: I95cf767789c3c93ff772d55ddc53669bb7eadd81
Signed-off-by: Ian Chang <ianc@nvidia.com>
Reviewed-on: http://git-master/r/1249510
Reviewed-by: Robert Shih <rshih@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoARM64: dts: darcy: rtc alarm2 wakeup via EN1 signal
Venkat Reddy Talla [Thu, 10 Nov 2016 08:37:15 +0000]
ARM64: dts: darcy: rtc alarm2 wakeup via EN1 signal

Adding maxim,enable-rtc2-alarm-wakeup to pmic dts node
to enable rtc alarm2 wake up via EN1 signal.

Bug 200236913

Change-Id: Ia3f0eaa60886acd9f875b213f3e76095c028d8e6
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: http://git-master/r/1250977
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agortc: max77620: set rtc alarm2 for 9sec wakeup
Venkat Reddy Talla [Thu, 13 Oct 2016 14:06:32 +0000]
rtc: max77620: set rtc alarm2 for 9sec wakeup

configuring rtc alarm2 for 9sec wakeup to handle
darcy device boot fail when power adapter is removed
and connected back with in 5 seconds, resetting alarm time
+9 sec to current time again before expire in workqueue.
alarm time should expire only when power adapater is removed.

Bug 200236913

Change-Id: I6aa4f58ef83b53b4223d7502c9e7cf059c34dc60
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: http://git-master/r/1250976
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoHID: usbhid: fix asynchronous resource free
Hans Yang [Tue, 8 Nov 2016 09:31:25 +0000]
HID: usbhid: fix asynchronous resource free

If usb_disconnect() and usbhid_disconnect() are invoked
asynchronously due to bottom-half workqueue to postpone
work in usbhid_disconnect(), following conditions might
occur:
* struct usb_device *dev memory resource has been freed.
* struct hid_device *dev is still available.
* user space issues a write to get hid report, calling
usbhid_output_raw_report() and lead to a kernel panic
due to invalid dereference from usbhid_device* to usb_dev*.

[ 137.137063] Unable to handle kernel paging request at
virtual address 000010ef
[ 137.144426] pgd = ffffffc0a1ec2000
[ 138.488914] Call trace:
[ 138.491362] [<ffffffc00073d0fc>] usb_submit_urb+0xb4/0x3e4
[ 138.496842] [<ffffffc00073e0f8>] usb_start_wait_urb+0x54/0x130
[ 138.502667] [<ffffffc00073e280>] usb_control_msg+0xac/0xf4
[ 138.508147] [<ffffffc000941aa8>] usbhid_output_raw_report+0xb8/0x10c
[ 138.514494] [<ffffffc00091ab0c>] hidraw_send_report+0x134/0x168
[ 138.520407] [<ffffffc00091ab7c>] hidraw_write+0x3c/0x58
[ 138.525625] [<ffffffc0001a1280>] vfs_write+0xc0/0x17c
[ 138.530669] [<ffffffc0001a1abc>] SyS_write+0x94/0x164

Also, if usb_dev memory is freed before freeing usbhid_device
resources, following crash dump may also be seen:

[42230.701858] Call trace:
[42230.704306] [<ffffffc000724e64>] hcd_buffer_free+0x18/0x130
[42230.709872] [<ffffffc000712a28>] usb_free_coherent+0x1c/0x24
[42230.715526] [<ffffffc000917ad8>] hid_free_buffers.isra.7+0x24/0x60
[42230.721696] [<ffffffc000917bf8>] usbhid_stop+0xe4/0x108
[42230.726914] [<ffffffc000913a80>] atvr_remove+0xa4/0x138
[42230.732134] [<ffffffc0008ec5f4>] hid_device_remove+0x80/0xc4
[42230.737788] [<ffffffc00051f7bc>] __device_release_driver+0x94/0xe4
[42230.743961] [<ffffffc00051f830>] device_release_driver+0x24/0x38
[42230.749959] [<ffffffc00051efd0>] bus_remove_device+0x140/0x164
[42230.755782] [<ffffffc00051c43c>] device_del+0x13c/0x19c
[42230.761001] [<ffffffc0008ec76c>] hid_destroy_device+0x28/0x60
[42230.766738] [<ffffffc000916b08>] usbhid_disconnect_bh+0x28/0x3c
[42230.772652] [<ffffffc0000c9a6c>] process_one_work+0x260/0x410
[42230.778390] [<ffffffc0000cabac>] worker_thread+0x204/0x378
[42230.783870] [<ffffffc0000d12a0>] kthread+0xc0/0xc8

This commit forces the usbhid_device and usb_dev resources
free are in order by introducing reference couning method into
usb hid driver. Whatever usb_disconnect() or usbhid_stop() is called
first, the usb_dev memory will only be freed when ref count goes to
zero, just before usbhid_device memory gets freed.

Bug 1834364

Signed-off-by: Hans Yang <hansy@nvidia.com>
Change-Id: I81748c60216c81dae55daaa9b0f331152121f8f6
Reviewed-on: http://git-master/r/1249662
Reviewed-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Tested-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Reviewed-by: Henry Lin <henryl@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: ChihMin Cheng <ccheng@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoclock: T124: Refine default cpu-emc table for power/perf benefits
Suril [Thu, 20 Oct 2016 20:35:23 +0000]
clock: T124: Refine default cpu-emc table for power/perf benefits

For the T124 CPU-EMC frequency in display off cases will use the default
table. This table has values that are refined for better perf/power
requirements. this patch has a more passive behavior for low power/perf
conditions.

Bug 1825329

Signed-off-by: Suril Dhruv <sdhruv@nvidia.com>
Change-Id: Ifaefd927a7f1bd4a81035eb26b81ae0241730f73
Reviewed-on: http://git-master/r/1240146
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoclock : Pick up CPU-EMC frequency relation from device tree
Suril [Thu, 20 Oct 2016 19:14:31 +0000]
clock : Pick up CPU-EMC frequency relation from device tree

Provision darcy/foster to pick up the CPU-EMC frequency co relation
from it's individual device tree entry for display on cases and
from the default table in display off cases. The dtb has slightly
more aggressive values as compared to the default table optimized
for higher perf.

Bug 1825329
Signed-off-by: Suril Dhruv <sdhruv@nvidia.com>
Change-Id: Ib989389a6ee110868070fc89725386239a5a1674
Reviewed-on: http://git-master/r/1240072
Reviewed-by: Somdutta Roy <somduttar@nvidia.com>
Reviewed-by: David Dastous St Hilaire <ddastoussthi@nvidia.com>
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jonathan Mccaffrey <jmccaffrey@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agohid: jarvis: Restrict init TSFW_ICM to TS only
Spencer Sutterlin [Fri, 21 Oct 2016 22:14:22 +0000]
hid: jarvis: Restrict init TSFW_ICM to TS only

Bug 200250677
Bug 1807528

Change-Id: I8b3933cb0fe8d4da5cbdb9d2bff031de2b791690
Signed-off-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Reviewed-on: http://git-master/r/1248539
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoARM64: config: tegra21: Increase compat mmap rnd bits to 16
Sri Krishna chowdary [Thu, 3 Nov 2016 08:55:26 +0000]
ARM64: config: tegra21: Increase compat mmap rnd bits to 16

This is required for Aslr test to pass with entropy 8.

bug 200226998

Change-Id: I78aefdacb862c94d2346da572809efaac488bdc1
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1247320
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agommc: sd: add attribute for speed class of SD
Harry Lin [Thu, 27 Oct 2016 08:03:02 +0000]
mmc: sd: add attribute for speed class of SD

Follow the design of debug sysfs node speed_class to add
a speed class attribute of SD.
cat /sys/block/mmcblk#/device/speed_class
Result:
4 - Class 10
3 - Class 6
2 - Class 4
1 - Class 2
0 - Class 0

Bug 200245639

Change-Id: I94f0e6557c2af7170c0b3ad813575d5c689e78ed
Signed-off-by: Harry Lin <harlin@nvidia.com>
Reviewed-on: http://git-master/r/1243608
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>

2 years agoRevert "iio: imu: nvi: v.337 Fix DMP gyro"
Todd Poynter [Tue, 8 Nov 2016 22:06:04 +0000]
Revert "iio: imu: nvi: v.337 Fix DMP gyro"

Bug 1831500

This reverts commit d686b0fd4d60b0a9fc8f7bfd5408f6e557a16684.

Change-Id: I9c09d8aa711bb89c968b96d57912f12ed8dd6847
Signed-off-by: Todd Poynter <tpoynter@nvidia.com>
Reviewed-on: http://git-master/r/1249988
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit

2 years agousb: core: avoid PM error -ENODEV for detached MSD
Petlozu Pravareshwar [Thu, 22 Sep 2016 10:44:42 +0000]
usb: core: avoid PM error -ENODEV for detached MSD

Let rpm_resume() be successful for auto-suspended
usb MSD when disconnected, instead of failing with
-ENODEV. This would allow the resumption of upper
layer devices such as SCSI and would prevent
indefinite writeback wait on page if suspended MSD
is disonnected in middle of data transfer.

Bug 1731175

Change-Id: I534eeb19bb635c96eb6fb240790001ee723bb5ef
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
Reviewed-on: http://git-master/r/1225243
(cherry picked from commit 05bd5b51751a460e7510519255cd88ee16ab7c5a)
Reviewed-on: http://git-master/r/1246443
GVS: Gerrit_Virtual_Submit
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

2 years agousb: storage: enable auto-suspend for USB storage
Petlozu Pravareshwar [Thu, 22 Sep 2016 10:40:24 +0000]
usb: storage: enable auto-suspend for USB storage

Enable auto-suspend for USB Mass storage devices.

Bug 1731175

Change-Id: I0cfeff38e1cb4911419aaf91c25146a5ed1a2210
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
Reviewed-on: http://git-master/r/1180730
(cherry picked from commit 5dbb7628c7fe5b31e916172cc660f563600faefd)
Reviewed-on: http://git-master/r/1246442
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

2 years agodriver core / PM: move the calling to device_pm_remove behind the calling to bus_remo...
LongX Zhang [Wed, 24 Oct 2012 22:21:28 +0000]
driver core / PM: move the calling to device_pm_remove behind the calling to bus_remove_device

We hit an hang issue when removing a mmc device on Medfield Android phone by sysfs interface.

device_pm_remove will call pm_runtime_remove which would disable
runtime PM of the device. After that pm_runtime_get* or
pm_runtime_put* will be ignored. So if we disable the runtime PM
before device really be removed, drivers' _remove callback may
access HW even pm_runtime_get* fails. That is bad.

Consider below call sequence when removing a device:
device_del => device_pm_remove
             => class_intf->remove_dev(dev, class_intf)  => pm_runtime_get_sync/put_sync
             => bus_remove_device => device_release_driver => pm_runtime_get_sync/put_sync

remove_dev might call pm_runtime_get_sync/put_sync.
Then, generic device_release_driver also calls pm_runtime_get_sync/put_sync.
Since device_del => device_pm_remove firstly, later _get_sync wouldn't really wake up the device.

I git log -p to find the patch which moves the calling to device_pm_remove ahead.
It's below patch:

commit  775b64d2b6ca37697de925f70799c710aab5849a
Author: Rafael J. Wysocki <rjw@sisk.pl>
Date:   Sat Jan 12 20:40:46 2008 +0100

     PM: Acquire device locks on suspend

     This patch reorganizes the way suspend and resume notifications are
     sent to drivers.  The major changes are that now the PM core acquires
     every device semaphore before calling the methods, and calls to
     device_add() during suspends will fail, while calls to device_del()
     during suspends will block.

     It also provides a way to safely remove a suspended device with the
     help of the PM core, by using the device_pm_schedule_removal() callback
     introduced specifically for this purpose, and updates two drivers (msr
     and cpuid) that need to use it.

As device_pm_schedule_removal is deleted by another patch, we need also revert other parts of the patch,
i.e. move the calling of device_pm_remove after the calling to bus_remove_device.

Signed-off-by: LongX Zhang <longx.zhang@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 4b6d1f12f9c4e0e420d5747d3ae285d8f66d627f)

Bug 1731175

Change-Id: Ic6113974660fc4a6a63566b8dbbb4887ff04dd2b
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
Reviewed-on: http://git-master/r/1246440
GVS: Gerrit_Virtual_Submit
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

2 years agovideo: tegra: host: Prevent the race between channel open and close
Gagan Grover [Fri, 4 Nov 2016 11:09:33 +0000]
video: tegra: host: Prevent the race between channel open and close

Moved fd_install() at the end of the channel_open ioctl. So, the fd
can't be used until open ioctl completes.

Bug 1832094

Change-Id: Ib33d43bf5164418a38f98677d4e3295f3d1c1450
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1248180
GVS: Gerrit_Virtual_Submit
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>

2 years agoiio: imu: nvi: v.337 Fix DMP gyro
Erik Lilliebjerg [Tue, 1 Nov 2016 15:54:52 +0000]
iio: imu: nvi: v.337 Fix DMP gyro

- Fix ICM DMP gyroscope data output to match the standard FIFO data output.

Bug 1831500

Change-Id: Ie26071fe211c390a03d4f912815ed00a89beff8b
Signed-off-by: Erik Lilliebjerg <elilliebjerg@nvidia.com>
Reviewed-on: http://git-master/r/1245846
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Robert Collins <rcollins@nvidia.com>

2 years agoARM: enable PSTORE_PMSG
Ian Chang [Fri, 26 Jun 2015 06:12:04 +0000]
ARM: enable PSTORE_PMSG

enable CONFIG_PSTORE_PMSG in tegra124/tegra210
platforms

bug 200104058
bug 200247808

Change-Id: I733d2b0cf6355bf0be4fa67c845b4f8ee983808a
Signed-off-by: Ian Chang <ianc@nvidia.com>
Reviewed-on: http://git-master/r/762795
(cherry picked from commit 17970ff09ffe126aff215aa7edb42b9f957b1612)
Reviewed-on: http://git-master/r/1244236
Reviewed-by: Robert Shih <rshih@nvidia.com>
Reviewed-by: Gagan Grover <ggrover@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoplatform: tegra: add PSTORE_PMSG buffer
Ian Chang [Fri, 26 Jun 2015 06:09:16 +0000]
platform: tegra: add PSTORE_PMSG buffer

add pstore pmsg buffer to store in tegra
platform.

bug 200104058
bug 200247808

Change-Id: Icfd2c6be5320a3e904e1470d961b1a3689699717
Signed-off-by: Ian Chang <ianc@nvidia.com>
Reviewed-on: http://git-master/r/762794
(cherry picked from commit 9d9f73fbf26e1c246a15a765ab2eac501b208ff8)
Reviewed-on: http://git-master/r/1244234
Reviewed-by: Robert Shih <rshih@nvidia.com>
Reviewed-by: Gagan Grover <ggrover@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agotegra-alt:adsp: NULL check for app variable
Viswanath L [Fri, 28 Oct 2016 07:46:39 +0000]
tegra-alt:adsp: NULL check for app variable

ADSP app variables are not initialized in all cases (like at APM
output pin) causing NULL pointer access to app->override_freq_work

NULL check fixes this; override_freq_work will get called at widget
ON event

Bug 200245012

Change-Id: Ie6161c0247d8b15db88bdef706ab6c3b472fa977
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1244336
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>

2 years agocdc_ncm: add back FLAG_RMNET flag
Vaibhav Shinde [Thu, 20 Oct 2016 05:30:33 +0000]
cdc_ncm: add back FLAG_RMNET flag

This flasg was missed while cherry-picking the upstream change
4d06dd537f95683aba3651098ae288b7cbff8274 in commit
efceda32988b9cce46559bd936f3f2e3dd51f617

Bug 200244875

Change-Id: Ife6363cca4ef6616b3ed433c03517def9f4e88d5
Signed-off-by: Vaibhav Shinde <vashinde@nvidia.com>
Reviewed-on: http://git-master/r/1239634
(cherry picked from commit 1c2cf72f8ec8efd04c4822561fdf04a7233263cc)
Reviewed-on: http://git-master/r/1243138
Reviewed-by: Todd Poynter <tpoynter@nvidia.com>
Tested-by: Todd Poynter <tpoynter@nvidia.com>

2 years agousb: gadget: f_fs: make it support v2 func descp
Hans Yang [Tue, 4 Oct 2016 06:48:35 +0000]
usb: gadget: f_fs: make it support v2 func descp

To support Android N adb via super spped to work,
need to accept V2 function descriptors from user space
drivers; without this change it will crash when adb is
working as superspeed.

Bug 200235473

Change-Id: I06f74880e26dd9c71e4cee2c8034d44a0259d5a1
Signed-off-by: Hans Yang <hansy@nvidia.com>
Reviewed-on: http://git-master/r/1231235
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
(cherry picked from commit 90105aa07f720c14e175499809351f240b5b6f8e)
Reviewed-on: http://git-master/r/1243574
Reviewed-by: WK Tsai <wtsai@nvidia.com>
Reviewed-by: ChihMin Cheng <ccheng@nvidia.com>
Reviewed-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agousb: gadget: xudc: fix null update deq pointer
Hans Yang [Wed, 19 Oct 2016 03:28:46 +0000]
usb: gadget: xudc: fix null update deq pointer

This commit adds pointer-check to prevent empty dma address
from an event trb (Ring Overrun/Underrun) being dereferenced
at updating dequeue pointer in udc driver.

The empty dma address will also be translated to null virtual
address and hence dereferencing it causes a kernel panic:

Unable to handle kernel NULL pointer dereference at virtual
address 0000001c
[  269.335313] PC is at update_dequeue_pt+0x38/0x5c
[  269.339925] LR is at update_dequeue_pt+0x2c/0x5c

Bug 200241737

Change-Id: I77c71703ea3ee353005349e9b33e4a587a81cef3
Signed-off-by: Hans Yang <hansy@nvidia.com>
Reviewed-on: http://git-master/r/1243062
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agonet: wireless: bcmdhd_88: security enhancement for BRCM ether type
Ramanathan R [Mon, 24 Oct 2016 08:06:34 +0000]
net: wireless: bcmdhd_88: security enhancement for BRCM ether type

Strict checkup for type and event data length
Patch to fix CVE-2016-0801 in DHD driver

Bug 200240360

Change-Id: I67cab7809740c1cba9079fbab0a3ad1848cd7586
Signed-off-by: Ramanathan R <ramanathan.r@broadcom.com>
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: http://git-master/r/1241426
GVS: Gerrit_Virtual_Submit
Reviewed-by: Om Prakash Singh <omp@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>

2 years agovideo: tegra: dc: protect unpin handle using mutex
Prafull Suryawanshi [Wed, 13 Jul 2016 09:14:11 +0000]
video: tegra: dc: protect unpin handle using mutex

bug 200208064

This change fixes the race condition where detach dma buffer
happens due to parallel paths in dc driver.
hpd worker and fb blank calls unpin window which unpin dma handles.
This is also done by flip_worker. There is possibility that same
buffer can be detached twice causing kernel panic. This change
protects cur_handle which is referred before doing unpin dma handles.

Change-Id: I8fa317d8d5fe62724c44c3630f71739ebb0c23ed
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: http://git-master/r/1180645
(cherry picked from commit f48c266c999337b216abe3f49d709843b58d2fdb)
Reviewed-on: http://git-master/r/1199050
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agousb: gadget: xudc: fix retrieve request logic
Hans Yang [Sat, 22 Oct 2016 05:58:36 +0000]
usb: gadget: xudc: fix retrieve request logic

This commit fixes a wrong memory access issue.
When the gadget function driver dequeues a request which
may has been completed by HW, then at handling its transfer
event, retrieving its corresponding request pointer could
be incorrect. SW should check if the request queue
is empty and the request is the correct one to avoid incorrect
memory access.

Below shows the call trace for an incorrect memory access case
Unable to handle kernel paging request at virtual
address ff0000c0be320e0a
PC is at ep_matches+0x38/0x2b4
LR is at usb_ep_autoconfig_ss+0x148/0x180
[<ffffffc00078b50c>] ep_matches+0x38/0x2b4
[<ffffffc00078b8d0>] usb_ep_autoconfig_ss+0x148/0x180
[<ffffffc00078b918>] usb_ep_autoconfig+0x10/0x18
[<ffffffc0007a9c84>] __ffs_func_bind_do_descs+0x100/0x170
[<ffffffc0007aa94c>] ffs_do_descs+0x4c/0x13c
[<ffffffc0007b29b8>] ffs_func_bind+0x224/0x338
[<ffffffc00078bdc4>] usb_add_function+0x98/0x180
[<ffffffc0007b3a68>] functionfs_bind_config+0xd0/0x100
[<ffffffc0007b3ab0>] ffs_function_bind_config+0x18/0x20
[<ffffffc0007a94e8>] android_bind_config+0x44/0x94
[<ffffffc00078c40c>] usb_add_config+0x7c/0x2ac
[<ffffffc0007b3cf4>] android_enable.isra.53+0x44/0x78
[<ffffffc0007ba154>] ffs_ep0_write+0x5c0/0x7bc
[<ffffffc0001a11ec>] vfs_write+0xc0/0x17c
[<ffffffc0001a1a28>] SyS_write+0x94/0x164

Bug 1824860

Change-Id: If742a8b4f8686cfa147c085913cf065b54dd022b
Signed-off-by: Hans Yang <hansy@nvidia.com>
Reviewed-on: http://git-master/r/1243044
Reviewed-by: Mark Kuo <mkuo@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agodevfreq: governor_pod: Raise threshold for vic03
Nicolin Chen [Thu, 13 Oct 2016 19:35:27 +0000]
devfreq: governor_pod: Raise threshold for vic03

The threshold used to govern the vic03 clock rate
is set at 250 (25% of the total capacity) which
seems to be too low as it's easier for devfreq to
drive the clock higher and then impact the power.

So this patch raises the threshold further to 30%
so as not to make the frequency fluctuate much.

Bug 200228585

Change-Id: Id13950bf170b21c8f6f9caf670efff25c4341f67
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: http://git-master/r/1236174
GVS: Gerrit_Virtual_Submit
Reviewed-by: Somdutta Roy <somduttar@nvidia.com>
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Tested-by: Somdutta Roy <somduttar@nvidia.com>

2 years agoiio: common: nvs: Set st->trig null after free
Spencer Sutterlin [Fri, 28 Oct 2016 01:11:33 +0000]
iio: common: nvs: Set st->trig null after free

Bug 200244923

Change-Id: Icd3cb01825fed14604130b278af6fa64b70365c0
Signed-off-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Reviewed-on: http://git-master/r/1244153
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
GVS: Gerrit_Virtual_Submit

2 years agomedia: i2c: ov5693: Fix potential power-leaks
Sudhir Vyas [Wed, 14 Sep 2016 05:58:45 +0000]
media: i2c: ov5693: Fix potential power-leaks

- Make sure to power off camera rails
in case of intermediate errors.
- Remove unnecessary return error checks for
power-off function calls.

Bug 200186908
Bug 200233021

Change-Id: I63ef1929535756b8378380fee5134b9c275d96bb
Signed-off-by: Sudhir Vyas <svyas@nvidia.com>
Reviewed-on: http://git-master/r/1220516
(cherry picked from commit 600f6a141c99893ac92d937d4cb0e37834faf2fc)
Reviewed-on: http://git-master/r/1242841
Reviewed-by: Aaron Huang <aaronh@nvidia.com>
Tested-by: Aaron Huang <aaronh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

2 years agovideo: tegra: hdmi2.0: fix hpd state in recovery
Prafull Suryawanshi [Mon, 24 Oct 2016 07:03:01 +0000]
video: tegra: hdmi2.0: fix hpd state in recovery

bug 200242122
bug 200243233

In kernel recovery path, we accidently disable hdmi
monitor in hpd event. This causes no display on hdmi
monitor in recovery mode which is 480p.
In normal scenario, rest of hpd engine takes care
but recovery, hpd is disabled causing this issue.
The hpd state is now checked which is set by bl for
this specific scenario.

Change-Id: I8812753927a2c6845c6b1c58cde83e91abbbbec0
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: http://git-master/r/1241478
Reviewed-by: Aly Hirani <ahirani@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>

2 years agohid: jarvis: Use kmalloc for pcm buffers
Ankita Garg [Wed, 12 Oct 2016 19:46:07 +0000]
hid: jarvis: Use kmalloc for pcm buffers

For buffering voice data before mic open,
we moved buffer allocations to the
audio_dec function. However, audio_dec
could be called from interrupt context if
the controller is connected over USB
instead of BT. So the allocations inside
audio_dec cannot use vmalloc.

This change causes the audio buffers to
be pre-allocated at device probe time
and will be allocated until the device
is connected.

Bug 1825439

Change-Id: I26dab7f232a5e146168482e13d7d19301bf8a4c9
Signed-off-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-on: http://git-master/r/1235462
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agoarch: arm64: config: enable cpuset for t210 android
Christopher Freeman [Tue, 4 Oct 2016 20:26:03 +0000]
arch: arm64: config: enable cpuset for t210 android

boot.img size is increased by 18432 bytes

Bug 1815239

Change-Id: I5bb8fd436f2fc9de19f2fd0ff8b9f08d06b17d6f
Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Reviewed-on: http://git-master/r/1231557
(cherry picked from commit f05cb72943a893a73cbfd9edd667b2b12241dd87 in
rel-24-jetson-vr)
Reviewed-on: http://git-master/r/1240275
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agokernel: cpuset: Make cpusets restore on hotplug
Riley Andrews [Fri, 12 Jun 2015 21:36:28 +0000]
kernel: cpuset: Make cpusets restore on hotplug

This deliberately changes the behavior of the per-cpuset
cpus file to not be effected by hotplug. When a cpu is offlined,
it will be removed from the cpuset/cpus file. When a cpu is onlined,
if the cpuset originally requested that that cpu was part of the cpuset, that
cpu will be restored to the cpuset. The cpus files still
have to be hierachical, but the ranges no longer have to be out of
the currently online cpus, just the physically present cpus.

Bug 1815239

Change-Id: I3efbae24a1f6384be1e603fb56f0d3baef61d924
Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Reviewed-on: http://git-master/r/1231559
(cherry picked from commit 2b02e3175e322505383c4c2cb123de34294e77e5 in
rel-24-jetson-vr)
Reviewed-on: http://git-master/r/1235405
Reviewed-by: Maneet Maneet Singh <mmaneetsingh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Raymond Poudrier <rapoudrier@nvidia.com>

2 years agoangler: Add allow_attach hook for cpusets on android.
Riley Andrews [Sat, 6 Jun 2015 01:59:29 +0000]
angler: Add allow_attach hook for cpusets on android.

Bug 1815239

Change-Id: Ic1b61b2bbb7ce74c9e9422b5e22ee9078251de21
[cfreeman@nvidia.com: change uid comparators]
Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Reviewed-on: http://git-master/r/1231558
(cherry picked from commit c310b0a2468af82b44e7b320c43de2acfbd2f478 in
rel-24-jetson-vr)
Reviewed-on: http://git-master/r/1240274
Reviewed-by: Maneet Maneet Singh <mmaneetsingh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Raymond Poudrier <rapoudrier@nvidia.com>

2 years agomm: remove gup_flags FOLL_WRITE games from __get_user_pages()
Gagan Grover [Fri, 21 Oct 2016 08:25:48 +0000]
mm: remove gup_flags FOLL_WRITE games from __get_user_pages()

commit 19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619 upstream.

This is an ancient bug that was actually attempted to be fixed once
(badly) by me eleven years ago in commit 4ceb5db9757a ("Fix
get_user_pages() race for write access") but that was then undone due to
problems on s390 by commit f33ea7f404e5 ("fix get_user_pages bug").

In the meantime, the s390 situation has long been fixed, and we can now
fix it by checking the pte_dirty() bit properly (and do it better).  The
s390 dirty bit was implemented in abf09bed3cce ("s390/mm: implement
software dirty bits") which made it into v3.9.  Earlier kernels will
have to look at the page state itself.

Also, the VM has become more scalable, and what used a purely
theoretical race back then has become easier to trigger.

To fix it, we introduce a new internal FOLL_COW flag to mark the "yes,
we already did a COW" rather than play racy games with FOLL_WRITE that
is very fundamental, and then use the pte dirty flag to validate that
the FOLL_COW flag is still valid.

bug 1829674

Change-Id: I13a55845a79f92c0c90228a229947d2bdf616a4a
Reported-and-tested-by: Phil "not Paul" Oester <kernel@linuxace.com>
Acked-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Nick Piggin <npiggin@gmail.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[wt: s/gup.c/memory.c; s/follow_page_pte/follow_page_mask;
     s/faultin_page/__get_user_page]
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1240465
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>
Tested-by: Dhiren Parmar <dparmar@nvidia.com>

2 years agovideo: tegra: host: add lower bound to num_syncpt_incrs
Gagan Grover [Fri, 21 Oct 2016 06:15:00 +0000]
video: tegra: host: add lower bound to num_syncpt_incrs

Check if there is at least one syncpt_incrs in each job.

Bug 1812182

Change-Id: I0bd0b2e7c4d01641c83ba729ec34390ddea81496
Reviewed-on: http://git-master/r/1221226
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1240374
GVS: Gerrit_Virtual_Submit
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>

2 years agoARM64: t210 android reboot on hard/soft locks
David DSH [Wed, 19 Oct 2016 21:12:54 +0000]
ARM64: t210 android reboot on hard/soft locks

Reboot the device on hard lock up to get proper backtraces.

Bug 1827051

Change-Id: I7968e663004b19a6a9d14b7d68740d5c918e2cd2
Signed-off-by: David DSH <ddastoussthi@nvidia.com>
Reviewed-on: http://git-master/r/1239437
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Manish Tuteja <mtuteja@nvidia.com>

2 years agoiio: imu: tsfw_icm: Fix report length + compass
Spencer Sutterlin [Wed, 19 Oct 2016 22:33:56 +0000]
iio: imu: tsfw_icm: Fix report length + compass

Fix reports #1a and 1b length and data offset

Add compass rotation matrix

Minor code clean up also

Bug 1827951
Bug 1828167

Change-Id: Id3df844487303b3de9475f45701f949093263de0
Signed-off-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Reviewed-on: http://git-master/r/1239497
GVS: Gerrit_Virtual_Submit
Reviewed-by: Siddardha Naraharisetti <siddardhan@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agommc: card: Disable Secure Erase/trim for SANDISK eMMC
Pavan Kunapuli [Fri, 21 Oct 2016 10:55:03 +0000]
mmc: card: Disable Secure Erase/trim for SANDISK eMMC

Disabling secure erase/trim feature on Sandisk eMMC with the
product names SDW16G, SDW32G, SDW64G

Bug 200205692

Change-Id: I8ea990203423a65096ed40a478eba93c5fd84643
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/1240605
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
GVS: Gerrit_Virtual_Submit

2 years agoRevert "arm64: dts: Add new dts file for Darcy with new memory"
Martin Gao [Thu, 13 Oct 2016 21:16:20 +0000]
Revert "arm64: dts: Add new dts file for Darcy with new memory"

Bug 1772578

This reverts commit 790caf00c2ef2e025ed8651c0aec5c8e4539a545.

Change-Id: Icb4352ee10cf2a1c57e1a8067b68e73076509517
Signed-off-by: Martin Gao <marting@nvidia.com>
Reviewed-on: http://git-master/r/1228093
(cherry picked from commit 82f268dc302921d4d6fe8d7e021ae98bb6437e92)
Reviewed-on: http://git-master/r/1236917
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoUPSTREAM: netfilter: x_tables: validate e->target_offset early
Florian Westphal [Tue, 22 Mar 2016 17:02:49 +0000]
UPSTREAM: netfilter: x_tables: validate e->target_offset early

(cherry pick from commit bdf533de6968e9686df777dc178486f600c6e617)

We should check that e->target_offset is sane before
mark_source_chains gets called since it will fetch the target entry
for loop detection.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Change-Id: Ic2dbc31c9525d698e94d4d8875886acf3524abbd
Bug: 29637687
Bug 1797728
(cherry picked from commit 7ed1e120e1cc31bea816709c25ebb80203ce9f1b)
Signed-off-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-on: http://git-master/r/1214540
GVS: Gerrit_Virtual_Submit

(cherry picked from commit 7f418177a6ac021fc6a10560b17733577b898b6f)
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Change-Id: I4381d3ca09eb1e22f720071be6bfa2701e14b885
Reviewed-on: http://git-master/r/1226957
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agogpu: nvgpu: fix use-after-free in case of error notifier
Gagan Grover [Wed, 12 Oct 2016 11:35:06 +0000]
gpu: nvgpu: fix use-after-free in case of error notifier

A use-after-free scenario is possible where one thread in
gk20a_free_error_notifiers() is trying to free the error
notifier and another thread in gk20a_set_error_notifier()
is still using the error notifier

Fix this by introducing mutex error_notifier_mutex for
error notifier accesses

Take mutex in gk20a_free_error_notifiers() and in
gk20a_set_error_notifier() before accessing notifier

In gk20a_init_error_notifier(), set the pointer
ch->error_notifier_ref inside the mutex and only
after notifier is completely initialized

Bug 1824788

Change-Id: I47e1ab57d54f391799f5a0999840b663fd34585f
Reviewed-on: http://git-master/r/1233988
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1235222
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoppp: take reference on channels netns
Guillaume Nault [Wed, 23 Mar 2016 15:38:55 +0000]
ppp: take reference on channels netns

Let channels hold a reference on their network namespace.
Some channel types, like ppp_async and ppp_synctty, can have their
userspace controller running in a different namespace. Therefore they
can't rely on them to preclude their netns from being removed from
under them.

==================================================================
BUG: KASAN: use-after-free in ppp_unregister_channel+0x372/0x3a0 at
addr ffff880064e217e0
Read of size 8 by task syz-executor/11581
=============================================================================
BUG net_namespace (Not tainted): kasan: bad access detected
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Allocated in copy_net_ns+0x6b/0x1a0 age=92569 cpu=3 pid=6906
[<      none      >] ___slab_alloc+0x4c7/0x500 kernel/mm/slub.c:2440
[<      none      >] __slab_alloc+0x4c/0x90 kernel/mm/slub.c:2469
[<     inline     >] slab_alloc_node kernel/mm/slub.c:2532
[<     inline     >] slab_alloc kernel/mm/slub.c:2574
[<      none      >] kmem_cache_alloc+0x23a/0x2b0 kernel/mm/slub.c:2579
[<     inline     >] kmem_cache_zalloc kernel/include/linux/slab.h:597
[<     inline     >] net_alloc kernel/net/core/net_namespace.c:325
[<      none      >] copy_net_ns+0x6b/0x1a0 kernel/net/core/net_namespace.c:360
[<      none      >] create_new_namespaces+0x2f6/0x610 kernel/kernel/nsproxy.c:95
[<      none      >] copy_namespaces+0x297/0x320 kernel/kernel/nsproxy.c:150
[<      none      >] copy_process.part.35+0x1bf4/0x5760 kernel/kernel/fork.c:1451
[<     inline     >] copy_process kernel/kernel/fork.c:1274
[<      none      >] _do_fork+0x1bc/0xcb0 kernel/kernel/fork.c:1723
[<     inline     >] SYSC_clone kernel/kernel/fork.c:1832
[<      none      >] SyS_clone+0x37/0x50 kernel/kernel/fork.c:1826
[<      none      >] entry_SYSCALL_64_fastpath+0x16/0x7a kernel/arch/x86/entry/entry_64.S:185

INFO: Freed in net_drop_ns+0x67/0x80 age=575 cpu=2 pid=2631
[<      none      >] __slab_free+0x1fc/0x320 kernel/mm/slub.c:2650
[<     inline     >] slab_free kernel/mm/slub.c:2805
[<      none      >] kmem_cache_free+0x2a0/0x330 kernel/mm/slub.c:2814
[<     inline     >] net_free kernel/net/core/net_namespace.c:341
[<      none      >] net_drop_ns+0x67/0x80 kernel/net/core/net_namespace.c:348
[<      none      >] cleanup_net+0x4e5/0x600 kernel/net/core/net_namespace.c:448
[<      none      >] process_one_work+0x794/0x1440 kernel/kernel/workqueue.c:2036
[<      none      >] worker_thread+0xdb/0xfc0 kernel/kernel/workqueue.c:2170
[<      none      >] kthread+0x23f/0x2d0 kernel/drivers/block/aoe/aoecmd.c:1303
[<      none      >] ret_from_fork+0x3f/0x70 kernel/arch/x86/entry/entry_64.S:468
INFO: Slab 0xffffea0001938800 objects=3 used=0 fp=0xffff880064e20000
flags=0x5fffc0000004080
INFO: Object 0xffff880064e20000 @offset=0 fp=0xffff880064e24200

CPU: 1 PID: 11581 Comm: syz-executor Tainted: G    B           4.4.0+
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 00000000ffffffff ffff8800662c7790 ffffffff8292049d ffff88003e36a300
 ffff880064e20000 ffff880064e20000 ffff8800662c77c0 ffffffff816f2054
 ffff88003e36a300 ffffea0001938800 ffff880064e20000 0000000000000000
Call Trace:
 [<     inline     >] __dump_stack kernel/lib/dump_stack.c:15
 [<ffffffff8292049d>] dump_stack+0x6f/0xa2 kernel/lib/dump_stack.c:50
 [<ffffffff816f2054>] print_trailer+0xf4/0x150 kernel/mm/slub.c:654
 [<ffffffff816f875f>] object_err+0x2f/0x40 kernel/mm/slub.c:661
 [<     inline     >] print_address_description kernel/mm/kasan/report.c:138
 [<ffffffff816fb0c5>] kasan_report_error+0x215/0x530 kernel/mm/kasan/report.c:236
 [<     inline     >] kasan_report kernel/mm/kasan/report.c:259
 [<ffffffff816fb4de>] __asan_report_load8_noabort+0x3e/0x40 kernel/mm/kasan/report.c:280
 [<     inline     >] ? ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ? ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ? ppp_pernet kernel/drivers/net/ppp/ppp_generic.c:293
 [<ffffffff83ad6f26>] ? ppp_unregister_channel+0xe6/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<ffffffff83ae18f3>] ppp_asynctty_close+0xa3/0x130 kernel/drivers/net/ppp/ppp_async.c:241
 [<ffffffff83ae1850>] ? async_lcp_peek+0x5b0/0x5b0 kernel/drivers/net/ppp/ppp_async.c:1000
 [<ffffffff82c33239>] tty_ldisc_close.isra.1+0x99/0xe0 kernel/drivers/tty/tty_ldisc.c:478
 [<ffffffff82c332c0>] tty_ldisc_kill+0x40/0x170 kernel/drivers/tty/tty_ldisc.c:744
 [<ffffffff82c34943>] tty_ldisc_release+0x1b3/0x260 kernel/drivers/tty/tty_ldisc.c:772
 [<ffffffff82c1ef21>] tty_release+0xac1/0x13e0 kernel/drivers/tty/tty_io.c:1901
 [<ffffffff82c1e460>] ? release_tty+0x320/0x320 kernel/drivers/tty/tty_io.c:1688
 [<ffffffff8174de36>] __fput+0x236/0x780 kernel/fs/file_table.c:208
 [<ffffffff8174e405>] ____fput+0x15/0x20 kernel/fs/file_table.c:244
 [<ffffffff813595ab>] task_work_run+0x16b/0x200 kernel/kernel/task_work.c:115
 [<     inline     >] exit_task_work kernel/include/linux/task_work.h:21
 [<ffffffff81307105>] do_exit+0x8b5/0x2c60 kernel/kernel/exit.c:750
 [<ffffffff813fdd20>] ? debug_check_no_locks_freed+0x290/0x290 kernel/kernel/locking/lockdep.c:4123
 [<ffffffff81306850>] ? mm_update_next_owner+0x6f0/0x6f0 kernel/kernel/exit.c:357
 [<ffffffff813215e6>] ? __dequeue_signal+0x136/0x470 kernel/kernel/signal.c:550
 [<ffffffff8132067b>] ? recalc_sigpending_tsk+0x13b/0x180 kernel/kernel/signal.c:145
 [<ffffffff81309628>] do_group_exit+0x108/0x330 kernel/kernel/exit.c:880
 [<ffffffff8132b9d4>] get_signal+0x5e4/0x14f0 kernel/kernel/signal.c:2307
 [<     inline     >] ? kretprobe_table_lock kernel/kernel/kprobes.c:1113
 [<ffffffff8151d355>] ? kprobe_flush_task+0xb5/0x450 kernel/kernel/kprobes.c:1158
 [<ffffffff8115f7d3>] do_signal+0x83/0x1c90 kernel/arch/x86/kernel/signal.c:712
 [<ffffffff8151d2a0>] ? recycle_rp_inst+0x310/0x310 kernel/include/linux/list.h:655
 [<ffffffff8115f750>] ? setup_sigcontext+0x780/0x780 kernel/arch/x86/kernel/signal.c:165
 [<ffffffff81380864>] ? finish_task_switch+0x424/0x5f0 kernel/kernel/sched/core.c:2692
 [<     inline     >] ? finish_lock_switch kernel/kernel/sched/sched.h:1099
 [<ffffffff81380560>] ? finish_task_switch+0x120/0x5f0 kernel/kernel/sched/core.c:2678
 [<     inline     >] ? context_switch kernel/kernel/sched/core.c:2807
 [<ffffffff85d794e9>] ? __schedule+0x919/0x1bd0 kernel/kernel/sched/core.c:3283
 [<ffffffff81003901>] exit_to_usermode_loop+0xf1/0x1a0 kernel/arch/x86/entry/common.c:247
 [<     inline     >] prepare_exit_to_usermode kernel/arch/x86/entry/common.c:282
 [<ffffffff810062ef>] syscall_return_slowpath+0x19f/0x210 kernel/arch/x86/entry/common.c:344
 [<ffffffff85d88022>] int_ret_from_sys_call+0x25/0x9f kernel/arch/x86/entry/entry_64.S:281
Memory state around the buggy address:
 ffff880064e21680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff880064e21780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff880064e21800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Fixes: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2")
Reported-by: Baozeng Ding <sploving1@gmail.com>
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Bug 1797728

Change-Id: I5e04b3c178b408af0412f635714b4bb3d2ff6a44
Signed-off-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-on: http://git-master/r/1214545
GVS: Gerrit_Virtual_Submit
(cherry picked from commit 493649df1bec9216bfd9ecb0430e5bfbaac61b2b)
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1226951
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoUPSTREAM: cdc_ncm: do not call usbnet_link_change from cdc_ncm_bind
Bjørn Mork [Fri, 8 Jul 2016 18:14:51 +0000]
UPSTREAM: cdc_ncm: do not call usbnet_link_change from cdc_ncm_bind

(cherry pick from commit 4d06dd537f95683aba3651098ae288b7cbff8274)

usbnet_link_change will call schedule_work and should be
avoided if bind is failing. Otherwise we will end up with
scheduled work referring to a netdev which has gone away.

Instead of making the call conditional, we can just defer
it to usbnet_probe, using the driver_info flag made for
this purpose.

Fixes: 8a34b0ae8778 ("usbnet: cdc_ncm: apply usbnet_link_change")
Reported-by: Andrey Konovalov <andreyknvl@gmail.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Change-Id: Id9a6d02bdd98bf495d26595cf2cc90e480746186
Bug: 28744625
Bug 1797728
(cherry picked from commit e0328ff123d1085b05f4e8b0ccde9c9e5203b61c)
Signed-off-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-on: http://git-master/r/1213267
GVS: Gerrit_Virtual_Submit

(cherry picked from commit e69933605e81838544cceecfa44b1c86010b5287)
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Change-Id: I67daf32a73a434f3703c00646c6e2f79dc8d63c0
Reviewed-on: http://git-master/r/1221320
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoiio: imu: tsfw_icm20628: Axis transform + frag fix
Spencer Sutterlin [Tue, 18 Oct 2016 03:31:53 +0000]
iio: imu: tsfw_icm20628: Axis transform + frag fix

Transform the axes orientations with nvs matrix

Pass non-sync fragmented data to NVS

And several cleanup fixes

Bug 1828167
Bug 1828048

Change-Id: I22a4172863d72cb21105b59a5b22e49ab89d175f
Signed-off-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Reviewed-on: http://git-master/r/1238205
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agousb: gadget: ucd: reduce Data Contact Detect timeout value
Rakesh Babu Bodla [Fri, 14 Oct 2016 12:18:28 +0000]
usb: gadget: ucd: reduce Data Contact Detect timeout value

Reduce DCD timeout to 400ms to meet charging compliance
requirements.

Bug 200190604

Change-Id: If62c4ca1c6dc0fc0f8aba65fe7cea3d1a80f4118
Signed-off-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/1236698
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agoarm64: dts: HE: get vbus notification from bq chip
Rakesh Babu Bodla [Fri, 14 Oct 2016 12:14:46 +0000]
arm64: dts: HE: get vbus notification from bq chip

Get the vbus notifications directly from bq charger
chip driver to reduce the time between the vbus detection
and usb charger detection code.

Bug 200190604

Change-Id: Icc9ae854342159d43726b96a864a3a2c5d6981a6
Signed-off-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/1236697
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

2 years agousb: gadget: tegra: fix DCD field and PD_CHG
Rakesh Babu Bodla [Thu, 13 Oct 2016 11:49:52 +0000]
usb: gadget: tegra: fix DCD field and PD_CHG

Fixes below issues.
1. Correct DCD debounce time configuration field.
2. Correct checks in tegra21x_usb_vbus_pad_protection.
3. Set PD_CHG during powering off pad.

Bug 200243453

Change-Id: Ic7a1ad523f96452d5cd47a6bf7f70bd449e16205
Signed-off-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/1235987
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

2 years agonetfilter: x_tables: fix unconditional helper
Florian Westphal [Tue, 22 Mar 2016 17:02:52 +0000]
netfilter: x_tables: fix unconditional helper

Ben Hawkes says:

 In the mark_source_chains function (net/ipv4/netfilter/ip_tables.c) it
 is possible for a user-supplied ipt_entry structure to have a large
 next_offset field. This field is not bounds checked prior to writing a
 counter value at the supplied offset.

Problem is that mark_source_chains should not have been called --
the rule doesn't have a next entry, so its supposed to return
an absolute verdict of either ACCEPT or DROP.

However, the function conditional() doesn't work as the name implies.
It only checks that the rule is using wildcard address matching.

However, an unconditional rule must also not be using any matches
(no -m args).

The underflow validator only checked the addresses, therefore
passing the 'unconditional absolute verdict' test, while
mark_source_chains also tested for presence of matches, and thus
proceeeded to the next (not-existent) rule.

Unify this so that all the callers have same idea of 'unconditional rule'.

Reported-by: Ben Hawkes <hawkes@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Bug 1797728

Change-Id: I7884811fd948fed4e18f1a0d38792bce4b397ed9
Signed-off-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-on: http://git-master/r/1214549
GVS: Gerrit_Virtual_Submit
(cherry picked from commit 9540a626609d490cd0fff4ae97ea713f5806ddd7)
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1226931
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoarm64: boot: dts: Add top dts for Darcy a07
Daniel Fu [Mon, 29 Aug 2016 10:43:28 +0000]
arm64: boot: dts: Add top dts for Darcy a07

- Add A07 Top dts
- Enable AOTAG
- Disable external thermal sensor
- Disable Tboard/Tdiode
- Add Thermal Trips/Maps to AOATG thermal-zones for CPU/GPU/CORE/EDP

Bug 1646378
Bug 200232561

Change-Id: I8a2148e9ea541084705f516f073891b03a0e98c6
Signed-off-by: Daniel Fu <danifu@nvidia.com>
Reviewed-on: http://git-master/r/1209126
(cherry picked from commit 5bbd3faf7033031f4f6101d5d7a9132714d1cb20)
Reviewed-on: http://git-master/r/1212924
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agosmp: print more useful debug info upon receiving IPI on an offline CPU
Sai Gurrappadi [Fri, 23 Oct 2015 00:57:43 +0000]
smp: print more useful debug info upon receiving IPI on an offline CPU

Manual backport of upstream commit: a219ccf4637396a2392bfbec7c12acbfe2b06b46

Bug 200107576

Change-Id: I6589871e66c4ed5a435972205728fa59eb723b8a
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/821759
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Tested-by: Vinayak Pane <vpane@nvidia.com>

2 years agoiio: Fix multi-link device removal
Erik Lilliebjerg [Fri, 14 Oct 2016 22:12:10 +0000]
iio: Fix multi-link device removal

- Create a dynamic device_type structure for drivers that use multiple links
  per device.

Bug 1824808

Change-Id: I7f803b326368f7e212c2b61cd2f76d8f2dea274a
Signed-off-by: Erik Lilliebjerg <elilliebjerg@nvidia.com>
Reviewed-on: http://git-master/r/1237017
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agousb: gadget: tegra: add apple charger detection
Rakesh Babu Bodla [Mon, 29 Dec 2014 11:58:10 +0000]
usb: gadget: tegra: add apple charger detection

Add detection of different apple charger 5W,10W,12W
using XUSB pad for XUSB device mode.

Bug 200054906

Change-Id: I4b1b77940e2133c3faf14ec91fa76b87c89693c1
Signed-off-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/1231871
Reviewed-by: Mark Kuo <mkuo@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

2 years agoarm64: t210: Enable TSFW_ICM
Spencer Sutterlin [Fri, 14 Oct 2016 02:12:57 +0000]
arm64: t210: Enable TSFW_ICM

Bug 1807528

Change-Id: I1ded0bb719459f1ae5bf8ffe582d8a20df385deb
Signed-off-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Reviewed-on: http://git-master/r/1228098
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoThunderstrike 9-axis sensor
Spencer Sutterlin [Thu, 25 Aug 2016 02:06:40 +0000]
Thunderstrike 9-axis sensor

hid: jarvis: TS sensor parsing

iio: imu: tsfw_icm20628: Initial stub driver

Fragmentation - working on syn packets

Dynamic stuff
- Add DYNAMIC_SENSOR_MASK flag
- Add nvs_dsm DT node

Bug 1807528

Change-Id: I54d9d8615790bd90f343da57272cb332ab8bf165
Signed-off-by: Spencer Sutterlin <ssutterlin@nvidia.com>
Reviewed-on: http://git-master/r/1228099
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agodts: include multiple emc table for darcy p2894
Martin Gao [Wed, 3 Aug 2016 05:20:21 +0000]
dts: include multiple emc table for darcy p2894

- darcy POR has two different memory hardware modules. To achieve single
sofeware SKU, emc tables for both types need to be included here.
- add print in emc dt parser to indicate which emc table is selected.

Bug 1772578

Change-Id: I6dd74812bf7a80580ef248e68c6e0b869b9f4d1b
Signed-off-by: Martin Gao <marting@nvidia.com>
Reviewed-on: http://git-master/r/1234874
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agobcmdhd_88: improve data integrity of nv_logger
Bibhay Ranjan [Mon, 26 Sep 2016 13:45:15 +0000]
bcmdhd_88: improve data integrity of nv_logger

Bug 200238576

Change-Id: I8a8ae9d66f4918fadb7107cd41de3c1670a4a4b3
Signed-off-by: Bibhay Ranjan <bibhayr@nvidia.com>
Reviewed-on: http://git-master/r/1227051
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>

2 years agobcmdhd_88: add DHD_ERROR for nv_logger
Bibhay Ranjan [Tue, 6 Sep 2016 09:09:26 +0000]
bcmdhd_88: add DHD_ERROR for nv_logger

All the logs generated via DHD_ERROR and will
now be written into nv_logger

Bug 200239493

Change-Id: Ibbbaadb397f83be2f04e8e7119da3ede44627547
Signed-off-by: Bibhay Ranjan <bibhayr@nvidia.com>
Reviewed-on: http://git-master/r/1215476
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>

2 years agotegra: dc: add support for sink capabilties ioctl
Arun Swain [Thu, 6 Oct 2016 19:57:24 +0000]
tegra: dc: add support for sink capabilties ioctl

Provides an interface to pass on sink capabilties
to user space. Even though the struct in scalable
to various types of capabilties, currently it
has support for hdr capability only. These
capabilty info comes via edid only as of today.
The plan is to provide capabilty info for dsi
panels via device tree.

Bug 1810547

Change-Id: I302efe3f6d79f6f0730668d06e6cdccd5a4cb2f1
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: http://git-master/r/1232704
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
Tested-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>

2 years agotegra: dc: ext: Add support for disp capabilities
Arun Swain [Wed, 5 Oct 2016 02:58:01 +0000]
tegra: dc: ext: Add support for disp capabilities

Add support for getting display capabilities from
kernel. The struct adds new data structures to be
used for the same. This approach attends to the
following needs:
- Can be used to pass-on an array of multiple
capabilities of different types with the same ioctl.
- Each of these capabilities will have it's own
struct type and should be clearly mentioned by the
"data_type" field.

Bug 1810547

Change-Id: I315fd9e06f6cc071197376eeac1c14638e8ae523
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: http://git-master/r/1231678
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
Tested-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>

2 years agoARM64: tegra21: increase max vpr to 750MB for foster
Sri Krishna chowdary [Mon, 26 Sep 2016 09:58:31 +0000]
ARM64: tegra21: increase max vpr to 750MB for foster

The worst case requirement for vpr is 750 MB as we
support upto 4K resolution.

bug 1787861

Change-Id: I902bd47c953cbfdb758c23f8a17aefc769f7b1f0
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1226940
(cherry picked from commit c712f49ab478a21903cd6c48c27eadd38ea710e7)
Reviewed-on: http://git-master/r/1229220
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoplatform: tegra: Ensure driver init prior to use
Sai Gurrappadi [Wed, 9 Dec 2015 17:49:19 +0000]
platform: tegra: Ensure driver init prior to use

The cpufreq platform driver has to finish initialization before it can
call into cpufreq core. To that end, use a flag to indicate when the
driver has finished initializing. This new flag is then used to bail
out of any calls that happen prior to driver init.

Bug 200159525

Change-Id: I32e26830f09a720a58b5c43de969b639dd33f020
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/921882
(cherry picked from commit 890e7fb164fcfa4c22eee7fc7216b2aa67008fa9)
(cherry picked from commit c0f94f735da51bdd94429e8f8e3b4da225a26e03)
Reviewed-on: http://git-master/r/843650
Tested-by: Vaibhav Shinde <vashinde@nvidia.com>
Reviewed-by: Gagan Grover <ggrover@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>

2 years agoRevert "HACK Revert "ARM: 7405/1: kexec: call platform_cpu_kill on the killer rather...
Nicolin Chen [Thu, 29 Sep 2016 01:37:10 +0000]
Revert "HACK Revert "ARM: 7405/1: kexec: call platform_cpu_kill on the killer rather than the victim""

This reverts commit f207c657eabbc231bddfe3fa72a98de16eb2d2b0.

The HACK Revert moved the platform_cpu_kill() back to the "victim"
from the "killer". However, the platform_cpu_kill() is a function
calling tegra_cpu_kill() which is supposed to run on the "killer"
to poll the status of the "victim" via AFFINITY_INFO command.

Meanwhile, the tegra_cpu_kill calls msleep(), so putting it into
an IRQ context results in "BUG: scheduling while atomic".

So we revert this HACK since it doesn't break reboot any more.

Bug 200224278
Bug 1808023

Change-Id: Iaa63f1a848378df47d3f76821d641ed187983183
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: http://git-master/r/1228810
GVS: Gerrit_Virtual_Submit
Tested-by: Vaibhav Shinde <vashinde@nvidia.com>
Reviewed-by: Vaibhav Shinde <vashinde@nvidia.com>
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>

2 years agoBuffer audio packets before pcm_open
Ankita Garg [Thu, 8 Sep 2016 20:56:28 +0000]
Buffer audio packets before pcm_open

Start buffering audio packets from TS even before
MIC ON request is sent from the host to TS. This
change reduces the response time for voice search
in the oder of 100ms

Bug 1811059

Change-Id: Ic336726363337a37ce0103335f14fb7ca54cc7a0
Signed-off-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-on: http://git-master/r/1217350
(cherry picked from commit 68d717756250c4962f4249c84bb4f766b86cc930)
Reviewed-on: http://git-master/r/1228532
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

2 years agoRevert "net: show cmdline in /proc/net/{tcp udp tcp6 udp6}"
Harry Lin [Mon, 26 Sep 2016 03:41:04 +0000]
Revert "net: show cmdline in /proc/net/{tcp udp tcp6 udp6}"

This reverts commit db969bbf31dbb79c0f06497f083b4bad16ad88c7.

Bug 1185001
Bug 200236925

Change-Id: I1ec6614c87e17d734b5ce850aa90754376c42f12
Signed-off-by: Harry Lin <harlin@nvidia.com>
Reviewed-on: http://git-master/r/1226759
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Om Prakash Singh <omp@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>

2 years agoRevert "arm64:mm: rm swtch to ASID0 in ctxt swtch"
Rohit Khanna [Wed, 7 Sep 2016 20:00:23 +0000]
Revert "arm64:mm: rm swtch to ASID0 in ctxt swtch"

This reverts commit 584b60200b8bdcc895c8edacb94f48db5929f70a.

Bug 1814735

Change-Id: Ibe5b217521b77fa5799400b9460182e3329e1779
Signed-off-by: Rohit Khanna <rokhanna@nvidia.com>
Reviewed-on: http://git-master/r/1216501
(cherry picked from commit 04c8d66d61e15198b95d54672b2f2fe047d180b3)
Reviewed-on: http://git-master/r/1222202
Tested-by: Mithun Maragiri <mmaragiri@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
GVS: Gerrit_Virtual_Submit

2 years agoirqchip: gic: use CPU_PM only when registering
Ajay Nandakumar [Mon, 22 Aug 2016 06:00:27 +0000]
irqchip: gic: use CPU_PM only when registering

Use CPU_PM only when registering the cpu_notifier rather than using
the config across the functions since these are required by AGIC.

Bug 1747157

Change-Id: Ic924ce41b73a866215d5d668c9f025893df1d7fb
(cherry picked from commit d311f245859432d334e52f9ae9c56d0f639bfa72)
Reviewed-on: http://git-master/r/1206650
(cherry picked from commit 3f9a85d2d518893f340cf9dcc02e66c374491011)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: http://git-master/r/1231758
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>

2 years agoARM: configs: tegra12: set ARCH_MMAP_RND_BITS to 16
Sri Krishna chowdary [Fri, 2 Sep 2016 09:53:14 +0000]
ARM: configs: tegra12: set ARCH_MMAP_RND_BITS to 16

bug 200226998

Change-Id: I3ada385947e6bd85c72297d0f773e96e133b00d0
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1213664
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agomm: ASLR: use get_random_long()
Sri Krishna chowdary [Thu, 25 Aug 2016 09:28:05 +0000]
mm: ASLR: use get_random_long()

Replace calls to get_random_int() followed by a cast to (unsigned long)
with calls to get_random_long().  Also address shifting bug which, in
case of x86 removed entropy mask for mmap_rnd_bits values > 31 bits.

bug 200226998

Signed-off-by: Daniel Cashman <dcashman@android.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nick Kralevich <nnk@google.com>
Cc: Jeff Vander Stoep <jeffv@google.com>
Cc: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from 5ef11c35ce86b94bfb878b684de4cdaf96f54b2f)
Change-Id: I6fecfc781a2de256d50f9f1e06cadaf97666b294
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1207748
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agodrivers: char: random: add get_random_long()
Daniel Cashman [Fri, 26 Feb 2016 23:19:34 +0000]
drivers: char: random: add get_random_long()

Commit d07e22597d1d ("mm: mmap: add new /proc tunable for mmap_base
ASLR") added the ability to choose from a range of values to use for
entropy count in generating the random offset to the mmap_base address.

The maximum value on this range was set to 32 bits for 64-bit x86
systems, but this value could be increased further, requiring more than
the 32 bits of randomness provided by get_random_int(), as is already
possible for arm64.  Add a new function: get_random_long() which more
naturally fits with the mmap usage of get_random_int() but operates
exactly the same as get_random_int().

Also, fix the shifting constant in mmap_rnd() to be an unsigned long so
that values greater than 31 bits generate an appropriate mask without
overflow.  This is especially important on x86, as its shift instruction
uses a 5-bit mask for the shift operand, which meant that any value for
mmap_rnd_bits over 31 acts as a no-op and effectively disables mmap_base
randomization.

Finally, replace calls to get_random_int() with get_random_long() where
appropriate.

This patch (of 2):

Add get_random_long().

bug 200226998

Signed-off-by: Daniel Cashman <dcashman@android.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nick Kralevich <nnk@google.com>
Cc: Jeff Vander Stoep <jeffv@google.com>
Cc: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ec9ee4acd97c0039a61c0ae4f12705767ae62153)
Change-Id: Id432068ef328af7770f3f44ff72a6907b1cac8ac
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1207747
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agomm: expose arch_mmap_rnd when available
Kees Cook [Tue, 14 Apr 2015 22:48:00 +0000]
mm: expose arch_mmap_rnd when available

When an architecture fully supports randomizing the ELF load location,
a per-arch mmap_rnd() function is used to find a randomized mmap base.
In preparation for randomizing the location of ET_DYN binaries
separately from mmap, this renames and exports these functions as
arch_mmap_rnd(). Additionally introduces CONFIG_ARCH_HAS_ELF_RANDOMIZE
for describing this feature on architectures that support it
(which is a superset of ARCH_BINFMT_ELF_RANDOMIZE_PIE, since s390
already supports a separated ET_DYN ASLR from mmap ASLR without the
ARCH_BINFMT_ELF_RANDOMIZE_PIE logic).

bug 200226998

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Hector Marco-Gisbert <hecmargi@upv.es>
Cc: Russell King <linux@arm.linux.org.uk>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: "David A. Long" <dave.long@linaro.org>
Cc: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Arun Chandran <achandran@mvista.com>
Cc: Yann Droneaud <ydroneaud@opteya.com>
Cc: Min-Hua Chen <orca.chen@gmail.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Alex Smith <alex@alex-smith.me.uk>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: Vineeth Vijayan <vvijayan@mvista.com>
Cc: Jeff Bailey <jeffbailey@google.com>
Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Behan Webster <behanw@converseincode.com>
Cc: Ismael Ripoll <iripoll@upv.es>
Cc: Jan-Simon Mller <dl9pf@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 2b68f6caeac271620cd2f9362aeaed360e317df0)
Change-Id: I1e376446aa6fa130f95be59198a59e33de99cb64
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1207743
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

2 years agoarm64: standardize mmap_rnd() usage
Kees Cook [Tue, 14 Apr 2015 22:47:48 +0000]
arm64: standardize mmap_rnd() usage

In preparation for splitting out ET_DYN ASLR, this refactors the use of
mmap_rnd() to be used similarly to arm and x86.  This additionally
enables mmap ASLR on legacy mmap layouts, which appeared to be missing
on arm64, and was already supported on arm.  Additionally removes a
copy/pasted declaration of an unused function.

bug 200226998

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit dd04cff1dceab18226853b555cf07914648a235f)
Change-Id: I058079c52e29888950af0e88f4547254f8cff176
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1207742
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>