All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] qla2xxx: Stable Backports for 4.10
@ 2017-03-28 19:50 Himanshu Madhani
  2017-03-28 19:50 ` [PATCH 1/2] qla2xxx: Allow vref count to timeout on vport delete Himanshu Madhani
  2017-03-28 19:50 ` [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS Himanshu Madhani
  0 siblings, 2 replies; 7+ messages in thread
From: Himanshu Madhani @ 2017-03-28 19:50 UTC (permalink / raw)
  To: stable; +Cc: himanshu.madhani, gregkh

Hi Greg, 

These patches are backport for the patches which failed to apply on linux
stable kernel version 4.10.5. Please consider them for next stable release.

Thanks,
Himanshu

Joe Carnuccio (1):
  qla2xxx: Allow vref count to timeout on vport delete.

Quinn Tran (1):
  qla2xxx: Fix inadequate lock protection for ABTS.

 drivers/scsi/qla2xxx/qla_attr.c   |  4 +---
 drivers/scsi/qla2xxx/qla_def.h    |  6 +++++-
 drivers/scsi/qla2xxx/qla_init.c   |  1 +
 drivers/scsi/qla2xxx/qla_mid.c    | 14 ++++++++------
 drivers/scsi/qla2xxx/qla_os.c     |  1 +
 drivers/scsi/qla2xxx/qla_target.c | 11 ++++++++++-
 6 files changed, 26 insertions(+), 11 deletions(-)

-- 
2.12.0.264.gd6db3f2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] qla2xxx: Allow vref count to timeout on vport delete.
  2017-03-28 19:50 [PATCH 0/2] qla2xxx: Stable Backports for 4.10 Himanshu Madhani
@ 2017-03-28 19:50 ` Himanshu Madhani
  2017-03-28 19:50 ` [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS Himanshu Madhani
  1 sibling, 0 replies; 7+ messages in thread
From: Himanshu Madhani @ 2017-03-28 19:50 UTC (permalink / raw)
  To: stable; +Cc: himanshu.madhani, gregkh

From: Joe Carnuccio <joe.carnuccio@cavium.com>

commit c4a9b538ab2a109c5f9798bea1f8f4bf93aadfb9 upstream.

Cc: <stable@vger.kernel.org>
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_attr.c |  4 +---
 drivers/scsi/qla2xxx/qla_def.h  |  6 +++++-
 drivers/scsi/qla2xxx/qla_init.c |  1 +
 drivers/scsi/qla2xxx/qla_mid.c  | 14 ++++++++------
 drivers/scsi/qla2xxx/qla_os.c   |  1 +
 5 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index f201f4099620..f204d7cd5354 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -2154,8 +2154,6 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
 		    "Timer for the VP[%d] has stopped\n", vha->vp_idx);
 	}
 
-	BUG_ON(atomic_read(&vha->vref_count));
-
 	qla2x00_free_fcports(vha);
 
 	mutex_lock(&ha->vport_lock);
@@ -2163,7 +2161,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
 	clear_bit(vha->vp_idx, ha->vp_idx_map);
 	mutex_unlock(&ha->vport_lock);
 
-	if (vha->qpair->vp_idx == vha->vp_idx) {
+	if (vha->qpair && vha->qpair->vp_idx == vha->vp_idx) {
 		if (qla2xxx_delete_qpair(vha, vha->qpair) != QLA_SUCCESS)
 			ql_log(ql_log_warn, vha, 0x7087,
 			    "Queue Pair delete failed.\n");
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 5b1287a63c49..7887f9b0950d 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3788,6 +3788,7 @@ typedef struct scsi_qla_host {
 	struct qla8044_reset_template reset_tmplt;
 	struct qla_tgt_counters tgt_counters;
 	uint16_t	bbcr;
+	wait_queue_head_t vref_waitq;
 } scsi_qla_host_t;
 
 struct qla27xx_image_status {
@@ -3843,14 +3844,17 @@ struct qla2_sgx {
 	mb();						\
 	if (__vha->flags.delete_progress) {		\
 		atomic_dec(&__vha->vref_count);		\
+		wake_up(&__vha->vref_waitq);		\
 		__bail = 1;				\
 	} else {					\
 		__bail = 0;				\
 	}						\
 } while (0)
 
-#define QLA_VHA_MARK_NOT_BUSY(__vha)			\
+#define QLA_VHA_MARK_NOT_BUSY(__vha) do {		\
 	atomic_dec(&__vha->vref_count);			\
+	wake_up(&__vha->vref_waitq);			\
+} while (0)						\
 
 #define QLA_QPAIR_MARK_BUSY(__qpair, __bail) do {	\
 	atomic_inc(&__qpair->ref_count);		\
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 7b6317c8c2e9..e2b2d7b6a085 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4352,6 +4352,7 @@ qla2x00_update_fcports(scsi_qla_host_t *base_vha)
 			}
 		}
 		atomic_dec(&vha->vref_count);
+		wake_up(&vha->vref_waitq);
 	}
 	spin_unlock_irqrestore(&ha->vport_slock, flags);
 }
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index c6d6f0d912ff..09a490c98763 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -74,13 +74,14 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
 	 * ensures no active vp_list traversal while the vport is removed
 	 * from the queue)
 	 */
-	spin_lock_irqsave(&ha->vport_slock, flags);
-	while (atomic_read(&vha->vref_count)) {
-		spin_unlock_irqrestore(&ha->vport_slock, flags);
-
-		msleep(500);
+	wait_event_timeout(vha->vref_waitq, atomic_read(&vha->vref_count),
+	    10*HZ);
 
-		spin_lock_irqsave(&ha->vport_slock, flags);
+	spin_lock_irqsave(&ha->vport_slock, flags);
+	if (atomic_read(&vha->vref_count)) {
+		ql_dbg(ql_dbg_vport, vha, 0xfffa,
+		    "vha->vref_count=%u timeout\n", vha->vref_count.counter);
+		vha->vref_count = (atomic_t)ATOMIC_INIT(0);
 	}
 	list_del(&vha->list);
 	qlt_update_vp_map(vha, RESET_VP_IDX);
@@ -269,6 +270,7 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb)
 
 			spin_lock_irqsave(&ha->vport_slock, flags);
 			atomic_dec(&vha->vref_count);
+			wake_up(&vha->vref_waitq);
 		}
 		i++;
 	}
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 17cdd1d09a57..dc79524178ad 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4215,6 +4215,7 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
 
 	spin_lock_init(&vha->work_lock);
 	spin_lock_init(&vha->cmd_list_lock);
+	init_waitqueue_head(&vha->vref_waitq);
 
 	sprintf(vha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, vha->host_no);
 	ql_dbg(ql_dbg_init, vha, 0x0041,
-- 
2.12.0.264.gd6db3f2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS.
  2017-03-28 19:50 [PATCH 0/2] qla2xxx: Stable Backports for 4.10 Himanshu Madhani
  2017-03-28 19:50 ` [PATCH 1/2] qla2xxx: Allow vref count to timeout on vport delete Himanshu Madhani
@ 2017-03-28 19:50 ` Himanshu Madhani
  2017-03-30  8:38   ` Greg KH
  1 sibling, 1 reply; 7+ messages in thread
From: Himanshu Madhani @ 2017-03-28 19:50 UTC (permalink / raw)
  To: stable; +Cc: himanshu.madhani, gregkh

From: Quinn Tran <quinn.tran@cavium.com>

commit 8f6fc8d4e7ae2347d6261d11a7eb2b247d2954d8 upstream.

Normally, ABTS is sent to Target Core as Task MGMT command.
In the case of error, qla2xxx needs to send response, hardware_lock
is required to prevent request queue corruption.

Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 26fe9cb3a963..e2e71e0de857 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -120,6 +120,9 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha,
 	uint16_t srr_flags, uint16_t srr_reject_code, uint8_t srr_explan);
 static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
 	struct imm_ntfy_from_isp *imm, int ha_locked);
+static void qlt_24xx_handle_abts(struct scsi_qla_host *,
+	struct abts_recv_from_24xx *);
+
 /*
  * Global Variables
  */
@@ -357,6 +360,8 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
 		    (struct abts_recv_from_24xx *)pkt;
 		struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
 		    entry->vp_index);
+		unsigned long flags;
+
 		if (unlikely(!host)) {
 			ql_dbg(ql_dbg_tgt, vha, 0xe044,
 			    "qla_target(%d): Response pkt "
@@ -364,7 +369,11 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
 			    "vp_index %d\n", vha->vp_idx, entry->vp_index);
 			break;
 		}
-		qlt_response_pkt(host, pkt);
+		if (!ha_locked)
+			spin_lock_irqsave(&host->hw->hardware_lock, flags);
+		qlt_24xx_handle_abts(host, (struct abts_recv_from_24xx *)atio);
+		if (!ha_locked)
+			spin_unlock_irqrestore(&host->hw->hardware_lock, flags);
 		break;
 	}
 
-- 
2.12.0.264.gd6db3f2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS.
  2017-03-28 19:50 ` [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS Himanshu Madhani
@ 2017-03-30  8:38   ` Greg KH
  2017-03-30 16:18     ` Himanshu Madhani
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2017-03-30  8:38 UTC (permalink / raw)
  To: Himanshu Madhani; +Cc: stable

On Tue, Mar 28, 2017 at 12:50:20PM -0700, Himanshu Madhani wrote:
> From: Quinn Tran <quinn.tran@cavium.com>
> 
> commit 8f6fc8d4e7ae2347d6261d11a7eb2b247d2954d8 upstream.
> 
> Normally, ABTS is sent to Target Core as Task MGMT command.
> In the case of error, qla2xxx needs to send response, hardware_lock
> is required to prevent request queue corruption.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index 26fe9cb3a963..e2e71e0de857 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -120,6 +120,9 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha,
>  	uint16_t srr_flags, uint16_t srr_reject_code, uint8_t srr_explan);
>  static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
>  	struct imm_ntfy_from_isp *imm, int ha_locked);
> +static void qlt_24xx_handle_abts(struct scsi_qla_host *,
> +	struct abts_recv_from_24xx *);
> +
>  /*
>   * Global Variables
>   */
> @@ -357,6 +360,8 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
>  		    (struct abts_recv_from_24xx *)pkt;
>  		struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
>  		    entry->vp_index);
> +		unsigned long flags;
> +
>  		if (unlikely(!host)) {
>  			ql_dbg(ql_dbg_tgt, vha, 0xe044,
>  			    "qla_target(%d): Response pkt "
> @@ -364,7 +369,11 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
>  			    "vp_index %d\n", vha->vp_idx, entry->vp_index);
>  			break;
>  		}
> -		qlt_response_pkt(host, pkt);
> +		if (!ha_locked)
> +			spin_lock_irqsave(&host->hw->hardware_lock, flags);
> +		qlt_24xx_handle_abts(host, (struct abts_recv_from_24xx *)atio);
> +		if (!ha_locked)
> +			spin_unlock_irqrestore(&host->hw->hardware_lock, flags);
>  		break;
>  	}
>  

You didn't test build this patch did you :(

Please do so, it breaks the build here on my end.  I'll drop it from my
queue, please fix this up _properly_ and resend after you have tested it
out.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS.
  2017-03-30  8:38   ` Greg KH
@ 2017-03-30 16:18     ` Himanshu Madhani
  2017-03-31  7:46       ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Himanshu Madhani @ 2017-03-30 16:18 UTC (permalink / raw)
  To: Greg KH; +Cc: stable



On Thu, 30 Mar 2017, 1:38am, Greg KH wrote:

> On Tue, Mar 28, 2017 at 12:50:20PM -0700, Himanshu Madhani wrote:
> > From: Quinn Tran <quinn.tran@cavium.com>
> > 
> > commit 8f6fc8d4e7ae2347d6261d11a7eb2b247d2954d8 upstream.
> > 
> > Normally, ABTS is sent to Target Core as Task MGMT command.
> > In the case of error, qla2xxx needs to send response, hardware_lock
> > is required to prevent request queue corruption.
> > 
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
> > Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
> > ---
> >  drivers/scsi/qla2xxx/qla_target.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> > index 26fe9cb3a963..e2e71e0de857 100644
> > --- a/drivers/scsi/qla2xxx/qla_target.c
> > +++ b/drivers/scsi/qla2xxx/qla_target.c
> > @@ -120,6 +120,9 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha,
> >  	uint16_t srr_flags, uint16_t srr_reject_code, uint8_t srr_explan);
> >  static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
> >  	struct imm_ntfy_from_isp *imm, int ha_locked);
> > +static void qlt_24xx_handle_abts(struct scsi_qla_host *,
> > +	struct abts_recv_from_24xx *);
> > +
> >  /*
> >   * Global Variables
> >   */
> > @@ -357,6 +360,8 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
> >  		    (struct abts_recv_from_24xx *)pkt;
> >  		struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
> >  		    entry->vp_index);
> > +		unsigned long flags;
> > +
> >  		if (unlikely(!host)) {
> >  			ql_dbg(ql_dbg_tgt, vha, 0xe044,
> >  			    "qla_target(%d): Response pkt "
> > @@ -364,7 +369,11 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
> >  			    "vp_index %d\n", vha->vp_idx, entry->vp_index);
> >  			break;
> >  		}
> > -		qlt_response_pkt(host, pkt);
> > +		if (!ha_locked)
> > +			spin_lock_irqsave(&host->hw->hardware_lock, flags);
> > +		qlt_24xx_handle_abts(host, (struct abts_recv_from_24xx *)atio);
> > +		if (!ha_locked)
> > +			spin_unlock_irqrestore(&host->hw->hardware_lock, flags);
> >  		break;
> >  	}
> >  
> 
> You didn't test build this patch did you :(
> 
> Please do so, it breaks the build here on my end.  I'll drop it from my
> queue, please fix this up _properly_ and resend after you have tested it
> out.
>

Apologies for the wrong backport. Looks like original patch has not yet 
made it into 4.10 stable. So this backport is not needed at this time.
 
Sorry for the noise.  

 > thanks,
> 
> greg k-h
> 
Thanks,
- Himanshu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS.
  2017-03-30 16:18     ` Himanshu Madhani
@ 2017-03-31  7:46       ` Greg KH
  2017-03-31 14:14         ` Madhani, Himanshu
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2017-03-31  7:46 UTC (permalink / raw)
  To: Himanshu Madhani; +Cc: stable

On Thu, Mar 30, 2017 at 09:18:53AM -0700, Himanshu Madhani wrote:
> 
> 
> On Thu, 30 Mar 2017, 1:38am, Greg KH wrote:
> 
> > On Tue, Mar 28, 2017 at 12:50:20PM -0700, Himanshu Madhani wrote:
> > > From: Quinn Tran <quinn.tran@cavium.com>
> > > 
> > > commit 8f6fc8d4e7ae2347d6261d11a7eb2b247d2954d8 upstream.
> > > 
> > > Normally, ABTS is sent to Target Core as Task MGMT command.
> > > In the case of error, qla2xxx needs to send response, hardware_lock
> > > is required to prevent request queue corruption.
> > > 
> > > Cc: <stable@vger.kernel.org>
> > > Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
> > > Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
> > > ---
> > >  drivers/scsi/qla2xxx/qla_target.c | 11 ++++++++++-
> > >  1 file changed, 10 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> > > index 26fe9cb3a963..e2e71e0de857 100644
> > > --- a/drivers/scsi/qla2xxx/qla_target.c
> > > +++ b/drivers/scsi/qla2xxx/qla_target.c
> > > @@ -120,6 +120,9 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha,
> > >  	uint16_t srr_flags, uint16_t srr_reject_code, uint8_t srr_explan);
> > >  static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
> > >  	struct imm_ntfy_from_isp *imm, int ha_locked);
> > > +static void qlt_24xx_handle_abts(struct scsi_qla_host *,
> > > +	struct abts_recv_from_24xx *);
> > > +
> > >  /*
> > >   * Global Variables
> > >   */
> > > @@ -357,6 +360,8 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
> > >  		    (struct abts_recv_from_24xx *)pkt;
> > >  		struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
> > >  		    entry->vp_index);
> > > +		unsigned long flags;
> > > +
> > >  		if (unlikely(!host)) {
> > >  			ql_dbg(ql_dbg_tgt, vha, 0xe044,
> > >  			    "qla_target(%d): Response pkt "
> > > @@ -364,7 +369,11 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
> > >  			    "vp_index %d\n", vha->vp_idx, entry->vp_index);
> > >  			break;
> > >  		}
> > > -		qlt_response_pkt(host, pkt);
> > > +		if (!ha_locked)
> > > +			spin_lock_irqsave(&host->hw->hardware_lock, flags);
> > > +		qlt_24xx_handle_abts(host, (struct abts_recv_from_24xx *)atio);
> > > +		if (!ha_locked)
> > > +			spin_unlock_irqrestore(&host->hw->hardware_lock, flags);
> > >  		break;
> > >  	}
> > >  
> > 
> > You didn't test build this patch did you :(
> > 
> > Please do so, it breaks the build here on my end.  I'll drop it from my
> > queue, please fix this up _properly_ and resend after you have tested it
> > out.
> >
> 
> Apologies for the wrong backport. Looks like original patch has not yet 
> made it into 4.10 stable. So this backport is not needed at this time.

What "original patch"?

Does that mean that patch 1/2 of this series should also be dropped?

totally confused,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS.
  2017-03-31  7:46       ` Greg KH
@ 2017-03-31 14:14         ` Madhani, Himanshu
  0 siblings, 0 replies; 7+ messages in thread
From: Madhani, Himanshu @ 2017-03-31 14:14 UTC (permalink / raw)
  To: Greg KH; +Cc: stable

Hi Greg, 

> On Mar 31, 2017, at 12:46 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> 
> On Thu, Mar 30, 2017 at 09:18:53AM -0700, Himanshu Madhani wrote:
>> 
>> 
>> On Thu, 30 Mar 2017, 1:38am, Greg KH wrote:
>> 
>>> On Tue, Mar 28, 2017 at 12:50:20PM -0700, Himanshu Madhani wrote:
>>>> From: Quinn Tran <quinn.tran@cavium.com>
>>>> 
>>>> commit 8f6fc8d4e7ae2347d6261d11a7eb2b247d2954d8 upstream.
>>>> 
>>>> Normally, ABTS is sent to Target Core as Task MGMT command.
>>>> In the case of error, qla2xxx needs to send response, hardware_lock
>>>> is required to prevent request queue corruption.
>>>> 
>>>> Cc: <stable@vger.kernel.org>
>>>> Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
>>>> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
>>>> ---
>>>> drivers/scsi/qla2xxx/qla_target.c | 11 ++++++++++-
>>>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>>> 
>>>> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
>>>> index 26fe9cb3a963..e2e71e0de857 100644
>>>> --- a/drivers/scsi/qla2xxx/qla_target.c
>>>> +++ b/drivers/scsi/qla2xxx/qla_target.c
>>>> @@ -120,6 +120,9 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha,
>>>> 	uint16_t srr_flags, uint16_t srr_reject_code, uint8_t srr_explan);
>>>> static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
>>>> 	struct imm_ntfy_from_isp *imm, int ha_locked);
>>>> +static void qlt_24xx_handle_abts(struct scsi_qla_host *,
>>>> +	struct abts_recv_from_24xx *);
>>>> +
>>>> /*
>>>>  * Global Variables
>>>>  */
>>>> @@ -357,6 +360,8 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
>>>> 		    (struct abts_recv_from_24xx *)pkt;
>>>> 		struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha,
>>>> 		    entry->vp_index);
>>>> +		unsigned long flags;
>>>> +
>>>> 		if (unlikely(!host)) {
>>>> 			ql_dbg(ql_dbg_tgt, vha, 0xe044,
>>>> 			    "qla_target(%d): Response pkt "
>>>> @@ -364,7 +369,11 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt)
>>>> 			    "vp_index %d\n", vha->vp_idx, entry->vp_index);
>>>> 			break;
>>>> 		}
>>>> -		qlt_response_pkt(host, pkt);
>>>> +		if (!ha_locked)
>>>> +			spin_lock_irqsave(&host->hw->hardware_lock, flags);
>>>> +		qlt_24xx_handle_abts(host, (struct abts_recv_from_24xx *)atio);
>>>> +		if (!ha_locked)
>>>> +			spin_unlock_irqrestore(&host->hw->hardware_lock, flags);
>>>> 		break;
>>>> 	}
>>>> 
>>> 
>>> You didn't test build this patch did you :(
>>> 
>>> Please do so, it breaks the build here on my end.  I'll drop it from my
>>> queue, please fix this up _properly_ and resend after you have tested it
>>> out.
>>> 
>> 
>> Apologies for the wrong backport. Looks like original patch has not yet 
>> made it into 4.10 stable. So this backport is not needed at this time.
> 
> What "original patch”?

This patch (2/2) fixes issue which was introduced by following patch.
 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/scsi/qla2xxx?id=41dc529a4602ac737020f423f84686a81de38e6d

> 
> Does that mean that patch 1/2 of this series should also be dropped?
> 

No 1/2 patch is independent of the this patch. 

> totally confused,
> 
> greg k-h

Thanks,
- Himanshu


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-31 14:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 19:50 [PATCH 0/2] qla2xxx: Stable Backports for 4.10 Himanshu Madhani
2017-03-28 19:50 ` [PATCH 1/2] qla2xxx: Allow vref count to timeout on vport delete Himanshu Madhani
2017-03-28 19:50 ` [PATCH 2/2] qla2xxx: Fix inadequate lock protection for ABTS Himanshu Madhani
2017-03-30  8:38   ` Greg KH
2017-03-30 16:18     ` Himanshu Madhani
2017-03-31  7:46       ` Greg KH
2017-03-31 14:14         ` Madhani, Himanshu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.