From: Darrick J. Wong Date: Fri, 26 Apr 2019 20:40:05 +0000 (-0500) Subject: xfs_io: don't read garbage stack contents if INUMBERS goes nuts X-Git-Tag: v5.0.0-rc1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae2883e3422b72c92af189a2d7361e0f01ffd8a5;p=thirdparty%2Fxfsprogs-dev.git xfs_io: don't read garbage stack contents if INUMBERS goes nuts 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 Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/io/open.c b/io/open.c index f5fbd2c4f..a406ea542 100644 --- 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 */