* [PATCH] cifs: fix check of rc in function generate_smb3signingkey
@ 2023-11-13 16:42 Ekaterina Esina
2023-11-13 18:49 ` Paulo Alcantara
2023-11-13 22:23 ` Steve French
0 siblings, 2 replies; 3+ messages in thread
From: Ekaterina Esina @ 2023-11-13 16:42 UTC (permalink / raw)
To: Steve French
Cc: Ekaterina Esina, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Aurelien Aptel, linux-cifs,
samba-technical, linux-kernel, lvc-project, Anastasia Belova
Remove extra check after condition, add check after generating key
for encryption. The check is needed to return non zero rc before
rewriting it with generating key for decryption.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: d70e9fa55884 ("cifs: try opening channels after mounting")
Signed-off-by: Ekaterina Esina <eesina@astralinux.ru>
Co-developed-by: Anastasia Belova <abelova@astralinux.ru>
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
fs/smb/client/smb2transport.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index 84ea67301303..5a3ca62d2f07 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -458,6 +458,8 @@ generate_smb3signingkey(struct cifs_ses *ses,
ptriplet->encryption.context,
ses->smb3encryptionkey,
SMB3_ENC_DEC_KEY_SIZE);
+ if (rc)
+ return rc;
rc = generate_key(ses, ptriplet->decryption.label,
ptriplet->decryption.context,
ses->smb3decryptionkey,
@@ -466,9 +468,6 @@ generate_smb3signingkey(struct cifs_ses *ses,
return rc;
}
- if (rc)
- return rc;
-
#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__);
/*
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: fix check of rc in function generate_smb3signingkey
2023-11-13 16:42 [PATCH] cifs: fix check of rc in function generate_smb3signingkey Ekaterina Esina
@ 2023-11-13 18:49 ` Paulo Alcantara
2023-11-13 22:23 ` Steve French
1 sibling, 0 replies; 3+ messages in thread
From: Paulo Alcantara @ 2023-11-13 18:49 UTC (permalink / raw)
To: Ekaterina Esina, Steve French
Cc: Ekaterina Esina, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Aurelien Aptel, linux-cifs, samba-technical, linux-kernel,
lvc-project, Anastasia Belova
Ekaterina Esina <eesina@astralinux.ru> writes:
> Remove extra check after condition, add check after generating key
> for encryption. The check is needed to return non zero rc before
> rewriting it with generating key for decryption.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: d70e9fa55884 ("cifs: try opening channels after mounting")
> Signed-off-by: Ekaterina Esina <eesina@astralinux.ru>
> Co-developed-by: Anastasia Belova <abelova@astralinux.ru>
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
> ---
> fs/smb/client/smb2transport.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: fix check of rc in function generate_smb3signingkey
2023-11-13 16:42 [PATCH] cifs: fix check of rc in function generate_smb3signingkey Ekaterina Esina
2023-11-13 18:49 ` Paulo Alcantara
@ 2023-11-13 22:23 ` Steve French
1 sibling, 0 replies; 3+ messages in thread
From: Steve French @ 2023-11-13 22:23 UTC (permalink / raw)
To: Ekaterina Esina
Cc: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
Tom Talpey, Aurelien Aptel, linux-cifs, samba-technical,
linux-kernel, lvc-project, Anastasia Belova
tentatively merged into cifs-2.6.git for-next pending testing
On Mon, Nov 13, 2023 at 10:43 AM Ekaterina Esina <eesina@astralinux.ru> wrote:
>
> Remove extra check after condition, add check after generating key
> for encryption. The check is needed to return non zero rc before
> rewriting it with generating key for decryption.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: d70e9fa55884 ("cifs: try opening channels after mounting")
> Signed-off-by: Ekaterina Esina <eesina@astralinux.ru>
> Co-developed-by: Anastasia Belova <abelova@astralinux.ru>
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
> ---
> fs/smb/client/smb2transport.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
> index 84ea67301303..5a3ca62d2f07 100644
> --- a/fs/smb/client/smb2transport.c
> +++ b/fs/smb/client/smb2transport.c
> @@ -458,6 +458,8 @@ generate_smb3signingkey(struct cifs_ses *ses,
> ptriplet->encryption.context,
> ses->smb3encryptionkey,
> SMB3_ENC_DEC_KEY_SIZE);
> + if (rc)
> + return rc;
> rc = generate_key(ses, ptriplet->decryption.label,
> ptriplet->decryption.context,
> ses->smb3decryptionkey,
> @@ -466,9 +468,6 @@ generate_smb3signingkey(struct cifs_ses *ses,
> return rc;
> }
>
> - if (rc)
> - return rc;
> -
> #ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
> cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__);
> /*
> --
> 2.30.2
>
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-13 22:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 16:42 [PATCH] cifs: fix check of rc in function generate_smb3signingkey Ekaterina Esina
2023-11-13 18:49 ` Paulo Alcantara
2023-11-13 22:23 ` Steve French
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®