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]
Date:   Tue, 3 Oct 2023 15:23:08 +0200
From:   Hans Verkuil <hverkuil-cisco@...all.nl>
To:     Marvin Lin <milkfafa@...il.com>, mchehab@...nel.org
Cc:     dan.carpenter@...aro.org, linux-media@...r.kernel.org,
        linux-kernel@...r.kernel.org, openbmc@...ts.ozlabs.org,
        avifishman70@...il.com, tmaimon77@...il.com, kwliu@...oton.com,
        kflin@...oton.com
Subject: Re: [PATCH] media: nuvoton: npcm-video: Fix sleeping in atomic
 context

On 10/3/23 09:55, Marvin Lin wrote:
> Fix sleeping in atomic context warnings reported by the Smatch static
> analysis tool. Use GFP_ATOMIC instead of GFP_KERNEL in atomic context.
> 
> Fixes: 70721089985c ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Signed-off-by: Marvin Lin <milkfafa@...il.com>
> ---
>  drivers/media/platform/nuvoton/npcm-video.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c
> index ac8d73b794d3..5d160978f7b3 100644
> --- a/drivers/media/platform/nuvoton/npcm-video.c
> +++ b/drivers/media/platform/nuvoton/npcm-video.c
> @@ -412,7 +412,7 @@ static unsigned int npcm_video_add_rect(struct npcm_video *video,
>  	struct rect_list *list = NULL;
>  	struct v4l2_rect *r;
>  
> -	list = kzalloc(sizeof(*list), GFP_KERNEL);
> +	list = kzalloc(sizeof(*list), GFP_ATOMIC);
>  	if (!list)
>  		return 0;
>  
> @@ -467,7 +467,7 @@ static struct rect_list *npcm_video_new_rect(struct npcm_video *video,
>  	struct rect_list *list = NULL;
>  	struct v4l2_rect *r;
>  
> -	list = kzalloc(sizeof(*list), GFP_KERNEL);
> +	list = kzalloc(sizeof(*list), GFP_ATOMIC);
>  	if (!list)
>  		return NULL;
>  

I'm not really sure this is the right approach.

Looking closer at the code I notice that npcm_video_irq is a threaded
interrupt handler, so wouldn't it be easier to change the video->lock
spinlock to a mutex?

Regards,

	Hans

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ