diff mbox

ibmvfc: prevent a potential deadlock

Message ID 20160715111857.GC13153@mwanda (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Dan Carpenter July 15, 2016, 11:18 a.m. UTC
My static checker complains that we need to unlock on this path.  Seems
true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Brian King July 15, 2016, 1:38 p.m. UTC | #1
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
Ewan Milne July 15, 2016, 3:06 p.m. UTC | #2
On Fri, 2016-07-15 at 14:18 +0300, Dan Carpenter wrote:
> My static checker complains that we need to unlock on this path.  Seems
> true.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
> index fc523c3..ab67ec4 100644
> --- a/drivers/scsi/ibmvscsi/ibmvfc.c
> +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
> @@ -4722,6 +4722,8 @@ static void ibmvfc_rport_add_thread(struct work_struct *work)
>  					tgt_dbg(tgt, "Setting rport roles\n");
>  					fc_remote_port_rolechg(rport, tgt->ids.roles);
>  					put_device(&rport->dev);
> +				} else {
> +					spin_unlock_irqrestore(vhost->host->host_lock, flags);
>  				}
>  
>  				kref_put(&tgt->kref, ibmvfc_release_tgt);
> --

Reviewed-by: Ewan D. Milne <emilne@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen July 15, 2016, 7:14 p.m. UTC | #3
>>>>> "Dan" == Dan Carpenter <dan.carpenter@oracle.com> writes:

Dan> My static checker complains that we need to unlock on this path.
Dan> Seems true.

Applied to 4.8/scsi-queue.
diff mbox

Patch

diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index fc523c3..ab67ec4 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -4722,6 +4722,8 @@  static void ibmvfc_rport_add_thread(struct work_struct *work)
 					tgt_dbg(tgt, "Setting rport roles\n");
 					fc_remote_port_rolechg(rport, tgt->ids.roles);
 					put_device(&rport->dev);
+				} else {
+					spin_unlock_irqrestore(vhost->host->host_lock, flags);
 				}
 
 				kref_put(&tgt->kref, ibmvfc_release_tgt);