提交 839c4227 编写于 作者: C Christophe JAILLET 提交者: Dmitry Torokhov

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: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: NAndrew Duggan <aduggan@synaptics.com>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 664b0bae
......@@ -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)
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册