Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp70635ybp; Thu, 3 Oct 2019 10:18:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRPHP4WN/2yNa2U305GjbdoW/gfglYIrElp6VlaExaEIMWwuhNq5y9ZD+scr/Ubo1++W2X X-Received: by 2002:a50:ec81:: with SMTP id e1mr10746782edr.107.1570123101353; Thu, 03 Oct 2019 10:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570123101; cv=none; d=google.com; s=arc-20160816; b=1AFPA+xTHdOVM6GrApQrlu98/YoEdwTaQIbJ9zBPpIbbyk7h/3ESAYnTc0ZSFU20wo 1dc5eAyOIbTMLB4jnqn2fiOPNYep8mv7GLGs6l/78q1VKwenihVS3WHGcSN+A6BF6sms E74/ldCWevdIdqWC8dJGDNYQhJCfVzotSQnqXtvu8Mz2c/TE1NPXme7gznA9uUwjzPnB 50GbUuk57O2vB7QG1rpaNi2VKY5InzDfOfzpfmgc1UbZbQ/XZ2olpks/PFHMI6MGUtj1 iBBDdoWoJezbf8nf+oyt/aF2GlutQGeXR9U7TWFSYEgcY7QEc2+76NKdT5cyFJQ84kSw ebLw== 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=BOtShHrzJNqGvcyA/Nx1gSsyDNUZR4KtfTffbdxPCzOQOw/EPWt/a6hcqt+Nm3WEw/ wV8F/At26fKn96BEulOn1UG7DuM2lryD1FrzGnYjO7cOKdHZaBeqG9/kReyeY1JeCu0E qGI1Wx48Df9OMH4DWDkKLFL+XE7oZRNha3j5v/4Ip7uk6uRUpY0J5zEZcMH/oBZaJzvS 0usSm5naQqPnV9Efb6axBI6EUyRI8OOtAK8/4w6RUcleA24NhcnDcrzl3vlv077RzdTl 6LAke8ghAtQ+FpaUwJbk57H0hkicWQHalKKlgJ1QxcReu35pp5eImD2HOq9r73cB4enw 7FPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vhSC2mWD; 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 y26si1814175edv.134.2019.10.03.10.17.57; Thu, 03 Oct 2019 10:18:21 -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=vhSC2mWD; 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 S2391226AbfJCQ1R (ORCPT + 99 others); Thu, 3 Oct 2019 12:27:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:58900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391195AbfJCQ1L (ORCPT ); Thu, 3 Oct 2019 12:27:11 -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 A0D3B20867; Thu, 3 Oct 2019 16:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120031; bh=NJLxmO+sPDzSi40Zm+6uwJ9bnxqS9Qk6TiNQiFwfxvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhSC2mWDsxvGsRhEHG4dI78PM1J9kEtuGfyU9yeyICHD63G27uEkNicOx/LCRMPQE VSvkikz4ZNf9WQJjZFTb9zL2MJHybNgBSjHe+FTLAkTgguQFKfZxJt7uA9kBSe2udV qccL2pQEHiroshCqAAAbsvWAu2H3G8WV1obUvlIA= 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 5.2 070/313] ia64:unwind: fix double free for mod->arch.init_unw_table Date: Thu, 3 Oct 2019 17:50:48 +0200 Message-Id: <20191003154539.770094835@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@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