Patch "RDMA/core: Set sgtable nents when using ib_dma_virt_map_sg()" has been added to the 5.15-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    RDMA/core: Set sgtable nents when using ib_dma_virt_map_sg()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-core-set-sgtable-nents-when-using-ib_dma_virt_m.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8c7f93d071a87932b07e45970e71bd19eaff3490
Author: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Date:   Wed Oct 13 10:59:42 2021 -0600

    RDMA/core: Set sgtable nents when using ib_dma_virt_map_sg()
    
    [ Upstream commit ac0fffa0859b8e1e991939663b3ebdd80bf979e6 ]
    
    ib_dma_map_sgtable_attrs() should be mapping the sgls and setting nents
    but the ib_uses_virt_dma() path falls back to ib_dma_virt_map_sg() which
    will not set the nents in the sgtable.
    
    Check the return value (per the map_sg calling convention) and set
    sgt->nents appropriately on success.
    
    Fixes: 79fbd3e1241c ("RDMA: Use the sg_table directly and remove the opencoded version from umem")
    Link: https://lore.kernel.org/r/20211013165942.89806-1-logang@xxxxxxxxxxxx
    Reported-by: Bart Van Assche <bvanassche@xxxxxxx>
    Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
    Tested-by: Bart Van Assche <bvanassche@xxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 4b50d9a3018a6..4ba642fc8a19a 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -4097,8 +4097,13 @@ static inline int ib_dma_map_sgtable_attrs(struct ib_device *dev,
 					   enum dma_data_direction direction,
 					   unsigned long dma_attrs)
 {
+	int nents;
+
 	if (ib_uses_virt_dma(dev)) {
-		ib_dma_virt_map_sg(dev, sgt->sgl, sgt->orig_nents);
+		nents = ib_dma_virt_map_sg(dev, sgt->sgl, sgt->orig_nents);
+		if (!nents)
+			return -EIO;
+		sgt->nents = nents;
 		return 0;
 	}
 	return dma_map_sgtable(dev->dma_device, sgt, direction, dma_attrs);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux