commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 01/06: ext2fs: Fix crash on ENOSPC while extending a directory


From: Samuel Thibault
Subject: [hurd] 01/06: ext2fs: Fix crash on ENOSPC while extending a directory
Date: Sun, 20 Nov 2016 21:18:22 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 484a67719146e819ddad64fbda23b4b23afa3095
Author: Samuel Thibault <address@hidden>
Date:   Sun Nov 20 16:19:38 2016 +0100

    ext2fs: Fix crash on ENOSPC while extending a directory
    
    * ext2fs/dir.c (diskfs_direnter_hard): Call hurd_safe_memset on
    directory extension before using it, to actually reserve room.
---
 ext2fs/dir.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index bc375c3..1097db8 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -26,6 +26,8 @@
 #include <dirent.h>
 #include <stddef.h>
 
+#include <hurd/sigpreempt.h>
+
 /* This isn't quite right because a file system block may straddle several
    device blocks, and so a write failure between writing two device blocks
    may scramble things up a bit.  But the linux doesn't do this.  We could
@@ -620,6 +622,12 @@ diskfs_direnter_hard (struct node *dp, const char *name, 
struct node *np,
        }
 
       new = (struct ext2_dir_entry_2 *) (ds->mapbuf + oldsize);
+      err = hurd_safe_memset (new, 0, DIRBLKSIZ);
+      if (err)
+       {
+         munmap ((caddr_t) ds->mapbuf, ds->mapextent);
+         return err;
+       }
 
       dp->dn_stat.st_size = oldsize + DIRBLKSIZ;
       dp->dn_set_ctime = 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]