[bug report] namei: allow restricted O_CREAT of FIFOs and regular files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Salvatore Mesoraca,

The patch 0d70abf05029: "namei: allow restricted O_CREAT of FIFOs and
regular files" from Apr 23, 2018, leads to the following static
checker warning:

	fs/namei.c:3390 do_last()
	error: uninitialized symbol 'inode'.

fs/namei.c
  3250  static int do_last(struct nameidata *nd,
  3251                     struct file *file, const struct open_flags *op,
  3252                     int *opened)
  3253  {
  3254          struct dentry *dir = nd->path.dentry;
  3255          int open_flag = op->open_flag;
  3256          bool will_truncate = (open_flag & O_TRUNC) != 0;
  3257          bool got_write = false;
  3258          int acc_mode = op->acc_mode;
  3259          unsigned seq;
  3260          struct inode *inode;
                              ^^^^^
  3261          struct path path;
  3262          int error;
  3263  
  3264          nd->flags &= ~LOOKUP_PARENT;
  3265          nd->flags |= op->intent;
  3266  
  3267          if (nd->last_type != LAST_NORM) {
  3268                  error = handle_dots(nd, nd->last_type);
  3269                  if (unlikely(error))
  3270                          return error;
  3271                  goto finish_open;
                        ^^^^^^^^^^^^^^^^
  3272          }

[ snip ]

  3380  finish_open:
  3381          /* Why this, you ask?  _Now_ we might have grown LOOKUP_JUMPED... */
  3382          error = complete_walk(nd);
  3383          if (error)
  3384                  return error;
  3385          audit_inode(nd->name, nd->path.dentry, 0);
  3386          if (open_flag & O_CREAT) {
  3387                  error = -EISDIR;
  3388                  if (d_is_dir(nd->path.dentry))
  3389                          goto out;
  3390                  error = may_create_in_sticky(dir, inode);
                                                          ^^^^^
  3391                  if (unlikely(error))
  3392                          goto out;
  3393          }
  3394          error = -ENOTDIR;
  3395          if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry))
  3396                  goto out;
  3397          if (!d_is_reg(nd->path.dentry))
  3398                  will_truncate = false;
  3399  
  3400          if (will_truncate) {
  3401                  error = mnt_want_write(nd->path.mnt);
  3402                  if (error)
  3403                          goto out;
  3404                  got_write = true;
  3405          }

regards,
dan carpenter



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux