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>
        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;