diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 8463c940e0e5..2ed773b395a4 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1486,6 +1486,11 @@ cifs_parse_devname(const char *devname, struct smb_vol *vol) const char *delims = "/\\"; size_t len; + if (unlikely(!devname || !*devname)) { + cifs_dbg(VFS, "Device name not specified.\n"); + return -EINVAL; + } + /* make sure we have a valid UNC double delimiter prefix */ len = strspn(devname, delims); if (len != 2)