From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BFF443786D for ; Tue, 7 Jul 2026 17:17:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783444667; cv=none; b=FiotYOKYzoBwMPsjXY/6S1ZFp1MqlPJYDEbXJz7LUSKYfbjYpB+x63nLweQr8ZT6C2QQaU0jrHrUy2Lp42arMy3pZiXYeusj0qJlpq3DYmLmYmUbZwL0NwCxYxZCPZmL09EIBYi/IKs4xtQ3qOX6dfwI0G2SPJUtOJVT8FJEbYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783444667; c=relaxed/simple; bh=nu6ZSgb2jRk2Ndie2s2jUBHTDDESXJco+T6QJqejMAk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qXaIWVhhsUy388SYsjbu+Hp3kyk6n13MKGDKfMkEX41slsctlQlUiL5rT2aDAqJEAV7zMMBxxqsJJhNO/Mi7XZarxQmmmPctG4Hb7EXBkroxht1aVLtCMe0iTNl6FqtgNK/44zcEvux//vNzZtdhuUZ+4+Ja96JCfMG3xSSUJas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kBNvimd3; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kBNvimd3" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-92e51d3d83cso228036185a.2 for ; Tue, 07 Jul 2026 10:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783444665; x=1784049465; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=oUCStv+mG3q24BIMvpoJICyGa6vMwC+AFAbHW03keOc=; b=kBNvimd3aSd9CFB7w5JUcCZIN/lBMdM18PjKPKG2PM1Fq2Q8rxKHqF3HDPy/fBqrEX 7bX5p72uJvpzezCxXtPXQcoa3lWi3p4ZTQgcUHaNGCmEYgZ9uU3gI9k4EiLLvushiYbU 40ftOtkRmrC5pxtxS0qABg+44xZnyxjsVWzDv+hSdWqwPWopcdpKDfStpFg3G0rARMd/ MAGGZrU+WOlDk+bvz9lxPuAblg0RUv7IUAg4XQR4QnOX+PesTSzN84NVL5LBFy/eoGtp 5kCaYr+qnPkkSzmnBVPAVhxEoR+mpi6BI2fSw7EHsVRXUm9R/qNHa0mhXUi5XdDrJK2k 20QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783444665; x=1784049465; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=oUCStv+mG3q24BIMvpoJICyGa6vMwC+AFAbHW03keOc=; b=eqQI4Uiy/vbI6HFD7eyrM1U4GORJzUFFlz5AJW8w8+y2OEWHIi3U70Xgqk0QAzhsV5 GdoPF+dqX3YMtDupPJAsQzSx/sXdseMvQUyRyyZS3l6TkSw1gC7YyVYSMNqhvHkM7ZTn pHQ2VOpe4Fz9XSGUeXzCgqqddrYuQq7o5FnUGLiibXT7d3XXAYX4SSANobjoJcsGJmrk bGWhgTzbxnjnwSK83qTJxa8sl5c95VdeaWNAxCt5Po+G3tszMeVGKguHJzRM7+YiKCGT VvUkPNyZTzmcXChwhGKSZp1XqLlcYGM6snCxDT9+o4uZpyduH+rlnrwmet5uBfu37xva r/Fw== X-Forwarded-Encrypted: i=1; AHgh+Rr+pvHx7TNcsSLFwIxxoWkwel7zJLGsA6It7yvADkNpmsQ+JhB12S71RxLGk7pwn1D8y+mOJBTnNfjjkfU=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/nvpYg6drEjtZOAJ5f5zaxiAqJyQLF4Ca21x/XBrutFrUtZCI ADm+atku2CivLtUeZIs1cj/tTWw/HM/xEHPBU7w8Yn+D4iZxq1+SKQ2wE8P274Ud X-Gm-Gg: AfdE7cmfyZVlWkyIEM/AZmt9b18OMbOQ4fi+IVnEVkQrYtprZBKxTj001v2DJLz5itb G0gyEptAbMYxKgPsSF+dJcouH6PBb0k3QkK8gCL8BaH5KFMNmMxYdIxXuW83A2g8aoRIG88/zRZ Tb07VpnFxmJWojAKodkYifvF6HFf59soPbSh/VAFQZ1mULYT8VmNe6cYQc7HTShh1j99ICGE64J wgCyHEQRaBd4ktKAfT7RUv/OeHcaxj6XCKfkKr+p7By5yvspL3ipfz0rcofn9KVbdAh9OuT8jsB gb/C+R8seE3fmz7Xw94XdjnGBkfJ7M+798rI8IZZbEJULRZU1VMvQiXPJws58P/gZ5wV/rKzG0B F/B52UAqR5OVV0WYlMuBCNdgNzarbJQplmqkJAXgPitL9hl/TKPI0opUdRqFMBLXY9iH0BL5Dlo 7J0bVpZ+m+FKsuRZ5f/fkw7I/t1HwZIDtmKfgGIrzq5dhcvGCphOGAye+oNtnKJtBbrx7W+GW5i mVDrEUik/BKfN0HdZdX8zrh3PqPkAyf X-Received: by 2002:a05:620a:4102:b0:92e:8a88:ab27 with SMTP id af79cd13be357-92ebb528e65mr702327185a.14.1783444665081; Tue, 07 Jul 2026 10:17:45 -0700 (PDT) Received: from server0.tail6e7dd.ts.net (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92e90ccde4fsm1220363385a.39.2026.07.07.10.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2026 10:17:44 -0700 (PDT) From: Michael Bommarito To: Matthieu Baerts , Mat Martineau Cc: Geliang Tang , Paolo Abeni , Eric Dumazet , Jakub Kicinski , mptcp@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] mptcp: only set DATA_FIN when a mapping is present Date: Tue, 7 Jul 2026 13:17:30 -0400 Message-ID: <20260707171730.2679013-1-michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2edcb1cd-f2db-4d0c-a0e3-fd2b4dd820fe@redhat.com> References: <2edcb1cd-f2db-4d0c-a0e3-fd2b4dd820fe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit mptcp_get_options() clears only the status group of struct mptcp_options_received; data_seq, subflow_seq and data_len are filled in by mptcp_parse_option() exclusively inside the DSS mapping block, which runs only when the DSS M (mapping present) bit is set. A peer can send a DSS option with the DATA_FIN flag set but the mapping bit clear. The parser then records mp_opt->data_fin while leaving data_len and data_seq uninitialized. For a zero-length segment mptcp_incoming_options() evaluates if (mp_opt.data_fin && mp_opt.data_len == 1 && mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64)) which reads the uninitialized data_len and data_seq; KMSAN reports an uninit-value in mptcp_incoming_options(). The stale data_seq can also be fed into the receive-side DATA_FIN sequence tracking. Record the DATA_FIN flag only when the DSS option carries a mapping, so data_fin is never set without data_seq and data_len also being present. data_fin is part of the status group that mptcp_get_options() clears up front, so on the no-map path it stays zero and the zero-length DATA_FIN branch is simply skipped. A DATA_FIN is always transmitted together with a mapping (mptcp_write_data_fin() sets use_map along with data_seq and data_len), so legitimate DATA_FIN handling is unaffected. Fixes: 43b54c6ee382 ("mptcp: Use full MPTCP-level disconnect state machine") Suggested-by: Paolo Abeni Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Michael Bommarito --- v2: adopt Paolo Abeni's suggested approach - do not set mp_opt->data_fin at all unless a mapping is present, rather than gating the consumer in mptcp_incoming_options() (v1). data_fin then defaults to the value mptcp_get_options() already clears it to (0) on the no-map path, so the uninitialized data_len/data_seq are never read. net/mptcp/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index dff3fd5d3b559..6d003b24b969f 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -157,7 +157,6 @@ static void mptcp_parse_option(const struct sk_buff *skb, ptr++; flags = (*ptr++) & MPTCP_DSS_FLAG_MASK; - mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0; mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0; mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; @@ -178,6 +177,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, } if (mp_opt->use_map) { + mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; if (mp_opt->dsn64) expected_opsize += TCPOLEN_MPTCP_DSS_MAP64; else -- 2.53.0