scsi: target: tcmu: Fix memory leak
Status from this message: Applied to 5.12/scsi-staging, thanks!
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | scsi: target: tcmu: Move some functions without code changedrivers/ | +80 | 0 replies | |
| 2/2 | scsi: target: tcmu: Fix memory leak caused by wrong uio usagedrivers/ | +26 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Mike Christie |
|---|---|
| Series | R-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] scsi: target: tcmu: Fix memory leak
This small series applies to Martin's for-next.
This is the third attempt to fix a severe memory leak in tcmu. Previous patches:
https://lore.kernel.org/linux-scsi/[email protected]/
and
https://lore.kernel.org/linux-scsi/[email protected]/
Tcmu's refcounting relies on tcmu_open and tcmu_release being called symmetrically by uio. But that is not true if userspace daemon holds the uio device open or mmap'ed while tcmu calls uio_unregister device. So refcount can stay above 0 for ever, which means that tcmu does not free resources of a tcmu device. In extreme cases the amount of memory leaked can be > 1 GB for a single destroyed tcmu device.
This new patch series fixes the problem by moving refcounting from tcmu_open/tcmu_release to new vm_operations_struct::open/*::close handlers, which are called under all conditions.
Bodo Stroesser (2):
scsi: target: tcmu: Move some functions without code change
scsi: target: tcmu: Fix memory leak caused by wrong uio usage
drivers/target/target_core_user.c | 189 +++++++++++++++++++++----------------- 1 file changed, 106 insertions(+), 83 deletions(-)
Signature · 1 line
2.12.3