linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-next] RDMA/rxe: Fix memory allocation while locked
@ 2021-08-13 21:06 Bob Pearson
  2021-08-19 23:25 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Pearson @ 2021-08-13 21:06 UTC (permalink / raw)
  To: jgg, zyjzyj2000, dan.carpenter, linux-rdma; +Cc: Bob Pearson

rxe_mcast_add_grp_elem() in rxe_mcast.c calls rxe_alloc() while holding
spinlocks which in turn calls kzalloc(size, GFP_KERNEL) which is incorrect.
This patch replaces rxe_alloc() by rxe_alloc_locked() which uses GFP_ATOMIC.
This bug was caused by the below mentioned commit and failing to handle the
need for the atomic allocate.

Fixes: 4276fd0dddc9 ("Remove RXE_POOL_ATOMIC")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_mcast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_mcast.c b/drivers/infiniband/sw/rxe/rxe_mcast.c
index 0ea9a5aa4ec0..1c1d1b53312d 100644
--- a/drivers/infiniband/sw/rxe/rxe_mcast.c
+++ b/drivers/infiniband/sw/rxe/rxe_mcast.c
@@ -85,7 +85,7 @@ int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
 		goto out;
 	}
 
-	elem = rxe_alloc(&rxe->mc_elem_pool);
+	elem = rxe_alloc_locked(&rxe->mc_elem_pool);
 	if (!elem) {
 		err = -ENOMEM;
 		goto out;
-- 
2.30.2


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

* Re: [PATCH for-next] RDMA/rxe: Fix memory allocation while locked
  2021-08-13 21:06 [PATCH for-next] RDMA/rxe: Fix memory allocation while locked Bob Pearson
@ 2021-08-19 23:25 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2021-08-19 23:25 UTC (permalink / raw)
  To: Bob Pearson; +Cc: zyjzyj2000, dan.carpenter, linux-rdma

On Fri, Aug 13, 2021 at 04:06:26PM -0500, Bob Pearson wrote:
> rxe_mcast_add_grp_elem() in rxe_mcast.c calls rxe_alloc() while holding
> spinlocks which in turn calls kzalloc(size, GFP_KERNEL) which is incorrect.
> This patch replaces rxe_alloc() by rxe_alloc_locked() which uses GFP_ATOMIC.
> This bug was caused by the below mentioned commit and failing to handle the
> need for the atomic allocate.
> 
> Fixes: 4276fd0dddc9 ("Remove RXE_POOL_ATOMIC")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_mcast.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc, thanks

Jason

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

end of thread, other threads:[~2021-08-19 23:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 21:06 [PATCH for-next] RDMA/rxe: Fix memory allocation while locked Bob Pearson
2021-08-19 23:25 ` Jason Gunthorpe

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