aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@sonymobile.com>2015-09-24 21:37:18 -0400
committerAndy Gross <agross@codeaurora.org>2015-10-14 15:51:21 -0400
commita208ca98ff63e5c94d03810bc80fee9b02fe9972 (patch)
tree7b7fe023c0b162a348d16eaf4e4aa22beb9655f7 /drivers/soc
parent24f60e3776e340136f8d822aff75fe06b78a315f (diff)
soc: qcom: smd: Reject send of too big packets
Attempting to find room for a packet that's bigger than the fifo will never succeed and the calling process will be sleeping forever in the loop, waiting for enough room. So fail early instead. Reported-by: Courtney Cavin <courtney.cavin@sonymobile.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Reviewed-by: Andy Gross <agross@codeaurora.org> Signed-off-by: Andy Gross <agross@codeaurora.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/smd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/soc/qcom/smd.c b/drivers/soc/qcom/smd.c
index 18964f154383..88353bda1ea4 100644
--- a/drivers/soc/qcom/smd.c
+++ b/drivers/soc/qcom/smd.c
@@ -723,6 +723,10 @@ int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len)
723 if (channel->info_word && len % 4) 723 if (channel->info_word && len % 4)
724 return -EINVAL; 724 return -EINVAL;
725 725
726 /* Reject packets that are too big */
727 if (tlen >= channel->fifo_size)
728 return -EINVAL;
729
726 ret = mutex_lock_interruptible(&channel->tx_lock); 730 ret = mutex_lock_interruptible(&channel->tx_lock);
727 if (ret) 731 if (ret)
728 return ret; 732 return ret;