Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Dan Carpenter <error27@gmail.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Joerg Roedel <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Nicolin Chen <nicolinc@nvidia.com>,
	iommu@lists.linux.dev, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iommufd: vfio: info leak in iommufd_vfio_unmap_dma()
Date: Tue, 15 Nov 2022 09:22:35 -0400	[thread overview]
Message-ID: <Y3OSm9dmaQJkjL6D@ziepe.ca> (raw)
In-Reply-To: <Y3OKdW/WXVr1VYbc@kili>

On Tue, Nov 15, 2022 at 03:47:49PM +0300, Dan Carpenter wrote:
> If iopt_unmap_iova() fails then "unmapped" is uninitialized.  Copying it
> to the user can leak stack information.
> 
> Fixes: 32c328dc9b73 ("iommufd: vfio container FD ioctl compatibility")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/iommu/iommufd/vfio_compat.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iommu/iommufd/vfio_compat.c b/drivers/iommu/iommufd/vfio_compat.c
> index 976aa12b247d..30a13552d632 100644
> --- a/drivers/iommu/iommufd/vfio_compat.c
> +++ b/drivers/iommu/iommufd/vfio_compat.c
> @@ -189,6 +189,9 @@ static int iommufd_vfio_unmap_dma(struct iommufd_ctx *ictx, unsigned int cmd,
>  		rc = iopt_unmap_iova(&ioas->iopt, unmap.iova, unmap.size,
>  				     &unmapped);
>  	}
> +	if (rc)
> +		goto err_put;
> +

It should be inited to 0, I fixed it, thanks

Jason

      reply	other threads:[~2022-11-15 13:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 12:47 [PATCH] iommufd: vfio: info leak in iommufd_vfio_unmap_dma() Dan Carpenter
2022-11-15 13:22 ` Jason Gunthorpe [this message]

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=Y3OSm9dmaQJkjL6D@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=error27@gmail.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kevin.tian@intel.com \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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