diff options
| author | Zi Yan <zi.yan@cs.rutgers.edu> | 2018-01-08 10:50:50 -0500 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@intel.com> | 2018-02-11 22:48:56 -0500 |
| commit | 0c0eb4caf03bb6d3d92c70560e0530c8fdf62284 (patch) | |
| tree | 165300d7a57375dddcf52d8f9049a33797981949 /include/linux | |
| parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) | |
dmaengine: avoid map_cnt overflow with CONFIG_DMA_ENGINE_RAID
When CONFIG_DMA_ENGINE_RAID is enabled, unmap pool size can reach to
256. But in struct dmaengine_unmap_data, map_cnt is only u8, wrapping
to 0, if the unmap pool is maximally used. This triggers BUG() when
struct dmaengine_unmap_data is freed. Use u16 to fix the problem.
Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/dmaengine.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index f838764993eb..861be5cab1df 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -470,7 +470,11 @@ typedef void (*dma_async_tx_callback_result)(void *dma_async_param, | |||
| 470 | const struct dmaengine_result *result); | 470 | const struct dmaengine_result *result); |
| 471 | 471 | ||
| 472 | struct dmaengine_unmap_data { | 472 | struct dmaengine_unmap_data { |
| 473 | #if IS_ENABLED(CONFIG_DMA_ENGINE_RAID) | ||
| 474 | u16 map_cnt; | ||
| 475 | #else | ||
| 473 | u8 map_cnt; | 476 | u8 map_cnt; |
| 477 | #endif | ||
| 474 | u8 to_cnt; | 478 | u8 to_cnt; |
| 475 | u8 from_cnt; | 479 | u8 from_cnt; |
| 476 | u8 bidi_cnt; | 480 | u8 bidi_cnt; |
