]> git.itanic.dy.fi Git - linux-stable/commit
RDMA/srp: Do not call scsi_done() from srp_abort()
authorBart Van Assche <bvanassche@acm.org>
Wed, 23 Aug 2023 20:57:27 +0000 (13:57 -0700)
committerLeon Romanovsky <leon@kernel.org>
Mon, 11 Sep 2023 11:15:58 +0000 (14:15 +0300)
commite193b7955dfad68035b983a0011f4ef3590c85eb
tree2adc3b6fdba65fe243d0f41c2c0a5576d37dcef5
parent0bb80ecc33a8fb5a682236443c1e740d5c917d1d
RDMA/srp: Do not call scsi_done() from srp_abort()

After scmd_eh_abort_handler() has called the SCSI LLD eh_abort_handler
callback, it performs one of the following actions:
* Call scsi_queue_insert().
* Call scsi_finish_command().
* Call scsi_eh_scmd_add().
Hence, SCSI abort handlers must not call scsi_done(). Otherwise all
the above actions would trigger a use-after-free. Hence remove the
scsi_done() call from srp_abort(). Keep the srp_free_req() call
before returning SUCCESS because we may not see the command again if
SUCCESS is returned.

Cc: Bob Pearson <rpearsonhpe@gmail.com>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: d8536670916a ("IB/srp: Avoid having aborted requests hang")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230823205727.505681-1-bvanassche@acm.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/ulp/srp/ib_srp.c