From: Eric Sandeen <sandeen@sandeen.net>
To: Jeff Liu <jeff.liu@oracle.com>, "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfsprogs/quota: fix NULL pointer dereference in report_f
Date: Fri, 11 Jul 2014 20:39:45 -0500 [thread overview]
Message-ID: <53C091E1.1010907@sandeen.net> (raw)
In-Reply-To: <52849CC5.10109@oracle.com>
On 11/14/13, 3:49 AM, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@oracle.com>
>
> 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 fix 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>
I know hch had grand plans to make this all nicer, but based on Jeff's
followup emails, it looks like this is the only spot needed to simply
resolve the problems w/ nonexistent paths in quota, and is a small,
contained change we can easily make before the next point release.
Thanks,
-Eric
> ---
> quota/report.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/quota/report.c b/quota/report.c
> index 70894a2..8e3316e 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) {
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-07-12 1:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 9:49 [PATCH] xfsprogs/quota: fix NULL pointer dereference in report_f Jeff Liu
2013-11-14 14:09 ` Christoph Hellwig
2013-11-15 1:42 ` Jeff Liu
2013-11-15 14:09 ` Christoph Hellwig
2013-11-15 15:36 ` Jeff Liu
2013-11-16 2:54 ` Jeff Liu
2014-07-12 1:39 ` Eric Sandeen [this message]
2014-07-15 10:14 ` Christoph Hellwig
2014-07-15 12:54 ` Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C091E1.1010907@sandeen.net \
--to=sandeen@sandeen.net \
--cc=jeff.liu@oracle.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox