xfs
[Top] [All Lists]

[PATCH 4/8] xfs_repair: Fix free of uninit ptr in xfs_acl_valid() error

To: xfs@xxxxxxxxxxx
Subject: [PATCH 4/8] xfs_repair: Fix free of uninit ptr in xfs_acl_valid() error path
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Sat, 26 Jan 2013 16:40:28 -0600
Cc: Eric Sandeen <sandeen@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1359240032-11576-1-git-send-email-sandeen@xxxxxxxxxx>
References: <1359240032-11576-1-git-send-email-sandeen@xxxxxxxxxx>
This error path:

xfs_acl_valid(xfs_acl_disk_t *daclp)
{
        xfs_acl_t       *aclp;
...
        if (daclp == NULL)
                goto acl_invalid;
...
acl_invalid:
        free(aclp);

attempts to free garbage; set it to NULL on init to make
it safe.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
 repair/attr_repair.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/repair/attr_repair.c b/repair/attr_repair.c
index bab65b1..ec7f4a3 100644
--- a/repair/attr_repair.c
+++ b/repair/attr_repair.c
@@ -1004,7 +1004,7 @@ process_attributes(
 static int
 xfs_acl_valid(xfs_acl_disk_t *daclp)
 {
-       xfs_acl_t       *aclp;
+       xfs_acl_t       *aclp = NULL;
        xfs_acl_entry_t *entry, *e;
        int user = 0, group = 0, other = 0, mask = 0, mask_required = 0;
        int i, j;
-- 
1.7.1

<Prev in Thread] Current Thread [Next in Thread>