Hi.

libdiskfs has a nasty bug moving directories in a special case:

If the source dir's parent is not writable by you, but the dir itself is, and
you try to move it, the ext2fs server crashes leaving your fs corrupted. The
cause is that it doesn't check to see if the source dir's parent is writable
before starting the move operation.

I've put a call to fshelp_checkdirmod in. To apply the patch:

$ cd libdiskfs
$ patch < dir-renamed.patch

Richard Smith
--- dir-renamed.c	2002-10-11 18:59:59.000000000 +0100
+++ dir-renamed.c.new	2002-10-11 18:59:59.000000000 +0100
@@ -109,6 +109,12 @@
   /* Now we can safely lock fnp */
   mutex_lock (&fnp->lock);
 
+  /* Make sure the source's parent directory is writable. */
+  err = fshelp_checkdirmod (&fdp->dn_stat, &fnp->dn_stat, fromcred->user);
+
+  if (err)
+    goto out;
+
   if (tnp)
     {
       if (! S_ISDIR(tnp->dn_stat.st_mode))

Reply via email to