Re: Stale expression reference causing use-after-free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Sep 21, 2010 at 12:55 PM, Catalin Marinas
<catalin.marinas@xxxxxxx> wrote:
> Arnaud Lacombe <lacombar@xxxxxxxxx> wrote:
>> FYI, just this line makes the crash disappear, still I understand the
>> expr_free(). However, wouldn't there be a better place to initialize
>> `dir_dep' and avoid the need to use expr_free() ?
>
> dir_dep would need to be initialised somewhere, unless there is a memset
> on the whole structure (I'm not familiar enough with kbuild). But I
> think we still need the expr_free() in case dir_dep gets overwritten
> (e.g. multiple 'depends on' lines where the full expression is re-built
> on the previous line via expr_alloc_and()).
>
this is a huge shoot in the dark, but does not seem to cause any regression:

diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 23acbdb..9eee093 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -107,7 +107,6 @@ 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;
 }

 void menu_set_type(int type)
@@ -268,6 +267,7 @@ void menu_finalize(struct menu *parent)
                        basedep = expr_alloc_and(expr_copy(parentdep), basedep);
                        basedep = expr_eliminate_dups(basedep);
                        menu->dep = basedep;
+                       menu->dir_dep = expr_copy(basedep);
                        if (menu->sym)
                                prop = menu->sym->prop;
                        else


 - Arnaud
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux