Skip to content
Snippets Groups Projects
Commit d7884e04 authored by Tom Rini's avatar Tom Rini
Browse files

cmd_pxe.c: Pass along 'cmdtp' to do_bootm()/do_bootz()


When we call do_bootm() with a vmlinuz, this would lead to a NULL
pointer dereference, and after talking with Wolfgang the right thing to
do here for now is to make sure that we pass cmdtp to these functions
rather than NULL.

Reported-by: default avatarSteven A. Falco <stevenfalco@gmail.com>
Signed-off-by: default avatarTom Rini <trini@ti.com>
parent 3d187b39
No related branches found
No related tags found
No related merge requests found
...@@ -572,7 +572,7 @@ static int label_localboot(struct pxe_label *label) ...@@ -572,7 +572,7 @@ static int label_localboot(struct pxe_label *label)
* If the label specifies an 'append' line, its contents will overwrite that * If the label specifies an 'append' line, its contents will overwrite that
* of the 'bootargs' environment variable. * of the 'bootargs' environment variable.
*/ */
static int label_boot(struct pxe_label *label) static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
{ {
char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL }; char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
char initrd_str[22]; char initrd_str[22];
...@@ -684,11 +684,11 @@ static int label_boot(struct pxe_label *label) ...@@ -684,11 +684,11 @@ static int label_boot(struct pxe_label *label)
if (bootm_argv[3]) if (bootm_argv[3])
bootm_argc = 4; bootm_argc = 4;
do_bootm(NULL, 0, bootm_argc, bootm_argv); do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
#ifdef CONFIG_CMD_BOOTZ #ifdef CONFIG_CMD_BOOTZ
/* Try booting a zImage if do_bootm returns */ /* Try booting a zImage if do_bootm returns */
do_bootz(NULL, 0, bootm_argc, bootm_argv); do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
#endif #endif
return 1; return 1;
} }
...@@ -1355,7 +1355,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg) ...@@ -1355,7 +1355,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
/* /*
* Try to boot any labels we have yet to attempt to boot. * Try to boot any labels we have yet to attempt to boot.
*/ */
static void boot_unattempted_labels(struct pxe_menu *cfg) static void boot_unattempted_labels(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
{ {
struct list_head *pos; struct list_head *pos;
struct pxe_label *label; struct pxe_label *label;
...@@ -1364,7 +1364,7 @@ static void boot_unattempted_labels(struct pxe_menu *cfg) ...@@ -1364,7 +1364,7 @@ static void boot_unattempted_labels(struct pxe_menu *cfg)
label = list_entry(pos, struct pxe_label, list); label = list_entry(pos, struct pxe_label, list);
if (!label->attempted) if (!label->attempted)
label_boot(label); label_boot(cmdtp, label);
} }
} }
...@@ -1380,7 +1380,7 @@ static void boot_unattempted_labels(struct pxe_menu *cfg) ...@@ -1380,7 +1380,7 @@ static void boot_unattempted_labels(struct pxe_menu *cfg)
* If this function returns, there weren't any labels that successfully * If this function returns, there weren't any labels that successfully
* booted, or the user interrupted the menu selection via ctrl+c. * booted, or the user interrupted the menu selection via ctrl+c.
*/ */
static void handle_pxe_menu(struct pxe_menu *cfg) static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
{ {
void *choice; void *choice;
struct menu *m; struct menu *m;
...@@ -1406,14 +1406,14 @@ static void handle_pxe_menu(struct pxe_menu *cfg) ...@@ -1406,14 +1406,14 @@ static void handle_pxe_menu(struct pxe_menu *cfg)
*/ */
if (err == 1) { if (err == 1) {
err = label_boot(choice); err = label_boot(cmdtp, choice);
if (!err) if (!err)
return; return;
} else if (err != -ENOENT) { } else if (err != -ENOENT) {
return; return;
} }
boot_unattempted_labels(cfg); boot_unattempted_labels(cmdtp, cfg);
} }
/* /*
...@@ -1453,7 +1453,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ...@@ -1453,7 +1453,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1; return 1;
} }
handle_pxe_menu(cfg); handle_pxe_menu(cmdtp, cfg);
destroy_pxe_menu(cfg); destroy_pxe_menu(cfg);
...@@ -1559,7 +1559,7 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ...@@ -1559,7 +1559,7 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (prompt) if (prompt)
cfg->prompt = 1; cfg->prompt = 1;
handle_pxe_menu(cfg); handle_pxe_menu(cmdtp, cfg);
destroy_pxe_menu(cfg); destroy_pxe_menu(cfg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment