net: Fix called net_enable_timestamp() in sctp_copy_sock()
Subsystems (3)
PATCH 1/1 net: Fix called net_enable_timestamp() in sctp_copy_sock()
Add sock_needs_netstamp() judgment condition when need to call net_enable_timestamp().
Signed-off-by Yajun Deng <[email protected]>
--- include/net/sock.h | 1 + net/core/sock.c | 2 +- net/sctp/socket.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
include/net/sock.h +1 -0
@@ -2757,6 +2757,7 @@ int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk);void sock_set_timestamp (struct sock *sk,int optname,bool valbool);int sock_set_timestamping (struct sock *sk,int optname,int val); +bool sock_needs_netstamp (const struct sock *sk);void sock_enable_timestamps (struct sock *sk);void sock_no_linger (struct sock *sk);void sock_set_keepalive (struct sock *sk);
net/core/sock.c +1 -1
@@ -429,7 +429,7 @@ static int sock_set_timeout(long *timeo_p, sockptr_t optval, int optlen,return 0 ; } -static bool sock_needs_netstamp (const struct sock *sk) +bool sock_needs_netstamp (const struct sock *sk) {switch (sk->sk_family) {case AF_UNSPEC :
net/sctp/socket.c +1 -1
@@ -9449,7 +9449,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, newinet->mc_index =0 ; newinet->mc_list =NULL ; -if (newsk->sk_flags &SK_FLAGS_TIMESTAMP ) +if (sock_needs_netstamp (newsk) && newsk->sk_flags &SK_FLAGS_TIMESTAMP )net_enable_timestamp ();/* Set newsk security attributes from original sk and connection
Signature · 1 line
2.32.0
Xin Long
maintainerQuoted 3 lines · Yajun Deng
Add
sock_needs_netstamp()judgment condition when need to callnet_enable_timestamp().
Why do we need this when it always returns true for SCTP?
Quoted 49 lines
Signed-off-by Yajun Deng <[email protected]>--- include/net/sock.h | 1 + net/core/sock.c | 2 +- net/sctp/socket.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)include/net/sock.h +1
-0@@ -2757,6 +2757,7 @@ int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk);void sock_set_timestamp (struct sock *sk,int optname,bool valbool);int sock_set_timestamping (struct sock *sk,int optname,int val); +bool sock_needs_netstamp (const struct sock *sk);void sock_enable_timestamps (struct sock *sk);void sock_no_linger (struct sock *sk);void sock_set_keepalive (struct sock *sk);net/core/sock.c +1
-1@@ -429,7 +429,7 @@ static int sock_set_timeout(long *timeo_p, sockptr_t optval, int optlen,return 0 ; } -static bool sock_needs_netstamp (const struct sock *sk) +bool sock_needs_netstamp (const struct sock *sk) {switch (sk->sk_family) {case AF_UNSPEC :net/sctp/socket.c +1
-2@@ -9449,7 +9449,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, newinet->mc_index =0 ; newinet->mc_list =NULL ; -if (newsk->sk_flags &SK_FLAGS_TIMESTAMP ) +if (sock_needs_netstamp (newsk) && newsk->sk_flags &SK_FLAGS_TIMESTAMP )net_enable_timestamp ();/* Set newsk security attributes from original sk and connection -- 2.32.0