Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp108790ybg; Mon, 8 Jun 2020 17:50:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/YIV7VIQWKhLfRWeGoRXN0Xn05RRcO38Mlt1cX75KJDVMSyA6Y4Z6a1X0pKlv7ONEaLya X-Received: by 2002:a50:f087:: with SMTP id v7mr23997173edl.225.1591663842684; Mon, 08 Jun 2020 17:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663842; cv=none; d=google.com; s=arc-20160816; b=Xx3TNUDkPsk2Bbz8W03yQIyUXRaK0lw0Q9+o8Emi26S1rcafXTcPiryEur+bQ94zqf wZnng8Id+HxEL5kxjE1Pxa9x7p7dPOnEweIXaCIA/erVKbhyc7dUin5eqmlh4u4wUgbt bMkavfUlgGmNhVsDp710IYNI+XyCLvKH3L83bzXWjnwSWJHFlpy60JJPZ2J1BJx+UqtB qK1+FmmCvBr1z0XrpUm6gwSooTMw2G2JiQcaCKZ2Z5R0CfWjvEIMfDGWeImxIj0BxcK4 eCW0RItCQijsNLgHBWq9Fu2rQch5BJ6Ui6fn4J9V2F8iJktiindmLFL81MCeKrQXZeR1 vYNw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FIguNxZ0fLr2sUOlUTiHHEYxyeBAYSGQ94UVlV6ym6s=; b=dqADT+TS3pgMFIABXMRBV695q6OyPcbdCBKZ7xLTdrpYXEFUUDc/HLpXfbdI0Nbnii HByL3SukuNn7Ma4M7E17ufJhmLqINM6OcZtmgXevDlypNagaeWZJ7Gf1bDGWAMwtCNQ7 sawn0L4obK8BfsrgY/f7H201buRYYeJmLyC17nxf+ndlvfOkZXFCTACdY/j5XOs5aHS1 B9Civr37ncEiNiaNkD/0fzVVIAFZJiRiHZPqZ3AwCLjdunTohPLZph6jnkrqYK5or3SL 2BkQAECoxhOZX4lxn4syXYy70DP13/baEigMVK4ZEtiCfhQ7sEpLDqchOgDauOqy79Na BwUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I9wOBa9Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt1si13273688ejc.29.2020.06.08.17.50.18; Mon, 08 Jun 2020 17:50:42 -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=I9wOBa9Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387639AbgFIAsk (ORCPT + 99 others); Mon, 8 Jun 2020 20:48:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:57320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728782AbgFHXKy (ORCPT ); Mon, 8 Jun 2020 19:10:54 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D184220CC7; Mon, 8 Jun 2020 23:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657853; bh=MPww2KMiIHzg/oIztqFpjBj3n/wGtvouVkgda4QhFYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9wOBa9ZTR/vP1qyv2pEKKq1gRtfBmoOOpNPOflBPsxfkqYGYxOEw8rxViCPb1Ko6 5ge1DU9i2n1IMVH4muN2paWlfqjKzkY6M0MkcE4GLzBLQYigHyZtjmce0Cp5ZVK38j yb4GE1ctCKX+/cIQbIXX2iry+r8Wn68JiDZFRwpg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Joyner , Tony Nguyen , Andrew Bowers , Jeff Kirsher , Sasha Levin , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 218/274] ice: Fix resource leak on early exit from function Date: Mon, 8 Jun 2020 19:05:11 -0400 Message-Id: <20200608230607.3361041-218-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Joyner [ Upstream commit 857a4f0e9f4956fffc0cedcaa2ba187a2e987153 ] Memory allocated in the ice_add_prof_id_vsig() function wasn't being properly freed if an error occurred inside the for-loop in the function. In particular, 'p' wasn't being freed if an error occurred before it was added to the resource list at the end of the for-loop. Signed-off-by: Eric Joyner Signed-off-by: Tony Nguyen Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_flex_pipe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c index e7a2671222d2..abfec38bb483 100644 --- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c +++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c @@ -3705,8 +3705,10 @@ ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, t->tcam[i].prof_id, t->tcam[i].ptg, vsig, 0, 0, vl_msk, dc_msk, nm_msk); - if (status) + if (status) { + devm_kfree(ice_hw_to_dev(hw), p); goto err_ice_add_prof_id_vsig; + } /* log change */ list_add(&p->list_entry, chg); -- 2.25.1