From: Dan Carpenter <dan.carpenter@linaro.org>
To: ericvh@kernel.org
Cc: v9fs@lists.linux.dev
Subject: [bug report] fs/9p: mitigate inode collisions
Date: Wed, 17 Apr 2024 21:11:53 +0300 [thread overview]
Message-ID: <5d527d1e-95de-4e36-845a-897cabdcaccd@moroto.mountain> (raw)
Hello Eric Van Hensbergen,
Commit 6ae7784008d9 (" fs/9p: mitigate inode collisions") from Apr
15, 2024 (linux-next), leads to the following Smatch static checker
warning:
fs/9p/vfs_inode.c:513 v9fs_remove()
error: uninitialized symbol 'v9fid'.
fs/9p/vfs_inode.c
470 static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
471 {
472 struct inode *inode;
473 int retval = -EOPNOTSUPP;
474 struct p9_fid *v9fid, *dfid;
475 struct v9fs_session_info *v9ses;
476
477 p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
478 dir, dentry, flags);
479
480 v9ses = v9fs_inode2v9ses(dir);
481 inode = d_inode(dentry);
482 dfid = v9fs_parent_fid(dentry);
483 if (IS_ERR(dfid)) {
484 retval = PTR_ERR(dfid);
485 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
486 return retval;
487 }
488 if (v9fs_proto_dotl(v9ses))
489 retval = p9_client_unlinkat(dfid, dentry->d_name.name,
490 v9fs_at_to_dotl_flags(flags));
491 p9_fid_put(dfid);
492 if (retval == -EOPNOTSUPP) {
493 /* Try the one based on path */
494 v9fid = v9fs_fid_clone(dentry);
495 if (IS_ERR(v9fid))
496 return PTR_ERR(v9fid);
497 retval = p9_client_remove(v9fid);
498 }
v9fid is not initialized if retval != -EOPNOTSUPP.
499 if (!retval) {
500 /*
501 * directories on unlink should have zero
502 * link count
503 */
504 if (flags & AT_REMOVEDIR) {
505 clear_nlink(inode);
506 v9fs_dec_count(dir);
507 } else
508 v9fs_dec_count(inode);
509
510 if (inode->i_nlink <= 0) { /* no more refs unhash it */
511 remove_inode_hash(inode);
512 } else {
--> 513 p9_debug(P9_DEBUG_ERROR,
514 "WARNING: unlink inode %lx %s qid->path=%llx w/i_nlink==%d\n",
515 inode->i_ino, dentry->d_name.name, v9fid->qid.path, inode->i_nlink);
^^^^^^^^^^^^^^^
Uninitialized.
516 }
517
518 v9fs_invalidate_inode_attr(inode);
519 v9fs_invalidate_inode_attr(dir);
520
521 /* invalidate all fids associated with dentry */
522 /* NOTE: This will not include open fids */
523 dentry->d_op->d_release(dentry);
524 }
525 return retval;
526 }
regards,
dan carpenter
next reply other threads:[~2024-04-17 18:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 18:11 Dan Carpenter [this message]
2024-04-17 18:50 ` [bug report] fs/9p: mitigate inode collisions Eric Van Hensbergen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5d527d1e-95de-4e36-845a-897cabdcaccd@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=ericvh@kernel.org \
--cc=v9fs@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.