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: <1323674155-17570-11-git-send-email-laijs@cn.fujitsu.com>
Date:	Mon, 12 Dec 2011 15:15:54 +0800
From:	Lai Jiangshan <laijs@...fujitsu.com>
To:	Pekka Enberg <penberg@...nel.org>, Ingo Molnar <mingo@...e.hu>
Cc:	linux-kernel@...r.kernel.org, Lai Jiangshan <laijs@...fujitsu.com>
Subject: [PATCH 10/11] kvm tools: protect shared global id in compat_mtx C.S.

The global id is shared, protect it when access it.

Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
---
 tools/kvm/guest_compat.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/guest_compat.c b/tools/kvm/guest_compat.c
index de97df5..8dd451b 100644
--- a/tools/kvm/guest_compat.c
+++ b/tools/kvm/guest_compat.c
@@ -20,6 +20,7 @@ static LIST_HEAD(messages);
 int compat__add_message(const char *title, const char *desc)
 {
 	struct compat_message *msg;
+	int msg_id;
 
 	msg = malloc(sizeof(*msg));
 	if (msg == NULL)
@@ -33,12 +34,12 @@ int compat__add_message(const char *title, const char *desc)
 
 	mutex_lock(&compat_mtx);
 
-	msg->id = id;
+	msg->id = msg_id = id++;
 	list_add_tail(&msg->list, &messages);
 
 	mutex_unlock(&compat_mtx);
 
-	return id++;
+	return msg_id;
 
 cleanup:
 	if (msg) {
-- 
1.7.4.4

--
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