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:	Mon, 29 Aug 2011 14:28:54 -0500
From:	Jonathan Lallinger <jonathan@....us>
To:	venkat.x.venkatsubra@...cle.com
Cc:	swise@...ngridcomputing.com, netdev@...r.kernel.org,
	rds-devel@....oracle.com
Subject: [PATCH] RDSRDMA: Fix to PAGE_MASK interpretation

The RDS_RDMA rds_iw_map_scatterlist function assumed PAGE_MASK was the bitwise
compliment of what it actually is. This problem was introduced in commit
404bb72a56e553febe1055f98347a7a3e3145759 when the variable dma_mask was replaced
by PAGE_MASK, however dma_mask represented the compliment of what PAGE_MASK
represents.

This fix corrects the logic by flipping the compliments on all uses of PAGE_MASK
int rds_iw_map_scatterlist.

Signed-off by: Jonathan Lallinger <jonathan@....us>
---

 net/rds/iw_rdma.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c
index 6deaa77..92f4efc 100644
--- a/net/rds/iw_rdma.c
+++ b/net/rds/iw_rdma.c
@@ -287,15 +287,15 @@ static u64 *rds_iw_map_scatterlist(struct rds_iw_device *rds_iwdev,
 		sg->bytes += dma_len;
 
 		end_addr = dma_addr + dma_len;
-		if (dma_addr & PAGE_MASK) {
+		if (dma_addr & ~PAGE_MASK) {
 			if (i > 0)
 				goto out_unmap;
-			dma_addr &= ~PAGE_MASK;
+			dma_addr &= PAGE_MASK;
 		}
-		if (end_addr & PAGE_MASK) {
+		if (end_addr & ~PAGE_MASK) {
 			if (i < sg->dma_len - 1)
 				goto out_unmap;
-			end_addr = (end_addr + PAGE_MASK) & ~PAGE_MASK;
+			end_addr = (end_addr + ~PAGE_MASK) & PAGE_MASK;
 		}
 
 		sg->dma_npages += (end_addr - dma_addr) >> PAGE_SHIFT;
@@ -317,7 +317,7 @@ static u64 *rds_iw_map_scatterlist(struct rds_iw_device *rds_iwdev,
 		u64 end_addr;
 
 		end_addr = dma_addr + dma_len;
-		dma_addr &= ~PAGE_MASK;
+		dma_addr &= PAGE_MASK;
 		for (; dma_addr < end_addr; dma_addr += PAGE_SIZE)
 			dma_pages[j++] = dma_addr;
 		BUG_ON(j > sg->dma_npages);

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ