Message ID | 20231113164241.32310-1-eesina@astralinux.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1328781vqg; Mon, 13 Nov 2023 08:43:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpYDG/rKH2egr8NTxuM1J/ROBo1ENEJr1cpO/jTL1gJsL8faISFk6m3QfMTCKGAxdrstQR X-Received: by 2002:a05:6808:3a0f:b0:3b2:dcff:9e54 with SMTP id gr15-20020a0568083a0f00b003b2dcff9e54mr10749993oib.24.1699893809434; Mon, 13 Nov 2023 08:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699893809; cv=none; d=google.com; s=arc-20160816; b=gLWEWb6te70+TGq1ujPmoxTEcu5+IX9mDfEQZ4kujOzh059J1bnxxW3FmrJrgyra/K svBwwCKTTPRN42ZxILrCPrmvJHbg6EsKBbOudBogUEPbgKLnQRz5cG1L3xEcPKdRVPUR JJn+tgrOWZ6YfCMN4KLbXeFigHzRjSuPUKVA38yBWbcbc3DtR4UaIjv0/QAIL32x/cWi kS5BZK++/OdFqi1VtwJpDSCSrPDKWV4wu7ESZs6YCIsmFn7yv3mUd5KZsmFhWdLMEDB3 f+dlhsqjSPHmGmob4dKDeEyRxgQJj9RH4t3y5+lA9HTJhMS3di2AFR8kH3hR9QHHBKzQ nY0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=zobRn7Wr0VU/xACGt8x4UIXjzNqhFUHIIReaxflccpo=; fh=mcH/Xl1wRXXJ+ZCWKKFpLNqq03JOkO7m6drr4bAVDy0=; b=aaMjun2KauXL/EImhcNZ5rf82LeCDB/OfBf8xdNqHjOwEf5u/taByw7bHJfs8UexFf O7MVYuToj3kCYrErAgKS//NIkoNAAfmxXF3tX97WSpxO1yKBQNnS2eAqRA9hF0iK9fSm n2jWZbDVSK6eUlr+CWH93gh3LMd341abC5djTQbQr3L2jKhVsnIpfTK0VOSfykYqSOFS 8wOLeIUXfirAlaua4xqL/wKIut+r2owmEGk26NqgEW6V1qFNKJ3w0Z9yCZw17M7Y/6gT Yk31cEZjSnqjhL1plx8TuRdkW15p7uDOuVDlKL+09tHAcD8Jt/A7b6ZxlTPFrC9xCXOU MCuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s6-20020a63e806000000b005ad8009e301si6337132pgh.250.2023.11.13.08.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 08:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 76A5F80AC8D6; Mon, 13 Nov 2023 08:43:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbjKMQnP (ORCPT <rfc822;heyuhang3455@gmail.com> + 29 others); Mon, 13 Nov 2023 11:43:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbjKMQnO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 13 Nov 2023 11:43:14 -0500 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEA1D53; Mon, 13 Nov 2023 08:43:09 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 6DB171869B6D; Mon, 13 Nov 2023 19:43:06 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id tdjbxSMGeGAM; Mon, 13 Nov 2023 19:43:06 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 17F601869B6A; Mon, 13 Nov 2023 19:43:06 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id HZuMF2TecaTM; Mon, 13 Nov 2023 19:43:06 +0300 (MSK) Received: from rbta-msk-lt-172751.astralinux.ru (unknown [10.177.20.22]) by mail.astralinux.ru (Postfix) with ESMTPSA id 071751869AEF; Mon, 13 Nov 2023 19:43:04 +0300 (MSK) From: Ekaterina Esina <eesina@astralinux.ru> To: Steve French <sfrench@samba.org> Cc: Ekaterina Esina <eesina@astralinux.ru>, Paulo Alcantara <pc@manguebit.com>, Ronnie Sahlberg <lsahlber@redhat.com>, Shyam Prasad N <sprasad@microsoft.com>, Tom Talpey <tom@talpey.com>, Aurelien Aptel <aaptel@suse.com>, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Anastasia Belova <abelova@astralinux.ru> Subject: [PATCH] cifs: fix check of rc in function generate_smb3signingkey Date: Mon, 13 Nov 2023 19:42:41 +0300 Message-Id: <20231113164241.32310-1-eesina@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 13 Nov 2023 08:43:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782467851338158451 X-GMAIL-MSGID: 1782467851338158451 |
Series |
cifs: fix check of rc in function generate_smb3signingkey
|
|
Commit Message
Ekaterina Esina
Nov. 13, 2023, 4:42 p.m. UTC
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(-)
Comments
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__); /*