Skip to content

Commit

Permalink
msm: iommu: Check if device is already attached
Browse files Browse the repository at this point in the history
An IOMMU device can only be attached to one IOMMU domain at
any given time. Check whether the device is already
attached to a domain before allowing it to be attached to
another domain. If so, return busy.

Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
  • Loading branch information
Stepan Moskovchenko authored and Daniel Walker committed Dec 1, 2010
1 parent 2607b0a commit 00d4b2b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/arm/mach-msm/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ static int msm_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
goto fail;
}

if (!list_empty(&ctx_drvdata->attached_elm)) {
ret = -EBUSY;
goto fail;
}

list_for_each_entry(tmp_drvdata, &priv->list_attached, attached_elm)
if (tmp_drvdata == ctx_drvdata) {
ret = -EBUSY;
Expand Down

0 comments on commit 00d4b2b

Please sign in to comment.