Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tejas Upadhyay <tejas.upadhyay@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
Subject: [PATCH] drm/xe: validate client of BO inside lock
Date: Mon,  3 Jun 2024 19:58:23 +0530	[thread overview]
Message-ID: <20240603142823.720213-1-tejas.upadhyay@intel.com> (raw)

As client of BO getting referenced inside lock of BOs
list, its good practice to move these WARN_ONs also
under same lock to validate existance of bo->client.

Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
---
 drivers/gpu/drm/xe/xe_drm_client.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c
index 4a19b771e3a0..7881b02fa117 100644
--- a/drivers/gpu/drm/xe/xe_drm_client.c
+++ b/drivers/gpu/drm/xe/xe_drm_client.c
@@ -131,10 +131,9 @@ void __xe_drm_client_free(struct kref *kref)
 void xe_drm_client_add_bo(struct xe_drm_client *client,
 			  struct xe_bo *bo)
 {
+	spin_lock(&client->bos_lock);
 	XE_WARN_ON(bo->client);
 	XE_WARN_ON(!list_empty(&bo->client_link));
-
-	spin_lock(&client->bos_lock);
 	bo->client = xe_drm_client_get(client);
 	list_add_tail(&bo->client_link, &client->bos_list);
 	spin_unlock(&client->bos_lock);
-- 
2.25.1


             reply	other threads:[~2024-06-03 14:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 14:28 Tejas Upadhyay [this message]
2024-06-04 17:32 ` ✓ CI.Patch_applied: success for drm/xe: validate client of BO inside lock Patchwork
2024-06-04 17:33 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-04 17:35 ` ✓ CI.KUnit: success " Patchwork
2024-06-04 17:49 ` ✓ CI.Build: " Patchwork
2024-06-04 17:49 ` ✗ CI.Hooks: failure " Patchwork
2024-06-04 17:50 ` ✓ CI.checksparse: success " Patchwork
2024-06-04 18:30 ` ✓ CI.BAT: " Patchwork
2024-06-04 22:58 ` ✗ CI.FULL: failure " Patchwork
2024-06-05  6:41 ` [PATCH] " Ghimiray, Himal Prasad
2024-06-05  7:29   ` Ghimiray, Himal Prasad

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=20240603142823.720213-1-tejas.upadhyay@intel.com \
    --to=tejas.upadhyay@intel.com \
    --cc=intel-xe@lists.freedesktop.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