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 <[email protected]>
---
 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

Reply via email to