Skip to content

Commit

Permalink
media: ti-vpe: cal: Unregister video device before cleanup
Browse files Browse the repository at this point in the history
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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Jul 19, 2020
1 parent 19a2374 commit 6675e87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/platform/ti-vpe/cal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 6675e87

Please sign in to comment.