public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] v4l: Fix dma buf single plane compat handling
@ 2015-12-07  8:45 Laurent Pinchart
  2015-12-08 15:29 ` Sakari Ailus
  0 siblings, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2015-12-07  8:45 UTC (permalink / raw)
  To: linux-media; +Cc: Gjorgji Rosikopulos

From: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>

Buffer length is needed for single plane as well, otherwise
is uninitialized and behaviour is undetermined.

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 8fd84a67478a..b0faa1f7e3a9 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -482,8 +482,10 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_DMABUF:
-			if (get_user(kp->m.fd, &up->m.fd))
+			if (get_user(kp->m.fd, &up->m.fd) ||
+			    get_user(kp->length, &up->length))
 				return -EFAULT;
+
 			break;
 		}
 	}
@@ -550,7 +552,8 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_DMABUF:
-			if (put_user(kp->m.fd, &up->m.fd))
+			if (put_user(kp->m.fd, &up->m.fd) ||
+			    put_user(kp->length, &up->length))
 				return -EFAULT;
 			break;
 		}
-- 
2.4.10


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-01-18 22:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07  8:45 [PATCH] v4l: Fix dma buf single plane compat handling Laurent Pinchart
2015-12-08 15:29 ` Sakari Ailus
2015-12-08 19:31   ` grosikopulos
2015-12-08 23:11   ` Laurent Pinchart
2015-12-09 11:07     ` Sakari Ailus
2015-12-13 20:40       ` Laurent Pinchart
2016-01-18 11:21         ` Hans Verkuil
2016-01-18 22:41           ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox