From patchwork Tue Sep 21 16:22:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 197432 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8LGMxrJ013873 for ; Tue, 21 Sep 2010 16:22:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754865Ab0IUQW6 (ORCPT ); Tue, 21 Sep 2010 12:22:58 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:49231 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754417Ab0IUQW6 (ORCPT ); Tue, 21 Sep 2010 12:22:58 -0400 Received: from cam-owa2.Emea.Arm.com (cam-owa2.emea.arm.com [10.1.105.18]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id o8LGKAF9023322; Tue, 21 Sep 2010 17:20:10 +0100 (BST) Received: from e102109-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 21 Sep 2010 17:22:54 +0100 From: Catalin Marinas To: Arnaud Lacombe Cc: Michal Marek , "linux-kbuild\@vger.kernel.org" Subject: Re: Stale expression reference causing use-after-free References: <1285072379.15732.70.camel@e102109-lin.cambridge.arm.com> Date: Tue, 21 Sep 2010 17:22:50 +0100 In-Reply-To: (Arnaud Lacombe's message of "Tue, 21 Sep 2010 10:36:43 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-OriginalArrivalTime: 21 Sep 2010 16:22:55.0001 (UTC) FILETIME=[3EE94090:01CB59A9] Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 21 Sep 2010 16:22:59 +0000 (UTC) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 7298806..e707aa2 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -107,7 +107,9 @@ static struct expr *menu_check_dep(struct expr *e) void menu_add_dep(struct expr *dep) { current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep)); - current_entry->dir_dep = current_entry->dep; + if (current_entry->dir_dep) + expr_free(current_entry->dir_dep); + current_entry->dir_dep = expr_copy(current_entry->dep); } void menu_set_type(int type)