aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 907a3f2b4c9c..37fcf941fa3f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1506,8 +1506,6 @@ do_last:
1506 mntput(path.mnt); 1506 mntput(path.mnt);
1507 goto exit; 1507 goto exit;
1508 } 1508 }
1509 mntput(nd->mnt);
1510 nd->mnt = path.mnt;
1511 } 1509 }
1512 error = -ENOENT; 1510 error = -ENOENT;
1513 if (!path.dentry->d_inode) 1511 if (!path.dentry->d_inode)
@@ -1517,6 +1515,9 @@ do_last:
1517 1515
1518 dput(nd->dentry); 1516 dput(nd->dentry);
1519 nd->dentry = path.dentry; 1517 nd->dentry = path.dentry;
1518 if (nd->mnt != path.mnt)
1519 mntput(nd->mnt);
1520 nd->mnt = path.mnt;
1520 error = -EISDIR; 1521 error = -EISDIR;
1521 if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode)) 1522 if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
1522 goto exit; 1523 goto exit;
@@ -1528,6 +1529,9 @@ ok:
1528 1529
1529exit_dput: 1530exit_dput:
1530 dput(path.dentry); 1531 dput(path.dentry);
1532 if (nd->mnt != path.mnt)
1533 mntput(nd->mnt);
1534 nd->mnt = path.mnt;
1531exit: 1535exit:
1532 path_release(nd); 1536 path_release(nd);
1533 return error; 1537 return error;
@@ -1550,6 +1554,9 @@ do_link:
1550 error = security_inode_follow_link(path.dentry, nd); 1554 error = security_inode_follow_link(path.dentry, nd);
1551 if (error) 1555 if (error)
1552 goto exit_dput; 1556 goto exit_dput;
1557 if (nd->mnt != path.mnt)
1558 mntput(nd->mnt);
1559 nd->mnt = path.mnt;
1553 error = __do_follow_link(&path, nd); 1560 error = __do_follow_link(&path, nd);
1554 if (error) 1561 if (error)
1555 return error; 1562 return error;