msm: vidc: Unlock core lock in error case

Unlock core lock in error case to avoid hang issue.

Change-Id: Ia4ae36357bb02aaca4b4933cd97bb8e8f478d2b3
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: vidc: Validate buffer prior to releasing reference

The buffer provided by the firmware could be invalid if we internally
freed it as part of error handling.  As such, before we touch the
buffer, confirm that the buffer is valid.

CRs-Fixed: 726818
Change-Id: I03f8b478bfa42607e1e6887ba16c1c330c37008c
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
new helper: single_open_size()

Same as single_open(), but preallocates the buffer of given size.
Doesn't make any sense for sizes up to PAGE_SIZE and doesn't make
sense if output of show() exceeds PAGE_SIZE only rarely - seq_read()
will take care of growing the buffer and redoing show().  If you
_know_ that it will be large, it might make more sense to look into
saner iterator, rather than go with single-shot one.  If that's
impossible, single_open_size() might be for you.

Again, don't use that without a good reason; occasionally that's really
the best way to go, but very often there are better solutions.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/seq_file: fallback to vmalloc allocation
fs/seq_file: Use vmalloc by default for allocations > PAGE_SIZE

Some OOM implementations are pretty trigger happy when it comes to
releasing memory for kmalloc() allocations.  We might as well head
straight to vmalloc for allocations over PAGE_SIZE.

Change-Id: Ic0dedbadc8bf551d34cc5d77c8073938d4adef80
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
nick kvfree() from apparmor