From: Lucas Stach <l.stach@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>,
Lee Jones <lee.jones@linaro.org>
Cc: linux-kernel@vger.kernel.org, cphealy@gmail.com,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH 3/3] mfd: rave-sp: Check received frame length before accepting next byte
Date: Tue, 06 Mar 2018 15:10:04 +0100 [thread overview]
Message-ID: <1520345404.4095.17.camel@pengutronix.de> (raw)
In-Reply-To: <20180226150739.13457-3-andrew.smirnov@gmail.com>
Am Montag, den 26.02.2018, 07:07 -0800 schrieb Andrey Smirnov:
> Check received frame length _before_ accepting next byte in order to
> avoid incorrectly rejecting payloads that are RAVE_SP_RX_BUFFER_SIZE
> long.
>
> Cc: linux-kernel@vger.kernel.org
> Cc: cphealy@gmail.com
> > Cc: Lucas Stach <l.stach@pengutronix.de>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Tested-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/mfd/rave-sp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/rave-sp.c b/drivers/mfd/rave-sp.c
> index cec1e309b31f..76fa32006a1b 100644
> --- a/drivers/mfd/rave-sp.c
> +++ b/drivers/mfd/rave-sp.c
> @@ -548,8 +548,6 @@ static int rave_sp_receive_buf(struct serdev_device *serdev,
> > /* FALLTHROUGH */
>
> > case RAVE_SP_EXPECT_ESCAPED_DATA:
> > - deframer->data[deframer->length++] = byte;
> -
> > if (deframer->length == sizeof(deframer->data)) {
> > dev_warn(dev, "Bad frame: Too long\n");
> > /*
> @@ -564,6 +562,8 @@ static int rave_sp_receive_buf(struct serdev_device *serdev,
> > goto reset_framer;
> > }
>
> > + deframer->data[deframer->length++] = byte;
> +
> > /*
> > * We've extracted out special byte, now we
> > * can go back to regular data collecting
next prev parent reply other threads:[~2018-03-06 14:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 15:07 [PATCH 1/3] mfd: rave-sp: Add code to print firmware versions Andrey Smirnov
2018-02-26 15:07 ` [PATCH 2/3] mfd: rave-sp: Convert print_hex_dump() to print_hex_dump_debug() Andrey Smirnov
2018-03-06 14:09 ` Lucas Stach
2018-03-07 16:52 ` Lee Jones
2018-02-26 15:07 ` [PATCH 3/3] mfd: rave-sp: Check received frame length before accepting next byte Andrey Smirnov
2018-03-06 14:10 ` Lucas Stach [this message]
2018-03-07 16:52 ` Lee Jones
2018-03-06 14:09 ` [PATCH 1/3] mfd: rave-sp: Add code to print firmware versions Lucas Stach
2018-03-07 16:51 ` Lee Jones
2018-03-08 17:18 ` Andrey Smirnov
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=1520345404.4095.17.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=andrew.smirnov@gmail.com \
--cc=cphealy@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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®