Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3069035pxj; Mon, 17 May 2021 16:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuA4TqlU9+VKL2aj5LV8dloKngYko1UPwm+n66Rwqm2Lp8f+teU64+0rzoKG/f6d1k4akx X-Received: by 2002:a05:6402:5243:: with SMTP id t3mr3249184edd.146.1621295988036; Mon, 17 May 2021 16:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621295988; cv=none; d=google.com; s=arc-20160816; b=J+LDsCFK11sIX5Ao+P6jojUREjSbylN8hnS8WBoE2bLmjWYSGny7Tfuun5Yjb6IAf5 6Q5X7ApdL5e8GupanRs3ICE0t17Y2Rg8X64Z07SFJsVz6DpT3J86s2+3O2HzsvXR78P6 9paqoqDP6237u/Gc7JifUs4AYZxuteFnPFENbO3307U2Eirsp31gBho9/pTycVfotYsU L7jct0ehrV4Dn/Ja2bFMc7O0wwprS1pWIkdGm0801L17sXSAT2tIusPgtqDgmII+3HRy 6zviafTDtn8oaB0nV+SCUhZ7Zw3GqzxoqDrGsZHEnhUR8GRNjLxKbsDvb8daxhuPdvpq 5BzA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=koSOjcU8D19PD7C863CTyK5d2Lj9BrofuNkN+pfiK+Q=; b=uUll8eumU8Lt8cXEnRdxm2WWPTNvyl1I3Wf7nH0cW9ZQEniFPvGvYcIcVu8c2ZNRgh e8S3SL9jOPQm/UdDOY/a9B/hwd53Ty3L/pY2/ivEIZDqS76AyOsf+d5e6cP7IddpVD9b o8mqJdhZjinwhL3TXeNq8bbpSvNaRvRQ3rYcvNSXg1iGDDcXbYnHt8whlqs8aXW3q5Bx xCbAM0mKCBOuvkh8m2Z7uIW9k2Wo0eZNvsQ7mWkb0GYtazrk89KgnXGFtvOeMncOS678 x4u0xHK+aQdNgRmGKY1MMQUX4reUdNf//dMA5jC/GRMNu3H6iO0Z+QSdMIcd7rhaEdgI zoTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vpm1sQ/D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si16778293ejy.43.2021.05.17.16.59.24; Mon, 17 May 2021 16:59:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vpm1sQ/D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235802AbhEQOZb (ORCPT + 99 others); Mon, 17 May 2021 10:25:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239193AbhEQOWS (ORCPT ); Mon, 17 May 2021 10:22:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F1390610A0; Mon, 17 May 2021 14:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260708; bh=wRIMUKf8f9czpJ2k7bhptKZpLNn6+LmfvKRAV48OawA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vpm1sQ/DnANcPtXlmawCRMxaiP4XUX56NSoYOD7RzNfBzffBBw0/7df7C4HytRpfx 0DM/r9EG1Bq1q12BblBEREFUl+hnGeSutlECAvqjSw8EFcbJBqRHQVy1VQRy2sw2q9 GcAxKQK5VEO0UVBbMWSR65JQjH0kzeRuIsfvCtpU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Md Haris Iqbal , Guoqing Jiang , Jack Wang , Gioh Kim , Jens Axboe , Sasha Levin Subject: [PATCH 5.12 204/363] block/rnbd-clt: Check the return value of the function rtrs_clt_query Date: Mon, 17 May 2021 16:01:10 +0200 Message-Id: <20210517140309.479153706@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Md Haris Iqbal [ Upstream commit 1056ad829ec43f9b705b507c2093b05e2088b0b7 ] In case none of the paths are in connected state, the function rtrs_clt_query returns an error. In such a case, error out since the values in the rtrs_attrs structure would be garbage. Fixes: f7a7a5c228d45 ("block/rnbd: client: main functionality") Signed-off-by: Md Haris Iqbal Reviewed-by: Guoqing Jiang Signed-off-by: Jack Wang Signed-off-by: Gioh Kim Link: https://lore.kernel.org/r/20210428061359.206794-4-gi-oh.kim@ionos.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/rnbd/rnbd-clt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c index 45a470076652..5ab7319ff2ea 100644 --- a/drivers/block/rnbd/rnbd-clt.c +++ b/drivers/block/rnbd/rnbd-clt.c @@ -693,7 +693,11 @@ static void remap_devs(struct rnbd_clt_session *sess) return; } - rtrs_clt_query(sess->rtrs, &attrs); + err = rtrs_clt_query(sess->rtrs, &attrs); + if (err) { + pr_err("rtrs_clt_query(\"%s\"): %d\n", sess->sessname, err); + return; + } mutex_lock(&sess->lock); sess->max_io_size = attrs.max_io_size; @@ -1234,7 +1238,11 @@ find_and_get_or_create_sess(const char *sessname, err = PTR_ERR(sess->rtrs); goto wake_up_and_put; } - rtrs_clt_query(sess->rtrs, &attrs); + + err = rtrs_clt_query(sess->rtrs, &attrs); + if (err) + goto close_rtrs; + sess->max_io_size = attrs.max_io_size; sess->queue_depth = attrs.queue_depth; -- 2.30.2