All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	martin.varghese@nokia.com, Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net v2] net: bareudp: add missing error handling for bareudp_link_config()
Date: Tue, 5 Jan 2021 14:39:12 -0800	[thread overview]
Message-ID: <20210105143912.34e71377@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <CAM_iQpVMBjoSFH34cunM+e+E6Qu+eWVfoduo5LvyupRHq1OG1w@mail.gmail.com>

On Tue, 5 Jan 2021 12:38:54 -0800 Cong Wang wrote:
> On Tue, Jan 5, 2021 at 11:07 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > +static void bareudp_dellink(struct net_device *dev, struct list_head *head)
> > +{
> > +       struct bareudp_dev *bareudp = netdev_priv(dev);
> > +
> > +       list_del(&bareudp->next);
> > +       unregister_netdevice_queue(dev, head);
> > +}
> > +
> >  static int bareudp_newlink(struct net *net, struct net_device *dev,
> >                            struct nlattr *tb[], struct nlattr *data[],
> >                            struct netlink_ext_ack *extack)
> >  {
> >         struct bareudp_conf conf;
> > +       LIST_HEAD(list_kill);
> >         int err;
> >
> >         err = bareudp2info(data, &conf, extack);
> > @@ -662,17 +671,14 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,
> >
> >         err = bareudp_link_config(dev, tb);
> >         if (err)
> > -               return err;
> > +               goto err_unconfig;
> >
> >         return 0;
> > -}
> > -
> > -static void bareudp_dellink(struct net_device *dev, struct list_head *head)
> > -{
> > -       struct bareudp_dev *bareudp = netdev_priv(dev);
> >
> > -       list_del(&bareudp->next);
> > -       unregister_netdevice_queue(dev, head);
> > +err_unconfig:
> > +       bareudp_dellink(dev, &list_kill);
> > +       unregister_netdevice_many(&list_kill);  
> 
> Why do we need unregister_netdevice_many() here? I think
> bareudp_dellink(dev, NULL) is sufficient as we always have
> one instance to unregister?
> 
> (For the same reason, bareudp_dev_create() does not need it
> either.)

Ack, I'm following how bareudp_dev_create() is written. 

I can follow up in net-next and change both, sounds good?

  reply	other threads:[~2021-01-05 22:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 19:07 [PATCH net v2] net: bareudp: add missing error handling for bareudp_link_config() Jakub Kicinski
2021-01-05 20:38 ` Cong Wang
2021-01-05 22:39   ` Jakub Kicinski [this message]
2021-01-05 23:36     ` Cong Wang
2021-01-07  0:00 ` patchwork-bot+netdevbpf

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=20210105143912.34e71377@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=martin.varghese@nokia.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    --cc=xiyou.wangcong@gmail.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.