]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: don't read garbage stack contents if INUMBERS goes nuts
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 26 Apr 2019 20:40:05 +0000 (15:40 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 26 Apr 2019 20:40:05 +0000 (15:40 -0500)
In theory INUMBERS will never return an ocount of zero, but on the off
chance it ever does we'll negative index the igroup array and return
stack contents for an inode number.  Don't do that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/open.c

index f5fbd2c4fe452d1262310deff9449a2ecdf28f7d..a406ea542eb4adb1ac822dcee5c3a0f29bf279bd 100644 (file)
--- a/io/open.c
+++ b/io/open.c
@@ -698,6 +698,9 @@ get_last_inode(void)
                lastgrp = ocount;
        }
 
+       if (lastgrp == 0)
+               return 0;
+
        lastgrp--;
 
        /* The last inode number in use */