linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: v4l2-ioctl: clear fields in s_parm
@ 2019-05-29 11:32 Naresh Kamboju
  2019-06-15 16:03 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Naresh Kamboju @ 2019-05-29 11:32 UTC (permalink / raw)
  To: stable
  Cc: linux-media, hverkuil-cisco, linux-kernel, Hans Verkuil,
	Mauro Carvalho Chehab

From: Hans Verkuil <hans.verkuil@cisco.com>

commit 8a7c5594c02022ca5fa7fb603e11b3e1feb76ed5 upstream.

Zero the reserved capture/output array.

Zero the extendedmode (it is never used in drivers).

Clear all flags in capture/outputmode except for V4L2_MODE_HIGHQUALITY,
as that is the only valid flag.

Cc: <stable@vger.kernel.org> # v4.9 v4.14
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 4510e8a37244..699e5f8e0a71 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1959,7 +1959,22 @@ static int v4l_s_parm(const struct v4l2_ioctl_ops *ops,
 	struct v4l2_streamparm *p = arg;
 	int ret = check_fmt(file, p->type);
 
-	return ret ? ret : ops->vidioc_s_parm(file, fh, p);
+	if (ret)
+		return ret;
+
+	/* Note: extendedmode is never used in drivers */
+	if (V4L2_TYPE_IS_OUTPUT(p->type)) {
+		memset(p->parm.output.reserved, 0,
+		       sizeof(p->parm.output.reserved));
+		p->parm.output.extendedmode = 0;
+		p->parm.output.outputmode &= V4L2_MODE_HIGHQUALITY;
+	} else {
+		memset(p->parm.capture.reserved, 0,
+		       sizeof(p->parm.capture.reserved));
+		p->parm.capture.extendedmode = 0;
+		p->parm.capture.capturemode &= V4L2_MODE_HIGHQUALITY;
+	}
+	return ops->vidioc_s_parm(file, fh, p);
 }
 
 static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops,
-- 
2.17.1


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

* Re: [PATCH] media: v4l2-ioctl: clear fields in s_parm
  2019-05-29 11:32 [PATCH] media: v4l2-ioctl: clear fields in s_parm Naresh Kamboju
@ 2019-06-15 16:03 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-06-15 16:03 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: stable, linux-media, hverkuil-cisco, linux-kernel, Hans Verkuil,
	Mauro Carvalho Chehab

On Wed, May 29, 2019 at 12:32:47PM +0100, Naresh Kamboju wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> commit 8a7c5594c02022ca5fa7fb603e11b3e1feb76ed5 upstream.
> 
> Zero the reserved capture/output array.
> 
> Zero the extendedmode (it is never used in drivers).
> 
> Clear all flags in capture/outputmode except for V4L2_MODE_HIGHQUALITY,
> as that is the only valid flag.
> 
> Cc: <stable@vger.kernel.org> # v4.9 v4.14
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> ---
>  drivers/media/v4l2-core/v4l2-ioctl.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2019-06-15 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 11:32 [PATCH] media: v4l2-ioctl: clear fields in s_parm Naresh Kamboju
2019-06-15 16:03 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).