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: <1818494207.887633.1466694466763.JavaMail.zimbra@redhat.com>
Date:	Thu, 23 Jun 2016 11:07:46 -0400 (EDT)
From:	Laurence Oberman <loberman@...hat.com>
To:	Johannes Thumshirn <jthumshirn@...e.de>
Cc:	"Martin K . Petersen" <martin.petersen@...cle.com>,
	James Bottomley <jejb@...ux.vnet.ibm.com>,
	Linux SCSI Mailinglist <linux-scsi@...r.kernel.org>,
	Linux Kernel Mailinglist <linux-kernel@...r.kernel.org>,
	Narsimhulu Musini <nmusini@...co.com>,
	Sesidhar Baddela <sebaddel@...co.com>
Subject: Re: [PATCH] snic: Fix use-after-free in case of a dma mapping error



----- Original Message -----
> From: "Johannes Thumshirn" <jthumshirn@...e.de>
> To: "Martin K . Petersen" <martin.petersen@...cle.com>, "James Bottomley" <jejb@...ux.vnet.ibm.com>
> Cc: "Linux SCSI Mailinglist" <linux-scsi@...r.kernel.org>, "Linux Kernel Mailinglist" <linux-kernel@...r.kernel.org>,
> "Narsimhulu Musini" <nmusini@...co.com>, "Sesidhar Baddela" <sebaddel@...co.com>, "Johannes Thumshirn"
> <jthumshirn@...e.de>
> Sent: Thursday, June 23, 2016 8:37:20 AM
> Subject: [PATCH] snic: Fix use-after-free in case of a dma mapping error
> 
> If there is a dma mapping error snic kfree()s buf right before printing it.
> Change the order to not accidently trip on memory that's not owned by us
> anymore.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@...e.de>
> ---
>  drivers/scsi/snic/snic_disc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c
> index b0fefd6..b106596 100644
> --- a/drivers/scsi/snic/snic_disc.c
> +++ b/drivers/scsi/snic/snic_disc.c
> @@ -113,11 +113,11 @@ snic_queue_report_tgt_req(struct snic *snic)
>  
>  	pa = pci_map_single(snic->pdev, buf, buf_len, PCI_DMA_FROMDEVICE);
>  	if (pci_dma_mapping_error(snic->pdev, pa)) {
> -		kfree(buf);
> -		snic_req_free(snic, rqi);
>  		SNIC_HOST_ERR(snic->shost,
>  			      "Rpt-tgt rspbuf %p: PCI DMA Mapping Failed\n",
>  			      buf);
> +		kfree(buf);
> +		snic_req_free(snic, rqi);
>  		ret = -EINVAL;
>  
>  		goto error;
> --
> 2.8.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Looks fine to me
Reviewed-by Laurence Oberman <loberman@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ