Received: by 10.192.165.148 with SMTP id m20csp4184847imm; Mon, 30 Apr 2018 13:25:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZosrDNA0Txqc0ESJPeqJE/6UUF3bHJlW9ClpDfe1M/CBmpPN1J3lU+h6d8GO5scgsc4k6Qu X-Received: by 2002:a65:4309:: with SMTP id j9-v6mr10852827pgq.375.1525119901580; Mon, 30 Apr 2018 13:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525119901; cv=none; d=google.com; s=arc-20160816; b=qShJDgCFZC2kyy2FuQcwAiHKWEdqh28Bc3tS8dgbn801j7IjDm+3yi12CIQ+D+bM5o JUWpCJ44sPfXG/FKG8g0VOdkLTsiUXQUjfDLkWn5NDEFwIi/Nhas9h4cOHO2GfOvcAfT swPxBWqE/QVwdrDc8PJvsLDFK0ICp+h4sRxTaODxAFLST84Ghu0ISvhRGXXDzSyHiyW9 DsjEgNK83z2l0PJbXJVKx+aPcPdYqZhL36A0jl0Ed2wPcM4toOLfI+rmTQOWDcJbr6+2 UxAwehpA5RfZQ/BIFspKrL1eRpBbuq4igR/Nwt+OrIdvmUTc+h9dMc88nOmnSEVYZUJ0 y8pw== 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=fwsT52TDIVq8EVzS9lM2Lk02eBCKoHH+USuaI60KFsA=; b=B9cw3HazEjF7vUv+HmX1EaQnygb0hH6ugxuoBTdr/8/VZaaA0YiS4hdhcDrXxt7ogw 78VfCF4ks+rmlfgXZZKAb5ghDiGr53qgrp+P8sgDRC7e4zN11h2Xn2mdaEQooBKxH2+B cPiju3DiFazEkObh83GFTY3Hs/JvxU2Q7ZyITB+Pvq04/0Rt90KtdWqADOtR+2UrT2lc bsDOGBo/6n4EEr+4Z5ppMMin+YhoguiAMHuUSGiPRXpeMxmUZ7wLSZ79CFU3L3Jt4ZiF IVag7eRhaROMhOqAKkOyAf7RD8pR63VRmO28LDecrhkS6dS5XQ5PtPtp4nBg1xwaBsYH 8A1A== 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 l1-v6si49356pli.409.2018.04.30.13.24.47; Mon, 30 Apr 2018 13:25:01 -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 S1756060AbeD3UXc (ORCPT + 99 others); Mon, 30 Apr 2018 16:23:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:60446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755711AbeD3T0g (ORCPT ); Mon, 30 Apr 2018 15:26:36 -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 CBDA622DC9; Mon, 30 Apr 2018 19:26:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBDA622DC9 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.9 06/61] random: fix possible sleeping allocation from irq context Date: Mon, 30 Apr 2018 12:24:09 -0700 Message-Id: <20180430183951.848308311@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430183951.312721450@linuxfoundation.org> References: <20180430183951.312721450@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.9-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 @@ -820,7 +820,7 @@ static int crng_fast_load(const char *cp } #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; @@ -841,6 +841,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