Commit 06ef4ad8 authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by Wen Zhiwei
Browse files

mptcp: pm: only in-kernel cannot have entries with ID 0

stable inclusion
from stable-v6.6.48
commit a7a692b791046ea7d3cca3c8a5295eeec583acf9
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAWEBV

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a7a692b791046ea7d3cca3c8a5295eeec583acf9



--------------------------------

commit ca6e55a703ca2894611bb5c5bca8bfd2290fd91e upstream.

The ID 0 is specific per MPTCP connections. The per netns entries cannot
have this special ID 0 then.

But that's different for the userspace PM where the entries are per
connection, they can then use this special ID 0.

Fixes: f40be0db ("mptcp: unify pm get_flags_and_ifindex_by_id")
Cc: stable@vger.kernel.org
Acked-by: default avatarGeliang Tang <geliang@kernel.org>
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20240819-net-mptcp-pm-reusing-id-v1-11-38035d40de5b@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent a0549f91
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -423,9 +423,6 @@ int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id
	*flags = 0;
	*ifindex = 0;

	if (!id)
		return 0;

	if (mptcp_pm_is_userspace(msk))
		return mptcp_userspace_pm_get_flags_and_ifindex_by_id(msk, id, flags, ifindex);
	return mptcp_pm_nl_get_flags_and_ifindex_by_id(msk, id, flags, ifindex);
+4 −0
Original line number Diff line number Diff line
@@ -1395,6 +1395,10 @@ int mptcp_pm_nl_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int
	struct sock *sk = (struct sock *)msk;
	struct net *net = sock_net(sk);

	/* No entries with ID 0 */
	if (id == 0)
		return 0;

	rcu_read_lock();
	entry = __lookup_addr_by_id(pm_nl_get_pernet(net), id);
	if (entry) {