Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6cf90a9 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] v4l2-ioctl.c: check for valid tuner type in S_HW_FREQ_SEEK



Prohibit attempts to change the tuner to a type that is different
from the device node the ioctl is called from. I.e. the type must
be RADIO for a radio node and ANALOG_TV for a video/vbi node.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 48783301
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -1946,12 +1946,18 @@ static long __video_do_ioctl(struct file *file,
	case VIDIOC_S_HW_FREQ_SEEK:
	{
		struct v4l2_hw_freq_seek *p = arg;
		enum v4l2_tuner_type type;

		if (!ops->vidioc_s_hw_freq_seek)
			break;
		type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
			V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
		dbgarg(cmd,
			"tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n",
			p->tuner, p->type, p->seek_upward, p->wrap_around);
			"tuner=%u, type=%u, seek_upward=%u, wrap_around=%u, spacing=%u\n",
			p->tuner, p->type, p->seek_upward, p->wrap_around, p->spacing);
		if (p->type != type)
			ret = -EINVAL;
		else
			ret = ops->vidioc_s_hw_freq_seek(file, fh, p);
		break;
	}