Patch "dlm: use kernel_connect() and kernel_bind()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    dlm: use kernel_connect() and kernel_bind()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dlm-use-kernel_connect-and-kernel_bind.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 95aa2bc2969bc2028bb2519c1b63fc9ab46242c8
Author: Jordan Rife <jrife@xxxxxxxxxx>
Date:   Mon Nov 6 15:24:38 2023 -0600

    dlm: use kernel_connect() and kernel_bind()
    
    [ Upstream commit e9cdebbe23f1aa9a1caea169862f479ab3fa2773 ]
    
    Recent changes to kernel_connect() and kernel_bind() ensure that
    callers are insulated from changes to the address parameter made by BPF
    SOCK_ADDR hooks. This patch wraps direct calls to ops->connect() and
    ops->bind() with kernel_connect() and kernel_bind() to protect callers
    in such cases.
    
    Link: https://lore.kernel.org/netdev/9944248dba1bce861375fcce9de663934d933ba9.camel@xxxxxxxxxx/
    Fixes: d74bad4e74ee ("bpf: Hooks for sys_connect")
    Fixes: 4fbac77d2d09 ("bpf: Hooks for sys_bind")
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Jordan Rife <jrife@xxxxxxxxxx>
    Signed-off-by: David Teigland <teigland@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 6ed09edabea0..72f34f96d015 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1845,8 +1845,8 @@ static int dlm_tcp_bind(struct socket *sock)
 	memcpy(&src_addr, dlm_local_addr[0], sizeof(src_addr));
 	make_sockaddr(&src_addr, 0, &addr_len);
 
-	result = sock->ops->bind(sock, (struct sockaddr *)&src_addr,
-				 addr_len);
+	result = kernel_bind(sock, (struct sockaddr *)&src_addr,
+			     addr_len);
 	if (result < 0) {
 		/* This *may* not indicate a critical error */
 		log_print("could not bind for connect: %d", result);
@@ -1860,7 +1860,7 @@ static int dlm_tcp_connect(struct connection *con, struct socket *sock,
 {
 	int ret;
 
-	ret = sock->ops->connect(sock, addr, addr_len, O_NONBLOCK);
+	ret = kernel_connect(sock, addr, addr_len, O_NONBLOCK);
 	switch (ret) {
 	case -EINPROGRESS:
 		fallthrough;
@@ -1900,8 +1900,8 @@ static int dlm_tcp_listen_bind(struct socket *sock)
 
 	/* Bind to our port */
 	make_sockaddr(dlm_local_addr[0], dlm_config.ci_tcp_port, &addr_len);
-	return sock->ops->bind(sock, (struct sockaddr *)dlm_local_addr[0],
-			       addr_len);
+	return kernel_bind(sock, (struct sockaddr *)&dlm_local_addr[0],
+			   addr_len);
 }
 
 static const struct dlm_proto_ops dlm_tcp_ops = {
@@ -1928,12 +1928,12 @@ static int dlm_sctp_connect(struct connection *con, struct socket *sock,
 	int ret;
 
 	/*
-	 * Make sock->ops->connect() function return in specified time,
+	 * Make kernel_connect() function return in specified time,
 	 * since O_NONBLOCK argument in connect() function does not work here,
 	 * then, we should restore the default value of this attribute.
 	 */
 	sock_set_sndtimeo(sock->sk, 5);
-	ret = sock->ops->connect(sock, addr, addr_len, 0);
+	ret = kernel_connect(sock, addr, addr_len, 0);
 	sock_set_sndtimeo(sock->sk, 0);
 	if (ret < 0)
 		return ret;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux