commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 05/21: ext2fs: Fix block leak in xattr code.


From: Samuel Thibault
Subject: [hurd] 05/21: ext2fs: Fix block leak in xattr code.
Date: Sat, 04 Mar 2017 21:10:58 +0000

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

sthibault pushed a commit to branch upstream
in repository hurd.

commit 08336418301f68c87e29e3735aa83cee1bc3c9b7
Author: Justus Winter <address@hidden>
Date:   Mon Oct 3 18:12:17 2016 +0200

    ext2fs: Fix block leak in xattr code.
    
    * ext2fs/xattr.c (ext2_set_xattr): Avoid allocating and leaking a
    block if the caller tries to delete an extended attribute from a node
    that has no extended attribute in the first place.
---
 ext2fs/xattr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c
index 4592d5e..41e8c89 100644
--- a/ext2fs/xattr.c
+++ b/ext2fs/xattr.c
@@ -686,6 +686,14 @@ ext2_set_xattr (struct node *np, const char *name, const 
char *value,
   ei = dino_ref (np->cache_id);
   blkno = ei->i_file_acl;
 
+  /* Avoid allocating a block if this is a request to delete data.  */
+  if (blkno == 0 && value == NULL)
+    {
+      block = NULL;
+      err = ENODATA;
+      goto cleanup;
+    }
+
   if (blkno == 0)
     {
       /* Allocate and initialize new block */

-- 
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]