All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: zyan@redhat.com
Cc: ceph-devel@vger.kernel.org
Subject: [bug report] ceph: avoid accessing / when mounting a subpath
Date: Fri, 14 Oct 2016 12:46:04 +0300	[thread overview]
Message-ID: <20161014094604.GA25372@mwanda> (raw)

Hello Yan, Zheng,

The patch ce2728aaa82b: "ceph: avoid accessing / when mounting a
subpath" from Sep 14, 2016, leads to the following static checker
warning:

	fs/ceph/super.c:853 ceph_real_mount()
	error: uninitialized symbol 'root'.

fs/ceph/super.c
   814  static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc)
   815  {
   816          int err;
   817          unsigned long started = jiffies;  /* note the start time */
   818          struct dentry *root;
   819          int first = 0;   /* first vfsmount for this super_block */
   820  
   821          dout("mount start %p\n", fsc);
   822          mutex_lock(&fsc->client->mount_mutex);
   823  
   824          if (!fsc->sb->s_root) {
   825                  const char *path;
   826                  err = __ceph_open_session(fsc->client, started);
   827                  if (err < 0)
   828                          goto out;
   829  
   830                  if (!fsc->mount_options->server_path) {
   831                          path = "";
   832                          dout("mount opening path \\t\n");
   833                  } else {
   834                          path = fsc->mount_options->server_path + 1;
   835                          dout("mount opening path %s\n", path);
   836                  }
   837                  root = open_root_dentry(fsc, path, started);
   838                  if (IS_ERR(root)) {
   839                          err = PTR_ERR(root);
   840                          goto out;
   841                  }
   842                  fsc->sb->s_root = dget(root);
   843                  first = 1;
   844  
   845                  err = ceph_fs_debugfs_init(fsc);
   846                  if (err < 0)
   847                          goto fail;
   848          }

We should initialize root on the else side.

   849  
   850          fsc->mount_state = CEPH_MOUNT_MOUNTED;
   851          dout("mount success\n");
   852          mutex_unlock(&fsc->client->mount_mutex);
   853          return root;



regards,
dan carpenter

             reply	other threads:[~2016-10-14  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14  9:46 Dan Carpenter [this message]
2016-10-14 10:06 ` [bug report] ceph: avoid accessing / when mounting a subpath Yan, Zheng

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=20161014094604.GA25372@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=zyan@redhat.com \
    /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.