From: Andrew Morton <akpm@linux-foundation.org>
To: Maarten ter Huurne <maarten@treewalker.org>
Cc: Vinod Koul <vinod.koul@intel.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-debug: Avoid NULL dereference when checking sync
Date: Mon, 7 Nov 2016 16:38:58 -0800 [thread overview]
Message-ID: <20161107163858.cc3c523690ced2ed2a10e7db@linux-foundation.org> (raw)
In-Reply-To: <1477926701-14782-1-git-send-email-maarten@treewalker.org>
On Mon, 31 Oct 2016 16:11:41 +0100 Maarten ter Huurne <maarten@treewalker.org> 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?
next prev parent reply other threads:[~2016-11-08 0:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-31 15:11 Maarten ter Huurne
2016-11-08 0:38 ` Andrew Morton [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-02-28 15:20 Maarten ter Huurne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161107163858.cc3c523690ced2ed2a10e7db@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten@treewalker.org \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome