From patchwork Tue Jun 15 16:59:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javed Hasan X-Patchwork-Id: 461816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66A53C48BDF for ; Tue, 15 Jun 2021 17:00:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5112061874 for ; Tue, 15 Jun 2021 17:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbhFORCM (ORCPT ); Tue, 15 Jun 2021 13:02:12 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:2522 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229528AbhFORCM (ORCPT ); Tue, 15 Jun 2021 13:02:12 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15FGu9Bc031281 for ; Tue, 15 Jun 2021 10:00:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=Q1mfWP8LG1YCXEOwb8W/D9enn5nMkZTBIJf94tn5i+g=; b=evabPOroBcJOOMoqXqCm/sVxUxo/4HZ0Vji3uo9suuAU/9arYtlzOcsKhqWG1knjdlLR Bi7GvY3ghuU0hRDQDHAtUUPWM76Bgpt3+nDdFN4E3U2h/fKVnglNnVhRkPXdwxCijals ykytXoWxUF0JwrXoVXkjcC4i0bNeDDBlp/KmsMspuWKnJnyqmLwDGVsqBxl5M63DCQQB 683Oz98B2jRQDlmV08YC7B7AjWhLPBPFhLOxa4eimVFLk28ItPkIHNCg8iqb5RupIeqV 6Scnb+a5XCYGHrp2w6Z4bt0l60e71df5vollMRt4JTyoD93+6BOgiaur3WkzYH4OuNs2 Sw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 396m0uktbn-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 15 Jun 2021 10:00:07 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 15 Jun 2021 10:00:06 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 15 Jun 2021 10:00:06 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 64CF43F7122; Tue, 15 Jun 2021 10:00:03 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 15FH037F024472; Tue, 15 Jun 2021 10:00:03 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 15FH036K024361; Tue, 15 Jun 2021 10:00:03 -0700 From: Javed Hasan To: CC: , , Subject: [PATCH] libfc: Fixed for array index out of bound exception Date: Tue, 15 Jun 2021 09:59:39 -0700 Message-ID: <20210615165939.24327-1-jhasan@marvell.com> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 X-Proofpoint-GUID: bNtmbH4bDsKR7kxrYUbyHfxNSYciMj8Y X-Proofpoint-ORIG-GUID: bNtmbH4bDsKR7kxrYUbyHfxNSYciMj8Y X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-15_07:2021-06-15,2021-06-15 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org -Fixed for array index out of bound exception in fc_rport_prli_resp(). Signed-off-by: Javed Hasan diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index cd0fb8ca2425..6fff6beee73c 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c @@ -1162,6 +1162,7 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK); FC_RPORT_DBG(rdata, "PRLI spp_flags = 0x%x spp_type 0x%x\n", pp->spp.spp_flags, pp->spp.spp_type); + rdata->spp_type = pp->spp.spp_type; if (resp_code != FC_SPP_RESP_ACK) { if (resp_code == FC_SPP_RESP_CONF) @@ -1184,11 +1185,13 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, /* * Call prli provider if we should act as a target */ - prov = fc_passive_prov[rdata->spp_type]; - if (prov) { - memset(&temp_spp, 0, sizeof(temp_spp)); - prov->prli(rdata, pp->prli.prli_spp_len, - &pp->spp, &temp_spp); + if(rdata->spp_type < FC_FC4_PROV_SIZE) { + prov = fc_passive_prov[rdata->spp_type]; + if (prov) { + memset(&temp_spp, 0, sizeof(temp_spp)); + prov->prli(rdata, pp->prli.prli_spp_len, + &pp->spp, &temp_spp); + } } /* * Check if the image pair could be established