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: <149789538333.9059.572530926643846106.stgit@localhost.localdomain>
Date:   Mon, 19 Jun 2017 21:03:03 +0300
From:   Kirill Tkhai <ktkhai@...tuozzo.com>
To:     linux-ia64@...r.kernel.org, avagin@...tuozzo.com,
        peterz@...radead.org, heiko.carstens@...ibm.com, hpa@...or.com,
        gorcunov@...tuozzo.com, linux-arch@...r.kernel.org,
        linux-s390@...r.kernel.org, x86@...nel.org, mingo@...hat.com,
        mattst88@...il.com, fenghua.yu@...el.com, arnd@...db.de,
        ktkhai@...tuozzo.com, ink@...assic.park.msu.ru, tglx@...utronix.de,
        rth@...ddle.net, tony.luck@...el.com, linux-kernel@...r.kernel.org,
        linux-alpha@...r.kernel.org, schwidefsky@...ibm.com,
        davem@...emloft.net
Subject: [PATCH 5/7] s390: Add __down_read_killable()

Similar to __down_write_killable(), and read killable primitive.

Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
---
 arch/s390/include/asm/rwsem.h |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h
index 597e7e96b59e..6bef7d5fbf1c 100644
--- a/arch/s390/include/asm/rwsem.h
+++ b/arch/s390/include/asm/rwsem.h
@@ -49,7 +49,7 @@
 /*
  * lock for reading
  */
-static inline void __down_read(struct rw_semaphore *sem)
+static inline int ___down_read(struct rw_semaphore *sem)
 {
 	signed long old, new;
 
@@ -62,10 +62,24 @@ static inline void __down_read(struct rw_semaphore *sem)
 		: "=&d" (old), "=&d" (new), "=Q" (sem->count)
 		: "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
 		: "cc", "memory");
-	if (old < 0)
+	return (old < 0);
+}
+
+static inline void __down_read(struct rw_semaphore *sem)
+{
+	if (___down_read(sem))
 		rwsem_down_read_failed(sem);
 }
 
+static inline int __down_read_killable(struct rw_semaphore *sem)
+{
+	if (___down_read(sem))
+		if (IS_ERR(rwsem_down_read_failed_killable(sem)))
+			return -EINTR;
+
+	return 0;
+}
+
 /*
  * trylock for reading -- returns 1 if successful, 0 if contention
  */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ