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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251125104443.82974-3-phasta@kernel.org>
Date: Tue, 25 Nov 2025 11:44:44 +0100
From: Philipp Stanner <phasta@...nel.org>
To: Sumit Semwal <sumit.semwal@...aro.org>,
	Gustavo Padovan <gustavo@...ovan.org>,
	Christian König <christian.koenig@....com>,
	Daniel Almeida <daniel.almeida@...labora.com>
Cc: linux-media@...r.kernel.org,
	dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org,
	Philipp Stanner <phasta@...nel.org>
Subject: [PATCH 2/2] dma-buf/dma-fence: Unify return codes for signalled fences

Almost all users of dma_fence_signal() ignore the return code which
would indicate that the fence was already signaled. The same return code
by dma_fence_add_callback() cannot be ignored, however, because it's
needed to detect races.

For an already signaled fence, dma_fence_signal() returns -EINVAL,
whereas dma_fence_add_callback() returns -ENOENT.

Unify the error codes by having dma_fence_signal() return -ENOENT, too.

Signed-off-by: Philipp Stanner <phasta@...nel.org>
---
 drivers/dma-buf/dma-fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 3a48896ded62..09d97624e647 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -373,7 +373,7 @@ int dma_fence_signal_timestamp_locked(struct dma_fence *fence,
 	lockdep_assert_held(fence->lock);
 
 	if (unlikely(__dma_fence_is_signaled(fence)))
-		return -EINVAL;
+		return -ENOENT;
 
 	/* Stash the cb_list before replacing it with the timestamp */
 	list_replace(&fence->cb_list, &cb_list);
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ