Skip to content

Commit

Permalink
block/rnbd-clt: Check the return value of the function rtrs_clt_query
Browse files Browse the repository at this point in the history
[ Upstream commit 1056ad8 ]

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: f7a7a5c ("block/rnbd: client: main functionality")
Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Reviewed-by: Guoqing Jiang <guoqing.jiang@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
Link: https://lore.kernel.org/r/20210428061359.206794-4-gi-oh.kim@ionos.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Md Haris Iqbal authored and gregkh committed May 19, 2021
1 parent c1a9029 commit 3d80891
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/block/rnbd/rnbd-clt.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 3d80891

Please sign in to comment.