[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKvLQ3jZ8fYwRiBHo-PmSKbhwujWpjFUKtRYANGaPk70g@mail.gmail.com>
Date: Wed, 25 Jun 2025 20:31:57 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Daniel Zahka <daniel.zahka@...il.com>
Cc: Donald Hunter <donald.hunter@...il.com>, Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Jonathan Corbet <corbet@....net>, Andrew Lunn <andrew+netdev@...n.ch>,
Saeed Mahameed <saeedm@...dia.com>, Leon Romanovsky <leon@...nel.org>, Tariq Toukan <tariqt@...dia.com>,
Boris Pismenny <borisp@...dia.com>, Kuniyuki Iwashima <kuniyu@...gle.com>,
Willem de Bruijn <willemb@...gle.com>, David Ahern <dsahern@...nel.org>,
Neal Cardwell <ncardwell@...gle.com>, Patrisious Haddad <phaddad@...dia.com>, Raed Salem <raeds@...dia.com>,
Jianbo Liu <jianbol@...dia.com>, Dragos Tatulea <dtatulea@...dia.com>,
Rahul Rameshbabu <rrameshbabu@...dia.com>, Stanislav Fomichev <sdf@...ichev.me>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Alexander Lobakin <aleksander.lobakin@...el.com>, Jacob Keller <jacob.e.keller@...el.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH v2 08/17] net: psp: add socket security association code
On Wed, Jun 25, 2025 at 6:52 AM Daniel Zahka <daniel.zahka@...il.com> wrote:
>
> From: Jakub Kicinski <kuba@...nel.org>
>
> Add the ability to install PSP Rx and Tx crypto keys on TCP
> connections. Netlink ops are provided for both operations.
> Rx side combines allocating a new Rx key and installing it
> on the socket. Theoretically these are separate actions,
> but in practice they will always be used one after the
> other. We can add distinct "alloc" and "install" ops later.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> Signed-off-by: Daniel Zahka <daniel.zahka@...il.com>
> Co-developed-by: Daniel Zahka <daniel.zahka@...il.com>
> ---
> +/**
> + * psp_assoc_put() - release a reference on a PSP association
> + * @pas: association to release
> + */
> +void psp_assoc_put(struct psp_assoc *pas)
> +{
> + if (pas && refcount_dec_and_test(&pas->refcnt))
> + call_rcu(&pas->rcu, psp_assoc_free_queue);
> +}
> +
> +void psp_sk_assoc_free(struct sock *sk)
> +{
> + rcu_read_lock();
This is a writer side.
rcu_read_lock() here is wrong, and only silences lockdep.
Use instead rcu_dereference_protected(sk->psp_assoc,
whatever_assert_making_sure_we_are_under_some_protection_against_another_writer);
The condition can be 1 if we are in a sk dismantle point, otherwise
lockdep_sock_is_held(sk) is often used.
> + psp_assoc_put(rcu_dereference(sk->psp_assoc));
> + rcu_assign_pointer(sk->psp_assoc, NULL);
> + rcu_read_unlock();
> +}
Powered by blists - more mailing lists