@@ -1558,7 +1558,11 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
1558
1558
* be overwriting an internal NUL character
1559
1559
*/
1560
1560
dentry -> d_iname [DNAME_INLINE_LEN - 1 ] = 0 ;
1561
- if (name -> len > DNAME_INLINE_LEN - 1 ) {
1561
+ if (unlikely (!name )) {
1562
+ static const struct qstr anon = QSTR_INIT ("/" , 1 );
1563
+ name = & anon ;
1564
+ dname = dentry -> d_iname ;
1565
+ } else if (name -> len > DNAME_INLINE_LEN - 1 ) {
1562
1566
size_t size = offsetof(struct external_name , name [1 ]);
1563
1567
struct external_name * p = kmalloc (size + name -> len ,
1564
1568
GFP_KERNEL_ACCOUNT );
@@ -1812,9 +1816,7 @@ struct dentry *d_make_root(struct inode *root_inode)
1812
1816
struct dentry * res = NULL ;
1813
1817
1814
1818
if (root_inode ) {
1815
- static const struct qstr name = QSTR_INIT ("/" , 1 );
1816
-
1817
- res = __d_alloc (root_inode -> i_sb , & name );
1819
+ res = __d_alloc (root_inode -> i_sb , NULL );
1818
1820
if (res )
1819
1821
d_instantiate (res , root_inode );
1820
1822
else
@@ -1855,7 +1857,6 @@ EXPORT_SYMBOL(d_find_any_alias);
1855
1857
1856
1858
static struct dentry * __d_obtain_alias (struct inode * inode , int disconnected )
1857
1859
{
1858
- static const struct qstr anonstring = QSTR_INIT ("/" , 1 );
1859
1860
struct dentry * tmp ;
1860
1861
struct dentry * res ;
1861
1862
unsigned add_flags ;
@@ -1869,7 +1870,7 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected)
1869
1870
if (res )
1870
1871
goto out_iput ;
1871
1872
1872
- tmp = __d_alloc (inode -> i_sb , & anonstring );
1873
+ tmp = __d_alloc (inode -> i_sb , NULL );
1873
1874
if (!tmp ) {
1874
1875
res = ERR_PTR (- ENOMEM );
1875
1876
goto out_iput ;
0 commit comments