patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] gpudev: fix deadlocks when registering callback
@ 2023-01-03 10:49 David Marchand
  2023-01-29 15:36 ` eagostini
  2023-01-31 10:14 ` David Marchand
  0 siblings, 2 replies; 3+ messages in thread
From: David Marchand @ 2023-01-03 10:49 UTC (permalink / raw)
  To: dev; +Cc: stable, Elena Agostini, Thomas Monjalon

gpu_callback_lock was not released in some branches of the register
helper.
While at it, set rte_errno in one branch.

Fixes: 18cb07563165 ("gpudev: add event notification")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/gpudev/gpudev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c
index 805719d00c..8f12abef23 100644
--- a/lib/gpudev/gpudev.c
+++ b/lib/gpudev/gpudev.c
@@ -408,6 +408,7 @@ rte_gpu_callback_register(int16_t dev_id, enum rte_gpu_event event,
 					callback->function == function &&
 					callback->user_data == user_data) {
 				GPU_LOG(INFO, "callback already registered");
+				rte_rwlock_write_unlock(&gpu_callback_lock);
 				return 0;
 			}
 		}
@@ -415,7 +416,9 @@ rte_gpu_callback_register(int16_t dev_id, enum rte_gpu_event event,
 		callback = malloc(sizeof(*callback));
 		if (callback == NULL) {
 			GPU_LOG(ERR, "cannot allocate callback");
-			return -ENOMEM;
+			rte_rwlock_write_unlock(&gpu_callback_lock);
+			rte_errno = ENOMEM;
+			return -rte_errno;
 		}
 		callback->function = function;
 		callback->user_data = user_data;
-- 
2.39.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] gpudev: fix deadlocks when registering callback
  2023-01-03 10:49 [PATCH] gpudev: fix deadlocks when registering callback David Marchand
@ 2023-01-29 15:36 ` eagostini
  2023-01-31 10:14 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: eagostini @ 2023-01-29 15:36 UTC (permalink / raw)
  To: david.marchand; +Cc: dev, eagostini, stable, thomas

Agree with the patch.
Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpudev: fix deadlocks when registering callback
  2023-01-03 10:49 [PATCH] gpudev: fix deadlocks when registering callback David Marchand
  2023-01-29 15:36 ` eagostini
@ 2023-01-31 10:14 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2023-01-31 10:14 UTC (permalink / raw)
  To: dev; +Cc: stable, Elena Agostini, Thomas Monjalon

On Tue, Jan 3, 2023 at 11:49 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> gpu_callback_lock was not released in some branches of the register
> helper.
> While at it, set rte_errno in one branch.
>
> Fixes: 18cb07563165 ("gpudev: add event notification")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Elena Agostini <eagostini@nvidia.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-31 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 10:49 [PATCH] gpudev: fix deadlocks when registering callback David Marchand
2023-01-29 15:36 ` eagostini
2023-01-31 10:14 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).