Skip to content

Fix a race condition when performing a controller reset

Maurizio Lombardi linux-nvme 3 versions – Applied

Status from this message: applied to nvme-5.16.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 6 repliesApplied
  2. v23 patches 6 repliesSuperseded
  3. v12 patches 18 repliesSuperseded

Changes in v3 from the cover letter

- rename nvmet_tcp_free_iovec() to nvmet_tcp_free_cmd_buffers()

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3nvmet-tcp: fix a race condition between release_queue and io_workdrivers/nvme/target/tcp.c+3 -11 reply
2/3nvmet-tcp: add an helper to free the cmd buffersdrivers/nvme/target/tcp.c+19 -92 replies
3/3nvmet-tcp: fix memory leak when performing a controller resetdrivers/nvme/target/tcp.c+4 -11 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSagi GrimbergJohn MeneghiniKeith Busch
SeriesR-b
1/3R-b R-b
2/3R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH V3 0/3] Fix a race condition when performing a controller reset

Memory leaks and kernel panics involving the nvmet driver have been observed when an initiator executes a reset_controller operation while doing I/O.

The problem is due to a race condition between io_work and release_queue, the latter may end up destroying the commands while io_work is still running, causing use-after-free and memory leaks.

V3:
- rename nvmet_tcp_free_iovec() to nvmet_tcp_free_cmd_buffers()

V2:
- Use "queue->rcv_state" to prevent the race condition, as suggested by Sagi Grimberg.
- Dropped the changes to nvmet_tcp_queue_response() because they are no longer necessary.
- Fix the memory leaks in a separate patch (PATCH 3/3).

Maurizio Lombardi (3):
nvmet-tcp: fix a race condition between release_queue and io_work
nvmet-tcp: add an helper to free the cmd buffers
nvmet-tcp: fix memory leak when performing a controller reset

 drivers/nvme/target/tcp.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)
Signature · 1 line
2.27.0