diff mbox

[for-next,1/3] RDMA/hns: Fix a bug with modifying mac address

Message ID 1517920459-93900-2-git-send-email-oulijun@huawei.com (mailing list archive)
State Rejected
Headers show

Commit Message

Lijun Ou Feb. 6, 2018, 12:34 p.m. UTC
When modifying mac address, it will trigger hns_roce_del_gid
function and can't delete the default gid matched the index
because the attribute of gid is null.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jason Gunthorpe Feb. 6, 2018, 3:53 p.m. UTC | #1
On Tue, Feb 06, 2018 at 08:34:17PM +0800, Lijun Ou wrote:
> When modifying mac address, it will trigger hns_roce_del_gid
> function and can't delete the default gid matched the index
> because the attribute of gid is null.
> 
> Signed-off-by: Lijun Ou <oulijun@huawei.com>
>  drivers/infiniband/hw/hns/hns_roce_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
> index eb9a69f..6f39afb 100644
> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
> @@ -100,6 +100,7 @@ static int hns_roce_del_gid(struct ib_device *device, u8 port_num,
>  			    unsigned int index, void **context)
>  {
>  	struct hns_roce_dev *hr_dev = to_hr_dev(device);
> +	const struct ib_gid_attr zattr;

That is uninited stack memory, need a = {}

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lijun Ou Feb. 8, 2018, 12:58 a.m. UTC | #2
在 2018/2/6 23:53, Jason Gunthorpe 写道:
> On Tue, Feb 06, 2018 at 08:34:17PM +0800, Lijun Ou wrote:
>> When modifying mac address, it will trigger hns_roce_del_gid
>> function and can't delete the default gid matched the index
>> because the attribute of gid is null.
>>
>> Signed-off-by: Lijun Ou <oulijun@huawei.com>
>>  drivers/infiniband/hw/hns/hns_roce_main.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
>> index eb9a69f..6f39afb 100644
>> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
>> @@ -100,6 +100,7 @@ static int hns_roce_del_gid(struct ib_device *device, u8 port_num,
>>  			    unsigned int index, void **context)
>>  {
>>  	struct hns_roce_dev *hr_dev = to_hr_dev(device);
>> +	const struct ib_gid_attr zattr;
> 
> That is uninited stack memory, need a = {}
> 
> Jason
> 
> 
Thanks, I have sent the patch V2.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index eb9a69f..6f39afb 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -100,6 +100,7 @@  static int hns_roce_del_gid(struct ib_device *device, u8 port_num,
 			    unsigned int index, void **context)
 {
 	struct hns_roce_dev *hr_dev = to_hr_dev(device);
+	const struct ib_gid_attr zattr;
 	union ib_gid zgid = { {0} };
 	u8 port = port_num - 1;
 	unsigned long flags;
@@ -110,7 +111,7 @@  static int hns_roce_del_gid(struct ib_device *device, u8 port_num,
 
 	spin_lock_irqsave(&hr_dev->iboe.lock, flags);
 
-	ret = hr_dev->hw->set_gid(hr_dev, port, index, &zgid, NULL);
+	ret = hr_dev->hw->set_gid(hr_dev, port, index, &zgid, &zattr);
 
 	spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);