Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp169236ybp; Thu, 3 Oct 2019 11:46:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeI54mBHop7v5lT3unCkvL3IPeo9AZLo92V7N91uiAxZmvPERMtMrx0gCVCBpMRAqo+K1G X-Received: by 2002:a17:906:1f12:: with SMTP id w18mr8822847ejj.224.1570128415640; Thu, 03 Oct 2019 11:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570128415; cv=none; d=google.com; s=arc-20160816; b=Sk5Hl0qS+en/yeXPcSmPUlDum+R9r5HVo3yi8Y/vj35y3sshFkbH186Ng3M/hwLzFr SfhvNlBONibQCrSDjaAAJ03HhLnOqh8N04aIAsdqK77aAiWzScxloyO26WXoWYSI/ZfJ kESXlrqBEFtoGvZOkot/sjyD/5HB2zXxkxMEx8xxq8qOgxu45Z0R6cYPJgtgJYxoo61K WrOntwOfoMoQf3X5NKtMccIf9daPBRIDu3xXsOjNxbkcqBr1Cb9oGtxaYLCx67hlgXD6 YH+6aPYW/XooAHK2hb316qUjcEXf2wKxCkLDTsUsi0nJcDyM6D8U6VLtcMEmhS0YuaH/ JwFw== 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=q4aDEhGNSE9h0ohxr5pKUpkjVb0nj2+mPiUNrGOF8CU=; b=UYByG4dL32QHJr0U32QnskL/kc6/WMutFfZNoNP/aAKeOpqeoXuELERzTFZg0sMLIG azRKNjfVac5l4Ghjdaf0As5smb6IGCAyta4/u05JWhLMIGUwioTs+j8SGfDV6xSALDll ZFWx+Q/QysnNnP/Lfqv41wjNCsgKyj2hjYc8QzrqX2vjFYH0Lo8mR6G6PPzfWp6Vuhe0 cmZm7xGZEieUuO4rdr3xVHuz8siT6r3Gf/pBAfstglGYxdYYNuW/w+FmBsdzHtoFHDF6 fUj3jhODWMdv0XJoA5uiOoOM1gjbpqQ+5bHKKFSbXQDdog392y3DMfT/SZvvBTee7mRe 16gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oKeKwVHm; 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 n6si1961882edq.228.2019.10.03.11.46.31; Thu, 03 Oct 2019 11:46:55 -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=oKeKwVHm; 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 S2389986AbfJCRk5 (ORCPT + 99 others); Thu, 3 Oct 2019 13:40:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:42514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731339AbfJCP7a (ORCPT ); Thu, 3 Oct 2019 11:59:30 -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 65D0E207FF; Thu, 3 Oct 2019 15:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118369; bh=tZ0vg3dZimMEgTi2SUGe7lP4Vh6YFUj0YqBXkUubxTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oKeKwVHm/+gCRcux6FIGpoj2YApCB9LmBpFhwsI1wBXMSZ7Strm/P+XKsHLb9Siv+ MIzmr854o/HDxXrmwLV8hKVPYwewMpJPNlKFHOoP/sfkOAJhobslXjQPWU9Rx+tVE7 3j/1sBBbaj1oCWBDyK08MR3HoKwFuJYUABS1ifsk= 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.4 48/99] ia64:unwind: fix double free for mod->arch.init_unw_table Date: Thu, 3 Oct 2019 17:53:11 +0200 Message-Id: <20191003154318.587383181@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154252.297991283@linuxfoundation.org> References: <20191003154252.297991283@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 36b2c94a8eb5d..14c7184daaf64 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