Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2177262iof; Tue, 7 Jun 2022 22:16:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrwwrMTXe9mrftYXdadfXVuocy3HiEzwPezLrAJpDTOcZoPf2KA1C/U2swXO39dMi3H0BF X-Received: by 2002:a17:902:a404:b0:166:1f9b:c63a with SMTP id p4-20020a170902a40400b001661f9bc63amr32778865plq.26.1654665405071; Tue, 07 Jun 2022 22:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665405; cv=none; d=google.com; s=arc-20160816; b=RAONDfsSwIq64ApF8BgLwNM+5eXaOw0/f7+3UUm275XLMaijKzQVA88YKGr/PraS4P jzskneCeu6q9icLHz7H6/D9RWsRmDnLBZlgp1NAXxOHmvJDjdyDolMR3oX/BvWvJlTc1 li7RgUoXWpa+/wG1jTLFNcmKubVyeXYRKoF5oSw8agm3dLJb4W9HIfWLvuRTYCnWjkSc srfWfoemYYCVxjg+1YHLRMErlpPzaJMlFHGkiNXk2k6UCf8QFmcZlMFUS2groPEkgdJg FqfUyWSQT/iQ7bDnnDZmgambMYh0ukSvruU4AAEtJofdEAS9k1XdHyAKHJNnf+6+2MQM KHrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VT4V4pVTwbiDwGXsc8ScrdvsXinh8toTvJxSyn0P/ds=; b=QjgZfcCS9ZwTuBLInXnt8uTA+NXssJQZbTfv0wvYfLDNKhfT98o/+BKfiC0jC2A44I 85iSUj7bep8KiZSYVZei9wXsc4/LTQXeuYjkAuqPuQe+ZkORgryIpltHOOZIj7c6nVtn li7bXMB+84I3/JmQXFkg2kIEnprfhBePFxyQehfQrnnFqnQu2bclfzLES2DFHhm/hz41 1QQwyKZBcbrPq9qVJAcSQQ/nPgHwHqKFvzwFLIrV4vMEAu7DjrkiUZSc1j3Woe+SUKxG MIzPWA/RMQm+ze+0BcptCbFLy7xbD528dmSLI1xa+PHPyluVkoGHv+BRccpuAK6WaYTu N//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nwPtMw91; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id cm18-20020a056a00339200b0051bc3f8dd1fsi23593526pfb.38.2022.06.07.22.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:16:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nwPtMw91; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 27B9A41BCFD; Tue, 7 Jun 2022 21:46:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345944AbiFGRW5 (ORCPT + 99 others); Tue, 7 Jun 2022 13:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346095AbiFGRUY (ORCPT ); Tue, 7 Jun 2022 13:20:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF9A1053CF; Tue, 7 Jun 2022 10:20:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id A4074CE2010; Tue, 7 Jun 2022 17:20:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0958C385A5; Tue, 7 Jun 2022 17:20:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622420; bh=631zzXTjK8+QjjXWIJaDYj6zf8tmyXSMCDUzq7AasZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nwPtMw91ECrAPfveq6LhLsSEsChGdq9DWGiFtcjABfmxSYDzzw+uopzYd1raL28vl RqXkSAVC4Gld+EeLh22i6j79Lf37TiAMsevTpc208B9XsTJn0CAMc3h1/oUfns2dO6 B8pHIPT3cdTcbstwblMfah1v8DoCnNQVNfLiccfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 052/452] scsi: lpfc: Fix resource leak in lpfc_sli4_send_seq_to_ulp() Date: Tue, 7 Jun 2022 18:58:29 +0200 Message-Id: <20220607164910.097999125@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 646db1a560f44236b7278b822ca99a1d3b6ea72c ] If no handler is found in lpfc_complete_unsol_iocb() to match the rctl of a received frame, the frame is dropped and resources are leaked. Fix by returning resources when discarding an unhandled frame type. Update lpfc_fc_frame_check() handling of NOP basic link service. Link: https://lore.kernel.org/r/20220426181419.9154-1-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_sli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index a50f870c5f72..755d68b98160 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -17445,7 +17445,6 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr) case FC_RCTL_ELS_REP: /* extended link services reply */ case FC_RCTL_ELS4_REQ: /* FC-4 ELS request */ case FC_RCTL_ELS4_REP: /* FC-4 ELS reply */ - case FC_RCTL_BA_NOP: /* basic link service NOP */ case FC_RCTL_BA_ABTS: /* basic link service abort */ case FC_RCTL_BA_RMC: /* remove connection */ case FC_RCTL_BA_ACC: /* basic accept */ @@ -17466,6 +17465,7 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr) fc_vft_hdr = (struct fc_vft_header *)fc_hdr; fc_hdr = &((struct fc_frame_header *)fc_vft_hdr)[1]; return lpfc_fc_frame_check(phba, fc_hdr); + case FC_RCTL_BA_NOP: /* basic link service NOP */ default: goto drop; } @@ -18284,12 +18284,14 @@ lpfc_sli4_send_seq_to_ulp(struct lpfc_vport *vport, if (!lpfc_complete_unsol_iocb(phba, phba->sli4_hba.els_wq->pring, iocbq, fc_hdr->fh_r_ctl, - fc_hdr->fh_type)) + fc_hdr->fh_type)) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "2540 Ring %d handler: unexpected Rctl " "x%x Type x%x received\n", LPFC_ELS_RING, fc_hdr->fh_r_ctl, fc_hdr->fh_type); + lpfc_in_buf_free(phba, &seq_dmabuf->dbuf); + } /* Free iocb created in lpfc_prep_seq */ list_for_each_entry_safe(curr_iocb, next_iocb, -- 2.35.1