Skip to content

Commit 03313d1

Browse files
Paulo Alcantarasmfrench
authored andcommitted
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: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 53d31a3 commit 03313d1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/cifs/cifs_dfs_ref.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
151151
return ERR_PTR(-EINVAL);
152152

153153
if (ref) {
154+
if (WARN_ON_ONCE(!ref->node_name || ref->path_consumed < 0))
155+
return ERR_PTR(-EINVAL);
156+
154157
if (strlen(fullpath) - ref->path_consumed) {
155158
prepath = fullpath + ref->path_consumed;
156159
/* skip initial delimiter */

0 commit comments

Comments
 (0)