Skip to content

Commit

Permalink
scsi: elx: efct: Do not hold lock while calling fc_vport_terminate()
Browse files Browse the repository at this point in the history
[ Upstream commit 4509074 ]

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@gmail.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com>
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
jsmart-gh authored and gregkh committed Oct 9, 2021
1 parent e95f620 commit 6a48e3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/elx/efct/efct_lio.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 6a48e3f

Please sign in to comment.