Hello,

I found that parted (tested on 1.6.25.1, 1.7.1 code looks the same) can
crash if libreiserfs.so is present, but is not in desired version (e.g.
0.3.1-rc). In such case libreiser.so is dlclose()d, but libreiserfs_handle
is left non-null, so reiserfs_ops_done() tries to dlclose() it again.
Patch attached.

BTW: in parted 1.7.0 and 1.7.1 <parted/device.h> file is unusable
without including <parted/contraint.h>, because of
ped_device_get_constraint() prototype (which uses PedConstraint type
from constraint.h) in device.h.
As constraint.h includes device.h anyway, I suggest to move this
prototype to constraint.h, like in the second attached patch.


-- 
Jakub Bogusz    http://qboosh.cs.net.pl/
--- parted-1.7.1/libparted/fs/reiserfs/reiserfs.c.orig  2005-11-11 
13:35:30.000000000 +0100
+++ parted-1.7.1/libparted/fs/reiserfs/reiserfs.c       2005-11-26 
23:05:42.000000000 +0100
@@ -771,6 +771,7 @@
 
 error_free_libreiserfs_handle:
        dlclose(libreiserfs_handle);
+       libreiserfs_handle = NULL;
 error:
        return 0;
 }
--- parted-1.7.1/include/parted/device.h.orig   2006-05-27 22:20:04.522149000 
+0200
+++ parted-1.7.1/include/parted/device.h        2006-05-27 22:25:19.965863750 
+0200
@@ -135,8 +135,6 @@
 extern int ped_device_sync_fast (PedDevice* dev);
 extern PedSector ped_device_check (PedDevice* dev, void* buffer,
                                    PedSector start, PedSector count);
-extern PedConstraint* ped_device_get_constraint (PedDevice* dev);
-
 /* private stuff ;-) */
 
 extern void _ped_device_probe (const char* path);
--- parted-1.7.1/include/parted/constraint.h.orig       2006-05-25 
19:28:43.000000000 +0200
+++ parted-1.7.1/include/parted/constraint.h    2006-05-27 22:25:20.497897000 
+0200
@@ -93,5 +93,8 @@
 extern PedConstraint*
 ped_constraint_exact (const PedGeometry* geom);
 
+extern PedConstraint*
+ped_device_get_constraint (PedDevice* dev);
+
 #endif /* PED_CONSTRAINT_H_INCLUDED */
 
_______________________________________________
bug-parted mailing list
bug-parted@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to