Re: [PATCH] dma-debug: Avoid NULL dereference when checking sync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 31 Oct 2016 16:11:41 +0100 Maarten ter Huurne <maarten@xxxxxxxxxxxxxx> wrote:

> check_sync() calls bucket_find_contain(), which in turn calls
> dma_get_max_seg_size(), which dereferences the device pointer.
> 
> ...
>
> --- 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);

Well.

a) who is calling check_sync() without having filled in ref.dev? 
   How does this occur?  Is this a bug in the caller?

b) why does check_sync() have a `dev' argument anyway?  Is there any
   situation in which that will differ from ref.dev?
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux