* [PATCH] iommu/amd: Fix bug in put_pasid_state_wait
@ 2015-04-16 14:08 ` Oded Gabbay
0 siblings, 0 replies; 5+ messages in thread
From: Oded Gabbay @ 2015-04-16 14:08 UTC (permalink / raw)
To: joro; +Cc: iommu, linux-kernel, stable
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
---
drivers/iommu/amd_iommu_v2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 6d5a5c4..173e70d 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);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] iommu/amd: Fix bug in put_pasid_state_wait
@ 2015-04-16 14:08 ` Oded Gabbay
0 siblings, 0 replies; 5+ messages in thread
From: Oded Gabbay @ 2015-04-16 14:08 UTC (permalink / raw)
To: joro; +Cc: iommu, linux-kernel, stable
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
---
drivers/iommu/amd_iommu_v2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 6d5a5c4..173e70d 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);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/amd: Fix bug in put_pasid_state_wait
2015-04-16 14:08 ` Oded Gabbay
@ 2015-04-26 9:14 ` Oded Gabbay
-1 siblings, 0 replies; 5+ messages in thread
From: Oded Gabbay @ 2015-04-26 9:14 UTC (permalink / raw)
To: joro; +Cc: iommu, linux-kernel, stable
Hi Joerg,
Could you please take a look at this patch ?
I want it to be included in stable asap so Fedora 22 will pick it up.
Thanks,
Oded
On 04/16/2015 05:08 PM, Oded Gabbay wrote:
> 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
> ---
> drivers/iommu/amd_iommu_v2.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
> index 6d5a5c4..173e70d 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);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/amd: Fix bug in put_pasid_state_wait
@ 2015-04-26 9:14 ` Oded Gabbay
0 siblings, 0 replies; 5+ messages in thread
From: Oded Gabbay @ 2015-04-26 9:14 UTC (permalink / raw)
To: joro; +Cc: iommu, linux-kernel, stable
Hi Joerg,
Could you please take a look at this patch ?
I want it to be included in stable asap so Fedora 22 will pick it up.
Thanks,
Oded
On 04/16/2015 05:08 PM, Oded Gabbay wrote:
> 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
> ---
> drivers/iommu/amd_iommu_v2.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
> index 6d5a5c4..173e70d 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);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/amd: Fix bug in put_pasid_state_wait
2015-04-16 14:08 ` Oded Gabbay
(?)
(?)
@ 2015-05-04 11:21 ` Joerg Roedel
-1 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2015-05-04 11:21 UTC (permalink / raw)
To: Oded Gabbay; +Cc: iommu, linux-kernel, stable
On Thu, Apr 16, 2015 at 05:08:44PM +0300, Oded Gabbay wrote:
> 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.
Gah! This issue was already pointed out in the original review of the
patch, looks like I applied the wrong version. Thanks for the fix, I
applied it to iommu/fixes.
Joerg
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-05-04 11:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 14:08 [PATCH] iommu/amd: Fix bug in put_pasid_state_wait Oded Gabbay
2015-04-16 14:08 ` Oded Gabbay
2015-04-26 9:14 ` Oded Gabbay
2015-04-26 9:14 ` Oded Gabbay
2015-05-04 11:21 ` Joerg Roedel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.