lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  7 Feb 2022 12:05:37 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Zeal Robot <zealci@....com.cn>,
        Minghao Chi <chi.minghao@....com.cn>,
        Shakeel Butt <shakeelb@...gle.com>,
        Manfred Spraul <manfred@...orfullife.com>,
        Arnd Bergmann <arnd@...db.de>, Yang Guang <cgel.zte@...il.com>,
        Davidlohr Bueso <dbueso@...e.de>,
        Randy Dunlap <rdunlap@...radead.org>,
        Bhaskar Chowdhury <unixbhaskar@...il.com>,
        Vasily Averin <vvs@...tuozzo.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH 5.15 004/110] ipc/sem: do not sleep with a spin lock held

From: Minghao Chi <chi.minghao@....com.cn>

commit 520ba724061cef59763e2b6f5b26e8387c2e5822 upstream.

We can't call kvfree() with a spin lock held, so defer it.

Link: https://lkml.kernel.org/r/20211223031207.556189-1-chi.minghao@zte.com.cn
Fixes: fc37a3b8b438 ("[PATCH] ipc sem: use kvmalloc for sem_undo allocation")
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
Reviewed-by: Shakeel Butt <shakeelb@...gle.com>
Reviewed-by: Manfred Spraul <manfred@...orfullife.com>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Yang Guang <cgel.zte@...il.com>
Cc: Davidlohr Bueso <dbueso@...e.de>
Cc: Randy Dunlap <rdunlap@...radead.org>
Cc: Bhaskar Chowdhury <unixbhaskar@...il.com>
Cc: Vasily Averin <vvs@...tuozzo.com>
Cc: <stable@...r.kernel.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 ipc/sem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1964,6 +1964,7 @@ static struct sem_undo *find_alloc_undo(
 	 */
 	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(
 	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;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ