From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Andy Gross <agross@codeaurora.org>
Cc: Courtney Cavin <courtney.cavin@sonymobile.com>,
<linux-arm-msm@vger.kernel.org>, <linux-soc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] soc: qcom: smd: Reject send of too big packets
Date: Thu, 24 Sep 2015 18:37:18 -0700 [thread overview]
Message-ID: <1443145038-30699-1-git-send-email-bjorn.andersson@sonymobile.com> (raw)
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
next reply other threads:[~2015-09-25 1:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 1:37 Bjorn Andersson [this message]
2015-09-25 17:03 ` Andy Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443145038-30699-1-git-send-email-bjorn.andersson@sonymobile.com \
--to=bjorn.andersson@sonymobile.com \
--cc=agross@codeaurora.org \
--cc=courtney.cavin@sonymobile.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®