Received: by 10.192.165.156 with SMTP id m28csp30675imm; Tue, 10 Apr 2018 15:45:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/EXfoZ+FhngnACYFX1BJI4bh5Py2Y3eahwFxTTGS2/TAkiZVdlF5pcl30VO/o+HXwDqAox X-Received: by 10.101.92.199 with SMTP id b7mr1588532pgt.138.1523400338066; Tue, 10 Apr 2018 15:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400338; cv=none; d=google.com; s=arc-20160816; b=xmgLADrCK1q9F+4a38ShDuDMIU8D1TrmKIdu/Jg/OeDVBjNg21h3g86HgAVVezG/TX pY0RiLVFwXduL7D08cXbgayI+rULHs766ZRNQ3GrUqx98uANWFQPSwNgEvQzKBrzrefe c6Ac6PhD14PI5BKSS+QaKfUzHuxVWcUbUyJy+AvyR0utIAflssnSDxHeFFaujUEDTCO/ OjG/76el/a7SU55TpabK7qeAFC2j6ZHKalPmRTZk4vYauW/ZgZKCqAsJSAauJruczOrD gzwGcHRdJeMlg/ZPk8kEHbVNGJ5rqPQlrJYolxRCVP4yqTK43NInKGJqfSZVbd0GJxuU ZeJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=DpQmsxTQuG65e66D/L0ObDgQfLaQNH0Pw62xpNMNGNM=; b=bbJK5j5BEKyelNx5wMPYkqxcnfHSEbxjfWQQd8kKdV/3CKxUN56juVYaN7dPdEvpFE Oa9Hgs8UVKz7iKeQe9kdH8pvBKwbHaQpWHdEBLLckxyQ4qJSHuJmEL4oUE7PnBxG3WnI GeCRTMl3tdklwt+imRmfTbj7eGFTEOt2s0tDgm+QOSj4U0W03tsE4MwLSqKPXTigH04T hgie9LOjJvHj02xQkloQGVphc1uLUcuxozIKurwEtLzEReFt1fZLCnjquweMEG0rUSOM E6hh/1MuUkQtB7d3ZEkeSVgDujUEMEvYqsXxh1xq919lmkdahpnLgVs3xE5TxpWtIPKY gUdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37-v6si3526957plq.288.2018.04.10.15.45.01; Tue, 10 Apr 2018 15:45:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932732AbeDJWkT (ORCPT + 99 others); Tue, 10 Apr 2018 18:40:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46640 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932691AbeDJWkQ (ORCPT ); Tue, 10 Apr 2018 18:40:16 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 06530E09; Tue, 10 Apr 2018 22:40:11 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Watson , "David S. Miller" Subject: [PATCH 4.14 131/138] strparser: Fix sign of err codes Date: Wed, 11 Apr 2018 00:25:21 +0200 Message-Id: <20180410212917.448177033@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dave Watson [ Upstream commit cd00edc179863848abab5cc5683de5b7b5f70954 ] 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. Fixes: 43a0c6751a322847 ("strparser: Stream parser for messages") Signed-off-by: Dave Watson Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/strparser/strparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c @@ -60,7 +60,7 @@ static void strp_abort_strp(struct strpa struct sock *sk = strp->sk; /* Report an error on the lower socket */ - sk->sk_err = err; + sk->sk_err = -err; sk->sk_error_report(sk); } } @@ -458,7 +458,7 @@ static void strp_msg_timeout(struct work /* Message assembly timed out */ STRP_STATS_INCR(strp->stats.msg_timeouts); strp->cb.lock(strp); - strp->cb.abort_parser(strp, ETIMEDOUT); + strp->cb.abort_parser(strp, -ETIMEDOUT); strp->cb.unlock(strp); }