From: ebiederm@xmission•com (Eric W. Biederman)
To: David Miller <davem@davemloft•net>
Cc: <netdev@vger•kernel.org>, Arnd Bergmann <arnd@arnd•de>,
Jason Wang <jasowang@redhat•com>,
"Michael S. Tsirkin" <mst@redhat•com>,
Ian Campbell <ian.campbell@citrix•com>,
Shirly Ma <mashirley@us•ibm.com>
Subject: [PATCH 1/5] macvtap: Close a race between macvtap_open and macvtap_dellink.
Date: Thu, 20 Oct 2011 07:26:01 -0700 [thread overview]
Message-ID: <m1sjmnu4cm.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <m1wrbzu4ec.fsf@fess.ebiederm.org> (Eric W. Biederman's message of "Thu, 20 Oct 2011 07:24:59 -0700")
There is a small window in macvtap_open between looking up a
networking device and calling macvtap_set_queue in which
macvtap_del_queues called from macvtap_dellink. After
calling macvtap_del_queues it is totally incorrect to
allow macvtap_set_queue to proceed so prevent success by
reporting that all of the available queues are in use.
Signed-off-by: Eric W. Biederman <ebiederm@xmission•com>
---
drivers/net/macvtap.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 3da5578..70aa628 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -231,6 +231,8 @@ static void macvtap_del_queues(struct net_device *dev)
}
}
BUG_ON(vlan->numvtaps != 0);
+ /* guarantee that any future macvtap_set_queue will fail */
+ vlan->numvtaps = MAX_MACVTAP_QUEUES;
spin_unlock(&macvtap_lock);
synchronize_rcu();
--
1.7.2.5
next prev parent reply other threads:[~2011-10-20 14:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-20 14:24 [PATCH 0/5] macvtap fixes Eric W. Biederman
2011-10-20 14:26 ` Eric W. Biederman [this message]
2011-10-20 14:26 ` [PATCH 2/5] macvtap: Fix macvtap_open races in the zero copy enable code Eric W. Biederman
2011-10-20 14:27 ` [PATCH 3/5] macvtap: Don't leak unreceived packets when we delete a macvtap device Eric W. Biederman
2011-10-20 14:28 ` [PATCH 4/5] macvtap: Rewrite macvtap_newlink so the error handling works Eric W. Biederman
2011-10-20 14:29 ` [PATCH 5/5] macvtap: Fix the minor device number allocation Eric W. Biederman
2011-10-21 6:56 ` [PATCH 0/5] macvtap fixes David Miller
2011-10-24 6:31 ` Michael S. Tsirkin
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=m1sjmnu4cm.fsf@fess.ebiederm.org \
--to=ebiederm@xmission$(echo .)com \
--cc=arnd@arnd$(echo .)de \
--cc=davem@davemloft$(echo .)net \
--cc=ian.campbell@citrix$(echo .)com \
--cc=jasowang@redhat$(echo .)com \
--cc=mashirley@us$(echo .)ibm.com \
--cc=mst@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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