]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hostfs: Handle bogus st.mode
authorRichard Weinberger <richard@nod.at>
Sun, 1 Mar 2015 23:10:25 +0000 (00:10 +0100)
committerRichard Weinberger <richard@nod.at>
Thu, 26 Mar 2015 22:27:49 +0000 (23:27 +0100)
Make sure that we return EIO if one passes an invalid st.mode
into hostfs.

Signed-off-by: Richard Weinberger <richard@nod.at>
fs/hostfs/hostfs_kern.c

index 92b008f564a457127f83c6db084d84f82fb0c9c8..8163aac81c21febcaec40a2968991c19fc7887ce 100644 (file)
@@ -534,11 +534,13 @@ static int read_name(struct inode *ino, char *name)
                init_special_inode(ino, st.mode & S_IFMT, rdev);
                ino->i_op = &hostfs_iops;
                break;
-
-       default:
+       case S_IFREG:
                ino->i_op = &hostfs_iops;
                ino->i_fop = &hostfs_file_fops;
                ino->i_mapping->a_ops = &hostfs_aops;
+               break;
+       default:
+               return -EIO;
        }
 
        ino->i_ino = st.ino;