Skip to content

Commit 1056ad8

Browse files
Md Haris Iqbalaxboe
authored andcommitted
block/rnbd-clt: Check the return value of the function rtrs_clt_query
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 <[email protected]> Reviewed-by: Guoqing Jiang <[email protected]> Signed-off-by: Jack Wang <[email protected]> Signed-off-by: Gioh Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 292660f commit 1056ad8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/block/rnbd/rnbd-clt.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,11 @@ static void remap_devs(struct rnbd_clt_session *sess)
691691
return;
692692
}
693693

694-
rtrs_clt_query(sess->rtrs, &attrs);
694+
err = rtrs_clt_query(sess->rtrs, &attrs);
695+
if (err) {
696+
pr_err("rtrs_clt_query(\"%s\"): %d\n", sess->sessname, err);
697+
return;
698+
}
695699
mutex_lock(&sess->lock);
696700
sess->max_io_size = attrs.max_io_size;
697701

@@ -1294,7 +1298,11 @@ find_and_get_or_create_sess(const char *sessname,
12941298
err = PTR_ERR(sess->rtrs);
12951299
goto wake_up_and_put;
12961300
}
1297-
rtrs_clt_query(sess->rtrs, &attrs);
1301+
1302+
err = rtrs_clt_query(sess->rtrs, &attrs);
1303+
if (err)
1304+
goto close_rtrs;
1305+
12981306
sess->max_io_size = attrs.max_io_size;
12991307
sess->queue_depth = attrs.queue_depth;
13001308
sess->nr_poll_queues = nr_poll_queues;

0 commit comments

Comments
 (0)