From: Steve French Date: Wed, 23 Jun 2021 00:53:08 +0000 (-0500) Subject: cifs: missing null check for newinode pointer X-Git-Tag: v5.15~861^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0917310b984c1ac24da2be0ebe992539b9ba94ed;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Steve French --- diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 9123330..79402ca 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);