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 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,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 C4D72C10F14 for ; Thu, 3 Oct 2019 17:38:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E93120865 for ; Thu, 3 Oct 2019 17:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570124305; bh=CkpWK4p5Fu9ZSIpocU+cai4I/VsWfIBkOmaRArptx4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jwWryWtMU27zC9erEswlHUX1qfneTDlhEY4qYg4rhEuiIN482sJ4k3wP7y6Zcglmr 65/w7ynBdQmFKmG7c/Uo/gprZVYKR05Hl9bwKbDPu5x4RNfj0UMpUm2FwDDH592Wvw KH/WP2+ovr3fd3LIlx5KiCfVBjRvif6qLrTJiDXQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732157AbfJCRiU (ORCPT ); Thu, 3 Oct 2019 13:38:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:47760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732047AbfJCQCp (ORCPT ); Thu, 3 Oct 2019 12:02:45 -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 9D27E21848; Thu, 3 Oct 2019 16:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118564; bh=CkpWK4p5Fu9ZSIpocU+cai4I/VsWfIBkOmaRArptx4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wUKCnaRrwQ+C+Y+8tpOSg8MkvuW9/XNlS3egaTtYbjXFAJ/WCkrwaBJue/fjjXUCp VmQDw1y611Zz4sFhfKTdK4JJ4ckpZ7x+8KzyLO7OvZdn1k5EI8axn80cmrdRSEkeA7 p5NpA5AvJvbRo+m13nkITauTgeMf6va7Gil+v9n8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chenzefeng , Tony Luck , Sasha Levin Subject: [PATCH 4.9 056/129] ia64:unwind: fix double free for mod->arch.init_unw_table Date: Thu, 3 Oct 2019 17:52:59 +0200 Message-Id: <20191003154343.675214453@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154318.081116689@linuxfoundation.org> References: <20191003154318.081116689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: chenzefeng [ Upstream commit c5e5c48c16422521d363c33cfb0dcf58f88c119b ] The function free_module in file kernel/module.c as follow: void free_module(struct module *mod) { ...... module_arch_cleanup(mod); ...... module_arch_freeing_init(mod); ...... } Both module_arch_cleanup and module_arch_freeing_init function would free the mod->arch.init_unw_table, which cause double free. Here, set mod->arch.init_unw_table = NULL after remove the unwind table to avoid double free. Signed-off-by: chenzefeng Signed-off-by: Tony Luck Signed-off-by: Sasha Levin --- arch/ia64/kernel/module.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c index d1d945c6bd05f..9fe114620b9d6 100644 --- a/arch/ia64/kernel/module.c +++ b/arch/ia64/kernel/module.c @@ -912,8 +912,12 @@ module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *mo void module_arch_cleanup (struct module *mod) { - if (mod->arch.init_unw_table) + if (mod->arch.init_unw_table) { unw_remove_unwind_table(mod->arch.init_unw_table); - if (mod->arch.core_unw_table) + mod->arch.init_unw_table = NULL; + } + if (mod->arch.core_unw_table) { unw_remove_unwind_table(mod->arch.core_unw_table); + mod->arch.core_unw_table = NULL; + } } -- 2.20.1