diff mbox series

cifs: Fix missed free operations

Message ID 20191014071531.12790-1-hslester96@gmail.com (mailing list archive)
State New, archived
Headers show
Series cifs: Fix missed free operations | expand

Commit Message

Chuhong Yuan Oct. 14, 2019, 7:15 a.m. UTC
cifs_setattr_nounix has two paths which miss free operations
for xid and fullpath.
Use goto cifs_setattr_exit like other paths to fix them.

Fixes: aa081859b10c ("cifs: flush before set-info if we have writeable handles")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 fs/cifs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Pavel Shilovsky Oct. 14, 2019, 9:43 p.m. UTC | #1
пн, 14 окт. 2019 г. в 00:18, Chuhong Yuan <hslester96@gmail.com>:
>
> cifs_setattr_nounix has two paths which miss free operations
> for xid and fullpath.
> Use goto cifs_setattr_exit like other paths to fix them.
>
> Fixes: aa081859b10c ("cifs: flush before set-info if we have writeable handles")
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  fs/cifs/inode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index 5dcc95b38310..df9377828e2f 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -2475,9 +2475,9 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
>                         rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid);
>                         cifsFileInfo_put(wfile);
>                         if (rc)
> -                               return rc;
> +                               goto cifs_setattr_exit;
>                 } else if (rc != -EBADF)
> -                       return rc;
> +                       goto cifs_setattr_exit;
>                 else
>                         rc = 0;
>         }
> --
> 2.20.1
>

Looks good, thanks.

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

The original patch was tagged for stable, so, it seems that this one
should be tagged too.

--
Best regards,
Pavel Shilovsky
Steve French Oct. 15, 2019, 4:53 a.m. UTC | #2
Merged into cifs-2.6.git for-next and cc: stable for 5.3

On Mon, Oct 14, 2019 at 4:43 PM Pavel Shilovsky via samba-technical
<samba-technical@lists.samba.org> wrote:
>
> пн, 14 окт. 2019 г. в 00:18, Chuhong Yuan <hslester96@gmail.com>:
> >
> > cifs_setattr_nounix has two paths which miss free operations
> > for xid and fullpath.
> > Use goto cifs_setattr_exit like other paths to fix them.
> >
> > Fixes: aa081859b10c ("cifs: flush before set-info if we have writeable handles")
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > ---
> >  fs/cifs/inode.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> > index 5dcc95b38310..df9377828e2f 100644
> > --- a/fs/cifs/inode.c
> > +++ b/fs/cifs/inode.c
> > @@ -2475,9 +2475,9 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> >                         rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid);
> >                         cifsFileInfo_put(wfile);
> >                         if (rc)
> > -                               return rc;
> > +                               goto cifs_setattr_exit;
> >                 } else if (rc != -EBADF)
> > -                       return rc;
> > +                       goto cifs_setattr_exit;
> >                 else
> >                         rc = 0;
> >         }
> > --
> > 2.20.1
> >
>
> Looks good, thanks.
>
> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>
> The original patch was tagged for stable, so, it seems that this one
> should be tagged too.
>
> --
> Best regards,
> Pavel Shilovsky
>
diff mbox series

Patch

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 5dcc95b38310..df9377828e2f 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2475,9 +2475,9 @@  cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
 			rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid);
 			cifsFileInfo_put(wfile);
 			if (rc)
-				return rc;
+				goto cifs_setattr_exit;
 		} else if (rc != -EBADF)
-			return rc;
+			goto cifs_setattr_exit;
 		else
 			rc = 0;
 	}