Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp98749ybp; Thu, 3 Oct 2019 10:44:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzTd9qG9uyAK4qN6t1cb95vO6pY+1IUVPQ9sHusUXZXHqEjEPII/E6W+HYJPr8lfz3R/Zw X-Received: by 2002:a17:906:c721:: with SMTP id fj1mr8637928ejb.177.1570124643468; Thu, 03 Oct 2019 10:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570124643; cv=none; d=google.com; s=arc-20160816; b=GGwEMgUeZLhlJW4d3QBqqDWHXp9/vpBpu6CMWHUDGtj8KIIMlmfv95Bn7bZqHX8dIH zNdOHmXlbbrmUr5wT+ZemDB60VO670geqyESEFAtjjugsjlsUdQZgq3xgEglk1zdcORc LLkPGGLq+cu1uvmMkXYhKQF7A/Vh0jb8JojVoC0AZzTLM12FPLQcZq4S+GiTL1eHbBqe L6HqquHd6Hgf+85LgsIw6BaGdj7KdETfi+/XtAnIAnqOraL5RpoMK5SziNZG7X6GFqPw WxNwBcQQL3DCmUeOUPBVDPl4oPajshnbylw3TtffDML+cK0K028CpsKhvrkYnm6xgEBM rrCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XrmhahMA5TcW0v7zvMu3hJ0MFd0Ot6PsqNh6snUP5qw=; b=lyyimu82plYsNqxlpNTSEHSxkIUMzk3dOt7xrj99bhwjR519C73v274U0QVH9VuPhb WJH5ad76y8vOAHQnxrstfXyl3SIb5riIEgJFH0U9MYGxPgHRA5U9VDhFJq30w4GBxbeq ROL3furCPgj6Vp622T/eE6fIiQCO008siBwssgzCobT9Tvl/GJ6xJJwIs4BSJVILnnMr 2g3mBaP0h69DxtnV9euc+8lTnZp9911YZpqt5YXLvBrUwOzZsOO1v4O8HOAgqcVGoLLi Go6KCKpsAEYYZQr5CLvMOvA/VQXKn0yIQVzshqVX2I77nllUUszGu7yLulOaF7AePQnY lN3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="i7n/SPCW"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ch26si1543012ejb.190.2019.10.03.10.43.39; Thu, 03 Oct 2019 10:44:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="i7n/SPCW"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732447AbfJCQQl (ORCPT + 99 others); Thu, 3 Oct 2019 12:16:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:41812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389045AbfJCQQj (ORCPT ); Thu, 3 Oct 2019 12:16:39 -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 67F2B20700; Thu, 3 Oct 2019 16:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119397; bh=NJLxmO+sPDzSi40Zm+6uwJ9bnxqS9Qk6TiNQiFwfxvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i7n/SPCWSAoMBtD8anJLDmgDb4bpR4eV+A67QpvaHUxk7pdSpEW4QoDpl79jcfxFQ a3NcvrBR2029ie6Ucfrtp3NeLvJ+QBqlYkRt/anKMd4w+OKB0rC7Tn7tM8CLh3RMnL fTiVCLFowQaWVu9xSCt9EpotO6tjpWLcdi+T9fJI= 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.19 050/211] ia64:unwind: fix double free for mod->arch.init_unw_table Date: Thu, 3 Oct 2019 17:51:56 +0200 Message-Id: <20191003154459.545070291@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 326448f9df160..1a42ba885188a 100644 --- a/arch/ia64/kernel/module.c +++ b/arch/ia64/kernel/module.c @@ -914,10 +914,14 @@ 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; + } } void *dereference_module_function_descriptor(struct module *mod, void *ptr) -- 2.20.1