gpu: ion: add explicit sync ioctl (not implemented)
timekeeping: fix 32-bit overflow in get_monotonic_boottime

get_monotonic_boottime adds three nanonsecond values stored
in longs, followed by an s64.  If the long values are all
close to 1e9 the first three additions can overflow and
become negative when added to the s64.  Cast the first
value to s64 so that all additions are 64 bit.

Change-Id: Ic996d8b6fbef0b72f2d027b0d8ef5259b5c1a540
Signed-off-by: Colin Cross <ccross@android.com>
net: ipv6: Don't purge default router if accept_ra=2

Setting net.ipv6.conf.<interface>.accept_ra=2 causes the kernel
to accept RAs even when forwarding is enabled. However, enabling
forwarding purges all default routes on the system, breaking
connectivity until the next RA is received. Fix this by not
purging default routes on interfaces that have accept_ra=2.

Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Iliyan Malchev <malchev@google.com>
wcnss: clk_prepare_enable before wcnss_cold_boot_done

Signed-off-by: Iliyan Malchev <malchev@google.com>
mako: debug: Support the lge crash handler in subsystem_restart

Support the lge crash handler in subsystem_restart. And use WARN instead
of panic.

Change-Id: Id0cfcf5825c5720a23737f07f9dcb5c28c711127
msm: subsystem_restart: restart the subsystem independently

Restart the subsystem independently instead of SOC reset.

Change-Id: I856f4a52ae4da837117cc8f0fe7c3515f5323558
mako: debug: disable the lge crash handler

lge crash handler is enabled only if download_mode = 1.
Disable the lge crash handler in production

if you want to use the lge crash handler, do like the below
echo 1 > /sys/module/restart/parameters/download_mode

Change-Id: If0e9412cacae8c0f6870c7ec59094cc6925123c9
Revert "mako_defconfig: disable the LGE crash handler"

We need the lge crash handler for boot reason. it marks the magic code
for boot reason. If disabled, we can't detect the boot reason correctly.

This reverts commit 7623f46ce5c3c4bfd100f27e8c07b4509e98240e.

Change-Id: I82227e37925b75d64c38afc1a74261f15adcc5a1
Revert "wcnss: Add support for nv bin download at coldboot"

This reverts commit 9f5732533180512df8f122b86412e074f88625c5.

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

Conflicts:
	drivers/net/wireless/wcnss/wcnss_riva.c
prima: release v3.2.2.2

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

	84e056c wlan: Release 3.2.2.2
	18064b9 wlan: update WCNSS_cfg.dat
	77ee64d wlan: (1) fix issues encounter when building with GCC 4.7
	352bd47 wlan: cs release 3.2.0.75a
	d1a02f9 wlan: Fixing copyright issue with Augment ioctl WLAN_PRIV_SET_MCBC_FILTER
	f2d27a6 wlan: cs release 3.2.0.75
	8da16ff Add Null check for psessionEntry in MTRACE code
	5ed2cf6 wlan: Fix for SAP start failure after GO turnoff.
	8d2f188 wlan: cs release 3.2.0.74
	edbcce0 Integrate memory corruption fixes from windows core stack
	4abca74 Fix for the crash at the time of driver unload
	5bd90ee Increase the maximum TDLS peer connections
	0de5997 Remove TDLS connected peers on Missed Beacon Indication
	8bc168d Fix multiple acquires for the same mutex lock and data stall.
	263ccc9 Not to do multiple setups during setup negotiation with same peer
	f9e2454 Fix to enhance the mutex lock acquire
	3dc8765 wlan: cs release 3.2.0.73
	a21df9e Fix WLAN connection issues with BTC
	35fcf02 wlan: sme: remove obsolete "INTEGRATED_SOC" featurization
	4a844a0 wlan: mac: remove obsolete "INTEGRATED_SOC" featurization
	2d79528 wlan: sys: remove obsolete "INTEGRATED_SOC" featurization
	d901a10 wlan: svc: remove obsolete "INTEGRATED_SOC" featurization
	f7c43d6 wlan: sap: remove obsolete "INTEGRATED_SOC" featurization
	e3876c5 wlan: tl: remove obsolete "INTEGRATED_SOC" featurization
	5d9e3c7 wlan: Fixing issue with Remove access to GPL only APIs
	c0e741d wlan: cs release 3.2.0.72
	872cde3 Fix for device not coming to BMPS after teardown TDLS link
	89cecd7 TDLS mgmt.frame encapsulated to data frame uses WDA/DXE MGMT path
	bd7ae7d wlan: dot11f: Fix to parse the received RIC IE appropriately
	deaec4a wlan: cs release 3.2.0.71
	0284fd7 wlan: Remove obsolete USB and SDIO conditional code
	0eb1e22 wlan: update Listen Interval with change in multisession
	a9e9b45 wlan: add a counter for RX free packets
	491ee19 wlan: bap: remove obsolete "INTEGRATED_SOC" featurization
	769e952 wlan: move mcast list to adapter context
	1a18f3b wlan: FirstSet of Run Time Config variables
	5618b49 wlan: Add SSR protection to WEXT APIs
	a4014df wlan: (2)Fixing issue with WCNSS_qcom_cfg.ini values for specific OEM
	2a693a8 wlan: Fixing issue with WCNSS_qcom_cfg.ini values for specific OEM
	832b99d wlan: cs release 3.2.0.70
	f249fcd Update WCNSS_qcom_cfg.ini values for specific OEM
	d0f91d1 Fix P2P connection failure
	7cea016 wlan: Fixed issue in handling of EAPOL keys
	b798dc1 wlan: Fix for ARP offload issue
	225a1b4 wlan: Augment ioctl WLAN_PRIV_SET_MCBC_FILTER
	6e2d2a4 wlan: cs release 3.2.0.69
	2b84761 P2P : Fix related to P2P connection reliability improvement
	a2e0214 TDLS: feature enhancement for discovery and teardown
	87d2686 wlan: Enable ARP offload config
	888e289 wlan: fix issues encounter when building with GCC 4.7
	d61fc9f wlan: cs release 3.2.0.68
	7156822 wlan: qnx awareness to corestack
	535117a wlan : Fast transition (11r)
	c1c88ff wlan: CSR should only indicate lostlink once
	c748428 wlan: MAC context set to NULL in HDD context after driver shutdown in SSR
	af6c227 wlan: cs release 3.2.0.67
	bac0b58 Revert "wlan: Abort scan on receiving  remain_on_channel request"
	bc57cf3 wlan: Fix for sending probe request at 6 MBps in WifiDirect
	68e2b1c wlan: Array out of bound due to invalid session Id
	77b39ec wlan: do not retry pre-auth after response with status 17.
	9ddfa02 wlan: Remove access to GPL only APIs
	1d657ea wlan: cs release 3.2.0.66
	8e5188e Fix to stop doing discovery after maximum retry
	36166bc wlan: cs release 3.2.0.65
	41e53fd wlan: Set TxBF csn value based on ini configuration.
	35d901d Send unicast deauth when GO terminates
	75d87b1 wlan: prevent timer callback after unload during SSR
	313daf4 wlan: cs release 3.2.0.64
	5c68731 Fix to send TDLS frames at basic rates
	d8051e4 Register TDLS peer to TL at link enable
	051a555 Fix for Multiple Invitation pop window seen during P2P connection
	178aedb wlan: Define flag WLAN_OPEN_SOURCE for the open source driver
	74b767b wlan: Fixing comments
	2dc03b9 wlan: removing files that were accidentally submitted
	4fe5c95 wlan: cs release 3.2.0.63
	2c2b281 Fix to not flood TDLS Discovery Request frames
	08a1d1c wlan: Remove obsolete LIM_TIMER_EXPIRY_LIST support
	1969045 wlan: remove obsolete RTL8652 and LX5280 conditional code
	aea6e42 Fix the conflicts of cfg.txt autogenerated files
	0d293c4 wlan: cs release 3.2.0.62
	fa97d49 Fix to delete all connected tdls peer
	f251c0c Fix TDLS link rate to operate with 11AC AP
	961f80a wlan: cs release 3.2.0.61
	944580a Disable LDPC in sta mode when AP is TXBF capable
	1aca8dc wlan: Initialization of structure variable
	da382fb wlan: Multiple Memory Leaks @File wlan_qct_wdi.c
	79d1506 wlan: fix ioctl interfaces to get driver/firmware version
	8811415 wlan: Do not reference userspace memory in the driver
	15fb73f wlan: Set correct CB mode for channel 165.
	68940f7 wlan: remove obsolete phyGlobal.h
	680f7b0 wlan: cs release 3.2.0.60
	6b6ec95 Fix vos_assert and kernel panic during wlan_exit
	7a6d70b wlan:Debugging Log Enhancement and Log CleanUp
	21930fe Padding up to 46 octet for TDLS setup confirm
	b92ff61 Remove packet filter dependency on connected state
	11fbd74 wlan: cs release 3.2.0.59
	5758f30 wlan: MTRACE LFR Debug Enhancements.
	15d08b7 wlan: Fix for P2P connection failure in 5GHz Auto GO
	a1645f1 wlan: cs release 3.2.0.58
	aed5e67 wlan: Fix for SAP/P2P GO to come up on configured channel
	5d2067e Quarky read reg support
	83fe58c wlan: Fixes to support 802.11K functionality
	1d21b6d WLAN: Update cfg.txt file so that it is in sync with the auto generated .h files
	fee3fe5 wlan: cs release 3.2.0.57A
	756a8e5 Send teardown with correct address.
	111254e wlan: cs release 3.2.0.57
	9b553eb PRIMA: Avoiding memory leak while setting dynamic MCBC filter.
	9321800 wlan: Fix for address scheme for p2p device administrated.

Signed-off-by: Iliyan Malchev <malchev@google.com>
ptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up()

Cleanup and preparation for the next change.

signal_wake_up(resume => true) is overused. None of ptrace/jctl callers
actually want to wakeup a TASK_WAKEKILL task, but they can't specify the
necessary mask.

Turn signal_wake_up() into signal_wake_up_state(state), reintroduce
signal_wake_up() as a trivial helper, and add ptrace_signal_wake_up()
which adds __TASK_TRACED.

This way ptrace_signal_wake_up() can work "inside" ptrace_request()
even if the tracee doesn't have the TASK_WAKEKILL bit set.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL

putreg() assumes that the tracee is not running and pt_regs_access() can
safely play with its stack.  However a killed tracee can return from
ptrace_stop() to the low-level asm code and do RESTORE_REST, this means
that debugger can actually read/modify the kernel stack until the tracee
does SAVE_REST again.

set_task_blockstep() can race with SIGKILL too and in some sense this
race is even worse, the very fact the tracee can be woken up breaks the
logic.

As Linus suggested we can clear TASK_WAKEKILL around the arch_ptrace()
call, this ensures that nobody can ever wakeup the tracee while the
debugger looks at it.  Not only this fixes the mentioned problems, we
can do some cleanups/simplifications in arch_ptrace() paths.

Probably ptrace_unfreeze_traced() needs more callers, for example it
makes sense to make the tracee killable for oom-killer before
access_process_vm().

While at it, add the comment into may_ptrace_stop() to explain why
ptrace_stop() still can't rely on SIGKILL and signal_pending_state().

Reported-by: Salman Qazi <sqazi@google.com>
Reported-by: Suleiman Souhlal <suleiman@google.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>

Conflicts:
	arch/x86/kernel/step.c
wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED task

wake_up_process() should never wakeup a TASK_STOPPED/TRACED task.
Change it to use TASK_NORMAL and add the WARN_ON().

TASK_ALL has no other users, probably can be killed.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mako_defconfig: enable SELinux and its dependencies

	Originally from
		https://bitbucket.org/seandroid/kernel-exynos/commits/1e7559d57879324a46afeee342faa6c1

Signed-off-by: Iliyan Malchev <malchev@google.com>
Add security hooks to binder and implement the hooks for SELinux.

Add security hooks to the binder and implement the hooks for SELinux.
The security hooks enable security modules such as SELinux to implement
controls over binder IPC.  The security hooks include support for
controlling what process can become the binder context manager
(binder_set_context_mgr), controlling the ability of a process
to invoke a binder transaction/IPC to another process (binder_transaction),
controlling the ability a process to transfer a binder reference to
another process (binder_transfer_binder), and controlling the ability
of a process to transfer an open file to another process (binder_transfer_file).

This support is used by SE Android, http://selinuxproject.org/page/SEAndroid.

Change-Id: I9a64a87825df2e60b9c51400377af4a9cd1c4049
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
msm: display: vsync usage in turning off dsi video

Add timeout to waiting for vsync so that it can come out
when vsync interrupt is not working.
Need not wait for vsync after timing engine is off.

Change-Id: Ib989e435405613d891024ba15144723730454e34
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
iommu/msm: check range before mapping.

Make sure iommu_map_range() does not leave a partial
mapping on error if part of the range is already
mapped.

Change-Id: I0ddeb0e0169b579f1efdeca4071fce4ee75a11f8
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Sakshi Agrawal <sakshia@codeaurora.org>
msm: kgsl: use readonly mappings on the iommu

Userspace passes a flag KGSL_MEMFLAGS_GPUREADONLY when
the gpu should not write to a memory region. Use this
flag to control IOMMU_WRITE permissions on the buffer.

Change-Id: I5d3fc615dc36687252e2242f63fe74d6ce1c4fbc
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Sakshi Agrawal <sakshia@codeaurora.org>
msm: kgsl: clean up use of memdesc->hostptr

Some external memory types were using hostptr to store
a userspace virtual address, but other code assumes it is a
kernel virtual address. Make memdesc->hostpr always
be the kernel virtual address and add a useraddr
field for the userspace virtual address.

Change-Id: Id4580a2ff34aeb15f2c1b26a7134f0fd4ec52a6e
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Sakshi Agrawal <sakshia@codeaurora.org>
msm: kgsl: prevent multiple or partial mmaps of a buffer

These cases have never been a normal operation pattern of the
userspace driver. Sharing buffers through multiple mappings
is better left to dma-buf or ion.

Change-Id: I7e7658137937c96b9505d0f912dcb262d652e0c3
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Sakshi Agrawal <sakshia@codeaurora.org>