public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux-foundation.org, shawn.lin@rock-chips.com,
	marc.zyngier@arm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu: Avoid NULL group dereference
Date: Fri, 18 Aug 2017 11:42:09 +0200	[thread overview]
Message-ID: <20170818094209.GA16257@8bytes.org> (raw)
In-Reply-To: <eef03509-2b1f-0e49-4e47-84e968a07746@arm.com>

On Thu, Aug 17, 2017 at 05:56:23PM +0100, Robin Murphy wrote:
> On 17/08/17 16:41, Joerg Roedel wrote:
> > Okay, so just to check I got it right: Drivers do the above to check
> > whether a device is managed by an IOMMU, and that crashes now because
> > the 'group == NULL' check was removed?
> 
> Indeed - the typical context is network descriptors that don't have
> space to store the CPU virtual address of the buffer, so when a packet
> arrives the driver has to work backwards from the DMA address, in this
> sort of pattern:
> 
> 	addr = desc[idx]->addr;
> 	domain = iommu_get_domain_for_dev(dev);
> 	if (domain)
> 		addr = iommu_iova_to_phys(domain, addr)
> 	buf = phys_to_virt(addr)
> 
> (the GIC thing is similar but in reverse, with a physical address which
> may or may not need replacing with an IOVA). Unless we were to change
> the interface to be iommu_get_domain_for_group(), I think it makes sense
> for it to remain valid to call for any device.

Okay, we should find a better solution for this at some point, but I
applied the patch for now.


	Joerg

  reply	other threads:[~2017-08-18  9:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 10:40 [PATCH] iommu: Avoid NULL group dereference Robin Murphy
2017-08-17 10:51 ` Marc Zyngier
2017-08-17 15:41 ` Joerg Roedel
2017-08-17 16:56   ` Robin Murphy
2017-08-18  9:42     ` Joerg Roedel [this message]
2017-08-18  0:49 ` Shawn Lin

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=20170818094209.GA16257@8bytes.org \
    --to=joro@8bytes.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=shawn.lin@rock-chips.com \
    /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