Patch "udp6: fix potential access to stale information" has been added to the 6.2-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

    udp6: fix potential access to stale information

to the 6.2-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:
     udp6-fix-potential-access-to-stale-information.patch
and it can be found in the queue-6.2 subdirectory.

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



commit 9412d67107a647a46a34cdd016d9298553aa42b1
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Wed Apr 12 13:03:08 2023 +0000

    udp6: fix potential access to stale information
    
    [ Upstream commit 1c5950fc6fe996235f1d18539b9c6b64b597f50f ]
    
    lena wang reported an issue caused by udpv6_sendmsg()
    mangling msg->msg_name and msg->msg_namelen, which
    are later read from ____sys_sendmsg() :
    
            /*
             * If this is sendmmsg() and sending to current destination address was
             * successful, remember it.
             */
            if (used_address && err >= 0) {
                    used_address->name_len = msg_sys->msg_namelen;
                    if (msg_sys->msg_name)
                            memcpy(&used_address->name, msg_sys->msg_name,
                                   used_address->name_len);
            }
    
    udpv6_sendmsg() wants to pretend the remote address family
    is AF_INET in order to call udp_sendmsg().
    
    A fix would be to modify the address in-place, instead
    of using a local variable, but this could have other side effects.
    
    Instead, restore initial values before we return from udpv6_sendmsg().
    
    Fixes: c71d8ebe7a44 ("net: Fix security_socket_sendmsg() bypass problem.")
    Reported-by: lena wang <lena.wang@xxxxxxxxxxxx>
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Reviewed-by: Maciej Żenczykowski <maze@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230412130308.1202254-1-edumazet@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 9fb2f33ee3a76..a675acfb901d1 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1395,9 +1395,11 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 			msg->msg_name = &sin;
 			msg->msg_namelen = sizeof(sin);
 do_udp_sendmsg:
-			if (ipv6_only_sock(sk))
-				return -ENETUNREACH;
-			return udp_sendmsg(sk, msg, len);
+			err = ipv6_only_sock(sk) ?
+				-ENETUNREACH : udp_sendmsg(sk, msg, len);
+			msg->msg_name = sin6;
+			msg->msg_namelen = addr_len;
+			return err;
 		}
 	}
 



[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