All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, Sumit Semwal <sumit.semwal@linaro.org>
Subject: [PATCH 3/7] dma-buf/sw-sync: Prevent user overflow on timeline advance
Date: Thu, 29 Jun 2017 13:59:26 +0100	[thread overview]
Message-ID: <20170629125930.821-3-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20170629125930.821-1-chris@chris-wilson.co.uk>

The timeline is u32, which limits any single advance to INT_MAX so that
we can detect all fences that need signaling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
---
 drivers/dma-buf/sw_sync.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
index 4d5d8c5e2534..0e676d08aa70 100644
--- a/drivers/dma-buf/sw_sync.c
+++ b/drivers/dma-buf/sw_sync.c
@@ -345,6 +345,11 @@ static long sw_sync_ioctl_inc(struct sync_timeline *obj, unsigned long arg)
 	if (copy_from_user(&value, (void __user *)arg, sizeof(value)))
 		return -EFAULT;
 
+	while (value > INT_MAX)  {
+		sync_timeline_signal(obj, INT_MAX);
+		value -= INT_MAX;
+	}
+
 	sync_timeline_signal(obj, value);
 
 	return 0;
-- 
2.13.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-06-29 12:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 12:59 [PATCH 1/7] dma-buf/dma-fence: Extract __dma_fence_is_later() Chris Wilson
2017-06-29 12:59 ` [PATCH 2/7] dma-buf/sw-sync: Fix the is-signaled test to handle u32 wraparound Chris Wilson
2017-06-29 12:59 ` Chris Wilson [this message]
2017-06-29 12:59 ` [PATCH 4/7] dma-buf/sw-sync: Reduce irqsave/irqrestore from known context Chris Wilson
2017-06-29 12:59 ` [PATCH 5/7] dma-buf/sw-sync: sync_pt is private and of fixed size Chris Wilson
2017-06-29 12:59 ` [PATCH 6/7] dma-buf/sw-sync: Fix locking around sync_timeline lists Chris Wilson
2017-06-29 17:22   ` Sean Paul
2017-06-29 17:29     ` Chris Wilson
2017-06-29 21:05   ` [PATCH v2] " Chris Wilson
2017-06-29 21:12   ` [PATCH v3] dma-buf/sw-sync: Use an rbtree to sort fences in the timeline Chris Wilson
2017-06-29 12:59 ` [PATCH 7/7] " Chris Wilson
2017-06-29 18:10   ` Sean Paul
2017-06-29 18:29     ` Chris Wilson
2017-06-29 21:08   ` [PATCH v2] " Chris Wilson
2017-06-29 14:08 ` ✓ Fi.CI.BAT: success for series starting with [1/7] dma-buf/dma-fence: Extract __dma_fence_is_later() Patchwork
2017-06-29 20:14 ` [PATCH 1/7] " Sean Paul
2017-06-29 23:20   ` Gustavo Padovan
2017-06-29 21:41 ` ✓ Fi.CI.BAT: success for series starting with [1/7] dma-buf/dma-fence: Extract __dma_fence_is_later() (rev4) Patchwork

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=20170629125930.821-3-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sumit.semwal@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.