summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_misc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 620da85948b4..d945b4f6e158 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -100,6 +100,13 @@ static const struct binfmt_misc_flag *misc_flag_by_char(const char c)
return NULL;
}
+static bool misc_valid_delim(const char c)
+{
+ if (!isascii(c) || !ispunct(c))
+ return false;
+ return c != '\\';
+}
+
struct binfmt_misc_entry {
struct hlist_node node;
unsigned long flags; /* type, status, etc. */
@@ -871,10 +878,9 @@ static struct binfmt_misc_entry *create_entry(const char __user *buffer,
del = *p++; /* delimiter */
- pr_debug("register: delim: %#x {%c}\n", del, del);
+ pr_debug("register: delim: %#x\n", del);
- /* A flag-char delimiter runs the flag scan off the buffer. */
- if (misc_flag_by_char(del))
+ if (!misc_valid_delim(del))
return ERR_PTR(-EINVAL);
/* Pad the buffer with the delim to simplify parsing below. */