media: media-device: fix ioctl function types
authorSami Tolvanen <samitolvanen@google.com>
Mon, 7 May 2018 18:09:46 +0000 (14:09 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:50:35 +0000 (07:50 +0200)
[ Upstream commit daa36370b62428cca6d48d1b2530a8419f631c8c ]

This change fixes function types for media device ioctls to avoid
indirect call mismatches with Control-Flow Integrity checking.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/media-device.c

index e79f72b8b858077f7b646caf7606afb42a830411..62b2c5d9bdfb704a6cb40d61268d9b35a170536a 100644 (file)
@@ -54,9 +54,10 @@ static int media_device_close(struct file *filp)
        return 0;
 }
 
-static int media_device_get_info(struct media_device *dev,
-                                struct media_device_info *info)
+static long media_device_get_info(struct media_device *dev, void *arg)
 {
+       struct media_device_info *info = arg;
+
        memset(info, 0, sizeof(*info));
 
        if (dev->driver_name[0])
@@ -93,9 +94,9 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id)
        return NULL;
 }
 
-static long media_device_enum_entities(struct media_device *mdev,
-                                      struct media_entity_desc *entd)
+static long media_device_enum_entities(struct media_device *mdev, void *arg)
 {
+       struct media_entity_desc *entd = arg;
        struct media_entity *ent;
 
        ent = find_entity(mdev, entd->id);
@@ -146,9 +147,9 @@ static void media_device_kpad_to_upad(const struct media_pad *kpad,
        upad->flags = kpad->flags;
 }
 
-static long media_device_enum_links(struct media_device *mdev,
-                                   struct media_links_enum *links)
+static long media_device_enum_links(struct media_device *mdev, void *arg)
 {
+       struct media_links_enum *links = arg;
        struct media_entity *entity;
 
        entity = find_entity(mdev, links->entity);
@@ -194,9 +195,9 @@ static long media_device_enum_links(struct media_device *mdev,
        return 0;
 }
 
-static long media_device_setup_link(struct media_device *mdev,
-                                   struct media_link_desc *linkd)
+static long media_device_setup_link(struct media_device *mdev, void *arg)
 {
+       struct media_link_desc *linkd = arg;
        struct media_link *link = NULL;
        struct media_entity *source;
        struct media_entity *sink;
@@ -222,9 +223,9 @@ static long media_device_setup_link(struct media_device *mdev,
        return __media_entity_setup_link(link, linkd->flags);
 }
 
-static long media_device_get_topology(struct media_device *mdev,
-                                     struct media_v2_topology *topo)
+static long media_device_get_topology(struct media_device *mdev, void *arg)
 {
+       struct media_v2_topology *topo = arg;
        struct media_entity *entity;
        struct media_interface *intf;
        struct media_pad *pad;