lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 12 Feb 2016 16:18:03 -0700
From:	Shuah Khan <shuahkh@....samsung.com>
To:	mchehab@....samsung.com
Cc:	Shuah Khan <shuahkh@....samsung.com>, hans.verkuil@...co.com,
	inki.dae@...sung.com, nenggun.kim@...sung.com,
	jh1009.sung@...sung.com, elfring@...rs.sourceforge.net,
	chehabrafael@...il.com, prabhakar.csengg@...il.com,
	linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] media: au0828 set ctrl_input in au0828_s_input()

dev->ctrl_input is set in vidioc_s_input() and
doesn't get set in au0828_s_input(). As a result,
dev->ctrl_input is left uninitialized until user
space calls s_input. It works correctly because
the default input value is 0 and which is what
dev->ctrl_input gets initialized via kzalloc().

Change to set dev->ctrl_input in au0828_s_input().
Also optimize vidioc_s_input() to return if the
new input value is same as the current.

Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
 drivers/media/usb/au0828/au0828-video.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 9304f96..20696a4 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1345,9 +1345,11 @@ static void au0828_s_input(struct au0828_dev *dev, int index)
 	default:
 		dprintk(1, "unknown input type set [%d]\n",
 			AUVI_INPUT(index).type);
-		break;
+		return;
 	}
 
+	dev->ctrl_input = index;
+
 	v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
 			AUVI_INPUT(index).vmux, 0, 0);
 
@@ -1386,7 +1388,10 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
 		return -EINVAL;
 	if (AUVI_INPUT(index).type == 0)
 		return -EINVAL;
-	dev->ctrl_input = index;
+
+	if (dev->ctrl_input == index)
+		return 0;
+
 	au0828_s_input(dev, index);
 	return 0;
 }
@@ -1901,6 +1906,7 @@ int au0828_analog_register(struct au0828_dev *dev,
 	dev->ctrl_ainput = 0;
 	dev->ctrl_freq = 960;
 	dev->std = V4L2_STD_NTSC_M;
+	/* Default input is TV Tuner */
 	au0828_s_input(dev, 0);
 
 	mutex_init(&dev->vb_queue_lock);
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ