diff mbox series

[1/3] Input: synaptics-rmi4 - fix video buffer size

Message ID 20190726140208.5758-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series [1/3] Input: synaptics-rmi4 - fix video buffer size | expand

Commit Message

Lucas Stach July 26, 2019, 2:02 p.m. UTC
The video buffer used by the queue is a vb2_v4l2_buffer, not a plain
vb2_buffer. Using the wrong type causes the allocation of the buffer
storage to be too small, causing a out of bounds write when
__init_vb2_v4l2_buffer initializes the buffer.

Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support
                      for F54 diagnostics")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/input/rmi4/rmi_f54.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lucas Stach Sept. 5, 2019, 8:52 a.m. UTC | #1
Hi Dmitry,

can you please take a look at those patches? At least the first 2 fix
some kernel crashing bugs, so I wouldn't like to see them being delayed
for too long.

Thanks,
Lucas

On Fr, 2019-07-26 at 16:02 +0200, Lucas Stach wrote:
> The video buffer used by the queue is a vb2_v4l2_buffer, not a plain
> vb2_buffer. Using the wrong type causes the allocation of the buffer
> storage to be too small, causing a out of bounds write when
> __init_vb2_v4l2_buffer initializes the buffer.
> 
> Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support
>                       for F54 diagnostics")
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/input/rmi4/rmi_f54.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/rmi4/rmi_f54.c
> b/drivers/input/rmi4/rmi_f54.c
> index 710b02595486..4841354af0d7 100644
> --- a/drivers/input/rmi4/rmi_f54.c
> +++ b/drivers/input/rmi4/rmi_f54.c
> @@ -359,7 +359,7 @@ static const struct vb2_ops rmi_f54_queue_ops = {
>  static const struct vb2_queue rmi_f54_queue = {
>  	.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
>  	.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ,
> -	.buf_struct_size = sizeof(struct vb2_buffer),
> +	.buf_struct_size = sizeof(struct vb2_v4l2_buffer),
>  	.ops = &rmi_f54_queue_ops,
>  	.mem_ops = &vb2_vmalloc_memops,
>  	.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
Dmitry Torokhov Sept. 17, 2019, 3:25 a.m. UTC | #2
Hi Lucas,

On Thu, Sep 05, 2019 at 10:52:28AM +0200, Lucas Stach wrote:
> Hi Dmitry,
> 
> can you please take a look at those patches? At least the first 2 fix
> some kernel crashing bugs, so I wouldn't like to see them being delayed
> for too long.

I seem to have lost the series. Could you please resent it?

Thanks.
diff mbox series

Patch

diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index 710b02595486..4841354af0d7 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -359,7 +359,7 @@  static const struct vb2_ops rmi_f54_queue_ops = {
 static const struct vb2_queue rmi_f54_queue = {
 	.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
 	.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ,
-	.buf_struct_size = sizeof(struct vb2_buffer),
+	.buf_struct_size = sizeof(struct vb2_v4l2_buffer),
 	.ops = &rmi_f54_queue_ops,
 	.mem_ops = &vb2_vmalloc_memops,
 	.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,