[hurd,commited] hurd: Fix hang in _hurd_raise_signal from pthread_kill

Message ID 20200606235746.3877290-1-samuel.thibault@ens-lyon.org
State New
Headers show
Series
  • [hurd,commited] hurd: Fix hang in _hurd_raise_signal from pthread_kill
Related show

Commit Message

Samuel Thibault June 6, 2020, 11:57 p.m.
When ss is not NULL, it is assumed to be locked.

* hurd/hurd-raise.c (_hurd_raise_signal): Unlock before returning an
error if ss is not NULL.
---
 hurd/hurd-raise.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.26.2

Patch

diff --git a/hurd/hurd-raise.c b/hurd/hurd-raise.c
index af464377b6..865e498bf9 100644
--- a/hurd/hurd-raise.c
+++ b/hurd/hurd-raise.c
@@ -29,7 +29,11 @@  _hurd_raise_signal (struct hurd_sigstate *ss,
 		    int signo, const struct hurd_signal_detail *detail)
 {
   if (signo <= 0 || signo >= NSIG)
-    return EINVAL;
+    {
+      if (ss)
+	__spin_unlock (&ss->lock);
+      return EINVAL;
+    }
 
   if (ss == NULL)
     {