From nobody Sat Oct 4 08:05:12 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 976DB224AEF; Mon, 18 Aug 2025 20:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755549743; cv=none; b=nKRxfep0tck0u+gMfTYmE+EQgUTAjH2iJdUoDdHrJtm8TCNoHm2hoVUqLzoZxd1GZGFbKTNMfr4Bsg9PaUs69eoJ1SksLrXxjLUd1hWdH6yKlgDwv244kizyKPSFOuNWGAZLWf0wkJv/qnwV0ac3TEv9rRlmKLh5CJL9CGllM1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755549743; c=relaxed/simple; bh=LBuYHRWyxVZ3a+UY4uT8bKRYbgMZALyyAbUztdfCWoo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aIq/D+nUQc5mWr/VDlKi+ykS8Y/x51Bf7qg+zVeCOXCgp679rS4ZNAUB6RqjC1gV5AdmrOl4Kf3JFeo7zlped513A0RYpwXMTuQmT3yCt8Oh23NzI5c38Il6Fy3pP2HO4GLSkE6eYMhMx7qiHwJUA9OfxJIeuqmc5z4gNb6jiBM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=QIXwreJm; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QIXwreJm" Received: from [192.168.1.106] (mob-5-90-52-92.net.vodafone.it [5.90.52.92]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 33AC11116; Mon, 18 Aug 2025 22:41:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1755549680; bh=LBuYHRWyxVZ3a+UY4uT8bKRYbgMZALyyAbUztdfCWoo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QIXwreJm5CBY9Ag/l5oHA2TK+Qb4eq/7dEstccJksFvL5maufWkwr3RGfGqrw9fws olHofxH8nM4uNMIa4crnvnU8jjJxdQeIdusFU/uZ7JEjKHDvbPNCUl1TKExTid9woC SodJs5/C/IMUmnbsyhv7wn2twEln0ySVNAPCYIVk= From: Jacopo Mondi Date: Mon, 18 Aug 2025 22:39:36 +0200 Subject: [PATCH v3 1/2] media: cx18: Fix invalid access to file * Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250818-cx18-v4l2-fh-v3-1-5e2f08f3cadc@ideasonboard.com> References: <20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com> In-Reply-To: <20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com> To: Andy Walls , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6124; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=LBuYHRWyxVZ3a+UY4uT8bKRYbgMZALyyAbUztdfCWoo=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoo5AlKWzGYPVi4myf9GQ2sdnnyQCxQP8ak84aS /8Zamz81SaJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaKOQJQAKCRByNAaPFqFW PGD1EAC/I9JoxOU9aaLpvPI2NrZqVcyA1uvwL7q7nYL5T5I9br9BQWo8GbZsPemi0fSAPSXI9mm 4uuDJAmxcNPsBqHhAkfc9GP2jfmoc6BSYo8+0/X2ffJ4q1oeIV43Dbr+L+YWSNndfFL4cMYzGmJ 4K8ENWInrpPyfYkxfenYh+i5/pUodU+ULPenSp3WQ/xWZXzXLmrRAa+u1cw/6F0/3V8wH6ZPqYm 5QYbfsrKrWTDzgewKoBQ9rsTy3W6q41cD8tGwFI59kHYUkXoCSBGfJnjAk9UouNEZePsKREUQzg D+7I/QO39kmuyFX22QlViCmuninTLOs+NAx0ANn7iElKX7v+w7nkAXoWa3TQ5LiydKXlhYz/6O6 40gOYd4Bds1YEZbV0R/WTOo03a+ecUMtREaNX6Wa9M9Szfe9tL9LibcWX4TymlfdrJFg33BvgEt RR9PhxQm/wtWSQD6+jGAc9Ash/cgdonym4Xoy7WnKVoqi5T4nMpgnjCT8/tLPadT1IKnjZmPQZg jBctcV50J2ZOsigisrzv+ddNaX2hPIOOBn207AivolIRKMqPoWGlpE9Ie/UrTWd4fBlrmv0k6d+ IubSMtMxcx0UJfaltch4SgXrSVTqrrY08/EX0SRRMkjrvYVEzRSCUqgh9RsHghvNRdpWs4VNHkn kkl7Tlbfdg/Zk8w== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B Sice commit 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") all ioctl handlers have been ported to operate on the file * first function argument. The cx18 DVB layer calls cx18_init_on_first_open() when the driver needs to start streaming. This function calls the s_input(), s_std() and s_frequency() ioctl handlers directly, but being called from the driver context, it doesn't have a valid file * to pass them. This causes the ioctl handlers to deference an invalid pointer. Fix this by wrapping the ioctl handlers implementation in helper functions which accepts a cx18 pointer as first argument and make the cx18_init_on_first_open() function call the helpers without going through the ioctl handlers. The bug has been reported by Smatch: --> 1223 cx18_s_input(NULL, &fh, video_input); The patch adds a new dereference of "file" but some of the callers pass a NULL pointer. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/all/aKL4OMWsESUdX8KQ@stanley.mountain/ Fixes: 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") Cc: stable@vger.kernel.org Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/pci/cx18/cx18-driver.c | 9 +++------ drivers/media/pci/cx18/cx18-ioctl.c | 30 +++++++++++++++++++----------- drivers/media/pci/cx18/cx18-ioctl.h | 8 +++++--- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/= cx18-driver.c index 743fcc9613744bfc1edeffc51e908fe88520405a..cd84dfcefcf971a7adb9aac2baf= b9089dbe0f33f 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c @@ -1136,11 +1136,8 @@ int cx18_init_on_first_open(struct cx18 *cx) int video_input; int fw_retry_count =3D 3; struct v4l2_frequency vf; - struct cx18_open_id fh; v4l2_std_id std; =20 - fh.cx =3D cx; - if (test_bit(CX18_F_I_FAILED, &cx->i_flags)) return -ENXIO; =20 @@ -1220,14 +1217,14 @@ int cx18_init_on_first_open(struct cx18 *cx) =20 video_input =3D cx->active_input; cx->active_input++; /* Force update of input */ - cx18_s_input(NULL, &fh, video_input); + cx18_do_s_input(cx, video_input); =20 /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code in one place. */ cx->std++; /* Force full standard initialization */ std =3D (cx->tuner_std =3D=3D V4L2_STD_ALL) ? V4L2_STD_NTSC_M : cx->tuner= _std; - cx18_s_std(NULL, &fh, std); - cx18_s_frequency(NULL, &fh, &vf); + cx18_do_s_std(cx, std); + cx18_do_s_frequency(cx, &vf); return 0; } =20 diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/c= x18-ioctl.c index bf16d36448f888d9326b5f4a8f9c8f0e13d0c3a1..6e869c43cbd520feb720a71d8eb= 2dd60c05b0ae9 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -521,10 +521,8 @@ static int cx18_g_input(struct file *file, void *fh, u= nsigned int *i) return 0; } =20 -int cx18_s_input(struct file *file, void *fh, unsigned int inp) +int cx18_do_s_input(struct cx18 *cx, unsigned int inp) { - struct cx18_open_id *id =3D file2id(file); - struct cx18 *cx =3D id->cx; v4l2_std_id std =3D V4L2_STD_ALL; const struct cx18_card_video_input *card_input =3D cx->card->video_inputs + inp; @@ -558,6 +556,11 @@ int cx18_s_input(struct file *file, void *fh, unsigned= int inp) return 0; } =20 +static int cx18_s_input(struct file *file, void *fh, unsigned int inp) +{ + return cx18_do_s_input(file2id(file)->cx, inp); +} + static int cx18_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) { @@ -570,11 +573,8 @@ static int cx18_g_frequency(struct file *file, void *f= h, return 0; } =20 -int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_freque= ncy *vf) +int cx18_do_s_frequency(struct cx18 *cx, const struct v4l2_frequency *vf) { - struct cx18_open_id *id =3D file2id(file); - struct cx18 *cx =3D id->cx; - if (vf->tuner !=3D 0) return -EINVAL; =20 @@ -585,6 +585,12 @@ int cx18_s_frequency(struct file *file, void *fh, cons= t struct v4l2_frequency *v return 0; } =20 +static int cx18_s_frequency(struct file *file, void *fh, + const struct v4l2_frequency *vf) +{ + return cx18_do_s_frequency(file2id(file)->cx, vf); +} + static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) { struct cx18 *cx =3D file2id(file)->cx; @@ -593,11 +599,8 @@ static int cx18_g_std(struct file *file, void *fh, v4l= 2_std_id *std) return 0; } =20 -int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) +int cx18_do_s_std(struct cx18 *cx, v4l2_std_id std) { - struct cx18_open_id *id =3D file2id(file); - struct cx18 *cx =3D id->cx; - if ((std & V4L2_STD_ALL) =3D=3D 0) return -EINVAL; =20 @@ -642,6 +645,11 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_i= d std) return 0; } =20 +static int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) +{ + return cx18_do_s_std(file2id(file)->cx, std); +} + static int cx18_s_tuner(struct file *file, void *fh, const struct v4l2_tun= er *vt) { struct cx18_open_id *id =3D file2id(file); diff --git a/drivers/media/pci/cx18/cx18-ioctl.h b/drivers/media/pci/cx18/c= x18-ioctl.h index 221e2400fb3e2d817eaff7515fa89eb94f2d7f8a..7a42ac99312ab6502e1abe4f3d5= c88c9c7f144f3 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.h +++ b/drivers/media/pci/cx18/cx18-ioctl.h @@ -12,6 +12,8 @@ u16 cx18_service2vbi(int type); void cx18_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pa= l); u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt); void cx18_set_funcs(struct video_device *vdev); -int cx18_s_std(struct file *file, void *fh, v4l2_std_id std); -int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_freque= ncy *vf); -int cx18_s_input(struct file *file, void *fh, unsigned int inp); + +struct cx18; +int cx18_do_s_std(struct cx18 *cx, v4l2_std_id std); +int cx18_do_s_frequency(struct cx18 *cx, const struct v4l2_frequency *vf); +int cx18_do_s_input(struct cx18 *cx, unsigned int inp); --=20 2.50.1 From nobody Sat Oct 4 08:05:12 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 479C927464F; Mon, 18 Aug 2025 20:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755549746; cv=none; b=jAnpig9AJvBSnXOz5atpCv90WvW9yQx+tj43F1t90nY8FijoMaE4FO15yNf+qe+MEpfK3shOobkdh+0zTxC+g0+r8A0RDBH1ZpzzRMmiYyN5Fwtrlc59gt9POc011IOBgL+wKvkSo9lAvJaE5GIOAkaXdlN95gZSHvy4cnIlzsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755549746; c=relaxed/simple; bh=pASaZZUa8G/kSzlS/eDqbEmaIuYle5Tg6zJNQzxv4+w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pFyMitQJx5hBTfdVLKg0SWtF4+Af8c6JLKsgCgccFEEkroEUnpsY54iRwXPXOSrX4OV5IufBsW57uC49vdflGLIIKRsDXvQaSq6AQepKyeNYd0FJstbyF7OFXB+/Kyg6KusngWoC1phjdmwDjaMMuN/7PdU51vbkJJs+yozX1+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Gi/16nbL; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Gi/16nbL" Received: from [192.168.1.106] (mob-5-90-52-92.net.vodafone.it [5.90.52.92]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 052B811EB; Mon, 18 Aug 2025 22:41:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1755549682; bh=pASaZZUa8G/kSzlS/eDqbEmaIuYle5Tg6zJNQzxv4+w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Gi/16nbLZUP/QS5ixbof3mx1iEnbOylMFFv/mp857+sKrOFrznaEiPO4Z/iEpWD3p xePUXUzxFGZCy+1SLwbPpGAkYrTvdoKW7AEjuFsAjjtZFwuGmeENxH7JsV756lvjHF NPiATQsQ7HMhh0ECn1G1r2XihTJpIee/68Gaum0Y= From: Jacopo Mondi Date: Mon, 18 Aug 2025 22:39:37 +0200 Subject: [PATCH v3 2/2] media: ivtv: Fix invalid access to file * Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250818-cx18-v4l2-fh-v3-2-5e2f08f3cadc@ideasonboard.com> References: <20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com> In-Reply-To: <20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com> To: Andy Walls , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5849; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=pASaZZUa8G/kSzlS/eDqbEmaIuYle5Tg6zJNQzxv4+w=; b=kA0DAAoBcjQGjxahVjwByyZiAGijkCWiszx0ya1IUjfDJzAXDwMl1n8tOhzS/7s3TRw8gLXJd 4kCMwQAAQoAHRYhBLXEPUiAmiCKj1g4wHI0Bo8WoVY8BQJoo5AlAAoJEHI0Bo8WoVY8icIP/18e V0aTRZ6D3TZYaEWMLp41bKXBT4ks36jTn0o0kp/dn//rCeYHUOyWuS+/ICoUcpAIcEtC0BWFJCp clL9tYpGexwitrUW05WLFlAVLOAvEr/bW+OV8vnKVzzY8//HDAALLsh/H/vACKz37wGNV77CuqZ bL5QlaEwJbcXubllVx/ylzgusmF5q+pTBj2xLXetFdepGS6m2XjHmgYzTG2KQE+S2lJSwCbwc2v bNMNTGQjNLMLz9pvs5TBqH2N4rHggqRzUWSQzdjCM7sRZ9yTsygbuG/0B85yjXAUnrTLscatPcB zXtATIo0ZDkvnLcfyeoYkYMksorQdtN0wxw1+5vqSjjU1HhpAvadByqwpHS6AGjFsW/ZPnikatb JbvzIUiEgXYh6IqtVFWDEHH5LjAo89lVGO7vacFEIAkFm5ellTNpzHUISuSsksaa3p0hNdwvPM1 HV4lnyM0PqveN1eR2wCDXW6nBxlq659iJCUND7oJZkLXIPj4o14cl920TD6n068HnofH030uV8W ZwPgzH0ghJhonCyT4b7ZS07snG7WHr79DdM3VVdo6KLGwfnZRV/VIrejND/VzqSn2v0paw8LyvF aHtrzEOmUXOrufKeYPjsrG7qT21WjNNd2346H+c1iFeb2V6Jn5iksSJ+/TIvXEw9EwnZ5lplpll BRrQl X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B Since commit 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") all ioctl handlers have been ported to operate on the file * first function argument. The ivtv DVB layer calls ivtv_init_on_first_open() when the driver needs to start streaming. This function calls the s_input() and s_frequency() ioctl handlers directly, but being called from the driver context, it doesn't have a valid file * to pass them. This causes the ioctl handlers to deference an invalid pointer. Fix this by wrapping the ioctl handlers implementation in helper functions. The ivtv_do_s_input() helper accepts a struct ivtv * as first argument, which is easily accessible from the DVB layer as well as from the file * argument of the ioctl handler. The ivtv_s_frequency() takes an ivtv_stream * instead. The stream * can safely be accessed from the DVB layer which hard-codes it to the IVTV_ENC_STREAM_TYPE_MPG stream type, as well as from the ioctl handler a valid stream type is associated to each open file handle depending on which video device node has been opened in the ivtv_open() file operation. The bug has been reported by Smatch. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/all/aKL4OMWsESUdX8KQ@stanley.mountain/ Fixes: 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") Cc: stable@vger.kernel.org Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/pci/ivtv/ivtv-driver.c | 11 ++++------- drivers/media/pci/ivtv/ivtv-ioctl.c | 22 +++++++++++++++++----- drivers/media/pci/ivtv/ivtv-ioctl.h | 6 ++++-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/= ivtv-driver.c index ecc20cd89926fe2ce4e472526a6b5fc0857615dd..7e2fb98cfccf02f701ceb4484dd= 1d330dd1dc867 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.c +++ b/drivers/media/pci/ivtv/ivtv-driver.c @@ -1260,15 +1260,12 @@ static int ivtv_probe(struct pci_dev *pdev, const s= truct pci_device_id *pci_id) =20 int ivtv_init_on_first_open(struct ivtv *itv) { - struct v4l2_frequency vf; /* Needed to call ioctls later */ - struct ivtv_open_id fh; + struct ivtv_stream *s =3D &itv->streams[IVTV_ENC_STREAM_TYPE_MPG]; + struct v4l2_frequency vf; int fw_retry_count =3D 3; int video_input; =20 - fh.itv =3D itv; - fh.type =3D IVTV_ENC_STREAM_TYPE_MPG; - if (test_bit(IVTV_F_I_FAILED, &itv->i_flags)) return -ENXIO; =20 @@ -1310,13 +1307,13 @@ int ivtv_init_on_first_open(struct ivtv *itv) =20 video_input =3D itv->active_input; itv->active_input++; /* Force update of input */ - ivtv_s_input(NULL, &fh, video_input); + ivtv_do_s_input(itv, video_input); =20 /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code in one place. */ itv->std++; /* Force full standard initialization */ itv->std_out =3D itv->std; - ivtv_s_frequency(NULL, &fh, &vf); + ivtv_do_s_frequency(s, &vf); =20 if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) { /* Turn on the TV-out: ivtv_init_mpeg_decoder() initializes diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/i= vtv-ioctl.c index 8077a71d4850ec773caa20c3fca08f92f3117d69..dfbc842b22453868a2075935a81= db7ae313ee46c 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -974,9 +974,8 @@ static int ivtv_g_input(struct file *file, void *fh, un= signed int *i) return 0; } =20 -int ivtv_s_input(struct file *file, void *fh, unsigned int inp) +int ivtv_do_s_input(struct ivtv *itv, unsigned int inp) { - struct ivtv *itv =3D file2id(file)->itv; v4l2_std_id std; int i; =20 @@ -1017,6 +1016,11 @@ int ivtv_s_input(struct file *file, void *fh, unsign= ed int inp) return 0; } =20 +static int ivtv_s_input(struct file *file, void *fh, unsigned int inp) +{ + return ivtv_do_s_input(file2id(file)->itv, inp); +} + static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) { struct ivtv *itv =3D file2id(file)->itv; @@ -1065,10 +1069,9 @@ static int ivtv_g_frequency(struct file *file, void = *fh, struct v4l2_frequency * return 0; } =20 -int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_freque= ncy *vf) +int ivtv_do_s_frequency(struct ivtv_stream *s, const struct v4l2_frequency= *vf) { - struct ivtv *itv =3D file2id(file)->itv; - struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; + struct ivtv *itv =3D s->itv; =20 if (s->vdev.vfl_dir) return -ENOTTY; @@ -1082,6 +1085,15 @@ int ivtv_s_frequency(struct file *file, void *fh, co= nst struct v4l2_frequency *v return 0; } =20 +static int ivtv_s_frequency(struct file *file, void *fh, + const struct v4l2_frequency *vf) +{ + struct ivtv_open_id *id =3D file2id(file); + struct ivtv *itv =3D id->itv; + + return ivtv_do_s_frequency(&itv->streams[id->type], vf); +} + static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) { struct ivtv *itv =3D file2id(file)->itv; diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.h b/drivers/media/pci/ivtv/i= vtv-ioctl.h index 42c2516379fcbbd0640820ab0e3abe9bf00b57ea..dd713a6b095e5ebca45a234dd6c= 9a90df0928596 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.h +++ b/drivers/media/pci/ivtv/ivtv-ioctl.h @@ -17,7 +17,9 @@ int ivtv_set_speed(struct ivtv *itv, int speed); void ivtv_set_funcs(struct video_device *vdev); void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id std); void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std); -int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_freque= ncy *vf); -int ivtv_s_input(struct file *file, void *fh, unsigned int inp); + +struct ivtv; +int ivtv_do_s_frequency(struct ivtv_stream *s, const struct v4l2_frequency= *vf); +int ivtv_do_s_input(struct ivtv *itv, unsigned int inp); =20 #endif --=20 2.50.1