mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: akpm@linux-foundation.org
Cc: davidlohr.bueso@hp.com, riel@redhat.com, walken@google.com,
	linux-kernel@vger.kernel.org,
	Sasha Levin <sasha.levin@oracle.com>
Subject: [PATCH] ipc: don't allocate with GFP_KERNEL inside rcu read lock
Date: Mon, 10 Jun 2013 12:14:30 -0400	[thread overview]
Message-ID: <1370880870-23833-1-git-send-email-sasha.levin@oracle.com> (raw)

ipc_addid() is protected by a rcu read lock, which means we can't allocate
using GFP_KERNEL inside it.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---

Another option would be to call idr_preload from outside the read lock,
but that complicates the code much more than this fix. If that's the
preferred method to fix it I can resend that solution instead.

 ipc/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/util.c b/ipc/util.c
index a746abb..00aca85 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -261,7 +261,7 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
 	if (ids->in_use >= size)
 		return -ENOSPC;
 
-	idr_preload(GFP_KERNEL);
+	idr_preload(GFP_ATOMIC);
 
 	spin_lock_init(&new->lock);
 	new->deleted = 0;
-- 
1.8.1.2


             reply	other threads:[~2013-06-10 16:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 16:14 Sasha Levin [this message]
2013-06-10 17:23 ` Davidlohr Bueso
2013-06-11 22:00   ` Andrew Morton

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=1370880870-23833-1-git-send-email-sasha.levin@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidlohr.bueso@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@redhat.com \
    --cc=walken@google.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

all inboxes | Powered by JetHome®