lkml.org 
[lkml]   [2012]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] dmatest: Fix NULL pointer dereference on ioat
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


\
 
 \ /
  Last update: 2012-11-11 23:41    [W:0.037 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site