Re: Potential race condition in drivers/ata/sata_mv.ko

From: Tejun Heo
Date: Thu Aug 11 2016 - 12:27:06 EST


On Thu, Aug 11, 2016 at 05:18:31PM +0300, Pavel Andrianov wrote:
> Hi!
>
> I have found such example:
>
> ... ->
>
> ata_exec_internal_sg ->
>
> ata_qc_issue ->
>
> mv_qc_issue ->
>
> mv_clear_and_enable_port_irqs ->
>
> mv_enable_port_irqs ->
>
> mv_set_main_irq_mask
>
>
> ata_exec_internal_sg acquires spin_lock(ap->lock) and call of the last
> function mv_set_main_irq_mask is with this lock. mv_interrupt acquires
> spin_lock(host->lock) before call of the same function. I am not sure is it
> correct to add one more spin_lock or move a call of request_irq in
> ata_host_activate, thus I can not easily fix the issue.

ap->lock and host->lock point to the the same lock. The only reason
ap->lock is a pointer is for SAS.

Thanks.

--
tejun