Message ID | 20200420195235.14260-1-ailiop@suse.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xfs_db: fix crc invalidation segfault | expand |
On 4/20/20 2:52 PM, Anthony Iliopoulos wrote: > The nowrite_ops var is declared within nested block scope but used > outside that scope, causing xfs_db to crash while trying to defererence > the verify_write pointer. Fix it by lifting the declaration to the outer > scope, where it is accessed. > > Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Yup, thanks for spotting & fixing this. Fixes: b64af2c "xfs_db: add crc manipulation commands" Reviewd-by: Eric Sandeen <sandeen@redhat.com> > --- > db/crc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/db/crc.c b/db/crc.c > index 95161c6df..b23417a11 100644 > --- a/db/crc.c > +++ b/db/crc.c > @@ -53,6 +53,7 @@ crc_f( > char **argv) > { > const struct xfs_buf_ops *stashed_ops = NULL; > + struct xfs_buf_ops nowrite_ops; > extern char *progname; > const field_t *fields; > const ftattr_t *fa; > @@ -127,7 +128,6 @@ crc_f( > } > > if (invalidate) { > - struct xfs_buf_ops nowrite_ops; > flist_t *sfl; > int bit_length; > int parentoffset; >
On Mon, Apr 20, 2020 at 03:33:36PM -0500, Eric Sandeen wrote: > On 4/20/20 2:52 PM, Anthony Iliopoulos wrote: > > The nowrite_ops var is declared within nested block scope but used > > outside that scope, causing xfs_db to crash while trying to defererence > > the verify_write pointer. Fix it by lifting the declaration to the outer > > scope, where it is accessed. > > > > Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> > > Yup, thanks for spotting & fixing this. > > Fixes: b64af2c "xfs_db: add crc manipulation commands" <nitpick> commit ids should be 14(?) digits long these days. > Reviewd-by: Eric Sandeen <sandeen@redhat.com> "Pat, I'd like to buy a vowel..." :D --D > > > --- > > db/crc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/db/crc.c b/db/crc.c > > index 95161c6df..b23417a11 100644 > > --- a/db/crc.c > > +++ b/db/crc.c > > @@ -53,6 +53,7 @@ crc_f( > > char **argv) > > { > > const struct xfs_buf_ops *stashed_ops = NULL; > > + struct xfs_buf_ops nowrite_ops; > > extern char *progname; > > const field_t *fields; > > const ftattr_t *fa; > > @@ -127,7 +128,6 @@ crc_f( > > } > > > > if (invalidate) { > > - struct xfs_buf_ops nowrite_ops; > > flist_t *sfl; > > int bit_length; > > int parentoffset; > >
On 4/20/20 7:05 PM, Darrick J. Wong wrote: > On Mon, Apr 20, 2020 at 03:33:36PM -0500, Eric Sandeen wrote: >> On 4/20/20 2:52 PM, Anthony Iliopoulos wrote: >>> The nowrite_ops var is declared within nested block scope but used >>> outside that scope, causing xfs_db to crash while trying to defererence >>> the verify_write pointer. Fix it by lifting the declaration to the outer >>> scope, where it is accessed. >>> >>> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> >> >> Yup, thanks for spotting & fixing this. >> >> Fixes: b64af2c "xfs_db: add crc manipulation commands" > > <nitpick> commit ids should be 14(?) digits long these days. hm yeah I should fix that. (tho in xfsprogs probably less necessary) >> Reviewd-by: Eric Sandeen <sandeen@redhat.com> > > "Pat, I'd like to buy a vowel..." :D sigh, you'd think I'd have hotkeys by now?
diff --git a/db/crc.c b/db/crc.c index 95161c6df..b23417a11 100644 --- a/db/crc.c +++ b/db/crc.c @@ -53,6 +53,7 @@ crc_f( char **argv) { const struct xfs_buf_ops *stashed_ops = NULL; + struct xfs_buf_ops nowrite_ops; extern char *progname; const field_t *fields; const ftattr_t *fa; @@ -127,7 +128,6 @@ crc_f( } if (invalidate) { - struct xfs_buf_ops nowrite_ops; flist_t *sfl; int bit_length; int parentoffset;
The nowrite_ops var is declared within nested block scope but used outside that scope, causing xfs_db to crash while trying to defererence the verify_write pointer. Fix it by lifting the declaration to the outer scope, where it is accessed. Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> --- db/crc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)