All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: harald@redhat.com
Cc: linux-btrfs@vger.kernel.org
Subject: re: btrfs: allow mounting btrfs subvolumes with different ro/rw options
Date: Mon, 14 Apr 2014 16:10:10 +0300	[thread overview]
Message-ID: <20140414131010.GA12764@mwanda> (raw)

Hello Harald Hoyer,

The patch 0723a0473fb4: "btrfs: allow mounting btrfs subvolumes with
different ro/rw options" from Nov 19, 2013, leads to the following
static checker warning:

	fs/btrfs/super.c:1194 mount_subvol()
	warn: 'newargs' was already freed.

fs/btrfs/super.c
  1177  static struct dentry *mount_subvol(const char *subvol_name, int flags,
  1178                                     const char *device_name, char *data)
  1179  {
  1180          struct dentry *root;
  1181          struct vfsmount *mnt;
  1182          char *newargs;
  1183  
  1184          newargs = setup_root_args(data);
  1185          if (!newargs)
  1186                  return ERR_PTR(-ENOMEM);
  1187          mnt = vfs_kern_mount(&btrfs_fs_type, flags, device_name,
  1188                               newargs);
  1189          kfree(newargs);
                      ^^^^^^^
Freed.

  1190  
  1191          if (PTR_RET(mnt) == -EBUSY) {
  1192                  if (flags & MS_RDONLY) {
  1193                          mnt = vfs_kern_mount(&btrfs_fs_type, flags & ~MS_RDONLY, device_name,
  1194                                               newargs);
                                                     ^^^^^^^
Used if you have some security stuff enabled.

  1195                  } else {
  1196                          int r;
  1197                          mnt = vfs_kern_mount(&btrfs_fs_type, flags | MS_RDONLY, device_name,
  1198                                               newargs);
                                                     ^^^^^^^
  1199                          if (IS_ERR(mnt))
  1200                                  return ERR_CAST(mnt);
  1201  
  1202                          r = btrfs_remount(mnt->mnt_sb, &flags, NULL);
  1203                          if (r < 0) {
  1204                                  /* FIXME: release vfsmount mnt ??*/
  1205                                  return ERR_PTR(r);
  1206                          }
  1207                  }
  1208          }
  1209  

Also you forgot to Sign your patch.

regards,
dan carpenter

             reply	other threads:[~2014-04-14 13:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14 13:10 Dan Carpenter [this message]
2014-04-14 13:39 ` btrfs: allow mounting btrfs subvolumes with different ro/rw options Chris Mason
2014-04-14 16:17   ` David Sterba
2014-04-14 17:08     ` Dan Carpenter

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=20140414131010.GA12764@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=harald@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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.