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]
Date:	Tue, 16 Nov 2010 10:32:59 -0600
From:	Sergio Aguirre <saaguirre@...com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	Sergio Aguirre <saaguirre@...com>,
	Huang Ying <ying.huang@...el.com>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Ingo Molnar <mingo@...e.hu>, Kyle McMartin <kyle@...artin.ca>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [RFC][PATCH] irq_work: Don't ignore possible cmpxchg failure

Although is very unlikely, it's better to make sure we're not
letting this happen.

This solves this compilation warning:

kernel/irq_work.c: In function 'irq_work_run':
kernel/irq_work.c:148: warning: value computed is not used

Signed-off-by: Sergio Aguirre <saaguirre@...com>
Cc: Huang Ying <ying.huang@...el.com>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Kyle McMartin <kyle@...artin.ca>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
---
 kernel/irq_work.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/irq_work.c b/kernel/irq_work.c
index f16763f..5da635b 100644
--- a/kernel/irq_work.c
+++ b/kernel/irq_work.c
@@ -131,7 +131,7 @@ void irq_work_run(void)
 
 	list = xchg(head, NULL);
 	while (list != NULL) {
-		struct irq_work *entry = list;
+		struct irq_work *entry = list, *xchgres;
 
 		list = irq_work_next(list);
 
@@ -145,7 +145,10 @@ void irq_work_run(void)
 		 * Clear the BUSY bit and return to the free state if
 		 * no-one else claimed it meanwhile.
 		 */
-		cmpxchg(&entry->next, next_flags(NULL, IRQ_WORK_BUSY), NULL);
+		xchgres = cmpxchg(&entry->next,
+				  next_flags(NULL, IRQ_WORK_BUSY),
+				  NULL);
+		BUG_ON(unlikely(xchgres != next_flags(NULL, IRQ_WORK_BUSY)));
 	}
 }
 EXPORT_SYMBOL_GPL(irq_work_run);
-- 
1.7.0.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