linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Duggan <aduggan@synaptics.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	dmitry.torokhov@gmail.com, benjamin.tissoires@redhat.com,
	gregkh@linuxfoundation.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Input: synaptics-rmi4 - Fix an unchecked out of memory error path
Date: Mon, 2 Apr 2018 17:52:52 -0700	[thread overview]
Message-ID: <a8d419ae-4047-77af-0a1c-683bf1370e6a@synaptics.com> (raw)
In-Reply-To: <20180402140327.7715-1-christophe.jaillet@wanadoo.fr>


On 04/02/2018 07:03 AM, Christophe JAILLET wrote:
> When extending the rmi_spi buffers, we must check that no out of memory
> error occurs, otherwise we may access data above the currently allocated
> memory.
>
> Propagate the error code returned by 'rmi_spi_manage_pools()' instead.
Yep, that definitely looks like an oversight on my part. Thanks for the fix.

Andrew

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Andrew Duggan <aduggan@synaptics.com>

> ---
>   drivers/input/rmi4/rmi_spi.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c
> index 76edbf2c1bce..082defc329a8 100644
> --- a/drivers/input/rmi4/rmi_spi.c
> +++ b/drivers/input/rmi4/rmi_spi.c
> @@ -147,8 +147,11 @@ static int rmi_spi_xfer(struct rmi_spi_xport *rmi_spi,
>   	if (len > RMI_SPI_XFER_SIZE_LIMIT)
>   		return -EINVAL;
>   
> -	if (rmi_spi->xfer_buf_size < len)
> -		rmi_spi_manage_pools(rmi_spi, len);
> +	if (rmi_spi->xfer_buf_size < len) {
> +		ret = rmi_spi_manage_pools(rmi_spi, len);
> +		if (ret < 0)
> +			return ret;
> +	}
>   
>   	if (addr == 0)
>   		/*

  reply	other threads:[~2018-04-03  0:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 14:03 [PATCH] Input: synaptics-rmi4 - Fix an unchecked out of memory error path Christophe JAILLET
2018-04-03  0:52 ` Andrew Duggan [this message]
2018-04-06 22:37   ` Dmitry Torokhov
2018-04-05  1:34 ` Sasha Levin

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=a8d419ae-4047-77af-0a1c-683bf1370e6a@synaptics.com \
    --to=aduggan@synaptics.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).