Acked-by: Sachin Prabhu <sprabhu@xxxxxxxxxx> On Wed, Jun 23, 2021 at 2:04 AM Steve French <smfrench@xxxxxxxxx> wrote: > > 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") > Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> > --- > fs/cifs/dir.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c > index 912333082b18..aca6ed58cc44 100644 > --- a/fs/cifs/dir.c > +++ b/fs/cifs/dir.c > @@ -384,10 +384,11 @@ cifs_do_create(struct inode *inode, struct > dentry *direntry, unsigned int xid, > 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); > > -- > Thanks, > > Steve