Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1835940pxb; Wed, 9 Feb 2022 05:37:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUXNoHNZKZhhzlyB1o42/tJ57vD2MkA2eisepN4oL3JmKWvibmpAZT58vx8hoLBO8ZxVk/ X-Received: by 2002:a62:bd0c:: with SMTP id a12mr2353893pff.26.1644413873944; Wed, 09 Feb 2022 05:37:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644413873; cv=none; d=google.com; s=arc-20160816; b=cd5anza8tdeXaIqcKeeVdXACTIyEqcqproSNWgtdVKPmnjyXa3iOuk0bQLWSvJ+7Lk kaYm4SFoC9U+1NWgDkioR1BfxLCmuU55xh65GnzVlrk/XJm+iqCvOBm0BSI2lTfhV524 GRNIBeYU4EHltOZwb1CVwJqXnyZ2k7OM1a1jTaIbHuiRRRD4AREiJ/rK39QY1fjIdbY3 6tBV8Oixdv0lA1ItV6BIhge9As8u0gYLMCxHUTsNWA4CAmCLXwA/92N8b6cGUENH4jzg BX65fGrHNIdaNov+01+Mpex+gRy2ishhbxpXkPkoaI82jSFKWJ2pBpIgYZHF8j7mgZxE r4qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i1vNXl8lifUyl8QjRPN7vmL4/erLmNuDBh6G3/Taea4=; b=ZCE+4MqRi5KSWgQL/QCwTGINameLswmbdczApkYteXEdo7L/XsMyZ1nap/zFUMutWg Pw99PDOWOFh2Nh5cYj3XMOUrYheZLBA3q4FZ99WLLshJ4iT9mRbOt0VGeuo+nydWsFyh uh3arzFj7gW8qNzX4n5G527b92xHhmwsW8vDSxK/GmtPYJ0E6OIv3HXuY/vs7TxuaAhW GZAan+u59lWNzlBFfIOcn/AClLMON1bMwTrPPBbBI6RBPURcrgYei1Tbvn9tp+EOvtGM /mY3KNPIOfrkGqZmfzwdlZGw1RfcrOFGglhU+isg2hsdInr8k7UcfDituKu/8qsYX6c/ qYUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YFvrwteB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id gp22si2062741pjb.161.2022.02.09.05.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:37:53 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YFvrwteB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F9CEE11F1A1; Wed, 9 Feb 2022 02:20:51 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388124AbiBGLnB (ORCPT + 99 others); Mon, 7 Feb 2022 06:43:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385604AbiBGLcB (ORCPT ); Mon, 7 Feb 2022 06:32:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88DD1C03E937; Mon, 7 Feb 2022 03:31:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4355BB80EC3; Mon, 7 Feb 2022 11:31:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57CB5C004E1; Mon, 7 Feb 2022 11:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233464; bh=UBUGUaJZe93yLz+nk7Ton8WJCc+VGhP2Z/SUcF67TSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFvrwteB+mdXqWaI/TEqe9p+HZVz/ssmC7faZDfiqz2w6yaAdXubolA2H6fgUqu3Z 5cNB74YztiImKAE4WdRGGT2B8eR2S/A4kPDWHx1CgghewNpGFcmFzJ82+JNRKDuyjr NQWH7NaHwj+obOgIRTqczbIAD6MoBue0dhM8lDIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Minghao Chi , Shakeel Butt , Manfred Spraul , Arnd Bergmann , Yang Guang , Davidlohr Bueso , Randy Dunlap , Bhaskar Chowdhury , Vasily Averin , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 004/126] ipc/sem: do not sleep with a spin lock held Date: Mon, 7 Feb 2022 12:05:35 +0100 Message-Id: <20220207103804.211134497@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103804.053675072@linuxfoundation.org> References: <20220207103804.053675072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minghao Chi 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 Signed-off-by: Minghao Chi Reviewed-by: Shakeel Butt Reviewed-by: Manfred Spraul Cc: Arnd Bergmann Cc: Yang Guang Cc: Davidlohr Bueso Cc: Randy Dunlap Cc: Bhaskar Chowdhury Cc: Vasily Averin Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- 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;