[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1456672859-15521-1-git-send-email-maarten@treewalker.org>
Date: Sun, 28 Feb 2016 16:20:59 +0100
From: Maarten ter Huurne <maarten@...ewalker.org>
To: Dan Williams <dan.j.williams@...el.com>,
Jiri Kosina <jkosina@...e.cz>
Cc: 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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 4a1515f..4960402 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -1194,6 +1194,13 @@ 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.2
Powered by blists - more mailing lists