| From hch@lst.de Mon Sep 18 10:08:11 2017 |
| From: Christoph Hellwig <hch@lst.de> |
| Date: Sun, 17 Sep 2017 14:06:36 -0700 |
| Subject: xfs: check _btree_check_block value |
| To: stable@vger.kernel.org |
| Cc: linux-xfs@vger.kernel.org, "Darrick J. Wong" <darrick.wong@oracle.com> |
| Message-ID: <20170917210712.10804-12-hch@lst.de> |
| |
| |
| From: "Darrick J. Wong" <darrick.wong@oracle.com> |
| |
| commit 1e86eabe73b73c82e1110c746ed3ec6d5e1c0a0d upstream. |
| |
| Check the _btree_check_block return value for the firstrec and lastrec |
| functions, since we have the ability to signal that the repositioning |
| did not succeed. |
| |
| Fixes-coverity-id: 114067 |
| Fixes-coverity-id: 114068 |
| Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> |
| Reviewed-by: Brian Foster <bfoster@redhat.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| fs/xfs/libxfs/xfs_btree.c | 6 ++++-- |
| 1 file changed, 4 insertions(+), 2 deletions(-) |
| |
| --- a/fs/xfs/libxfs/xfs_btree.c |
| +++ b/fs/xfs/libxfs/xfs_btree.c |
| @@ -714,7 +714,8 @@ xfs_btree_firstrec( |
| * Get the block pointer for this level. |
| */ |
| block = xfs_btree_get_block(cur, level, &bp); |
| - xfs_btree_check_block(cur, block, level, bp); |
| + if (xfs_btree_check_block(cur, block, level, bp)) |
| + return 0; |
| /* |
| * It's empty, there is no such record. |
| */ |
| @@ -743,7 +744,8 @@ xfs_btree_lastrec( |
| * Get the block pointer for this level. |
| */ |
| block = xfs_btree_get_block(cur, level, &bp); |
| - xfs_btree_check_block(cur, block, level, bp); |
| + if (xfs_btree_check_block(cur, block, level, bp)) |
| + return 0; |
| /* |
| * It's empty, there is no such record. |
| */ |