Thread (6 messages) 6 messages, 3 authors, 2021-10-13

Re: Kernel warning at drivers/infiniband/core/rw.c:349

From: Bart Van Assche <bvanassche@acm.org>
Date: 2021-10-13 16:38:48

On 10/13/21 9:15 AM, Logan Gunthorpe wrote:
quoted hunk ↗ jump to hunk
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 4b50d9a3018a..4ba642fc8a19 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_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);
Thanks!

Tested-by: Bart Van Assche <bvanassche@acm.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help