From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <sdf@fomichev.me>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, Cosmin Ratiu <cratiu@nvidia.com>
Subject: Re: [PATCH net v4 02/11] net: hold instance lock during NETDEV_REGISTER/UP
Date: Mon, 31 Mar 2025 13:48:11 -0700 [thread overview]
Message-ID: <20250331134811.02655264@kernel.org> (raw)
In-Reply-To: <20250331150603.1906635-3-sdf@fomichev.me>
On Mon, 31 Mar 2025 08:05:54 -0700 Stanislav Fomichev wrote:
> Callers of inetdev_init can come from several places with inconsistent
> expectation about netdev instance lock. Grab instance lock during
> REGISTER (plus UP). Also solve the inconsistency with UNREGISTER
> where it was locked only during move netns path.
Couple of nits, with that:
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
> diff --git a/net/core/dev_api.c b/net/core/dev_api.c
> index 8dbc60612100..cb3e5807dce8 100644
> --- a/net/core/dev_api.c
> +++ b/net/core/dev_api.c
> @@ -119,9 +119,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net,
> {
> int ret;
>
> - netdev_lock_ops(dev);
> - ret = netif_change_net_namespace(dev, net, pat, 0, NULL);
> - netdev_unlock_ops(dev);
> + ret = __dev_change_net_namespace(dev, net, pat, 0, NULL);
>
> return ret;
> }
nit: no need for the temp variable for ret, now
> @@ -3042,14 +3040,16 @@ static int do_setlink(const struct sk_buff *skb, struct net_device *dev,
>
> new_ifindex = nla_get_s32_default(tb[IFLA_NEW_IFINDEX], 0);
>
> - err = netif_change_net_namespace(dev, tgt_net, pat,
> - new_ifindex, extack);
> + err = __dev_change_net_namespace(dev, tgt_net, pat, new_ifindex,
nit: over 80 chars now
> + extack);
> if (err)
> - goto errout;
> + return err;
next prev parent reply other threads:[~2025-03-31 20:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 15:05 [PATCH net v4 00/11] net: hold instance lock during NETDEV_UP/REGISTER Stanislav Fomichev
2025-03-31 15:05 ` [PATCH net v4 01/11] net: switch to netif_disable_lro in inetdev_init Stanislav Fomichev
2025-03-31 20:43 ` Jakub Kicinski
2025-03-31 21:06 ` Stanislav Fomichev
2025-03-31 15:05 ` [PATCH net v4 02/11] net: hold instance lock during NETDEV_REGISTER/UP Stanislav Fomichev
2025-03-31 20:48 ` Jakub Kicinski [this message]
2025-03-31 21:13 ` Stanislav Fomichev
2025-03-31 21:27 ` Jakub Kicinski
2025-03-31 15:05 ` [PATCH net v4 03/11] net: use netif_disable_lro in ipv6_add_dev Stanislav Fomichev
2025-03-31 15:05 ` [PATCH net v4 04/11] net: rename rtnl_net_debug to lock_debug Stanislav Fomichev
2025-03-31 20:48 ` Jakub Kicinski
2025-03-31 15:05 ` [PATCH net v4 05/11] netdevsim: add dummy device notifiers Stanislav Fomichev
2025-03-31 20:54 ` Jakub Kicinski
2025-03-31 21:20 ` Stanislav Fomichev
2025-03-31 15:05 ` [PATCH net v4 06/11] net: dummy: request ops lock Stanislav Fomichev
2025-03-31 15:05 ` [PATCH net v4 07/11] docs: net: document netdev notifier expectations Stanislav Fomichev
2025-03-31 20:58 ` Jakub Kicinski
2025-03-31 21:49 ` Stanislav Fomichev
2025-03-31 15:06 ` [PATCH net v4 08/11] selftests: net: use netdevsim in netns test Stanislav Fomichev
2025-03-31 15:06 ` [PATCH net v4 09/11] net: designate XSK pool pointers in queues as "ops protected" Stanislav Fomichev
2025-03-31 15:06 ` [PATCH net v4 10/11] netdev: add "ops compat locking" helpers Stanislav Fomichev
2025-03-31 15:06 ` [PATCH net v4 11/11] netdev: don't hold rtnl_lock over nl queue info get when possible Stanislav Fomichev
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=20250331134811.02655264@kernel.org \
--to=kuba@kernel.org \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.