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] [day] [month] [year] [list]
Message-ID: <8f607a2b-3d99-4f3e-b370-b7e4793ad27c@mev.co.uk>
Date: Thu, 3 Apr 2025 18:28:37 +0100
From: Ian Abbott <abbotti@....co.uk>
To: Wentao Liang <vulab@...as.ac.cn>, hsweeten@...ionengravers.com
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: comedi: Add DMA preparation before
 mite_dma_arm().

On 2025-04-03 17:35, Wentao Liang wrote:
> The ni_tio_input_inttrig() calls mite_dma_arm() without calling
> mite_prep_dma() first. A proper implementation can be found in
> ni_cdo_inttrig() in ni_mio_common.c.
> 
> Add mite_prep_dma() before mite_dma_arm().
> 
> Fixes: cb7859a90af1 ("Staging: comedi: add National Instruments infrastructure")
> Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
> ---
>   drivers/comedi/drivers/ni_tiocmd.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/comedi/drivers/ni_tiocmd.c b/drivers/comedi/drivers/ni_tiocmd.c
> index ab6d9e8269f3..b943836ccf1a 100644
> --- a/drivers/comedi/drivers/ni_tiocmd.c
> +++ b/drivers/comedi/drivers/ni_tiocmd.c
> @@ -84,9 +84,10 @@ static int ni_tio_input_inttrig(struct comedi_device *dev,
>   		return -EINVAL;
>   
>   	spin_lock_irqsave(&counter->lock, flags);
> -	if (counter->mite_chan)
> +	if (counter->mite_chan) {
> +		mite_prep_dma(counter->mite_chan, 32, 32);
>   		mite_dma_arm(counter->mite_chan);
> -	else
> +	} else
>   		ret = -EIO;
>   	spin_unlock_irqrestore(&counter->lock, flags);
>   	if (ret < 0)

mite_prep_dma() will get called by ni_tio_input_cmd() at some arbitrary 
time before ni_tio_input_inttrig() is called. (ni_tio_input_cmd() sets 
up the software trigger function pointer that is called during 
processing of a subsequent INSN_INTTRIG comedi instruction from 
user-space. Also, the last two parameters of mite_prep_dma() are not 
always 32 and 32 - it depends on the hardware, as can be seen in the 
switch statement in ni_tio_input_cmd().

-- 
-=( Ian Abbott <abbotti@....co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ