]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mptcp: pm: ignore unknown endpoint flags
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Tue, 30 Dec 2025 14:07:01 +0000 (09:07 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:10:07 +0000 (13:10 +0100)
[ Upstream commit 0ace3297a7301911e52d8195cb1006414897c859 ]

Before this patch, the kernel was saving any flags set by the userspace,
even unknown ones. This doesn't cause critical issues because the kernel
is only looking at specific ones. But on the other hand, endpoints dumps
could tell the userspace some recent flags seem to be supported on older
kernel versions.

Instead, ignore all unknown flags when parsing them. By doing that, the
userspace can continue to set unsupported flags, but it has a way to
verify what is supported by the kernel.

Note that it sounds better to continue accepting unsupported flags not
to change the behaviour, but also that eases things on the userspace
side by adding "optional" endpoint types only supported by newer kernel
versions without having to deal with the different kernel versions.

A note for the backports: there will be conflicts in mptcp.h on older
versions not having the mentioned flags, the new line should still be
added last, and the '5' needs to be adapted to have the same value as
the last entry.

Fixes: 01cacb00b35c ("mptcp: add netlink-based PM")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20251205-net-mptcp-misc-fixes-6-19-rc1-v1-1-9e4781a6c1b8@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ GENMASK(5, 0) => GENMASK(3, 0) + context ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/uapi/linux/mptcp.h
net/mptcp/pm_netlink.c

index 80c40194e297765f220769fad1257c6815b69a6f..f86b1475c87ca95372b1e022aa95e54bded4dc99 100644 (file)
@@ -74,6 +74,7 @@ enum {
 #define MPTCP_PM_ADDR_FLAG_SUBFLOW                     (1 << 1)
 #define MPTCP_PM_ADDR_FLAG_BACKUP                      (1 << 2)
 #define MPTCP_PM_ADDR_FLAG_FULLMESH                    (1 << 3)
+#define MPTCP_PM_ADDR_FLAGS_MASK                       GENMASK(3, 0)
 
 enum {
        MPTCP_PM_CMD_UNSPEC,
index 21ebb4cbd33bacaa158cc79eb046d8499bdf13a3..e396adefea02662cc0f5ab52f98e5a4af930d02d 100644 (file)
@@ -1294,7 +1294,8 @@ skip_family:
                entry->addr.id = nla_get_u8(tb[MPTCP_PM_ADDR_ATTR_ID]);
 
        if (tb[MPTCP_PM_ADDR_ATTR_FLAGS])
-               entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]);
+               entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]) &
+                              MPTCP_PM_ADDR_FLAGS_MASK;
 
        if (tb[MPTCP_PM_ADDR_ATTR_PORT]) {
                if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) {