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: <20180730055515epcas5p3358ce6d5e80b66256ea92aa5659f74bb~GD9F1P8zb2847928479epcas5p3D@epcas5p3.samsung.com>
Date:   Mon, 30 Jul 2018 10:48:36 +0530
From:   Satendra Singh Thakur <satendra.t@...sung.com>
To:     Gustavo Padovan <gustavo@...ovan.org>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Sean Paul <seanpaul@...omium.org>,
        David Airlie <airlied@...ux.ie>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:     vineet.j@...sung.com, hemanshu.s@...sung.com,
        nishant.y08@...sung.com, sst2005@...il.com,
        Satendra Singh Thakur <satendra.t@...sung.com>
Subject: [PATCH] drm/kms/plane: Avoiding redundant checks in case of EDEADLK
 retries

1. Currently, if modeset_lock is re-tried many times in case of EDEADLK
error, then this will be the code flow

retry:
	ret = drm_modeset_lock();

if (ret)-->this is true
		goto out;

out:
	if (fb)
	if (plane->old_fb)
	if (ret == -EDEADLK)
		goto retry;
It can be observed that checks on fb, old_fb are redundant
in retry-case.
If we keep if (ret == -EDEADLK) right after the out label,
that will avoid redundant checks.
It won't affect normal scenario (non-retry case).
2. Moved NULL assignment inside if statement related to NULL check

Signed-off-by: Satendra Singh Thakur <satendra.t@...sung.com>
---
 drivers/gpu/drm/drm_plane.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 0350544..ed42cd4 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -658,9 +658,10 @@ static int __setplane_internal(struct drm_plane *plane,
 	}
 
 out:
-	if (plane->old_fb)
+	if (plane->old_fb) {
 		drm_framebuffer_put(plane->old_fb);
-	plane->old_fb = NULL;
+		plane->old_fb = NULL;
+	}
 
 	return ret;
 }
@@ -1097,17 +1098,17 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 	}
 
 out:
-	if (fb)
-		drm_framebuffer_put(fb);
-	if (plane->old_fb)
-		drm_framebuffer_put(plane->old_fb);
-	plane->old_fb = NULL;
-
 	if (ret == -EDEADLK) {
 		ret = drm_modeset_backoff(&ctx);
 		if (!ret)
 			goto retry;
 	}
+	if (fb)
+		drm_framebuffer_put(fb);
+	if (plane->old_fb) {
+		drm_framebuffer_put(plane->old_fb);
+		plane->old_fb = NULL;
+	}
 
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ