diff mbox series

[for-next,1/2] RDMA/hns: Fix potential memory leak in free_dip_list

Message ID 20211231101341.45759-2-liangwenpeng@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Leon Romanovsky
Headers show
Series Bugfix or cleanup related to hns hardware version | expand

Commit Message

Wenpeng Liang Dec. 31, 2021, 10:13 a.m. UTC
Hardware with a higher version than HIP09 should also release dip memory.

Fixes: f91696f2f053 ("RDMA/hns: Support congestion control type selection according to the FW")
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Jan. 4, 2022, 8:37 a.m. UTC | #1
On Fri, Dec 31, 2021 at 06:13:40PM +0800, Wenpeng Liang wrote:
> Hardware with a higher version than HIP09 should also release dip memory.
> 
> Fixes: f91696f2f053 ("RDMA/hns: Support congestion control type selection according to the FW")
> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> index e681c2dc23e8..d0c0ea6754f6 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> @@ -2769,7 +2769,7 @@ static void hns_roce_v2_exit(struct hns_roce_dev *hr_dev)
>  	if (!hr_dev->is_vf)
>  		hns_roce_free_link_table(hr_dev);
>  
> -	if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP09)
> +	if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)

Are you referring to out-of-tree code? In upstream code,
PCI_REVISION_ID_HIP09 is the highest revision.

Thanks

>  		free_dip_list(hr_dev);
>  }
>  
> -- 
> 2.33.0
>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index e681c2dc23e8..d0c0ea6754f6 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -2769,7 +2769,7 @@  static void hns_roce_v2_exit(struct hns_roce_dev *hr_dev)
 	if (!hr_dev->is_vf)
 		hns_roce_free_link_table(hr_dev);
 
-	if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP09)
+	if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)
 		free_dip_list(hr_dev);
 }