Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (C) 2011 Novell Inc. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 as published by |
| 7 | * the Free Software Foundation. |
| 8 | */ |
| 9 | |
| 10 | #include <linux/fs.h> |
| 11 | #include <linux/slab.h> |
| 12 | #include <linux/xattr.h> |
| 13 | #include "overlayfs.h" |
| 14 | |
Al Viro | 0f7ff2d | 2015-12-06 12:31:07 -0500 | [diff] [blame] | 15 | static int ovl_copy_up_truncate(struct dentry *dentry) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 16 | { |
| 17 | int err; |
| 18 | struct dentry *parent; |
| 19 | struct kstat stat; |
| 20 | struct path lowerpath; |
| 21 | |
| 22 | parent = dget_parent(dentry); |
| 23 | err = ovl_copy_up(parent); |
| 24 | if (err) |
| 25 | goto out_dput_parent; |
| 26 | |
| 27 | ovl_path_lower(dentry, &lowerpath); |
| 28 | err = vfs_getattr(&lowerpath, &stat); |
| 29 | if (err) |
| 30 | goto out_dput_parent; |
| 31 | |
Al Viro | 0f7ff2d | 2015-12-06 12:31:07 -0500 | [diff] [blame] | 32 | stat.size = 0; |
| 33 | err = ovl_copy_up_one(parent, dentry, &lowerpath, &stat); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 34 | |
| 35 | out_dput_parent: |
| 36 | dput(parent); |
| 37 | return err; |
| 38 | } |
| 39 | |
| 40 | int ovl_setattr(struct dentry *dentry, struct iattr *attr) |
| 41 | { |
| 42 | int err; |
| 43 | struct dentry *upperdentry; |
| 44 | |
Miklos Szeredi | cf9a678 | 2015-12-11 16:30:49 +0100 | [diff] [blame] | 45 | /* |
| 46 | * Check for permissions before trying to copy-up. This is redundant |
| 47 | * since it will be rechecked later by ->setattr() on upper dentry. But |
| 48 | * without this, copy-up can be triggered by just about anybody. |
| 49 | * |
| 50 | * We don't initialize inode->size, which just means that |
| 51 | * inode_newsize_ok() will always check against MAX_LFS_FILESIZE and not |
| 52 | * check for a swapfile (which this won't be anyway). |
| 53 | */ |
| 54 | err = inode_change_ok(dentry->d_inode, attr); |
| 55 | if (err) |
| 56 | return err; |
| 57 | |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 58 | err = ovl_want_write(dentry); |
| 59 | if (err) |
| 60 | goto out; |
| 61 | |
Miklos Szeredi | acff81e | 2015-12-04 19:18:48 +0100 | [diff] [blame] | 62 | err = ovl_copy_up(dentry); |
| 63 | if (!err) { |
| 64 | upperdentry = ovl_dentry_upper(dentry); |
| 65 | |
Al Viro | 5955102 | 2016-01-22 15:40:57 -0500 | [diff] [blame] | 66 | inode_lock(upperdentry->d_inode); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 67 | err = notify_change(upperdentry, attr, NULL); |
Konstantin Khlebnikov | b81de06 | 2016-01-31 16:21:29 +0300 | [diff] [blame] | 68 | if (!err) |
| 69 | ovl_copyattr(upperdentry->d_inode, dentry->d_inode); |
Al Viro | 5955102 | 2016-01-22 15:40:57 -0500 | [diff] [blame] | 70 | inode_unlock(upperdentry->d_inode); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 71 | } |
| 72 | ovl_drop_write(dentry); |
| 73 | out: |
| 74 | return err; |
| 75 | } |
| 76 | |
| 77 | static int ovl_getattr(struct vfsmount *mnt, struct dentry *dentry, |
| 78 | struct kstat *stat) |
| 79 | { |
| 80 | struct path realpath; |
| 81 | |
| 82 | ovl_path_real(dentry, &realpath); |
| 83 | return vfs_getattr(&realpath, stat); |
| 84 | } |
| 85 | |
| 86 | int ovl_permission(struct inode *inode, int mask) |
| 87 | { |
| 88 | struct ovl_entry *oe; |
| 89 | struct dentry *alias = NULL; |
| 90 | struct inode *realinode; |
| 91 | struct dentry *realdentry; |
| 92 | bool is_upper; |
| 93 | int err; |
| 94 | |
| 95 | if (S_ISDIR(inode->i_mode)) { |
| 96 | oe = inode->i_private; |
| 97 | } else if (mask & MAY_NOT_BLOCK) { |
| 98 | return -ECHILD; |
| 99 | } else { |
| 100 | /* |
| 101 | * For non-directories find an alias and get the info |
| 102 | * from there. |
| 103 | */ |
| 104 | alias = d_find_any_alias(inode); |
| 105 | if (WARN_ON(!alias)) |
| 106 | return -ENOENT; |
| 107 | |
| 108 | oe = alias->d_fsdata; |
| 109 | } |
| 110 | |
| 111 | realdentry = ovl_entry_real(oe, &is_upper); |
| 112 | |
Miklos Szeredi | 8d3095f | 2015-10-12 17:11:44 +0200 | [diff] [blame] | 113 | if (ovl_is_default_permissions(inode)) { |
| 114 | struct kstat stat; |
| 115 | struct path realpath = { .dentry = realdentry }; |
| 116 | |
| 117 | if (mask & MAY_NOT_BLOCK) |
| 118 | return -ECHILD; |
| 119 | |
| 120 | realpath.mnt = ovl_entry_mnt_real(oe, inode, is_upper); |
| 121 | |
| 122 | err = vfs_getattr(&realpath, &stat); |
| 123 | if (err) |
| 124 | return err; |
| 125 | |
| 126 | if ((stat.mode ^ inode->i_mode) & S_IFMT) |
| 127 | return -ESTALE; |
| 128 | |
| 129 | inode->i_mode = stat.mode; |
| 130 | inode->i_uid = stat.uid; |
| 131 | inode->i_gid = stat.gid; |
| 132 | |
| 133 | return generic_permission(inode, mask); |
| 134 | } |
| 135 | |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 136 | /* Careful in RCU walk mode */ |
| 137 | realinode = ACCESS_ONCE(realdentry->d_inode); |
| 138 | if (!realinode) { |
| 139 | WARN_ON(!(mask & MAY_NOT_BLOCK)); |
| 140 | err = -ENOENT; |
| 141 | goto out_dput; |
| 142 | } |
| 143 | |
| 144 | if (mask & MAY_WRITE) { |
| 145 | umode_t mode = realinode->i_mode; |
| 146 | |
| 147 | /* |
| 148 | * Writes will always be redirected to upper layer, so |
| 149 | * ignore lower layer being read-only. |
| 150 | * |
| 151 | * If the overlay itself is read-only then proceed |
| 152 | * with the permission check, don't return EROFS. |
| 153 | * This will only happen if this is the lower layer of |
| 154 | * another overlayfs. |
| 155 | * |
| 156 | * If upper fs becomes read-only after the overlay was |
| 157 | * constructed return EROFS to prevent modification of |
| 158 | * upper layer. |
| 159 | */ |
| 160 | err = -EROFS; |
| 161 | if (is_upper && !IS_RDONLY(inode) && IS_RDONLY(realinode) && |
| 162 | (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) |
| 163 | goto out_dput; |
| 164 | } |
| 165 | |
| 166 | err = __inode_permission(realinode, mask); |
| 167 | out_dput: |
| 168 | dput(alias); |
| 169 | return err; |
| 170 | } |
| 171 | |
Al Viro | 6b25539 | 2015-11-17 10:20:54 -0500 | [diff] [blame] | 172 | static const char *ovl_get_link(struct dentry *dentry, |
Al Viro | fceef39 | 2015-12-29 15:58:39 -0500 | [diff] [blame] | 173 | struct inode *inode, |
| 174 | struct delayed_call *done) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 175 | { |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 176 | struct dentry *realdentry; |
| 177 | struct inode *realinode; |
| 178 | |
Al Viro | 6b25539 | 2015-11-17 10:20:54 -0500 | [diff] [blame] | 179 | if (!dentry) |
| 180 | return ERR_PTR(-ECHILD); |
| 181 | |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 182 | realdentry = ovl_dentry_real(dentry); |
| 183 | realinode = realdentry->d_inode; |
| 184 | |
Al Viro | 6b25539 | 2015-11-17 10:20:54 -0500 | [diff] [blame] | 185 | if (WARN_ON(!realinode->i_op->get_link)) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 186 | return ERR_PTR(-EPERM); |
| 187 | |
Al Viro | fceef39 | 2015-12-29 15:58:39 -0500 | [diff] [blame] | 188 | return realinode->i_op->get_link(realdentry, realinode, done); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz) |
| 192 | { |
| 193 | struct path realpath; |
| 194 | struct inode *realinode; |
| 195 | |
| 196 | ovl_path_real(dentry, &realpath); |
| 197 | realinode = realpath.dentry->d_inode; |
| 198 | |
| 199 | if (!realinode->i_op->readlink) |
| 200 | return -EINVAL; |
| 201 | |
| 202 | touch_atime(&realpath); |
| 203 | |
| 204 | return realinode->i_op->readlink(realpath.dentry, buf, bufsiz); |
| 205 | } |
| 206 | |
| 207 | |
| 208 | static bool ovl_is_private_xattr(const char *name) |
| 209 | { |
hujianyang | cead89b | 2014-11-24 18:25:21 +0800 | [diff] [blame] | 210 | return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0; |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 211 | } |
| 212 | |
Al Viro | 3767e25 | 2016-05-27 11:06:05 -0400 | [diff] [blame] | 213 | int ovl_setxattr(struct dentry *dentry, struct inode *inode, |
| 214 | const char *name, const void *value, |
| 215 | size_t size, int flags) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 216 | { |
| 217 | int err; |
| 218 | struct dentry *upperdentry; |
| 219 | |
| 220 | err = ovl_want_write(dentry); |
| 221 | if (err) |
| 222 | goto out; |
| 223 | |
| 224 | err = -EPERM; |
| 225 | if (ovl_is_private_xattr(name)) |
| 226 | goto out_drop_write; |
| 227 | |
| 228 | err = ovl_copy_up(dentry); |
| 229 | if (err) |
| 230 | goto out_drop_write; |
| 231 | |
| 232 | upperdentry = ovl_dentry_upper(dentry); |
| 233 | err = vfs_setxattr(upperdentry, name, value, size, flags); |
| 234 | |
| 235 | out_drop_write: |
| 236 | ovl_drop_write(dentry); |
| 237 | out: |
| 238 | return err; |
| 239 | } |
| 240 | |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 241 | static bool ovl_need_xattr_filter(struct dentry *dentry, |
| 242 | enum ovl_path_type type) |
| 243 | { |
Miklos Szeredi | 1afaba1 | 2014-12-13 00:59:42 +0100 | [diff] [blame] | 244 | if ((type & (__OVL_PATH_PURE | __OVL_PATH_UPPER)) == __OVL_PATH_UPPER) |
| 245 | return S_ISDIR(dentry->d_inode->i_mode); |
| 246 | else |
| 247 | return false; |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 248 | } |
| 249 | |
Al Viro | ce23e64 | 2016-04-11 00:48:00 -0400 | [diff] [blame] | 250 | ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode, |
| 251 | const char *name, void *value, size_t size) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 252 | { |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 253 | struct path realpath; |
| 254 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); |
| 255 | |
| 256 | if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 257 | return -ENODATA; |
| 258 | |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 259 | return vfs_getxattr(realpath.dentry, name, value, size); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) |
| 263 | { |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 264 | struct path realpath; |
| 265 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 266 | ssize_t res; |
| 267 | int off; |
| 268 | |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 269 | res = vfs_listxattr(realpath.dentry, list, size); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 270 | if (res <= 0 || size == 0) |
| 271 | return res; |
| 272 | |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 273 | if (!ovl_need_xattr_filter(dentry, type)) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 274 | return res; |
| 275 | |
| 276 | /* filter out private xattrs */ |
| 277 | for (off = 0; off < res;) { |
| 278 | char *s = list + off; |
| 279 | size_t slen = strlen(s) + 1; |
| 280 | |
| 281 | BUG_ON(off + slen > res); |
| 282 | |
| 283 | if (ovl_is_private_xattr(s)) { |
| 284 | res -= slen; |
| 285 | memmove(s, s + slen, res - off); |
| 286 | } else { |
| 287 | off += slen; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | return res; |
| 292 | } |
| 293 | |
| 294 | int ovl_removexattr(struct dentry *dentry, const char *name) |
| 295 | { |
| 296 | int err; |
| 297 | struct path realpath; |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 298 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 299 | |
| 300 | err = ovl_want_write(dentry); |
| 301 | if (err) |
| 302 | goto out; |
| 303 | |
Miklos Szeredi | 5214846 | 2014-11-20 16:40:00 +0100 | [diff] [blame] | 304 | err = -ENODATA; |
| 305 | if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 306 | goto out_drop_write; |
| 307 | |
Miklos Szeredi | 1afaba1 | 2014-12-13 00:59:42 +0100 | [diff] [blame] | 308 | if (!OVL_TYPE_UPPER(type)) { |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 309 | err = vfs_getxattr(realpath.dentry, name, NULL, 0); |
| 310 | if (err < 0) |
| 311 | goto out_drop_write; |
| 312 | |
| 313 | err = ovl_copy_up(dentry); |
| 314 | if (err) |
| 315 | goto out_drop_write; |
| 316 | |
| 317 | ovl_path_upper(dentry, &realpath); |
| 318 | } |
| 319 | |
| 320 | err = vfs_removexattr(realpath.dentry, name); |
| 321 | out_drop_write: |
| 322 | ovl_drop_write(dentry); |
| 323 | out: |
| 324 | return err; |
| 325 | } |
| 326 | |
| 327 | static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type, |
| 328 | struct dentry *realdentry) |
| 329 | { |
Miklos Szeredi | 1afaba1 | 2014-12-13 00:59:42 +0100 | [diff] [blame] | 330 | if (OVL_TYPE_UPPER(type)) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 331 | return false; |
| 332 | |
| 333 | if (special_file(realdentry->d_inode->i_mode)) |
| 334 | return false; |
| 335 | |
| 336 | if (!(OPEN_FMODE(flags) & FMODE_WRITE) && !(flags & O_TRUNC)) |
| 337 | return false; |
| 338 | |
| 339 | return true; |
| 340 | } |
| 341 | |
David Howells | 4bacc9c | 2015-06-18 14:32:31 +0100 | [diff] [blame] | 342 | struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags) |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 343 | { |
| 344 | int err; |
| 345 | struct path realpath; |
| 346 | enum ovl_path_type type; |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 347 | |
Al Viro | 9391dd0 | 2015-07-12 10:39:45 -0400 | [diff] [blame] | 348 | if (d_is_dir(dentry)) |
| 349 | return d_backing_inode(dentry); |
| 350 | |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 351 | type = ovl_path_real(dentry, &realpath); |
David Howells | 4bacc9c | 2015-06-18 14:32:31 +0100 | [diff] [blame] | 352 | if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) { |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 353 | err = ovl_want_write(dentry); |
| 354 | if (err) |
David Howells | 4bacc9c | 2015-06-18 14:32:31 +0100 | [diff] [blame] | 355 | return ERR_PTR(err); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 356 | |
David Howells | 4bacc9c | 2015-06-18 14:32:31 +0100 | [diff] [blame] | 357 | if (file_flags & O_TRUNC) |
Al Viro | 0f7ff2d | 2015-12-06 12:31:07 -0500 | [diff] [blame] | 358 | err = ovl_copy_up_truncate(dentry); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 359 | else |
| 360 | err = ovl_copy_up(dentry); |
David Howells | f25801e | 2015-06-18 14:32:23 +0100 | [diff] [blame] | 361 | ovl_drop_write(dentry); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 362 | if (err) |
David Howells | 4bacc9c | 2015-06-18 14:32:31 +0100 | [diff] [blame] | 363 | return ERR_PTR(err); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 364 | |
| 365 | ovl_path_upper(dentry, &realpath); |
| 366 | } |
| 367 | |
Miklos Szeredi | 1c8a47d | 2015-10-12 15:56:20 +0200 | [diff] [blame] | 368 | if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE) |
| 369 | return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags); |
| 370 | |
David Howells | 4bacc9c | 2015-06-18 14:32:31 +0100 | [diff] [blame] | 371 | return d_backing_inode(realpath.dentry); |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 372 | } |
| 373 | |
| 374 | static const struct inode_operations ovl_file_inode_operations = { |
| 375 | .setattr = ovl_setattr, |
| 376 | .permission = ovl_permission, |
| 377 | .getattr = ovl_getattr, |
| 378 | .setxattr = ovl_setxattr, |
| 379 | .getxattr = ovl_getxattr, |
| 380 | .listxattr = ovl_listxattr, |
| 381 | .removexattr = ovl_removexattr, |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 382 | }; |
| 383 | |
| 384 | static const struct inode_operations ovl_symlink_inode_operations = { |
| 385 | .setattr = ovl_setattr, |
Al Viro | 6b25539 | 2015-11-17 10:20:54 -0500 | [diff] [blame] | 386 | .get_link = ovl_get_link, |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 387 | .readlink = ovl_readlink, |
| 388 | .getattr = ovl_getattr, |
| 389 | .setxattr = ovl_setxattr, |
| 390 | .getxattr = ovl_getxattr, |
| 391 | .listxattr = ovl_listxattr, |
| 392 | .removexattr = ovl_removexattr, |
| 393 | }; |
| 394 | |
| 395 | struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, |
| 396 | struct ovl_entry *oe) |
| 397 | { |
| 398 | struct inode *inode; |
| 399 | |
| 400 | inode = new_inode(sb); |
| 401 | if (!inode) |
| 402 | return NULL; |
| 403 | |
| 404 | mode &= S_IFMT; |
| 405 | |
| 406 | inode->i_ino = get_next_ino(); |
| 407 | inode->i_mode = mode; |
| 408 | inode->i_flags |= S_NOATIME | S_NOCMTIME; |
| 409 | |
| 410 | switch (mode) { |
| 411 | case S_IFDIR: |
| 412 | inode->i_private = oe; |
| 413 | inode->i_op = &ovl_dir_inode_operations; |
| 414 | inode->i_fop = &ovl_dir_operations; |
| 415 | break; |
| 416 | |
| 417 | case S_IFLNK: |
| 418 | inode->i_op = &ovl_symlink_inode_operations; |
| 419 | break; |
| 420 | |
| 421 | case S_IFREG: |
| 422 | case S_IFSOCK: |
| 423 | case S_IFBLK: |
| 424 | case S_IFCHR: |
| 425 | case S_IFIFO: |
| 426 | inode->i_op = &ovl_file_inode_operations; |
| 427 | break; |
| 428 | |
| 429 | default: |
| 430 | WARN(1, "illegal file type: %i\n", mode); |
| 431 | iput(inode); |
| 432 | inode = NULL; |
| 433 | } |
| 434 | |
| 435 | return inode; |
Miklos Szeredi | e9be9d5 | 2014-10-24 00:14:38 +0200 | [diff] [blame] | 436 | } |