dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Sasha Levin' <sashal@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Colin Ian King <colin.king@canonical.com>,
	Inki Dae <inki.dae@samsung.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: RE: [PATCH AUTOSEL 5.2 51/59] drm/exynos: fix missing decrement of retry counter
Date: Wed, 7 Aug 2019 08:49:52 +0000	[thread overview]
Message-ID: <2ecde45912fc44b88df2ff5129b8ab67@AcuMS.aculab.com> (raw)
In-Reply-To: <20190806213319.19203-51-sashal@kernel.org>

From: Sasha Levin
> Sent: 06 August 2019 22:33
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> [ Upstream commit 1bbbab097a05276e312dd2462791d32b21ceb1ee ]
> 
> Currently the retry counter is not being decremented, leading to a
> potential infinite spin if the scalar_reads don't change state.
> 
> Addresses-Coverity: ("Infinite loop")
> Fixes: 280e54c9f614 ("drm/exynos: scaler: Reset hardware before starting the operation")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Inki Dae <inki.dae@samsung.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_scaler.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
> index ec9c1b7d31033..8989f8af716b7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
> @@ -94,12 +94,12 @@ static inline int scaler_reset(struct scaler_context *scaler)
>  	scaler_write(SCALER_CFG_SOFT_RESET, SCALER_CFG);
>  	do {
>  		cpu_relax();
> -	} while (retry > 1 &&
> +	} while (--retry > 1 &&
>  		 scaler_read(SCALER_CFG) & SCALER_CFG_SOFT_RESET);
>  	do {
>  		cpu_relax();
>  		scaler_write(1, SCALER_INT_EN);
> -	} while (retry > 0 && scaler_read(SCALER_INT_EN) != 1);
> +	} while (--retry > 0 && scaler_read(SCALER_INT_EN) != 1);
> 
>  	return retry ? 0 : -EIO;

If the first loop hits the retry limit the second loop won't be right
and the final return value will be 0.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

  reply	other threads:[~2019-08-07  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190806213319.19203-1-sashal@kernel.org>
2019-08-06 21:32 ` [PATCH AUTOSEL 5.2 22/59] drm/bridge: lvds-encoder: Fix build error while CONFIG_DRM_KMS_HELPER=m Sasha Levin
2019-08-06 21:32 ` [PATCH AUTOSEL 5.2 23/59] drm/bridge: tc358764: Fix build error Sasha Levin
2019-08-06 21:32 ` [PATCH AUTOSEL 5.2 29/59] drm/amdkfd: Fix byte align on VegaM Sasha Levin
2019-08-06 21:32 ` [PATCH AUTOSEL 5.2 31/59] drm/amdgpu: fix error handling in amdgpu_cs_process_fence_dep Sasha Levin
     [not found] ` <20190806213319.19203-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2019-08-06 21:32   ` [PATCH AUTOSEL 5.2 30/59] drm/amd/powerplay: fix null pointer dereference around dpm state relates Sasha Levin
2019-08-06 21:32   ` [PATCH AUTOSEL 5.2 32/59] drm/amdgpu: fix a potential information leaking bug Sasha Levin
2019-08-06 21:32 ` [PATCH AUTOSEL 5.2 37/59] drm/vgem: fix cache synchronization on arm/arm64 Sasha Levin
2019-08-06 22:45   ` Rob Clark
2019-08-18  1:45     ` Sasha Levin
2019-08-06 21:33 ` [PATCH AUTOSEL 5.2 49/59] drm: msm: Fix add_gpu_components Sasha Levin
2019-08-06 21:33 ` [PATCH AUTOSEL 5.2 51/59] drm/exynos: fix missing decrement of retry counter Sasha Levin
2019-08-07  8:49   ` David Laight [this message]
2019-08-18  1:47     ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ecde45912fc44b88df2ff5129b8ab67@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=colin.king@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox