Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp479737pxj; Tue, 18 May 2021 07:39:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAALUsx/1kVmX1p95AUdRb9LtaZ7E+1i81VCFoi+zQjz1zKrifbiUvGO03h8pp7kE3o7D7 X-Received: by 2002:a17:907:3e0b:: with SMTP id hp11mr6180032ejc.171.1621348763218; Tue, 18 May 2021 07:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621348763; cv=none; d=google.com; s=arc-20160816; b=K79r53tAxsuFWdEXxqNrOZ/hzskJuPvgSFupWkrPCYyRJx2DOz+Vc8YZEaKopg1+k8 rbVWsVu7UrjDOmeeuiLTYrTak/xwacAyqj+eK2Ep4D6WJKFcd/kk+eetChm4pVTruxN7 OP5XLlR18Tu+CMr5kxiOoY5rlwdi5A/k2c9cOBc8dWxL82V+GbGWU6NYNFkaaLO/AdzC yKwKX4QerAwhn03xbiLkCdOdVo0LwOCMk1D4mUMv6KC6FeZWAfwrSCNOy8TpFLDYWV+W mM6oT1txGHA2tCfnWaTSYZUmqA4d+ab7UkWyP0A+pqACs4v8Q3ZPmsTwHfXAo2Lk1AJG j0xQ== 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=cLV2wZZ8HrW4xXp8e/xrGzfh9MzJ3TgiImyvPEkpHTc=; b=JopIWSlL4U203SyPHSZQQVahBLfg0RFSeubawjOe6ey9RECD0WprB7XPPRNyU2Hnkq +fTEFSZk8PgcjAf+n6E4K7gVgwC6wU0wOGzWdyjJFvQFVW6v7MDP6tPUiE3198gwefsl q7J0Dxd2KZ8eQNbdh6H2wIfoon7M8L2Akgd8rF5b4yFb2dOEgNCgqz109qwh3bg0jB37 2m26colvFwXXWFyPCMc2149HJc3R4Bb2HTperlD9sxXlDuddA3CLsHtWQeM0yZdXuZ+h zkHk72YGsNQ9skUjnynesdNFycA+5d6OBiNwMqzGpNn+zdkiRp2iFnjvARpbTmWK4t37 14yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENpuwHMt; 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 i12si15509448edr.394.2021.05.18.07.38.58; Tue, 18 May 2021 07:39:23 -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=ENpuwHMt; 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 S244948AbhEQPrW (ORCPT + 99 others); Mon, 17 May 2021 11:47:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:57350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243072AbhEQPb2 (ORCPT ); Mon, 17 May 2021 11:31:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B0CB7613F7; Mon, 17 May 2021 14:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262300; bh=P9LNJfZVMETolnPmcQMKXlWFJEtYJqWcQNRs47Gp0Pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENpuwHMtMV9mNRaj1A6BlM8hWwxtIDdAfEOgfh/5bI7uxLQMrUFi9QDIRB1poj6sH E+EfwY1deD2oEdB6UhJ2laORWWFV2Xv6XRIl70j4UKiZ6s4c5BrKWQ/G6yMq9sjhZW pjUNjpTNZ7/cdQp3g/Ev8pkPTNlfxYJFGLHovA4A= 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.10 156/289] block/rnbd-clt: Check the return value of the function rtrs_clt_query Date: Mon, 17 May 2021 16:01:21 +0200 Message-Id: <20210517140310.385643619@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 ba334fe7626d..71b86fee81c2 100644 --- a/drivers/block/rnbd/rnbd-clt.c +++ b/drivers/block/rnbd/rnbd-clt.c @@ -679,7 +679,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; @@ -1211,7 +1215,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