Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp672657img; Fri, 22 Mar 2019 06:19:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqze4f9NqqCDLkxbslaFGdnwCtRlL78EcHsr0G+7j9Tm5qUhg22SDjJuGgXRqYqXMcw8/wJC X-Received: by 2002:a63:65c4:: with SMTP id z187mr8801014pgb.102.1553260768146; Fri, 22 Mar 2019 06:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553260768; cv=none; d=google.com; s=arc-20160816; b=x+WJXPmq+Mt4TzTAgyGViD08Mk5seEKgyCf0L5rX47nrHtdbPcDXvh8CcubONop+N4 B8vHQ+Yy8wvr7d9OSN663Nzy37HPqs2b3XFwPmSJ6VC9ruxevEinErsPt8kHzSMNJPZE i2hc4SoVldm1yAFjrPDg0+Kqf+VUK2CsAalQ7qLkBtYPY6mwR+898ggJqf8a5c98eTsj XEnaKeKaDwMUZUJogwWQz/D2fPs0FZXxJpYRq13IYSrh7ZLvHwZtodGHSzTYtVH0HDwM vxCtB7ziCKVTgoK2ljpzwXzLKzGnG5ibHYwgXZHcgroIqDJrKw7kdUmU7BEWikGLWqjm GLRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OnzVXsviKQ9RvKz2AzzNFrC1FhpU8MnO3hfyUWnGZ8U=; b=m36A3Psoerdr5t8WkTOJF5D+sOGtNWq2GF5+6IKsRUZ/sLEf3SgY6Alxt9b79wIjYG t/X4BuTiwmLZO39MwP09A+p00y02D0D7X9uzPb4gPBCRAeeGJFfYKgg3mJl41wYBoAW5 fFhD98mih8NMrH9P4SZUnfytWaFMj+C45TeYLFg/imK/ITRnv1SYoVIIVWK/Cconbo0J vfYxiQE1pZsufF/nEPq1fnEcWNlNt7F/jQrEsNViE0/oesaPEnu4u0QCoVq1oMY1WM8l W/pv5nZnHpzntEOXnitwaSb6xrrtQ1TwZm6nhAkVvTlD32D8kiscVxiDchFU0+ds6Wwu AhlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wCBHmlaF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb2si7497424plb.201.2019.03.22.06.19.10; Fri, 22 Mar 2019 06:19:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wCBHmlaF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728402AbfCVLXo (ORCPT + 99 others); Fri, 22 Mar 2019 07:23:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:50694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728169AbfCVLXm (ORCPT ); Fri, 22 Mar 2019 07:23:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C4712190A; Fri, 22 Mar 2019 11:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253821; bh=pm4veDj0yz+XJ17s6duOlJGetnbxbw0C9TOBCq0pit0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wCBHmlaF5NDKx2YBQ9RwYlqGIqRBAmR1/VqHda8XDPe79XAEVlq7m1kE6EToGNeCI JRw7cF+l/JJSc++UY2/ecNp7Q/+OU48C+Z4zwv7mttmIgwK7YVjZc6U8n9LWAv8+A4 Q55s1wFfK718kEGQ7erZihRNrqh+1EwmZIzpjk68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Lu , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 3.18 065/134] scsi: libfc: free skb when receiving invalid flogi resp Date: Fri, 22 Mar 2019 12:14:38 +0100 Message-Id: <20190322111214.743178260@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 5d8fc4a9f0eec20b6c07895022a6bea3fb6dfb38 ] The issue to be fixed in this commit is when libfc found it received a invalid FLOGI response from FC switch, it would return without freeing the fc frame, which is just the skb data. This would cause memory leak if FC switch keeps sending invalid FLOGI responses. This fix is just to make it execute `fc_frame_free(fp)` before returning from function `fc_lport_flogi_resp`. Signed-off-by: Ming Lu Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libfc/fc_lport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index e01a29863c38..867fc036d6ef 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -1739,14 +1739,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, fc_frame_payload_op(fp) != ELS_LS_ACC) { FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); fc_lport_error(lport, fp); - goto err; + goto out; } flp = fc_frame_payload_get(fp, sizeof(*flp)); if (!flp) { FC_LPORT_DBG(lport, "FLOGI bad response\n"); fc_lport_error(lport, fp); - goto err; + goto out; } mfs = ntohs(flp->fl_csp.sp_bb_data) & @@ -1756,7 +1756,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " "lport->mfs:%hu\n", mfs, lport->mfs); fc_lport_error(lport, fp); - goto err; + goto out; } if (mfs <= lport->mfs) { -- 2.19.1