Al Viro <[EMAIL PROTECTED]> wrote:

> Not enough.  isofs_iget() still can return NULL; that needs to be converted to
> ERR_PTR().
> 
> BTW, ERR_CAST is there for purpose...

This patch should probably be added on top of that one.

David
---
IGET: Add another couple of fixes to ISOFS error handling

From: David Howells <[EMAIL PROTECTED]>

Add some more fixes to ISOFS error handling on top of Al Viro's patch:

 (1) Use IS_ERR() rather than ERR_PTR() to test for errors.

 (2) Return the error from isofs_iget() in parse_rock_ridge_inode_internal().

 (3) In isofs_export_get_parent() return -ENOMEM if that was the error rather
     than -EACCES.  Should we return -EIO if that is the error rather than
     -EACCES?

Signed-off-by: David Howells <[EMAIL PROTECTED]>
---

 fs/isofs/export.c |    8 +++++---
 fs/isofs/namei.c  |    2 +-
 fs/isofs/rock.c   |    4 +++-
 3 files changed, 9 insertions(+), 5 deletions(-)


diff --git a/fs/isofs/export.c b/fs/isofs/export.c
index 63a2113..bb21913 100644
--- a/fs/isofs/export.c
+++ b/fs/isofs/export.c
@@ -26,7 +26,7 @@ isofs_export_iget(struct super_block *sb,
        if (block == 0)
                return ERR_PTR(-ESTALE);
        inode = isofs_iget(sb, block, offset);
-       if (ERR_PTR(inode))
+       if (IS_ERR(inode))
                return ERR_CAST(inode);
        if (generation && inode->i_generation != generation) {
                iput(inode);
@@ -108,8 +108,10 @@ static struct dentry *isofs_export_get_parent(struct 
dentry *child)
        parent_inode = isofs_iget(child_inode->i_sb,
                                  parent_block,
                                  parent_offset);
-       if (ERR_PTR(parent_inode)) {
-               rv = ERR_PTR(-EACCES);
+       if (IS_ERR(parent_inode)) {
+               rv = ERR_CAST(parent_inode);
+               if (rv != ERR_PTR(-ENOMEM))
+                       rv = ERR_PTR(-EACCES);
                goto out;
        }
 
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index beee021..344b247 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -179,7 +179,7 @@ struct dentry *isofs_lookup(struct inode *dir, struct 
dentry *dentry, struct nam
        inode = NULL;
        if (found) {
                inode = isofs_iget(dir->i_sb, block, offset);
-               if (ERR_PTR(inode)) {
+               if (IS_ERR(inode)) {
                        unlock_kernel();
                        return ERR_CAST(inode);
                }
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index c62b650..6bd48f0 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -474,8 +474,10 @@ repeat:
                            isofs_iget(inode->i_sb,
                                       ISOFS_I(inode)->i_first_extent,
                                       0);
-                       if (ERR_PTR(reloc))
+                       if (IS_ERR(reloc)) {
+                               ret = PTR_ERR(reloc);
                                goto out;
+                       }
                        inode->i_mode = reloc->i_mode;
                        inode->i_nlink = reloc->i_nlink;
                        inode->i_uid = reloc->i_uid;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to