linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org,
	bvanassche@acm.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH for-next v2 2/5] RDMA/rxe: Fix memory allocation while locked
Date: Wed,  8 Sep 2021 00:29:25 -0500	[thread overview]
Message-ID: <20210908052928.17375-3-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20210908052928.17375-1-rpearsonhpe@gmail.com>

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>
---
v2:
  rebase on version 5.14

 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


  parent reply	other threads:[~2021-09-08  5:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08  5:29 [PATCH for-next 0/5] RDMA/rxe: Various bug fixes Bob Pearson
2021-09-08  5:29 ` [PATCH for-next v2 1/5] RDMA/rxe: Add memory barriers to kernel queues Bob Pearson
2021-09-08  5:29 ` Bob Pearson [this message]
2021-09-08  5:29 ` [PATCH for-next 3/5] RDMA/rxe: Separate HW and SW l/rkeys Bob Pearson
2021-09-08  5:29 ` [PATCH for-next 4/5] RDMA/rxe: Create duplicate mapping tables for FMRs Bob Pearson
2021-09-08  5:29 ` [PATCH for-next 5/5] RDMA/rxe: Cleanup MR status and type enums Bob Pearson
2021-09-09  3:52 ` [PATCH for-next 0/5] RDMA/rxe: Various bug fixes Bart Van Assche
2021-09-09 20:58   ` Bob Pearson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210908052928.17375-3-rpearsonhpe@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=bvanassche@acm.org \
    --cc=dan.carpenter@oracle.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=zyjzyj2000@gmail.com \
    --subject='Re: [PATCH for-next v2 2/5] RDMA/rxe: Fix memory allocation while locked' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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