diff options
author | Dave Jiang <dave.jiang@intel.com> | 2020-01-31 10:58:39 -0700 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-02-03 09:47:54 +0530 |
commit | 5429b51f606cb82f315f68678b959112766f235e (patch) | |
tree | 064b55c8456e36717648ed47e61c50863f78fa0e /drivers/dma | |
parent | a9113a90f5f0ff476a4ac2bf15861fa4358a3643 (diff) | |
download | linux-5429b51f606cb82f315f68678b959112766f235e.tar.bz2 |
dmaengine: fix null ptr check for __dma_async_device_channel_register()
Add check to pointer after assignment before accessing members.
Fixes: d2fb0a043838: ("dmaengine: break out channel registration")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/158049351973.45445.3291586905226032744.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/dmaengine.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 7b1cefc3213a..3432dac695e5 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -962,6 +962,9 @@ static int __dma_async_device_channel_register(struct dma_device *device, tchan = list_first_entry_or_null(&device->channels, struct dma_chan, device_node); + if (!tchan) + return -ENODEV; + if (tchan->dev) { idr_ref = tchan->dev->idr_ref; } else { |