Fix driver crash when module parameter lpfc_fcp_io_channel set to 16

Signed-off-by: Dick Kennedy <dick.kenn...@avagotech.com>
Signed-off-by: James Smart <james.sm...@avagotech.com>
---
 drivers/scsi/lpfc/lpfc_init.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index ab27d81..bd6aa8d 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8833,9 +8833,12 @@ found:
                                 * already mapped to this phys_id.
                                 */
                                if (cpup->irq != LPFC_VECTOR_MAP_EMPTY) {
-                                       chann[saved_chann] =
-                                               cpup->channel_id;
-                                       saved_chann++;
+                                       if (saved_chann <=
+                                           LPFC_FCP_IO_CHAN_MAX) {
+                                               chann[saved_chann] =
+                                                       cpup->channel_id;
+                                               saved_chann++;
+                                       }
                                        goto out;
                                }
 
-- 
1.7.11.7

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

Reply via email to