* [PATCH] dmaengine: ti-dma-crossbar: Fix possible race condition with dma_inuse
@ 2017-09-21 11:35 Peter Ujfalusi
2017-09-21 17:30 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Peter Ujfalusi @ 2017-09-21 11:35 UTC (permalink / raw)
To: linux-arm-kernel
?When looking for unused xbar_out lane we should also protect the set_bit()
call with the same mutex to protect against concurrent threads picking the
same ID.
Fixes: ec9bfa1e1a796 ("dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: stable at vger.kernel.org
---
drivers/dma/ti-dma-crossbar.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index 10ef9d5d5a66..7df910e7c348 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -262,13 +262,14 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
mutex_lock(&xbar->mutex);
map->xbar_out = find_first_zero_bit(xbar->dma_inuse,
xbar->dma_requests);
- mutex_unlock(&xbar->mutex);
if (map->xbar_out == xbar->dma_requests) {
+ mutex_unlock(&xbar->mutex);
dev_err(&pdev->dev, "Run out of free DMA requests\n");
kfree(map);
return ERR_PTR(-ENOMEM);
}
set_bit(map->xbar_out, xbar->dma_inuse);
+ mutex_unlock(&xbar->mutex);
map->xbar_in = (u16)dma_spec->args[0];
--
2.14.1
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] dmaengine: ti-dma-crossbar: Fix possible race condition with dma_inuse
2017-09-21 11:35 [PATCH] dmaengine: ti-dma-crossbar: Fix possible race condition with dma_inuse Peter Ujfalusi
@ 2017-09-21 17:30 ` Vinod Koul
2017-09-22 7:03 ` Peter Ujfalusi
0 siblings, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2017-09-21 17:30 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Sep 21, 2017 at 02:35:32PM +0300, Peter Ujfalusi wrote:
> When looking for unused xbar_out lane we should also protect the set_bit()
> call with the same mutex to protect against concurrent threads picking the
> same ID.
Applied, thanks
Just a note, somehow the patches from you only are getting mangled for me.
Curiously, the ones in patchworks are fine and I used to apply that, not sure
what mail servers at our work places are doing!!
>
> Fixes: ec9bfa1e1a796 ("dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr")
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Cc: stable at vger.kernel.org
> ---
> drivers/dma/ti-dma-crossbar.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
> index 10ef9d5d5a66..7df910e7c348 100644
> --- a/drivers/dma/ti-dma-crossbar.c
> +++ b/drivers/dma/ti-dma-crossbar.c
> @@ -262,13 +262,14 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
> mutex_lock(&xbar->mutex);
> map->xbar_out = find_first_zero_bit(xbar->dma_inuse,
> xbar->dma_requests);
> - mutex_unlock(&xbar->mutex);
> if (map->xbar_out == xbar->dma_requests) {
> + mutex_unlock(&xbar->mutex);
> dev_err(&pdev->dev, "Run out of free DMA requests\n");
> kfree(map);
> return ERR_PTR(-ENOMEM);
> }
> set_bit(map->xbar_out, xbar->dma_inuse);
> + mutex_unlock(&xbar->mutex);
>
> map->xbar_in = (u16)dma_spec->args[0];
>
> --
> 2.14.1
>
>
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
>
>
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH] dmaengine: ti-dma-crossbar: Fix possible race condition with dma_inuse
2017-09-21 17:30 ` Vinod Koul
@ 2017-09-22 7:03 ` Peter Ujfalusi
2017-09-22 8:43 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Peter Ujfalusi @ 2017-09-22 7:03 UTC (permalink / raw)
To: linux-arm-kernel
?Vinod,
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
On 2017-09-21 20:30, Vinod Koul wrote:
> On Thu, Sep 21, 2017 at 02:35:32PM +0300, Peter Ujfalusi wrote:
>> When looking for unused xbar_out lane we should also protect the set_bit()
>> call with the same mutex to protect against concurrent threads picking the
>> same ID.
>
> Applied, thanks
>
> Just a note, somehow the patches from you only are getting mangled for me.
> Curiously, the ones in patchworks are fine and I used to apply that, not sure
> what mail servers at our work places are doing!!
I'm afraid it is our mail servers where the mangling is happening :(
We are trying to resolve this since early August when it first started
to happen (and only for the guys in Finland).
We are as frustrated as one can be, believe me.
PS: And the mangler will add a footer on top of this mail
- P?ter
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] dmaengine: ti-dma-crossbar: Fix possible race condition with dma_inuse
2017-09-22 7:03 ` Peter Ujfalusi
@ 2017-09-22 8:43 ` Vinod Koul
0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2017-09-22 8:43 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Sep 22, 2017 at 10:03:59AM +0300, Peter Ujfalusi wrote:
> Vinod,
>
>
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
>
> On 2017-09-21 20:30, Vinod Koul wrote:
> > On Thu, Sep 21, 2017 at 02:35:32PM +0300, Peter Ujfalusi wrote:
> >> When looking for unused xbar_out lane we should also protect the set_bit()
> >> call with the same mutex to protect against concurrent threads picking the
> >> same ID.
> >
> > Applied, thanks
> >
> > Just a note, somehow the patches from you only are getting mangled for me.
> > Curiously, the ones in patchworks are fine and I used to apply that, not sure
> > what mail servers at our work places are doing!!
>
> I'm afraid it is our mail servers where the mangling is happening :(
> We are trying to resolve this since early August when it first started
> to happen (and only for the guys in Finland).
> We are as frustrated as one can be, believe me.
>
> PS: And the mangler will add a footer on top of this mail
ah okay, consider sending using some other server then, or just put up a
linux box in the corner like we do (@linux.intel.com)
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-22 8:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-21 11:35 [PATCH] dmaengine: ti-dma-crossbar: Fix possible race condition with dma_inuse Peter Ujfalusi
2017-09-21 17:30 ` Vinod Koul
2017-09-22 7:03 ` Peter Ujfalusi
2017-09-22 8:43 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).