Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3115661pxj; Mon, 17 May 2021 18:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwgdF+B3ZwoUuNvsKQYe+HocJAUW7wjmVyx0asZCHV24AKTJ39Oii5P0bQVOwWbrYISZYC X-Received: by 2002:a17:906:4c82:: with SMTP id q2mr3149913eju.80.1621300223591; Mon, 17 May 2021 18:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621300223; cv=none; d=google.com; s=arc-20160816; b=FiiSLomLhQ5D8EawA4BA8B1KOTc87yfVRz+sRD4/k5P8mbnyRYm6n01BIz9BN+94Cq bOqTHg1WpVgZREmFtQg2KP924oDTwc4j4A6Yxiq+NjsvVTLtoDku0k37yOqptqbY2oDG 8F7IcVUMgGwTZFUX6di2cM4aGxqARXRAXhckw6GDn9tF+JFiEgMID54zZbpOC8M4pC0h aQIXHdoR4gKSg2zQkwJaou9yb1QLBZlCeV09voYYnIWvonnOt0QhfNbz1pj8l/r8sJx9 3/BoDWi4LPV2uLjwiURObBtY0Jtt8Xf0ZEgnpNZMBf/00quN0gd05sdUUeSfonfSTSrp AsXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XGDeDalIXhzDul17eMGjZIEP6e8C4ZPv2M3P8Uqvumo=; b=wyV/r0JZ1VlUrskgF0inKEEOg6yuGq8H+hm1IHtSupvfvRWj1YoLvubd1teM3ZaG8v Q0LiVYNSSwOaluFdi3+cV+JfZDJ6iEEmB254aoVFXBHP38L8TBuMvneQ8jHCkJs2aQiX Z4k79AuhCjRRq29VeQp/I4nwiBSx0pGabRJQ1r9HooadvaYh0Cx6KnUJoBYbVvRngBmp Vaqqg1svuDW+Pv7OY7CmbrQr60RC+P0Qf4mbLIU6jK0CnpWJfKAAJu4ah+W2cRhvLaqR uh4b46V0VSuSPLz2RVixMW0PzpuLhti8jpfWWNxt6pnfqkf4HmxD4ENilR78SNZEMdYl EE7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AKnpRMvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si15700732eje.413.2021.05.17.18.10.00; Mon, 17 May 2021 18:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AKnpRMvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239781AbhEQOdA (ORCPT + 99 others); Mon, 17 May 2021 10:33:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:52996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238860AbhEQO2I (ORCPT ); Mon, 17 May 2021 10:28:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F240F61585; Mon, 17 May 2021 14:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260839; bh=ufm9GTUagM18Or2FtuSdbwv2lTF6sUADIm9d1/SyEcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKnpRMvsFSMOEn6tfyZU8shrO3uRCxlq8hjiPYOJ+CsiLRaP730jXsva5pct5KVf2 0PXFJ385gR+e1aRueCPHNEuEgS2lttuGgYD6EXMgDuhOqVrFt54p5dBL8rSlGlMnia np5JDCGrUX1vmOQ+uV0kAOlQ+AcxpeXKK6rKw0XU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Paolo Abeni , Mat Martineau , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.12 247/363] mptcp: fix splat when closing unaccepted socket Date: Mon, 17 May 2021 16:01:53 +0200 Message-Id: <20210517140310.936546579@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Abeni [ Upstream commit 578c18eff1627d6a911f08f4cf351eca41fdcc7d ] If userspace exits before calling accept() on a listener that had at least one new connection ready, we get: Attempt to release TCP socket in state 8 This happens because the mptcp socket gets cloned when the TCP connection is ready, but the socket is never exposed to userspace. The client additionally sends a DATA_FIN, which brings connection into CLOSE_WAIT state. This in turn prevents the orphan+state reset fixup in mptcp_sock_destruct() from doing its job. Fixes: 3721b9b64676b ("mptcp: Track received DATA_FIN sequence number and add related helpers") Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/185 Tested-by: Florian Westphal Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Link: https://lore.kernel.org/r/20210507001638.225468-1-mathew.j.martineau@linux.intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/mptcp/subflow.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index d17d39ccdf34..4fe7acaa472f 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -524,8 +524,7 @@ static void mptcp_sock_destruct(struct sock *sk) * ESTABLISHED state and will not have the SOCK_DEAD flag. * Both result in warnings from inet_sock_destruct. */ - - if (sk->sk_state == TCP_ESTABLISHED) { + if ((1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { sk->sk_state = TCP_CLOSE; WARN_ON_ONCE(sk->sk_socket); sock_orphan(sk); -- 2.30.2