[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1ac61d8a51a985f25848f480191c0677b3ed0b7.camel@redhat.com>
Date: Mon, 27 Nov 2023 12:13:09 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org
Cc: kuba@...nel.org, davem@...emloft.net, edumazet@...gle.com,
jacob.e.keller@...el.com, jhs@...atatu.com, johannes@...solutions.net,
andriy.shevchenko@...ux.intel.com, amritha.nambiar@...el.com,
sdf@...gle.com, horms@...nel.org
Subject: Re: [patch net-next v4 5/9] genetlink: introduce per-sock family
private pointer storage
On Thu, 2023-11-23 at 19:15 +0100, Jiri Pirko wrote:
[...]
> +/**
> + * genl_sk_priv_store - Store per-socket private pointer for family
> + *
> + * @sk: socket
> + * @family: family
> + * @priv: private pointer
> + *
> + * Store a private pointer per-socket for a specified
> + * Generic netlink family.
> + *
> + * Caller has to make sure this is not called in parallel multiple times
> + * for the same sock and also in parallel to genl_release() for the same sock.
> + *
> + * Returns: previously stored private pointer for the family (could be NULL)
> + * on success, otherwise negative error value encoded by ERR_PTR().
> + */
> +void *genl_sk_priv_store(struct sock *sk, struct genl_family *family,
> + void *priv)
> +{
> + struct genl_sk_ctx *ctx;
> + void *old_priv;
> +
> + ctx = rcu_dereference_raw(nlk_sk(sk)->priv);
Minor nit: Looking at the following patch, this will be called under
the rtnl lock. Since a look is needed to ensure the priv ptr
consistency, what about adding the relevant lockdep annotation here?
No need to repost for the above.
Cheers,
Paolo
Powered by blists - more mailing lists