public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.24-rc6-mm1 - iget-stop-isofs-from-using-read_inode-fix-2.patch
Date: Tue, 05 Feb 2008 10:09:21 +0000	[thread overview]
Message-ID: <30832.1202206161@redhat.com> (raw)
In-Reply-To: <20420.1201625624@turing-police.cc.vt.edu>


How about this patch?

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

From: David Howells <dhowells@redhat.com>

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@redhat.com>
---

 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)

      reply	other threads:[~2008-02-05 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29 16:53 2.6.24-rc6-mm1 - iget-stop-isofs-from-using-read_inode-fix-2.patch Valdis.Kletnieks
2008-02-05 10:09 ` David Howells [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30832.1202206161@redhat.com \
    --to=dhowells@redhat.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox