Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1232523 > unrolled thread

[PATCH] soc: qcom: smd: Reject send of too big packets

Started byBjorn Andersson <bjorn.andersson@sonymobile.com>
First post2015-09-25 03:40 +0200
Last post2015-09-25 19:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] soc: qcom: smd: Reject send of too big packets Bjorn Andersson <bjorn.andersson@sonymobile.com> - 2015-09-25 03:40 +0200
    Re: [PATCH] soc: qcom: smd: Reject send of too big packets Andy Gross <agross@codeaurora.org> - 2015-09-25 19:10 +0200

#1232523 — [PATCH] soc: qcom: smd: Reject send of too big packets

FromBjorn Andersson <bjorn.andersson@sonymobile.com>
Date2015-09-25 03:40 +0200
Subject[PATCH] soc: qcom: smd: Reject send of too big packets
Message-ID<qcq9r-3Fl-5@gated-at.bofh.it>
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>
---
 drivers/soc/qcom/smd.c | 4 ++++
 1 file changed, 4 insertions(+)

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1232952

FromAndy Gross <agross@codeaurora.org>
Date2015-09-25 19:10 +0200
Message-ID<qcEFs-7G2-21@gated-at.bofh.it>
In reply to#1232523
On Thu, Sep 24, 2015 at 06:37:18PM -0700, Bjorn Andersson wrote:
> 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>
> ---

Looks reasonable.

Reviewed-by: Andy Gross <agross@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web