From patchwork Tue Nov 15 14:27:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Belova X-Patchwork-Id: 20404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2766908wru; Tue, 15 Nov 2022 06:41:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5UnVnwsGXfVuFRxIzvbdAZi/fOfeU1dm54kBjQ4gaNeuhP9W6s0ulZS6/tKq7IqPZkAwAx X-Received: by 2002:a17:906:e0d2:b0:7ad:9f03:aa1f with SMTP id gl18-20020a170906e0d200b007ad9f03aa1fmr14222860ejb.632.1668523311250; Tue, 15 Nov 2022 06:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668523311; cv=none; d=google.com; s=arc-20160816; b=TN6xiG86vbippi01NT3gQ1NS45G+mWChfdMizZ4kigcd1/ghGsP5v2TqeCOn4PRflT N6qOeOAOvFNDj5EPfOmb/U1PqKY3693C4/JKLA0VBB4Uw/RI4mCoL9JyftFK089PnxDf qrMz4R33poAE5SEzNmyJ9rs6VQzzoDHiPYNllsfdX+IA8A2kvyHbxEmTnoQENWOROQau y2PVlj8LFGhQDUXPcB6Uja1Gz8k8fXfiAz6vKMRGpGF3e3cJhcCFMK1a6AdXx4Bpmxch mc7+ZTFSrPSVEQkBAntCbf7jTLec25YU9j/jNGH8OYMdLnFkJLdYEP7iN4yZ6CE3Mthp qERg== 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=AsXBdmB4zXWZpappV1x7oAQaaHwc6BHUZPHScgnWPoE=; b=It7xtkSGoSPYxxjt2ENsHG0CfhOhne5l/t2ASR+i33eJN1Wa8F7GjRTvA+oFjy2eIK xWKYvcjM8x8z7j7VzJrKHdMMN9qPg4NYjo34JW5b3QVOriI0PjqKweWfNrsgHocRRwHy NXD+ZgFu1aKN6Mmm8DidNS8BQkwSHk/3/Si5dR8TRPt8oyc/iZEjR0LcS3ue3mbML+tc s5QQWFzFiRvwV6BwoqcTndx/53Z6eUUrU1g6RDif8FWVOee11MmvFQjOaIUisapRq6EP XBk4WYJMCk+/lb+Fq6aANezdGq37MZ7+s0m6Iiiijhv+XzkQr3tGukihXFwaMOUXDvZG rezA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di17-20020a170906731100b00782e1a663dcsi8804842ejc.435.2022.11.15.06.41.22; Tue, 15 Nov 2022 06:41:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230402AbiKOOfh (ORCPT + 99 others); Tue, 15 Nov 2022 09:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiKOOff (ORCPT ); Tue, 15 Nov 2022 09:35:35 -0500 X-Greylist: delayed 495 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Nov 2022 06:35:29 PST Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AEC31401B; Tue, 15 Nov 2022 06:35:29 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 8147F1864269; Tue, 15 Nov 2022 17:27:10 +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 4-vJmt9wN1H0; Tue, 15 Nov 2022 17:27:10 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 352F4186422F; Tue, 15 Nov 2022 17:27:10 +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 y9MG4Fq2LoDP; Tue, 15 Nov 2022 17:27:10 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.20]) by mail.astralinux.ru (Postfix) with ESMTPSA id 7D4AC1864248; Tue, 15 Nov 2022 17:27:09 +0300 (MSK) From: Anastasia Belova To: Steve French Cc: Anastasia Belova , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Aurelien Aptel , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] cifs: add check for returning value of SMB2_close_init Date: Tue, 15 Nov 2022 17:27:01 +0300 Message-Id: <20221115142701.27074-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749573499646573002?= X-GMAIL-MSGID: =?utf-8?q?1749573499646573002?= 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 Reviewed-by: Paulo Alcantara (SUSE) --- 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,