soc: qcom: smd: Reject send of too big packets
Subsystems (2)
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.
Reported-by Courtney Cavin <[email protected]>
Signed-off-by Bjorn Andersson <[email protected]>
--- drivers/soc/qcom/smd.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/soc/qcom/smd.c +4 -0
@@ -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
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.
Reported-by Courtney Cavin <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>---
Looks reasonable.
Reviewed-by Andy Gross <[email protected]>
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