Re: 2.6.24-rc6-mm1 - iget-stop-isofs-from-using-read_inode-fix-2.patch

From: David Howells
Date: Tue Feb 05 2008 - 05:09:41 EST



How about this patch?

David
---
IGET: Fix isofs_get_block() to only return 0 on success.

From: David Howells <dhowells@xxxxxxxxxx>

Fix isofs_get_block() to return only 0 on success. It shouldn't return a +ve
block count for example.

Also make sure that isofs_get_blocks() doesn't accidentally return an error if
rv is 0 come the return statement.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

fs/isofs/inode.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 0f5ed8c..875d37f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1022,6 +1022,7 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
rv++;
}

+ error = 0;
abort:
unlock_kernel();
return rv != 0 ? rv : error;
@@ -1033,12 +1034,15 @@ abort:
static int isofs_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create)
{
+ int ret;
+
if (create) {
printk(KERN_DEBUG "%s: Kernel tries to allocate a block\n", __func__);
return -EROFS;
}

- return isofs_get_blocks(inode, iblock, &bh_result, 1);
+ ret = isofs_get_blocks(inode, iblock, &bh_result, 1);
+ return ret < 0 ? ret : 0;
}

static int isofs_bmap(struct inode *inode, sector_t block)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/