Received: by 10.192.165.156 with SMTP id m28csp52919imm; Tue, 10 Apr 2018 16:13:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/YQ0sVmcFOLusPlBNztkGS05OaCkmenGnPXoJPkITyqpBm3z3KaQK4SQ9NfZIJxiXPkjfr X-Received: by 2002:a17:902:8606:: with SMTP id f6-v6mr2494851plo.258.1523402003529; Tue, 10 Apr 2018 16:13:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402003; cv=none; d=google.com; s=arc-20160816; b=rt9PsvtRKfTjg2nHyTOdOgJ6zM73nNxVpNXHF4vGIiUVPDHL8cYlYd8FXVGIX6mkJK AnIHPV6zurkFzlrWRxXF9bHm4vYlfuGJwWSJew6g/3Ce91Iwjd6FUl1hS0T8UsSPZLZK Te04kLtGoVcXMJo7KSJuWev4B9GFfZaKUyD4g+9iH1RvmG8NKzKb+1raEvLSqcQgtGu5 gW5P1fIKwSNyI5uOnJXBIgcZkfkgKDUK194SgNlhyGQHRKR4DHGVkz2i0XhXc9TirQ24 ZTkQcyvIpt6vSOf7RwiqtfKEgKKFukzf/lQbIrdpYHY5NzkZ7fuX/c45a+LQ2tstjXcC ckaA== 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=p5YztYvj5vEeLkPTNfaZu3/AFyve5o6t1udNvy9UWlw=; b=qN7uB2SfoU+LVkflkMkq6n4Abhmgl13eN7DbliiW6wa4L3pS/7qyjDK+N7xGHC3FMR CRdpNw5LoA5yrZm/MCqLdkjNxNlfYnTVAghslOMNk5g3zfR504d9EiySFygRxxCezVxZ XUpklWMSfgWoO0RyNxyUXi7iHvx8xn/zqf5RiwwPQnFLM/KV+sAU8/WblUhzJuH55Chj k3qDa8Gq8z+y0v9aDX+xyBFLUCXRvxwWoPea1X5RgzsSFYxp0YH9E51FU/z2IGyCBQ7w o+5mxeMoNpC+1L4mbOJl3Xf16nwpknMqWzHfjMe171RN5PNQaRNoenzCG7mJro+iJddW KNhw== 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 b31-v6si3703909pla.170.2018.04.10.16.12.47; Tue, 10 Apr 2018 16:13:23 -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 S1755282AbeDJWdn (ORCPT + 99 others); Tue, 10 Apr 2018 18:33:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41430 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752783AbeDJWdk (ORCPT ); Tue, 10 Apr 2018 18:33:40 -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 47DB1C8D; Tue, 10 Apr 2018 22:33:39 +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.15 161/168] strparser: Fix sign of err codes Date: Wed, 11 Apr 2018 00:25:03 +0200 Message-Id: <20180410212807.981844883@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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); }