From: Hans Verkuil Date: Mon, 1 Oct 2012 09:45:36 +0000 (-0300) Subject: [media] ivtv: don't allow g/s_frequency for output device nodes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dff274fd86e401880d2d10c1dd7fa1fcb6d2bdbc;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [media] ivtv: don't allow g/s_frequency for output device nodes Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c index eed95a396665..74e9a5032364 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.c +++ b/drivers/media/pci/ivtv/ivtv-driver.c @@ -1325,6 +1325,7 @@ int ivtv_init_on_first_open(struct ivtv *itv) int video_input; fh.itv = itv; + fh.type = IVTV_ENC_STREAM_TYPE_MPG; if (test_bit(IVTV_F_I_FAILED, &itv->i_flags)) return -ENXIO; diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c index e5ce970266f3..5537c8842075 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -1064,7 +1064,10 @@ static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) { struct ivtv *itv = fh2id(fh)->itv; + struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; + if (s->vdev->vfl_dir) + return -ENOTTY; if (vf->tuner != 0) return -EINVAL; @@ -1075,7 +1078,10 @@ static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency * int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) { struct ivtv *itv = fh2id(fh)->itv; + struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; + if (s->vdev->vfl_dir) + return -ENOTTY; if (vf->tuner != 0) return -EINVAL;