Skip to contentSkip to conversation

soc: qcom: smd: Reject send of too big packets

PATCH In review Bjorn Andersson 2 participants 2 messages Sep 25, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/soc/qcom/smd.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/soc/qcom/smd.c +4 -0
index 18964f154383..88353bda1ea4 100644
@@ -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;
Signature · 1 line
1.8.2.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Bjorn Andersson

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.

---

Looks reasonable.

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project