summaryrefslogtreecommitdiffstats
path: root/fs/cifs/dir.c
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2021-06-23 02:53:08 +0200
committerSteve French <stfrench@microsoft.com>2021-06-24 02:24:30 +0200
commit0917310b984c1ac24da2be0ebe992539b9ba94ed (patch)
treee9ff527315aa2398152acea23865c22659eedb44 /fs/cifs/dir.c
parentcifs: remove two cases where rc is set unnecessarily in sid_to_id (diff)
downloadlinux-0917310b984c1ac24da2be0ebe992539b9ba94ed.tar.xz
linux-0917310b984c1ac24da2be0ebe992539b9ba94ed.zip
cifs: missing null check for newinode pointer
in cifs_do_create we check if newinode is valid before referencing it but are missing the check in one place in fs/cifs/dir.c Addresses-Coverity: 1357292 ("Dereference after null check") Acked-by: Sachin Prabhu <sprabhu@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r--fs/cifs/dir.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 912333082b18..79402ca0ddfa 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -384,10 +384,11 @@ cifs_create_set_dentry:
goto out_err;
}
- if (S_ISDIR(newinode->i_mode)) {
- rc = -EISDIR;
- goto out_err;
- }
+ if (newinode)
+ if (S_ISDIR(newinode->i_mode)) {
+ rc = -EISDIR;
+ goto out_err;
+ }
d_drop(direntry);
d_add(direntry, newinode);