:10000000150255003704FFFFFFFFFFFF8907A70612
:10001000FFFFFFFFFFFF580501000C001213100047
:1000200008000C00160238009C001000564020000A
:10003000CC802300560038009C0010000B4C24009C
:1000400000080000184812003804380000000000C2
:1000500000001400550538000080300062061000D2
:100060006105100008040E006148130002000C0036
:10007000933010000080300024061000610510004D
:1000800008040E00610810007E000C00212C2200E4
:1000900002000C00933010007A0C380000000800B9
:1000A000903010007A0C38000000000000000000C2
:1000B00000000000000000009C0010002D4C2400F7
:1000C000040001000010040037043A00104004004E
:1000D0008A07380000000000990010007A6C2000A8
:1000E0009C001000484C24002408130001000C0060
:1000F00013121000750C260000100400040001000B
:100100002608130006000C00A806220026C91300CA
:1001100013131000A80638000000000000000000C3
:1001200000000000000000000000000000000000CF
:10013000000000000000000000060800101B100076
:10014000040005002608100010121000340C3800BE
:1001500000000000000000005B1521009900100065
:10016000596520009C0010005945240036081300F2
:1001700000000C00620C220001000C00131B100098
:100180000E9C22000E0C21000E6C22000E6C210031
:100190000EFC22000E5C21000E4C2100550538009B
:1001A0000400010000100400678C27000008040010
:1001B0000081010037043A002608130001000C00FA
:1001C00059052200131310005905380000000000E3
:1001D000000000000000000000000000000000001F
:1001E00000000000000000000000000031081300C3
:1001F0000B0910001348120080FF0C00AB0626000C
:100200000010040004000100A806380000000000EF
:0B02100000000000000000004E417ED6
:00000001FF
/********************************************************/
/* Micro code for 8086:1229 Rev 8 */
/********************************************************/
&id=91539eb1fda2d530d3b268eef542c5414e54bf1a'>refslogtreecommitdiff
dmaengine: pl330: fix double lock
The static bug finder EBA (http://www.iagoabal.eu/eba/) reported the
following double-lock bug:
Double lock:
1. spin_lock_irqsave(pch->lock, flags) at pl330_free_chan_resources:2236;
2. call to function `pl330_release_channel' immediately after;
3. call to function `dma_pl330_rqcb' in line 1753;
4. spin_lock_irqsave(pch->lock, flags) at dma_pl330_rqcb:1505.
I have fixed it as suggested by Marek Szyprowski.
First, I have replaced `pch->lock' with `pl330->lock' in functions
`pl330_alloc_chan_resources' and `pl330_free_chan_resources'. This avoids
the double-lock by acquiring a different lock than `dma_pl330_rqcb'.
NOTE that, as a result, `pl330_free_chan_resources' executes
`list_splice_tail_init' on `pch->work_list' under lock `pl330->lock',
whereas in the rest of the code `pch->work_list' is protected by
`pch->lock'. I don't know if this may cause race conditions. Similarly
`pch->cyclic' is written by `pl330_alloc_chan_resources' under
`pl330->lock' but read by `pl330_tx_submit' under `pch->lock'.
Second, I have removed locking from `pl330_request_channel' and
`pl330_release_channel' functions. Function `pl330_request_channel' is
only called from `pl330_alloc_chan_resources', so the lock is already
held. Function `pl330_release_channel' is called from
`pl330_free_chan_resources', which already holds the lock, and from
`pl330_del'. Function `pl330_del' is called in an error path of
`pl330_probe' and at the end of `pl330_remove', but I assume that there
cannot be concurrent accesses to the protected data at those points.
Signed-off-by: Iago Abal <mail@iagoabal.eu>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>