From: Zhu Yanjun Date: Mon, 23 Oct 2017 06:50:22 +0000 (-0400) Subject: xscore: add dma address check X-Git-Tag: v4.1.12-117.0_27200813_3~47 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ef67b1b232de7f71e961f3d73b240df615ac767c;p=users%2Fjedix%2Flinux-maple.git xscore: add dma address check When "swiotlb buffer is full" error occurs, the DMA allocation will fail. The data conn and control conn are disconnected. Then xscore will make error handling. In this error handling, the unallocated DMA address is unmapped. This will result in the crash. To avoid crash, the dma address check is added. Orabug: 27074085 Signed-off-by: Zhu Yanjun Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Dhaval Giani --- diff --git a/drivers/infiniband/ulp/xsigo/xscore/xscore_api.c b/drivers/infiniband/ulp/xsigo/xscore/xscore_api.c index 524922010f2d5..1cb4d6593fee5 100644 --- a/drivers/infiniband/ulp/xsigo/xscore/xscore_api.c +++ b/drivers/infiniband/ulp/xsigo/xscore/xscore_api.c @@ -1282,7 +1282,8 @@ static void xscore_reclaim_recv_buffers(struct xscore_conn_ctx *ctx) desc->sg_mapping[j], PAGE_SIZE, DMA_FROM_DEVICE); - } else if (desc->skb || desc->vaddr) { + } else if ((desc->skb || desc->vaddr) && + (desc->sg_mapping[0])) { ib_dma_unmap_single(ca, desc->sg_mapping[0], desc->size, DMA_FROM_DEVICE);