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 3/5] macvtap: Don't leak unreceived packets when we delete a macvtap device.
Date: Thu, 20 Oct 2011 07:27:24 -0700 [thread overview]
Message-ID: <m1hb33u4ab.fsf_-_@fess.ebiederm.org> (raw)
In-Reply-To: <m1mxcvu4bk.fsf_-_@fess.ebiederm.org> (Eric W. Biederman's message of "Thu, 20 Oct 2011 07:26:39 -0700")
To avoid leaking packets in the receive queue. Add a socket destructor
that will run whenever destroy a macvtap socket.
Signed-off-by: Eric W. Biederman <ebiederm@xmission•com>
---
drivers/net/macvtap.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 1d9c9c2..515aa87 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -339,6 +339,11 @@ static void macvtap_sock_write_space(struct sock *sk)
wake_up_interruptible_poll(wqueue, POLLOUT | POLLWRNORM | POLLWRBAND);
}
+static void macvtap_sock_destruct(struct sock *sk)
+{
+ skb_queue_purge(&sk->sk_receive_queue);
+}
+
static int macvtap_open(struct inode *inode, struct file *file)
{
struct net *net = current->nsproxy->net_ns;
@@ -369,6 +374,7 @@ static int macvtap_open(struct inode *inode, struct file *file)
q->sock.ops = &macvtap_socket_ops;
sock_init_data(&q->sock, &q->sk);
q->sk.sk_write_space = macvtap_sock_write_space;
+ q->sk.sk_destruct = macvtap_sock_destruct;
q->flags = IFF_VNET_HDR | IFF_NO_PI | IFF_TAP;
q->vnet_hdr_sz = sizeof(struct virtio_net_hdr);
--
1.7.2.5
next prev parent reply other threads:[~2011-10-20 14:26 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 ` [PATCH 1/5] macvtap: Close a race between macvtap_open and macvtap_dellink Eric W. Biederman
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 ` Eric W. Biederman [this message]
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=m1hb33u4ab.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