mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
Prevent init from potentially using already freed memory when
deleting an initAction, fixing a bug pointed out by Andreas Neuhaus -Erik
This commit is contained in:
parent
0b57e28373
commit
0d4e51d390
12
init.c
12
init.c
@ -598,8 +598,8 @@ static void check_memory()
|
||||
/* Run all commands to be run right before halt/reboot */
|
||||
static void run_lastAction(void)
|
||||
{
|
||||
initAction *a;
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
initAction *a, *tmp;
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == CTRLALTDEL) {
|
||||
waitfor(a->process, a->console, FALSE);
|
||||
delete_initAction(a);
|
||||
@ -843,7 +843,7 @@ static void parse_inittab(void)
|
||||
|
||||
extern int init_main(int argc, char **argv)
|
||||
{
|
||||
initAction *a;
|
||||
initAction *a, *tmp;
|
||||
pid_t wpid;
|
||||
int status;
|
||||
|
||||
@ -938,7 +938,7 @@ extern int init_main(int argc, char **argv)
|
||||
/* Now run everything that needs to be run */
|
||||
|
||||
/* First run the sysinit command */
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == SYSINIT) {
|
||||
waitfor(a->process, a->console, FALSE);
|
||||
/* Now remove the "sysinit" entry from the list */
|
||||
@ -946,7 +946,7 @@ extern int init_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
/* Next run anything that wants to block */
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == WAIT) {
|
||||
waitfor(a->process, a->console, FALSE);
|
||||
/* Now remove the "wait" entry from the list */
|
||||
@ -954,7 +954,7 @@ extern int init_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
/* Next run anything to be run only once */
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == ONCE) {
|
||||
run(a->process, a->console, FALSE);
|
||||
/* Now remove the "once" entry from the list */
|
||||
|
12
init/init.c
12
init/init.c
@ -598,8 +598,8 @@ static void check_memory()
|
||||
/* Run all commands to be run right before halt/reboot */
|
||||
static void run_lastAction(void)
|
||||
{
|
||||
initAction *a;
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
initAction *a, *tmp;
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == CTRLALTDEL) {
|
||||
waitfor(a->process, a->console, FALSE);
|
||||
delete_initAction(a);
|
||||
@ -843,7 +843,7 @@ static void parse_inittab(void)
|
||||
|
||||
extern int init_main(int argc, char **argv)
|
||||
{
|
||||
initAction *a;
|
||||
initAction *a, *tmp;
|
||||
pid_t wpid;
|
||||
int status;
|
||||
|
||||
@ -938,7 +938,7 @@ extern int init_main(int argc, char **argv)
|
||||
/* Now run everything that needs to be run */
|
||||
|
||||
/* First run the sysinit command */
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == SYSINIT) {
|
||||
waitfor(a->process, a->console, FALSE);
|
||||
/* Now remove the "sysinit" entry from the list */
|
||||
@ -946,7 +946,7 @@ extern int init_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
/* Next run anything that wants to block */
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == WAIT) {
|
||||
waitfor(a->process, a->console, FALSE);
|
||||
/* Now remove the "wait" entry from the list */
|
||||
@ -954,7 +954,7 @@ extern int init_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
/* Next run anything to be run only once */
|
||||
for (a = initActionList; a; a = a->nextPtr) {
|
||||
for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) {
|
||||
if (a->action == ONCE) {
|
||||
run(a->process, a->console, FALSE);
|
||||
/* Now remove the "once" entry from the list */
|
||||
|
Loading…
Reference in New Issue
Block a user