Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6030462iog; Thu, 23 Jun 2022 09:55:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s9Goz+TvoOb8lpM2ZlZ9hgTT08SJ6sdVQbal06ZJBp2iQUryLIEFLbJ5nLKN1h+bI4Awyw X-Received: by 2002:a17:907:7f9e:b0:711:d84d:408 with SMTP id qk30-20020a1709077f9e00b00711d84d0408mr9011588ejc.17.1656003307565; Thu, 23 Jun 2022 09:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656003307; cv=none; d=google.com; s=arc-20160816; b=Wax6TN7nlMuiRHZd8cuKsufbhq/8td/2jH3MZz1EAUQhV5NRAnuF+nZlR8C/1AvpmW w+0NbX8XYl16Vyj09R3oJGUqU6xUK6lH3kX4EdXb25XsBXAR6fBQZ7RbY/7NTbGTnJmH /6V2Kg+T7Zh/fzgyTzrfl7zLxBtNpvoBh2p33AILnMbW1k66vOMrG9lVTQY+vSpjI9zb 3KdObEHPyYa+cauqllS34Vb4nHsD2NW1JZe13foFu0qaf8gOf86fiWeyS3AayEJBMvZx Qirxy3IdD1gVRlG6lUcYTEWzOaT+Z0d7H/nDkKKyLxXIKOixHVHbFkToKWgQkhnAno63 i+4w== 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=a/PBGAINvhR7AIceLtH9Dw3J21nDUGjSVocx6oi1w5g=; b=n5TlWBgy8zRqT+LuNCW9eRqu0nrxSpeELBuOBe6mqx0/0p0NTW4kchdkXyYNROeelQ QUizs25hQLDYWIfx5mnGj3rv0P8MqQXDNdjdW1VLTviJdTeYtTXAdRFzvWHEx43qjBWX CQq/RLfBDDIOBP55wosgaHvL8nlUkuW5tYWkWbBUUyTO1sXdNPvC11VMtuq9lCI25Z7A gEG3YJjcJrwhAcHaT75kryxU1GWXgLha9h+S+t69Rtac1uDJP6BJdqpmzqz54/AxZE1I QyKZR7ovqvcdv8atz9bDOZ5/nnXTFVrqhn/e+imZ8q4q1K2/1Qvz430/Ny8DJOk6JdE2 OPHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dJRTnd3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a170906104600b00722e541f5c7si8563801ejj.605.2022.06.23.09.54.42; Thu, 23 Jun 2022 09:55:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dJRTnd3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232500AbiFWQqr (ORCPT + 99 others); Thu, 23 Jun 2022 12:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232450AbiFWQqL (ORCPT ); Thu, 23 Jun 2022 12:46:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62AF648899; Thu, 23 Jun 2022 09:46:07 -0700 (PDT) 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 ED52761F99; Thu, 23 Jun 2022 16:46:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB2B9C3411B; Thu, 23 Jun 2022 16:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656002766; bh=zfjYakhufALYOcCw1/8OMrfMmpo4S54sJyp1TLq0JQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJRTnd3kWZgHeyzyXfJ1k+BhignxF2tnOlsRpCUIgY8kOQGe8rxXbMAwV6nRggC7k B8AvFIf1NTWBeC1t3ipD4ZTipqmoXZ8f3i1i1SVjfSy//OAgxAT/SUePuUtdfRi6np taN0yfkPSvSQwJwgVdmbAz4tNTm83uFn7J94HhyQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa , syzbot+9de458f6a5e713ee8c1a@syzkaller.appspotmail.com, Theodore Tso Subject: [PATCH 4.9 019/264] random: fix possible sleeping allocation from irq context Date: Thu, 23 Jun 2022 18:40:12 +0200 Message-Id: <20220623164344.609507273@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@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=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Theodore Ts'o commit 6c1e851c4edc13a43adb3ea4044e3fc8f43ccf7d upstream. We can do a sleeping allocation from an irq context when CONFIG_NUMA is enabled. Fix this by initializing the NUMA crng instances in a workqueue. Reported-by: Tetsuo Handa Reported-by: syzbot+9de458f6a5e713ee8c1a@syzkaller.appspotmail.com Fixes: 8ef35c866f8862df ("random: set up the NUMA crng instances...") Cc: stable@vger.kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -800,7 +800,7 @@ static void crng_initialize(struct crng_ } #ifdef CONFIG_NUMA -static void numa_crng_init(void) +static void do_numa_crng_init(struct work_struct *work) { int i; struct crng_state *crng; @@ -821,6 +821,13 @@ static void numa_crng_init(void) kfree(pool); } } + +static DECLARE_WORK(numa_crng_init_work, do_numa_crng_init); + +static void numa_crng_init(void) +{ + schedule_work(&numa_crng_init_work); +} #else static void numa_crng_init(void) {} #endif