From patchwork Tue Oct 24 10:02:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Belova X-Patchwork-Id: 157360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1832984vqx; Tue, 24 Oct 2023 03:03:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHm2pMPL/5hsMwoYATYncvyXW4MbeKVvHZKviCb02DcfjaHEVLmiztDlGL8ByEBh1z43gci X-Received: by 2002:a05:6a21:a59f:b0:149:700e:f50a with SMTP id gd31-20020a056a21a59f00b00149700ef50amr3051345pzc.29.1698141829035; Tue, 24 Oct 2023 03:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698141829; cv=none; d=google.com; s=arc-20160816; b=dD8VLdn0CxBy9Hgg1LpdNxpQKHLSdG8iP+SiyCKDgNWcBF2p/2TYkG22S7oZo4K/wk z+k2ZQbBqha9E4USwnQq1nCeTCAblGbFXLxtE9EpF5byNuHwLm1Hn7jAesE5VqkgY2dv 5rp/E1akMNhVehy/J9x7pT+4m8uciasG1D88XoYl0w5IMJIuNS5NDN8dikM7lrDtN8h2 zCsZAqzxTw2w1DUPB2FSPZHS1Gv5HFyaY6w5IYYruiyKUEnzYcTO7ddFvncoKUa7NUK/ U67raCIkbS2l/ys8RHmlzyZBCS3+rD7ZhlcfcTPcqiFfVw6tW8iTNqYueNaVmv/zmwym k0Xw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=69pHW99tE7i6dFZv0iunaIxFxAAXjmgFeTfEXpowq4s=; fh=qxQapqUP9+86mgpfb7aDmjyr6NCQha3xXjoMSp3kRuI=; b=kCq+o4laE7Vdip8yBXh94i2kCp6gLsZ4RK6hhU5I/r0dWuL7Q/r9H/ws8B70cdR+4N CHwaj8/uqu5EyMgsWF416SPzK3XjUl/7NEi0EJ8tGbzi+udyZcNcoFwUq52vuMegBnis 9AlU0lewsWU/bQNtUGhbSfAaQTm9Teud1yF6AbMxeEuwPq4RTAXVhWNphoQcSPgqx6lz h0I0C2in5RL9iZvh0rH2J21mCkeLNiphb6x6blgKC61Obi9jbtVllRjHvTagHJ6Duehz c6+5llQb2EnZHWhzpttxmmkHHp26wUZ5jNhCmzkRFaYd2/wMx3vSvOTesrXmJEauNzcx XgrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id l133-20020a633e8b000000b00565e7a3342dsi8428037pga.256.2023.10.24.03.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 03:03:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 7A8AB8086925; Tue, 24 Oct 2023 03:03:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234354AbjJXKDO (ORCPT + 26 others); Tue, 24 Oct 2023 06:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbjJXKDK (ORCPT ); Tue, 24 Oct 2023 06:03:10 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3729DEA; Tue, 24 Oct 2023 03:03:08 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 9B86F18685AA; Tue, 24 Oct 2023 13:03: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 U9j6gZZ_QIsU; Tue, 24 Oct 2023 13:03:06 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 120331867D87; Tue, 24 Oct 2023 13:03: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 timcU0KQJ8eb; Tue, 24 Oct 2023 13:03:05 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.58]) by mail.astralinux.ru (Postfix) with ESMTPSA id B322E186785A; Tue, 24 Oct 2023 13:03:04 +0300 (MSK) From: Anastasia Belova To: stable@vger.kernel.org, Greg Kroah-Hartman Cc: Anastasia Belova , Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Tom Talpey , Long Li , Steve French Subject: [PATCH 5.10 1/1] smbdirect: missing rc checks while waiting for rdma events Date: Tue, 24 Oct 2023 13:02:26 +0300 Message-Id: <20231024100226.25860-2-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231024100226.25860-1-abelova@astralinux.ru> References: <20231024100226.25860-1-abelova@astralinux.ru> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 24 Oct 2023 03:03:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780630757298356124 X-GMAIL-MSGID: 1780630766124108397 From: Steve French commit 0555b221528e9cb11f5766dcdee19c809187e42e upstream. There were two places where we weren't checking for error (e.g. ERESTARTSYS) while waiting for rdma resolution. Addresses-Coverity: 1462165 ("Unchecked return value") Reviewed-by: Tom Talpey Reviewed-by: Long Li Signed-off-by: Steve French Signed-off-by: Anastasia Belova --- fs/cifs/smbdirect.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index bcc611069308..7d18b9268817 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -571,8 +571,13 @@ static struct rdma_cm_id *smbd_create_id( log_rdma_event(ERR, "rdma_resolve_addr() failed %i\n", rc); goto out; } - wait_for_completion_interruptible_timeout( + rc = wait_for_completion_interruptible_timeout( &info->ri_done, msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT)); + /* e.g. if interrupted returns -ERESTARTSYS */ + if (rc < 0) { + log_rdma_event(ERR, "rdma_resolve_addr timeout rc: %i\n", rc); + goto out; + } rc = info->ri_rc; if (rc) { log_rdma_event(ERR, "rdma_resolve_addr() completed %i\n", rc); @@ -585,8 +590,13 @@ static struct rdma_cm_id *smbd_create_id( log_rdma_event(ERR, "rdma_resolve_route() failed %i\n", rc); goto out; } - wait_for_completion_interruptible_timeout( + rc = wait_for_completion_interruptible_timeout( &info->ri_done, msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT)); + /* e.g. if interrupted returns -ERESTARTSYS */ + if (rc < 0) { + log_rdma_event(ERR, "rdma_resolve_addr timeout rc: %i\n", rc); + goto out; + } rc = info->ri_rc; if (rc) { log_rdma_event(ERR, "rdma_resolve_route() completed %i\n", rc);