From: Willy Tarreau Date: Sun, 24 Jan 2016 08:19:57 +0000 (+0100) Subject: af_unix: fix incorrect revert of 'lock_interruptible' in stream receive code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=85ec9232455406f1453bff56d8ef83c2aa2281c3;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git af_unix: fix incorrect revert of 'lock_interruptible' in stream receive code As reported by Sultan Qasim, commit 3822b5c ("af_unix: Revert 'lock_interruptible' in stream receive code") was accidently applied at the wrong place in the backport that appeared in 3.10.95, it affected unix_dgram_recvmsg() instead of unix_stream_recvmsg() due to now similar code sections there. The dgram part needs to remain but the stream part needs to be removed. Reported-By: Sultan Qasim Fixes: 3a57e78 (3.10.95) Signed-off-by: Willy Tarreau --- diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index f934e7ba5eb8..0061d003752a 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1934,7 +1934,14 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, if (flags&MSG_OOB) goto out; - mutex_lock(&u->readlock); + 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; + } skip = sk_peek_offset(sk, flags); @@ -2083,14 +2090,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, memset(&tmp_scm, 0, sizeof(tmp_scm)); } - 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); do { int chunk;