[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <oypijd5xekra51.fsf%l.stelmach@samsung.com>
Date: Mon, 18 Aug 2025 16:12:58 +0200
From: Lukasz Stelmach <l.stelmach@...sung.com>
To: Jacopo Mondi <jacopo.mondi@...asonboard.com>
Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev, linux-doc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
linux-tegra@...r.kernel.org, imx@...ts.linux.dev,
linux-renesas-soc@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-samsung-soc@...r.kernel.org, linux-sunxi@...ts.linux.dev,
linux-usb@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linux-rockchip@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com, mjpeg-users@...ts.sourceforge.net
Subject: Re: [PATCH 27/65] media: Reset file->private_data to NULL in
v4l2_fh_del()
It was <2025-08-02 sob 11:22>, when Jacopo Mondi wrote:
> From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
>
> 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..922262f61e7b53baf1b5840d35149bf5b4b2e7ad 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/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> index c4ad0196ed8f1bf579365a0a21dd8c4a78bdaa10..2a57efd181540183e7d2b66d51f9f2f274ddd100 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;
>
> 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: Łukasz Stelmach <l.stelmach@...sung.com>
[...]
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
Download attachment "signature.asc" of type "application/pgp-signature" (488 bytes)
Powered by blists - more mailing lists