mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>,
	xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] xen-netfront: Fix race between device setup and open
Date: Tue, 16 Jan 2018 13:56:37 -0500	[thread overview]
Message-ID: <de3cc880-e94e-304a-0d90-e5f90d21a734@oracle.com> (raw)
In-Reply-To: <20180111093638.28937-3-ross.lagerwall@citrix.com>

On 01/11/2018 04:36 AM, Ross Lagerwall wrote:
> When a netfront device is set up it registers a netdev fairly early on,
> before it has set up the queues and is actually usable. A userspace tool
> like NetworkManager will immediately try to open it and access its state
> as soon as it appears. The bug can be reproduced by hotplugging VIFs
> until the VM runs out of grant refs. It registers the netdev but fails
> to set up any queues (since there are no more grant refs). In the
> meantime, NetworkManager opens the device and the kernel crashes trying
> to access the queues (of which there are none).
>
> Fix this in two ways:
> * For initial setup, register the netdev much later, after the queues
> are setup. This avoids the race entirely.
> * During a suspend/resume cycle, the frontend reconnects to the backend
> and the queues are recreated. It is possible (though highly unlikely) to
> race with something opening the device and accessing the queues after
> they have been destroyed but before they have been recreated. Extend the
> region covered by the rtnl semaphore to protect against this race. There
> is a possibility that we fail to recreate the queues so check for this
> in the open function.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

  parent reply	other threads:[~2018-01-16 18:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11  9:36 [PATCH 0/2] Fix a couple of crashes in netfront Ross Lagerwall
2018-01-11  9:36 ` [PATCH 1/2] xen/grant-table: Use put_page instead of free_page Ross Lagerwall
2018-01-11 15:48   ` Ross Lagerwall
2018-01-16 18:47   ` Boris Ostrovsky
2018-01-11  9:36 ` [PATCH 2/2] xen-netfront: Fix race between device setup and open Ross Lagerwall
2018-01-11 15:26   ` David Miller
2018-01-11 15:49     ` Ross Lagerwall
2018-01-11 16:08       ` David Miller
2018-01-11 16:27         ` Ross Lagerwall
2018-01-11 16:36           ` David Miller
2018-01-16 18:56   ` Boris Ostrovsky [this message]
2018-01-11 15:48 ` [PATCH 0/2] Fix a couple of crashes in netfront Ross Lagerwall
2018-02-06 14:52 ` Juergen Gross

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=de3cc880-e94e-304a-0d90-e5f90d21a734@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ross.lagerwall@citrix.com \
    --cc=xen-devel@lists.xenproject.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

Powered by JetHome