soc: qcom: smd: Reject send of too big packets
authorBjorn Andersson <bjorn.andersson@sonymobile.com>
Fri, 25 Sep 2015 01:37:18 +0000 (18:37 -0700)
committerAndy Gross <agross@codeaurora.org>
Wed, 14 Oct 2015 19:51:21 +0000 (14:51 -0500)
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>
drivers/soc/qcom/smd.c

index 18964f1543831055530591a47e8cc453f2b3314a..88353bda1ea4094db0bdec40a1a660fda24663ce 100644 (file)
@@ -723,6 +723,10 @@ int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len)
        if (channel->info_word && len % 4)
                return -EINVAL;
 
+       /* Reject packets that are too big */
+       if (tlen >= channel->fifo_size)
+               return -EINVAL;
+
        ret = mutex_lock_interruptible(&channel->tx_lock);
        if (ret)
                return ret;
This page took 0.036955 seconds and 5 git commands to generate.