Patch "scsi: elx: efct: Do not hold lock while calling fc_vport_terminate()" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: elx: efct: Do not hold lock while calling fc_vport_terminate()

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-elx-efct-do-not-hold-lock-while-calling-fc_vpor.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 946e4f971b313410b4ee4f6a2482a41eae6c68fa
Author: James Smart <jsmart2021@xxxxxxxxx>
Date:   Tue Sep 7 09:52:25 2021 -0700

    scsi: elx: efct: Do not hold lock while calling fc_vport_terminate()
    
    [ Upstream commit 450907424d9ebcc28fab42a065c3cddce49ee97d ]
    
    Smatch checker reported the following error:
    
      drivers/base/power/sysfs.c:833 dpm_sysfs_remove()
      warn: sleeping in atomic context
    
    With a calling sequence of:
    
      efct_lio_npiv_drop_nport() <- disables preempt
      -> fc_vport_terminate()
         -> device_del()
            -> dpm_sysfs_remove()
    
    Issue is efct_lio_npiv_drop_nport() is making the fc_vport_terminate() call
    while holding a lock w/ ipl raised.
    
    It is unnecessary to hold the lock over this call, shift where the lock is
    taken.
    
    Link: https://lore.kernel.org/r/20210907165225.10821-1-jsmart2021@xxxxxxxxx
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Co-developed-by: Ram Vegesna <ram.vegesna@xxxxxxxxxxxx>
    Signed-off-by: Ram Vegesna <ram.vegesna@xxxxxxxxxxxx>
    Signed-off-by: James Smart <jsmart2021@xxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efct_lio.c
index e0d798d6baee..f1d6fcfe12f0 100644
--- a/drivers/scsi/elx/efct/efct_lio.c
+++ b/drivers/scsi/elx/efct/efct_lio.c
@@ -880,11 +880,11 @@ efct_lio_npiv_drop_nport(struct se_wwn *wwn)
 	struct efct *efct = lio_vport->efct;
 	unsigned long flags = 0;
 
-	spin_lock_irqsave(&efct->tgt_efct.efct_lio_lock, flags);
-
 	if (lio_vport->fc_vport)
 		fc_vport_terminate(lio_vport->fc_vport);
 
+	spin_lock_irqsave(&efct->tgt_efct.efct_lio_lock, flags);
+
 	list_for_each_entry_safe(vport, next_vport, &efct->tgt_efct.vport_list,
 				 list_entry) {
 		if (vport->lio_vport == lio_vport) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux