msm: usbaudio: Add check for NULL before dereferencing

kzalloc() and usb_ifnum_to_if() both APIs can return NULL. Current
code is not checking return value and derefencing which may crash
device if it is set to NULL. Fix this by checking return value
against NULL and handling the same.

CRs-Fixed: 562273
Change-Id: I0d2c910f43321e94fc447b19ae3e3207727e24f3
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
hsic_sysmon_test: Add check for userspace buffer size count

hsic_sysmon_test local buffer size limit is 4096 bytes. If user space
tries to write data with size greater than 4096 bytes, memory corruption
would happen. Hence, add check for userspace buffer size count before
writing data from userspace buffer to hsic_sysmon_test local buffer.

CRs-Fixed: 547489
Change-Id: I25de15b2abea44ff4cecac827d86b2da8a57c40e
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
usb: gadget: Fix response available notify count usage

The outstanding responses are purged and notify count is reset
during bus suspend. But the notify interrupt endpoint is not flushed.
If a request is pending with the controller, It gets finished during
resume and the notify count is decremented in the completion handler.
As the notify count is reset during the suspend its become negative now.
As the counter is not zero, interrupt notifications are queued even
though there are no responses. This is leading to watchdog bark due to
an error print messages.

Flush the notify endpoint before resetting the notify counter during
suspend. As we are modifying notify counter under spin lock, atomic
variable is not required. Ensure that notify counter never
becomes negative.

CRs-Fixed: 624896
Change-Id: I78cb7a585c1c2b527ca6b46bc99e7db8067ee21a
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
USB: msm_otg: Allow platforms to vote for BUS bw on cable connect

Some platforms require voting for NOC bandwidth (and PNOC clocks)
when enabling/disabling USB clocks. It is also recommended to have
NOC running when USB is active or in session.
Hence, allow such platforms to specify MIN BUS vote along with NONE
(or inactive) and MAX USB votes. If MIN vote is not specified then
driver treats NONE vote as MIN vote.
Overall platforms should be passing these votes based on that:
NO vote is used when USB cable is not connected or there is no USB
session. MAX vote is used when USB is operating in peripheral mode
and MIN vote is used for any other scenario e.g. host mode or when
turning off USB clocks as part of putting USB in low power state.
MIN vote shouldn't be a significant value to avoid increase in power
numbers.

CRs-Fixed: 624360
Change-Id: Ia4498356b026963f7a6fda8a30ecbd9c1cd98924
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
ARM: dts: msm: Specify MIN BUS voting as long as USB is active on 9x25

MSM9x25 requires voting for NOC bandwidth (and PNOC clocks) until
USB enters LPM or as long as controller is running. Otherwise clock
gating at PNOC may result in USB controller reporting FATAL error.
Hence, add BUS bandwidth vote for the same.

CRs-Fixed: 624360
Change-Id: Id3620190ba99058c2a0253045517e54b8d1aa3c7
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
crypto: msm: ota: fix possible buffer overflow issue

This patch replaces snprintf with scnprintf to prevent
possible buffer overflow issues

CRs-Fixed: 562347

Change-Id: I56aebd24557dccc547ff86cb8853ace0602b6e50
Acked-by: Radhakrishna Popuri <c_rpopur@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
(cherry picked from commit 9b8fff396b1491c0f799b142636c5d88c9c4812b)
ASoC: msm: qdsp6v2: Fix ion_import failure

When ion_import_legacy api fails,we should not
destory the client instead just bail out.

CRs-Fixed: 620370
Change-Id: Icbcf4dadd5f00e1cf4d7a356ee1c0f5835dcb4c4
Signed-off-by: Anish Kumar <kanish@codeaurora.org>
msm: vidc: Check input arguments correctly

This commit fixes some minor bugs in which input arguments or malloc
return values were being insufficiently validated.

Change-Id: Ib0b3d2ded29384b49ec61a5fc275d3aca1fd6e14
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
usb: smd: Send zero length packets in modem data calls

The USB protocol requires zero length packets to be sent when the data
transmission ends on a USB packet size boundary. This fix enables sending
zero length packets when required.

Change-Id: Ife4edae6e0ef01d0e06e5a9e0e29cf25fb6e7465
Signed-off-by: Danny Segal <dsegal@codeaurora.org>
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Merge "ASoC: msm: qdsp6v2: Fix ion_import failure"
Merge "hsic_sysmon_test: Add check for userspace buffer size count"
Merge "msm: usbaudio: Add check for NULL before dereferencing"
Merge "usb: gadget: Fix response available notify count usage"
Merge "USB: msm_otg: Allow platforms to vote for BUS bw on cable connect"
Merge "ARM: dts: msm: Specify MIN BUS voting as long as USB is active on 9x25"
Merge "usb: smd: Send zero length packets in modem data calls"
misc: qfpfuse: Fix overflow condition

Fix potential integer overflow for ioctl command to avoid incorrect
buffer allocation. Use the stack for data buffering to avoid the
small buffer allocation for improved performance. Increase the fuse
blow timeout in the driver to cover all QFPROM implementations.

CRs-Fixed: 550574,550575

Change-Id: Iee3cc1d38aa5dbf8ef693a43a0ca716fc8724c62
Acked-by: Radhakrishna Popuri <c_rpopur@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
(cherry picked from commit 1c523da2454b2b821c71d437c4c83bc894321378)
Merge "misc: qfpfuse: Fix overflow condition"
misc: qfpfuse: validate ioctl input parameters

validate input parameters for ioctl command request

CRs-Fixed: 550574,550575
Change-Id: I87c3818b3bacc43c679aa555d79cc6ed127c6ef8
Acked-by: John Nicholas <jnichola@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
Signed-off-by: Devendra Patel <cdevenp@codeaurora.org>
Merge "misc: qfpfuse: validate ioctl input parameters"