From: tixy@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] firmware: arm_scpi: check the payload length in scpi_send_message
Date: Fri, 09 Dec 2016 09:57:07 +0000 [thread overview]
Message-ID: <1481277427.2902.12.camel@linaro.org> (raw)
In-Reply-To: <20161125005432.1205-3-martin.blumenstingl@googlemail.com>
On Fri, 2016-11-25 at 01:54 +0100, Martin Blumenstingl wrote:
> This adds a sanity check to ensure we're not writing data beyond the
> end of our rx_buf and tx_buf. Currently we are still far from reaching
> this limit, so this is a non-critical fix.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> drivers/firmware/arm_scpi.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
> index 8c183d8..78ea8c7 100644
> --- a/drivers/firmware/arm_scpi.c
> +++ b/drivers/firmware/arm_scpi.c
> @@ -538,6 +538,11 @@ static int scpi_send_message(u8 idx, void *tx_buf, unsigned int tx_len,
> scpi_info->num_chans;
> scpi_chan = scpi_info->channels + chan;
>
> + if (tx_len > scpi_chan->max_payload_len)
> + return -EINVAL;
> + if (rx_len > scpi_chan->max_payload_len)
> + return -EINVAL;
What is max_payload_len? I don't see it in anywhere in the kernel tree.
Also, why is the check needed? Surely having a channel not be able to
support the requirements of the SCPI protocol is a bit of a
design/configuration flaw of the system and shouldn't happen. If a check
is really needed perhaps it also warrants a WARN_ON or similar?
> +
> msg = get_scpi_xfer(scpi_chan);
> if (!msg)
> return -ENOMEM;
--
Tixy
next prev parent reply other threads:[~2016-12-09 9:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 0:18 [PATCH] SCPI (pre-v1.0): fix reading sensor value Martin Blumenstingl
2016-11-24 0:18 ` [PATCH] firmware: arm_scpi: fix reading sensor values on pre-1.0 SCPI firmwares Martin Blumenstingl
2016-12-07 18:44 ` Sudeep Holla
2016-12-11 21:16 ` Martin Blumenstingl
2016-11-24 10:47 ` [PATCH] SCPI (pre-v1.0): fix reading sensor value Sudeep Holla
2016-11-24 11:15 ` Martin Blumenstingl
2016-11-25 0:56 ` Martin Blumenstingl
2016-12-02 22:54 ` Martin Blumenstingl
2016-12-06 11:38 ` Sudeep Holla
2016-11-25 0:54 ` [PATCH v2 0/2] " Martin Blumenstingl
2016-11-25 0:54 ` [PATCH v2 1/2] firmware: arm_scpi: zero RX buffer before requesting data from the mbox Martin Blumenstingl
2016-12-07 18:17 ` Sudeep Holla
2016-12-09 20:23 ` Martin Blumenstingl
2016-12-09 10:16 ` Jon Medhurst (Tixy)
2016-11-25 0:54 ` [PATCH v2 2/2] firmware: arm_scpi: check the payload length in scpi_send_message Martin Blumenstingl
2016-12-09 9:57 ` Jon Medhurst (Tixy) [this message]
2016-12-11 21:14 ` [PATCH v3] SCPI (pre-v1.0): fix reading sensor value Martin Blumenstingl
2016-12-11 21:14 ` [PATCH v3] firmware: arm_scpi: fix reading sensor values on pre-1.0 SCPI firmwares Martin Blumenstingl
2016-12-13 14:09 ` Sudeep Holla
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=1481277427.2902.12.camel@linaro.org \
--to=tixy@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).