linux-stable/drivers/scsi/megaraid
Sumit Saxena 8e781506a7 scsi: megaraid_sas: Fix concurrent access to ISR between IRQ polling and real interrupt
[ Upstream commit e7dcc514a4 ]

IRQ polling thread calls ISR after enable_irq() to handle any missed I/O
completion. The atomic flag "in_used" was added to have the synchronization
between the IRQ polling thread and the interrupt context. There is a bug
around it leading to a race condition.

Below is the sequence:

 - IRQ polling thread accesses ISR, fetches the reply descriptor.

 - Real interrupt arrives and pre-empts polling thread (enable_irq() is
   already called).

 - Interrupt context picks the same reply descriptor as fetched by polling
   thread, processes it, and exits.

 - Polling thread resumes and processes the descriptor which is already
   processed by interrupt thread leads to kernel crash.

Setting the "in_used" flag before fetching the reply descriptor ensures
synchronized access to ISR.

Link: https://www.spinics.net/lists/linux-scsi/msg159440.html
Link: https://lore.kernel.org/r/20210929124022.24605-2-sumit.saxena@broadcom.com
Fixes: 9bedd36e91 ("scsi: megaraid_sas: Handle missing interrupts while re-enabling IRQs")
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18 19:16:50 +01:00
..
Kconfig.megaraid
Makefile
mbox_defs.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
mega_common.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
megaraid_ioctl.h
megaraid_mbox.c scsi: megaraid_mbox: Use DEVICE_ATTR_ADMIN_RO() macro 2021-06-22 23:00:02 -04:00
megaraid_mbox.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
megaraid_mm.c scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry() 2021-07-28 23:29:09 -04:00
megaraid_mm.h
megaraid_sas.h scsi: megaraid_sas: Update driver version to 07.717.02.00-rc1 2021-06-02 01:06:33 -04:00
megaraid_sas_base.c scsi: megaraid: Clean up some inconsistent indenting 2021-09-13 22:15:50 -04:00
megaraid_sas_debugfs.c
megaraid_sas_fp.c scsi: megaraid_sas: Early detection of VD deletion through RaidMap update 2021-06-02 01:06:33 -04:00
megaraid_sas_fusion.c scsi: megaraid_sas: Fix concurrent access to ISR between IRQ polling and real interrupt 2021-11-18 19:16:50 +01:00
megaraid_sas_fusion.h scsi: megaraid_sas: mq_poll support 2021-03-04 17:37:03 -05:00