From patchwork Tue Dec 27 17:08:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Ricardo Leitner X-Patchwork-Id: 709057 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tp2Sg5TMhz9t2T for ; Wed, 28 Dec 2016 04:10:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JIXKewZI"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932792AbcL0RKr (ORCPT ); Tue, 27 Dec 2016 12:10:47 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:33613 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753057AbcL0RKe (ORCPT ); Tue, 27 Dec 2016 12:10:34 -0500 Received: by mail-qk0-f194.google.com with SMTP id n21so29295014qka.0; Tue, 27 Dec 2016 09:08:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7KMuWJ1GM21PmuVmeGOubv9LOwTZgFVJ1phVK91edg8=; b=JIXKewZIA+W8oZwGaV2Sea4yumHX0glqjZViG4XOmmpcBLygjdrMT1xK7a5N82hFev VXUBWrRSeN1v+zGTx5HlZw7G2qS1bSVVmGaAjN16TaXLvGIny+/0bK3Pw4XbzHSaPnyh 3+8mBI7eTUaQlVDNXj0ygwicnYdNJ/8wEywCzVtJljLQZG4H4R8Ono/e6KGbgwP6sNDf Guznk7ZRh9WSu4mQRP2n/3OwUv98lFES99IPp7R2+s3xaD5JpezGH29SGVxwsxd6CxZx GRe+9CEGFhZ/CM65l7bHJ2QJ5GIBPkvMpja4pzS2BLotUHJTV2d0fsRtMcmBnY3x+XxO irZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7KMuWJ1GM21PmuVmeGOubv9LOwTZgFVJ1phVK91edg8=; b=dLmYWJixOFDMmJ1Wd6vE7YFpbRZE7cCWqgs0/KakFxeLrN44Og+q5tPCm2Gkt/wUBn 9j1dUcK78eGexkIrcOglVn842c1tS3a6nHHDBXbaapGYWvI4eMpYK0zP+cz24HUw2Ecs cM36ipwa95KzPDPhEdQGEbb+NnN9XIZivrxWatIwnYd0YHIrcgzhnfAwoUNLqPmELDE+ sHnfJqs2Fq4oxhTsDK/6Vj9lg3HlcdmgNlvMpeyYLavYHcxbiPCcqL4huUmI7cnY2D1z eOxqhfP/G5e8BnYsNNaFMSE6TA9+vJPP92CZ+k/LHDTfq5kzv1SGB8HRThdh+/PA7c5P NxBg== X-Gm-Message-State: AIkVDXLXQuzqDQUNePTJymiIAInj+SaUd/qNbc3BcABX1a4JCoUywU4XeVvmYBque0AQhQ== X-Received: by 10.55.130.133 with SMTP id e127mr30130493qkd.44.1482858538199; Tue, 27 Dec 2016 09:08:58 -0800 (PST) Received: from localhost.localdomain.com ([2804:7f4:3381:1ed0::1]) by smtp.gmail.com with ESMTPSA id c2sm28854454qkg.8.2016.12.27.09.08.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 09:08:57 -0800 (PST) From: Marcelo Ricardo Leitner To: netdev@vger.kernel.org Cc: linux-sctp@vger.kernel.org, Vlad Yasevich , Neil Horman Subject: [PATCH net-next 2/5] sctp: reduce indent level in sctp_sf_shut_8_4_5 Date: Tue, 27 Dec 2016 15:08:29 -0200 Message-Id: <516c622c83445125697aa64f6c28c6538a09a37d.1482857832.git.marcelo.leitner@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Marcelo Ricardo Leitner --- net/sctp/sm_statefuns.c | 58 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 32587b1f84e729221965e270607fea7ef93a7430..a95915ef9dbabad30f6171f77b26feab61752f36 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -3501,45 +3501,43 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(struct net *net, struct sctp_chunk *shut; packet = sctp_ootb_pkt_new(net, asoc, chunk); + if (!packet) + return SCTP_DISPOSITION_NOMEM; - if (packet) { - /* Make an SHUTDOWN_COMPLETE. - * The T bit will be set if the asoc is NULL. - */ - shut = sctp_make_shutdown_complete(asoc, chunk); - if (!shut) { - sctp_ootb_pkt_free(packet); - return SCTP_DISPOSITION_NOMEM; - } - - /* Reflect vtag if T-Bit is set */ - if (sctp_test_T_bit(shut)) - packet->vtag = ntohl(chunk->sctp_hdr->vtag); + /* Make an SHUTDOWN_COMPLETE. + * The T bit will be set if the asoc is NULL. + */ + shut = sctp_make_shutdown_complete(asoc, chunk); + if (!shut) { + sctp_ootb_pkt_free(packet); + return SCTP_DISPOSITION_NOMEM; + } - /* Set the skb to the belonging sock for accounting. */ - shut->skb->sk = ep->base.sk; + /* Reflect vtag if T-Bit is set */ + if (sctp_test_T_bit(shut)) + packet->vtag = ntohl(chunk->sctp_hdr->vtag); - sctp_packet_append_chunk(packet, shut); + /* Set the skb to the belonging sock for accounting. */ + shut->skb->sk = ep->base.sk; - sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, - SCTP_PACKET(packet)); + sctp_packet_append_chunk(packet, shut); - SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS); + sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, + SCTP_PACKET(packet)); - /* If the chunk length is invalid, we don't want to process - * the reset of the packet. - */ - if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) - return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); + SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS); - /* We need to discard the rest of the packet to prevent - * potential bomming attacks from additional bundled chunks. - * This is documented in SCTP Threats ID. - */ + /* If the chunk length is invalid, we don't want to process + * the reset of the packet. + */ + if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); - } - return SCTP_DISPOSITION_NOMEM; + /* We need to discard the rest of the packet to prevent + * potential bomming attacks from additional bundled chunks. + * This is documented in SCTP Threats ID. + */ + return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); } /*