Skip to content

Commit

Permalink
dmaengine: avoid map_cnt overflow with CONFIG_DMA_ENGINE_RAID
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zi Yan authored and Vinod Koul committed Feb 12, 2018
1 parent 7928b2c commit 0c0eb4c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/linux/dmaengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,11 @@ typedef void (*dma_async_tx_callback_result)(void *dma_async_param,
const struct dmaengine_result *result);

struct dmaengine_unmap_data {
#if IS_ENABLED(CONFIG_DMA_ENGINE_RAID)
u16 map_cnt;
#else
u8 map_cnt;
#endif
u8 to_cnt;
u8 from_cnt;
u8 bidi_cnt;
Expand Down

0 comments on commit 0c0eb4c

Please sign in to comment.