Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Development (http://www.linux-archive.org/archlinux-development/)
-   -   Fix SIGSEGV in dlabel feature (#556390) (http://www.linux-archive.org/archlinux-development/311540-fix-sigsegv-dlabel-feature-556390-a.html)

Martin Sivak 01-19-2010 11:44 AM

Fix SIGSEGV in dlabel feature (#556390)
 
---
loader/driverdisk.c | 11 ++++-------
loader/loader.c | 7 +++++++
2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index e2acbc8..769d075 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -841,20 +841,17 @@ GSList* findDriverDiskByLabel(void)
return NULL;
}

- if ((ddDevice = g_slist_alloc())==NULL) {
- logMessage(ERROR, "Cannot allocate space for list of devices");
- return NULL;
- }
-
bIter = blkid_dev_iterate_begin(bCache);
blkid_dev_set_search(bIter, "LABEL", ddLabel);
while ((res = blkid_dev_next(bIter, &bDev)) == 0) {
bDev = blkid_verify(bCache, bDev);
if (!bDev)
continue;
+
+ char *devname = strdup(blkid_dev_devname(bDev));
logMessage(DEBUGLVL, "Adding driver disc %s to the list "
- "of available DDs.", blkid_dev_devname(bDev));
- ddDevice = g_slist_prepend(ddDevice, (gpointer)blkid_dev_devname(bDev));
+ "of available DDs.", devname);
+ ddDevice = g_slist_prepend(ddDevice, (gpointer)devname);
/* Freeing bDev is taken care of by the put cache call */
}
blkid_dev_iterate_end(bIter);
diff --git a/loader/loader.c b/loader/loader.c
index d8d5fd5..9bf7c2f 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1971,12 +1971,19 @@ int main(int argc, char ** argv) {
dd = findDriverDiskByLabel();
dditer = dd;
while(dditer) {
+ /* load the DD */
if (loadDriverDiskFromPartition(&loaderData, (char*)(dditer->data))) {
logMessage(ERROR, "Automatic driver disk loader failed for %s.", (char*)(dditer->data));
}
else {
logMessage(INFO, "Automatic driver disk loader succeeded for %s.", (char*)(dditer->data));
}
+
+ /* clean the device record */
+ free((char*)(dditer->data));
+ dditer->data = NULL;
+
+ /* next DD */
dditer = g_slist_next(dditer);
}
g_slist_free(dd);
--
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Hans de Goede 01-19-2010 01:37 PM

Fix SIGSEGV in dlabel feature (#556390)
 
Hi,

-ENOMEANINGFULLCOMMITMSG

Regards,

Hans

On 01/19/2010 01:44 PM, Martin Sivak wrote:

---
loader/driverdisk.c | 11 ++++-------
loader/loader.c | 7 +++++++
2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index e2acbc8..769d075 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -841,20 +841,17 @@ GSList* findDriverDiskByLabel(void)
return NULL;
}

- if ((ddDevice = g_slist_alloc())==NULL) {
- logMessage(ERROR, "Cannot allocate space for list of devices");
- return NULL;
- }
-
bIter = blkid_dev_iterate_begin(bCache);
blkid_dev_set_search(bIter, "LABEL", ddLabel);
while ((res = blkid_dev_next(bIter,&bDev)) == 0) {
bDev = blkid_verify(bCache, bDev);
if (!bDev)
continue;
+
+ char *devname = strdup(blkid_dev_devname(bDev));
logMessage(DEBUGLVL, "Adding driver disc %s to the list "
- "of available DDs.", blkid_dev_devname(bDev));
- ddDevice = g_slist_prepend(ddDevice, (gpointer)blkid_dev_devname(bDev));
+ "of available DDs.", devname);
+ ddDevice = g_slist_prepend(ddDevice, (gpointer)devname);
/* Freeing bDev is taken care of by the put cache call */
}
blkid_dev_iterate_end(bIter);
diff --git a/loader/loader.c b/loader/loader.c
index d8d5fd5..9bf7c2f 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1971,12 +1971,19 @@ int main(int argc, char ** argv) {
dd = findDriverDiskByLabel();
dditer = dd;
while(dditer) {
+ /* load the DD */
if (loadDriverDiskFromPartition(&loaderData, (char*)(dditer->data))) {
logMessage(ERROR, "Automatic driver disk loader failed for %s.", (char*)(dditer->data));
}
else {
logMessage(INFO, "Automatic driver disk loader succeeded for %s.", (char*)(dditer->data));
}
+
+ /* clean the device record */
+ free((char*)(dditer->data));
+ dditer->data = NULL;
+
+ /* next DD */
dditer = g_slist_next(dditer);
}
g_slist_free(dd);


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 03:48 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.