From mboxrd@z Thu Jan 1 00:00:00 1970 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=unavailable 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 CBF44C38A2A for ; Fri, 8 May 2020 12:51:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A320924959 for ; Fri, 8 May 2020 12:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942312; bh=CSSG65g2BH3IAonSSiWOlBenGNI6RSP/8pRPZEKLlNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OitTMXcukla9x2z2K4z0eopIrY/dSgf0duNbtWtEKx5sWY3FTFR6ATdThCFidgvDJ PX+CCNyTovesZ6EyZE6KtNyZM2M7SVipiOb8lOYjcdc/eWFw84UDewLrEb7YAJddbR NjEzaa0jZFd2RN0+8JxHSFg+1NXkfx/EbPz90rXc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728784AbgEHMvv (ORCPT ); Fri, 8 May 2020 08:51:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:60844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728823AbgEHMvk (ORCPT ); Fri, 8 May 2020 08:51:40 -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 7A6F424966; Fri, 8 May 2020 12:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942300; bh=CSSG65g2BH3IAonSSiWOlBenGNI6RSP/8pRPZEKLlNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Th1bAbe+HedMpmEmCj/xtOfKv5cSSh38j+2iC7oZmrQgT5OwC/5ldcRykxKZZuIP9 MRqpvfXbSwfCihg2jnZKC71pzGfYThMYWgoDV4B2qK8q9d9P8XwnmaKw0YG8t2J1pp SFBEeuULb2Ym0z6RDlo0kJkM4MIMDpDEIcmtxWH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jere=20Lepp=C3=A4nen?= , Marcelo Ricardo Leitner , "David S. Miller" Subject: [PATCH 4.19 22/32] sctp: Fix SHUTDOWN CTSN Ack in the peer restart case Date: Fri, 8 May 2020 14:35:35 +0200 Message-Id: <20200508123037.944302353@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123034.886699170@linuxfoundation.org> References: <20200508123034.886699170@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: 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 @@ -871,7 +871,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,