vdpa/mlx5: Fix oversized null mkey longer than 32bit
Subsystems (4)
Dragos Tatulea
maintainerPATCH v2 1/1 vdpa/mlx5: Fix oversized null mkey longer than 32bit
From: Si-Wei Liu <[email protected]>
create_user_mr() has correct code to count the number of null keys used to fill in a hole for the memory map. However, fill_indir() does not follow the same to cap the range up to the 1GB limit correspondingly. Fill in more null keys for the gaps in between, so that null keys are correctly populated.
---
Changes in v2:
- Added Reported-by tag.
- Fixed typo found during review.
--- drivers/vdpa/mlx5/core/mr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/core/mr.c +5 -2
@@ -190,9 +190,12 @@ static void fill_indir(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_mr *mkey, v klm->bcount =cpu_to_be32 (klm_bcount (dmr->end - dmr->start)); preve = dmr->end; }else { +u64 bcount =min_t (u64, dmr->start - preve,MAX_KLM_SIZE ); + klm->key =cpu_to_be32 (mvdev->res.null_mkey); - klm->bcount =cpu_to_be32 (klm_bcount (dmr->start - preve)); - preve = dmr->start; + klm->bcount =cpu_to_be32 (klm_bcount (bcount)); + preve += bcount; + goto again; } }
Signature · 1 line
2.43.0
Quoted 9 lines · Dragos Tatulea
From: Si-Wei Liu <[email protected]>
create_user_mr()has correct code to count the number of null keys used to fill in a hole for the memory map. However,fill_indir()does not follow the same to cap the range up to the 1GB limit correspondingly. Fill in more null keys for the gaps in between, so that null keys are correctly populated.
Quoted 6 lines
Fixes 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")Reported-by Cong Meng <[email protected]>Signed-off-by Si-Wei Liu <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>Acked-by Eugenio Pérez <[email protected]>
Thanks
Lei Yang
Tested-byI tested this patch with virtio-net and mlx5 vdpa regression tests, everything works fine.
Quoted 23 lines · Jason Wang
Quoted 9 lines · Dragos Tatulea
From: Si-Wei Liu <[email protected]>
create_user_mr()has correct code to count the number of null keys used to fill in a hole for the memory map. However,fill_indir()does not follow the same to cap the range up to the 1GB limit correspondingly. Fill in more null keys for the gaps in between, so that null keys are correctly populated.Quoted 6 lines
Fixes 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")Reported-by Cong Meng <[email protected]>Signed-off-by Si-Wei Liu <[email protected]>Signed-off-by Dragos Tatulea <[email protected]>Acked-by Eugenio Pérez <[email protected]>Acked-by Jason Wang <[email protected]>Thanks