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: <0370257c-ce0c-792f-6c85-50ebc18975f9@st.com>
Date:   Fri, 15 Dec 2017 14:51:00 +0000
From:   Fabien DESSENNE <fabien.dessenne@...com>
To:     Jia-Ju Bai <baijiaju1990@...il.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
CC:     "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Benjamin GAIGNARD" <benjamin.gaignard@...com>,
        Hans Verkuil <hverkuil@...all.nl>
Subject: Re: [PATCH 1/2] bdisp: Fix a possible sleep-in-atomic bug in
 bdisp_hw_reset

Hi

On 12/12/17 14:47, Jia-Ju Bai wrote:
> The driver may sleep under a spinlock.
> The function call path is:
> bdisp_device_run (acquire the spinlock)
>    bdisp_hw_reset
>      msleep --> may sleep
>
> To fix it, msleep is replaced with mdelay.

May I suggest you to use readl_poll_timeout_atomic (instead of the whole 
"for" block): this fixes the problem and simplifies the code?

>
> This bug is found by my static analysis tool(DSAC) and checked by my code review.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
>   drivers/media/platform/sti/bdisp/bdisp-hw.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c
> index b7892f3..4b62ceb 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
> @@ -382,7 +382,7 @@ int bdisp_hw_reset(struct bdisp_dev *bdisp)
>   	for (i = 0; i < POLL_RST_MAX; i++) {
>   		if (readl(bdisp->regs + BLT_STA1) & BLT_STA1_IDLE)
>   			break;
> -		msleep(POLL_RST_DELAY_MS);
> +		mdelay(POLL_RST_DELAY_MS);
>   	}
>   	if (i == POLL_RST_MAX)
>   		dev_err(bdisp->dev, "Reset timeout\n");

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ