From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4490112D754 for ; Fri, 24 May 2024 15:11:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716563463; cv=none; b=htWoiunSIeeD2Q2IhRUT+gw+UtPKy29oIff1QneRv20jBiApv/j4ws6RV1FMot03MPTO/sIhm1cZH866x8t46kxTwUubh/5p9LJjctkSqJrHAERDKwhdtGPwclLKi4WoWtEyXH/XfnsJfksG9IU1naH61D38WaJGej+U5PlXESI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716563463; c=relaxed/simple; bh=Kv+5VvpAdRJM648HeN16Hq0WSrR4I86MehPHy0QjW0k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=S+jqXabs8w2NYXDK5O7tSdxth9yL3vS3OBy4dzcFO+nb4CwoR0eh4u8D3+a3hmvFOPH3zTr1tLzKyk75vcfcCwHnkflHZln/AZOqE1hT0Q9ZL4HObG831+xh1QMH/EwYjhr01rjnBUV5Fcb7f+JtpBd5nma5NafgEyqoJOw2imQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IjK6/Ydt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IjK6/Ydt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2A62C2BBFC; Fri, 24 May 2024 15:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716563463; bh=Kv+5VvpAdRJM648HeN16Hq0WSrR4I86MehPHy0QjW0k=; h=From:To:Cc:Subject:Date:Reply-to:From; b=IjK6/YdtLkEf4c49Js9fn7wxHWO/QgzBGM2tgtvo85Lo+M4Cz8BdQBr5pnL78HXP4 23MwLmuu6Dxnvyr6vdGAjoTTvwHVRhhpDuWJzJ8zaxFedZddcC5V7zwvLconqQYvHx 6AenfaxpXESUKwssNLDJHmmZCz0oznlp4JIEimsk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47516: nfp: Fix memory leak in nfp_cpp_area_cache_add() Date: Fri, 24 May 2024 17:09:36 +0200 Message-ID: <2024052431-CVE-2021-47516-29dd@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3131; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Kv+5VvpAdRJM648HeN16Hq0WSrR4I86MehPHy0QjW0k=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkBa9cYddwzaT2elJgtvbE9dRabm6rPNg3Bno8fTA+cf C37yTy4I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACby9QPDggXp//5H2Yj4r3v0 cpblqoUTInVNFzLMz3woOCuqUTNrtZEMg3NgpiTHl0WLAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: nfp: Fix memory leak in nfp_cpp_area_cache_add() In line 800 (#1), nfp_cpp_area_alloc() allocates and initializes a CPP area structure. But in line 807 (#2), when the cache is allocated failed, this CPP area structure is not freed, which will result in memory leak. We can fix it by freeing the CPP area when the cache is allocated failed (#2). 792 int nfp_cpp_area_cache_add(struct nfp_cpp *cpp, size_t size) 793 { 794 struct nfp_cpp_area_cache *cache; 795 struct nfp_cpp_area *area; 800 area = nfp_cpp_area_alloc(cpp, NFP_CPP_ID(7, NFP_CPP_ACTION_RW, 0), 801 0, size); // #1: allocates and initializes 802 if (!area) 803 return -ENOMEM; 805 cache = kzalloc(sizeof(*cache), GFP_KERNEL); 806 if (!cache) 807 return -ENOMEM; // #2: missing free 817 return 0; 818 } The Linux kernel CVE team has assigned CVE-2021-47516 to this issue. Affected and fixed versions =========================== Issue introduced in 4.11 with commit 4cb584e0ee7d and fixed in 4.14.258 with commit 3e93abcdcec0 Issue introduced in 4.11 with commit 4cb584e0ee7d and fixed in 4.19.221 with commit eb51f639ef3f Issue introduced in 4.11 with commit 4cb584e0ee7d and fixed in 5.4.165 with commit 2e0e072e62fd Issue introduced in 4.11 with commit 4cb584e0ee7d and fixed in 5.10.85 with commit 484069b5de9d Issue introduced in 4.11 with commit 4cb584e0ee7d and fixed in 5.15.8 with commit f707820c0923 Issue introduced in 4.11 with commit 4cb584e0ee7d and fixed in 5.16 with commit c56c96303e92 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2021-47516 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/3e93abcdcec0436fbf0b6a88ae806902426895a2 https://git.kernel.org/stable/c/eb51f639ef3fd5498b7def290ed8681b6aadd9a7 https://git.kernel.org/stable/c/2e0e072e62fdaf7816220af08e05c020f0fcb77a https://git.kernel.org/stable/c/484069b5de9d223cc1c64c6f80389a99cfef51f1 https://git.kernel.org/stable/c/f707820c09239d6f67699d9b2ff57863cc7905b0 https://git.kernel.org/stable/c/c56c96303e9289cc34716b1179597b6f470833de