From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752564AbcBLNcF (ORCPT ); Fri, 12 Feb 2016 08:32:05 -0500 Received: from tiger.mobileactivedefense.com ([217.174.251.109]:42607 "EHLO tiger.mobileactivedefense.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752424AbcBLNcD (ORCPT ); Fri, 12 Feb 2016 08:32:03 -0500 From: Rainer Weikusat To: Joseph Salisbury Cc: Rainer Weikusat , "davem\@davemloft.net" , hannes@stressinduktion.org, edumazet@google.com, dhowells@redhat.com, ying.xue@windriver.com, "netdev\@vger.kernel.org" , LKML , "stable\@vger.kernel.org" , Tim Gardner Subject: Re: [PATCH] af_unix: Don't set err in unix_stream_read_generic unless there was an error In-Reply-To: <56BCFDC8.6010406@canonical.com> (Joseph Salisbury's message of "Thu, 11 Feb 2016 16:31:52 -0500") References: <56B4EF04.2060407@canonical.com> <87zivebxjr.fsf@doppelsaurus.mobileactivedefense.com> <56BCFDC8.6010406@canonical.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Date: Fri, 12 Feb 2016 13:31:44 +0000 Message-ID: <871t8ivyv3.fsf@doppelsaurus.mobileactivedefense.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (tiger.mobileactivedefense.com [217.174.251.109]); Fri, 12 Feb 2016 13:31:52 +0000 (GMT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Joseph Salisbury writes: > On 02/05/2016 05:30 PM, Rainer Weikusat wrote: >> The present unix_stream_read_generic contains various code sequences of >> the form >> >> err = -EDISASTER; >> if () >> goto out; [...] >> Change it such that err is only set if an error condition was detected. [...] > I tested your patch, Rainer. I can confirm that it fixes the reported > bug[0]. This is only a partial fix: The launchpad test case will no longer fail with EOPNOTSUPP and it will actually receive the credentials because the message they're attached to was available by the time of the recvmsg. But if this isn't the case, ie, if the receiver has to wait for a message, the continue in the do { } while (size) loop will cause the loop to be terminated without copying the credential information as the continue will cause the size (of the remaining 'receive area' which is zero for this case) to be checked before any of the other loop code is executed again. I posted a test case for this and a patch addressing that elsewhere in this thread.