]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blobdiff - drivers/media/v4l2-core/v4l2-ioctl.c
v4l2: prevent speculative load
[hercules2020/nv-tegra/linux-4.4.git] / drivers / media / v4l2-core / v4l2-ioctl.c
index 724cb9046360ff28d211a56983644952257c4fb5..cd659d44b36ab0bff4eccb545a741b69697d7ed9 100644 (file)
@@ -28,6 +28,8 @@
 #include <media/v4l2-device.h>
 #include <media/videobuf2-v4l2.h>
 
+#include <asm/barrier.h>
+
 #include <trace/events/v4l2.h>
 
 /* Zero out the end of the struct pointed to by p.  Everything after, but
@@ -2515,6 +2517,7 @@ bool v4l2_is_known_ioctl(unsigned int cmd)
 {
        if (_IOC_NR(cmd) >= V4L2_IOCTLS)
                return false;
+       speculation_barrier();
        return v4l2_ioctls[_IOC_NR(cmd)].ioctl == cmd;
 }
 
@@ -2524,6 +2527,7 @@ struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned cmd)
                return vdev->lock;
        if (test_bit(_IOC_NR(cmd), vdev->disable_locking))
                return NULL;
+       speculation_barrier();
        if (vdev->queue && vdev->queue->lock &&
                        (v4l2_ioctls[_IOC_NR(cmd)].flags & INFO_FL_QUEUE))
                return vdev->queue->lock;