Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1782009pxb; Wed, 9 Feb 2022 04:30:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIjGxtJWVK152738zRDEHUkqXXvTQdu3rdd5nGTKBFf2rD7V1F0tpVu6PqqG1czhngrpIZ X-Received: by 2002:a17:90b:3cf:: with SMTP id go15mr2228173pjb.223.1644409810470; Wed, 09 Feb 2022 04:30:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644409810; cv=none; d=google.com; s=arc-20160816; b=jPOAPhcskeuK2pIRnUyEk44w7kSKI1/H70TkDnLKQvDEzTI2Vrr1elG6Sz1IkDxuFn sP9S+eXOtDh20QDPXd1zkMgm7fcScHiUq8WBsFTtFUwe8rc3Yb5jiFKifmh3ZsJ8hMqf vPHNXWqv2fkxsIlhfwA0E/dbBHGHlTmNGdDzcJb9y6Mx9YK2LlCrr/Zhe0vlJ2umA6zn d7halJSmh0dX2HwT1gCxOSg3n3fJwZQLOs5FU6e0U0AlKTH7Jr9JTjQ+AM/NON09Hz+/ bqUQsBkxdnDUiHQd1tSjO8gP3LqvmywngtIeixq0xzOPUbb200cZJhOPiKSRvbXDmP1h SGGg== 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=0HsxEyOsGoEvBljkDwWiO/70to26w7+jTkTjGBn0nljPh47wBxSIrxolHb8k50SW90 b1dNaXSqZ5cufQA30ZexpboUqc7XMRcitOQFn88BgAbUq+zKLq5MfvDTyxTeDj7t1FXL 2eLGc5lUHuz+ae7KV+o4fiyLI6nje6wQgAxDVu0FJY+vnHwW3eGxPoZBeQ4WmBjlWXiM CgKc7BwhSvWePggaLJOkvsJOcA7aCmEcznhecFXk7nNiTqI7E7KLs8+FtTByB5iZ1hB7 0tdjTWux3kuc57JIdWQ4rAqoKJDUdKDmt2P6Y54a9TMAZjBkcD0hapONywL4F5SrROA1 0LHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D1QCKwMv; 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 bg8si14519957plb.586.2022.02.09.04.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:30:10 -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=D1QCKwMv; 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 8D21BE0CE74B; Wed, 9 Feb 2022 02:19:58 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386172AbiBGLdv (ORCPT + 99 others); Mon, 7 Feb 2022 06:33:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234936AbiBGLZC (ORCPT ); Mon, 7 Feb 2022 06:25:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32FCEC043189; Mon, 7 Feb 2022 03:25:01 -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 dfw.source.kernel.org (Postfix) with ESMTPS id BCDE76077B; Mon, 7 Feb 2022 11:25:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69A43C004E1; Mon, 7 Feb 2022 11:24:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233100; bh=UBUGUaJZe93yLz+nk7Ton8WJCc+VGhP2Z/SUcF67TSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1QCKwMvqrqOY0PBmIDwvsgpmfBWF561OZJGbdMc+oizXCQ/u/1+F/GKaVoqbI2VB Z5WGPTW8JfAp+GA9nrVU9z4Ai28ziNIDvL6IFZ+oWrQueZuwplzPzJzG5ykmS2sJEd MGrZQV7D45NGNmhtx8xUC8YbdneSCOX2cH46DXMQ= 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.15 004/110] ipc/sem: do not sleep with a spin lock held Date: Mon, 7 Feb 2022 12:05:37 +0100 Message-Id: <20220207103802.427673715@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103802.280120990@linuxfoundation.org> References: <20220207103802.280120990@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;