lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <fca82c66-89cd-58fa-22a3-da628f85d1ff@gmx.net>
Date:   Tue, 10 Dec 2019 13:46:47 +0100
From:   Arne Jansen <sensille@....net>
To:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     jejb@...ux.ibm.com, martin.petersen@...cle.com
Subject: [PATCH] bnx2fc: protect kref_put by tgt_lock

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@....net>
---
  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ