Received: by 10.192.165.148 with SMTP id m20csp2524061imm; Sun, 22 Apr 2018 08:49:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Y+Hp+IJ4yMPgw9BqfZypsTqu5zbBMc6FzG1eBC9sXaPjeLhTFtBDfA0/WDz++5ExRq7Iy X-Received: by 10.98.149.21 with SMTP id p21mr8511238pfd.62.1524412188720; Sun, 22 Apr 2018 08:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412188; cv=none; d=google.com; s=arc-20160816; b=ekacLtUvfMo85Pw0ixa+CgUT96O9jqX4wCHPYvv4bKHAOoUSnblAaDeIGj9vjWhUbp N+7OZVLEYYJsFIciOkjBMlwvTszByl/urV4J865mRNlRdKukzgtLHZjdvk1KMcDn/LHm zZZTDwrkmmS/9r8OxWavNlMLxCs1R004fVPAukP1wPm7MPn38xGFxzES60BnVjQ6NPoL FglXP0jq8fbldVRc3CPSZKgxefvIQl6g/eofB35VS1iQ+XJaaJi5RkG5M5bUxInv6fUy p7vplA90SUdtWTJ129MA8lSF107V9D1Ac3z8J56q+MsDuYSHVp5c3vPLYk8DVGzXa3ck +8ZQ== 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 :arc-authentication-results; bh=pxhDh2TKOouIfvlNJ3tXa0esNlQ8ljQeUNc2S6QUZ0A=; b=SBpnmnWpzPmt6KGze300KHkpQZLdO6Ap0Ajjf+Fo9uhipR/f7J6nnQAp1QPBK8bWFV tTMKw5wXV3ZVX3dOgg+SxX7VnQDjxG5hFvu9NoSmIgnH+3b9SGQHdZaj95undOIO+eCB SV85hiJCVmqbrAYf2FImYochc5Mmu2ISNya/rcY+bEaltIj/jfgwG4hFQMs7LeEdDaTy FmYHYpsx5OoCdAHhGTU0WYge4CCPHijGfrYFK0yqruz287B+ov1VIaCc4RxjBTjV3Edn nKevjaOhpAP653ZpRstXQ17pNr/NaLMhw3tp7voAMeu0E0V7MnszR5NTck4NNK5VH0vo jZUQ== 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 c10-v6si10443603plr.398.2018.04.22.08.49.34; Sun, 22 Apr 2018 08:49:48 -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 S1753732AbeDVOBw (ORCPT + 99 others); Sun, 22 Apr 2018 10:01:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48112 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752473AbeDVOBs (ORCPT ); Sun, 22 Apr 2018 10:01:48 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 68C77BC8; Sun, 22 Apr 2018 14:01:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Theodore Tso , stable@kernel.org Subject: [PATCH 4.16 166/196] random: crng_reseed() should lock the crng instance that it is modifying Date: Sun, 22 Apr 2018 15:53:06 +0200 Message-Id: <20180422135112.860567110@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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 0bb29a849a6433b72e249eea7695477b02056e94 upstream. Reported-by: Jann Horn Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly...") Cc: stable@kernel.org # 4.8+ Signed-off-by: Theodore Ts'o Reviewed-by: Jann Horn Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -905,7 +905,7 @@ static void crng_reseed(struct crng_stat _crng_backtrack_protect(&primary_crng, buf.block, CHACHA20_KEY_SIZE); } - spin_lock_irqsave(&primary_crng.lock, flags); + spin_lock_irqsave(&crng->lock, flags); for (i = 0; i < 8; i++) { unsigned long rv; if (!arch_get_random_seed_long(&rv) && @@ -915,7 +915,7 @@ static void crng_reseed(struct crng_stat } memzero_explicit(&buf, sizeof(buf)); crng->init_time = jiffies; - spin_unlock_irqrestore(&primary_crng.lock, flags); + spin_unlock_irqrestore(&crng->lock, flags); if (crng == &primary_crng && crng_init < 2) { invalidate_batched_entropy(); numa_crng_init();