[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150403055500.GA3336@vergenet.net>
Date: Fri, 3 Apr 2015 14:55:02 +0900
From: Simon Horman <simon.horman@...ronome.com>
To: "John W. Linville" <linville@...driver.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Jesse Gross <jesse@...ira.com>, Andy Zhou <azhou@...ira.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Alexander Duyck <alexander.h.duyck@...hat.com>
Subject: Re: [RFC PATCH 5/5] geneve: add initial netdev driver for GENEVE
tunnels
Hi John,
On Thu, Apr 02, 2015 at 03:17:06PM -0400, John W. Linville wrote:
> This is an initial implementation of a netdev driver for GENEVE
> tunnels. This implementation uses a fixed UDP port, and only supports
> a single tunnel (and therefore only a single VNI) per net namespace.
> Only IPv4 links are supported at this time.
>
> Signed-off-by: John W. Linville <linville@...driver.com>
Thanks for working on this. I'm very happy to see a Geneve driver hit netdev.
I have a question below.
[snip]
> +/* Scheduled at device creation to bind to a socket */
> +static void geneve_sock_work(struct work_struct *work)
> +{
> + struct geneve_dev *geneve = container_of(work, struct geneve_dev, sock_work);
> + struct net *net = geneve->net;
> + struct geneve_sock *gs;
> +
> + gs = geneve_sock_add(net, htons(GENEVE_UDP_PORT), geneve_rx, geneve,
> + true, false);
> + if (!IS_ERR(gs))
> + geneve->sock = gs;
> +
> + dev_put(geneve->dev);
> +}
> +
> +/* Setup stats when device is created */
> +static int geneve_init(struct net_device *dev)
> +{
> + struct geneve_dev *geneve = netdev_priv(dev);
> +
> + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
> + if (!dev->tstats)
> + return -ENOMEM;
> +
> + /* make new socket outside of RTNL */
> + dev_hold(dev);
> + queue_work(geneve_wq, &geneve->sock_work);
> +
> + return 0;
> +}
> +
> +static void geneve_uninit(struct net_device *dev)
> +{
> + struct geneve_dev *geneve = netdev_priv(dev);
> + struct geneve_sock *gs = geneve->sock;
> +
> + if (gs)
> + geneve_sock_release(gs);
> + free_percpu(dev->tstats);
> +}
I am wondering if there a possibility that geneve_sock_work() could run
after the check for gs in geneve_uninit() thus leaking gs?
[snip]
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists