netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Simon Horman <simon.horman@netronome.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Jesse Gross <jesse@nicira.com>, Andy Zhou <azhou@nicira.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Alexander Duyck <alexander.h.duyck@redhat.com>
Subject: Re: [RFC PATCH 5/5] geneve: add initial netdev driver for GENEVE tunnels
Date: Fri, 3 Apr 2015 10:41:57 -0400	[thread overview]
Message-ID: <20150403144157.GC31348@tuxdriver.com> (raw)
In-Reply-To: <20150403055500.GA3336@vergenet.net>

On Fri, Apr 03, 2015 at 02:55:02PM +0900, Simon Horman wrote:
> 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@tuxdriver.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]

Hey, good catch!  I should add some locking around that...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2015-04-03 14:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 19:17 [RFC] add GENEVE netdev tunnel driver John W. Linville
2015-04-02 19:17 ` [RFC PATCH 1/5] geneve: remove MODULE_ALIAS_RTNL_LINK from net/ipv4/geneve.c John W. Linville
2015-04-02 23:39   ` Stephen Hemminger
2015-04-03 12:17     ` Jiri Pirko
2015-04-03 14:27       ` John W. Linville
2015-04-02 19:17 ` [RFC PATCH 2/5] geneve: move definition of geneve_hdr() to geneve.h John W. Linville
2015-04-02 19:17 ` [RFC PATCH 3/5] Rename support library for geneve John W. Linville
2015-04-03  0:05   ` Cong Wang
2015-04-03 14:40     ` John W. Linville
2015-04-03 15:54       ` Nicolas Dichtel
2015-04-03 18:25         ` John W. Linville
2015-04-02 19:17 ` [RFC PATCH 4/5] libgeneve: identify as driver library in modules description John W. Linville
2015-04-02 19:17 ` [RFC PATCH 5/5] geneve: add initial netdev driver for GENEVE tunnels John W. Linville
2015-04-02 20:20   ` Jiri Pirko
2015-04-03 14:57     ` John W. Linville
2015-04-03 15:07       ` John W. Linville
2015-04-03 15:20         ` Jiri Pirko
2015-04-03 18:31           ` John W. Linville
2015-04-03  5:55   ` Simon Horman
2015-04-03 14:41     ` John W. Linville [this message]
2015-04-03 21:05   ` Jesse Gross
2015-04-04  1:01     ` Francois Romieu
2015-04-06 18:06       ` Jesse Gross
2015-04-06 18:44         ` John W. Linville
2015-04-06 20:44           ` Francois Romieu
2015-04-06 18:43     ` John W. Linville
2015-04-06 22:52       ` Jesse Gross
2015-04-02 19:17 ` [RFC PATCH] iproute2: GENEVE support John W. Linville

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=20150403144157.GC31348@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=alexander.h.duyck@redhat.com \
    --cc=azhou@nicira.com \
    --cc=davem@davemloft.net \
    --cc=jesse@nicira.com \
    --cc=netdev@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    --cc=stephen@networkplumber.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).