Patch "rxrpc: Improve setsockopt() handling of malformed user input" 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

    rxrpc: Improve setsockopt() handling of malformed user input

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:
     rxrpc-improve-setsockopt-handling-of-malformed-user-.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 bdd21d14e9b70490ba831bde4975694f8751e197
Author: Michal Luczaj <mhal@xxxxxxx>
Date:   Tue Nov 19 14:31:42 2024 +0100

    rxrpc: Improve setsockopt() handling of malformed user input
    
    [ Upstream commit 02020056647017e70509bb58c3096448117099e1 ]
    
    copy_from_sockptr() does not return negative value on error; instead, it
    reports the number of bytes that failed to copy. Since it's deprecated,
    switch to copy_safe_from_sockptr().
    
    Note: Keeping the `optlen != sizeof(unsigned int)` check as
    copy_safe_from_sockptr() by itself would also accept
    optlen > sizeof(unsigned int). Which would allow a more lenient handling
    of inputs.
    
    Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
    Signed-off-by: Michal Luczaj <mhal@xxxxxxx>
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index ceba28e9dce62..9b3efe6d580fe 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -641,9 +641,10 @@ static int rxrpc_setsockopt(struct socket *sock, int level, int optname,
 			ret = -EISCONN;
 			if (rx->sk.sk_state != RXRPC_UNBOUND)
 				goto error;
-			ret = copy_from_sockptr(&min_sec_level, optval,
-				       sizeof(unsigned int));
-			if (ret < 0)
+			ret = copy_safe_from_sockptr(&min_sec_level,
+						     sizeof(min_sec_level),
+						     optval, optlen);
+			if (ret)
 				goto error;
 			ret = -EINVAL;
 			if (min_sec_level > RXRPC_SECURITY_MAX)




[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