[PATCH v2 0/2] scsi: leapraid: fix firmware log mmap lifetime

Linmao Li posted 2 patches 1 month, 2 weeks ago
There is a newer version of this series
drivers/scsi/leapraid/leapraid_app.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
[PATCH v2 0/2] scsi: leapraid: fix firmware log mmap lifetime
Posted by Linmao Li 1 month, 2 weeks ago
The firmware log mmap path has two related lifetime issues.  VMA clones
drop Scsi_Host references that they never acquired, and device removal
can free the coherent log buffer while mmap is still setting up a VMA.

Patch 1 gives each VMA its own host device reference.  Patch 2 claims a
temporary mmap activity reference under the adapter-list lock so teardown
cannot miss an in-progress mapping.

Patch 2 depends on patch 1: patch 1 keeps adapter non-NULL on the
successful mmap path, allowing patch 2 to drop the temporary mmap
reference at out_put.  Applied alone, patch 2 would leak that reference
and make teardown wait indefinitely.

Neither patch has been tested on hardware; both are derived from the
reference counting and locking in the code.

Changes in v2:
- 2/2: keep the return type and function name of
  leapraid_ctl_lookup_adapter() on one line, the declaration fits in
  the line-length limit (Dongdong Hao)
- 1/2: unchanged

v1: https://lore.kernel.org/all/20260811112001.1158587-1-lilinmao@kylinos.cn/

Linmao Li (2):
  scsi: leapraid: balance host references for firmware log VMAs
  scsi: leapraid: serialize firmware log mmap with teardown

 drivers/scsi/leapraid/leapraid_app.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)


base-commit: 376a3960e5efe85ff765abfb5b5b7e4655ad6aed
-- 
2.25.1