All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andrew Duggan <aduggan@synaptics.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	benjamin.tissoires@redhat.com, gregkh@linuxfoundation.org,
	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: Fri, 06 Apr 2018 22:37:56 +0000	[thread overview]
Message-ID: <20180406223756.GD206175@dtor-ws> (raw)
In-Reply-To: <a8d419ae-4047-77af-0a1c-683bf1370e6a@synaptics.com>

On Mon, Apr 02, 2018 at 05:52:52PM -0700, Andrew Duggan wrote:
> 
> 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>

Applied, thank you.

> 
> > ---
> >   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)
> >   		/*
> 

-- 
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andrew Duggan <aduggan@synaptics.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	benjamin.tissoires@redhat.com, gregkh@linuxfoundation.org,
	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: Fri, 6 Apr 2018 15:37:56 -0700	[thread overview]
Message-ID: <20180406223756.GD206175@dtor-ws> (raw)
In-Reply-To: <a8d419ae-4047-77af-0a1c-683bf1370e6a@synaptics.com>

On Mon, Apr 02, 2018 at 05:52:52PM -0700, Andrew Duggan wrote:
> 
> 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>

Applied, thank you.

> 
> > ---
> >   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)
> >   		/*
> 

-- 
Dmitry

  reply	other threads:[~2018-04-06 22:37 UTC|newest]

Thread overview: 7+ 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-02 14:03 ` Christophe JAILLET
2018-04-03  0:52 ` Andrew Duggan
2018-04-03  0:52   ` Andrew Duggan
2018-04-06 22:37   ` Dmitry Torokhov [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=20180406223756.GD206175@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=aduggan@synaptics.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.