Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1884688pxk; Tue, 1 Sep 2020 10:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSXxWXkgD3nVe0sH9MquEtmGi3i4D4u1oUeNKWgrEvqEwXLmEbJO9bn+yVmxW4zgyCs+Sb X-Received: by 2002:a17:906:4c81:: with SMTP id q1mr2303254eju.72.1598979653500; Tue, 01 Sep 2020 10:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598979653; cv=none; d=google.com; s=arc-20160816; b=cQ5PwS1TMv/zLyNX3CipkquXFJOMRlQVCO/fiCZBCRivu0jp/vE627GNIn/yxcO6mp 0c8AehHdii6ixusqxmdmRbxCPLrgAzWkoHeugeaxuftFRb9EF040QPFEi5mCi704TE7G F6MK1x/2W+wDonOh/jF+GRrWV9dxT8HgxRV6UBIo7Jnr35w7kL5cumqygzjI/4w5njBu FCqFTccbQeUp5IVy/dfI05I4xmfGKSKRGtl/dmKTe0vUwNwTul76ZlpMft82utjRf60+ 5sRyf+86GPTi+6XFu49AMfGgFYtwWkkxIOamENa8dSm1JOqR0E1TE8mxu0KhV/zspSgl oWBA== 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=namS3b5UAlxNypiD/2xrPnrHP4W+l07/9f0k61I0RJY=; b=RpWD2VkvsWujLB4M7JoD+NU70R9XlDtcn9De0PfrGc9ROf5uy8O5DGp1Zz4uPmDf9I 8rfrOCc4igo/MGvMRKT0+RZbqoL3ltXL7cG4qmh643KABa2zYuNn4QlOKZbULndmwzUU khtRusGJfrPQgYeXU4VjipLvAUkKJX3sWTgAOIvtqzBjeHqU/Nog0AFKKc/oD+8/UQUD 5IFmk5GQrERNBM+lbzjT7MF08wrjrSTofV3YwusDk0/M/p92bZBXJIJ2uVNDo4GNiOhe zuniipqCQhc8EU5nm8KuW2yhoyCCJcJ+udbZ9mi6ui5BetR1JDPBpouSbnu++qQu50DK 44Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="C/edVu0x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lf11si996337ejb.48.2020.09.01.10.00.30; Tue, 01 Sep 2020 10:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="C/edVu0x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729984AbgIAQ5t (ORCPT + 99 others); Tue, 1 Sep 2020 12:57:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:45622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729681AbgIAPXC (ORCPT ); Tue, 1 Sep 2020 11:23:02 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 EE596206FA; Tue, 1 Sep 2020 15:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598973782; bh=1RWtT8E4YoCSAVBxjIpIKeJoAnVXtAoepvZi3EKMf6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/edVu0xc6YhRdrq0vaMlmZ9FfQn8GL3jyjH+XXedZuSx0KFbyIKjIU0gh/IVRZxx 4DJdWZ3JadHq0HdZfnT63faUocA8XFhVC151nLNXA47n1FBoJcNlFIlFoqvfyfrkZi 5BQ28BoKLIW0+GOODwbJBrgE5H9yKFltMOKBxoHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Girish Basrur , Santosh Vernekar , Saurav Kashyap , Shyam Sundar , Javed Hasan , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 045/125] scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del() Date: Tue, 1 Sep 2020 17:10:00 +0200 Message-Id: <20200901150936.775948335@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150934.576210879@linuxfoundation.org> References: <20200901150934.576210879@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Javed Hasan [ Upstream commit e95b4789ff4380733006836d28e554dc296b2298 ] In fcoe_sysfs_fcf_del(), we first deleted the fcf from the list and then freed it if ctlr_dev was not NULL. This was causing a memory leak. Free the fcf even if ctlr_dev is NULL. Link: https://lore.kernel.org/r/20200729081824.30996-3-jhasan@marvell.com Reviewed-by: Girish Basrur Reviewed-by: Santosh Vernekar Reviewed-by: Saurav Kashyap Reviewed-by: Shyam Sundar Signed-off-by: Javed Hasan Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index 24cbd0a2cc69f..658c0726581f9 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c @@ -267,9 +267,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new) WARN_ON(!fcf_dev); new->fcf_dev = NULL; fcoe_fcf_device_delete(fcf_dev); - kfree(new); mutex_unlock(&cdev->lock); } + kfree(new); } /** -- 2.25.1