public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH V3 0/3] Fix a race condition when performing a controller reset
@ 2021-11-16 15:49 Maurizio Lombardi
  2021-11-16 15:49 ` [PATCH V3 1/3] nvmet-tcp: fix a race condition between release_queue and io_work Maurizio Lombardi
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Maurizio Lombardi @ 2021-11-16 15:49 UTC (permalink / raw)
  To: linux-nvme; +Cc: hch, sagi, chaitanya.kulkarni

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(-)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-11-19 17:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-16 15:49 [PATCH V3 0/3] Fix a race condition when performing a controller reset Maurizio Lombardi
2021-11-16 15:49 ` [PATCH V3 1/3] nvmet-tcp: fix a race condition between release_queue and io_work Maurizio Lombardi
2021-11-16 17:25   ` John Meneghini
2021-11-16 15:49 ` [PATCH V3 2/3] nvmet-tcp: add an helper to free the cmd buffers Maurizio Lombardi
2021-11-16 16:23   ` Sagi Grimberg
2021-11-16 17:25   ` John Meneghini
2021-11-16 15:49 ` [PATCH V3 3/3] nvmet-tcp: fix memory leak when performing a controller reset Maurizio Lombardi
2021-11-16 17:26   ` John Meneghini
2021-11-16 20:26 ` [PATCH V3 0/3] Fix a race condition " Keith Busch
2021-11-19 17:11 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox