vfs: initialize d_iname to null for long file names
PATCH 1/1 vfs: initialize d_iname to null for long file names
dentry->d_iname is currently uninitialized for long file names. Init it to null string to avoid bad behaviors on careless references to it.
Signed-off-by Wu Fengguang <[email protected]>
---
fs/dcache.c +1 -0
@@ -929,6 +929,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)kmem_cache_free (dentry_cache, dentry);return NULL ; } + dentry->d_iname[0 ] ='\0' ; }else { dname = dentry->d_iname; }
Quoted 2 lines · Wu Fengguang
dentry->d_inameis currently uninitialized for long file names. Init it to null string to avoid bad behaviors on careless references to it.
I don't really see the point. If your code references it's already buggy. The only proper way to acces it is through dentry->d_name.