Commit 9fa8e282 authored by Al Viro's avatar Al Viro

ext4_get_link(): fix breakage in RCU mode

1) errors from ext4_getblk() should not be propagated to caller
unless we are really sure that we would've gotten the same error
in non-RCU pathwalk.
2) we leak buffer_heads if ext4_getblk() is successful, but bh is
not uptodate.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0511fdb4
...@@ -92,10 +92,12 @@ static const char *ext4_get_link(struct dentry *dentry, struct inode *inode, ...@@ -92,10 +92,12 @@ static const char *ext4_get_link(struct dentry *dentry, struct inode *inode,
if (!dentry) { if (!dentry) {
bh = ext4_getblk(NULL, inode, 0, EXT4_GET_BLOCKS_CACHED_NOWAIT); bh = ext4_getblk(NULL, inode, 0, EXT4_GET_BLOCKS_CACHED_NOWAIT);
if (IS_ERR(bh)) if (IS_ERR(bh) || !bh)
return ERR_CAST(bh);
if (!bh || !ext4_buffer_uptodate(bh))
return ERR_PTR(-ECHILD); return ERR_PTR(-ECHILD);
if (!ext4_buffer_uptodate(bh)) {
brelse(bh);
return ERR_PTR(-ECHILD);
}
} else { } else {
bh = ext4_bread(NULL, inode, 0, 0); bh = ext4_bread(NULL, inode, 0, 0);
if (IS_ERR(bh)) if (IS_ERR(bh))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment