]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
quota: fix NULL pointer dereference in report_f
authorJie Liu <jeff.liu@oracle.com>
Wed, 16 Jul 2014 03:54:47 +0000 (13:54 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 16 Jul 2014 03:54:47 +0000 (13:54 +1000)
commita14d40939de7d38029f99c10bc237bb68e83d119
tree20c23dd61ac764fa834646b227743527768151f7
parented350fc6c49155ec398866ebef1d59be02636bce
quota: fix NULL pointer dereference in report_f

Run xfs_quota report against an invalid XFS path without desired quota
limitation is enabled will hit SEGSEGV as fs_path is uninitialized, e.g.

# xfs_quota -xc 'report -up' /invalid_path
xfs_quota: cannot setup path for mount /invalid_path: No such file or directory
Segmentation fault (core dumped)

(gdb) r -xc 'report -up' /invalid_path
xfs_quota: cannot setup path for mount /invalid_path: No such file or directory

Program received signal SIGSEGV, Segmentation fault.
0x0000000000408b4d in report_f (argc=2, argv=0x105ea70) at report.c:627
627 else if (fs_path->fs_flags & FS_MOUNT_POINT)

This patch fixes report_f() to only do report if the fs_path is initialized.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
quota/report.c