BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004754 [BusyBox] Documentation minor always 08-27-08 11:00 09-28-08 16:22
Reporter Gustavo Moreira View Status public  
Assigned To BusyBox
Priority normal Resolution unable to reproduce  
Status closed   Product Version
Summary 0004754: Bug: segfault in ifup during bootup
Description Busybox ifup crashed due to a segmentation fault, when open /var/run/ifstate or (CONFIG_IFUPDOWN_IFSTATE_PATH) and not exist.

This is a strace part:

open("/var/run/ifstate", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
ioctl(2147483647, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbf90df4c) = -1 EBADF (Bad file descriptor)
brk(0x80cf000) = 0x80cf000
ioctl(2147483647, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbf90df48) = -1 EBADF (Bad file descriptor)
brk(0x80d0000) = 0x80d0000
ioctl(2147483647, SNDCTL_TMR_TIMEBASE or TCGETsh[741]: segfault at bf857000 eip b7f6a4f8 esp bf85533c error ffff0004
S, 0xbf90df44) = -1 EBADF (Bad file descriptor)
brk(0x80d1000) = 0x80d1000


This is a patch to fix it:

--- a/busybox-1.10.1/networking/ifupdown.c 2008-04-19 00:50:27.000000000 -0300
+++ b/busybox-1.10.1/networking/ifupdown.c 2008-08-27 12:11:50.000000000 -0300
@@ -1261,14 +1261,16 @@

                        /* Actually write the new state */
                        state_fp = xfopen(CONFIG_IFUPDOWN_IFSTATE_PATH, "w");
- state = state_list;
- while (state) {
- if (state->data) {
- fprintf(state_fp, "%s\n", state->data);
+ if(state_fp) {
+ state = state_list;
+ while (state) {
+ if (state->data) {
+ fprintf(state_fp, "%s\n", state->data);
+ }
+ state = state->link;
                                }
- state = state->link;
+ fclose(state_fp);
                        }
- fclose(state_fp);
                        llist_free(state_list, free);
                }
        }



Additional Information
Attached Files

- Relationships

- Notes
(0010824)
vda
08-27-08 14:45

Looks very strange. xfopen() should never return NULL.
 

- Issue History
Date Modified Username Field Change
08-27-08 11:00 Gustavo Moreira New Issue
08-27-08 11:00 Gustavo Moreira Status new => assigned
08-27-08 11:00 Gustavo Moreira Assigned To  => BusyBox
08-27-08 11:36 Gustavo Moreira Issue Monitored: Gustavo Moreira
08-27-08 14:45 vda Note Added: 0010824
09-28-08 16:22 vda Status assigned => closed
09-28-08 16:22 vda Resolution open => unable to reproduce


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker