All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe()
@ 2021-06-25 13:03 Dan Carpenter
  2021-06-25 13:11 ` Majd Dibbiny
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dan Carpenter @ 2021-06-25 13:03 UTC (permalink / raw)
  To: Zhu Yanjun, Bob Pearson
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, kernel-janitors

This error path needs to unlock before returning.

Fixes: ec0fa2445c18 ("RDMA/rxe: Fix over copying in get_srq_wqe")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I'm sort of surprised this one wasn't caught in testing...

 drivers/infiniband/sw/rxe/rxe_resp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 72cdb170b67b..3743dc39b60c 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -314,6 +314,7 @@ static enum resp_states get_srq_wqe(struct rxe_qp *qp)
 
 	/* don't trust user space data */
 	if (unlikely(wqe->dma.num_sge > srq->rq.max_sge)) {
+		spin_unlock_bh(&srq->rq.consumer_lock);
 		pr_warn("%s: invalid num_sge in SRQ entry\n", __func__);
 		return RESPST_ERR_MALFORMED_WQE;
 	}
-- 
2.30.2


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

* Re: [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe()
  2021-06-25 13:03 [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe() Dan Carpenter
@ 2021-06-25 13:11 ` Majd Dibbiny
  2021-06-25 14:32 ` Bob Pearson
  2021-06-25 15:03 ` Jason Gunthorpe
  2 siblings, 0 replies; 5+ messages in thread
From: Majd Dibbiny @ 2021-06-25 13:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Zhu Yanjun, Bob Pearson, Doug Ledford, Jason Gunthorpe,
	linux-rdma, kernel-janitors


> On Jun 25, 2021, at 4:03 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> This error path needs to unlock before returning.
> 
> Fixes: ec0fa2445c18 ("RDMA/rxe: Fix over copying in get_srq_wqe")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Majd Dibbiny <majd@nvidia.com>
> ---
> I'm sort of surprised this one wasn't caught in testing...
> 
> drivers/infiniband/sw/rxe/rxe_resp.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
> index 72cdb170b67b..3743dc39b60c 100644
> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
> @@ -314,6 +314,7 @@ static enum resp_states get_srq_wqe(struct rxe_qp *qp)
> 
>   /* don't trust user space data */
>   if (unlikely(wqe->dma.num_sge > srq->rq.max_sge)) {
> +        spin_unlock_bh(&srq->rq.consumer_lock);
>       pr_warn("%s: invalid num_sge in SRQ entry\n", __func__);
>       return RESPST_ERR_MALFORMED_WQE;
>   }
> -- 
> 2.30.2

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

* Re: [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe()
  2021-06-25 13:03 [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe() Dan Carpenter
  2021-06-25 13:11 ` Majd Dibbiny
@ 2021-06-25 14:32 ` Bob Pearson
  2021-06-25 14:33   ` Bob Pearson
  2021-06-25 15:03 ` Jason Gunthorpe
  2 siblings, 1 reply; 5+ messages in thread
From: Bob Pearson @ 2021-06-25 14:32 UTC (permalink / raw)
  To: Dan Carpenter, Zhu Yanjun
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, kernel-janitors

On 6/25/21 8:03 AM, Dan Carpenter wrote:
> This error path needs to unlock before returning.
> 
> Fixes: ec0fa2445c18 ("RDMA/rxe: Fix over copying in get_srq_wqe")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I'm sort of surprised this one wasn't caught in testing...
> 
>  drivers/infiniband/sw/rxe/rxe_resp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
> index 72cdb170b67b..3743dc39b60c 100644
> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
> @@ -314,6 +314,7 @@ static enum resp_states get_srq_wqe(struct rxe_qp *qp)
>  
>  	/* don't trust user space data */
>  	if (unlikely(wqe->dma.num_sge > srq->rq.max_sge)) {
> +		spin_unlock_bh(&srq->rq.consumer_lock);
>  		pr_warn("%s: invalid num_sge in SRQ entry\n", __func__);
>  		return RESPST_ERR_MALFORMED_WQE;
>  	}
> 

This is correct. Thanks.
Bob Pearson 

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

* Re: [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe()
  2021-06-25 14:32 ` Bob Pearson
@ 2021-06-25 14:33   ` Bob Pearson
  0 siblings, 0 replies; 5+ messages in thread
From: Bob Pearson @ 2021-06-25 14:33 UTC (permalink / raw)
  To: Dan Carpenter, Zhu Yanjun
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, kernel-janitors

On 6/25/21 9:32 AM, Bob Pearson wrote:
> On 6/25/21 8:03 AM, Dan Carpenter wrote:
>> This error path needs to unlock before returning.
>>
>> Fixes: ec0fa2445c18 ("RDMA/rxe: Fix over copying in get_srq_wqe")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>> I'm sort of surprised this one wasn't caught in testing...
>>
>>  drivers/infiniband/sw/rxe/rxe_resp.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
>> index 72cdb170b67b..3743dc39b60c 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
>> @@ -314,6 +314,7 @@ static enum resp_states get_srq_wqe(struct rxe_qp *qp)
>>  
>>  	/* don't trust user space data */
>>  	if (unlikely(wqe->dma.num_sge > srq->rq.max_sge)) {
>> +		spin_unlock_bh(&srq->rq.consumer_lock);
>>  		pr_warn("%s: invalid num_sge in SRQ entry\n", __func__);
>>  		return RESPST_ERR_MALFORMED_WQE;
>>  	}
>>
> 
> This is correct. Thanks.
> Bob Pearson 
> 
Should say
Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>

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

* Re: [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe()
  2021-06-25 13:03 [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe() Dan Carpenter
  2021-06-25 13:11 ` Majd Dibbiny
  2021-06-25 14:32 ` Bob Pearson
@ 2021-06-25 15:03 ` Jason Gunthorpe
  2 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2021-06-25 15:03 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Zhu Yanjun, Bob Pearson, Doug Ledford, linux-rdma, kernel-janitors

On Fri, Jun 25, 2021 at 04:03:06PM +0300, Dan Carpenter wrote:
> This error path needs to unlock before returning.
> 
> Fixes: ec0fa2445c18 ("RDMA/rxe: Fix over copying in get_srq_wqe")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Majd Dibbiny <majd@nvidia.com>
> Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
> ---
> I'm sort of surprised this one wasn't caught in testing...

Probably because you have to make malformed wqe's..

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2021-06-25 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 13:03 [PATCH] RDMA/rxe: missing unlock on error in get_srq_wqe() Dan Carpenter
2021-06-25 13:11 ` Majd Dibbiny
2021-06-25 14:32 ` Bob Pearson
2021-06-25 14:33   ` Bob Pearson
2021-06-25 15:03 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.