dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Zi Yan <zi.yan@sent.com>, Dan Williams <dan.j.williams@intel.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zi Yan <zi.yan@cs.rutgers.edu>
Subject: dmaengine: avoid map_cnt overflow with CONFIG_DMA_ENGINE_RAID
Date: Fri, 12 Jan 2018 22:26:48 +0530	[thread overview]
Message-ID: <20180112165648.GP18649@localhost> (raw)

On Mon, Jan 08, 2018 at 10:50:50AM -0500, Zi Yan wrote:
> From: Zi Yan <zi.yan@cs.rutgers.edu>
> 
> 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>
> ---
>  include/linux/dmaengine.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> 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,
>  				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;

Would that cause adverse performance, the data structure is not aligned
anymore. Dan was that a consideration while adding this?

             reply	other threads:[~2018-01-12 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 16:56 Vinod Koul [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-02-05  5:39 dmaengine: avoid map_cnt overflow with CONFIG_DMA_ENGINE_RAID Vinod Koul
2018-01-16 20:00 Zi Yan
2018-01-08 15:50 Zi Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180112165648.GP18649@localhost \
    --to=vinod.koul@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zi.yan@cs.rutgers.edu \
    --cc=zi.yan@sent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).