Commit 03313d1c authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

cifs: prevent NULL deref in cifs_compose_mount_options()

The optional @ref parameter might contain an NULL node_name, so
prevent dereferencing it in cifs_compose_mount_options().

Addresses-Coverity: 1476408 ("Explicit null dereferenced")
Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 53d31a3f
...@@ -151,6 +151,9 @@ char *cifs_compose_mount_options(const char *sb_mountdata, ...@@ -151,6 +151,9 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (ref) { if (ref) {
if (WARN_ON_ONCE(!ref->node_name || ref->path_consumed < 0))
return ERR_PTR(-EINVAL);
if (strlen(fullpath) - ref->path_consumed) { if (strlen(fullpath) - ref->path_consumed) {
prepath = fullpath + ref->path_consumed; prepath = fullpath + ref->path_consumed;
/* skip initial delimiter */ /* skip initial delimiter */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment