From: Jon Mason <jon.mason@intel.com>
To: viresh kumar <viresh.kumar@linaro.org>
Cc: Dan Williams <djbw@fb.com>,
linux-kernel@vger.kernel.org, Dave Jiang <dave.jiang@intel.com>,
Vinod Koul <vinod.koul@intel.com>
Subject: Re: [PATCH] dmatest: Fix NULL pointer dereference on ioat
Date: Sun, 11 Nov 2012 15:09:43 -0700 [thread overview]
Message-ID: <20121111220943.GB20133@jonmason-lab> (raw)
In-Reply-To: <CAOh2x=mE8d1YtRy_Efqbtc+24SCgEYuKwVpFHrFZBTpt2CB08w@mail.gmail.com>
On Sat, Nov 10, 2012 at 09:00:15AM +0530, viresh kumar wrote:
> On Sat, Nov 10, 2012 at 2:27 AM, Jon Mason <jon.mason@intel.com> wrote:
> > device_control is an optional and not implemented in all DMA drivers.
> > Any calls to these will result in a NULL pointer dereference. dmatest
> > makes two of these calls when completing the kernel thread and removing
> > the module. These are corrected by calling the dmaengine_device_control
> > wrapper and checking for a non-existant device_control function pointer
> > there.
> >
> > Signed-off-by: Jon Mason <jon.mason@intel.com>
> > CC: Vinod Koul <vinod.koul@intel.com>
> > CC: Dan Williams <djbw@fb.com>
> > ---
> > drivers/dma/dmatest.c | 4 ++--
> > include/linux/dmaengine.h | 5 ++++-
> > 2 files changed, 6 insertions(+), 3 deletions(-)
> >
>
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index d3201e4..e0004fb 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -608,7 +608,10 @@ static inline int dmaengine_device_control(struct dma_chan *chan,
> > enum dma_ctrl_cmd cmd,
> > unsigned long arg)
> > {
> > - return chan->device->device_control(chan, cmd, arg);
> > + if (chan->device->device_control)
> > + return chan->device->device_control(chan, cmd, arg);
> > + else
> > + return -EINVAL;
>
> -ENOTSUPP or -ENOSYS ??
ENOSYS makes more sense to me. I'll send out another version shortly.
Dan, do you want me to send the patch to Greg KH for inclusion in the
stable branches back to v3.2?
Thanks,
Jon
>
> @Dan: I believe i don't have to send another version now. Correct??
>
> --
> viresh
prev parent reply other threads:[~2012-11-11 22:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-09 20:57 [PATCH] dmatest: Fix NULL pointer dereference on ioat Jon Mason
2012-11-10 3:30 ` viresh kumar
2012-11-11 22:09 ` Jon Mason [this message]
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=20121111220943.GB20133@jonmason-lab \
--to=jon.mason@intel.com \
--cc=dave.jiang@intel.com \
--cc=djbw@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vinod.koul@intel.com \
--cc=viresh.kumar@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.