diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-08-30 13:18:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-10-31 13:51:45 -0400 |
commit | b6ee3f0dcf43dc3e8dbbe9be9c4e728c8d52f1ba (patch) | |
tree | 4171a3b2634b8238b12188cd55fd629157efaeb6 /drivers/media/platform/rcar_drif.c | |
parent | bce9e317cec9c4ffff3dde1170c0ad70f5e690c8 (diff) | |
download | linux-b6ee3f0dcf43dc3e8dbbe9be9c4e728c8d52f1ba.tar.gz linux-b6ee3f0dcf43dc3e8dbbe9be9c4e728c8d52f1ba.tar.bz2 linux-b6ee3f0dcf43dc3e8dbbe9be9c4e728c8d52f1ba.zip |
media: v4l: async: Move async subdev notifier operations to a separate structure
The async subdev notifier .bound(), .unbind() and .complete() operations
are function pointers stored directly in the v4l2_async_subdev
structure. As the structure isn't immutable, this creates a potential
security risk as the function pointers are mutable.
To fix this, move the function pointers to a new
v4l2_async_subdev_operations structure that can be made const in
drivers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/rcar_drif.c')
-rw-r--r-- | drivers/media/platform/rcar_drif.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c index 2c6afd38b78a..63c94f4028a7 100644 --- a/drivers/media/platform/rcar_drif.c +++ b/drivers/media/platform/rcar_drif.c @@ -1185,6 +1185,12 @@ error: return ret; } +static const struct v4l2_async_notifier_operations rcar_drif_notify_ops = { + .bound = rcar_drif_notify_bound, + .unbind = rcar_drif_notify_unbind, + .complete = rcar_drif_notify_complete, +}; + /* Read endpoint properties */ static void rcar_drif_get_ep_properties(struct rcar_drif_sdr *sdr, struct fwnode_handle *fwnode) @@ -1347,9 +1353,7 @@ static int rcar_drif_sdr_probe(struct rcar_drif_sdr *sdr) if (ret) goto error; - sdr->notifier.bound = rcar_drif_notify_bound; - sdr->notifier.unbind = rcar_drif_notify_unbind; - sdr->notifier.complete = rcar_drif_notify_complete; + sdr->notifier.ops = &rcar_drif_notify_ops; /* Register notifier */ ret = v4l2_async_notifier_register(&sdr->v4l2_dev, &sdr->notifier); |