linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow
@ 2015-09-01  6:41 Haggai Eran
       [not found] ` <1441089671-3390-1-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Haggai Eran @ 2015-09-01  6:41 UTC (permalink / raw)
  To: Doug Ledford, Eli Cohen
  Cc: Majd Dibbiny, Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Haggai Eran

The mlx5_ib_reg_user_mr() function will attempt to call clean_mr() in
its error flow even though there is never a case where the error flow
occurs with a valid MR pointer to destroy.

Remove the clean_mr() call and the incorrect comment above it.

Fixes: b4cfe447d47b ("IB/mlx5: Implement on demand paging by adding
support for MMU notifiers")

Cc: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/mr.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 0dfd379b9bad..54a15b5d336d 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1114,19 +1114,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 	return &mr->ibmr;
 
 error:
-	/*
-	 * Destroy the umem *before* destroying the MR, to ensure we
-	 * will not have any in-flight notifiers when destroying the
-	 * MR.
-	 *
-	 * As the MR is completely invalid to begin with, and this
-	 * error path is only taken if we can't push the mr entry into
-	 * the pagefault tree, this is safe.
-	 */
-
 	ib_umem_release(umem);
-	/* Kill the MR, and return an error code. */
-	clean_mr(mr);
 	return ERR_PTR(err);
 }
 
-- 
1.7.11.2

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

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

* [PATCH] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow
       [not found] ` <1441089671-3390-1-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-09-01  6:56   ` Haggai Eran
       [not found]     ` <1441090616-20640-1-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Haggai Eran @ 2015-09-01  6:56 UTC (permalink / raw)
  To: Doug Ledford, Eli Cohen
  Cc: Majd Dibbiny, Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Or Gerlitz, Haggai Eran

The mlx5_ib_reg_user_mr() function will attempt to call clean_mr() in
its error flow even though there is never a case where the error flow
occurs with a valid MR pointer to destroy.

Remove the clean_mr() call and the incorrect comment above it.

Fixes: b4cfe447d47b ("IB/mlx5: Implement on demand paging by adding
support for MMU notifiers")
Cc: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
A quick resend without spaces between the Fixes: line and the rest of the
signatures, per Or Gerlitz's request.

 drivers/infiniband/hw/mlx5/mr.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 0dfd379b9bad..54a15b5d336d 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1114,19 +1114,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 	return &mr->ibmr;
 
 error:
-	/*
-	 * Destroy the umem *before* destroying the MR, to ensure we
-	 * will not have any in-flight notifiers when destroying the
-	 * MR.
-	 *
-	 * As the MR is completely invalid to begin with, and this
-	 * error path is only taken if we can't push the mr entry into
-	 * the pagefault tree, this is safe.
-	 */
-
 	ib_umem_release(umem);
-	/* Kill the MR, and return an error code. */
-	clean_mr(mr);
 	return ERR_PTR(err);
 }
 
-- 
1.7.11.2

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

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

* Re: [PATCH] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow
       [not found]     ` <1441090616-20640-1-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-09-01  8:06       ` Sagi Grimberg
       [not found]         ` <55E55C7A.2090602-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Sagi Grimberg @ 2015-09-01  8:06 UTC (permalink / raw)
  To: Haggai Eran, Doug Ledford, Eli Cohen
  Cc: Majd Dibbiny, Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Or Gerlitz

On 9/1/2015 9:56 AM, Haggai Eran wrote:
> The mlx5_ib_reg_user_mr() function will attempt to call clean_mr() in
> its error flow even though there is never a case where the error flow
> occurs with a valid MR pointer to destroy.
>
> Remove the clean_mr() call and the incorrect comment above it.
>
> Fixes: b4cfe447d47b ("IB/mlx5: Implement on demand paging by adding
> support for MMU notifiers")
> Cc: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
> A quick resend without spaces between the Fixes: line and the rest of the
> signatures, per Or Gerlitz's request.
>
>   drivers/infiniband/hw/mlx5/mr.c | 12 ------------
>   1 file changed, 12 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index 0dfd379b9bad..54a15b5d336d 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -1114,19 +1114,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
>   	return &mr->ibmr;
>
>   error:
> -	/*
> -	 * Destroy the umem *before* destroying the MR, to ensure we
> -	 * will not have any in-flight notifiers when destroying the
> -	 * MR.
> -	 *
> -	 * As the MR is completely invalid to begin with, and this
> -	 * error path is only taken if we can't push the mr entry into
> -	 * the pagefault tree, this is safe.
> -	 */
> -
>   	ib_umem_release(umem);
> -	/* Kill the MR, and return an error code. */
> -	clean_mr(mr);
>   	return ERR_PTR(err);
>   }
>
>

Looks good,

Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow
       [not found]         ` <55E55C7A.2090602-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2015-09-03 18:43           ` Doug Ledford
  0 siblings, 0 replies; 4+ messages in thread
From: Doug Ledford @ 2015-09-03 18:43 UTC (permalink / raw)
  To: Sagi Grimberg, Haggai Eran, Eli Cohen
  Cc: Majd Dibbiny, Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Or Gerlitz

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

On 09/01/2015 04:06 AM, Sagi Grimberg wrote:
> On 9/1/2015 9:56 AM, Haggai Eran wrote:
>> The mlx5_ib_reg_user_mr() function will attempt to call clean_mr() in
>> its error flow even though there is never a case where the error flow
>> occurs with a valid MR pointer to destroy.
>>
>> Remove the clean_mr() call and the incorrect comment above it.
>>
>> Fixes: b4cfe447d47b ("IB/mlx5: Implement on demand paging by adding
>> support for MMU notifiers")
>> Cc: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>> Signed-off-by: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Thanks, applied.


-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2015-09-03 18:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-01  6:41 [PATCH] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow Haggai Eran
     [not found] ` <1441089671-3390-1-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-09-01  6:56   ` Haggai Eran
     [not found]     ` <1441090616-20640-1-git-send-email-haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-09-01  8:06       ` Sagi Grimberg
     [not found]         ` <55E55C7A.2090602-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-09-03 18:43           ` Doug Ledford

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).