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, 31 Oct 2016 16:11:41 +0100
From:   Maarten ter Huurne <maarten@...ewalker.org>
To:     Vinod Koul <vinod.koul@...el.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
        Maarten ter Huurne <maarten@...ewalker.org>
Subject: [PATCH] dma-debug: Avoid NULL dereference when checking sync

check_sync() calls bucket_find_contain(), which in turn calls
dma_get_max_seg_size(), which dereferences the device pointer.

Signed-off-by: Maarten ter Huurne <maarten@...ewalker.org>
---
 lib/dma-debug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 8971370..84c6e88 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -1223,6 +1223,11 @@ static void check_sync(struct device *dev,
 	struct hash_bucket *bucket;
 	unsigned long flags;
 
+	if (!ref->dev) {
+		err_printk(dev, NULL, "DMA-API: device driver passes NULL for device to DMA sync function; cannot check usage\n");
+		return;
+	}
+
 	bucket = get_hash_bucket(ref, &flags);
 
 	entry = bucket_find_contain(&bucket, ref, &flags);
-- 
2.6.6

Powered by blists - more mailing lists