Revert "Revert "msm: modem-8960: Check if the modem is alive after restarting it""

This reverts commit 92c7c8b3b9c74e0f7328849544953e15951b3439.

Change-Id: I0d522bbd6bac383e72ec2def1b8775f495895927
netlink: fix possible spoofing from non-root processes

[ Upstream commit 20e1db19db5d6b9e4e83021595eab0dc8f107bef ]

Non-root user-space processes can send Netlink messages to other
processes that are well-known for being subscribed to Netlink
asynchronous notifications. This allows ilegitimate non-root
process to send forged messages to Netlink subscribers.

The userspace process usually verifies the legitimate origin in
two ways:

a) Socket credentials. If UID != 0, then the message comes from
   some ilegitimate process and the message needs to be dropped.

b) Netlink portID. In general, portID == 0 means that the origin
   of the messages comes from the kernel. Thus, discarding any
   message not coming from the kernel.

However, ctnetlink sets the portID in event messages that has
been triggered by some user-space process, eg. conntrack utility.
So other processes subscribed to ctnetlink events, eg. conntrackd,
know that the event was triggered by some user-space action.

Neither of the two ways to discard ilegitimate messages coming
from non-root processes can help for ctnetlink.

This patch adds capability validation in case that dst_pid is set
in netlink_sendmsg(). This approach is aggressive since existing
applications using any Netlink bus to deliver messages between
two user-space processes will break. Note that the exception is
NETLINK_USERSOCK, since it is reserved for netlink-to-netlink
userspace communication.

Still, if anyone wants that his Netlink bus allows netlink-to-netlink
userspace, then they can set NL_NONROOT_SEND. However, by default,
I don't think it makes sense to allow to use NETLINK_ROUTE to
communicate two processes that are sending no matter what information
that is not related to link/neighbouring/routing. They should be using
NETLINK_USERSOCK instead for that.

Change-Id: I6ee58fe1322f72c31fd0dbb4ad13a4d994e5d637
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
netlink: add reference of module in netlink_dump_start

[ Upstream commit 6dc878a8ca39e93f70c42f3dd7260bde10c1e0f1 ]

I get a panic when I use ss -a and rmmod inet_diag at the
same time.

It's because netlink_dump uses inet_diag_dump which belongs to module
inet_diag.

I search the codes and find many modules have the same problem.  We
need to add a reference to the module which the cb->dump belongs to.

Thanks for all help from Stephen,Jan,Eric,Steffen and Pablo.

Change From v3:
change netlink_dump_start to inline,suggestion from Pablo and
Eric.

Change From v2:
delete netlink_dump_done,and call module_put in netlink_dump
and netlink_sock_destruct.

Change-Id: Ib109f12c7c0c7e36e6e882e4a47604c45a48d7d5
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ext4: add missing save_error_info() to ext4_error()

commit f3fc0210c0fc91900766c995f089c39170e68305 upstream.

The ext4_error() function is missing a call to save_error_info().
Since this is the function which marks the file system as containing
an error, this oversight (which was introduced in 2.6.36) is quite
significant, and should be backported to older stable kernels with
high urgency.

Change-Id: I06d62deac9599a614dc2fefb6eb276e0fd10d0b5
Reported-by: Ken Sumrall <ksumrall@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: ksumrall@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
msm: Export some iommu domain management functions

Several of the iommu virtual address space functions may
need to be accessed by modules. Export the symbol.

Change-Id: Ief99cbb63f729943b6d8b45ce9aed071d84decd1
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: iommu: Remove the vcap iommu from 8960ab

There is no vcap iommu in the 8960ab platform.
Also, a cleaner separation between platforms is
obtained by re-organizing the gfx3d and vcap
structures by device block instead of by msm.

Change-Id: I9dbfceebe67d44c4ee65e960873e2f9a1811f913
Signed-off-by: Joel King <joelking@codeaurora.org>
msm: iommu: Fix SMR NSCFG configuration

When setting the NSCFG field, the S2CR register being
written needs to be indexed by the stream matching group,
not by the value of the SID being configured. Additionally,
there is no need to set CBACR for every SMR that is
programmed.

Change-Id: Ib79771a3bd87e4bd3b353bd5c6de9247138ca43e
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
iommu: msm: Configure memory attribute overrides

The default IOMMU memory attribute setting results in
reduced performance as a result of downgrading memory
attributes. Fix that.

Change-Id: Ie04175b8037855e4c962eac281f7f88901ae2034
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
vidc: Use correct port setting for encoder during prepare buffer.

When prepare buffer was called for encoder, the port configurations
were swapped. This change corrects this error.

Change-Id: I927cf66666dd02e0f4abbdc9d7be561a857ab2b0
Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
vidc: Disable venus VBIF dynamic clock gating for video core.

Video core behaviour was inconsistent for different resolutions. This
was due to dynamic clock gating for venus VBIF was enabled. Disable Venus
VBIF clock gating to prevent this inconsistent behaviour.

Change-Id: Id7efd4b7f922efcb77c729f1dc119b1549cb8d74
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
msm: vidc: Add support for cached ion allocation

Add support to allocate ion memory from cached
or uncached region in video driver. Also, Clean and
invalidate caches for input, output, shared command
memory and internal buffers incase they are allocated
from cached region.

Change-Id: Id1ac9587bfef8d2d0e2a3d3d30f30e39de10665e
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
msm: vidc: Fix for IOMMU mapping.

Same memory region was being mapped multiple times.
This fix avoids this scenario and makes sure that
that we map proper size and single fd is mapped
and unmapped one time only.

Change-Id: Ibba932456792d5964213fe93db2c6101ad94b74c
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
msm: vidc: Honor client's request for more buffers

The driver should allow the client's request for more buffers than the
minimum rather than enforcing just the minimum required by Venus.

Change-Id: I8c10372b1ffef55d0e73b824b13ad80de2446f23
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm_vidc: Fix setting queue size to firmware.

Incorrect queue size was being set to firmware. This patch fixes the issue.

Change-Id: Ic0ab9384d364f70cf06c352331887dfcdf6592c4
Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
vidc: fix NV12 buffer size calculation in encoder and decoder.

Buffer size calculation in driver and firmware is different. This
results in inconsistent behaviour for different resolutions. This
change calculates buffer size as in firmware.

Change-Id: I9dca9e0e8729eb4e578de63dc43c01dd65c3f3be
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
msm: vidc: Return timestamps correctly back to the client

Propagate the timestamp client provides on the OUTPUT port to the
CAPTURE port.  Additionally, use kernel provided functions to convert
the timeval struct to a 64 bit value rather than requiring the clients
to set the timestamp within the tv_usec field.

Change-Id: I19b8b953c837199019d7370f8bf3afec88a0d00d
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
msm_fb: Fix adb shell start/stop issue when bypass enabled

Currently when 2/3/4 layer bypass is enabled, doing a adb shell
stop/start is failing overlay and composition happens through
GPU. Fix this issue by proper overlay configuration during this
scenario.

Change-Id: Ia04f1839bf80ed552671e48445af63a4dcd6bdfd
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
kernel: Includes initial Pantech's structure

Change-Id: Icc607209d403017b986b3072bedbaf0fbe53152a
kernel: Mod to replace original source with our own model.

This modification allows to replace some files in the kernel with our own model.
And add modifications without "interfering" in the original source.

Based on Samsung's kernel msm8660.

Change-Id: Ib20772af9cf57c86f74a973ad163bf784163baff
kernel: Add initial support for Pantech oscar.

Only includes the duplicates of the kernel original files.

Change-Id: I68d5c26788bc2a24d8c41207d3f1c13ec04497a3