Message ID | 20180402140327.7715-1-christophe.jaillet@wanadoo.fr (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
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) > /* -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Christophe JAILLET. [This is an automated email] This commit has been processed by the -stable helper bot and determined to be a high probability candidate for -stable trees. (score: 7.5278) The bot has tested the following trees: v4.15.15, v4.14.32, v4.9.92, v4.4.126, v4.15.15: Build OK! v4.14.32: Build OK! v4.9.92: Build OK! v4.4.126: Failed to apply! Possible dependencies: 8d99758dee31: ("Input: synaptics-rmi4 - add SPI transport driver") ff8f83708b3e: ("Input: synaptics-rmi4 - add support for 2D sensors and F11") fdf51604f104: ("Input: synaptics-rmi4 - add I2C transport driver") 2b6a321da9a2: ("Input: synaptics-rmi4 - add support for Synaptics RMI4 devices") 2b6a321da9a2: ("Input: synaptics-rmi4 - add support for Synaptics RMI4 devices") fdf51604f104: ("Input: synaptics-rmi4 - add I2C transport driver") 2b6a321da9a2: ("Input: synaptics-rmi4 - add support for Synaptics RMI4 devices") 2b6a321da9a2: ("Input: synaptics-rmi4 - add support for Synaptics RMI4 devices") Please let us know if you'd like to have this patch included in a stable tree. -- Thanks. Sasha-- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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) > > /* >
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) /*
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(-)