* [PATCH] Input: synaptics-rmi4 - Fix an unchecked out of memory error path
@ 2018-04-02 14:03 Christophe JAILLET
2018-04-03 0:52 ` Andrew Duggan
0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2018-04-02 14:03 UTC (permalink / raw)
To: dmitry.torokhov, benjamin.tissoires, gregkh
Cc: linux-input, linux-kernel, kernel-janitors, Christophe JAILLET
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.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
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)
/*
--
2.14.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Input: synaptics-rmi4 - Fix an unchecked out of memory error path
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
2018-04-06 22:37 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Duggan @ 2018-04-03 0:52 UTC (permalink / raw)
To: Christophe JAILLET, dmitry.torokhov, benjamin.tissoires, gregkh
Cc: linux-input, linux-kernel, kernel-janitors
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)
> /*
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Input: synaptics-rmi4 - Fix an unchecked out of memory error path
2018-04-03 0:52 ` Andrew Duggan
@ 2018-04-06 22:37 ` Dmitry Torokhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2018-04-06 22:37 UTC (permalink / raw)
To: Andrew Duggan
Cc: Christophe JAILLET, benjamin.tissoires, gregkh, linux-input,
linux-kernel, kernel-janitors
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-06 22:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-04-06 22:37 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox