public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: rpearsonhpe@gmail.com
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] RDMA/rxe: Remove RXE_POOL_ATOMIC
Date: Wed, 11 Aug 2021 11:54:41 +0300	[thread overview]
Message-ID: <20210811085441.GA20866@kili> (raw)

Hello Bob Pearson,

The patch 4276fd0dddc9: "RDMA/rxe: Remove RXE_POOL_ATOMIC" from Jan
25, 2021, leads to the following
Smatch static checker warning:

	drivers/infiniband/sw/rxe/rxe_pool.c:362 rxe_alloc()
	warn: sleeping in atomic context

drivers/infiniband/sw/rxe/rxe_pool.c
    353 void *rxe_alloc(struct rxe_pool *pool)
    354 {
    355 	struct rxe_type_info *info = &rxe_type_info[pool->type];
    356 	struct rxe_pool_entry *elem;
    357 	u8 *obj;
    358 
    359 	if (atomic_inc_return(&pool->num_elem) > pool->max_elem)
    360 		goto out_cnt;
    361 
--> 362 	obj = kzalloc(info->size, GFP_KERNEL);
                                          ^^^^^^^^^^
It's possible the patch just exposed a bug instead of introducing it,
but rxe_mcast_add_grp_elem() calls rxe_alloc() with spin_locks held so
we can't sleep.

    363 	if (!obj)
    364 		goto out_cnt;
    365 
    366 	elem = (struct rxe_pool_entry *)(obj + info->elem_offset);
    367 
    368 	elem->pool = pool;
    369 	kref_init(&elem->ref_cnt);
    370 
    371 	return obj;
    372 
    373 out_cnt:
    374 	atomic_dec(&pool->num_elem);
    375 	return NULL;
    376 }

regards,
dan carpenter

             reply	other threads:[~2021-08-11  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11  8:54 Dan Carpenter [this message]
2021-08-13 19:57 ` [bug report] RDMA/rxe: Remove RXE_POOL_ATOMIC Bob Pearson
2021-08-13 19:57 ` 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=20210811085441.GA20866@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox