cifs: add check for returning value of SMB2_set_info_init

Message ID 20221116141027.10947-1-abelova@astralinux.ru
State New
Headers
Series cifs: add check for returning value of SMB2_set_info_init |

Commit Message

Anastasia Belova Nov. 16, 2022, 2:10 p.m. UTC
  If the returning value of SMB2_set_info_init is an error-value,
exit the function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0967e5457954 ("cifs: use a compound for setting an xattr")

Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
 fs/cifs/smb2ops.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Steve French Nov. 16, 2022, 6:28 p.m. UTC | #1
merged into cifs-2.6.git for-next

On Wed, Nov 16, 2022 at 8:26 AM Anastasia Belova <abelova@astralinux.ru> wrote:
>
> If the returning value of SMB2_set_info_init is an error-value,
> exit the function.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 0967e5457954 ("cifs: use a compound for setting an xattr")
>
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
> ---
>  fs/cifs/smb2ops.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 880cd494afea..c77e49b3fcc6 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -1116,6 +1116,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
>                                 COMPOUND_FID, current->tgid,
>                                 FILE_FULL_EA_INFORMATION,
>                                 SMB2_O_INFO_FILE, 0, data, size);
> +       if (rc)
> +               goto sea_exit;
>         smb2_set_next_command(tcon, &rqst[1]);
>         smb2_set_related(&rqst[1]);
>
> --
> 2.30.2
>
  
Paulo Alcantara Nov. 18, 2022, 2:51 p.m. UTC | #2
Anastasia Belova <abelova@astralinux.ru> writes:

> If the returning value of SMB2_set_info_init is an error-value,
> exit the function.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 0967e5457954 ("cifs: use a compound for setting an xattr")
>
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
> ---
>  fs/cifs/smb2ops.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
  

Patch

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 880cd494afea..c77e49b3fcc6 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1116,6 +1116,8 @@  smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
 				COMPOUND_FID, current->tgid,
 				FILE_FULL_EA_INFORMATION,
 				SMB2_O_INFO_FILE, 0, data, size);
+	if (rc)
+		goto sea_exit;
 	smb2_set_next_command(tcon, &rqst[1]);
 	smb2_set_related(&rqst[1]);