[BusyBox 0004754]: Bug: segfault in ifup during bootup

bugs at busybox.net bugs at busybox.net
Wed Aug 27 18:00:24 UTC 2008


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=4754 
====================================================================== 
Reported By:                Gustavo Moreira
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   4754
Category:                   Documentation
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             08-27-2008 11:00 PDT
Last Modified:              08-27-2008 11:00 PDT
====================================================================== 
Summary:                    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);
                }
        }




====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-27-08 11:00  Gustavo MoreiraNew Issue                                    
08-27-08 11:00  Gustavo MoreiraStatus                   new => assigned     
08-27-08 11:00  Gustavo MoreiraAssigned To               => BusyBox         
======================================================================




More information about the busybox-cvs mailing list