netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 9p/rdma: unmap receive dma buffer in rdma_request()
@ 2022-12-20  3:12 Zhengchao Shao
  2022-12-28  9:35 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Zhengchao Shao @ 2022-12-20  3:12 UTC (permalink / raw)
  To: v9fs-developer, netdev, ericvh, lucho, asmadeus, davem, edumazet,
	kuba, pabeni
  Cc: linux_oss, tom, weiyongjun1, yuehaibing, shaozhengchao

When down_interruptible() failed in rdma_request(), receive dma buffer
is not unmapped. Add unmap action to error path.

Fixes: fc79d4b104f0 ("9p: rdma: RDMA Transport Support for 9P")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 net/9p/trans_rdma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 83f9100d46bf..da83023fecbf 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -499,6 +499,8 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
 
 	if (down_interruptible(&rdma->sq_sem)) {
 		err = -EINTR;
+		ib_dma_unmap_single(rdma->cm_id->device, c->busa,
+				    c->req->tc.size, DMA_TO_DEVICE);
 		goto send_error;
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] 9p/rdma: unmap receive dma buffer in rdma_request()
  2022-12-20  3:12 [PATCH] 9p/rdma: unmap receive dma buffer in rdma_request() Zhengchao Shao
@ 2022-12-28  9:35 ` Leon Romanovsky
  2023-01-04  1:30   ` shaozhengchao
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2022-12-28  9:35 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: v9fs-developer, netdev, ericvh, lucho, asmadeus, davem, edumazet,
	kuba, pabeni, linux_oss, tom, weiyongjun1, yuehaibing

On Tue, Dec 20, 2022 at 11:12:23AM +0800, Zhengchao Shao wrote:
> When down_interruptible() failed in rdma_request(), receive dma buffer
> is not unmapped. Add unmap action to error path.
> 
> Fixes: fc79d4b104f0 ("9p: rdma: RDMA Transport Support for 9P")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
>  net/9p/trans_rdma.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
> index 83f9100d46bf..da83023fecbf 100644
> --- a/net/9p/trans_rdma.c
> +++ b/net/9p/trans_rdma.c
> @@ -499,6 +499,8 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
>  
>  	if (down_interruptible(&rdma->sq_sem)) {
>  		err = -EINTR;
> +		ib_dma_unmap_single(rdma->cm_id->device, c->busa,
> +				    c->req->tc.size, DMA_TO_DEVICE);
>  		goto send_error;
>  	}

It is not the only place where ib_dma_unmap_single() wasn't called.
Even at the same function if ib_post_send() fails, the unmap is not
called. Also post_recv() is missing call to ib_dma_unmap_single() too.

Thanks

>  
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 9p/rdma: unmap receive dma buffer in rdma_request()
  2022-12-28  9:35 ` Leon Romanovsky
@ 2023-01-04  1:30   ` shaozhengchao
  0 siblings, 0 replies; 3+ messages in thread
From: shaozhengchao @ 2023-01-04  1:30 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: v9fs-developer, netdev, ericvh, lucho, asmadeus, davem, edumazet,
	kuba, pabeni, linux_oss, tom, weiyongjun1, yuehaibing



On 2022/12/28 17:35, Leon Romanovsky wrote:
> On Tue, Dec 20, 2022 at 11:12:23AM +0800, Zhengchao Shao wrote:
>> When down_interruptible() failed in rdma_request(), receive dma buffer
>> is not unmapped. Add unmap action to error path.
>>
>> Fixes: fc79d4b104f0 ("9p: rdma: RDMA Transport Support for 9P")
>> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>> ---
>>   net/9p/trans_rdma.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
>> index 83f9100d46bf..da83023fecbf 100644
>> --- a/net/9p/trans_rdma.c
>> +++ b/net/9p/trans_rdma.c
>> @@ -499,6 +499,8 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req)
>>   
>>   	if (down_interruptible(&rdma->sq_sem)) {
>>   		err = -EINTR;
>> +		ib_dma_unmap_single(rdma->cm_id->device, c->busa,
>> +				    c->req->tc.size, DMA_TO_DEVICE);
>>   		goto send_error;
>>   	}
> 
> It is not the only place where ib_dma_unmap_single() wasn't called.
> Even at the same function if ib_post_send() fails, the unmap is not
> called. Also post_recv() is missing call to ib_dma_unmap_single() too.
> 
> Thanks
> 
Hi Leon:
	Thank you for your review. I'm sorry I haven't answered your
message for so long, I've got Coronavirus and it's a terrible feeling.
I will send v2 soon.

Zhengchao Shao
>>   
>> -- 
>> 2.34.1
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-04  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20  3:12 [PATCH] 9p/rdma: unmap receive dma buffer in rdma_request() Zhengchao Shao
2022-12-28  9:35 ` Leon Romanovsky
2023-01-04  1:30   ` shaozhengchao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).