From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Watson Subject: Re: [PATCH net] strparser: Fix sign of err codes Date: Tue, 27 Mar 2018 08:05:25 -0700 Message-ID: <20180327150525.GA30996@davejwatson-mba.local> References: <20180326193121.GA78356@davejwatson-mba.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: "David S. Miller" , Linux Kernel Network Developers To: Tom Herbert Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:48634 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751068AbeC0PEt (ORCPT ); Tue, 27 Mar 2018 11:04:49 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On 03/26/18 01:44 PM, Tom Herbert wrote: > On Mon, Mar 26, 2018 at 12:31 PM, Dave Watson wrote: > > strp_parser_err is called with a negative code everywhere, which then > > calls abort_parser with a negative code. strp_msg_timeout calls > > abort_parser directly with a positive code. Negate ETIMEDOUT > > to match signed-ness of other calls. > > > > The default abort_parser callback, strp_abort_strp, sets > > sk->sk_err to err. Also negate the error here so sk_err always > > holds a positive value, as the rest of the net code expects. Currently > > a negative sk_err can result in endless loops, or user code that > > thinks it actually sent/received err bytes. > > > > Found while testing net/tls_sw recv path. > > > Nice catch! > > It might be nice to have a comment at strp_parser_err and abort_parser > description in Documentation/networking/strparser.txt should also be > updated that err is a negative error value. Sure I can update the docs also.