Re: [PATCH for-next 12/22] RDMA/rtrs-clt: Check state of the rtrs_clt_sess before reading its stats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 25, 2021 at 04:32:58PM +0100, Gioh Kim wrote:
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index 42f49208b8f7..1519191d7154 100644
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -808,6 +808,9 @@ static struct rtrs_clt_sess *get_next_path_min_inflight(struct path_it *it)
>  	int inflight;
>  
>  	list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) {
> +		if (unlikely(READ_ONCE(sess->state) != RTRS_CLT_CONNECTED))
> +			continue;

There is no way this could be right, a READ_ONCE can't guarentee that
a following load is not going to happen without races.

You need locking.

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux