From: Patrick McHardy <kaber@trash.net>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>,
"" <davem@davemloft.net>, "Michael S. Tsirkin" <mst@redhat.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Or Gerlitz <ogerlitz@voltaire.com>,
"Fischer, Anna" <anna.fischer@hp.com>,
Anthony Liguori <anthony@codemonkey.ws>,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
Edge Virtual Bridging <evb@yahoogroups.com>
Subject: Re: [RFC] macvlan: add tap device backend
Date: Mon, 14 Dec 2009 13:53:14 +0100 [thread overview]
Message-ID: <4B26353A.9020005@trash.net> (raw)
In-Reply-To: <1259862720-28432-3-git-send-email-arnd@arndb.de>
Arnd Bergmann wrote:
> +static int macvtap_newlink(struct net *src_net,
> + struct net_device *dev,
> + struct nlattr *tb[],
> + struct nlattr *data[])
> +{
> + struct device *classdev;
> + dev_t devt;
> + int err;
> +
> + err = macvlan_common_newlink(src_net, dev, tb, data,
> + macvtap_receive, macvtap_forward);
> + if (err)
> + goto out;
> +
> + devt = MKDEV(MAJOR(macvtap_major), dev->ifindex);
> +
> + classdev = device_create(macvtap_class, &dev->dev, devt,
> + dev, "tap%d", dev->ifindex);
> + if (IS_ERR(classdev)) {
> + err = PTR_ERR(classdev);
> + macvtap_del_queues(dev);
> + macvlan_dellink(dev, NULL);
I think this may cause a double free since macvlan_dellink() will
free the device and rtnl_newlink() will free it again on error.
> + }
> +
> +out:
> + return err;
> +}
> +
> +static void macvtap_dellink(struct net_device *dev,
> + struct list_head *head)
> +{
> + device_destroy(macvtap_class,
> + MKDEV(MAJOR(macvtap_major), dev->ifindex));
> +
> + macvtap_del_queues(dev);
> + macvlan_dellink(dev, head);
> +}
> +
> +static struct rtnl_link_ops macvtap_link_ops __read_mostly = {
> + .kind = "macvtap",
> + .newlink = macvtap_newlink,
> + .dellink = macvtap_dellink,
> +};
next prev parent reply other threads:[~2009-12-14 12:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-03 17:51 [RFC 0/2] macvtap, second try Arnd Bergmann
2009-12-03 17:51 ` [RFC 1/2] macvlan: Allow plugging in additional backends Arnd Bergmann
2009-12-14 12:49 ` Patrick McHardy
2009-12-03 17:52 ` [RFC] macvlan: add tap device backend Arnd Bergmann
2009-12-12 8:41 ` Herbert Xu
2009-12-14 12:00 ` Arnd Bergmann
2009-12-14 12:38 ` David Miller
2009-12-14 12:53 ` Patrick McHardy [this message]
2009-12-14 15:40 ` Arnd Bergmann
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=4B26353A.9020005@trash.net \
--to=kaber@trash.net \
--cc=anna.fischer@hp.com \
--cc=anthony@codemonkey.ws \
--cc=arnd@arndb.de \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=evb@yahoogroups.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@voltaire.com \
--cc=shemminger@linux-foundation.org \
--cc=virtualization@lists.linux-foundation.org \
/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).