lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 8 Dec 2011 16:22:52 +0800
From:	Huang Shijie <b32955@...escale.com>
To:	Lothar Waßmann <LW@...O-electronics.de>
CC:	Vinod Koul <vinod.koul@...el.com>,
	Wolfram Sang <w.sang@...gutronix.de>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/4] dma: mxs-dma: make mxs_dma_prep_slave_sg() multi
 user safe

于 2011年12月08日 16:15, Lothar Waßmann 写道:
> Using a static variable for counting the number of CCWs attached to
> a DMA channel when appending a new descriptor is not multi user safe.
>
> Signed-off-by: Lothar Waßmann<LW@...O-electronics.de>
> ---
>   drivers/dma/mxs-dma.c |    5 ++++-
>   1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index c7574e8..78336b0 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -111,6 +111,7 @@ struct mxs_dma_chan {
>   	int				chan_irq;
>   	struct mxs_dma_ccw		*ccw;
>   	dma_addr_t			ccw_phys;
> +	int				desc_count;
>   	dma_cookie_t			last_completed;
>   	enum dma_status			status;
>   	unsigned int			flags;
> @@ -386,7 +387,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
>   	struct scatterlist *sg;
>   	int i, j;
>   	u32 *pio;
> -	static int idx;
> +	int idx = append ? mxs_chan->desc_count : 0;
>
>   	if (mxs_chan->status == DMA_IN_PROGRESS&&  !append)
>   		return NULL;
> @@ -462,6 +463,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
>   			}
>   		}
>   	}
> +	mxs_chan->desc_count = idx;
>
>   	return&mxs_chan->desc;
>
> @@ -523,6 +525,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
>
>   		i++;
>   	}
> +	mxs_chan->desc_count = i;
>
>   	return&mxs_chan->desc;
>
I like this patch.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ