From: cgel.zte@gmail.com
To: manfred@colorfullife.com
Cc: stable@vger.kernel.org, akpm@linux-foundation.org, arnd@arndb.de,
cgel.zte@gmail.com, chi.minghao@zte.com.cn, dbueso@suse.de,
linux-kernel@vger.kernel.org, rdunlap@infradead.org,
shakeelb@google.com, unixbhaskar@gmail.com, vvs@virtuozzo.com,
zealci@zte.com.cn
Subject: [PATCH v2] ipc/sem: do not sleep with a spin lock held
Date: Thu, 23 Dec 2021 02:56:23 +0000 [thread overview]
Message-ID: <20211223025623.556044-1-chi.minghao@zte.com.cn> (raw)
In-Reply-To: <63840bf3-2199-3240-bdfa-abb55518b5f9@colorfullife.com>
From: Minghao Chi <chi.minghao@zte.com.cn>
We can't call kvfree() with a spin lock held, so defer it.
Fixes: fc37a3b8b438 ("[PATCH] ipc sem: use kvmalloc for sem_undo
allocation")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
changelog since v2:
+ Fixes: fc37a3b8b438 ("[PATCH] ipc sem: use kvmalloc for sem_undo
+ allocation")
ipc/sem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ipc/sem.c b/ipc/sem.c
index 6693daf4fe11..0dbdb98fdf2d 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1964,6 +1964,7 @@ static struct sem_undo *find_alloc_undo(struct
ipc_namespace *ns, int semid)
*/
un = lookup_undo(ulp, semid);
if (un) {
+ spin_unlock(&ulp->lock);
kvfree(new);
goto success;
}
@@ -1976,9 +1977,8 @@ static struct sem_undo *find_alloc_undo(struct
ipc_namespace *ns, int semid)
ipc_assert_locked_object(&sma->sem_perm);
list_add(&new->list_id, &sma->list_id);
un = new;
-
-success:
spin_unlock(&ulp->lock);
+success:
sem_unlock(sma, -1);
out:
return un;
--
2.25.1
next prev parent reply other threads:[~2021-12-23 2:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <63840bf3-2199-3240-bdfa-abb55518b5f9@colorfullife.com>
2021-12-23 2:37 ` [PATCH v2] ipc/sem: do not sleep with a spin lock held cgel.zte
2021-12-23 2:56 ` cgel.zte [this message]
2021-12-23 3:12 ` cgel.zte
2022-01-03 9:27 ` Jiri Slaby
2022-01-03 17:17 ` Manfred Spraul
2022-01-04 18:20 ` Shakeel Butt
2022-01-04 18:20 ` Shakeel Butt
2022-01-04 20:18 ` Manfred Spraul
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=20211223025623.556044-1-chi.minghao@zte.com.cn \
--to=cgel.zte@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=chi.minghao@zte.com.cn \
--cc=dbueso@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=rdunlap@infradead.org \
--cc=shakeelb@google.com \
--cc=stable@vger.kernel.org \
--cc=unixbhaskar@gmail.com \
--cc=vvs@virtuozzo.com \
--cc=zealci@zte.com.cn \
/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;
as well as URLs for NNTP newsgroup(s).