瀏覽代碼

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>
Bjorn Andersson 10 年之前
父節點
當前提交
a208ca98ff
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      drivers/soc/qcom/smd.c

+ 4 - 0
drivers/soc/qcom/smd.c

@@ -723,6 +723,10 @@ int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len)
 	if (channel->info_word && len % 4)
 	if (channel->info_word && len % 4)
 		return -EINVAL;
 		return -EINVAL;
 
 
+	/* Reject packets that are too big */
+	if (tlen >= channel->fifo_size)
+		return -EINVAL;
+
 	ret = mutex_lock_interruptible(&channel->tx_lock);
 	ret = mutex_lock_interruptible(&channel->tx_lock);
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;