]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
libceph: use kernel_connect()
authorJordan Rife <jrife@google.com>
Wed, 4 Oct 2023 23:38:27 +0000 (18:38 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 09:16:51 +0000 (11:16 +0200)
commit476589a280e2ecffd68e5e7116ec847eea89e5c5
treeee4737a67540dcd25433e8d5a9727a9d87eb4581
parent8d7eef327b9faaea7254e0d514576de128c86ab1
libceph: use kernel_connect()

[ Upstream commit 7563cf17dce0a875ba3d872acdc63a78ea344019 ]

Direct calls to ops->connect() can overwrite the address parameter when
used in conjunction with BPF SOCK_ADDR hooks. Recent changes to
kernel_connect() ensure that callers are insulated from such side
effects. This patch wraps the direct call to ops->connect() with
kernel_connect() to prevent unexpected changes to the address passed to
ceph_tcp_connect().

This change was originally part of a larger patch targeting the net tree
addressing all instances of unprotected calls to ops->connect()
throughout the kernel, but this change was split up into several patches
targeting various trees.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/netdev/20230821100007.559638-1-jrife@google.com/
Link: https://lore.kernel.org/netdev/9944248dba1bce861375fcce9de663934d933ba9.camel@redhat.com/
Fixes: d74bad4e74ee ("bpf: Hooks for sys_connect")
Signed-off-by: Jordan Rife <jrife@google.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ceph/messenger.c