From patchwork Fri May 8 12:35:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 226161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EF55C38A2A for ; Fri, 8 May 2020 13:03:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B6892054F for ; Fri, 8 May 2020 13:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942981; bh=AsdhOWSmGpAo9X9fraQLcchhnvazowDqGOabd/fCwm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ydae8ITfb7hA3R6byVaZd3Hw5uMrcCVE7zqncdhxQdWvzVRdQEVKeCbWf5iHgPeid 1VQoHcz1lrXW5AtNvvwcvxPEXaciDYgfizU1d6iaw9WD9xy1Libt8N5LZR+mzmLNty p7Ig6A3PaJW800kwHC9lxkq0vqxp/ejloUSGzSdI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbgEHNDA (ORCPT ); Fri, 8 May 2020 09:03:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:58474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729525AbgEHMua (ORCPT ); Fri, 8 May 2020 08:50:30 -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 DF62924958; Fri, 8 May 2020 12:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942230; bh=AsdhOWSmGpAo9X9fraQLcchhnvazowDqGOabd/fCwm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugQCPYfi8jbkblI1QgTc89W4SlsfZevwrB1+AaFkLWHgPltLBSqRThRfGbiYYw5Xl yjOADwR8lldEUXmeBh5cBAdeWS4oTGXgMRagcv4pj7wPfXfnN+DBQTRc6/BcOxoTIz VNj2cL2hnTEMHEuh+ZKW0mffyMznn9g8E9RxOkbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Jere_Lepp=C3=A4nen?= , Marcelo Ricardo Leitner , "David S. Miller" Subject: [PATCH 4.14 18/22] sctp: Fix SHUTDOWN CTSN Ack in the peer restart case Date: Fri, 8 May 2020 14:35:30 +0200 Message-Id: <20200508123036.195643301@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123033.915895060@linuxfoundation.org> References: <20200508123033.915895060@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jere Leppänen commit 12dfd78e3a74825e6f0bc8df7ef9f938fbc6bfe3 upstream. When starting shutdown in sctp_sf_do_dupcook_a(), get the value for SHUTDOWN Cumulative TSN Ack from the new association, which is reconstructed from the cookie, instead of the old association, which the peer doesn't have anymore. Otherwise the SHUTDOWN is either ignored or replied to with an ABORT by the peer because CTSN Ack doesn't match the peer's Initial TSN. Fixes: bdf6fa52f01b ("sctp: handle association restarts when the socket is closed.") Signed-off-by: Jere Leppänen Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sctp/sm_make_chunk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -858,7 +858,11 @@ struct sctp_chunk *sctp_make_shutdown(co struct sctp_chunk *retval; __u32 ctsn; - ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); + if (chunk && chunk->asoc) + ctsn = sctp_tsnmap_get_ctsn(&chunk->asoc->peer.tsn_map); + else + ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); + shut.cum_tsn_ack = htonl(ctsn); retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN, 0,