Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp664138pxv; Thu, 15 Jul 2021 12:51:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWPK9dXM3Om7MEvrALMhGO/uN/fYERiaszCinqR220WpyzLovKDzUbJ8ZADmKOa8j8/voz X-Received: by 2002:a17:906:58c9:: with SMTP id e9mr7349165ejs.144.1626378706993; Thu, 15 Jul 2021 12:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378706; cv=none; d=google.com; s=arc-20160816; b=dbqNwOzVUalCpbO7yo3x5/RX41iwg9ru6C/UbHftfXvfRbi6zaV/tyu4+sQsYvFeOV UjBsczRtA5/OKcQTtvLku0ccgda8mOpCjVK6rGvVA7fELquCfsG7GXt5lH3eyi11Qel8 Js9aLfF47EPHbkyndc5sJrncJG3BGFpe0M0xVOv4xOjCHJ5biC/X465sC9knDzuXWzm6 Gq3EWekfWJRGFn+R8wSfWbJB7xP/jBgxhj9SL6kxVP0lU+5JqHG/ZlSf/K7arILIs6Sw 3SjY0PzSHrFB7RkNPCDwj9R83wiajfRecXzypVzOo8BBN0hkpiOABrR4Jf+LWsskeirt cQtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FMrOGE8rqLc5eWB/7MotYWv8XdcDHuwRIywdASj/Rvc=; b=jA8z4MYz+Nfa2m3tgG/f0DAYtiW1jrYTQJKgZzUPMRvrTtHieXv+FJkMSMGtj2Kp9W Ax3J7zRbijcJ97f4nNqK6X3kMLatEMx/uA9nrWU7tFljEOsJil9UiehfDRJ/UpNKWbUE D6c5870dOohC77X59Pi8e6z88wSWGkHKyOMMADv0+5pDYywDvGAqJRD9zrgob4Z3rQQe BjPupm4yapK6nWePeRb61QE68xJw9QGgTay22OwRa49+6qZ3z6CdHiOG91uoQ/FPCxZy sWuh8tRk3szFnRR41psTMLElwFrQFGcJbd7wg/fcaBOhqPe5GgDxPeJ6muoTXYQzyW86 DoUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I92hrAo5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo20si9493254edb.17.2021.07.15.12.51.23; Thu, 15 Jul 2021 12:51:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I92hrAo5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244587AbhGOTxS (ORCPT + 99 others); Thu, 15 Jul 2021 15:53:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:58676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244985AbhGOTTG (ORCPT ); Thu, 15 Jul 2021 15:19:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 36BE0613CF; Thu, 15 Jul 2021 19:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376421; bh=YuweoZV+Q0HO9FtsgisyhkUx55eopAuEa8pRRSusLlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I92hrAo5VmU3eWv1EaaoAwYhXtbQC5F1QXdDXbkIA4+G5dYDxJaWvHKj/48P4vB5z ddBnvuLq/jZNOIBki2+EfYmkgPJngXttj/E88xhx8eEJDyqR9uJ5CMxPmhd1QUDtpK In43M1FgAuC7K0ddGR9WT3TiGjJ9s4REa6eift/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Casey Schaufler Subject: [PATCH 5.13 265/266] smackfs: restrict bytes count in smk_set_cipso() Date: Thu, 15 Jul 2021 20:40:20 +0200 Message-Id: <20210715182653.571022568@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tetsuo Handa commit 49ec114a6e62d8d320037ce71c1aaf9650b3cafd upstream. Oops, I failed to update subject line. >From 07571157c91b98ce1a4aa70967531e64b78e8346 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Mon, 12 Apr 2021 22:25:06 +0900 Subject: [PATCH 5.13 265/266] smackfs: restrict bytes count in smk_set_cipso() Commit 7ef4c19d245f3dc2 ("smackfs: restrict bytes count in smackfs write functions") missed that count > SMK_CIPSOMAX check applies to only format == SMK_FIXED24_FMT case. Reported-by: syzbot Signed-off-by: Tetsuo Handa Signed-off-by: Casey Schaufler Signed-off-by: Greg Kroah-Hartman --- security/smack/smackfs.c | 2 ++ 1 file changed, 2 insertions(+) --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -855,6 +855,8 @@ static ssize_t smk_set_cipso(struct file if (format == SMK_FIXED24_FMT && (count < SMK_CIPSOMIN || count > SMK_CIPSOMAX)) return -EINVAL; + if (count > PAGE_SIZE) + return -EINVAL; data = memdup_user_nul(buf, count); if (IS_ERR(data))