From: ebiederm@xmission.com (Eric W. Biederman)
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, pshelar@nicira.com,
cwang@twopensource.com, nicolas.dichtel@6wind.com,
david@gibson.dropbear.id.au, sfeldma@cumulusnetworks.com,
sucheta.chakraborty@qlogic.com, stephen@networkplumber.org
Subject: Re: [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set
Date: Wed, 25 Jun 2014 08:55:02 -0700 [thread overview]
Message-ID: <87tx79vvah.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <1403699280-12837-1-git-send-email-jiri@resnulli.us> (Jiri Pirko's message of "Wed, 25 Jun 2014 14:27:59 +0200")
Jiri Pirko <jiri@resnulli.us> writes:
> So far, it is assumed that ops->setup is filled up. But there might be
> case that ops might make sense even without ->setup. In that case,
> forbid to newlink and dellink.
This patch does not handle all cases of dellink, and so you have created
a way to oops the kernel. One case that is not handled is
default_device_exit_batch.
Further using !setup to prevent dellink does not make any kind of
logical sense. Which leads to a maintenance hazard. Aka how can we
further update this code without running into weird corner cases.
Further you have not given a description why anyone would want to have
something that is almost completely unlike rtnl link operations
implemented with the rtnl link operations.
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
> net/core/rtnetlink.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 1063996..84affd7 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -1777,7 +1777,7 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh)
> return -ENODEV;
>
> ops = dev->rtnl_link_ops;
> - if (!ops)
> + if (!ops || !ops->setup)
> return -EOPNOTSUPP;
>
> ops->dellink(dev, &list_kill);
> @@ -2038,6 +2038,9 @@ replay:
> return -EOPNOTSUPP;
> }
>
> + if (!ops->setup)
> + return -EOPNOTSUPP;
> +
> if (!ifname[0])
> snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind);
next prev parent reply other threads:[~2014-06-25 15:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-25 12:27 [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set Jiri Pirko
2014-06-25 12:28 ` [patch net-next 2/2] openvswitch: introduce rtnl ops stub Jiri Pirko
2014-06-25 16:02 ` Eric W. Biederman
2014-06-25 16:35 ` Jiri Pirko
2014-06-25 17:13 ` Eric W. Biederman
2014-06-26 7:39 ` Jiri Pirko
2014-06-25 15:55 ` Eric W. Biederman [this message]
2014-06-25 16:31 ` [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set 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=87tx79vvah.fsf@x220.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=cwang@twopensource.com \
--cc=davem@davemloft.net \
--cc=david@gibson.dropbear.id.au \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=pshelar@nicira.com \
--cc=sfeldma@cumulusnetworks.com \
--cc=stephen@networkplumber.org \
--cc=sucheta.chakraborty@qlogic.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 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.