lib, net: make isodigit() public and use it

There are at least two users of isodigit().  Let's make it a public
function of ctype.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
fbmem: Check failure of FBIOPUTCMAP ioctl

On FBIOPUTCMAP ioctl failure deallocate
fb cmap. Put null check for cmap red, green,
blue component.

Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
net: fib: fix incorrect call_rcu_bh()

After IP route cache removal, I believe rcu_bh() has very little use and
we should remove this RCU variant, since it adds some cycles in fast
path.
Anyway, the call_rcu_bh() use in fib_true is obviously wrong, since
some users only assert rcu_read_lock().

4619.617291:   <0> Internal error: Oops: 5 [#1] PREEMPT SMP ARM
114619.622541:   <4> Modules linked in: wlan(O) adsprpc [last unloaded: wlan]
114619.628980:   <4> CPU: 1    Tainted: G        W  O  (3.4.0-g366f2d7-00028-gde45140 #1)
114619.636427:   <4> PC is at leaf_walk_rcu+0x50/0x9c
114619.640761:   <4> LR is at fib_route_seq_next+0x58/0x7c
...[ Dmesg snip snip ]...
14620.187747:   <0> 5fe0: 405a3cd4 405a3ca0 007207ac 0071c098 80000010 00000012 00000000 00000000
114620.196018:   <4> [<c0720ec4>] (leaf_walk_rcu+0x50/0x9c) from [<c07210b0>] (fib_route_seq_next+0x58/0x7c)
114620.205114:   <4> [<c07210b0>] (fib_route_seq_next+0x58/0x7c) from [<c01642d8>] (seq_read+0x304/0x498)
114620.213964:   <4> [<c01642d8>] (seq_read+0x304/0x498) from [<c018daf8>] (proc_reg_read+0x80/0x98)
114620.222388:   <4> [<c018daf8>] (proc_reg_read+0x80/0x98) from [<c0147e90>] (vfs_read+0xa4/0x12c)
114620.230720:   <4> [<c0147e90>] (vfs_read+0xa4/0x12c) from [<c0147f4c>] (sys_read+0x34/0x68)
114620.238625:   <4> [<c0147f4c>] (sys_read+0x34/0x68) from [<c000e2e0>] (ret_fast_syscall+0x0/0x30)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Git-commit: 0c03eca3d995e73d691edea8c787e25929ec156d
Git-repo: https://www.codeaurora.org/cgit/quic/la/kernel/msm-3.10
Signed-off-by: Vijaya Kumar T M <vtmuni@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Bluetooth: Prevent Bluetooth L2CAP Remote Heap Memory Corruption

A remote user can provide a small value for the command size field in
the command header of an l2cap configuration request, resulting in an
integer underflow when subtracting the size of the configuration request
header.  This results in copying a very large amount of data via
memcpy() and destroying the kernel heap.  Check for underflow.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: watchdog-v2: use request_mem_region instead of request_region

Use request_mem_region api to request for allocating io resource in place
of request_region since the resource is actually not an io port resource
but io memory.

Signed-off-by: Aparna Das <adas@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: platform: qpnp-clkdiv: fix potential null pointer dereference

Add a return statement in the spmi resource null check in
qpnp_clkdiv_probe().  This is needed in order to avoid
dereferencing a null pointer in a subsequent statement.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
misc: isa1200: correct overdrive enablement bit shift

Overdrive enablement bit sits at 6th bit of control register 0.
Current shifting overwrites overdrive high bit.

Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
usb: usb_bam: set activity state upon hsic consumer request

In the original design, upon hsic consumer request, the hsic core was
resumed, but the hsic bam state stayed in inactivity, waiting for a
packet to arrive through the bam pipes in order to get back to activity
state, ask for the hsic producer and notify the USB class driver.

However, since the resume of the hsic core upon hsic consumer request,
the USB class driver is notified about the resume by the ehci resume
callback. Therefore if we will wait for activity state the USB class
driver will get also the activity indication after the resume. On both
indications the class driver set a pm runtime vote. Therefore this
scenario lead to a double pm runtime vote that will prevent hsic suspend
from that point on.

Fix this by enter to activity state right when getting hsic consumer
request, therefore requesting the hsic producer and wait for inactivity
timer interrupt from the bam instead of activity wakeup interrupt.

Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: peripheral-loader: Change IOMAP_SIZE from SZ_4M to SZ_1M

The ioremap call made for zeroing out trailing memory is currently
requesting for a 4M memory region. This is resulting in vmalloc
allocation failures on some platforms.
Instead, request for 1M memory locations and zero out the area
in smaller chunks to make this failure less probable.

Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ASoC: msm: Add check for both offset and index variable

-The offset and index variable may leads to array out of
boundary exception.
-Added offset and index overflow check.

Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ASoC: msm: Add Buffer overflow check

The overflow check is required to ensure that user space data
in kernel may not go beyond buffer boundary.

Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
media: Init the reserved fields of struct media_link_desc

struct media_link_desc is copy_to_user'ed as the return value of
MEDIA_IOC_ENUM_LINKS. When copying, the driver is omitting to initialise
the reserved fields.  This commit fixes that by initialising the
reserved fields to 0.

Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: sps: use a new flag for disconnecting pipe

Use a new flag to indicate if BAM client has decided to disconnect
a pipe so that we can avoid BAM IRQ handling for a disconnected
pipe.

Signed-off-by: Yan He <yanhe@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
spi_qsd: Add support for bam pipe flush on timeout

BAM pipes must be flushed when a transfer timeout
leaving dangling descriptors.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
spi_qsd: Verify pointers prior to redirection

Redirection on a NULL pointer leads to a system crash.
Here we verify pointers which potentially may be NULL
before a redirection.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
spi_qsd: set device's runtime PM status to 'suspended'

Sometimes system suspend is initiated before runtime
PM's auto-suspend delay expires and causing devices to
not suspended runtime. As part of system suspend if
device is not suspended runtime then clocks and gpios
are manages by system suspend.

If spi client does initiate transaction request immediately
after system resume then spi doesn't resume run-time
immediately as spi controller's device state is not in
'suspended state'.

Keep device's runtime PM status to suspended during
system suspend.

Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
spi_qsd: Correct an error reporting check

When reading values from the device tree, the error
check on BAM producer pipe must be negated.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
spi_qsd: Remove redundant input first setting in bam mode

The HW is not mandating the use of input first in bam mode,
therefore, that statement is removed.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
spi_qsd: Fix SPI L2 Crash

Work queue is scheduled to process
SPI messages  during system suspend
state which leads to crash.

This patch make sure all the messages
in queue are processed before system
suspends.

Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: camera: Fix unterminated of_device_id table

Add a NULL table entry at end for msm, ispif and
msm_generic_buf_mgr device tree match tables.

Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>