Skip to content

Commit

Permalink
menuconfig: fix NULL pointer dereference when searching a symbol
Browse files Browse the repository at this point in the history
Searching for PPC_EFIKA results in a segmentation fault, and it's
because get_symbol_prop() returns NULL.

In this case CONFIG_PPC_EFIKA is defined in arch/powerpc/platforms/
52xx/Kconfig, so it won't be parsed if ARCH!=PPC, but menuconfig knows
this symbol when it parses sound/soc/fsl/Kconfig:

    config SND_MPC52xx_SOC_EFIKA
        tristate "SoC AC97 Audio support for bbplan Efika and STAC9766"
        depends on PPC_EFIKA

This bug was introduced by commit bcdedcc ("menuconfig: print more
info for symbol without prompts").

Reported-and-tested-by: Borislav Petkov <[email protected]>
Signed-off-by: Li Zefan <[email protected]>
Tested-by: Libo Chen <[email protected]>
Reviewed-by: "Yann E. MORIN" <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
lizf-os authored and torvalds committed May 7, 2013
1 parent 2a437cd commit 383da76
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/kconfig/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym,
}
for_all_prompts(sym, prop)
get_prompt_str(r, prop, head);

prop = get_symbol_prop(sym);
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) {
str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
if (prop) {
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) {
str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
}
}

hit = false;
for_all_properties(sym, prop, P_SELECT) {
if (!hit) {
Expand Down

0 comments on commit 383da76

Please sign in to comment.