Message ID | 20231113164241.32310-1-eesina@astralinux.ru (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | cifs: fix check of rc in function generate_smb3signingkey | expand |
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>
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 > >
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__); /*