From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net,
edumazet@google.com, jacob.e.keller@intel.com, jhs@mojatatu.com,
johannes@sipsolutions.net, andriy.shevchenko@linux.intel.com,
amritha.nambiar@intel.com, sdf@google.com, horms@kernel.org,
przemyslaw.kitszel@intel.com
Subject: Re: [patch net-next v6 5/9] genetlink: introduce per-sock family private storage
Date: Wed, 13 Dec 2023 09:50:43 +0100 [thread overview]
Message-ID: <ZXlwY5NxMCEzT/MM@nanopsycho> (raw)
In-Reply-To: <20231212154938.6e68fc1d@kernel.org>
Wed, Dec 13, 2023 at 12:49:38AM CET, kuba@kernel.org wrote:
>On Tue, 12 Dec 2023 11:17:32 +0100 Jiri Pirko wrote:
>> +static void genl_sk_priv_free(struct genl_sk_priv *priv)
>> +{
>> + spin_lock(&priv->family->sock_priv_list->lock);
>> + list_del(&priv->list);
>> + spin_unlock(&priv->family->sock_priv_list->lock);
>> + if (priv->destructor)
>> + priv->destructor(priv->priv);
>> + kfree(priv);
>
>> +static void genl_sk_priv_list_free(const struct genl_family *family)
>> +{
>> + struct genl_sk_priv *priv, *tmp;
>> +
>> + if (!family->sock_priv_size)
>> + return;
>> +
>> + list_for_each_entry_safe(priv, tmp, &family->sock_priv_list->list, list)
>> + genl_sk_priv_free(priv);
>> + kfree(family->sock_priv_list);
>
>Is this not racy for socket close vs family unregister?
>Once family starts to unregister no new privs can be installed
>(on the basis that such family's callbacks can no longer be called).
>But a socket may get closed in the meantime, and we'll end up entering
>genl_sk_priv_free() both from genl_release() and genl_sk_priv_list_free().
>
>Also I'm afraid there is a race still between removing the entry from
>the list and calling destroy.
Moreover, priv is not erased from gsk->family_privs xarray. Sigh, this
is pain.
next prev parent reply other threads:[~2023-12-13 8:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 10:17 [patch net-next v6 0/9] devlink: introduce notifications filtering Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 1/9] devlink: use devl_is_registered() helper instead xa_get_mark() Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 2/9] devlink: introduce __devl_is_registered() helper and use it instead of xa_get_mark() Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 3/9] devlink: send notifications only if there are listeners Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 4/9] devlink: introduce a helper for netlink multicast send Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 5/9] genetlink: introduce per-sock family private storage Jiri Pirko
2023-12-12 23:49 ` Jakub Kicinski
2023-12-13 8:50 ` Jiri Pirko [this message]
2023-12-12 10:17 ` [patch net-next v6 6/9] netlink: introduce typedef for filter function Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 7/9] genetlink: introduce helpers to do filtered multicast Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 8/9] devlink: add a command to set notification filter and use it for multicasts Jiri Pirko
2023-12-12 10:17 ` [patch net-next v6 9/9] devlink: extend multicast filtering by port index Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZXlwY5NxMCEzT/MM@nanopsycho \
--to=jiri@resnulli.us \
--cc=amritha.nambiar@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jhs@mojatatu.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).