From: Ferruh Yigit Date: Tue, 22 Jun 2021 12:29:56 +0000 (+0100) Subject: kni: fix crash on userspace VA for segmented packets X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9b83a7ed2ac160aca64eed4d45102aadf26bc053;p=dpdk.git kni: fix crash on userspace VA for segmented packets When IOVA=VA, address translation for segmented packets is wrong, it assumes the address in the mbuf->next is physical address, not VA address. Fixing the address translation to work both PA & VA mode. Fixes: e73831dc6c26 ("kni: support userspace VA") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit Acked-by: Ajit Khaparde --- diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index f259327954..611719b5ee 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -245,7 +245,7 @@ kni_fifo_trans_pa2va(struct kni_dev *kni, break; prev_kva = kva; - kva = pa2kva(kva->next); + kva = get_kva(kni, kva->next); /* Convert physical address to virtual address */ prev_kva->next = pa2va(prev_kva->next, kva); } @@ -422,7 +422,7 @@ kni_net_rx_normal(struct kni_dev *kni) break; prev_kva = kva; - kva = pa2kva(kva->next); + kva = get_kva(kni, kva->next); data_kva = kva2data_kva(kva); /* Convert physical address to virtual address */ prev_kva->next = pa2va(prev_kva->next, kva); @@ -501,7 +501,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni) kni->va[i] = pa2va(kni->pa[i], kva); while (kva->next) { - next_kva = pa2kva(kva->next); + next_kva = get_kva(kni, kva->next); /* Convert physical address to virtual address */ kva->next = pa2va(kva->next, next_kva); kva = next_kva;