We have seen several kernel warning about list corruptions involving bnx2fc_cmd.link. Reviewing the locking of this element showed that in one instance a kref_put on io_req->refcount has been called without tgt_lock. As the io_req might still be enqueued on a list protected by this lock, this patch adds it. This was the only call site without it. Signed-off-by: Arne Jansen <sensille@xxxxxxx> --- drivers/scsi/bnx2fc/bnx2fc_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 4c8122a82322..d0d465271e5c 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c @@ -1097,6 +1097,9 @@ static int bnx2fc_abts_cleanup(struct bnx2fc_cmd *io_req) */ time_left = wait_for_completion_timeout(&io_req->cleanup_done, BNX2FC_FW_TIMEOUT); + + spin_lock_bh(&tgt->tgt_lock); + if (!time_left) { BNX2FC_IO_DBG(io_req, "%s(): Wait for cleanup timed out.\n", __func__); @@ -1107,8 +1110,6 @@ static int bnx2fc_abts_cleanup(struct bnx2fc_cmd *io_req) */ kref_put(&io_req->refcount, bnx2fc_cmd_release); } - - spin_lock_bh(&tgt->tgt_lock); io_req->wait_for_cleanup_comp = 0; return SUCCESS; } -- 2.11.0