Re: [PATCH for-next 7/9] RDMA/hns: Prevent the gid overflow

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

 



在 2019/2/23 0:24, Jason Gunthorpe 写道:
> On Fri, Feb 22, 2019 at 12:21:06PM +0800, Lijun Ou wrote:
>> Because hip08 supports up to 256 gids and hip06 supports up to 2 gids, it
>> adds judgement for preventing the gid overflow.
>>
>> Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx>
>>  drivers/infiniband/hw/hns/hns_roce_main.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
>> index 29fb4fb..e3f79d1 100644
>> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
>> @@ -81,8 +81,12 @@ static int hns_roce_add_gid(const struct ib_gid_attr *attr, void **context)
>>  	unsigned long flags;
>>  	int ret;
>>  
>> -	if (port >= hr_dev->caps.num_ports)
>> +	if (port >= hr_dev->caps.num_ports ||
>> +	    attr->index > hr_dev->caps.gid_table_len[port]) {
>> +		dev_err(hr_dev->dev, "add gid failed. port - %d, index - %d\n",
>> +			port, attr->index);
>>  		return -EINVAL;
>> +	}
> The core code already checks these values, drivers should not
> duplicate core checks. 
>
> Drop these tests and make sure that
> ib_dev->port_data[rdma_port].immutable.gid_tbl_len is right.
>
> Jason
>
Yes, the gid_tbl_len is fixed in hns_roce_query_device. This fixes is required by our test team and I was reserved at the time. I will drop it






[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