Commit a2c36b450ee68470836cb858c58a6ba3a52c5ec5

Authored by Al Viro
1 parent c99658fe97

pull more into do_last()

Handling of LAST_DOT/LAST_ROOT/LAST_DOTDOT/terminating slash
can be pulled in as well

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 7 additions and 14 deletions Side-by-side Diff

... ... @@ -1656,6 +1656,10 @@
1656 1656  
1657 1657 *is_link = 0;
1658 1658  
  1659 + error = -EISDIR;
  1660 + if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len])
  1661 + goto exit;
  1662 +
1659 1663 mutex_lock(&dir->d_inode->i_mutex);
1660 1664  
1661 1665 path->dentry = lookup_hash(nd);
1662 1666  
... ... @@ -1826,13 +1830,8 @@
1826 1830 audit_inode(pathname, nd.path.dentry);
1827 1831  
1828 1832 /*
1829   - * We have the parent and last component. First of all, check
1830   - * that we are not asked to creat(2) an obvious directory - that
1831   - * will not do.
  1833 + * We have the parent and last component.
1832 1834 */
1833   - error = -EISDIR;
1834   - if (nd.last_type != LAST_NORM || nd.last.name[nd.last.len])
1835   - goto exit_parent;
1836 1835  
1837 1836 error = -ENFILE;
1838 1837 filp = get_empty_filp();
1839 1838  
... ... @@ -1908,16 +1907,10 @@
1908 1907 nd.flags &= ~LOOKUP_PARENT;
1909 1908 if (nd.last_type == LAST_BIND)
1910 1909 goto ok;
1911   - error = -EISDIR;
1912   - if (nd.last_type != LAST_NORM)
1913   - goto exit;
1914   - if (nd.last.name[nd.last.len]) {
1915   - __putname(nd.last.name);
1916   - goto exit;
1917   - }
1918 1910 filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode,
1919 1911 pathname, &is_link);
1920   - __putname(nd.last.name);
  1912 + if (nd.last_type == LAST_NORM)
  1913 + __putname(nd.last.name);
1921 1914 if (is_link)
1922 1915 goto do_link;
1923 1916 if (nd.root.mnt)