Message ID | 1efbb9dc-e5a0-64d7-da3e-235852783f9c@I-love.SAKURA.ne.jp (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Johannes Berg |
Headers | show |
diff --git a/net/rfkill/core.c b/net/rfkill/core.c index 59d0eb9..d8beebc 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -933,6 +933,10 @@ struct rfkill * __must_check rfkill_alloc(const char *name, if (WARN_ON(type == RFKILL_TYPE_ALL || type >= NUM_RFKILL_TYPES)) return NULL; + if (strlen(name) > NAME_MAX || strchr(name, '/') || + !strcmp(name, ".") || !strcmp(name, "..")) + return NULL; + rfkill = kzalloc(sizeof(*rfkill) + strlen(name) + 1, GFP_KERNEL); if (!rfkill) return NULL;