From patchwork Thu Dec 22 18:12:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 13080212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C6EAC001B2 for ; Thu, 22 Dec 2022 18:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oLTtVgzf71BrtZpC+19mEVhH5T0Q3GI7IX+4+Zt9Tg8=; b=oUH8TCGC7uTrEW xgBoQs7SvE9XnAMYXxIEbX/us1+4DsL9hxWmKl9DCRdt0AuDccPb3Mm8NrssyzM7lTLD2JDJ3wJMr c/GPPx79NJMKwP4u3rZDHjbdb99vOnJXa1bm+XPEOoDi7PyKw7FRePrIKlUa30d+ldXAie3zsaJFM mYefKaMj/Gxvnz7BJDy9GSImPJ4kx8TXM7bRwlyfBAO6o3e+ktU1VxMGNVqSqZd1uVKISgUOa9WbO LebFT8aymj4MmpXJ+jO0XDg1wHu7XA5kgzUlW9vknh8iUizJp6BrQ0vjK0bXFHMowcPZw7Escs1cp lQmO+++zXMjZct+3ArwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p8Q4U-00FREU-8b; Thu, 22 Dec 2022 18:13:34 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p8Q3z-00FR6T-4o for linux-arm-kernel@lists.infradead.org; Thu, 22 Dec 2022 18:13:04 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 14350B81F3A; Thu, 22 Dec 2022 18:12:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 320A0C433F0; Thu, 22 Dec 2022 18:12:56 +0000 (UTC) From: Catalin Marinas To: Will Deacon , Seth Jenkins Cc: Eric Biederman , Kees Cook , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: [PATCH 1/3] arm64: mte: Fix double-freeing of the temporary tag storage during coredump Date: Thu, 22 Dec 2022 18:12:49 +0000 Message-Id: <20221222181251.1345752-2-catalin.marinas@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221222181251.1345752-1-catalin.marinas@arm.com> References: <20221222181251.1345752-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221222_101303_355234_1F11EAC1 X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 16decce22efa ("arm64: mte: Fix the stack frame size warning in mte_dump_tag_range()") moved the temporary tag storage array from the stack to slab but it also introduced an error in double freeing this object. Remove the in-loop freeing. Fixes: 16decce22efa ("arm64: mte: Fix the stack frame size warning in mte_dump_tag_range()") Cc: # 5.18.x Signed-off-by: Catalin Marinas Reported-by: Seth Jenkins Cc: Will Deacon --- arch/arm64/kernel/elfcore.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/kernel/elfcore.c b/arch/arm64/kernel/elfcore.c index 27ef7ad3ffd2..4e3f84799669 100644 --- a/arch/arm64/kernel/elfcore.c +++ b/arch/arm64/kernel/elfcore.c @@ -65,7 +65,6 @@ static int mte_dump_tag_range(struct coredump_params *cprm, mte_save_page_tags(page_address(page), tags); put_page(page); if (!dump_emit(cprm, tags, MTE_PAGE_TAG_STORAGE)) { - mte_free_tag_storage(tags); ret = 0; break; }