OSDN Git Service

iommu/arm-smmu: Add new lock to protect assign and unassign list
authorNeeti Desai <neetid@codeaurora.org>
Mon, 14 Sep 2015 23:30:04 +0000 (16:30 -0700)
committerDavid Keitel <dkeitel@codeaurora.org>
Tue, 22 Mar 2016 18:14:19 +0000 (11:14 -0700)
commit425cbf444d4914751b48ede8de92a0545a0a7af4
tree571eb0f1933fa3f8c4e50abe3d7d00f83908a059
parent16135b65406895cc3ab28f39ccd5c2b44cd1aa94
iommu/arm-smmu: Add new lock to protect assign and unassign list

Simultaneous maps and/or unmaps will lead to a race condition,
where if the assign list has multiple entries and one call is
in the middle of an assign operation for one entry, and the other
call removes the next element from the list and queues itself for
the assign operation. When the first call returns from assign, and
the list is empty, it will return back to the caller without
completing the assign on all the ptes allocated for that mapping.
This results in a page fault when the client is actually accessing
the buffer.

Protect the assign and unassign lists with a mutex to ensure that
the operation is serialized and the control does not return back
to the client before all the ptes have been correctly assigned.

Change-Id: Idaf894671fee9fc9c8d339bfa17344b68dd0ad77
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
drivers/iommu/arm-smmu.c