Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1457079 > unrolled thread
| Started by | Pavel Andrianov <andrianov@ispras.ru> |
|---|---|
| First post | 2016-08-05 14:50 +0200 |
| Last post | 2016-08-10 06:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
Potential race condition in drivers/ata/sata_mv.ko Pavel Andrianov <andrianov@ispras.ru> - 2016-08-05 14:50 +0200
Re: Potential race condition in drivers/ata/sata_mv.ko Tejun Heo <tj@kernel.org> - 2016-08-10 06:00 +0200
| From | Pavel Andrianov <andrianov@ispras.ru> |
|---|---|
| Date | 2016-08-05 14:50 +0200 |
| Subject | Potential race condition in drivers/ata/sata_mv.ko |
| Message-ID | <s2MJA-7zE-13@gated-at.bofh.it> |
Hi! In drivers/ata/sata_mv.ko function mv_set_main_irq_mask is called several times. Twice with a spinlock, twice from init function and once without any protection. The call without protection rises to several handlers from ata_port_operations. The structure with the ata_port_operations is included into a structure 'host' in mv_platform_probe and in mv_pci_init_one. At the end of these functions ata_host operations are activated together with interrupt handler. The conclusion is: interrupt handler may be executed in parallel with handlers from ata_port_operations, or, more formally, it may interrupt its execution. In mv_set_main_irq_mask and in interrupt handler mv_interrupt the interrupt mask is modified, but, as I said, handlers from ata_port_operations do not acquire any lock. Thus, the interrupt mask may be set incorrectly if the are two conflicting modifications. -- Pavel Andrianov Linux Verification Center, ISPRAS web: http://linuxtesting.org e-mail: andrianov@ispras.ru
[toc] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2016-08-10 06:00 +0200 |
| Message-ID | <s4sQp-8kn-1@gated-at.bofh.it> |
| In reply to | #1457079 |
Hello, On Fri, Aug 05, 2016 at 03:43:30PM +0300, Pavel Andrianov wrote: > In drivers/ata/sata_mv.ko function mv_set_main_irq_mask is called several > times. Twice with a spinlock, twice from init function and once without any > protection. The call without protection rises to several handlers from > ata_port_operations. The structure with the ata_port_operations is included > into a structure 'host' in mv_platform_probe and in mv_pci_init_one. At the > end of these functions ata_host operations are activated together with > interrupt handler. The conclusion is: interrupt handler may be executed in > parallel with handlers from ata_port_operations, or, more formally, it may > interrupt its execution. > > In mv_set_main_irq_mask and in interrupt handler mv_interrupt the interrupt > mask is modified, but, as I said, handlers from ata_port_operations do not > acquire any lock. Thus, the interrupt mask may be set incorrectly if the are > two conflicting modifications. It depends on which operations. Most are only called from EH context and racing there isn't likely to cause any actual issues. Care to submit a patch to fix the issue? Thanks. -- tejun
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web