From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752142AbdFVOXY (ORCPT ); Thu, 22 Jun 2017 10:23:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:35296 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751149AbdFVOXX (ORCPT ); Thu, 22 Jun 2017 10:23:23 -0400 Date: Thu, 22 Jun 2017 16:23:20 +0200 From: Johannes Thumshirn To: John Garry Cc: "Martin K . Petersen" , Linux SCSI Mailinglist , Linux Kernel Mailinglist , qla2xxx-upstream@qlogic.com, Himanshu Madhani Subject: Re: [PATCH] qla2xxx: Protect access to qpair members with qpair->qp_lock Message-ID: <20170622142320.GP5670@linux-x5ow.site> References: <20170622134325.26931-1-jthumshirn@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 22, 2017 at 03:19:27PM +0100, John Garry wrote: > On 22/06/2017 14:43, Johannes Thumshirn wrote: > >In qla2xx_start_scsi_mq() and qla2xx_dif_start_scsi_mq() we grab the > >qpair->qp_lock but do access members of the qpair before having the lock. > >Re-order the locking sequence to have all read and write access to qpair > >members under the qpair->qp_lock. > > > >Signed-off-by: Johannes Thumshirn > >--- > > drivers/scsi/qla2xxx/qla_iocb.c | 20 +++++++++++++------- > > 1 file changed, 13 insertions(+), 7 deletions(-) > > > >diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c > >index 8404f17f3c6c..425ca1646a9a 100644 > >--- a/drivers/scsi/qla2xxx/qla_iocb.c > >+++ b/drivers/scsi/qla2xxx/qla_iocb.c > >@@ -1770,10 +1770,6 @@ qla2xxx_start_scsi_mq(srb_t *sp) > > struct qla_hw_data *ha = vha->hw; > > struct qla_qpair *qpair = sp->qpair; > > > >- /* Setup qpair pointers */ > >- rsp = qpair->rsp; > >- req = qpair->req; > > Can you check the call to qla2x00_marker() before the spinlock grab, which > takes rsp and req as parameters? Good catch, thanks. -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850