Patch "net: Implement missing getsockopt(SO_TIMESTAMPING_NEW)" has been added to the 5.10-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

    net: Implement missing getsockopt(SO_TIMESTAMPING_NEW)

to the 5.10-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:
     net-implement-missing-getsockopt-so_timestamping_new.patch
and it can be found in the queue-5.10 subdirectory.

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



commit c3d9ee6603aadfdabf7f95dadf4e80e595626b22
Author: Jörn-Thorben Hinz <jthinz@xxxxxxxxxxxxxxxxxxxx>
Date:   Fri Dec 22 00:19:01 2023 +0100

    net: Implement missing getsockopt(SO_TIMESTAMPING_NEW)
    
    [ Upstream commit 7f6ca95d16b96567ce4cf458a2790ff17fa620c3 ]
    
    Commit 9718475e6908 ("socket: Add SO_TIMESTAMPING_NEW") added the new
    socket option SO_TIMESTAMPING_NEW. Setting the option is handled in
    sk_setsockopt(), querying it was not handled in sk_getsockopt(), though.
    
    Following remarks on an earlier submission of this patch, keep the old
    behavior of getsockopt(SO_TIMESTAMPING_OLD) which returns the active
    flags even if they actually have been set through SO_TIMESTAMPING_NEW.
    
    The new getsockopt(SO_TIMESTAMPING_NEW) is stricter, returning flags
    only if they have been set through the same option.
    
    Fixes: 9718475e6908 ("socket: Add SO_TIMESTAMPING_NEW")
    Link: https://lore.kernel.org/lkml/20230703175048.151683-1-jthinz@xxxxxxxxxxxxxxxxxxxx/
    Link: https://lore.kernel.org/netdev/0d7cddc9-03fa-43db-a579-14f3e822615b@xxxxxxxxxxxxxxxx/
    Signed-off-by: Jörn-Thorben Hinz <jthinz@xxxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Willem de Bruijn <willemb@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/sock.c b/net/core/sock.c
index a069b5476df46..9c3bc24bfdd1f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1383,9 +1383,16 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		break;
 
 	case SO_LINGER:
+	case SO_TIMESTAMPING_NEW:
 		lv		= sizeof(v.ling);
-		v.ling.l_onoff	= sock_flag(sk, SOCK_LINGER);
-		v.ling.l_linger	= sk->sk_lingertime / HZ;
+		/* For the later-added case SO_TIMESTAMPING_NEW: Be strict about only
+		 * returning the flags when they were set through the same option.
+		 * Don't change the beviour for the old case SO_TIMESTAMPING_OLD.
+		 */
+		if (optname == SO_TIMESTAMPING_OLD || sock_flag(sk, SOCK_TSTAMP_NEW)) {
+			v.ling.l_onoff	= sock_flag(sk, SOCK_LINGER);
+			v.ling.l_linger	= sk->sk_lingertime / HZ;
+		}
 		break;
 
 	case SO_BSDCOMPAT:




[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