]> Git Repo - J-linux.git/commitdiff
cifs: prevent NULL deref in cifs_compose_mount_options()
authorPaulo Alcantara <[email protected]>
Fri, 2 Jul 2021 14:50:54 +0000 (11:50 -0300)
committerSteve French <[email protected]>
Fri, 9 Jul 2021 17:57:05 +0000 (12:57 -0500)
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: Paulo Alcantara (SUSE) <[email protected]>
Signed-off-by: Steve French <[email protected]>
fs/cifs/cifs_dfs_ref.c

index ec57cdb1590f72d1a2e60cdd13c38a70c3e95371..57f91311fdaa3a8418a5205845c5ba1ce8922d31 100644 (file)
@@ -151,6 +151,9 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
                return ERR_PTR(-EINVAL);
 
        if (ref) {
+               if (WARN_ON_ONCE(!ref->node_name || ref->path_consumed < 0))
+                       return ERR_PTR(-EINVAL);
+
                if (strlen(fullpath) - ref->path_consumed) {
                        prepath = fullpath + ref->path_consumed;
                        /* skip initial delimiter */
This page took 0.048752 seconds and 4 git commands to generate.