[Xenial][PATCH 1/1] Revert "Revert "af_unix: Revert 'lock_interruptible' in stream receive code""

Joseph Salisbury joseph.salisbury at canonical.com
Thu Mar 17 21:28:51 UTC 2016


BugLink: http://bugs.launchpad.net/bugs/1558447

This reverts commit d45d44e002a9db710bde7c9a5831dd3324b32813.
---
 net/unix/af_unix.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index e2ccd7e..898a53a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2293,14 +2293,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)
 	/* Lock the socket to prevent queue disordering
 	 * while sleeps in memcpy_tomsg
 	 */
-	err = mutex_lock_interruptible(&u->readlock);
-	if (unlikely(err)) {
-		/* recvmsg() in non blocking mode is supposed to return -EAGAIN
-		 * sk_rcvtimeo is not honored by mutex_lock_interruptible()
-		 */
-		err = noblock ? -EAGAIN : -ERESTARTSYS;
-		goto out;
-	}
+	mutex_lock(&u->readlock);
 
 	if (flags & MSG_PEEK)
 		skip = sk_peek_offset(sk, flags);
@@ -2346,13 +2339,13 @@ again:
 			timeo = unix_stream_data_wait(sk, timeo, last,
 						      last_len);
 
-			if (signal_pending(current) ||
-			    mutex_lock_interruptible(&u->readlock)) {
+			if (signal_pending(current)) {
 				err = sock_intr_errno(timeo);
 				scm_destroy(&scm);
 				goto out;
 			}
 
+			mutex_lock(&u->readlock);
 			continue;
 unlock:
 			unix_state_unlock(sk);
-- 
1.9.1





More information about the kernel-team mailing list