All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ceph: avoid accessing / when mounting a subpath
@ 2016-10-14  9:46 Dan Carpenter
  2016-10-14 10:06 ` Yan, Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-10-14  9:46 UTC (permalink / raw)
  To: zyan; +Cc: ceph-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] ceph: avoid accessing / when mounting a subpath
  2016-10-14  9:46 [bug report] ceph: avoid accessing / when mounting a subpath Dan Carpenter
@ 2016-10-14 10:06 ` Yan, Zheng
  0 siblings, 0 replies; 2+ messages in thread
From: Yan, Zheng @ 2016-10-14 10:06 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: ceph-devel

Already fixed, thanks

Regards
Yan, Zheng

> On 14 Oct 2016, at 17:46, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-14 10:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14  9:46 [bug report] ceph: avoid accessing / when mounting a subpath Dan Carpenter
2016-10-14 10:06 ` Yan, Zheng

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.