linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: fix SIGFPE bug in align_ag_geometry
@ 2021-04-01  1:58 lixiaokeng
  2021-04-01  2:29 ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: lixiaokeng @ 2021-04-01  1:58 UTC (permalink / raw)
  To: linux-xfs, bfoster, sandeen, darrick.wong; +Cc: linfeilong, liuzhiqiang (I)

In some case, the cfg->dsunit is 32, the cfg->dswidth is zero
and cfg->agsize is 6400 in align_ag_geometry. So, the
(cfg->agsize % cfg->dswidth) will lead to coredump.

Here add check cfg->dswidth. If it is zero, goto validate.

Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
---
 mkfs/xfs_mkfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index a135e06..71d3f74 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2725,6 +2725,9 @@ _("agsize rounded to %lld, sunit = %d\n"),
 				(long long)cfg->agsize, dsunit);
 	}

+	if (!cfg->dswidth)
+		goto validate;
+
 	if ((cfg->agsize % cfg->dswidth) == 0 &&
 	    cfg->dswidth != cfg->dsunit &&
 	    cfg->agcount > 1) {
-- 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: fix SIGFPE bug in align_ag_geometry
  2021-04-01  1:58 [PATCH] xfs: fix SIGFPE bug in align_ag_geometry lixiaokeng
@ 2021-04-01  2:29 ` Gao Xiang
  2021-04-01  2:53   ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2021-04-01  2:29 UTC (permalink / raw)
  To: lixiaokeng
  Cc: linux-xfs, bfoster, sandeen, darrick.wong, linfeilong, liuzhiqiang (I)

On Thu, Apr 01, 2021 at 09:58:53AM +0800, lixiaokeng wrote:
> In some case, the cfg->dsunit is 32, the cfg->dswidth is zero
> and cfg->agsize is 6400 in align_ag_geometry. So, the
> (cfg->agsize % cfg->dswidth) will lead to coredump.
> 
> Here add check cfg->dswidth. If it is zero, goto validate.
> 

May I ask what's the command line? and is it reproducable on
the latest upstream version?

Thanks,
Gao Xiang

> Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
> ---
>  mkfs/xfs_mkfs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index a135e06..71d3f74 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -2725,6 +2725,9 @@ _("agsize rounded to %lld, sunit = %d\n"),
>  				(long long)cfg->agsize, dsunit);
>  	}
> 
> +	if (!cfg->dswidth)
> +		goto validate;
> +
>  	if ((cfg->agsize % cfg->dswidth) == 0 &&
>  	    cfg->dswidth != cfg->dsunit &&
>  	    cfg->agcount > 1) {
> -- 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: fix SIGFPE bug in align_ag_geometry
  2021-04-01  2:29 ` Gao Xiang
@ 2021-04-01  2:53   ` Gao Xiang
  0 siblings, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2021-04-01  2:53 UTC (permalink / raw)
  To: lixiaokeng
  Cc: linux-xfs, bfoster, sandeen, darrick.wong, linfeilong, liuzhiqiang (I)

On Thu, Apr 01, 2021 at 10:29:15AM +0800, Gao Xiang wrote:
> On Thu, Apr 01, 2021 at 09:58:53AM +0800, lixiaokeng wrote:
> > In some case, the cfg->dsunit is 32, the cfg->dswidth is zero
> > and cfg->agsize is 6400 in align_ag_geometry. So, the
> > (cfg->agsize % cfg->dswidth) will lead to coredump.
> > 
> > Here add check cfg->dswidth. If it is zero, goto validate.
> > 
> 
> May I ask what's the command line? and is it reproducable on
> the latest upstream version?

Btw, according to the line number of your patch format, it seems
your patch was based on "v4.17.0". May I ask which version you
were testing? If so, that is an outdated version, it'd be better
to try with latest version first.

Thanks,
Gao Xiang

> 
> Thanks,
> Gao Xiang
> 
> > Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
> > ---
> >  mkfs/xfs_mkfs.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> > index a135e06..71d3f74 100644
> > --- a/mkfs/xfs_mkfs.c
> > +++ b/mkfs/xfs_mkfs.c
> > @@ -2725,6 +2725,9 @@ _("agsize rounded to %lld, sunit = %d\n"),
> >  				(long long)cfg->agsize, dsunit);
> >  	}
> > 
> > +	if (!cfg->dswidth)
> > +		goto validate;
> > +
> >  	if ((cfg->agsize % cfg->dswidth) == 0 &&
> >  	    cfg->dswidth != cfg->dsunit &&
> >  	    cfg->agcount > 1) {
> > -- 
> > 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-01  2:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01  1:58 [PATCH] xfs: fix SIGFPE bug in align_ag_geometry lixiaokeng
2021-04-01  2:29 ` Gao Xiang
2021-04-01  2:53   ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).