From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753929AbcBEXDY (ORCPT ); Fri, 5 Feb 2016 18:03:24 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:36793 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750721AbcBEXDW (ORCPT ); Fri, 5 Feb 2016 18:03:22 -0500 Message-ID: <1454713398.7627.325.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [V4.4-rc6 Regression] af_unix: Revert 'lock_interruptible' in stream receive code From: Eric Dumazet To: Rainer Weikusat Cc: 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" , Joseph Salisbury Date: Fri, 05 Feb 2016 15:03:18 -0800 In-Reply-To: <87bn7ude8g.fsf@doppelsaurus.mobileactivedefense.com> References: <56B4EF04.2060407@canonical.com> <87bn7ude8g.fsf@doppelsaurus.mobileactivedefense.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2016-02-05 at 21:44 +0000, Rainer Weikusat wrote: > The present unix_stream_read_generic contains various code sequences of > the form > > err = -EDISASTER; > if () > goto out; > > This has the unfortunate side effect of possibly causing the error code > to bleed through to the final > > out: > return copied ? : err; > > and then to be wrongly returned if no data was copied because the caller > didn't supply a data buffer, as demonstrated by the program available at > > http://pad.lv/1540731 > > Change it such that err is only set if an error condition was detected. Well, if you replace the traditional flow err = -XXXX; if (test) goto out; Then please add unlikely() to at least give a hint to the compiler. if (unlikely(test)) { err = -XXX; goto out; } And please add a 'Fixes: .... ' tag for bug fixes. Thanks.