Re: [PATCH 27/65] media: Reset file->private_data to NULL in v4l2_fh_del()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It was <2025-08-02 sob 11:22>, when Jacopo Mondi wrote:
> From: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxx>



[...]


-- 
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux