From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 3/4] Btrfs: check device_path in btrfs_find_device_by_user_input()
Date: Mon, 1 Jun 2015 14:16:18 +0800 [thread overview]
Message-ID: <1433139379-640-3-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1433139379-640-1-git-send-email-anand.jain@oracle.com>
so btrfs_dev_replace_start() can be sleak and btrfs_rm_device() will
also need it.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/dev-replace.c | 4 ----
fs/btrfs/volumes.c | 3 +++
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index ff1ef57..a6a2b84 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -321,10 +321,6 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
return -EINVAL;
}
- if ((args->start.srcdevid == 0 && args->start.srcdev_name[0] == '\0') ||
- args->start.tgtdev_name[0] == '\0')
- return -EINVAL;
-
/* the disk copy procedure reuses the scrub code */
mutex_lock(&fs_info->volume_mutex);
ret = btrfs_find_device_by_user_input(root, args->start.srcdevid,
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a51d492..cafedaa 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1990,6 +1990,9 @@ int btrfs_find_device_by_user_input(struct btrfs_root *root, u64 srcdevid,
if (!*device)
ret = -ENOENT;
} else {
+ if (!srcdev_name || !srcdev_name[0])
+ return -EINVAL;
+
ret = btrfs_find_device_missing_or_by_path(root, srcdev_name,
device);
}
--
2.4.1
next prev parent reply other threads:[~2015-06-01 6:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 6:16 [PATCH 1/4] Btrfs: device path change must be logged Anand Jain
2015-06-01 6:16 ` [PATCH 2/4] Btrfs: kernel operation should come after user input has been verified Anand Jain
2015-06-01 6:16 ` Anand Jain [this message]
2015-06-01 6:16 ` [PATCH 4/4] Btrfs: avoid user cli usage error logging into the sys log Anand Jain
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=1433139379-640-3-git-send-email-anand.jain@oracle.com \
--to=anand.jain@oracle.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.