From patchwork Fri Jun 19 14:32:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223976 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 9F583C433E1 for ; Fri, 19 Jun 2020 15:48:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7539121532 for ; Fri, 19 Jun 2020 15:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592581732; bh=MPww2KMiIHzg/oIztqFpjBj3n/wGtvouVkgda4QhFYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zqkaNYzOwmAnCKd9uUkR9N4uaBm4bcupYDWvN5IYdI0QQkSStQ0liSnH7A+BuPVdE mXyOi9HoOsfjJsEN4Suh3MNGvXlz9M0G4Dh9J9siLhbFsAi5AAhA3wZR/SmTecugHL NczcNi0EdT397Y0b1xHGQjaum1m/0SReAyjR40aE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393398AbgFSPZW (ORCPT ); Fri, 19 Jun 2020 11:25:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:57126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393395AbgFSPZU (ORCPT ); Fri, 19 Jun 2020 11:25:20 -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 5109420734; Fri, 19 Jun 2020 15:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580319; bh=MPww2KMiIHzg/oIztqFpjBj3n/wGtvouVkgda4QhFYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXxW9avdXkLmzb1ZSrRcEmhTu7dKfxtDMOczlYBeLAEZDF6jTUn0Z5J0nNZ4PAAz0 Zpka9JEk7InTIoKoLvjWQNpTA8pNmwjCn1alNGn02sbxBi4TQF6wHlpIfvQS8HsCKe OKQ6Pc+i44e4iUtWpnMe0waFp0d6SUIfO075lDkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Joyner , Tony Nguyen , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 5.7 204/376] ice: Fix resource leak on early exit from function Date: Fri, 19 Jun 2020 16:32:02 +0200 Message-Id: <20200619141719.995181180@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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);