Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6
[firefly-linux-kernel-4.4.55.git] / mm / shmem.c
index 5ee67c9906022a15b566711da17b8c78e65fa16d..41f82bb59eec5c083e254d5db10e0eb747412ec2 100644 (file)
@@ -1843,8 +1843,9 @@ shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
 
        inode = shmem_get_inode(dir->i_sb, dir, mode, dev, VM_NORESERVE);
        if (inode) {
-               error = security_inode_init_security(inode, dir, NULL, NULL,
-                                                    NULL);
+               error = security_inode_init_security(inode, dir,
+                                                    &dentry->d_name, NULL,
+                                                    NULL, NULL);
                if (error) {
                        if (error != -EOPNOTSUPP) {
                                iput(inode);
@@ -1983,8 +1984,8 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
        if (!inode)
                return -ENOSPC;
 
-       error = security_inode_init_security(inode, dir, NULL, NULL,
-                                            NULL);
+       error = security_inode_init_security(inode, dir, &dentry->d_name, NULL,
+                                            NULL, NULL);
        if (error) {
                if (error != -EOPNOTSUPP) {
                        iput(inode);
@@ -2144,8 +2145,10 @@ static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
 {
        struct inode *inode = dentry->d_inode;
 
-       if (*len < 3)
+       if (*len < 3) {
+               *len = 3;
                return 255;
+       }
 
        if (inode_unhashed(inode)) {
                /* Unfortunately insert_inode_hash is not idempotent,