xfs
[Top] [All Lists]

[PATCH] xfs_quota: avoid segfault when report -h on non-existent path

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs_quota: avoid segfault when report -h on non-existent path
From: Eryu Guan <eguan@xxxxxxxxxx>
Date: Wed, 19 Mar 2014 00:39:06 +0800
Cc: Eryu Guan <eguan@xxxxxxxxxx>, Eric Sandeen <esandeen@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Command xfs_quota -xc "report -h" /nosuchdir would get segfault, fix
that by checking fs_path first before dereferencing it.

Cc: Eric Sandeen <esandeen@xxxxxxxxxx>
Signed-off-by: Eryu Guan <eguan@xxxxxxxxxx>
---
 quota/report.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/quota/report.c b/quota/report.c
index 70894a2..d486524 100644
--- a/quota/report.c
+++ b/quota/report.c
@@ -624,7 +624,7 @@ report_f(
                if (flags & ALL_MOUNTS_FLAG)
                        report_any_type(fp, form, type, NULL,
                                        lower, upper, flags);
-               else if (fs_path->fs_flags & FS_MOUNT_POINT)
+               else if (fs_path && fs_path->fs_flags & FS_MOUNT_POINT)
                        report_any_type(fp, form, type, fs_path->fs_dir,
                                        lower, upper, flags);
        } else while (argc > optind) {
-- 
1.8.5.3

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