diff options
author | Jon Mason <jon.mason@intel.com> | 2012-11-11 18:03:20 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-01-08 01:05:05 -0500 |
commit | 944ea4dd38b8575e30a5699633c81945bff1864d (patch) | |
tree | 7883205efd57c7c1e95ad2cb2bed59bde165ecc8 /include/linux/dmaengine.h | |
parent | e4d43c1764bc3ee1150f24e530db2b5b23e91425 (diff) |
dmatest: Fix NULL pointer dereference on ioat
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>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'include/linux/dmaengine.h')
-rw-r--r-- | include/linux/dmaengine.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 3aa76dbed166..be6e95395b11 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, | |||
608 | enum dma_ctrl_cmd cmd, | 608 | enum dma_ctrl_cmd cmd, |
609 | unsigned long arg) | 609 | unsigned long arg) |
610 | { | 610 | { |
611 | return chan->device->device_control(chan, cmd, arg); | 611 | if (chan->device->device_control) |
612 | return chan->device->device_control(chan, cmd, arg); | ||
613 | else | ||
614 | return -ENOSYS; | ||
612 | } | 615 | } |
613 | 616 | ||
614 | static inline int dmaengine_slave_config(struct dma_chan *chan, | 617 | static inline int dmaengine_slave_config(struct dma_chan *chan, |