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]
Message-Id: <1351587113-2566-4-git-send-email-sjur@brendeland.net>
Date:	Tue, 30 Oct 2012 09:51:53 +0100
From:	Sjur Brændeland <sjur@...ndeland.net>
To:	Rusty Russell <rusty@...tcorp.com.au>
Cc:	"Michael S. Tsirkin" <mst@...hat.com>,
	Amit Shah <amit.shah@...hat.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Ohad Ben-Cohen <ohad@...ery.com>, linux-kernel@...r.kernel.org,
	virtualization@...ts.linux-foundation.org, sjurbren@...il.com,
	Sjur Brændeland <sjur.brandeland@...ricsson.com>
Subject: [PATCH v8 3/3] virtio_console: Remove buffers from out_vq at port removal

From: Sjur Brændeland <sjur.brandeland@...ricsson.com>

Remove buffers from the out-queue when a rproc_serial device
is removed. Rproc_serial communicates with remote processors
that may crash and leave buffers in the out-queue. But the
virtio_console device is not supposed to leave buffers in the
out-queue when a port is removed, so in this case throw a
warning.

Signed-off-by: Sjur Brændeland <sjur.brandeland@...ricsson.com>
---
 drivers/char/virtio_console.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 9ebadcb..3fa036a 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1521,6 +1521,16 @@ static void remove_port_data(struct port *port)
 	/* Remove buffers we queued up for the Host to send us data in. */
 	while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
 		free_buf(buf, true);
+
+	/*
+	 * Check the out-queue for buffers. For VIRTIO_CONSOLE it is a
+	 * bug if this happens. But for RPROC_SERIAL the remote processor
+	 * may have crashed, leaving buffers hanging in the out-queue.
+	 */
+	while ((buf = virtqueue_detach_unused_buf(port->out_vq))) {
+		WARN_ON_ONCE(!is_rproc_serial(port->portdev->vdev));
+		free_buf(buf, true);
+	}
 }
 
 /*
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ