GNU Linux-libre 4.14.290-gnu1
[releases.git] / fs / overlayfs / inode.c
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/cred.h>
13 #include <linux/xattr.h>
14 #include <linux/posix_acl.h>
15 #include <linux/ratelimit.h>
16 #include "overlayfs.h"
17 #include "ovl_entry.h"
18
19 int ovl_setattr(struct dentry *dentry, struct iattr *attr)
20 {
21         int err;
22         struct dentry *upperdentry;
23         const struct cred *old_cred;
24
25         /*
26          * Check for permissions before trying to copy-up.  This is redundant
27          * since it will be rechecked later by ->setattr() on upper dentry.  But
28          * without this, copy-up can be triggered by just about anybody.
29          *
30          * We don't initialize inode->size, which just means that
31          * inode_newsize_ok() will always check against MAX_LFS_FILESIZE and not
32          * check for a swapfile (which this won't be anyway).
33          */
34         err = setattr_prepare(dentry, attr);
35         if (err)
36                 return err;
37
38         err = ovl_want_write(dentry);
39         if (err)
40                 goto out;
41
42         err = ovl_copy_up(dentry);
43         if (!err) {
44                 upperdentry = ovl_dentry_upper(dentry);
45
46                 if (attr->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
47                         attr->ia_valid &= ~ATTR_MODE;
48
49                 inode_lock(upperdentry->d_inode);
50                 old_cred = ovl_override_creds(dentry->d_sb);
51                 err = notify_change(upperdentry, attr, NULL);
52                 revert_creds(old_cred);
53                 if (!err)
54                         ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
55                 inode_unlock(upperdentry->d_inode);
56         }
57         ovl_drop_write(dentry);
58 out:
59         return err;
60 }
61
62 int ovl_getattr(const struct path *path, struct kstat *stat,
63                 u32 request_mask, unsigned int flags)
64 {
65         struct dentry *dentry = path->dentry;
66         enum ovl_path_type type;
67         struct path realpath;
68         const struct cred *old_cred;
69         bool is_dir = S_ISDIR(dentry->d_inode->i_mode);
70         int err;
71
72         type = ovl_path_real(dentry, &realpath);
73         old_cred = ovl_override_creds(dentry->d_sb);
74         err = vfs_getattr(&realpath, stat, request_mask, flags);
75         if (err)
76                 goto out;
77
78         /*
79          * When all layers are on the same fs, all real inode number are
80          * unique, so we use the overlay st_dev, which is friendly to du -x.
81          *
82          * We also use st_ino of the copy up origin, if we know it.
83          * This guaranties constant st_dev/st_ino across copy up.
84          *
85          * If filesystem supports NFS export ops, this also guaranties
86          * persistent st_ino across mount cycle.
87          */
88         if (ovl_same_sb(dentry->d_sb)) {
89                 if (OVL_TYPE_ORIGIN(type)) {
90                         struct kstat lowerstat;
91                         u32 lowermask = STATX_INO | (!is_dir ? STATX_NLINK : 0);
92
93                         ovl_path_lower(dentry, &realpath);
94                         err = vfs_getattr(&realpath, &lowerstat,
95                                           lowermask, flags);
96                         if (err)
97                                 goto out;
98
99                         WARN_ON_ONCE(stat->dev != lowerstat.dev);
100                         /*
101                          * Lower hardlinks may be broken on copy up to different
102                          * upper files, so we cannot use the lower origin st_ino
103                          * for those different files, even for the same fs case.
104                          * With inodes index enabled, it is safe to use st_ino
105                          * of an indexed hardlinked origin. The index validates
106                          * that the upper hardlink is not broken.
107                          */
108                         if (is_dir || lowerstat.nlink == 1 ||
109                             ovl_test_flag(OVL_INDEX, d_inode(dentry)))
110                                 stat->ino = lowerstat.ino;
111                 }
112                 stat->dev = dentry->d_sb->s_dev;
113         } else if (is_dir) {
114                 /*
115                  * If not all layers are on the same fs the pair {real st_ino;
116                  * overlay st_dev} is not unique, so use the non persistent
117                  * overlay st_ino.
118                  *
119                  * Always use the overlay st_dev for directories, so 'find
120                  * -xdev' will scan the entire overlay mount and won't cross the
121                  * overlay mount boundaries.
122                  */
123                 stat->dev = dentry->d_sb->s_dev;
124                 stat->ino = dentry->d_inode->i_ino;
125         }
126
127         /*
128          * It's probably not worth it to count subdirs to get the
129          * correct link count.  nlink=1 seems to pacify 'find' and
130          * other utilities.
131          */
132         if (is_dir && OVL_TYPE_MERGE(type))
133                 stat->nlink = 1;
134
135         /*
136          * Return the overlay inode nlinks for indexed upper inodes.
137          * Overlay inode nlink counts the union of the upper hardlinks
138          * and non-covered lower hardlinks. It does not include the upper
139          * index hardlink.
140          */
141         if (!is_dir && ovl_test_flag(OVL_INDEX, d_inode(dentry)))
142                 stat->nlink = dentry->d_inode->i_nlink;
143
144 out:
145         revert_creds(old_cred);
146
147         return err;
148 }
149
150 int ovl_permission(struct inode *inode, int mask)
151 {
152         struct inode *upperinode = ovl_inode_upper(inode);
153         struct inode *realinode = upperinode ?: ovl_inode_lower(inode);
154         const struct cred *old_cred;
155         int err;
156
157         /* Careful in RCU walk mode */
158         if (!realinode) {
159                 WARN_ON(!(mask & MAY_NOT_BLOCK));
160                 return -ECHILD;
161         }
162
163         /*
164          * Check overlay inode with the creds of task and underlying inode
165          * with creds of mounter
166          */
167         err = generic_permission(inode, mask);
168         if (err)
169                 return err;
170
171         old_cred = ovl_override_creds(inode->i_sb);
172         if (!upperinode &&
173             !special_file(realinode->i_mode) && mask & MAY_WRITE) {
174                 mask &= ~(MAY_WRITE | MAY_APPEND);
175                 /* Make sure mounter can read file for copy up later */
176                 mask |= MAY_READ;
177         }
178         err = inode_permission(realinode, mask);
179         revert_creds(old_cred);
180
181         return err;
182 }
183
184 static const char *ovl_get_link(struct dentry *dentry,
185                                 struct inode *inode,
186                                 struct delayed_call *done)
187 {
188         const struct cred *old_cred;
189         const char *p;
190
191         if (!dentry)
192                 return ERR_PTR(-ECHILD);
193
194         old_cred = ovl_override_creds(dentry->d_sb);
195         p = vfs_get_link(ovl_dentry_real(dentry), done);
196         revert_creds(old_cred);
197         return p;
198 }
199
200 bool ovl_is_private_xattr(const char *name)
201 {
202         return strncmp(name, OVL_XATTR_PREFIX,
203                        sizeof(OVL_XATTR_PREFIX) - 1) == 0;
204 }
205
206 int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
207                   const void *value, size_t size, int flags)
208 {
209         int err;
210         struct dentry *upperdentry = ovl_i_dentry_upper(inode);
211         struct dentry *realdentry = upperdentry ?: ovl_dentry_lower(dentry);
212         const struct cred *old_cred;
213
214         err = ovl_want_write(dentry);
215         if (err)
216                 goto out;
217
218         if (!value && !upperdentry) {
219                 old_cred = ovl_override_creds(dentry->d_sb);
220                 err = vfs_getxattr(realdentry, name, NULL, 0);
221                 revert_creds(old_cred);
222                 if (err < 0)
223                         goto out_drop_write;
224         }
225
226         if (!upperdentry) {
227                 err = ovl_copy_up(dentry);
228                 if (err)
229                         goto out_drop_write;
230
231                 realdentry = ovl_dentry_upper(dentry);
232         }
233
234         old_cred = ovl_override_creds(dentry->d_sb);
235         if (value)
236                 err = vfs_setxattr(realdentry, name, value, size, flags);
237         else {
238                 WARN_ON(flags != XATTR_REPLACE);
239                 err = vfs_removexattr(realdentry, name);
240         }
241         revert_creds(old_cred);
242
243 out_drop_write:
244         ovl_drop_write(dentry);
245 out:
246         return err;
247 }
248
249 int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
250                   void *value, size_t size)
251 {
252         ssize_t res;
253         const struct cred *old_cred;
254         struct dentry *realdentry =
255                 ovl_i_dentry_upper(inode) ?: ovl_dentry_lower(dentry);
256
257         old_cred = ovl_override_creds(dentry->d_sb);
258         res = vfs_getxattr(realdentry, name, value, size);
259         revert_creds(old_cred);
260         return res;
261 }
262
263 static bool ovl_can_list(const char *s)
264 {
265         /* List all non-trusted xatts */
266         if (strncmp(s, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) != 0)
267                 return true;
268
269         /* Never list trusted.overlay, list other trusted for superuser only */
270         return !ovl_is_private_xattr(s) &&
271                ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN);
272 }
273
274 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)
275 {
276         struct dentry *realdentry = ovl_dentry_real(dentry);
277         ssize_t res;
278         size_t len;
279         char *s;
280         const struct cred *old_cred;
281
282         old_cred = ovl_override_creds(dentry->d_sb);
283         res = vfs_listxattr(realdentry, list, size);
284         revert_creds(old_cred);
285         if (res <= 0 || size == 0)
286                 return res;
287
288         /* filter out private xattrs */
289         for (s = list, len = res; len;) {
290                 size_t slen = strnlen(s, len) + 1;
291
292                 /* underlying fs providing us with an broken xattr list? */
293                 if (WARN_ON(slen > len))
294                         return -EIO;
295
296                 len -= slen;
297                 if (!ovl_can_list(s)) {
298                         res -= slen;
299                         memmove(s, s + slen, len);
300                 } else {
301                         s += slen;
302                 }
303         }
304
305         return res;
306 }
307
308 struct posix_acl *ovl_get_acl(struct inode *inode, int type)
309 {
310         struct inode *realinode = ovl_inode_real(inode);
311         const struct cred *old_cred;
312         struct posix_acl *acl;
313
314         if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !IS_POSIXACL(realinode))
315                 return NULL;
316
317         old_cred = ovl_override_creds(inode->i_sb);
318         acl = get_acl(realinode, type);
319         revert_creds(old_cred);
320
321         return acl;
322 }
323
324 static bool ovl_open_need_copy_up(struct dentry *dentry, int flags)
325 {
326         if (ovl_dentry_upper(dentry) &&
327             ovl_dentry_has_upper_alias(dentry))
328                 return false;
329
330         if (special_file(d_inode(dentry)->i_mode))
331                 return false;
332
333         if (!(OPEN_FMODE(flags) & FMODE_WRITE) && !(flags & O_TRUNC))
334                 return false;
335
336         return true;
337 }
338
339 int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags)
340 {
341         int err = 0;
342
343         if (ovl_open_need_copy_up(dentry, file_flags)) {
344                 err = ovl_want_write(dentry);
345                 if (!err) {
346                         err = ovl_copy_up_flags(dentry, file_flags);
347                         ovl_drop_write(dentry);
348                 }
349         }
350
351         return err;
352 }
353
354 int ovl_update_time(struct inode *inode, struct timespec *ts, int flags)
355 {
356         struct dentry *alias;
357         struct path upperpath;
358
359         if (!(flags & S_ATIME))
360                 return 0;
361
362         alias = d_find_any_alias(inode);
363         if (!alias)
364                 return 0;
365
366         ovl_path_upper(alias, &upperpath);
367         if (upperpath.dentry) {
368                 touch_atime(&upperpath);
369                 inode->i_atime = d_inode(upperpath.dentry)->i_atime;
370         }
371
372         dput(alias);
373
374         return 0;
375 }
376
377 static const struct inode_operations ovl_file_inode_operations = {
378         .setattr        = ovl_setattr,
379         .permission     = ovl_permission,
380         .getattr        = ovl_getattr,
381         .listxattr      = ovl_listxattr,
382         .get_acl        = ovl_get_acl,
383         .update_time    = ovl_update_time,
384 };
385
386 static const struct inode_operations ovl_symlink_inode_operations = {
387         .setattr        = ovl_setattr,
388         .get_link       = ovl_get_link,
389         .getattr        = ovl_getattr,
390         .listxattr      = ovl_listxattr,
391         .update_time    = ovl_update_time,
392 };
393
394 /*
395  * It is possible to stack overlayfs instance on top of another
396  * overlayfs instance as lower layer. We need to annonate the
397  * stackable i_mutex locks according to stack level of the super
398  * block instance. An overlayfs instance can never be in stack
399  * depth 0 (there is always a real fs below it).  An overlayfs
400  * inode lock will use the lockdep annotaion ovl_i_mutex_key[depth].
401  *
402  * For example, here is a snip from /proc/lockdep_chains after
403  * dir_iterate of nested overlayfs:
404  *
405  * [...] &ovl_i_mutex_dir_key[depth]   (stack_depth=2)
406  * [...] &ovl_i_mutex_dir_key[depth]#2 (stack_depth=1)
407  * [...] &type->i_mutex_dir_key        (stack_depth=0)
408  */
409 #define OVL_MAX_NESTING FILESYSTEM_MAX_STACK_DEPTH
410
411 static inline void ovl_lockdep_annotate_inode_mutex_key(struct inode *inode)
412 {
413 #ifdef CONFIG_LOCKDEP
414         static struct lock_class_key ovl_i_mutex_key[OVL_MAX_NESTING];
415         static struct lock_class_key ovl_i_mutex_dir_key[OVL_MAX_NESTING];
416
417         int depth = inode->i_sb->s_stack_depth - 1;
418
419         if (WARN_ON_ONCE(depth < 0 || depth >= OVL_MAX_NESTING))
420                 depth = 0;
421
422         if (S_ISDIR(inode->i_mode))
423                 lockdep_set_class(&inode->i_rwsem, &ovl_i_mutex_dir_key[depth]);
424         else
425                 lockdep_set_class(&inode->i_rwsem, &ovl_i_mutex_key[depth]);
426 #endif
427 }
428
429 static void ovl_fill_inode(struct inode *inode, umode_t mode, dev_t rdev)
430 {
431         inode->i_ino = get_next_ino();
432         inode->i_mode = mode;
433         inode->i_flags |= S_NOCMTIME;
434 #ifdef CONFIG_FS_POSIX_ACL
435         inode->i_acl = inode->i_default_acl = ACL_DONT_CACHE;
436 #endif
437
438         ovl_lockdep_annotate_inode_mutex_key(inode);
439
440         switch (mode & S_IFMT) {
441         case S_IFREG:
442                 inode->i_op = &ovl_file_inode_operations;
443                 break;
444
445         case S_IFDIR:
446                 inode->i_op = &ovl_dir_inode_operations;
447                 inode->i_fop = &ovl_dir_operations;
448                 break;
449
450         case S_IFLNK:
451                 inode->i_op = &ovl_symlink_inode_operations;
452                 break;
453
454         default:
455                 inode->i_op = &ovl_file_inode_operations;
456                 init_special_inode(inode, mode, rdev);
457                 break;
458         }
459 }
460
461 /*
462  * With inodes index enabled, an overlay inode nlink counts the union of upper
463  * hardlinks and non-covered lower hardlinks. During the lifetime of a non-pure
464  * upper inode, the following nlink modifying operations can happen:
465  *
466  * 1. Lower hardlink copy up
467  * 2. Upper hardlink created, unlinked or renamed over
468  * 3. Lower hardlink whiteout or renamed over
469  *
470  * For the first, copy up case, the union nlink does not change, whether the
471  * operation succeeds or fails, but the upper inode nlink may change.
472  * Therefore, before copy up, we store the union nlink value relative to the
473  * lower inode nlink in the index inode xattr trusted.overlay.nlink.
474  *
475  * For the second, upper hardlink case, the union nlink should be incremented
476  * or decremented IFF the operation succeeds, aligned with nlink change of the
477  * upper inode. Therefore, before link/unlink/rename, we store the union nlink
478  * value relative to the upper inode nlink in the index inode.
479  *
480  * For the last, lower cover up case, we simplify things by preceding the
481  * whiteout or cover up with copy up. This makes sure that there is an index
482  * upper inode where the nlink xattr can be stored before the copied up upper
483  * entry is unlink.
484  */
485 #define OVL_NLINK_ADD_UPPER     (1 << 0)
486
487 /*
488  * On-disk format for indexed nlink:
489  *
490  * nlink relative to the upper inode - "U[+-]NUM"
491  * nlink relative to the lower inode - "L[+-]NUM"
492  */
493
494 static int ovl_set_nlink_common(struct dentry *dentry,
495                                 struct dentry *realdentry, const char *format)
496 {
497         struct inode *inode = d_inode(dentry);
498         struct inode *realinode = d_inode(realdentry);
499         char buf[13];
500         int len;
501
502         len = snprintf(buf, sizeof(buf), format,
503                        (int) (inode->i_nlink - realinode->i_nlink));
504
505         if (WARN_ON(len >= sizeof(buf)))
506                 return -EIO;
507
508         return ovl_do_setxattr(ovl_dentry_upper(dentry),
509                                OVL_XATTR_NLINK, buf, len, 0);
510 }
511
512 int ovl_set_nlink_upper(struct dentry *dentry)
513 {
514         return ovl_set_nlink_common(dentry, ovl_dentry_upper(dentry), "U%+i");
515 }
516
517 int ovl_set_nlink_lower(struct dentry *dentry)
518 {
519         return ovl_set_nlink_common(dentry, ovl_dentry_lower(dentry), "L%+i");
520 }
521
522 unsigned int ovl_get_nlink(struct dentry *lowerdentry,
523                            struct dentry *upperdentry,
524                            unsigned int fallback)
525 {
526         int nlink_diff;
527         int nlink;
528         char buf[13];
529         int err;
530
531         if (!lowerdentry || !upperdentry || d_inode(lowerdentry)->i_nlink == 1)
532                 return fallback;
533
534         err = vfs_getxattr(upperdentry, OVL_XATTR_NLINK, &buf, sizeof(buf) - 1);
535         if (err < 0)
536                 goto fail;
537
538         buf[err] = '\0';
539         if ((buf[0] != 'L' && buf[0] != 'U') ||
540             (buf[1] != '+' && buf[1] != '-'))
541                 goto fail;
542
543         err = kstrtoint(buf + 1, 10, &nlink_diff);
544         if (err < 0)
545                 goto fail;
546
547         nlink = d_inode(buf[0] == 'L' ? lowerdentry : upperdentry)->i_nlink;
548         nlink += nlink_diff;
549
550         if (nlink <= 0)
551                 goto fail;
552
553         return nlink;
554
555 fail:
556         pr_warn_ratelimited("overlayfs: failed to get index nlink (%pd2, err=%i)\n",
557                             upperdentry, err);
558         return fallback;
559 }
560
561 struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, dev_t rdev)
562 {
563         struct inode *inode;
564
565         inode = new_inode(sb);
566         if (inode)
567                 ovl_fill_inode(inode, mode, rdev);
568
569         return inode;
570 }
571
572 static int ovl_inode_test(struct inode *inode, void *data)
573 {
574         return inode->i_private == data;
575 }
576
577 static int ovl_inode_set(struct inode *inode, void *data)
578 {
579         inode->i_private = data;
580         return 0;
581 }
582
583 static bool ovl_verify_inode(struct inode *inode, struct dentry *lowerdentry,
584                              struct dentry *upperdentry)
585 {
586         if (S_ISDIR(inode->i_mode)) {
587                 /* Real lower dir moved to upper layer under us? */
588                 if (!lowerdentry && ovl_inode_lower(inode))
589                         return false;
590
591                 /* Lookup of an uncovered redirect origin? */
592                 if (!upperdentry && ovl_inode_upper(inode))
593                         return false;
594         }
595
596         /*
597          * Allow non-NULL lower inode in ovl_inode even if lowerdentry is NULL.
598          * This happens when finding a copied up overlay inode for a renamed
599          * or hardlinked overlay dentry and lower dentry cannot be followed
600          * by origin because lower fs does not support file handles.
601          */
602         if (lowerdentry && ovl_inode_lower(inode) != d_inode(lowerdentry))
603                 return false;
604
605         /*
606          * Allow non-NULL __upperdentry in inode even if upperdentry is NULL.
607          * This happens when finding a lower alias for a copied up hard link.
608          */
609         if (upperdentry && ovl_inode_upper(inode) != d_inode(upperdentry))
610                 return false;
611
612         return true;
613 }
614
615 /*
616  * Does overlay inode need to be hashed by lower inode?
617  */
618 static bool ovl_hash_bylower(struct super_block *sb, struct dentry *upper,
619                              struct dentry *lower, struct dentry *index)
620 {
621         struct ovl_fs *ofs = sb->s_fs_info;
622
623         /* No, if pure upper */
624         if (!lower)
625                 return false;
626
627         /* Yes, if already indexed */
628         if (index)
629                 return true;
630
631         /* Yes, if won't be copied up */
632         if (!ofs->upper_mnt)
633                 return true;
634
635         /* No, if lower hardlink is or will be broken on copy up */
636         if ((upper || !ovl_indexdir(sb)) &&
637             !d_is_dir(lower) && d_inode(lower)->i_nlink > 1)
638                 return false;
639
640         /* No, if non-indexed upper with NFS export */
641         if (sb->s_export_op && upper)
642                 return false;
643
644         /* Otherwise, hash by lower inode for fsnotify */
645         return true;
646 }
647
648 struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry,
649                             struct dentry *index)
650 {
651         struct super_block *sb = dentry->d_sb;
652         struct dentry *lowerdentry = ovl_dentry_lower(dentry);
653         struct inode *realinode = upperdentry ? d_inode(upperdentry) : NULL;
654         struct inode *inode;
655         bool bylower = ovl_hash_bylower(sb, upperdentry, lowerdentry, index);
656         bool is_dir;
657
658         if (!realinode)
659                 realinode = d_inode(lowerdentry);
660
661         /*
662          * Copy up origin (lower) may exist for non-indexed upper, but we must
663          * not use lower as hash key if this is a broken hardlink.
664          */
665         is_dir = S_ISDIR(realinode->i_mode);
666         if (upperdentry || bylower) {
667                 struct inode *key = d_inode(bylower ? lowerdentry :
668                                                       upperdentry);
669                 unsigned int nlink = is_dir ? 1 : realinode->i_nlink;
670
671                 inode = iget5_locked(sb, (unsigned long) key,
672                                      ovl_inode_test, ovl_inode_set, key);
673                 if (!inode)
674                         goto out_nomem;
675                 if (!(inode->i_state & I_NEW)) {
676                         /*
677                          * Verify that the underlying files stored in the inode
678                          * match those in the dentry.
679                          */
680                         if (!ovl_verify_inode(inode, lowerdentry, upperdentry)) {
681                                 iput(inode);
682                                 inode = ERR_PTR(-ESTALE);
683                                 goto out;
684                         }
685
686                         dput(upperdentry);
687                         goto out;
688                 }
689
690                 /* Recalculate nlink for non-dir due to indexing */
691                 if (!is_dir)
692                         nlink = ovl_get_nlink(lowerdentry, upperdentry, nlink);
693                 set_nlink(inode, nlink);
694         } else {
695                 /* Lower hardlink that will be broken on copy up */
696                 inode = new_inode(sb);
697                 if (!inode)
698                         goto out_nomem;
699         }
700         ovl_fill_inode(inode, realinode->i_mode, realinode->i_rdev);
701         ovl_inode_init(inode, upperdentry, lowerdentry);
702
703         if (upperdentry && ovl_is_impuredir(upperdentry))
704                 ovl_set_flag(OVL_IMPURE, inode);
705
706         if (inode->i_state & I_NEW)
707                 unlock_new_inode(inode);
708 out:
709         return inode;
710
711 out_nomem:
712         inode = ERR_PTR(-ENOMEM);
713         goto out;
714 }