From: David Howells Dave Young wrote: > + if (IS_ERR(inode)) > + goto out_no_root; How about this then? David --- IGET: Handle errors in ISOFS correctly From: David Howells Handle errors in ISOFS correctly. Updated to correctly handle the iput() and re-isofs_iget() done when we change to the secondary root. Updated to return -ENOMEM from isofs_fill_super() rather than -EINVAL when the former is the actual error condition. Also to return -EIO when that occurs within isofs_iget(). Signed-off-by: David Howells Cc: "Dave Young" Signed-off-by: Andrew Morton --- fs/isofs/inode.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff -puN fs/isofs/inode.c~iget-stop-isofs-from-using-read_inode-fix-2-update fs/isofs/inode.c --- a/fs/isofs/inode.c~iget-stop-isofs-from-using-read_inode-fix-2-update +++ a/fs/isofs/inode.c @@ -551,7 +551,7 @@ static int isofs_fill_super(struct super int joliet_level = 0; int iso_blknum, block; int orig_zonesize; - int table; + int table, error = -EINVAL; unsigned int vol_desc_start; sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); @@ -809,6 +809,8 @@ root_found: * we then decide whether to use the Joliet descriptor. */ inode = isofs_iget(s, sbi->s_firstdatazone, 0); + if (IS_ERR(inode)) + goto out_no_root; /* * If this disk has both Rock Ridge and Joliet on it, then we @@ -828,6 +830,8 @@ root_found: "ISOFS: changing to secondary root\n"); iput(inode); inode = isofs_iget(s, sbi->s_firstdatazone, 0); + if (IS_ERR(inode)) + goto out_no_root; } } @@ -841,8 +845,6 @@ root_found: sbi->s_joliet_level = joliet_level; /* check the root inode */ - if (IS_ERR(inode)) - goto out_no_root; if (!inode->i_op) goto out_bad_root; @@ -879,7 +881,9 @@ out_iput: iput(inode); goto out_no_inode; out_no_root: - printk(KERN_WARNING "%s: get root inode failed\n", __func__); + error = PTR_ERR(inode); + if (error != -ENOMEM) + printk(KERN_WARNING "%s: get root inode failed\n", __func__); out_no_inode: #ifdef CONFIG_JOLIET if (sbi->s_nls_iocharset) @@ -908,7 +912,7 @@ out_freesbi: kfree(opt.iocharset); kfree(sbi); s->s_fs_info = NULL; - return -EINVAL; + return error; } static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf) _