Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp165297pxa; Wed, 26 Aug 2020 07:31:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc8KBa+53Kt9oQJhT7w4nAUAk2htoi1yfr8pJGo5NazasqmA62L9iDlN5af/AMaIxH1kD5 X-Received: by 2002:aa7:d983:: with SMTP id u3mr15806252eds.366.1598452293641; Wed, 26 Aug 2020 07:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598452293; cv=none; d=google.com; s=arc-20160816; b=RpEkHQdb45cOTMCgr6zSWL3vGI2ZjmqCxFKC+dM68QOKGRe4GbtmMBz+ef8I6C8wY/ cPmPT64B3haKxnogMwKg9ZdNFy4l4O+HW54oaDuAHXLd7IaxWXiwHoiWiBl8DM4FKUCl iieyYK2B9vBo9OoSkIs/R5v7mm8u7PtPPPDwqBslVAhpUKbS2FWOOLfKcD91Y5ri9c53 0/aJukisHImn2ERQBrE6o62hhH8jkosiev7ZZZS8F85kM0wPJEhRUpEaUTyhuNoLxBSf v3c0LFNRLcvAqNtSFWrF5x/fGNWuS2i9XJkjnJtjMMXuD6A0ioJpKxHGL0ehCDJdOs69 myKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EPa4x0nU+8v2KRRPsd2B1vaNFFp5/osP8Mc4ojRnWog=; b=fVtHygU/PEMi1524xBAkiO/GbSd6Pk5UMGAmcAvFTDyw4+h+XzSry/SePgI5Om3YXI m0imVgArpHMds29AoZ4kANohfp0f9eZHMgO7vUK0QdMQLm/fSqdigOMLf9zLWGxwVYZk ieOH8UFAY1cANyUvozE4XORSWd1ZNgC7dtYQOYLeFvRacA/DvPr6Ecec9GXAKMlrodKo lzsNfPiSUiMYlU/g09Ip0XcjpG8jOk8al36k6P56FnrWwFwp5Ij61Rwsc96CBGtf7tZ5 Q9rzViyezefoGeQfLUNYb/mUn7TG0LdxopA1ZWwpgkDXlNWcioLKeBG7ILJBEJUE4Igo oKmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCrCc9Kw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm15si1594889edb.441.2020.08.26.07.31.10; Wed, 26 Aug 2020 07:31:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCrCc9Kw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729553AbgHZMDq (ORCPT + 99 others); Wed, 26 Aug 2020 08:03:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:37278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729464AbgHZMCu (ORCPT ); Wed, 26 Aug 2020 08:02:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02B40208E4; Wed, 26 Aug 2020 12:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598443370; bh=lHjVCNb+Y24qQJ+20TP7JRBp6qoTPqc/m8f2Ri154yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCrCc9KwTQJ1l+wWGttjwuTdzmqhHmwnB/wUOTC376FIxqc1nUHl6uMv6+KFwvUKj xoy/cJXF+mybIp1Av17kXUSbexAADxuJIdcTeenxdIAQtxFb4M9tFLSIcLlRGNEN0Y 0NVtJGEwPbO+81MjV8rNUR2jL4AUgeL9+kgef5Rg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Laight , Marcelo Ricardo Leitner , "David S. Miller" Subject: [PATCH 5.7 06/15] net: sctp: Fix negotiation of the number of data streams. Date: Wed, 26 Aug 2020 14:02:34 +0200 Message-Id: <20200826114849.605704029@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200826114849.295321031@linuxfoundation.org> References: <20200826114849.295321031@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Laight [ Upstream commit ab921f3cdbec01c68705a7ade8bec628d541fc2b ] The number of output and input streams was never being reduced, eg when processing received INIT or INIT_ACK chunks. The effect is that DATA chunks can be sent with invalid stream ids and then discarded by the remote system. Fixes: 2075e50caf5ea ("sctp: convert to genradix") Signed-off-by: David Laight Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sctp/stream.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/sctp/stream.c +++ b/net/sctp/stream.c @@ -88,12 +88,13 @@ static int sctp_stream_alloc_out(struct int ret; if (outcnt <= stream->outcnt) - return 0; + goto out; ret = genradix_prealloc(&stream->out, outcnt, gfp); if (ret) return ret; +out: stream->outcnt = outcnt; return 0; } @@ -104,12 +105,13 @@ static int sctp_stream_alloc_in(struct s int ret; if (incnt <= stream->incnt) - return 0; + goto out; ret = genradix_prealloc(&stream->in, incnt, gfp); if (ret) return ret; +out: stream->incnt = incnt; return 0; }