- Fix null deref on mount when given a null device name.
- Move the dev_name checks to return EINVAL when it is invalid.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
char *dev_name = NULL, **devs = NULL, *s;
size_t i, nr_devs = 0;
- if (strlen(_dev_name) == 0)
- return NULL;
-
dev_name = kstrdup(_dev_name, GFP_KERNEL);
if (!dev_name)
return NULL;
if (ret)
return ERR_PTR(ret);
+ if (!dev_name || strlen(dev_name) == 0)
+ return ERR_PTR(-EINVAL);
+
devs = split_devs(dev_name, &nr_devs);
if (!devs)
return ERR_PTR(-ENOMEM);