linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/siw: Fix missing permission check in user buffer registration
@ 2022-12-16 18:32 Bernard Metzler
  2022-12-16 18:34 ` Jason Gunthorpe
  0 siblings, 1 reply; 9+ messages in thread
From: Bernard Metzler @ 2022-12-16 18:32 UTC (permalink / raw)
  To: linux-rdma; +Cc: jgg, leonro, David.Laight, Bernard Metzler

User communication buffer registration lacks check of access
rights for provided address range. Using pin_user_pages_fast()
instead of pin_user_pages() during user page pinning implicitely
introduces the necessary check. It furthermore tries to avoid
grabbing the mmap_read_lock.

Fixes: 2251334dcac9 ("rdma/siw: application buffer management")
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
---
 drivers/infiniband/sw/siw/siw_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c
index b2b33dd3b4fa..ba28a5d94fc1 100644
--- a/drivers/infiniband/sw/siw/siw_mem.c
+++ b/drivers/infiniband/sw/siw/siw_mem.c
@@ -423,8 +423,8 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable)
 		while (nents) {
 			struct page **plist = &umem->page_chunk[i].plist[got];
 
-			rv = pin_user_pages(first_page_va, nents, foll_flags,
-					    plist, NULL);
+			rv = pin_user_pages_fast(first_page_va, nents,
+						 foll_flags, plist);
 			if (rv < 0)
 				goto out_sem_up;
 
-- 
2.32.0


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

end of thread, other threads:[~2023-01-03 16:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-16 18:32 [PATCH] RDMA/siw: Fix missing permission check in user buffer registration Bernard Metzler
2022-12-16 18:34 ` Jason Gunthorpe
2022-12-16 20:11   ` Bernard Metzler
2022-12-16 20:12     ` Jason Gunthorpe
2022-12-20 13:52       ` Bernard Metzler
2023-01-03 13:07         ` Jason Gunthorpe
2023-01-03 14:11           ` Bernard Metzler
2023-01-03 14:15             ` Jason Gunthorpe
2023-01-03 16:19               ` Bernard Metzler

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