diff mbox

[rdma] IB/rxe: Update caller's CRC for RXE_MEM_TYPE_DMA memory type

Message ID 20170504123607.22708-1-leon@kernel.org (mailing list archive)
State Accepted
Headers show

Commit Message

Leon Romanovsky May 4, 2017, 12:36 p.m. UTC
From: Leon Romanovsky <leonro@mellanox.com>

Callers of rxe_mem_copy() provide pointer to store updated CRC
value. That pointer was supposed to be updated, but the
commit cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
mistakenly removed that assignment for RXE_MEM_TYPE_DMA memory type.

The code worked because there are no actual callers with
RXE_MEM_TYPE_DMA, who are interested in returned value of crcp.
The one caller in read_reply(), who uses the returned crcp didn't
set RXE_MEM_TYPE_DMA as mem->type.

Fixes: cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
Reported-by: Andrew Boyer <andrew.boyer@dell.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Moni Shoua <monis@mellanox.com>
---
Hi Doug,

It will be great if you forward this patch as part of your second pull request.
As you can see from the commit message, it fixes issue spotted by Andrew.

Thanks
---
 drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andrew Boyer May 4, 2017, 1:21 p.m. UTC | #1
On 5/4/17, 8:36 AM, "linux-rdma-owner@vger.kernel.org on behalf of Leon
Romanovsky" <linux-rdma-owner@vger.kernel.org on behalf of
leon@kernel.org> wrote:

>From: Leon Romanovsky <leonro@mellanox.com>
>
>Callers of rxe_mem_copy() provide pointer to store updated CRC
>value. That pointer was supposed to be updated, but the
>commit cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
>mistakenly removed that assignment for RXE_MEM_TYPE_DMA memory type.
>
>The code worked because there are no actual callers with
>RXE_MEM_TYPE_DMA, who are interested in returned value of crcp.
>The one caller in read_reply(), who uses the returned crcp didn't
>set RXE_MEM_TYPE_DMA as mem->type.
>
>Fixes: cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
>Reported-by: Andrew Boyer <andrew.boyer@dell.com>
>Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>Acked-by: Moni Shoua <monis@mellanox.com>
>---
>Hi Doug,
>
>It will be great if you forward this patch as part of your second pull
>request.
>As you can see from the commit message, it fixes issue spotted by Andrew.
>
>Thanks
>---
> drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Andrew Boyer <andrew.boyer@dell.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sagi Grimberg May 4, 2017, 1:23 p.m. UTC | #2
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky May 4, 2017, 2:15 p.m. UTC | #3
On Thu, May 04, 2017 at 01:21:15PM +0000, Boyer, Andrew wrote:
>
> On 5/4/17, 8:36 AM, "linux-rdma-owner@vger.kernel.org on behalf of Leon
> Romanovsky" <linux-rdma-owner@vger.kernel.org on behalf of
> leon@kernel.org> wrote:
>
> >From: Leon Romanovsky <leonro@mellanox.com>
> >
> >Callers of rxe_mem_copy() provide pointer to store updated CRC
> >value. That pointer was supposed to be updated, but the
> >commit cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
> >mistakenly removed that assignment for RXE_MEM_TYPE_DMA memory type.
> >
> >The code worked because there are no actual callers with
> >RXE_MEM_TYPE_DMA, who are interested in returned value of crcp.
> >The one caller in read_reply(), who uses the returned crcp didn't
> >set RXE_MEM_TYPE_DMA as mem->type.
> >
> >Fixes: cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
> >Reported-by: Andrew Boyer <andrew.boyer@dell.com>
> >Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> >Acked-by: Moni Shoua <monis@mellanox.com>
> >---
> >Hi Doug,
> >
> >It will be great if you forward this patch as part of your second pull
> >request.
> >As you can see from the commit message, it fixes issue spotted by Andrew.
> >
> >Thanks
> >---
> > drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Andrew Boyer <andrew.boyer@dell.com>

Thank you for catching, reviewing and testing it.
Doug Ledford May 4, 2017, 11:46 p.m. UTC | #4
On Thu, 2017-05-04 at 15:36 +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Callers of rxe_mem_copy() provide pointer to store updated CRC
> value. That pointer was supposed to be updated, but the
> commit cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
> mistakenly removed that assignment for RXE_MEM_TYPE_DMA memory type.
> 
> The code worked because there are no actual callers with
> RXE_MEM_TYPE_DMA, who are interested in returned value of crcp.
> The one caller in read_reply(), who uses the returned crcp didn't
> set RXE_MEM_TYPE_DMA as mem->type.
> 
> Fixes: cee2688e3cd6 ("IB/rxe: Offload CRC calculation when possible")
> Reported-by: Andrew Boyer <andrew.boyer@dell.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> Acked-by: Moni Shoua <monis@mellanox.com>
> ---
> Hi Doug,
> 
> It will be great if you forward this patch as part of your second
> pull request.
> As you can see from the commit message, it fixes issue spotted by
> Andrew.

I've queued it for my second pull request, thanks.
diff mbox

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index ced15c4446bd..e37cc89987e1 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -368,7 +368,7 @@  int rxe_mem_copy(struct rxe_mem *mem, u64 iova, void *addr, int length,
 			((void *)(uintptr_t)iova) : addr;

 		if (crcp)
-			crc = rxe_crc32(to_rdev(mem->pd->ibpd.device),
+			*crcp = rxe_crc32(to_rdev(mem->pd->ibpd.device),
 					*crcp, src, length);

 		memcpy(dest, src, length);