Received: by 10.192.165.148 with SMTP id m20csp4156880imm; Mon, 30 Apr 2018 12:51:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoiPFTKR6jFyGytpeVg71UJ3ErbOxRzTdK5t4uL8kSVAFjLcos8OMG8Kv3QewZJ6q4EpmQT X-Received: by 10.98.15.23 with SMTP id x23mr13208725pfi.3.1525117904587; Mon, 30 Apr 2018 12:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525117904; cv=none; d=google.com; s=arc-20160816; b=qEdw14KJe1Bb1BwYYLk3OoYuMc12H8DqzWem1C/g62/BpTgbl72cTcu5zCy4408Sjq AvHfcDc2RobPGzl/tDwuqiMAR5ScafiWnwy4bNiY6G/AnU62/dU3Kv24+UDLiJNLDnOe J3RAafL1ap375SPhYk5N5qZl3Kn5NJDIM3Ukh81VhfQDSKU+saub0oHR+Q57PtiQMFKY 30vYOclJ2OP4o3nYywbEv0PfG1ehyH4UBZJS4kJlG/FsZ7cTOfMMFypIOCZrW6y1SSjC HFXetJDkCuYqxUvvpbJZtUYBB3ocTI+6N8KDOyRK+IBfZPKJMbDQRrgVHm/e780Kt3+b JDKw== 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=eOOeAfLn++5JdNJeV7M5bJQziBRaZDFHlr1P+1K+DxE=; b=kGFWru23NbrvPy8hbdoZV2gLv1MNL19To5e9gA8pxKFd12nw9R1snItOkTr3ANmm39 v3kF4CSP3Z0RKPiwzCTosXjIGqyV0ohXuRwctUUPHMIzEiIJWMyDZ+zhHKsCx1JnVA/0 +XbV+wfm5N0fEkSzzF6xKgQNNYPP1IHijuOvKmrFR9hCymEh8TaX6gWjF2iXJYCsss4k NsodM460vpCs4QRpNw4fxdBRrjzs99fAUUkZkVvlqpfz2WpDn6CuPOhGKv2o4g7XJQK1 STVi2uKBtkDFz9/OYsWuaem+UaLKRNzOXG4AM49fZXFtK/BZ1HDVUogwQdE4lz8SWa3E V5ew== 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 v123si8063031pfc.273.2018.04.30.12.51.30; Mon, 30 Apr 2018 12:51:44 -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 S1756369AbeD3Tt1 (ORCPT + 99 others); Mon, 30 Apr 2018 15:49:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:35612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756216AbeD3T2L (ORCPT ); Mon, 30 Apr 2018 15:28:11 -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 1839922DAC; Mon, 30 Apr 2018 19:28:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1839922DAC 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.16 007/113] random: fix possible sleeping allocation from irq context Date: Mon, 30 Apr 2018 12:23:38 -0700 Message-Id: <20180430184015.381778399@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@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.16-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