From patchwork Tue Jul 28 22:12:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 1338036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGWBF5b75z9sTZ for ; Wed, 29 Jul 2020 08:12:20 +1000 (AEST) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0774812523390; Tue, 28 Jul 2020 15:12:17 -0700 (PDT) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=mathew.j.martineau@linux.intel.com; receiver= Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D20AA1245D44F for ; Tue, 28 Jul 2020 15:12:14 -0700 (PDT) IronPort-SDR: jVyVhYFlHW+2y73XJEW7IjnZTk+4XqVj+HcJyfVjuJ/PB314HFaOV+KE0zogYMRWjbTv+DhPWu 1bV18ebHUNtA== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="139342672" X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="139342672" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 15:12:13 -0700 IronPort-SDR: qGPSZeptvBctBvkmIru8akZEDyIyMOY2/Sr6s1YNuzGpSFpNVVVUw84L0wUGXOAfcWRbMUoKcK jLM/jrO47ohg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="328468880" Received: from mjmartin-nuc02.amr.corp.intel.com ([10.254.116.118]) by FMSMGA003.fm.intel.com with ESMTP; 28 Jul 2020 15:12:13 -0700 From: Mat Martineau To: netdev@vger.kernel.org Date: Tue, 28 Jul 2020 15:12:00 -0700 Message-Id: <20200728221210.92841-3-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200728221210.92841-1-mathew.j.martineau@linux.intel.com> References: <20200728221210.92841-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: QBA3L2GIR3RTX5TYN6F33TCVHNBIRVRX X-Message-ID-Hash: QBA3L2GIR3RTX5TYN6F33TCVHNBIRVRX X-MailFrom: mathew.j.martineau@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: mptcp@lists.01.org X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH net-next 02/12] mptcp: Return EPIPE if sending is shut down during a sendmsg List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: A MPTCP socket where sending has been shut down should not attempt to send additional data, since DATA_FIN has already been sent. Signed-off-by: Mat Martineau --- net/mptcp/protocol.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 2891ae8a1028..b3c3dbc89b3f 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -748,6 +748,11 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) restart: mptcp_clean_una(sk); + if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) { + ret = -EPIPE; + goto out; + } + wait_for_sndbuf: __mptcp_flush_join_list(msk); ssk = mptcp_subflow_get_send(msk);