diff mbox series

[02/31] rdma/siw: call smp_mb() after mem->stag_valid = 0 in siw_invalidate_stag() too

Message ID 04384dc3dd5396ae770aebf5434810f489605c63.1620343860.git.metze@samba.org (mailing list archive)
State Changes Requested
Headers show
Series rdma/siw: fix a lot of deadlocks and use after free bugs | expand

Commit Message

Stefan Metzmacher May 6, 2021, 11:36 p.m. UTC
We already do the same in siw_mr_drop_mem().

Fixes: 2251334dcac9 ("rdma/siw: application buffer management")
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Cc: Bernard Metzler <bmt@zurich.ibm.com>
Cc: linux-rdma@vger.kernel.org
---
 drivers/infiniband/sw/siw/siw_mem.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bernard Metzler May 11, 2021, 11:31 a.m. UTC | #1
-----"Stefan Metzmacher" <metze@samba.org> wrote: -----

>To: "Bernard Metzler" <bmt@zurich.ibm.com>
>From: "Stefan Metzmacher" <metze@samba.org>
>Date: 05/07/2021 01:37AM
>Cc: linux-rdma@vger.kernel.org, "Stefan Metzmacher" <metze@samba.org>
>Subject: [EXTERNAL] [PATCH 02/31] rdma/siw: call smp_mb() after
>mem->stag_valid = 0 in siw_invalidate_stag() too
>
>We already do the same in siw_mr_drop_mem().
>
>Fixes: 2251334dcac9 ("rdma/siw: application buffer management")
>Signed-off-by: Stefan Metzmacher <metze@samba.org>
>Cc: Bernard Metzler <bmt@zurich.ibm.com>
>Cc: linux-rdma@vger.kernel.org
>---
> drivers/infiniband/sw/siw/siw_mem.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/drivers/infiniband/sw/siw/siw_mem.c
>b/drivers/infiniband/sw/siw/siw_mem.c
>index 61c17db70d65..8596ce1ef5a3 100644
>--- a/drivers/infiniband/sw/siw/siw_mem.c
>+++ b/drivers/infiniband/sw/siw/siw_mem.c
>@@ -309,6 +309,8 @@ int siw_invalidate_stag(struct ib_pd *pd, u32
>stag)
> 	 * state if invalidation is requested. So no state check here.
> 	 */
> 	mem->stag_valid = 0;
>+	/* make STag invalid visible asap */
>+	smp_mb();
> 
> 	siw_dbg_pd(pd, "STag 0x%08x now invalid\n", stag);
> out:
>-- 
>2.25.1
>
>
makes sense, thanks.

Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c
index 61c17db70d65..8596ce1ef5a3 100644
--- a/drivers/infiniband/sw/siw/siw_mem.c
+++ b/drivers/infiniband/sw/siw/siw_mem.c
@@ -309,6 +309,8 @@  int siw_invalidate_stag(struct ib_pd *pd, u32 stag)
 	 * state if invalidation is requested. So no state check here.
 	 */
 	mem->stag_valid = 0;
+	/* make STag invalid visible asap */
+	smp_mb();
 
 	siw_dbg_pd(pd, "STag 0x%08x now invalid\n", stag);
 out: