Skip to content

Commit

Permalink
net-timestamp: introduce cgroup lock to avoid affecting non-bpf cases
Browse files Browse the repository at this point in the history
Introducing the lock to avoid affecting the applications which
are not using timestamping bpf feature.

Signed-off-by: Jason Xing <[email protected]>
  • Loading branch information
JasonXing authored and Kernel Patches Daemon committed Feb 1, 2025
1 parent da6ea0f commit 070fc02
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ static void tcp_tx_timestamp(struct sock *sk, struct sockcm_cookie *sockc)
shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1;
}

if (SK_BPF_CB_FLAG_TEST(sk, SK_BPF_CB_TX_TIMESTAMPING) && skb) {
if (cgroup_bpf_enabled(CGROUP_SOCK_OPS) &&
SK_BPF_CB_FLAG_TEST(sk, SK_BPF_CB_TX_TIMESTAMPING) && skb) {
struct skb_shared_info *shinfo = skb_shinfo(skb);
struct tcp_skb_cb *tcb = TCP_SKB_CB(skb);

Expand Down

0 comments on commit 070fc02

Please sign in to comment.