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-next>] [day] [month] [year] [list]
Message-Id: <1433934428-21980-1-git-send-email-hofrat@osadl.org>
Date:	Wed, 10 Jun 2015 13:07:08 +0200
From:	Nicholas Mc Guire <hofrat@...dl.org>
To:	Russell King <rmk+kernel@....linux.org.uk>
Cc:	David Airlie <airlied@...ux.ie>, dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org, Nicholas Mc Guire <hofrat@...dl.org>
Subject: [PATCH] DRM: Armada: fixup wait_event_timeout being ignored

event API conformance testing with coccinelle spatches are being
used to locate API usage inconsistencies this triggert with:
./drivers/gpu/drm/armada/armada_overlay.c:153
        incorrect check for negative return

Return type of wait_event_timeout is signed long not int and the
return type is >=0 always thus the negative check was effectively
ignoring the timeout event - this looks like a bug.
An appropriately named variable of type long is inserted and the
call fixed up as well as the negative return check changed to detect
the timeout event.

Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
---

The calling side seems to assume 0 as success and <0 as error so 
returning -ETIME should be fine here.

Patch was compile tested with imx_v6_v7_defconfig + CONFIG_DRM_ARMADA=m

Patch is against 4.1-rc7 (localversion-next is -next-20150609)

 drivers/gpu/drm/armada/armada_overlay.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index c5b06fd..f308949 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -107,7 +107,7 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 	struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
 	uint32_t val, ctrl0;
 	unsigned idx = 0;
-	int ret;
+	long time_left;
 
 	crtc_w = armada_limit(crtc_x, crtc_w, dcrtc->crtc.mode.hdisplay);
 	crtc_h = armada_limit(crtc_y, crtc_h, dcrtc->crtc.mode.vdisplay);
@@ -150,11 +150,11 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 			       dcrtc->base + LCD_SPU_SRAM_PARA1);
 	}
 
-	ret = wait_event_timeout(dplane->vbl.wait,
-				 list_empty(&dplane->vbl.update.node),
-				 HZ/25);
-	if (ret < 0)
-		return ret;
+	time_left = wait_event_timeout(dplane->vbl.wait,
+				       list_empty(&dplane->vbl.update.node),
+				       HZ / 25);
+	if (time_left == 0)
+		return -ETIME;
 
 	if (plane->fb != fb) {
 		struct armada_gem_object *obj = drm_fb_obj(fb);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ