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:   Sun, 23 Apr 2017 01:41:33 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc:     "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        ldv-project@...uxtesting.org
Subject: Re: [PATCH] scsi: mvumi: add check for dma mapping errors

On Sat, Apr 22, 2017 at 02:17:50AM +0300, Alexey Khoroshilov wrote:
>  	} else {
> -		scmd->SCp.dma_handle = scsi_bufflen(scmd) ?
> -			pci_map_single(mhba->pdev, scsi_sglist(scmd),
> -				scsi_bufflen(scmd),
> -				(int) scmd->sc_data_direction)
> -			: 0;
> +		if (!scsi_bufflen(scmd))
> +			return -1;
> +		scmd->SCp.dma_handle = pci_map_single(mhba->pdev,
> +						scsi_sglist(scmd),
> +						scsi_bufflen(scmd),
> +						(int) scmd->sc_data_direction);
> +		if (pci_dma_mapping_error(mhba->pdev, scmd->SCp.dma_handle))
> +			return -1;

This looks completely broken.  Why would you DMA map the in-memory
struct scatterlist?  It has no meaning for the hardware.

In fact this whole branch (and the equivalent in the unmap path)
are dead - SCSI commands that transfer data always have a SG entry.

So the right fix is to remove the !scsi_sg_count(scmd) map/unmap
path.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ