lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c39b3c3-8146-4418-8835-6dbfe38a85ec@collabora.com>
Date: Mon, 29 Apr 2024 19:44:59 +0200
From: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
To: Ming Qian <ming.qian@....com>, mchehab@...nel.org,
 hverkuil-cisco@...all.nl
Cc: shawnguo@...nel.org, robh+dt@...nel.org, s.hauer@...gutronix.de,
 kernel@...gutronix.de, festevam@...il.com, linux-imx@....com,
 xiahong.bao@....com, eagle.zhou@....com, tao.jiang_2@....com,
 ming.qian@....nxp.com, imx@...ts.linux.dev, linux-media@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 3/3] media: amphion: Remove lock in s_ctrl callback

Hi Ming Qian,

W dniu 25.04.2024 o 08:50, Ming Qian pisze:
> There is no need to add lock in s_ctrl callback, it has been
> synchronized by the ctrl_handler's lock, otherwise it may led to
> deadlock if driver call v4l2_ctrl_s_ctrl().
> 
> Signed-off-by: Ming Qian <ming.qian@....com>
> ---
>   drivers/media/platform/amphion/vdec.c | 2 --
>   drivers/media/platform/amphion/venc.c | 2 --
>   2 files changed, 4 deletions(-)
> 
> diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c
> index a57f9f4f3b87..6a38a0fa0e2d 100644
> --- a/drivers/media/platform/amphion/vdec.c
> +++ b/drivers/media/platform/amphion/vdec.c
> @@ -195,7 +195,6 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl)
>   	struct vdec_t *vdec = inst->priv;
>   	int ret = 0;
>   
> -	vpu_inst_lock(inst);

I assume that PATCH v2 2/3 might cause the said deadlock to happen?
If so, maybe it would make more sense to make the current patch preceed
  PATCH v2 2/3? Otherwise the kernel at PATCH v2 2/3 introduces a potential
deadlock.

Regards,

Andrzej

>   	switch (ctrl->id) {
>   	case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE:
>   		vdec->params.display_delay_enable = ctrl->val;
> @@ -207,7 +206,6 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl)
>   		ret = -EINVAL;
>   		break;
>   	}
> -	vpu_inst_unlock(inst);
>   
>   	return ret;
>   }
> diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c
> index cdfaba9d107b..351b4edc8742 100644
> --- a/drivers/media/platform/amphion/venc.c
> +++ b/drivers/media/platform/amphion/venc.c
> @@ -518,7 +518,6 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
>   	struct venc_t *venc = inst->priv;
>   	int ret = 0;
>   
> -	vpu_inst_lock(inst);
>   	switch (ctrl->id) {
>   	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
>   		venc->params.profile = ctrl->val;
> @@ -579,7 +578,6 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
>   		ret = -EINVAL;
>   		break;
>   	}
> -	vpu_inst_unlock(inst);
>   
>   	return ret;
>   }


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ