From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3439C3527E for ; Tue, 5 Apr 2022 11:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379364AbiDELkq (ORCPT ); Tue, 5 Apr 2022 07:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354472AbiDEKOU (ORCPT ); Tue, 5 Apr 2022 06:14:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7A76A424; Tue, 5 Apr 2022 03:00:33 -0700 (PDT) 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 2BA2AB818F6; Tue, 5 Apr 2022 10:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79F98C385A1; Tue, 5 Apr 2022 10:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152830; bh=57Bn+WXxIZqFBjJU2aM3gx6DzG/2oNf6AgrznRSIjW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MujUOygyI9DRrC1kdu3uuqhOxW4n788DYrjJjEOzuwTmgispIoHBhQXivbwKqg6QV NUtLJiQ+vrGcnsDs23+kcK4QYvl2HIWub2CaHMg0K2HLMgovBZti6P1rdHLx0o6TNX 0GunaTadQqaWYgWj375Tush3k1LeiIphYwz2r7O4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Kees Cook , "Eric W. Biederman" Subject: [PATCH 5.15 911/913] coredump: Remove the WARN_ON in dump_vma_snapshot Date: Tue, 5 Apr 2022 09:32:53 +0200 Message-Id: <20220405070407.126814127@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric W. Biederman commit 49c1866348f364478a0c4d3dd13fd08bb82d3a5b upstream. The condition is impossible and to the best of my knowledge has never triggered. We are in deep trouble if that conditions happens and we walk past the end of our allocated array. So delete the WARN_ON and the code that makes it look like the kernel can handle the case of walking past the end of it's vma_meta array. Reviewed-by: Jann Horn Reviewed-by: Kees Cook Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman --- fs/coredump.c | 6 ------ 1 file changed, 6 deletions(-) --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1151,12 +1151,6 @@ static bool dump_vma_snapshot(struct cor mmap_write_unlock(mm); - if (WARN_ON(i != cprm->vma_count)) { - kvfree(cprm->vma_meta); - return false; - } - - for (i = 0; i < cprm->vma_count; i++) { struct core_vma_metadata *m = cprm->vma_meta + i;