* [bug report] namei: allow restricted O_CREAT of FIFOs and regular files
@ 2018-04-26 8:14 Dan Carpenter
2018-04-26 17:28 ` Salvatore Mesoraca
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-04-26 8:14 UTC (permalink / raw)
To: s.mesoraca16; +Cc: linux-fsdevel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-26 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 8:14 [bug report] namei: allow restricted O_CREAT of FIFOs and regular files Dan Carpenter
2018-04-26 17:28 ` Salvatore Mesoraca
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.