- inode leak on d_alloc_root() failure
- sanitized the cleanup logics
{
struct buffer_head *bh;
struct romfs_super_block *rsb;
+ struct inode *root;
int sz;
/* I would parse the options here, but there are none.. :) */
strnlen(rsb->name, ROMFS_MAXFN) + 1 + ROMFH_PAD)
& ROMFH_MASK;
- brelse(bh);
-
s->s_op = &romfs_ops;
+ root = iget(s, sz);
+ if (!root)
+ goto out;
+
s->s_root = d_alloc_root(iget(s, sz));
if (!s->s_root)
- goto outnobh;
+ goto outiput;
- /* Ehrhm; sorry.. :) And thanks to Hans-Joachim Widmaier :) */
- if (0) {
+ brelse(bh);
+ return 0;
+
+outiput:
+ iput(root);
out:
- brelse(bh);
+ brelse(bh);
outnobh:
- return -EINVAL;
- }
-
- return 0;
+ return -EINVAL;
}
/* That's simple too. */