diff mbox series

cifs: add check for returning value of SMB2_close_init

Message ID 20221115142701.27074-1-abelova@astralinux.ru
State New
Headers show
Series cifs: add check for returning value of SMB2_close_init | expand

Commit Message

Anastasia Belova Nov. 15, 2022, 2:27 p.m. UTC
If the returning value of SMB2_close_init is an error-value, 
exit the function.

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

Fixes: 352d96f3acc6 ("cifs: multichannel: move channel selection above transport layer")

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

Comments

Steve French Nov. 15, 2022, 6:59 p.m. UTC | #1
good catch.

merged into cifs-2.6.git for-next

On Tue, Nov 15, 2022 at 8:41 AM Anastasia Belova <abelova@astralinux.ru> wrote:
>
> If the returning value of SMB2_close_init is an error-value,
> exit the function.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 352d96f3acc6 ("cifs: multichannel: move channel selection above transport layer")
>
> 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..9737296c0fbc 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -1126,6 +1126,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
>         rqst[2].rq_nvec = 1;
>         rc = SMB2_close_init(tcon, server,
>                              &rqst[2], COMPOUND_FID, COMPOUND_FID, false);
> +       if (rc)
> +               goto sea_exit;
>         smb2_set_related(&rqst[2]);
>
>         rc = compound_send_recv(xid, ses, server,
> --
> 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_close_init is an error-value, 
> exit the function.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 352d96f3acc6 ("cifs: multichannel: move channel selection above transport layer")
>
> 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>
diff mbox series

Patch

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 880cd494afea..9737296c0fbc 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1126,6 +1126,8 @@  smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
 	rqst[2].rq_nvec = 1;
 	rc = SMB2_close_init(tcon, server,
 			     &rqst[2], COMPOUND_FID, COMPOUND_FID, false);
+	if (rc)
+		goto sea_exit;
 	smb2_set_related(&rqst[2]);
 
 	rc = compound_send_recv(xid, ses, server,