--- x/net/ipv4/cipso_ipv4.c +++ y/net/ipv4/cipso_ipv4.c @@ -1848,6 +1848,7 @@ static int cipso_v4_get_actual_opt_len(c * values on failure. * */ +static DEFINE_SPINLOCK(setattr_spinlock); int cipso_v4_sock_setattr(struct sock *sk, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr, @@ -1899,6 +1900,7 @@ int cipso_v4_sock_setattr(struct sock *s kfree(buf); buf = NULL; + spin_lock(&setattr_spinlock); sk_inet = inet_sk(sk); old = rcu_dereference_protected(sk_inet->inet_opt, sk_locked); @@ -1912,6 +1914,7 @@ int cipso_v4_sock_setattr(struct sock *s rcu_assign_pointer(sk_inet->inet_opt, opt); if (old) kfree_rcu(old, rcu); + spin_unlock(&setattr_spinlock); return 0;