Commit bd23a539d0733c9f9ec3f9fc628491fad2658e82
1 parent
eddecbb601
Exists in
master
and in
4 other branches
fix leaks in path_lookupat()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -1644,13 +1644,16 @@ |
1644 | 1644 | err = -ECHILD; |
1645 | 1645 | } |
1646 | 1646 | |
1647 | - if (!err) | |
1647 | + if (!err) { | |
1648 | 1648 | err = handle_reval_path(nd); |
1649 | + if (err) | |
1650 | + path_put(&nd->path); | |
1651 | + } | |
1649 | 1652 | |
1650 | 1653 | if (!err && nd->flags & LOOKUP_DIRECTORY) { |
1651 | 1654 | if (!nd->inode->i_op->lookup) { |
1652 | 1655 | path_put(&nd->path); |
1653 | - return -ENOTDIR; | |
1656 | + err = -ENOTDIR; | |
1654 | 1657 | } |
1655 | 1658 | } |
1656 | 1659 |