aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2018-04-06 18:36:11 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2018-04-06 18:39:18 -0400
commit839c42273617787318da7baf6151d553108f5e17 (patch)
treecf916a04b3632b742374f3f19c6222d6856848d6
parent664b0bae0b87f69bc9deb098f5e0158b9cf18e04 (diff)
Input: synaptics-rmi4 - fix an unchecked out of memory error path
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> Reviewed-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/rmi4/rmi_spi.c7
1 files 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,
147 if (len > RMI_SPI_XFER_SIZE_LIMIT) 147 if (len > RMI_SPI_XFER_SIZE_LIMIT)
148 return -EINVAL; 148 return -EINVAL;
149 149
150 if (rmi_spi->xfer_buf_size < len) 150 if (rmi_spi->xfer_buf_size < len) {
151 rmi_spi_manage_pools(rmi_spi, len); 151 ret = rmi_spi_manage_pools(rmi_spi, len);
152 if (ret < 0)
153 return ret;
154 }
152 155
153 if (addr == 0) 156 if (addr == 0)
154 /* 157 /*