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-next>] [day] [month] [year] [list]
Message-ID: <20100304211014.GA10008@localhost.localdomain>
Date:	Thu, 4 Mar 2010 16:10:14 -0500
From:	Jeff Dike <jdike@...toit.com>
To:	"Michael S. Tsirkin" <mst@...hat.com>
Cc:	Xin Xiaohui <xiaohui.xin@...el.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] vhost - Fix error path in vhost_net_set_backend

commit 7bee327f8020f81a52ecb362f1fec7a4494dc98b
Author: Jeff Dike <jdike@...alhost.localdomain>
Date:   Thu Mar 4 14:48:38 2010 -0500

    Fix vhost_net_set_backend error path
    
    An error could cause vhost_net_set_backend to exit without unlocking
    vq->mutex.
    
    Signed-off-by: Jeff Dike <jdike@...ux.intel.com>

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index ad37da2..4ada4b4 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -508,12 +508,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 	/* Verify that ring has been setup correctly. */
 	if (!vhost_vq_access_ok(vq)) {
 		r = -EFAULT;
-		goto err;
+		goto err_unlock_vq;
 	}
 	sock = get_socket(fd);
 	if (IS_ERR(sock)) {
 		r = PTR_ERR(sock);
-		goto err;
+		goto err_unlock_vq;
 	}
 
 	/* start polling new socket */
@@ -524,12 +524,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 	vhost_net_disable_vq(n, vq);
 	rcu_assign_pointer(vq->private_data, sock);
 	vhost_net_enable_vq(n, vq);
-	mutex_unlock(&vq->mutex);
 done:
 	if (oldsock) {
 		vhost_net_flush_vq(n, index);
 		fput(oldsock->file);
 	}
+
+err_unlock_vq:
+	mutex_unlock(&vq->mutex);
 err:
 	mutex_unlock(&n->dev.mutex);
 	return r;
--
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