Unverified Commit 99e8874a authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15766 bpf, sockmap: Fix race between element replace and close()

parents 23070259 18d0386d
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -431,12 +431,11 @@ static void *sock_map_lookup_sys(struct bpf_map *map, void *key)
static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,
			     struct sock **psk)
{
	struct sock *sk;
	struct sock *sk = NULL;
	int err = 0;

	raw_spin_lock_bh(&stab->lock);
	sk = *psk;
	if (!sk_test || sk_test == sk)
	if (!sk_test || sk_test == *psk)
		sk = xchg(psk, NULL);

	if (likely(sk))