diff mbox series

RDMA/rxe: Fix an error handling path in rxe_bind_mw()

Message ID 43698d8a3ed4e720899eadac887427f73d7ec2eb.1689623735.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Headers show
Series RDMA/rxe: Fix an error handling path in rxe_bind_mw() | expand

Commit Message

Christophe JAILLET July 17, 2023, 7:55 p.m. UTC
All errors go to the error handling path, except this one. Be consistent
and also branch to it.

Fixes: 02ed253770fb ("RDMA/rxe: Introduce rxe access supported flags")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
/!\ Speculative /!\

   This patch is based on analysis of the surrounding code and should be
   reviewed with care !

/!\ Speculative /!\
---
 drivers/infiniband/sw/rxe/rxe_mw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Bob Pearson July 17, 2023, 10:31 p.m. UTC | #1
On 7/17/23 14:55, Christophe JAILLET wrote:
> All errors go to the error handling path, except this one. Be consistent
> and also branch to it.
> 
> Fixes: 02ed253770fb ("RDMA/rxe: Introduce rxe access supported flags")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> /!\ Speculative /!\
> 
>    This patch is based on analysis of the surrounding code and should be
>    reviewed with care !
> 
> /!\ Speculative /!\
> ---
>  drivers/infiniband/sw/rxe/rxe_mw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c
> index d8a43d87de93..d9312b5c9d20 100644
> --- a/drivers/infiniband/sw/rxe/rxe_mw.c
> +++ b/drivers/infiniband/sw/rxe/rxe_mw.c
> @@ -199,7 +199,8 @@ int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
>  
>  	if (access & ~RXE_ACCESS_SUPPORTED_MW) {
>  		rxe_err_mw(mw, "access %#x not supported", access);
> -		return -EOPNOTSUPP;
> +		ret = -EOPNOTSUPP;
> +		goto err_drop_mr;
>  	}
>  
>  	spin_lock_bh(&mw->lock);
Christophe,
Good catch. Thanks. Probably should go to for-next.
Bob

Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
Zhu Yanjun July 17, 2023, 11:20 p.m. UTC | #2
On Tue, Jul 18, 2023 at 3:55 AM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> All errors go to the error handling path, except this one. Be consistent
> and also branch to it.
>
> Fixes: 02ed253770fb ("RDMA/rxe: Introduce rxe access supported flags")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> /!\ Speculative /!\
>
>    This patch is based on analysis of the surrounding code and should be
>    reviewed with care !
>
> /!\ Speculative /!\
> ---
>  drivers/infiniband/sw/rxe/rxe_mw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c
> index d8a43d87de93..d9312b5c9d20 100644
> --- a/drivers/infiniband/sw/rxe/rxe_mw.c
> +++ b/drivers/infiniband/sw/rxe/rxe_mw.c
> @@ -199,7 +199,8 @@ int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
>
>         if (access & ~RXE_ACCESS_SUPPORTED_MW) {
>                 rxe_err_mw(mw, "access %#x not supported", access);

https://www.kernel.org/doc/Documentation/core-api/printk-formats.rst
What is "%#x"? No such definition in the above link.
Except that, I am fine with it.

Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Zhu Yanjun

> -               return -EOPNOTSUPP;
> +               ret = -EOPNOTSUPP;
> +               goto err_drop_mr;
>         }
>
>         spin_lock_bh(&mw->lock);
> --
> 2.34.1
>
Leon Romanovsky July 18, 2023, 12:30 p.m. UTC | #3
On Mon, 17 Jul 2023 21:55:56 +0200, Christophe JAILLET wrote:
> All errors go to the error handling path, except this one. Be consistent
> and also branch to it.
> 
> 

Applied, thanks!

[1/1] RDMA/rxe: Fix an error handling path in rxe_bind_mw()
      https://git.kernel.org/rdma/rdma/c/5c719d7aef298e

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c
index d8a43d87de93..d9312b5c9d20 100644
--- a/drivers/infiniband/sw/rxe/rxe_mw.c
+++ b/drivers/infiniband/sw/rxe/rxe_mw.c
@@ -199,7 +199,8 @@  int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
 
 	if (access & ~RXE_ACCESS_SUPPORTED_MW) {
 		rxe_err_mw(mw, "access %#x not supported", access);
-		return -EOPNOTSUPP;
+		ret = -EOPNOTSUPP;
+		goto err_drop_mr;
 	}
 
 	spin_lock_bh(&mw->lock);