Received: by 10.192.165.148 with SMTP id m20csp4177118imm; Mon, 30 Apr 2018 13:15:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrc2jtxr01OijGJsCpbuQT/p9Nihdo3TfzvBKcYtX7b/VA98xVz6NTWHTwJYLVX8YYJO8D5 X-Received: by 10.167.133.206 with SMTP id z14mr13135617pfn.2.1525119306655; Mon, 30 Apr 2018 13:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525119306; cv=none; d=google.com; s=arc-20160816; b=NaiYJQPzitz7FcHntAK7nUtZFYUBDqmngztxAapODVlx0FlVf7wrf2ValrNQ6c1A0I X9iRU9xgYpaORkKKVoNsvBxf3Haj0q256P2utrsJy2pO/OSRrCybhyVw9e9tvErhMZh5 iUFK+noCwQRof9unpTo4vX0yp1zOYyTv6795DmzAKvn7OJFyruaVFjRiMEiDPvlCHZG2 eHQ72Vu68DH73z4Ps37R7a8XZF4faBjgdGBZlsVjb0hbb5D80ks0YfiqIbyT7yChX/IN sUOJGyt9I93CwLla0L9xp/NF8EBNqkMQKdOOqHswC46N/VsReMUFSuqBl4J+AaYNIkHn /s3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=OFT7+Nn+WLRYETLFR+pXGjC8JMQm1rpPTK7X1goUXiI=; b=AO+NuCS8Jf+p634LKsv8/GP/y7l7HMt64RnKQnMdZmVLSDk1/eEDnJoLh6qqiuJEYC 4KtCWD9UMWSzGeC403qlckaiUxYE+Ht3vC5F9GuLaBTHke9ViDcJMDJ5SKICy/z6s0Qb 9BAevf4d+9SmWRTcsH1SRy41jVyKeXkCl++FhwOgvLQmrSsUkTr0BBH3AVwjy/9Vm+dP srVAUJVxwZI4lBPX5ezJjNL1p6sUU/Q0h9p/lUQfSnWUm+79VOk0srYRGOolboFM3PXY j9ouA1t1JyWLwZqcKCq1NFFIFZVCj8kS1WQYtgGw+2DFoCnVet2dyw8EQxeNvvWuOdOf ISXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w127si7529663pfd.313.2018.04.30.13.14.52; Mon, 30 Apr 2018 13:15:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932187AbeD3UNg (ORCPT + 99 others); Mon, 30 Apr 2018 16:13:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:33286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932142AbeD3T1I (ORCPT ); Mon, 30 Apr 2018 15:27:08 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2D1922DAC; Mon, 30 Apr 2018 19:27:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2D1922DAC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org 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.14 07/91] random: fix possible sleeping allocation from irq context Date: Mon, 30 Apr 2018 12:23:49 -0700 Message-Id: <20180430184004.586667586@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184004.216234025@linuxfoundation.org> References: <20180430184004.216234025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 --- drivers/char/random.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -788,7 +788,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; @@ -809,6 +809,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