lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 Dec 2017 18:46:52 +0100
From:   Greg Kurz <groug@...d.org>
To:     linux-kernel@...r.kernel.org
Cc:     v9fs-developer@...ts.sourceforge.net,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Jason Wang <jasowang@...hat.com>,
        Al Viro <viro@...IV.linux.org.uk>
Subject: [PATCH 2/2] 9p/trans_virtio: implement cancelled callback

When 9p requests are successfully flushed, we must manually move the
associated buffers to the virtqueue freelist, since the server doesn't
send a reply.

Signed-off-by: Greg Kurz <groug@...d.org>
---
 net/9p/trans_virtio.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index f3a4efcf1456..d3216af124c4 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -206,6 +206,23 @@ static int p9_virtio_cancel(struct p9_client *client, struct p9_req_t *req)
 	return 1;
 }
 
+static int p9_virtio_cancelled(struct p9_client *client, struct p9_req_t *req)
+{
+	struct virtio_chan *chan = client->trans;
+	unsigned long flags;
+
+	spin_lock_irqsave(&chan->lock, flags);
+	if (virtqueue_detach_buf(chan->vq, req) != req) {
+		spin_unlock_irqrestore(&chan->lock, flags);
+		return 0;
+	}
+	chan->ring_bufs_avail = 1;
+	spin_unlock_irqrestore(&chan->lock, flags);
+	/* Wakeup if anyone waiting for VirtIO ring space. */
+	wake_up(chan->vc_wq);
+	return 0;
+}
+
 /**
  * pack_sg_list_p - Just like pack_sg_list. Instead of taking a buffer,
  * this takes a list of pages.
@@ -737,6 +754,7 @@ static struct p9_trans_module p9_virtio_trans = {
 	.request = p9_virtio_request,
 	.zc_request = p9_virtio_zc_request,
 	.cancel = p9_virtio_cancel,
+	.cancelled = p9_virtio_cancelled,
 	/*
 	 * We leave one entry for input and one entry for response
 	 * headers. We also skip one more entry to accomodate, address

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ