summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu_v2.c
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@amd.com>2015-04-16 16:08:44 +0200
committerJoerg Roedel <jroedel@suse.de>2015-05-04 13:20:22 +0200
commit1bf1b431d98d7e5b5419876d4c219469e60693e1 (patch)
treeb1a9f44753f394ec88f65c32687f46e6f699ec46 /drivers/iommu/amd_iommu_v2.c
parentLinux 4.1-rc2 (diff)
downloadlinux-1bf1b431d98d7e5b5419876d4c219469e60693e1.tar.xz
linux-1bf1b431d98d7e5b5419876d4c219469e60693e1.zip
iommu/amd: Fix bug in put_pasid_state_wait
This patch fixes a bug in put_pasid_state_wait that appeared in kernel 4.0 The bug is that pasid_state->count wasn't decremented before entering the wait_event. Thus, the condition in wait_event will never be true. The fix is to decrement (atomically) the pasid_state->count before the wait_event. Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Cc: stable@vger.kernel.org #v4.0 Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd_iommu_v2.c')
-rw-r--r--drivers/iommu/amd_iommu_v2.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index a1cbba9056fd..3465faf1809e 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -266,6 +266,7 @@ static void put_pasid_state(struct pasid_state *pasid_state)
static void put_pasid_state_wait(struct pasid_state *pasid_state)
{
+ atomic_dec(&pasid_state->count);
wait_event(pasid_state->wq, !atomic_read(&pasid_state->count));
free_pasid_state(pasid_state);
}