xfs
[Top] [All Lists]

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

To: Eryu Guan <eguan@xxxxxxxxxx>, xfs@xxxxxxxxxxx
Subject: Re: [PATCH] xfs_quota: avoid segfault when report -h on non-existent path
From: Eric Sandeen <esandeen@xxxxxxxxxx>
Date: Tue, 18 Mar 2014 12:06:38 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1395160746-26654-1-git-send-email-eguan@xxxxxxxxxx>
References: <1395160746-26654-1-git-send-email-eguan@xxxxxxxxxx>
Reply-to: sandeen@xxxxxxxxxx
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
On 3/18/14, 11:39 AM, Eryu Guan wrote:
> 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) {
> 

I think this is ok; state_f does the same thing.

but others don't; enable_f, disable_f, off_f etc.

Also this seems to be a slight regression since v3.1.8 or so, let me double
check that and see if we need to fix something more general.

Thanks!
-Eric

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