diff mbox series

xfs_db: fix crc invalidation segfault

Message ID 20200512141648.3569-1-ailiop@suse.com (mailing list archive)
State Accepted
Headers show
Series xfs_db: fix crc invalidation segfault | expand

Commit Message

Anthony Iliopoulos May 12, 2020, 2:16 p.m. UTC
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.

Fixes: b64af2c48220c8 ("xfs_db: add crc manipulation commands")
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 db/crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Sandeen May 12, 2020, 3:08 p.m. UTC | #1
On 5/12/20 9:16 AM, 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.
> 
> Fixes: b64af2c48220c8 ("xfs_db: add crc manipulation commands")
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>

Thank you for the reminder, this is staged now.

-Eric
diff mbox series

Patch

diff --git a/db/crc.c b/db/crc.c
index 95161c6dfe6a55..b23417a11a1e66 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;