Received: by 10.213.65.68 with SMTP id h4csp2119486imn; Sun, 8 Apr 2018 20:11:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/yedBZj9sm1ADGFWLZeScReV3d/pKihokabQYCJkR558+0JVt/nwqt5beqN3+x6cUQCvpS X-Received: by 2002:a17:902:322:: with SMTP id 31-v6mr37118704pld.122.1523243470189; Sun, 08 Apr 2018 20:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243470; cv=none; d=google.com; s=arc-20160816; b=NkUQ5dtFnxkKO0kwvvXdBA25IvKHmGamh5u/jXE5Qxw7tOBjlnT32/ou8TEXO0jjQd OyCnZFAKWdVIA+M/SNhCgVOR1ak4uXyCGwCe3KPjJcnvyzWdFi4SqaQjjQgNsbZyrKZp oEKmS6mmQWuiekcqxd+zrh4IRKDGlbU4AM56iKXV1lQcr1eSvh02jtEvTPRXGNAPFwwS PehFkl5QQ8KtfbGqFlC415L5jjO39yVC24xUYWc8tGY/n4X8AbyUBRMAbvXBAXdZjHaZ tMa3P+ICBsdllChQGx3E8Etg3oNqoAXOmsQ/Mc2lMmUmcnILIA3Gu6csUv9xdzbUsbk+ qn+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=UFWaQdQdqE86Q+4h9yzR3t15LshwWmMQMYTIo9gOcrU=; b=MtsfL2TdxF666texZsafxMb3xML7OiDKRvE5veP5Bctt6FsPrqWleyZEpozg8b2g0B TJSYfUwads4J8bK8uF40wqQ7rzKD64GFM2IV5gQp+cbEVwfmXrRtGwj9BQ+Kxjc1y858 VYSROHDGlTPHd88tBIiNeFwjnwgyUzJ9A7tUf35eXm4INrMXOLeAGFYdOnYSU2FxuNp/ dRwtsBKAvf07AWe1lY1HpkE3/ZhMGYPOOom9rcnetutE22W05VeaHSwiBJq/OnfchXFd XUoXXAWBJYbGMUyZHqUdS9+Mnn/YdT+Yjab9kfpHgpWHrm5ykib0TQglsU53x9zy3jsc Rs7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HD4DlA2q; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si10513036pgc.474.2018.04.08.20.10.32; Sun, 08 Apr 2018 20:11:10 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HD4DlA2q; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756479AbeDICXW (ORCPT + 99 others); Sun, 8 Apr 2018 22:23:22 -0400 Received: from mail-by2nam03on0107.outbound.protection.outlook.com ([104.47.42.107]:6816 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756008AbeDIA3i (ORCPT ); Sun, 8 Apr 2018 20:29:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UFWaQdQdqE86Q+4h9yzR3t15LshwWmMQMYTIo9gOcrU=; b=HD4DlA2qh4/GZZZ3kn0QI2arNgOc2/B4ErncRs8oQwP7AfHZiSkPGgIMimWKdurbGow6/XTSYYGSHEkPjJdKeUjgivB4hRu6kKA7tGk0ASnt7a6rBRTif3AuEj/3og5w/1JxeBzCX23n8OJDZbthDpuqzbE7az7pCw9DR2b2hrk= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0967.namprd21.prod.outlook.com (52.132.133.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:29:35 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:29:35 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Xin Long , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 108/293] sctp: uncork the old asoc before changing to the new one Thread-Topic: [PATCH AUTOSEL for 4.9 108/293] sctp: uncork the old asoc before changing to the new one Thread-Index: AQHTz5kYrj1538CEaU+CUGOIbPJs6A== Date: Mon, 9 Apr 2018 00:24:17 +0000 Message-ID: <20180409002239.163177-108-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0967;7:jckDRRkUmkeA3GryG998/Qcia0zoYTpzHXUAHUWqje5HzrRGpxkVcP0R8Bv2wwjmd3ANX2Crusan9U97FLZ2lKpsj8ZTtkmnHQgc0NiHi1T1wuzVFHYrO587Bn98eevK1zB3RmqtrOHePMh7WPeJMdUIjkjkIStEoMmli7Dd6XDEMwI1esk8gAD1SCsuauNRop5J1dlBU+hxp4RUklWiQ57wbh1aM8Abs/LmHTYTzuJpPNplFxd6ShMLHyFqM99P;20:mJNYJrBxcHGpsDJzVGFE8hRwp5HRnTioEEbsUon7SnHaMEAKwIpP/o0xygCthY1Dc4rAZdrFAnqLfO1LIl2yDA8RTDAxCOsjNORvi6TVZlK2nG+v2WpkcbhH9Ul6Q7aPxtbYxLKsL929YqTFfIjYVHEuusQzEIy+oeheoURdvR4= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: ae543a49-1b94-4dd8-3963-08d59db0f87e x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0967; x-ms-traffictypediagnostic: DM5PR2101MB0967: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB0967;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0967; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(366004)(376002)(39380400002)(346002)(199004)(189003)(6506007)(486006)(86362001)(14454004)(59450400001)(68736007)(102836004)(99286004)(26005)(3846002)(6116002)(186003)(476003)(2616005)(1076002)(3280700002)(86612001)(72206003)(4326008)(446003)(54906003)(76176011)(11346002)(2906002)(22452003)(3660700001)(110136005)(97736004)(316002)(6666003)(5660300001)(478600001)(8676002)(6512007)(8936002)(39060400002)(107886003)(6486002)(53936002)(81166006)(36756003)(81156014)(10290500003)(6436002)(10090500001)(25786009)(66066001)(106356001)(305945005)(7736002)(2501003)(5250100002)(105586002)(2900100001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0967;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: +M1WtM34lWLnsmf8unB/xXK2y4PKzs3Ju7ussYjB2jCEKJpaLmMHPYwXqSi0sq3wSbaquJrl6wkksG6dPP8FFBP6u/94xv+V4WL03o57QJ5UE/IQj1pQdOtwdSV0ABNDShyndvuZ5gYfN/Fzof0V/ju3mVF3Ppu7QYN1x1Ifjgl/FdSIN24NujCuTta/XnZBU+hlRajWEm06WjaXjkZl/bIRH4HUmVoIpukuM+i6c95CDHbDayDOI1U9NuOiI2v0Bq2yoWoXPk92FKmcLOQ1PaCQeInRxlQr1qE8X+UK/P9mXdGZJYbjTW0Fypj7Q3VMozqJ87mu0aH/4tKEuss/kiE8ZszYeSrOtN8Q8lZtrnscCI4tqywekBd5dQn5OElKt9N0vA43Xbr+vUJMcBLyWLVBU1JNA9PyPW29x6oMbxk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae543a49-1b94-4dd8-3963-08d59db0f87e X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:24:17.8156 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0967 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Long [ Upstream commit 8cd5c25f2db03306727d2f6b8f28956169dc1123 ] local_cork is used to decide if it should uncork asoc outq after processing some cmds, and it is set when replying or sending msgs. local_cork should always have the same value with current asoc q->cork in some way. The thing is when changing to a new asoc by cmd SET_ASOC, local_cork may not be consistent with the current asoc any more. The cmd seqs can be: SCTP_CMD_UPDATE_ASSOC (asoc) SCTP_CMD_REPLY (asoc) SCTP_CMD_SET_ASOC (new_asoc) SCTP_CMD_DELETE_TCB (new_asoc) SCTP_CMD_SET_ASOC (asoc) SCTP_CMD_REPLY (asoc) The 1st REPLY makes OLD asoc q->cork and local_cork both are 1, and the cmd DELETE_TCB clears NEW asoc q->cork and local_cork. After asoc goes back to OLD asoc, q->cork is still 1 while local_cork is 0. The 2nd REPLY will not set local_cork because q->cork is already set and it can't be uncorked and sent out because of this. To keep local_cork consistent with the current asoc q->cork, this patch is to uncork the old asoc if local_cork is set before changing to the new one. Note that the above cmd seqs will be used in the next patch when updating asoc and handling errors in it. Suggested-by: Marcelo Ricardo Leitner Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Acked-by: Neil Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/sm_sideeffect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index c345bf153bed..255dc92276b1 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -1712,6 +1712,10 @@ static int sctp_cmd_interpreter(sctp_event_t event_t= ype, break; =20 case SCTP_CMD_SET_ASOC: + if (asoc && local_cork) { + sctp_outq_uncork(&asoc->outqueue, gfp); + local_cork =3D 0; + } asoc =3D cmd->obj.asoc; break; =20 --=20 2.15.1