Re: [PATCH 27/65] media: Reset file->private_data to NULL in v4l2_fh_del()
Lukasz Stelmach <[email protected]> Mon, 18 Aug 2025 16:12:58 +0200
| Newsgroups | gmane.linux.ports.tegra,gmane.linux.drivers.video-input-infrastructure,gmane.linux.kernel,gmane.linux.documentation,gmane.linux.ports.arm.kernel,gmane.linux.ports.arm.mediatek,gmane.linux.kernel.renesas-soc,gmane.linux.ports.arm.msm,gmane.linux.kernel.samsung-soc,gmane.linux.usb.general,gmane.linux.ports.arm.rockchip,gmane.comp.video.mjpeg.user |
|---|---|
| Message-ID | <oypijd5xekra51.fsf%[email protected]> |
--=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable It was <2025-08-02 sob 11:22>, when Jacopo Mondi wrote: > From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]> > > Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset > the file->private_data pointer to NULL in their video device .release() > file operation handler. Move the code to the v4l2_fh_del() function to > avoid direct access to file->private_data in drivers. This requires > adding a file pointer argument to the function. [...] > diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media= /platform/samsung/s5p-g2d/g2d.c > index e34cae9c9cf65d3161822b68233d28472171f917..922262f61e7b53baf1b5840d3= 5149bf5b4b2e7ad 100644 > --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c > +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c > @@ -280,7 +280,7 @@ static int g2d_release(struct file *file) > v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); > mutex_unlock(&dev->mutex); > v4l2_ctrl_handler_free(&ctx->ctrl_handler); > - v4l2_fh_del(&ctx->fh); > + v4l2_fh_del(&ctx->fh, file); > v4l2_fh_exit(&ctx->fh); > kfree(ctx); > v4l2_info(&dev->v4l2_dev, "instance closed\n"); > diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/driver= s/media/platform/samsung/s5p-jpeg/jpeg-core.c > index c4ad0196ed8f1bf579365a0a21dd8c4a78bdaa10..2a57efd181540183e7d2b66d5= 1f9f2f274ddd100 100644 > --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c > +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c > @@ -1005,7 +1005,7 @@ static int s5p_jpeg_open(struct file *file) > return 0; >=20=20 > error: > - v4l2_fh_del(&ctx->fh); > + v4l2_fh_del(&ctx->fh, file); > v4l2_fh_exit(&ctx->fh); > mutex_unlock(&jpeg->lock); > free: > @@ -1021,7 +1021,7 @@ static int s5p_jpeg_release(struct file *file) > mutex_lock(&jpeg->lock); > v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); > v4l2_ctrl_handler_free(&ctx->ctrl_handler); > - v4l2_fh_del(&ctx->fh); > + v4l2_fh_del(&ctx->fh, file); > v4l2_fh_exit(&ctx->fh); > kfree(ctx); > mutex_unlock(&jpeg->lock); Acked-by: =C5=81ukasz Stelmach <[email protected]> [...] =2D-=20 =C5=81ukasz Stelmach Samsung R&D Institute Poland Samsung Electronics --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEXpuyqjq9kGEVr9UQsK4enJilgBAFAmijNOoACgkQsK4enJil gBAXpggAhxgfNJt5JHfaNRWL4tntTEflz9jY6aL37c5XVvyFfbAOD9ZUAipWxJ3g fm3satj2+sGjeHZtH4lAnwpLpNY8egrTC1c9muXvIy/ExVz7jwo1JW/IKM9a0tZl D9N1GuZeTlQeLoFPsXl4LQhDbj48llm8roSKgfK4mU8ymTEw6BYOQ7bMZcxWKd9+ amU+zqtKIXE3OHNKDB3Hoo9pLBhOIBPXcqEV8rwNbC0dyidV8GvVUUv4ptQBlAyV SNaaVoSHo+4P9caRnQOeX3kj7NXJa3ES03Cgpj8IhhZigvTtXJ+VL0fL283OuvOe p2JcG+pKY00NgIMbtv0xGbMhZGox9A== =VvC9 -----END PGP SIGNATURE----- --=-=-=--