From: Bjorn Andersson Date: Fri, 25 Sep 2015 01:37:18 +0000 (-0700) Subject: soc: qcom: smd: Reject send of too big packets X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a208ca98ff63e5c94d03810bc80fee9b02fe9972;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Bjorn Andersson Reviewed-by: Andy Gross Signed-off-by: Andy Gross --- diff --git a/drivers/soc/qcom/smd.c b/drivers/soc/qcom/smd.c index 18964f154383..88353bda1ea4 100644 --- a/drivers/soc/qcom/smd.c +++ b/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) 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;