Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp892980yba; Thu, 18 Apr 2019 11:19:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOdGKbYfeKBF1NlhS+4Rs60wkdBzUciUobVj5fpkopTZ9FwtlEsvi4Ma3sVLD5he7W1yhi X-Received: by 2002:a65:638f:: with SMTP id h15mr83890827pgv.147.1555611569540; Thu, 18 Apr 2019 11:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611569; cv=none; d=google.com; s=arc-20160816; b=g2NeSV7bf4lBP6IOoppFDVgk9wh8I6nqw5v+O9mJz4U9ztQ85+lSofAb3rfhws1d5y Y7Bc+lbFcpx5NEIbPQKoe8obnMCjjydMFQimeHlV2O7dP2Z6bzNwuqTH8YF9ep6wOxbt bRaBwmTxg3SnzgiswqMDJGkkjd9gnL8dwigtqxamhai2ZZakDu1OwaoGsEqhIlSSITfs P9L5zBib7QSBLRM+B3Y4GTDKXRj3i+QRH/0JPNSpSGdYdK3d60S693ALjT3+LCcVzy14 lF5BYzTEtZPmsSk+4I/nXKJHOphzOh3uPmZ0YoS5LD1IrF2O3Baeuas0P+UgB09dQyfl 1hvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AHBIGdJP7irT17fEfzULA3oxvbl52m1+ehQtPHIPnmI=; b=dIH3m+GVUHA20EinkcIaWpXqOCnRBDFItXWb4ps5szjMth3ADWUYaxl6fzZydszLa9 XMUHFFZweEE6K4Z3CgTYQw+pLiRG8CgZM22BQfv+aW1E7n7zpZyFqVorLDsbIhJDQJmZ RzZLakQlFj0fbWnO/Aeks3wB9ULAMo4i39N/93WTrSPOzkzOy34KLxPfx3FN1tncPdOj mVJ3AQanW32PXEAedYvjJsgv+YRWE33Y9SXV4OOwIwWcajbRvzH1pOZ0m9blzFepj7Jw cC7xvIzvv+Q9Jh7l8MtZaOMQYQitT+m8/6Cr+TZ3ckDndeagRZslBJBvyEJ5je06af6y fnOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GPhVQiWU; 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 r75si3012690pfa.10.2019.04.18.11.19.14; Thu, 18 Apr 2019 11:19:29 -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; dkim=pass header.i=@kernel.org header.s=default header.b=GPhVQiWU; 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 S2391783AbfDRSLI (ORCPT + 99 others); Thu, 18 Apr 2019 14:11:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:43112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391278AbfDRSLE (ORCPT ); Thu, 18 Apr 2019 14:11:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 2DD8A20652; Thu, 18 Apr 2019 18:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611063; bh=f66SDBxJ92CaD4EXd4mkVOlyCUadXdzmnULD5beLgtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GPhVQiWUksj0DUGX5NEiIN5ffUYF9X4Im3B/n7mfvW7fuabLcuaKAb8qqKhk9ABdN DCFooytcPgJxMu64tfxkD+i5dt+k/fDahHLg5JoyuNmKNbEOE4W81g3mrzMVSrCy1X ANDGMgGTVx+p234glJFtFCuNiorBzoL612rxK4G8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Khlebnikov , "Peter Zijlstra (Intel)" , Tejun Heo , Andy Lutomirski , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Johannes Weiner , Li Zefan , Linus Torvalds , Rik van Riel , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 5.0 28/93] sched/core: Fix buffer overflow in cgroup2 property cpu.max Date: Thu, 18 Apr 2019 19:57:06 +0200 Message-Id: <20190418160439.740438937@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 4c47acd824aaaa8fc6dc519fb4e08d1522105b7a ] Add limit into sscanf format string for on-stack buffer. Signed-off-by: Konstantin Khlebnikov Signed-off-by: Peter Zijlstra (Intel) Acked-by: Tejun Heo Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: H. Peter Anvin Cc: Johannes Weiner Cc: Li Zefan Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Fixes: 0d5936344f30 ("sched: Implement interface for cgroup unified hierarchy") Link: https://lkml.kernel.org/r/155189230232.2620.13120481613524200065.stgit@buzz Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 01a2489de94e..62cc29364fba 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6942,7 +6942,7 @@ static int __maybe_unused cpu_period_quota_parse(char *buf, { char tok[21]; /* U64_MAX */ - if (!sscanf(buf, "%s %llu", tok, periodp)) + if (sscanf(buf, "%20s %llu", tok, periodp) < 1) return -EINVAL; *periodp *= NSEC_PER_USEC; -- 2.19.1