Message ID | 20211101232825.2350233-4-ipylypiv@google.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | small pm80xx cleanups and fixes | expand |
On Tue, Nov 2, 2021 at 12:29 AM Igor Pylypiv <ipylypiv@google.com> wrote: > > Starting from commit 05c6c029a44d9 ("scsi: pm80xx: Increase number of > supported queues") driver initializes only max_q_num queues. > Do not use an invalid queue if the WARN_ON condition is true. > > Fixes: 7640e1eb8c5de ("scsi: pm80xx: Make mpi_build_cmd locking consistent") > Reviewed-by: Vishakha Channapattan <vishakhavc@google.com> > Signed-off-by: Igor Pylypiv <ipylypiv@google.com> Acked-by: Jack Wang <jinpu.wang@ionos.com> Thanks > --- > drivers/scsi/pm8001/pm8001_hwi.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c > index 1a593f2b2c87..3d41f0ac6595 100644 > --- a/drivers/scsi/pm8001/pm8001_hwi.c > +++ b/drivers/scsi/pm8001/pm8001_hwi.c > @@ -1325,7 +1325,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, > int q_index = circularQ - pm8001_ha->inbnd_q_tbl; > int rv; > > - WARN_ON(q_index >= PM8001_MAX_INB_NUM); > + if (WARN_ON(q_index >= pm8001_ha->max_q_num)) > + return -EINVAL; > + > spin_lock_irqsave(&circularQ->iq_lock, flags); > rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size, > &pMessage); > -- > 2.33.1.1089.g2158813163f-goog >
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 1a593f2b2c87..3d41f0ac6595 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -1325,7 +1325,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, int q_index = circularQ - pm8001_ha->inbnd_q_tbl; int rv; - WARN_ON(q_index >= PM8001_MAX_INB_NUM); + if (WARN_ON(q_index >= pm8001_ha->max_q_num)) + return -EINVAL; + spin_lock_irqsave(&circularQ->iq_lock, flags); rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size, &pMessage);