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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 31 Jul 2010 22:35:28 +0200 (CEST)
From:	Julia Lawall <julia@...u.dk>
To:	Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] drivers/acpi: call rcu_read_unlock in default case

From: Julia Lawall <julia@...u.dk>

Adjust the default case so that it benefits from the call to rcu_read_unlock.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@rcu@
position p1;
@@

rcu_read_lock@p1();
...
rcu_read_unlock();

@@
position rcu.p1;
@@

*rcu_read_lock@p1();
... when != rcu_read_unlock();
// </smpl>

Signed-off-by: Julia Lawall <julia@...u.dk>

---
 drivers/acpi/atomicio.c             |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index 8f8bd73..f426010 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -267,6 +267,7 @@ EXPORT_SYMBOL_GPL(acpi_post_unmap_gar);
 static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
 {
 	void __iomem *addr;
+	int res = 0;
 
 	rcu_read_lock();
 	addr = __acpi_ioremap_fast(paddr, width);
@@ -284,16 +285,17 @@ static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
 		*val = readq(addr);
 		break;
 	default:
-		return -EINVAL;
+		res = -EINVAL;
 	}
 	rcu_read_unlock();
 
-	return 0;
+	return res;
 }
 
 static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
 {
 	void __iomem *addr;
+	int res = 0;
 
 	rcu_read_lock();
 	addr = __acpi_ioremap_fast(paddr, width);
@@ -311,11 +313,11 @@ static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
 		writeq(val, addr);
 		break;
 	default:
-		return -EINVAL;
+		res = -EINVAL;
 	}
 	rcu_read_unlock();
 
-	return 0;
+	return res;
 }
 
 /* GAR accessing in atomic (including NMI) or process context */
--
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