diff options
author | Laurent Pinchart <[email protected]> | 2020-07-06 20:36:17 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <[email protected]> | 2020-07-19 09:34:25 +0200 |
commit | 6675e871ca4dab14e849298767d34c2722f3ee1e (patch) | |
tree | ff41db8f06cfb37f63ffa1a193185b3a1fe7273c | |
parent | 19a2374068b557ed1a19c68ebaef5f1a161e2973 (diff) |
media: ti-vpe: cal: Unregister video device before cleanup
In cal_remove(), unregister the video devices as the first operation,
before cleaning up the V4L2 objects, to avoid use-after-free. This isn't
a complete solution yet, as video nodes can be kept open across
unregistration.
Signed-off-by: Laurent Pinchart <[email protected]>
Reviewed-by: Benoit Parrot <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-rw-r--r-- | drivers/media/platform/ti-vpe/cal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 5f218ac5fb60..5580913a1356 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -2320,11 +2320,11 @@ static int cal_remove(struct platform_device *pdev) if (ctx) { ctx_dbg(1, ctx, "unregistering %s\n", video_device_node_name(&ctx->vdev)); + cal_ctx_v4l2_unregister(ctx); cal_camerarx_disable(ctx->phy); v4l2_async_notifier_unregister(&ctx->notifier); v4l2_async_notifier_cleanup(&ctx->notifier); cal_ctx_v4l2_cleanup(ctx); - cal_ctx_v4l2_unregister(ctx); } } |